From patchwork Fri Nov 17 01:17:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nambiar, Amritha" X-Patchwork-Id: 13458325 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="gCvmFwL+" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4383DC5 for ; Thu, 16 Nov 2023 17:01:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700182873; x=1731718873; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SLUyIbbZSBAPMlLMUC4HaU3IMqusIYqPIIw/i+8BYxE=; b=gCvmFwL+17eW3NlzzPUq0yAHVAkuvMxmslCtFKU8lq666LxxIR5noA0Q JdeKCsgspAHwM8qInxPFNa9bkt+q5DOpqRj21Q+giWLDn7XFnwGBDnItG QrvmCHcY6NNlibi25ZdPnBqP/4jVE2nhSMwyCSvVvzT925j1+O94uzJq9 QAb2e3X5oIze80KfbZJURQkdXrotrpEPsgZSwy/e4SjCz1YLMy6XCKc5n X0YhUYik5DU4eoIWpyG9gvQMKVRoUCNPuoP2f8BcX27sIRjx86bI3ADXy gE0mlg0invFPvOoZ3zKsjewuhyaaawP1YeyrGOp4YhSeW+W8nnTqZSNcy Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10896"; a="422310343" X-IronPort-AV: E=Sophos;i="6.04,205,1695711600"; d="scan'208";a="422310343" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2023 17:01:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10896"; a="1012774236" X-IronPort-AV: E=Sophos;i="6.04,205,1695711600"; d="scan'208";a="1012774236" Received: from anambiarhost.jf.intel.com ([10.166.29.163]) by fmsmga006.fm.intel.com with ESMTP; 16 Nov 2023 17:01:12 -0800 Subject: [net-next PATCH v8 10/10] netdev-genl: Add PID for the NAPI thread From: Amritha Nambiar To: netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com Cc: sridhar.samudrala@intel.com, amritha.nambiar@intel.com Date: Thu, 16 Nov 2023 17:17:30 -0800 Message-ID: <170018385078.3767.13370128982508798097.stgit@anambiarhost.jf.intel.com> In-Reply-To: <170018355327.3767.5169918029687620348.stgit@anambiarhost.jf.intel.com> References: <170018355327.3767.5169918029687620348.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 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 d4d418c0e67e..4f22b9ff6315 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -152,6 +152,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; @@ -170,6 +171,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_u32(rsp, NETDEV_A_NAPI_PID, pid)) + goto nla_put_failure; + } + genlmsg_end(rsp, hdr); return 0;