diff mbox series

[net-next,v1,9/9] netdev-genl: Add PID for the NAPI thread

Message ID 169059165828.3736.1595843116804085813.stgit@anambiarhost.jf.intel.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Introduce NAPI queues support | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1330 this patch: 1330
netdev/cc_maintainers warning 3 maintainers not CCed: pabeni@redhat.com ast@kernel.org edumazet@google.com
netdev/build_clang fail Errors and warnings before: 115 this patch: 115
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 34 this patch: 34
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 19 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Nambiar, Amritha July 29, 2023, 12:47 a.m. UTC
In the threaded NAPI mode, expose the PID of the NAPI thread.

Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
---
 net/core/netdev-genl.c |    7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
index 8401f646a10b..60af99ffb9ec 100644
--- a/net/core/netdev-genl.c
+++ b/net/core/netdev-genl.c
@@ -141,6 +141,7 @@  netdev_nl_napi_fill_one(struct sk_buff *msg, struct napi_struct *napi)
 	struct netdev_queue *tx_queue, *txq;
 	unsigned int rx_qid, tx_qid;
 	struct nlattr *napi_info;
+	pid_t pid;
 
 	napi_info = nla_nest_start(msg, NETDEV_A_NAPI_NAPI_INFO);
 	if (!napi_info)
@@ -165,6 +166,12 @@  netdev_nl_napi_fill_one(struct sk_buff *msg, struct napi_struct *napi)
 		if (nla_put_u32(msg, NETDEV_A_NAPI_INFO_ENTRY_IRQ, napi->irq))
 			goto nla_put_failure;
 
+	if (napi->thread) {
+		pid = task_pid_nr(napi->thread);
+		if (nla_put_s32(msg, NETDEV_A_NAPI_INFO_ENTRY_PID, pid))
+			goto nla_put_failure;
+	}
+
 	nla_nest_end(msg, napi_info);
 	return 0;
 nla_put_failure: