Message ID | 20220912182829.160715-13-ioana.ciornei@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: dpaa2-eth: AF_XDP zero-copy support | expand |
Hi Ioana, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on net-next/master] url: https://github.com/intel-lab-lkp/linux/commits/Ioana-Ciornei/net-dpaa2-eth-AF_XDP-zero-copy-support/20220913-023809 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 169ccf0e40825d9e465863e4707d8e8546d3c3cb config: arm64-allmodconfig compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/aac3b456e9cc4c9b94b716c208d9ce955b37eeb8 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Ioana-Ciornei/net-dpaa2-eth-AF_XDP-zero-copy-support/20220913-023809 git checkout aac3b456e9cc4c9b94b716c208d9ce955b37eeb8 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c:1734:8: warning: variable 'page' is uninitialized when used here [-Wuninitialized] page, DPAA2_ETH_RX_BUF_RAW_SIZE, ^~~~ drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c:1681:19: note: initialize the variable 'page' to silence this warning struct page *page; ^ = NULL 1 warning generated. vim +/page +1734 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c 1670 1671 /* Perform a single release command to add buffers 1672 * to the specified buffer pool 1673 */ 1674 static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv, 1675 struct dpaa2_eth_channel *ch) 1676 { 1677 struct xdp_buff *xdp_buffs[DPAA2_ETH_BUFS_PER_CMD]; 1678 struct device *dev = priv->net_dev->dev.parent; 1679 u64 buf_array[DPAA2_ETH_BUFS_PER_CMD]; 1680 struct dpaa2_eth_swa *swa; 1681 struct page *page; 1682 dma_addr_t addr; 1683 int retries = 0; 1684 int i = 0, err; 1685 u32 batch; 1686 1687 /* Allocate buffers visible to WRIOP */ 1688 if (!ch->xsk_zc) { 1689 for (i = 0; i < DPAA2_ETH_BUFS_PER_CMD; i++) { 1690 /* Also allocate skb shared info and alignment padding */ 1691 /* There is one page for each Rx buffer. WRIOP sees 1692 * the entire page except for a tailroom reserved for 1693 * skb shared info 1694 */ 1695 page = dev_alloc_pages(0); 1696 if (!page) 1697 goto err_alloc; 1698 1699 addr = dma_map_page(dev, page, 0, priv->rx_buf_size, 1700 DMA_BIDIRECTIONAL); 1701 if (unlikely(dma_mapping_error(dev, addr))) 1702 goto err_map; 1703 1704 buf_array[i] = addr; 1705 1706 /* tracing point */ 1707 trace_dpaa2_eth_buf_seed(priv->net_dev, page_address(page), 1708 DPAA2_ETH_RX_BUF_RAW_SIZE, 1709 addr, priv->rx_buf_size, 1710 ch->bp->bpid); 1711 } 1712 } else if (xsk_buff_can_alloc(ch->xsk_pool, DPAA2_ETH_BUFS_PER_CMD)) { 1713 /* Allocate XSK buffers for AF_XDP fast path in batches 1714 * of DPAA2_ETH_BUFS_PER_CMD. Bail out if the UMEM cannot 1715 * provide enough buffers at the moment 1716 */ 1717 batch = xsk_buff_alloc_batch(ch->xsk_pool, xdp_buffs, 1718 DPAA2_ETH_BUFS_PER_CMD); 1719 if (!batch) 1720 goto err_alloc; 1721 1722 for (i = 0; i < batch; i++) { 1723 swa = (struct dpaa2_eth_swa *)(xdp_buffs[i]->data_hard_start + 1724 DPAA2_ETH_RX_HWA_SIZE); 1725 swa->xsk.xdp_buff = xdp_buffs[i]; 1726 1727 addr = xsk_buff_xdp_get_frame_dma(xdp_buffs[i]); 1728 if (unlikely(dma_mapping_error(dev, addr))) 1729 goto err_map; 1730 1731 buf_array[i] = addr; 1732 1733 trace_dpaa2_xsk_buf_seed(priv->net_dev, > 1734 page, DPAA2_ETH_RX_BUF_RAW_SIZE, 1735 addr, priv->rx_buf_size, 1736 ch->bp->bpid); 1737 } 1738 } 1739 1740 release_bufs: 1741 /* In case the portal is busy, retry until successful */ 1742 while ((err = dpaa2_io_service_release(ch->dpio, ch->bp->bpid, 1743 buf_array, i)) == -EBUSY) { 1744 if (retries++ >= DPAA2_ETH_SWP_BUSY_RETRIES) 1745 break; 1746 cpu_relax(); 1747 } 1748 1749 /* If release command failed, clean up and bail out; 1750 * not much else we can do about it 1751 */ 1752 if (err) { 1753 dpaa2_eth_free_bufs(priv, buf_array, i, ch->xsk_zc); 1754 return 0; 1755 } 1756 1757 return i; 1758 1759 err_map: 1760 if (!ch->xsk_zc) { 1761 __free_pages(page, 0); 1762 } else { 1763 for (; i < batch; i++) 1764 xsk_buff_free(xdp_buffs[i]); 1765 } 1766 err_alloc: 1767 /* If we managed to allocate at least some buffers, 1768 * release them to hardware 1769 */ 1770 if (i) 1771 goto release_bufs; 1772 1773 return 0; 1774 } 1775
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-trace.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-trace.h index 5fb5f14e01ec..9b43fadb9b11 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-trace.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-trace.h @@ -73,6 +73,14 @@ DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_fd, TP_ARGS(netdev, fd) ); +/* Tx (egress) XSK fd */ +DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_xsk_fd, + TP_PROTO(struct net_device *netdev, + const struct dpaa2_fd *fd), + + TP_ARGS(netdev, fd) +); + /* Rx fd */ DEFINE_EVENT(dpaa2_eth_fd, dpaa2_rx_fd, TP_PROTO(struct net_device *netdev, @@ -81,6 +89,14 @@ DEFINE_EVENT(dpaa2_eth_fd, dpaa2_rx_fd, TP_ARGS(netdev, fd) ); +/* Rx XSK fd */ +DEFINE_EVENT(dpaa2_eth_fd, dpaa2_rx_xsk_fd, + TP_PROTO(struct net_device *netdev, + const struct dpaa2_fd *fd), + + TP_ARGS(netdev, fd) +); + /* Tx confirmation fd */ DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_conf_fd, TP_PROTO(struct net_device *netdev, @@ -90,57 +106,81 @@ DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_conf_fd, ); /* Log data about raw buffers. Useful for tracing DPBP content. */ -TRACE_EVENT(dpaa2_eth_buf_seed, - /* Trace function prototype */ - TP_PROTO(struct net_device *netdev, - /* virtual address and size */ - void *vaddr, - size_t size, - /* dma map address and size */ - dma_addr_t dma_addr, - size_t map_size, - /* buffer pool id, if relevant */ - u16 bpid), - - /* Repeat argument list here */ - TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid), - - /* A structure containing the relevant information we want - * to record. Declare name and type for each normal element, - * name, type and size for arrays. Use __string for variable - * length strings. - */ - TP_STRUCT__entry( - __field(void *, vaddr) - __field(size_t, size) - __field(dma_addr_t, dma_addr) - __field(size_t, map_size) - __field(u16, bpid) - __string(name, netdev->name) - ), - - /* The function that assigns values to the above declared - * fields - */ - TP_fast_assign( - __entry->vaddr = vaddr; - __entry->size = size; - __entry->dma_addr = dma_addr; - __entry->map_size = map_size; - __entry->bpid = bpid; - __assign_str(name, netdev->name); - ), - - /* This is what gets printed when the trace event is - * triggered. - */ - TP_printk(TR_BUF_FMT, - __get_str(name), - __entry->vaddr, - __entry->size, - &__entry->dma_addr, - __entry->map_size, - __entry->bpid) +DECLARE_EVENT_CLASS(dpaa2_eth_buf, + /* Trace function prototype */ + TP_PROTO(struct net_device *netdev, + /* virtual address and size */ + void *vaddr, + size_t size, + /* dma map address and size */ + dma_addr_t dma_addr, + size_t map_size, + /* buffer pool id, if relevant */ + u16 bpid), + + /* Repeat argument list here */ + TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid), + + /* A structure containing the relevant information we want + * to record. Declare name and type for each normal element, + * name, type and size for arrays. Use __string for variable + * length strings. + */ + TP_STRUCT__entry( + __field(void *, vaddr) + __field(size_t, size) + __field(dma_addr_t, dma_addr) + __field(size_t, map_size) + __field(u16, bpid) + __string(name, netdev->name) + ), + + /* The function that assigns values to the above declared + * fields + */ + TP_fast_assign( + __entry->vaddr = vaddr; + __entry->size = size; + __entry->dma_addr = dma_addr; + __entry->map_size = map_size; + __entry->bpid = bpid; + __assign_str(name, netdev->name); + ), + + /* This is what gets printed when the trace event is + * triggered. + */ + TP_printk(TR_BUF_FMT, + __get_str(name), + __entry->vaddr, + __entry->size, + &__entry->dma_addr, + __entry->map_size, + __entry->bpid) +); + +/* Main memory buff seeding */ +DEFINE_EVENT(dpaa2_eth_buf, dpaa2_eth_buf_seed, + TP_PROTO(struct net_device *netdev, + void *vaddr, + size_t size, + dma_addr_t dma_addr, + size_t map_size, + u16 bpid), + + TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid) +); + +/* UMEM buff seeding on AF_XDP fast path */ +DEFINE_EVENT(dpaa2_eth_buf, dpaa2_xsk_buf_seed, + TP_PROTO(struct net_device *netdev, + void *vaddr, + size_t size, + dma_addr_t dma_addr, + size_t map_size, + u16 bpid), + + TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid) ); /* If only one event of a certain type needs to be declared, use TRACE_EVENT(). diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index ccfec7986ba1..9e29b3ed6edc 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -1729,6 +1729,11 @@ static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv, goto err_map; buf_array[i] = addr; + + trace_dpaa2_xsk_buf_seed(priv->net_dev, + page, DPAA2_ETH_RX_BUF_RAW_SIZE, + addr, priv->rx_buf_size, + ch->bp->bpid); } } diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c index 0a8cbd3fa837..7599c028fa42 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk.c @@ -113,6 +113,8 @@ static void dpaa2_xsk_rx(struct dpaa2_eth_priv *priv, void *vaddr; u32 xdp_act; + trace_dpaa2_rx_xsk_fd(priv->net_dev, fd); + vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr); percpu_stats = this_cpu_ptr(priv->percpu_stats); @@ -414,6 +416,8 @@ bool dpaa2_xsk_tx(struct dpaa2_eth_priv *priv, batch = i; break; } + + trace_dpaa2_tx_xsk_fd(priv->net_dev, &fds[i]); } /* Enqueue all the created FDs */