linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iwl-next] idpf: set napi for each TX and RX queue
@ 2025-07-16 21:12 Samiullah Khawaja
  2025-07-17 20:25 ` Tony Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Samiullah Khawaja @ 2025-07-16 21:12 UTC (permalink / raw)
  To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, intel-wired-lan
  Cc: skhawaja, willemb, almasrymina, David Decotigny, Anjali Singhai,
	Sridhar Samudrala, linux-kernel, netdev, emil.s.tantilov

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'}

Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
---
 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
-- 
2.50.0.727.gbf7dc18ff4-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH iwl-next] idpf: set napi for each TX and RX queue
  2025-07-16 21:12 [PATCH iwl-next] idpf: set napi for each TX and RX queue Samiullah Khawaja
@ 2025-07-17 20:25 ` Tony Nguyen
  2025-07-18 13:06   ` Alexander Lobakin
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Nguyen @ 2025-07-17 20:25 UTC (permalink / raw)
  To: Samiullah Khawaja, Przemek Kitszel, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, intel-wired-lan, Alexander Lobakin
  Cc: willemb, almasrymina, David Decotigny, Anjali Singhai,
	Sridhar Samudrala, linux-kernel, netdev, emil.s.tantilov



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/20250624164515.2663137-4-aleksander.lobakin@intel.com/

> Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
> ---
>   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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH iwl-next] idpf: set napi for each TX and RX queue
  2025-07-17 20:25 ` Tony Nguyen
@ 2025-07-18 13:06   ` Alexander Lobakin
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Lobakin @ 2025-07-18 13:06 UTC (permalink / raw)
  To: Tony Nguyen, Samiullah Khawaja
  Cc: Przemek Kitszel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, intel-wired-lan, willemb, almasrymina,
	David Decotigny, Anjali Singhai, Sridhar Samudrala, linux-kernel,
	netdev, emil.s.tantilov

From: Tony Nguyen <anthony.l.nguyen@intel.com>
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-
> aleksander.lobakin@intel.com/

Thanks,
Olek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-18 13:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-16 21:12 [PATCH iwl-next] idpf: set napi for each TX and RX queue Samiullah Khawaja
2025-07-17 20:25 ` Tony Nguyen
2025-07-18 13:06   ` Alexander Lobakin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).