Link IRQs to NAPI instances with netif_napi_set_irq. This
information can be queried with the netdev-genl API.
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..a88af868da8c 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(tp->dev, &tp->int_vector[i].napi,
+ tp->int_vector[i].poll);
+ 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
On Tue, Jun 10, 2025 at 06:33:33PM +0800, Justin Lai wrote:
> Link IRQs to NAPI instances with netif_napi_set_irq. This
> information can be queried with the netdev-genl API.
>
> 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..a88af868da8c 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(tp->dev, &tp->int_vector[i].napi,
> + tp->int_vector[i].poll);
Maybe netif_napi_add_config can be used either in this patch or in an added
3rd patch to this series to support persitent NAPI config?
Otherwise:
Reviewed-by: Joe Damato <joe@dama.to>
> + 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
>
>
> On Tue, Jun 10, 2025 at 06:33:33PM +0800, Justin Lai wrote:
> > Link IRQs to NAPI instances with netif_napi_set_irq. This information
> > can be queried with the netdev-genl API.
> >
> > 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..a88af868da8c 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(tp->dev, &tp->int_vector[i].napi,
> > + tp->int_vector[i].poll);
>
> Maybe netif_napi_add_config can be used either in this patch or in an added
> 3rd patch to this series to support persitent NAPI config?
>
> Otherwise:
>
> Reviewed-by: Joe Damato <joe@dama.to>
Hi Joe,
Thank you for your suggestion. I will make the change in this patch in v2.
Thanks,
Justin
>
> > + 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
> >
> >
© 2016 - 2026 Red Hat, Inc.