Message ID | 169266034688.10199.12117427969821291880.stgit@anambiarhost.jf.intel.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Introduce NAPI queues support | expand |
On Mon, 21 Aug 2023 16:25:46 -0700 Amritha Nambiar wrote:
> + if (napi->irq >= 0 && (nla_put_u32(rsp, NETDEV_A_NAPI_IRQ, napi->irq)))
Unnecessary brackets around nla_put
On 8/22/2023 5:52 PM, Jakub Kicinski wrote: > On Mon, 21 Aug 2023 16:25:46 -0700 Amritha Nambiar wrote: >> + if (napi->irq >= 0 && (nla_put_u32(rsp, NETDEV_A_NAPI_IRQ, napi->irq))) > > Unnecessary brackets around nla_put Will fix in v3.
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index c2b9a25db139..6c86e6ac9dfe 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -2972,6 +2972,9 @@ int ice_q_vector_add_napi_queues(struct ice_q_vector *q_vector) return ret; } + /* Also set the interrupt number for the NAPI */ + napi_set_irq(&q_vector->napi, q_vector->irq.virq); + return ret; } diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 4ec86d9aceb2..60f06bac6d24 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -390,6 +390,7 @@ struct napi_struct { struct hlist_node napi_hash_node; struct list_head napi_rxq_list; struct list_head napi_txq_list; + int irq; }; enum { @@ -2634,6 +2635,11 @@ static inline void *netdev_priv(const struct net_device *dev) */ #define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) +static inline void napi_set_irq(struct napi_struct *napi, int irq) +{ + napi->irq = irq; +} + int netif_napi_add_queue(struct napi_struct *napi, unsigned int queue_index, enum q_type type); diff --git a/net/core/dev.c b/net/core/dev.c index ec4c469c9e1d..10d1f0a07ba2 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6465,6 +6465,7 @@ void netif_napi_add_weight(struct net_device *dev, struct napi_struct *napi, INIT_LIST_HEAD(&napi->napi_rxq_list); INIT_LIST_HEAD(&napi->napi_txq_list); + napi->irq = -1; } EXPORT_SYMBOL(netif_napi_add_weight); diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 4bc6aa756001..63b8690d8ba3 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -168,7 +168,11 @@ netdev_nl_napi_fill_one(struct sk_buff *rsp, struct napi_struct *napi, goto nla_put_failure; } + if (napi->irq >= 0 && (nla_put_u32(rsp, NETDEV_A_NAPI_IRQ, napi->irq))) + goto nla_put_failure; + genlmsg_end(rsp, hdr); + return 0; nla_put_failure:
Add support to associate the interrupt vector number for a NAPI instance. Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com> --- drivers/net/ethernet/intel/ice/ice_lib.c | 3 +++ include/linux/netdevice.h | 6 ++++++ net/core/dev.c | 1 + net/core/netdev-genl.c | 4 ++++ 4 files changed, 14 insertions(+)