Commit ff999149 authored by Amritha Nambiar's avatar Amritha Nambiar Committed by Jakub Kicinski
Browse files

netdev-genl: spec: Extend netdev netlink spec in YAML for NAPI



Add support in netlink spec(netdev.yaml) for napi related information.
Add code generated from the spec.

Signed-off-by: default avatarAmritha Nambiar <amritha.nambiar@intel.com>
Reviewed-by: default avatarSridhar Samudrala <sridhar.samudrala@intel.com>
Link: https://lore.kernel.org/r/170147333119.5260.7050639053080529108.stgit@anambiarhost.jf.intel.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6b6171db
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -213,6 +213,19 @@ attribute-sets:
        name: recycle-released-refcnt
        type: uint

  -
    name: napi
    attributes:
      -
        name: ifindex
        doc: ifindex of the netdevice to which NAPI instance belongs.
        type: u32
        checks:
          min: 1
      -
        name: id
        doc: ID of the NAPI instance.
        type: u32
  -
    name: queue
    attributes:
@@ -359,6 +372,23 @@ operations:
          attributes:
            - ifindex
        reply: *queue-get-op
    -
      name: napi-get
      doc: Get information about NAPI instances configured on the system.
      attribute-set: napi
      do:
        request:
          attributes:
            - id
        reply: &napi-get-op
          attributes:
            - id
            - ifindex
      dump:
        request:
          attributes:
            - ifindex
        reply: *napi-get-op

mcast-groups:
  list:
+9 −0
Original line number Diff line number Diff line
@@ -109,6 +109,14 @@ enum {
	NETDEV_A_PAGE_POOL_STATS_MAX = (__NETDEV_A_PAGE_POOL_STATS_MAX - 1)
};

enum {
	NETDEV_A_NAPI_IFINDEX = 1,
	NETDEV_A_NAPI_ID,

	__NETDEV_A_NAPI_MAX,
	NETDEV_A_NAPI_MAX = (__NETDEV_A_NAPI_MAX - 1)
};

enum {
	NETDEV_A_QUEUE_ID = 1,
	NETDEV_A_QUEUE_IFINDEX,
@@ -130,6 +138,7 @@ enum {
	NETDEV_CMD_PAGE_POOL_CHANGE_NTF,
	NETDEV_CMD_PAGE_POOL_STATS_GET,
	NETDEV_CMD_QUEUE_GET,
	NETDEV_CMD_NAPI_GET,

	__NETDEV_CMD_MAX,
	NETDEV_CMD_MAX = (__NETDEV_CMD_MAX - 1)
+24 −0
Original line number Diff line number Diff line
@@ -58,6 +58,16 @@ static const struct nla_policy netdev_queue_get_dump_nl_policy[NETDEV_A_QUEUE_IF
	[NETDEV_A_QUEUE_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1),
};

/* NETDEV_CMD_NAPI_GET - do */
static const struct nla_policy netdev_napi_get_do_nl_policy[NETDEV_A_NAPI_ID + 1] = {
	[NETDEV_A_NAPI_ID] = { .type = NLA_U32, },
};

/* NETDEV_CMD_NAPI_GET - dump */
static const struct nla_policy netdev_napi_get_dump_nl_policy[NETDEV_A_NAPI_IFINDEX + 1] = {
	[NETDEV_A_NAPI_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1),
};

/* Ops table for netdev */
static const struct genl_split_ops netdev_nl_ops[] = {
	{
@@ -114,6 +124,20 @@ static const struct genl_split_ops netdev_nl_ops[] = {
		.maxattr	= NETDEV_A_QUEUE_IFINDEX,
		.flags		= GENL_CMD_CAP_DUMP,
	},
	{
		.cmd		= NETDEV_CMD_NAPI_GET,
		.doit		= netdev_nl_napi_get_doit,
		.policy		= netdev_napi_get_do_nl_policy,
		.maxattr	= NETDEV_A_NAPI_ID,
		.flags		= GENL_CMD_CAP_DO,
	},
	{
		.cmd		= NETDEV_CMD_NAPI_GET,
		.dumpit		= netdev_nl_napi_get_dumpit,
		.policy		= netdev_napi_get_dump_nl_policy,
		.maxattr	= NETDEV_A_NAPI_IFINDEX,
		.flags		= GENL_CMD_CAP_DUMP,
	},
};

static const struct genl_multicast_group netdev_nl_mcgrps[] = {
+2 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ int netdev_nl_page_pool_stats_get_dumpit(struct sk_buff *skb,
int netdev_nl_queue_get_doit(struct sk_buff *skb, struct genl_info *info);
int netdev_nl_queue_get_dumpit(struct sk_buff *skb,
			       struct netlink_callback *cb);
int netdev_nl_napi_get_doit(struct sk_buff *skb, struct genl_info *info);
int netdev_nl_napi_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb);

enum {
	NETDEV_NLGRP_MGMT,
+10 −0
Original line number Diff line number Diff line
@@ -155,6 +155,16 @@ int netdev_nl_dev_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
	return skb->len;
}

int netdev_nl_napi_get_doit(struct sk_buff *skb, struct genl_info *info)
{
	return -EOPNOTSUPP;
}

int netdev_nl_napi_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
{
	return -EOPNOTSUPP;
}

static int
netdev_nl_queue_fill_one(struct sk_buff *rsp, struct net_device *netdev,
			 u32 q_idx, u32 q_type, const struct genl_info *info)
Loading