From: Amritha Nambiar Date: Fri, 1 Dec 2023 23:29:18 +0000 (-0800) Subject: netdev-genl: Add PID for the NAPI thread X-Git-Tag: v6.8-rc1~131^2~221^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=db4704f4e4dfce835e934609fca735a648ce26e8;p=thirdparty%2Flinux.git netdev-genl: Add PID for the NAPI thread In the threaded NAPI mode, expose the PID of the NAPI thread. Signed-off-by: Amritha Nambiar Reviewed-by: Sridhar Samudrala Link: https://lore.kernel.org/r/170147335818.5260.10253384006102593087.stgit@anambiarhost.jf.intel.com Signed-off-by: Jakub Kicinski --- diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 9753c19e36de5..fd98936da3aec 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -163,6 +163,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; @@ -183,6 +184,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;