History

netdev-genl: spec: Add PID in netdev netlink YAML spec

Add support in netlink spec(netdev.yaml) for PID of the NAPI thread. Add code generated from the spec.

Amritha Nambiar committed 2 years ago

Commit 8481a241 parent 26793bf5 files · +17 −0Browse files

Unified · Split

5 files
  1. Documentation/netlink/specs/netdev.yaml +7 −0
  2. include/uapi/linux/netdev.h +1 −0
  3. tools/include/uapi/linux/netdev.h +1 −0
  4. tools/net/ynl/generated/netdev-user.c +6 −0
  5. tools/net/ynl/generated/netdev-user.h +2 −0
Documentation/netlink/specs/netdev.yaml+7−0
@@ -230,6 +230,12 @@ attribute-sets: · 229 unmodified lines
230 name: irq230 name: irq
231 doc: The associated interrupt vector number for the napi231 doc: The associated interrupt vector number for the napi
232 type: u32232 type: u32
233 -
234 name: pid
235 doc: PID of the napi thread, if NAPI is configured to operate in
236 threaded mode. If NAPI is not in threaded mode (i.e. uses normal
237 softirq context), the attribute will be absent.
238 type: u32
233 -239 -
234 name: queue240 name: queue
235 attributes:241 attributes:
@@ -389,6 +395,7 @@ operations: · 153 unmodified lines
389 - id395 - id
390 - ifindex396 - ifindex
391 - irq397 - irq
398 - pid
392 dump:399 dump:
393 request:400 request:
394 attributes:401 attributes:
include/uapi/linux/netdev.h+1−0
@@ -113,6 +113,7 @@ enum { · 112 unmodified lines
113 NETDEV_A_NAPI_IFINDEX = 1,113 NETDEV_A_NAPI_IFINDEX = 1,
114 NETDEV_A_NAPI_ID,114 NETDEV_A_NAPI_ID,
115 NETDEV_A_NAPI_IRQ,115 NETDEV_A_NAPI_IRQ,
116 NETDEV_A_NAPI_PID,
116 117
117 __NETDEV_A_NAPI_MAX,118 __NETDEV_A_NAPI_MAX,
118 NETDEV_A_NAPI_MAX = (__NETDEV_A_NAPI_MAX - 1)119 NETDEV_A_NAPI_MAX = (__NETDEV_A_NAPI_MAX - 1)
tools/include/uapi/linux/netdev.h+1−0
@@ -113,6 +113,7 @@ enum { · 112 unmodified lines
113 NETDEV_A_NAPI_IFINDEX = 1,113 NETDEV_A_NAPI_IFINDEX = 1,
114 NETDEV_A_NAPI_ID,114 NETDEV_A_NAPI_ID,
115 NETDEV_A_NAPI_IRQ,115 NETDEV_A_NAPI_IRQ,
116 NETDEV_A_NAPI_PID,
116 117
117 __NETDEV_A_NAPI_MAX,118 __NETDEV_A_NAPI_MAX,
118 NETDEV_A_NAPI_MAX = (__NETDEV_A_NAPI_MAX - 1)119 NETDEV_A_NAPI_MAX = (__NETDEV_A_NAPI_MAX - 1)
tools/net/ynl/generated/netdev-user.c+6−0
@@ -165,6 +165,7 @@ struct ynl_policy_attr netdev_napi_policy[NETDEV_A_NAPI_MAX + 1] = { · 164 unmodified lines
165 [NETDEV_A_NAPI_IFINDEX] = { .name = "ifindex", .type = YNL_PT_U32, },165 [NETDEV_A_NAPI_IFINDEX] = { .name = "ifindex", .type = YNL_PT_U32, },
166 [NETDEV_A_NAPI_ID] = { .name = "id", .type = YNL_PT_U32, },166 [NETDEV_A_NAPI_ID] = { .name = "id", .type = YNL_PT_U32, },
167 [NETDEV_A_NAPI_IRQ] = { .name = "irq", .type = YNL_PT_U32, },167 [NETDEV_A_NAPI_IRQ] = { .name = "irq", .type = YNL_PT_U32, },
168 [NETDEV_A_NAPI_PID] = { .name = "pid", .type = YNL_PT_U32, },
168};169};
169 170
170struct ynl_policy_nest netdev_napi_nest = {171struct ynl_policy_nest netdev_napi_nest = {
@@ -216,6 +217,11 @@ int netdev_page_pool_info_parse(struct ynl_parse_arg *yarg, · 45 unmodified lines
216 return MNL_CB_ERROR;217 return MNL_CB_ERROR;
217 dst->_present.irq = 1;218 dst->_present.irq = 1;
218 dst->irq = mnl_attr_get_u32(attr);219 dst->irq = mnl_attr_get_u32(attr);
220 } else if (type == NETDEV_A_NAPI_PID) {
221 if (ynl_attr_validate(yarg, attr))
222 return MNL_CB_ERROR;
223 dst->_present.pid = 1;
224 dst->pid = mnl_attr_get_u32(attr);
219 }225 }
220 }226 }
221 227
tools/net/ynl/generated/netdev-user.h+2−0
@@ -388,11 +388,13 @@ struct netdev_napi_get_rsp { · 387 unmodified lines
388 __u32 id:1;388 __u32 id:1;
389 __u32 ifindex:1;389 __u32 ifindex:1;
390 __u32 irq:1;390 __u32 irq:1;
391 __u32 pid:1;
391 } _present;392 } _present;
392 393
393 __u32 id;394 __u32 id;
394 __u32 ifindex;395 __u32 ifindex;
395 __u32 irq;396 __u32 irq;
397 __u32 pid;
396};398};
397 399
398void netdev_napi_get_rsp_free(struct netdev_napi_get_rsp *rsp);400void netdev_napi_get_rsp_free(struct netdev_napi_get_rsp *rsp);