From patchwork Fri Oct 6 09:15:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nambiar, Amritha" X-Patchwork-Id: 13411153 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 AABEB107BE for ; Fri, 6 Oct 2023 08:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NC+yU4X4" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE81C83 for ; Fri, 6 Oct 2023 01:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696582798; x=1728118798; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XaHAvdJYriil4QtaY2V7G7IbVZTw5ZBT9+CTCnr0idM=; b=NC+yU4X4O+YrC2OXkPAJ4xhiuVw8F/0v455080f4bWj2M0AsRA7V5bLw hin33jYer2mG/fxuVp0DZgVWkRpxqbkgARueOtcDaH5WzSRlZazlkcZTX QMFzkYwETLUY8kbvam1/2lh57VT1i3Sbw+/FQCNUD2YdePTSCjqTFGSge yg1F9DzuzumbbQWXRNR4b1GD2Xv2Qd/wgIokgm83g7POOcnDOc0IrIjcV f7dbliU7qtnngKuoVc5B7Cq4DNT9dfZ83G9ACAbaNxqQQQoSVtB73e0U7 4wf0qQ/FXm7tHrvlicSpnwJ3eHKGlxU8ToHpuNePfAvyDLv63g8/mFXZf A==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="469980289" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="469980289" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2023 01:59:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="999264317" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="999264317" Received: from anambiarhost.jf.intel.com ([10.166.29.163]) by fmsmga006.fm.intel.com with ESMTP; 06 Oct 2023 01:59:48 -0700 Subject: [net-next PATCH v4 10/10] netdev-genl: Add PID for the NAPI thread 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:31 -0700 Message-ID: <169658373113.3683.333790071628109423.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=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 In the threaded NAPI mode, expose the PID of the NAPI thread. Signed-off-by: Amritha Nambiar Reviewed-by: Sridhar Samudrala --- net/core/netdev-genl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 336fcaaf169a..d1dec79aac12 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -151,6 +151,7 @@ netdev_nl_napi_fill_one(struct sk_buff *rsp, struct napi_struct *napi, const struct genl_info *info) { void *hdr; + pid_t pid; if (WARN_ON_ONCE(!napi->dev)) return -EINVAL; @@ -169,6 +170,12 @@ netdev_nl_napi_fill_one(struct sk_buff *rsp, struct napi_struct *napi, if (napi->irq >= 0 && nla_put_u32(rsp, NETDEV_A_NAPI_IRQ, napi->irq)) goto nla_put_failure; + if (napi->thread) { + pid = task_pid_nr(napi->thread); + if (nla_put_s32(rsp, NETDEV_A_NAPI_PID, pid)) + goto nla_put_failure; + } + genlmsg_end(rsp, hdr); return 0;