linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2] Link NAPI instances to queues and IRQs
@ 2025-06-16  3:22 Justin Lai
  2025-06-16  3:22 ` [PATCH net-next v2 1/2] rtase: Link IRQs to NAPI instances Justin Lai
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Justin Lai @ 2025-06-16  3:22 UTC (permalink / raw)
  To: kuba
  Cc: davem, edumazet, pabeni, andrew+netdev, linux-kernel, netdev,
	horms, jdamato, pkshih, larry.chiu, Justin Lai

This patch series introduces netdev-genl support to rtase, enabling
user-space applications to query the relationships between IRQs,
queues, and NAPI instances.

v1 -> v2:
- Use netif_napi_add_config() to support persistent NAPI configuration.
- Use enum netdev_queue_type instead of driver-specific values.
- Rename ring_type to type.

Justin Lai (2):
  rtase: Link IRQs to NAPI instances
  rtase: Link queues to NAPI instances

 drivers/net/ethernet/realtek/rtase/rtase.h    |  1 +
 .../net/ethernet/realtek/rtase/rtase_main.c   | 39 +++++++++++++++----
 2 files changed, 32 insertions(+), 8 deletions(-)

-- 
2.34.1


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

* [PATCH net-next v2 1/2] rtase: Link IRQs to NAPI instances
  2025-06-16  3:22 [PATCH net-next v2 0/2] Link NAPI instances to queues and IRQs Justin Lai
@ 2025-06-16  3:22 ` Justin Lai
  2025-06-16 15:42   ` Joe Damato
  2025-06-16  3:22 ` [PATCH net-next v2 2/2] rtase: Link queues " Justin Lai
  2025-06-17 23:30 ` [PATCH net-next v2 0/2] Link NAPI instances to queues and IRQs patchwork-bot+netdevbpf
  2 siblings, 1 reply; 7+ messages in thread
From: Justin Lai @ 2025-06-16  3:22 UTC (permalink / raw)
  To: kuba
  Cc: davem, edumazet, pabeni, andrew+netdev, linux-kernel, netdev,
	horms, jdamato, pkshih, larry.chiu, Justin Lai

Link IRQs to NAPI instances with netif_napi_set_irq. This
information can be queried with the netdev-genl API.

Also add support for persistent NAPI configuration using
netif_napi_add_config().

Signed-off-by: Justin Lai <justinlai0215@realtek.com>
---
 .../net/ethernet/realtek/rtase/rtase_main.c   | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c
index 4d37217e9a14..d13877f051e7 100644
--- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
+++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
@@ -1871,6 +1871,18 @@ static void rtase_init_netdev_ops(struct net_device *dev)
 	dev->ethtool_ops = &rtase_ethtool_ops;
 }
 
+static void rtase_init_napi(struct rtase_private *tp)
+{
+	u16 i;
+
+	for (i = 0; i < tp->int_nums; i++) {
+		netif_napi_add_config(tp->dev, &tp->int_vector[i].napi,
+				      tp->int_vector[i].poll, i);
+		netif_napi_set_irq(&tp->int_vector[i].napi,
+				   tp->int_vector[i].irq);
+	}
+}
+
 static void rtase_reset_interrupt(struct pci_dev *pdev,
 				  const struct rtase_private *tp)
 {
@@ -1956,9 +1968,6 @@ static void rtase_init_int_vector(struct rtase_private *tp)
 	memset(tp->int_vector[0].name, 0x0, sizeof(tp->int_vector[0].name));
 	INIT_LIST_HEAD(&tp->int_vector[0].ring_list);
 
-	netif_napi_add(tp->dev, &tp->int_vector[0].napi,
-		       tp->int_vector[0].poll);
-
 	/* interrupt vector 1 ~ 3 */
 	for (i = 1; i < tp->int_nums; i++) {
 		tp->int_vector[i].tp = tp;
@@ -1972,9 +1981,6 @@ static void rtase_init_int_vector(struct rtase_private *tp)
 		memset(tp->int_vector[i].name, 0x0,
 		       sizeof(tp->int_vector[0].name));
 		INIT_LIST_HEAD(&tp->int_vector[i].ring_list);
-
-		netif_napi_add(tp->dev, &tp->int_vector[i].napi,
-			       tp->int_vector[i].poll);
 	}
 }
 
@@ -2206,6 +2212,8 @@ static int rtase_init_one(struct pci_dev *pdev,
 		goto err_out_del_napi;
 	}
 
+	rtase_init_napi(tp);
+
 	rtase_init_netdev_ops(dev);
 
 	dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
-- 
2.34.1


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

* [PATCH net-next v2 2/2] rtase: Link queues to NAPI instances
  2025-06-16  3:22 [PATCH net-next v2 0/2] Link NAPI instances to queues and IRQs Justin Lai
  2025-06-16  3:22 ` [PATCH net-next v2 1/2] rtase: Link IRQs to NAPI instances Justin Lai
@ 2025-06-16  3:22 ` Justin Lai
  2025-06-16 15:46   ` Joe Damato
  2025-06-17 23:30 ` [PATCH net-next v2 0/2] Link NAPI instances to queues and IRQs patchwork-bot+netdevbpf
  2 siblings, 1 reply; 7+ messages in thread
From: Justin Lai @ 2025-06-16  3:22 UTC (permalink / raw)
  To: kuba
  Cc: davem, edumazet, pabeni, andrew+netdev, linux-kernel, netdev,
	horms, jdamato, pkshih, larry.chiu, Justin Lai

Link queues to NAPI instances with netif_queue_set_napi. This
information can be queried with the netdev-genl API.

Signed-off-by: Justin Lai <justinlai0215@realtek.com>
---
 drivers/net/ethernet/realtek/rtase/rtase.h    |  1 +
 .../net/ethernet/realtek/rtase/rtase_main.c   | 19 +++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/realtek/rtase/rtase.h b/drivers/net/ethernet/realtek/rtase/rtase.h
index 498cfe4d0cac..20decdeb9fdb 100644
--- a/drivers/net/ethernet/realtek/rtase/rtase.h
+++ b/drivers/net/ethernet/realtek/rtase/rtase.h
@@ -288,6 +288,7 @@ struct rtase_ring {
 	u32 cur_idx;
 	u32 dirty_idx;
 	u16 index;
+	u8 type;
 
 	struct sk_buff *skbuff[RTASE_NUM_DESC];
 	void *data_buf[RTASE_NUM_DESC];
diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c
index d13877f051e7..ef13109c49cf 100644
--- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
+++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
@@ -326,6 +326,7 @@ static void rtase_tx_desc_init(struct rtase_private *tp, u16 idx)
 	ring->cur_idx = 0;
 	ring->dirty_idx = 0;
 	ring->index = idx;
+	ring->type = NETDEV_QUEUE_TYPE_TX;
 	ring->alloc_fail = 0;
 
 	for (i = 0; i < RTASE_NUM_DESC; i++) {
@@ -345,6 +346,9 @@ static void rtase_tx_desc_init(struct rtase_private *tp, u16 idx)
 		ring->ivec = &tp->int_vector[0];
 		list_add_tail(&ring->ring_entry, &tp->int_vector[0].ring_list);
 	}
+
+	netif_queue_set_napi(tp->dev, ring->index,
+			     ring->type, &ring->ivec->napi);
 }
 
 static void rtase_map_to_asic(union rtase_rx_desc *desc, dma_addr_t mapping,
@@ -590,6 +594,7 @@ static void rtase_rx_desc_init(struct rtase_private *tp, u16 idx)
 	ring->cur_idx = 0;
 	ring->dirty_idx = 0;
 	ring->index = idx;
+	ring->type = NETDEV_QUEUE_TYPE_RX;
 	ring->alloc_fail = 0;
 
 	for (i = 0; i < RTASE_NUM_DESC; i++)
@@ -597,6 +602,8 @@ static void rtase_rx_desc_init(struct rtase_private *tp, u16 idx)
 
 	ring->ring_handler = rx_handler;
 	ring->ivec = &tp->int_vector[idx];
+	netif_queue_set_napi(tp->dev, ring->index,
+			     ring->type, &ring->ivec->napi);
 	list_add_tail(&ring->ring_entry, &tp->int_vector[idx].ring_list);
 }
 
@@ -1161,8 +1168,12 @@ static void rtase_down(struct net_device *dev)
 		ivec = &tp->int_vector[i];
 		napi_disable(&ivec->napi);
 		list_for_each_entry_safe(ring, tmp, &ivec->ring_list,
-					 ring_entry)
+					 ring_entry) {
+			netif_queue_set_napi(tp->dev, ring->index,
+					     ring->type, NULL);
+
 			list_del(&ring->ring_entry);
+		}
 	}
 
 	netif_tx_disable(dev);
@@ -1518,8 +1529,12 @@ static void rtase_sw_reset(struct net_device *dev)
 	for (i = 0; i < tp->int_nums; i++) {
 		ivec = &tp->int_vector[i];
 		list_for_each_entry_safe(ring, tmp, &ivec->ring_list,
-					 ring_entry)
+					 ring_entry) {
+			netif_queue_set_napi(tp->dev, ring->index,
+					     ring->type, NULL);
+
 			list_del(&ring->ring_entry);
+		}
 	}
 
 	ret = rtase_init_ring(dev);
-- 
2.34.1


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

* Re: [PATCH net-next v2 1/2] rtase: Link IRQs to NAPI instances
  2025-06-16  3:22 ` [PATCH net-next v2 1/2] rtase: Link IRQs to NAPI instances Justin Lai
@ 2025-06-16 15:42   ` Joe Damato
  2025-06-17  7:20     ` Justin Lai
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Damato @ 2025-06-16 15:42 UTC (permalink / raw)
  To: Justin Lai
  Cc: kuba, davem, edumazet, pabeni, andrew+netdev, linux-kernel,
	netdev, horms, jdamato, pkshih, larry.chiu

On Mon, Jun 16, 2025 at 11:22:25AM +0800, Justin Lai wrote:
> Link IRQs to NAPI instances with netif_napi_set_irq. This
> information can be queried with the netdev-genl API.
> 
> Also add support for persistent NAPI configuration using
> netif_napi_add_config().
> 
> Signed-off-by: Justin Lai <justinlai0215@realtek.com>
> ---
>  .../net/ethernet/realtek/rtase/rtase_main.c   | 20 +++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 

Did you test the persistent NAPI config on one of these devices?

Reviewed-by: Joe Damato <joe@dama.to>

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

* Re: [PATCH net-next v2 2/2] rtase: Link queues to NAPI instances
  2025-06-16  3:22 ` [PATCH net-next v2 2/2] rtase: Link queues " Justin Lai
@ 2025-06-16 15:46   ` Joe Damato
  0 siblings, 0 replies; 7+ messages in thread
From: Joe Damato @ 2025-06-16 15:46 UTC (permalink / raw)
  To: Justin Lai
  Cc: kuba, davem, edumazet, pabeni, andrew+netdev, linux-kernel,
	netdev, horms, jdamato, pkshih, larry.chiu

On Mon, Jun 16, 2025 at 11:22:26AM +0800, Justin Lai wrote:
> Link queues to NAPI instances with netif_queue_set_napi. This
> information can be queried with the netdev-genl API.
> 
> Signed-off-by: Justin Lai <justinlai0215@realtek.com>
> ---
>  drivers/net/ethernet/realtek/rtase/rtase.h    |  1 +
>  .../net/ethernet/realtek/rtase/rtase_main.c   | 19 +++++++++++++++++--
>  2 files changed, 18 insertions(+), 2 deletions(-)

Reviewed-by: Joe Damato <joe@dama.to>

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

* RE: [PATCH net-next v2 1/2] rtase: Link IRQs to NAPI instances
  2025-06-16 15:42   ` Joe Damato
@ 2025-06-17  7:20     ` Justin Lai
  0 siblings, 0 replies; 7+ messages in thread
From: Justin Lai @ 2025-06-17  7:20 UTC (permalink / raw)
  To: Joe Damato
  Cc: kuba@kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	horms@kernel.org, jdamato@fastly.com, Ping-Ke Shih, Larry Chiu

> On Mon, Jun 16, 2025 at 11:22:25AM +0800, Justin Lai wrote:
> > Link IRQs to NAPI instances with netif_napi_set_irq. This information
> > can be queried with the netdev-genl API.
> >
> > Also add support for persistent NAPI configuration using
> > netif_napi_add_config().
> >
> > Signed-off-by: Justin Lai <justinlai0215@realtek.com>
> > ---
> >  .../net/ethernet/realtek/rtase/rtase_main.c   | 20 +++++++++++++------
> >  1 file changed, 14 insertions(+), 6 deletions(-)
> >
> 
> Did you test the persistent NAPI config on one of these devices?
> 
> Reviewed-by: Joe Damato <joe@dama.to>

Hi Joe,

Yes, I tested it, and the persistent NAPI config worked correctly on
the device.

Thanks,
Justin

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

* Re: [PATCH net-next v2 0/2] Link NAPI instances to queues and IRQs
  2025-06-16  3:22 [PATCH net-next v2 0/2] Link NAPI instances to queues and IRQs Justin Lai
  2025-06-16  3:22 ` [PATCH net-next v2 1/2] rtase: Link IRQs to NAPI instances Justin Lai
  2025-06-16  3:22 ` [PATCH net-next v2 2/2] rtase: Link queues " Justin Lai
@ 2025-06-17 23:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-17 23:30 UTC (permalink / raw)
  To: Justin Lai
  Cc: kuba, davem, edumazet, pabeni, andrew+netdev, linux-kernel,
	netdev, horms, jdamato, pkshih, larry.chiu

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 16 Jun 2025 11:22:24 +0800 you wrote:
> This patch series introduces netdev-genl support to rtase, enabling
> user-space applications to query the relationships between IRQs,
> queues, and NAPI instances.
> 
> v1 -> v2:
> - Use netif_napi_add_config() to support persistent NAPI configuration.
> - Use enum netdev_queue_type instead of driver-specific values.
> - Rename ring_type to type.
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/2] rtase: Link IRQs to NAPI instances
    https://git.kernel.org/netdev/net-next/c/9f611bfd1011
  - [net-next,v2,2/2] rtase: Link queues to NAPI instances
    https://git.kernel.org/netdev/net-next/c/8d672a3e51ad

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-06-17 23:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16  3:22 [PATCH net-next v2 0/2] Link NAPI instances to queues and IRQs Justin Lai
2025-06-16  3:22 ` [PATCH net-next v2 1/2] rtase: Link IRQs to NAPI instances Justin Lai
2025-06-16 15:42   ` Joe Damato
2025-06-17  7:20     ` Justin Lai
2025-06-16  3:22 ` [PATCH net-next v2 2/2] rtase: Link queues " Justin Lai
2025-06-16 15:46   ` Joe Damato
2025-06-17 23:30 ` [PATCH net-next v2 0/2] Link NAPI instances to queues and IRQs patchwork-bot+netdevbpf

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).