From patchwork Thu Oct 19 00:06:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nambiar, Amritha" X-Patchwork-Id: 13428141 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 4AFA946661 for ; Wed, 18 Oct 2023 23:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="buEtAnNe" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42066FA for ; Wed, 18 Oct 2023 16:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697673057; x=1729209057; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u+/iWWGQocUrD9tTIidtF+5WS9eLC35Sd7bWtFlCTOk=; b=buEtAnNeDnTbQ//BhX+xaxZkk5jH/I3MSPa4Jr0OrhYcFiuADECZD6+0 dcRu3za8s+/MtTCYEP0YUaLt7Ngj81xeE8jU/VrJ+ug+upPGbKoo0/JG5 Z7sfO9bQrgZHsE/PzWCvUvPyPePmLP/qj16fIF6eI9p/FuRBJQb255qTr IZHyLAD4haNXGT5z9yYZz83lJlqwTQHAujy/+XrN/YWJw/ytdhDxOR6Bg mG3Mwteup0/O0mlksLKwCTQH3RRRkttX7eJQEf5hNsfl14E9dUXUOvM5V Cf9R8qlUOF/i7TyAs7oO5AWwZqio+ZZ2TCZXmedszTHc2L9g9xnYcDXyy Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="366383243" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="366383243" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 16:50:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="847459681" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="847459681" Received: from anambiarhost.jf.intel.com ([10.166.29.163]) by FMSMGA003.fm.intel.com with ESMTP; 18 Oct 2023 16:50:56 -0700 Subject: [net-next PATCH v5 09/10] netdev-genl: spec: Add PID in netdev netlink YAML spec From: Amritha Nambiar To: netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com Cc: sridhar.samudrala@intel.com, amritha.nambiar@intel.com Date: Wed, 18 Oct 2023 17:06:50 -0700 Message-ID: <169767401007.6692.10809662776348370465.stgit@anambiarhost.jf.intel.com> In-Reply-To: <169767295948.6692.18077536155633460138.stgit@anambiarhost.jf.intel.com> References: <169767295948.6692.18077536155633460138.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 Add support in netlink spec(netdev.yaml) for PID of the NAPI thread. Add code generated from the spec. Signed-off-by: Amritha Nambiar Reviewed-by: Sridhar Samudrala --- Documentation/netlink/specs/netdev.yaml | 5 +++++ include/uapi/linux/netdev.h | 1 + tools/include/uapi/linux/netdev.h | 1 + tools/net/ynl/generated/netdev-user.c | 6 ++++++ tools/net/ynl/generated/netdev-user.h | 2 ++ 5 files changed, 15 insertions(+) diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml index 2faa69d5752f..9ddb1d0b37dc 100644 --- a/Documentation/netlink/specs/netdev.yaml +++ b/Documentation/netlink/specs/netdev.yaml @@ -108,6 +108,10 @@ attribute-sets: name: irq doc: The associated interrupt vector number for the napi type: u32 + - + name: pid + doc: PID of the napi thread + type: s32 - name: queue attributes: @@ -198,6 +202,7 @@ operations: - napi-id - ifindex - irq + - pid dump: request: attributes: diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h index d461915aa514..a13fb55b2dde 100644 --- a/include/uapi/linux/netdev.h +++ b/include/uapi/linux/netdev.h @@ -73,6 +73,7 @@ enum { NETDEV_A_NAPI_IFINDEX = 1, NETDEV_A_NAPI_NAPI_ID, NETDEV_A_NAPI_IRQ, + NETDEV_A_NAPI_PID, __NETDEV_A_NAPI_MAX, NETDEV_A_NAPI_MAX = (__NETDEV_A_NAPI_MAX - 1) diff --git a/tools/include/uapi/linux/netdev.h b/tools/include/uapi/linux/netdev.h index d461915aa514..a13fb55b2dde 100644 --- a/tools/include/uapi/linux/netdev.h +++ b/tools/include/uapi/linux/netdev.h @@ -73,6 +73,7 @@ enum { NETDEV_A_NAPI_IFINDEX = 1, NETDEV_A_NAPI_NAPI_ID, NETDEV_A_NAPI_IRQ, + NETDEV_A_NAPI_PID, __NETDEV_A_NAPI_MAX, NETDEV_A_NAPI_MAX = (__NETDEV_A_NAPI_MAX - 1) diff --git a/tools/net/ynl/generated/netdev-user.c b/tools/net/ynl/generated/netdev-user.c index a3060531b42e..ca9a68f6bd72 100644 --- a/tools/net/ynl/generated/netdev-user.c +++ b/tools/net/ynl/generated/netdev-user.c @@ -102,6 +102,7 @@ struct ynl_policy_attr netdev_napi_policy[NETDEV_A_NAPI_MAX + 1] = { [NETDEV_A_NAPI_IFINDEX] = { .name = "ifindex", .type = YNL_PT_U32, }, [NETDEV_A_NAPI_NAPI_ID] = { .name = "napi-id", .type = YNL_PT_U32, }, [NETDEV_A_NAPI_IRQ] = { .name = "irq", .type = YNL_PT_U32, }, + [NETDEV_A_NAPI_PID] = { .name = "pid", .type = YNL_PT_U32, }, }; struct ynl_policy_nest netdev_napi_nest = { @@ -400,6 +401,11 @@ int netdev_napi_get_rsp_parse(const struct nlmsghdr *nlh, void *data) return MNL_CB_ERROR; dst->_present.irq = 1; dst->irq = mnl_attr_get_u32(attr); + } else if (type == NETDEV_A_NAPI_PID) { + if (ynl_attr_validate(yarg, attr)) + return MNL_CB_ERROR; + dst->_present.pid = 1; + dst->pid = mnl_attr_get_u32(attr); } } diff --git a/tools/net/ynl/generated/netdev-user.h b/tools/net/ynl/generated/netdev-user.h index 1f8251e8ed41..9aa35f66daad 100644 --- a/tools/net/ynl/generated/netdev-user.h +++ b/tools/net/ynl/generated/netdev-user.h @@ -215,11 +215,13 @@ struct netdev_napi_get_rsp { __u32 napi_id:1; __u32 ifindex:1; __u32 irq:1; + __u32 pid:1; } _present; __u32 napi_id; __u32 ifindex; __u32 irq; + __s32 pid; }; void netdev_napi_get_rsp_free(struct netdev_napi_get_rsp *rsp);