Re: [Intel-wired-lan] [PATCH iwl-next] idpf: set napi for each TX and RX queue

2025-07-18 Thread Alexander Lobakin
From: Tony Nguyen 
Date: Thu, 17 Jul 2025 13:25:05 -0700

> 
> 
> On 7/16/2025 2:12 PM, Samiullah Khawaja wrote:
>> Use netif_queue_set_napi to associate TX/RX queues to the relevant napi.
>> This allows fetching napi for a TX or RX queue using netlink queue-get
>> op.
>>
>> Tested:
>> python3 tools/net/ynl/pyynl/cli.py \
>> --spec Documentation/netlink/specs/netdev.yaml \
>> --do queue-get --json '{"ifindex": 3, "type": "rx", "id": 2}'
>> {'id': 2, 'ifindex': 3, 'napi-id': 515, 'type': 'rx'}
> 
> Hi Samiullah,
> 
> Thanks for the patch. We do, however, have this functionality already in
> flight [1].

Yes, and it requires handling RTNL locks differently in several reset
and reconfig paths. Just adding netif_napi_set_*() won't work properly.

> 
> Thanks,
> Tony
> 
> [1] https://lore.kernel.org/intel-wired-lan/20250624164515.2663137-4-
> [email protected]/

Thanks,
Olek


Re: [Intel-wired-lan] [PATCH iwl-next] idpf: set napi for each TX and RX queue

2025-07-17 Thread Tony Nguyen




On 7/16/2025 2:12 PM, Samiullah Khawaja wrote:

Use netif_queue_set_napi to associate TX/RX queues to the relevant napi.
This allows fetching napi for a TX or RX queue using netlink queue-get
op.

Tested:
python3 tools/net/ynl/pyynl/cli.py \
--spec Documentation/netlink/specs/netdev.yaml \
--do queue-get --json '{"ifindex": 3, "type": "rx", "id": 2}'
{'id': 2, 'ifindex': 3, 'napi-id': 515, 'type': 'rx'}


Hi Samiullah,

Thanks for the patch. We do, however, have this functionality already in 
flight [1].


Thanks,
Tony

[1] 
https://lore.kernel.org/intel-wired-lan/[email protected]/



Signed-off-by: Samiullah Khawaja 
---
  drivers/net/ethernet/intel/idpf/idpf_txrx.c | 16 +++-
  1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c 
b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
index bf23967674d5..f01e72fb73e8 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
@@ -4373,7 +4373,7 @@ static void idpf_vport_intr_napi_add_all(struct 
idpf_vport *vport,
 struct idpf_q_vec_rsrc *rsrc)
  {
int (*napi_poll)(struct napi_struct *napi, int budget);
-   int irq_num;
+   int i, irq_num;
u16 qv_idx;
  
  	if (idpf_is_queue_model_split(rsrc->txq_model))

@@ -4390,6 +4390,20 @@ static void idpf_vport_intr_napi_add_all(struct 
idpf_vport *vport,
netif_napi_add_config(vport->netdev, &q_vector->napi,
  napi_poll, v_idx);
netif_napi_set_irq(&q_vector->napi, irq_num);
+
+   for (i = 0; i < q_vector->num_rxq; ++i) {
+   netif_queue_set_napi(vport->netdev,
+q_vector->rx[i]->idx,
+NETDEV_QUEUE_TYPE_RX,
+&q_vector->napi);
+   }
+
+   for (i = 0; i < q_vector->num_txq; ++i) {
+   netif_queue_set_napi(vport->netdev,
+q_vector->tx[i]->idx,
+NETDEV_QUEUE_TYPE_TX,
+&q_vector->napi);
+   }
}
  }
  


base-commit: 4cc8116d6c4ef909e52868c1251ed6eff8c5010b