From patchwork Tue Nov 28 03:50:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nambiar, Amritha" X-Patchwork-Id: 13470475 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BYbc1G0f" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF646136 for ; Mon, 27 Nov 2023 19:33:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701142423; x=1732678423; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TGopEwu1MiXeb7+6/ttj3KrmEXt3GSw/NGpMCUcl8ko=; b=BYbc1G0fUG2mH6MwkY05XEtkcs7JBWhxhL4jfCtA33eGfcbh3HgAvLUc pBFwQXUXfqKDDP6npxtNyk86iOJpqIwGByUmmuAA7+pHuqlNFKzpPMPxt JwVONrabYHe8EjYKJLGk/pxEWfDasW+6TSHBhTQJmqVEONwkomj7JAIr0 IFM4mJDHg9+RAUeKhTFbTFLTNL8IEQDWv9E793FnT/QcTkdahQCpoHmlX /EC6zkb9iuHNqQNEXAvEqHkWkOtoQndw0s7grHwrzLU8rmvnVwdwQbsvz MVuAaTegv74rTWf6bMTCZvRXIj2XwBogWzPAyhBlXENaS6OegeDtgOZiX A==; X-IronPort-AV: E=McAfee;i="6600,9927,10907"; a="373013061" X-IronPort-AV: E=Sophos;i="6.04,232,1695711600"; d="scan'208";a="373013061" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2023 19:33:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10907"; a="834524768" X-IronPort-AV: E=Sophos;i="6.04,232,1695711600"; d="scan'208";a="834524768" Received: from anambiarhost.jf.intel.com ([10.166.29.163]) by fmsmga008.fm.intel.com with ESMTP; 27 Nov 2023 19:33:43 -0800 Subject: [net-next PATCH v9 08/11] net: Add NAPI IRQ support From: Amritha Nambiar To: netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com Cc: sridhar.samudrala@intel.com, amritha.nambiar@intel.com Date: Mon, 27 Nov 2023 19:50:09 -0800 Message-ID: <170114340926.10303.9608580372184617636.stgit@anambiarhost.jf.intel.com> In-Reply-To: <170114286635.10303.8773144948795839629.stgit@anambiarhost.jf.intel.com> References: <170114286635.10303.8773144948795839629.stgit@anambiarhost.jf.intel.com> User-Agent: StGit/unknown-version Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add support to associate the interrupt vector number for a NAPI instance. Signed-off-by: Amritha Nambiar Reviewed-by: Sridhar Samudrala --- drivers/net/ethernet/intel/ice/ice_lib.c | 2 ++ include/linux/netdevice.h | 6 ++++++ net/core/dev.c | 1 + net/core/netdev-genl.c | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index 83f6977fad22..626577c7d5b2 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -2978,6 +2978,8 @@ void ice_q_vector_set_napi_queues(struct ice_q_vector *q_vector, bool locked) ice_queue_set_napi(q_vector->vsi->netdev, tx_ring->q_index, NETDEV_QUEUE_TYPE_TX, &q_vector->napi, locked); + /* Also set the interrupt number for the NAPI */ + netif_napi_set_irq(&q_vector->napi, q_vector->irq.virq); } /** diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index c5a401ba4e59..9b4156f57c64 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -382,6 +382,7 @@ struct napi_struct { /* control-path-only fields follow */ struct list_head dev_list; struct hlist_node napi_hash_node; + int irq; }; enum { @@ -2659,6 +2660,11 @@ void netif_queue_set_napi(struct net_device *dev, unsigned int queue_index, enum netdev_queue_type type, struct napi_struct *napi); +static inline void netif_napi_set_irq(struct napi_struct *napi, int irq) +{ + napi->irq = irq; +} + /* Default NAPI poll() weight * Device drivers are strongly advised to not use bigger value */ diff --git a/net/core/dev.c b/net/core/dev.c index 13c9d1580e62..1d720fc59161 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6471,6 +6471,7 @@ void netif_napi_add_weight(struct net_device *dev, struct napi_struct *napi, */ if (dev->threaded && napi_kthread_create(napi)) dev->threaded = 0; + netif_napi_set_irq(napi, -1); } EXPORT_SYMBOL(netif_napi_add_weight); diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 851c8ebca267..e87d2f2d7fec 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -169,7 +169,11 @@ netdev_nl_napi_fill_one(struct sk_buff *rsp, struct napi_struct *napi, if (nla_put_u32(rsp, NETDEV_A_NAPI_IFINDEX, napi->dev->ifindex)) 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: