diff mbox series

[net-next,v2,07/15] eth: link netdev to page_pools in drivers

Message ID 20231121000048.789613-8-kuba@kernel.org (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: page_pool: add netlink-based introspection | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/codegen success Generated files up to date
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 1129 this patch: 17
netdev/cc_maintainers warning 10 maintainers not CCed: linux-rdma@vger.kernel.org haiyangz@microsoft.com wei.liu@kernel.org linux-hyperv@vger.kernel.org kys@microsoft.com michael.chan@broadcom.com saeedm@nvidia.com decui@microsoft.com leon@kernel.org jaswinder.singh@linaro.org
netdev/build_clang fail Errors and warnings before: 1155 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 1158 this patch: 19
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 29 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jakub Kicinski Nov. 21, 2023, midnight UTC
Link page pool instances to netdev for the drivers which
already link to NAPI. Unless the driver is doing something
very weird per-NAPI should imply per-netdev.

Add netsec as well, Ilias indicates that it fits the mold.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2: add netsec
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c         | 1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 1 +
 drivers/net/ethernet/microsoft/mana/mana_en.c     | 1 +
 drivers/net/ethernet/socionext/netsec.c           | 2 ++
 4 files changed, 5 insertions(+)

Comments

kernel test robot Nov. 21, 2023, 1:13 p.m. UTC | #1
Hi Jakub,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jakub-Kicinski/net-page_pool-split-the-page_pool_params-into-fast-and-slow/20231121-092240
base:   net-next/main
patch link:    https://lore.kernel.org/r/20231121000048.789613-8-kuba%40kernel.org
patch subject: [PATCH net-next v2 07/15] eth: link netdev to page_pools in drivers
config: openrisc-allmodconfig (https://download.01.org/0day-ci/archive/20231121/202311212126.kJXnPMgJ-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231121/202311212126.kJXnPMgJ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311212126.kJXnPMgJ-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/ethernet/socionext/netsec.c: In function 'netsec_setup_rx_dring':
>> drivers/net/ethernet/socionext/netsec.c:1305:25: error: incompatible types when initializing type 'struct napi_struct *' using type 'struct napi_struct'
    1305 |                 .napi = priv->napi,
         |                         ^~~~


vim +1305 drivers/net/ethernet/socionext/netsec.c

  1290	
  1291	static int netsec_setup_rx_dring(struct netsec_priv *priv)
  1292	{
  1293		struct netsec_desc_ring *dring = &priv->desc_ring[NETSEC_RING_RX];
  1294		struct bpf_prog *xdp_prog = READ_ONCE(priv->xdp_prog);
  1295		struct page_pool_params pp_params = {
  1296			.order = 0,
  1297			/* internal DMA mapping in page_pool */
  1298			.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV,
  1299			.pool_size = DESC_NUM,
  1300			.nid = NUMA_NO_NODE,
  1301			.dev = priv->dev,
  1302			.dma_dir = xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE,
  1303			.offset = NETSEC_RXBUF_HEADROOM,
  1304			.max_len = NETSEC_RX_BUF_SIZE,
> 1305			.napi = priv->napi,
  1306			.netdev = priv->ndev,
  1307		};
  1308		int i, err;
  1309	
  1310		dring->page_pool = page_pool_create(&pp_params);
  1311		if (IS_ERR(dring->page_pool)) {
  1312			err = PTR_ERR(dring->page_pool);
  1313			dring->page_pool = NULL;
  1314			goto err_out;
  1315		}
  1316	
  1317		err = xdp_rxq_info_reg(&dring->xdp_rxq, priv->ndev, 0, priv->napi.napi_id);
  1318		if (err)
  1319			goto err_out;
  1320	
  1321		err = xdp_rxq_info_reg_mem_model(&dring->xdp_rxq, MEM_TYPE_PAGE_POOL,
  1322						 dring->page_pool);
  1323		if (err)
  1324			goto err_out;
  1325	
  1326		for (i = 0; i < DESC_NUM; i++) {
  1327			struct netsec_desc *desc = &dring->desc[i];
  1328			dma_addr_t dma_handle;
  1329			void *buf;
  1330			u16 len;
  1331	
  1332			buf = netsec_alloc_rx_data(priv, &dma_handle, &len);
  1333	
  1334			if (!buf) {
  1335				err = -ENOMEM;
  1336				goto err_out;
  1337			}
  1338			desc->dma_addr = dma_handle;
  1339			desc->addr = buf;
  1340			desc->len = len;
  1341		}
  1342	
  1343		netsec_rx_fill(priv, 0, DESC_NUM);
  1344	
  1345		return 0;
  1346	
  1347	err_out:
  1348		netsec_uninit_pkt_dring(priv, NETSEC_RING_RX);
  1349		return err;
  1350	}
  1351
kernel test robot Nov. 21, 2023, 9:25 p.m. UTC | #2
Hi Jakub,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jakub-Kicinski/net-page_pool-split-the-page_pool_params-into-fast-and-slow/20231121-092240
base:   net-next/main
patch link:    https://lore.kernel.org/r/20231121000048.789613-8-kuba%40kernel.org
patch subject: [PATCH net-next v2 07/15] eth: link netdev to page_pools in drivers
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20231122/202311220437.p7reesKP-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231122/202311220437.p7reesKP-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311220437.p7reesKP-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/net/ethernet/socionext/netsec.c:1305:11: error: initializing 'struct napi_struct *' with an expression of incompatible type 'struct napi_struct'; take the address with &
                   .napi = priv->napi,
                           ^~~~~~~~~~
                           &
   1 error generated.


vim +1305 drivers/net/ethernet/socionext/netsec.c

  1290	
  1291	static int netsec_setup_rx_dring(struct netsec_priv *priv)
  1292	{
  1293		struct netsec_desc_ring *dring = &priv->desc_ring[NETSEC_RING_RX];
  1294		struct bpf_prog *xdp_prog = READ_ONCE(priv->xdp_prog);
  1295		struct page_pool_params pp_params = {
  1296			.order = 0,
  1297			/* internal DMA mapping in page_pool */
  1298			.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV,
  1299			.pool_size = DESC_NUM,
  1300			.nid = NUMA_NO_NODE,
  1301			.dev = priv->dev,
  1302			.dma_dir = xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE,
  1303			.offset = NETSEC_RXBUF_HEADROOM,
  1304			.max_len = NETSEC_RX_BUF_SIZE,
> 1305			.napi = priv->napi,
  1306			.netdev = priv->ndev,
  1307		};
  1308		int i, err;
  1309	
  1310		dring->page_pool = page_pool_create(&pp_params);
  1311		if (IS_ERR(dring->page_pool)) {
  1312			err = PTR_ERR(dring->page_pool);
  1313			dring->page_pool = NULL;
  1314			goto err_out;
  1315		}
  1316	
  1317		err = xdp_rxq_info_reg(&dring->xdp_rxq, priv->ndev, 0, priv->napi.napi_id);
  1318		if (err)
  1319			goto err_out;
  1320	
  1321		err = xdp_rxq_info_reg_mem_model(&dring->xdp_rxq, MEM_TYPE_PAGE_POOL,
  1322						 dring->page_pool);
  1323		if (err)
  1324			goto err_out;
  1325	
  1326		for (i = 0; i < DESC_NUM; i++) {
  1327			struct netsec_desc *desc = &dring->desc[i];
  1328			dma_addr_t dma_handle;
  1329			void *buf;
  1330			u16 len;
  1331	
  1332			buf = netsec_alloc_rx_data(priv, &dma_handle, &len);
  1333	
  1334			if (!buf) {
  1335				err = -ENOMEM;
  1336				goto err_out;
  1337			}
  1338			desc->dma_addr = dma_handle;
  1339			desc->addr = buf;
  1340			desc->len = len;
  1341		}
  1342	
  1343		netsec_rx_fill(priv, 0, DESC_NUM);
  1344	
  1345		return 0;
  1346	
  1347	err_out:
  1348		netsec_uninit_pkt_dring(priv, NETSEC_RING_RX);
  1349		return err;
  1350	}
  1351
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index e6ac1bd21bb3..68cf0036f867 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -3322,6 +3322,7 @@  static int bnxt_alloc_rx_page_pool(struct bnxt *bp,
 		pp.pool_size += bp->rx_ring_size;
 	pp.nid = dev_to_node(&bp->pdev->dev);
 	pp.napi = &rxr->bnapi->napi;
+	pp.netdev = bp->dev;
 	pp.dev = &bp->pdev->dev;
 	pp.dma_dir = bp->rx_dir;
 	pp.max_len = PAGE_SIZE;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 3aecdf099a2f..af5e0d3c8ee1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -902,6 +902,7 @@  static int mlx5e_alloc_rq(struct mlx5e_params *params,
 		pp_params.nid       = node;
 		pp_params.dev       = rq->pdev;
 		pp_params.napi      = rq->cq.napi;
+		pp_params.netdev    = rq->netdev;
 		pp_params.dma_dir   = rq->buff.map_dir;
 		pp_params.max_len   = PAGE_SIZE;
 
diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index fc3d2903a80f..d1adec01299c 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -2137,6 +2137,7 @@  static int mana_create_page_pool(struct mana_rxq *rxq, struct gdma_context *gc)
 	pprm.pool_size = RX_BUFFERS_PER_QUEUE;
 	pprm.nid = gc->numa_node;
 	pprm.napi = &rxq->rx_cq.napi;
+	pprm.netdev = rxq->ndev;
 
 	rxq->page_pool = page_pool_create(&pprm);
 
diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index 0891e9e49ecb..384c506bb930 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -1302,6 +1302,8 @@  static int netsec_setup_rx_dring(struct netsec_priv *priv)
 		.dma_dir = xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE,
 		.offset = NETSEC_RXBUF_HEADROOM,
 		.max_len = NETSEC_RX_BUF_SIZE,
+		.napi = priv->napi,
+		.netdev = priv->ndev,
 	};
 	int i, err;