[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230808194511.538a0784@kernel.org>
Date: Tue, 8 Aug 2023 19:45:11 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: "Nambiar, Amritha" <amritha.nambiar@...el.com>
Cc: <netdev@...r.kernel.org>, <davem@...emloft.net>,
<sridhar.samudrala@...el.com>
Subject: Re: [net-next PATCH v1 3/9] netdev-genl: spec: Extend netdev
netlink spec in YAML for NAPI
On Tue, 8 Aug 2023 17:17:34 -0700 Nambiar, Amritha wrote:
> > The main thing to focus on for next version is to make the NAPI objects
> > "flat" and individual, rather than entries in multi-attr nest within
> > per-netdev object.
>
> Would this be acceptable:
> $ netdev.yaml --do napi-get --json='{"ifindex": 12}'
>
> {'napi-info': [{'ifindex': 12, 'irq': 293, 'napi-id': 595, ...},
> {'ifindex': 12, 'irq': 292, 'napi-id': 594, ...},
> {'ifindex': 12, 'irq': 291, 'napi-id': 593, ...}]}
>
> Here, "napi-info" represents a list of NAPI objects. A NAPI object is an
> individual element in the list, and are not within per-netdev object.
> The ifindex is just another attribute that is part of the NAPI object.
> The result for non-NAPI devices will just be empty.
>
> I am not sure how to totally avoid multi-attr nest in this case. For the
> 'do napi-get' command, the response is a list of elements with multiple
> attributes and not an individual entry. This transforms to a struct
> array of NAPI objects in the 'do' response, and is achieved with the
> multi-attr nest in the YAML. Subsequently, the 'dump napi-get' response
> is a list of the 'NAPI objects struct list' for all netdevs. Am I
> missing any special type in the YAML that can also give out a
> struct-array in the 'do' response besides using multi-attr nest ?
napi-get needs to take napi-id as an argument, if you want to filter
by ifindex - that means a dump. Dumps work kind-of similar to do, you
still get the attributes for the request (although in a somewhat
convoluted way:
static int your_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
{
const struct genl_dumpit_info *info = genl_dumpit_info(cb);
info->attr[attrs-as-normal]
So if info->attrs[IFINDEX] is provided by the user - limit the dump to
only napis from that netdev.
Powered by blists - more mailing lists