From patchwork Thu Nov 30 00:28:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nambiar, Amritha" X-Patchwork-Id: 13473688 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="aLBSFWPB" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BB0CCA for ; Wed, 29 Nov 2023 16:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701303111; x=1732839111; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kBfnDMj0eLuxkcItt0ZPkHag/uxwbD9FO0IpFVBpcBk=; b=aLBSFWPByq6pmsDPkGqhIx0Z6hKCY2MNLcZ35liq/T2dVn5Cpqbr4LH2 2kf/1pxTB1dgiotn43x6ddtxtq8T6FDNAFzo9tzd4oH2YYl3QuFbsgup/ YYN1ULDJtqZp3K47ExCqntkl3Vf67Sny2ssYoa1zVrHW9dwwESopc9dVB XWL5XVvQ46i1JUPNeJNpzyvCaWL2hMuB2tlQkWmzRfUbiTn3RLrN4CEP0 CBG9byfaD+/7YqLRzndJUYQsWVfdBXzHaGFgHS9rE0AdJ5CBTN5ZTzVcR MyG4YLHW6b8OsrBGM9MwqO3kIqPCQ5FLkesoRf5lLIIODaEhXtYiEVrMl g==; X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="112131" X-IronPort-AV: E=Sophos;i="6.04,237,1695711600"; d="scan'208";a="112131" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2023 16:11:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="772864011" X-IronPort-AV: E=Sophos;i="6.04,237,1695711600"; d="scan'208";a="772864011" Received: from anambiarhost.jf.intel.com ([10.166.29.163]) by fmsmga007.fm.intel.com with ESMTP; 29 Nov 2023 16:11:50 -0800 Subject: [net-next PATCH v10 10/11] netdev-genl: Add PID for the NAPI thread From: Amritha Nambiar To: netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com Cc: edumazet@google.com, ast@kernel.org, sdf@google.com, lorenzo@kernel.org, tariqt@nvidia.com, daniel@iogearbox.net, anthony.l.nguyen@intel.com, lucien.xin@gmail.com, michael.chan@broadcom.com, sridhar.samudrala@intel.com, amritha.nambiar@intel.com Date: Wed, 29 Nov 2023 16:28:18 -0800 Message-ID: <170130409873.5198.6723749951487504481.stgit@anambiarhost.jf.intel.com> In-Reply-To: <170130378595.5198.158092030504280163.stgit@anambiarhost.jf.intel.com> References: <170130378595.5198.158092030504280163.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 e87d2f2d7fec..b39e9c8c0dc1 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; @@ -172,6 +173,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;