[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231116005327.365065ab@kernel.org>
Date: Thu, 16 Nov 2023 00:53:27 -0500
From: Jakub Kicinski <kuba@...nel.org>
To: "Nambiar, Amritha" <amritha.nambiar@...el.com>
Cc: <netdev@...r.kernel.org>, <pabeni@...hat.com>,
<sridhar.samudrala@...el.com>
Subject: Re: [net-next PATCH v7 01/10] netdev-genl: spec: Extend netdev
netlink spec in YAML for queue
On Wed, 15 Nov 2023 13:05:24 -0800 Nambiar, Amritha wrote:
> We could drop the word "queue" from all attrs of queue-object and also
> the word "napi" from all attrs of napi-object. Only concern is, queue
> object will have NAPI-ID as "napi-id" while the napi object will have
> NAPI-ID as "id". Same values but referred to as "id" and "napi-id"
> depending on the object (although should be fine as the command names
> carry the object names).
> Here's an example how this would look:
>
> $ queue-get --json='{"ifindex": 12, "id": 0, "type": 0}'
> {'ifindex': 12, 'napi-id': 593, 'id': 0, 'type': 'rx'}
>
> $ napi-get --json='{"id": 593}'
> {'ifindex': 12, 'irq': 291, 'id': 593, 'pid': 3817}
>
> Let me know if this is okay.
It's a bit of a judgment call. The CLI JSON obviously looks fine with
the $obj-id format, perhaps even a tiny bit more consistent.
But the C uAPI defines are unpleasant with the NETDEV_$OBJ_$OBJ_ID
repetition. And I think the same thing would happen in Python code.
I'm guessing user may end up writing code like:
queue = netdev.get_queue({'id': X, 'type': "rx"})
do_something_with(queue_id=queue["id"])
which seems pretty clear. With the $obj-id it'd be:
queue = netdev.get_queue({'queue-id': X, 'queue-type': "rx"})
^^^^^ ^^^^^ ^^^^^
do_something_with(queue_id=queue["queue-id"])
^^^^^ ^^^^^ ^^^^^
IOW we'd also say "queue" a lot...
So yes, I'm only 80% sure we won't regret this but let's drop the
$obj AKA queue / napi prefix.
Powered by blists - more mailing lists