[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240625120807.1165581-4-amcohen@nvidia.com>
Date: Tue, 25 Jun 2024 15:08:06 +0300
From: Amit Cohen <amcohen@...dia.com>
To: <kuba@...nel.org>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <pabeni@...hat.com>,
<hawk@...nel.org>, <idosch@...dia.com>, <petrm@...dia.com>,
<mlxsw@...dia.com>, <netdev@...r.kernel.org>, Amit Cohen <amcohen@...dia.com>
Subject: [PATCH RFC net-next 3/4] mlxsw: pci: Allow get page pool info/stats via netlink
Spectrum ASICs do not have queue per netdevice, so mlxsw driver does not
have NAPI per netdevice, instead "dummy" netdevice is used. Lately, the
driver started using page pool for buffers allocations, each Rx queue (RDQ)
uses a dedicated page pool.
To allow user to query page pool info and statistics, page pool should
be attached to netdevice. Setting "dummy" netdevice as part of page pool
parameters allows querying info about specific pool.
Without this patch, "do" commands fail:
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
--do page-pool-get --json '{"id" : "20"}' --output-json
Netlink error: No such file or directory
nl_len = 36 (20) nl_flags = 0x100 nl_type = 2
error: -2
With this patch, user can query info of specific pool:
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
--do page-pool-get --json '{"id" : "20"}' --output-json
{"id": 20, "ifindex": 0, "napi-id": 108, "inflight": 3072, "inflight-mem": 12582912}
Note that this behavior works only in case that the devlink instance in the
initial namespace, in case that the devlink instance is reloaded to
another namesapce, get command will fail as the dummy netdevice associated with
the pools belongs to the initial namespace.
$ ip netns add pp_test
$ devlink dev reload pci/0000:xx:00.0 netns pp_test
$ ip netns exec pp_test ./tools/net/ynl/cli.py \
--spec Documentation/netlink/specs/netdev.yaml \
--do page-pool-stats-get --json '{"info" : {"id" : "20"}}' --output-json
Netlink error: No such file or directory
nl_len = 36 (20) nl_flags = 0x100 nl_type = 2
error: -2
A next patch will allow user use "dump" command also.
Signed-off-by: Amit Cohen <amcohen@...dia.com>
---
drivers/net/ethernet/mellanox/mlxsw/pci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c
index cb043379c01c..7abb4b2fe541 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c
@@ -892,6 +892,7 @@ static int mlxsw_pci_cq_page_pool_init(struct mlxsw_pci_queue *q,
pp_params.dev = &mlxsw_pci->pdev->dev;
pp_params.napi = &q->u.cq.napi;
pp_params.dma_dir = DMA_FROM_DEVICE;
+ pp_params.netdev = q->pci->napi_dev_rx;
page_pool = page_pool_create(&pp_params);
if (IS_ERR(page_pool))
--
2.45.1
Powered by blists - more mailing lists