From patchwork Tue Oct 24 01:34:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nambiar, Amritha" X-Patchwork-Id: 13433876 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 67749538D for ; Tue, 24 Oct 2023 01:18:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EWkHc2mt" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20515A1 for ; Mon, 23 Oct 2023 18:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698110316; x=1729646316; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1IMC3PdUiUX8T4WA6Sj1FO8MyKaO4rh4sCxoia6ubWM=; b=EWkHc2mtBlNYCV6B/ni2VyO7NVhvz7KV7r6+x7VSOoLNkgIvZM7APYBV /eJvOkm9m05bIRjgpHmjY8FJQzV6YR/xpinmEaMh6NZecmHnDo6BwTb4l hcB+XGjQJzsGSLiHVM3uGJd6hKfAXbgFhzBGsRLGv29cVd22SCQykyY9i xlELEr2MUBgIpk8eERyIAbSn3L3pr34wv3ug2kxAPaP+PKQclmrB8Mq9x iTuB5ZYVKUzip2uiuxVfPY3CVHrIdKdDQSxxRJyrLmQqIpjGhgZfrKPl2 zhdffxfup5vGLxddU77kmporVBJXfIIjtm8PPJz6K9tJku6gvkJKzrtBc A==; X-IronPort-AV: E=McAfee;i="6600,9927,10872"; a="366305832" X-IronPort-AV: E=Sophos;i="6.03,246,1694761200"; d="scan'208";a="366305832" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Oct 2023 18:18:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10872"; a="761938468" X-IronPort-AV: E=Sophos;i="6.03,246,1694761200"; d="scan'208";a="761938468" Received: from anambiarhost.jf.intel.com ([10.166.29.163]) by fmsmga007.fm.intel.com with ESMTP; 23 Oct 2023 18:18:33 -0700 Subject: [net-next PATCH v6 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: Mon, 23 Oct 2023 18:34:12 -0700 Message-ID: <169811125219.59034.3763841060212779862.stgit@anambiarhost.jf.intel.com> In-Reply-To: <169811096816.59034.13985871730113977096.stgit@anambiarhost.jf.intel.com> References: <169811096816.59034.13985871730113977096.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 ad4b1ee0a2d1..e05fbdac2a58 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_s32(rsp, NETDEV_A_NAPI_PID, pid)) + goto nla_put_failure; + } + genlmsg_end(rsp, hdr); return 0;