From patchwork Fri Oct 6 09:15:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nambiar, Amritha" X-Patchwork-Id: 13411154 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AE37F9DF for ; Fri, 6 Oct 2023 09:03:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="amb+SSy/" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C9A7AD for ; Fri, 6 Oct 2023 02:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696583006; x=1728119006; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9ZfHdryUdgu/oLJ0Nz7OUXXf1eBEBAqRMmtJD44gb3U=; b=amb+SSy/m29ScBeu5Qll3gY/kLJR81+/N8IVxBzqKojCyy1mnxaQ7t39 2V/jd2pD8YiVnYd2wkpQJLo/jszqvpIH33vnRVMbw4tFOjIT4R/LfAddg Lftj1qAzq0ZKU7HSkY/GiWfxgISemtUW6Lf5+4XjQnF1uXV6iKSPQyMze BtkAxCYoxmua5SIDPh5yNpCzwtTKoFVX/4ehGXeHkmY5R2EECscjv23T0 0pPNDSn/Kbu7fHvd06m8vU3CQY3i1mD2YV82CdvSxC9krdIG7In60B6GO 3o3rRv99MfXTs760X4vh0kR4VvPAwoNXXEoF18SyiR6qxmyt36NvSJU0f Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="2312882" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="2312882" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2023 02:03:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="781583697" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="781583697" Received: from anambiarhost.jf.intel.com ([10.166.29.163]) by orsmga008.jf.intel.com with ESMTP; 06 Oct 2023 01:59:37 -0700 Subject: [net-next PATCH v4 08/10] net: Add NAPI IRQ support From: Amritha Nambiar To: netdev@vger.kernel.org, kuba@kernel.org Cc: sridhar.samudrala@intel.com, amritha.nambiar@intel.com Date: Fri, 06 Oct 2023 02:15:20 -0700 Message-ID: <169658372080.3683.4503482783113141526.stgit@anambiarhost.jf.intel.com> In-Reply-To: <169658340079.3683.13049063254569592908.stgit@anambiarhost.jf.intel.com> References: <169658340079.3683.13049063254569592908.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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 | 3 +++ include/linux/netdevice.h | 6 ++++++ net/core/dev.c | 1 + net/core/netdev-genl.c | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index f2554ecdd2bb..029d2b4b8789 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -2961,6 +2961,9 @@ int ice_q_vector_add_napi_queues(struct ice_q_vector *q_vector) return ret; } + /* Also set the interrupt number for the NAPI */ + netif_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 da211f4d81db..1dab653cb6a5 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 { @@ -2626,6 +2627,11 @@ static inline void *netdev_priv(const struct net_device *dev) int netif_queue_set_napi(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 85448451b9fa..8e8410c71b7a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6463,6 +6463,7 @@ void netif_napi_add_weight(struct net_device *dev, struct napi_struct *napi, */ if (dev->threaded && napi_kthread_create(napi)) dev->threaded = 0; + napi->irq = -1; } EXPORT_SYMBOL(netif_napi_add_weight); diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 530d6f474bd5..336fcaaf169a 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -166,7 +166,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: