From: Jakub Kicinski <kuba@kernel.org>
To: "Nambiar, Amritha" <amritha.nambiar@intel.com>
Cc: <netdev@vger.kernel.org>, <sridhar.samudrala@intel.com>
Subject: Re: [net-next PATCH v4 04/10] netdev-genl: Add netlink framework functions for queue
Date: Thu, 12 Oct 2023 16:48:53 -0700 [thread overview]
Message-ID: <20231012164853.7882fa86@kernel.org> (raw)
In-Reply-To: <fe26f9b6-ff3d-441d-887d-9f65d44f06d0@intel.com>
On Wed, 11 Oct 2023 16:54:00 -0700 Nambiar, Amritha wrote:
> >> +static int netdev_nl_queue_validate(struct net_device *netdev, u32 q_id,
> >> + u32 q_type)
> >> +{
> >> + switch (q_type) {
> >> + case NETDEV_QUEUE_TYPE_RX:
> >> + if (q_id >= netdev->real_num_rx_queues)
> >> + return -EINVAL;
> >> + return 0;
> >> + case NETDEV_QUEUE_TYPE_TX:
> >> + if (q_id >= netdev->real_num_tx_queues)
> >> + return -EINVAL;
> >> + return 0;
> >> + default:
> >> + return -EOPNOTSUPP;
> >
> > Doesn't the netlink policy prevent this already?
>
> For this, should I be using "checks: max:" as an attribute property for
> the 'queue-id' attribute in the yaml. If so, not sure how I can give a
> custom value (not hard-coded) for max.
> Or should I include a pre-doit hook.
Weird, I was convinced that if you specify enum by default the code gen
will automatically generate the range check to make sure that the value
is within the enum..
Looks like it does, this is the policy, right?
+static const struct nla_policy netdev_queue_get_do_nl_policy[NETDEV_A_QUEUE_QUEUE_TYPE + 1] = {
+ [NETDEV_A_QUEUE_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1),
+ [NETDEV_A_QUEUE_QUEUE_TYPE] = NLA_POLICY_MAX(NLA_U32, 1),
^^^^^^^^^^^^^^^^^^^^^^^^^^^
next prev parent reply other threads:[~2023-10-12 23:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-06 9:14 [net-next PATCH v4 00/10] Introduce queue and NAPI support in netdev-genl (Was: Introduce NAPI queues support) Amritha Nambiar
2023-10-06 9:14 ` [net-next PATCH v4 01/10] netdev-genl: spec: Extend netdev netlink spec in YAML for queue Amritha Nambiar
2023-10-11 2:12 ` Jakub Kicinski
2023-10-11 23:28 ` Nambiar, Amritha
2023-10-06 9:14 ` [net-next PATCH v4 02/10] net: Add queue and napi association Amritha Nambiar
2023-10-11 2:17 ` Jakub Kicinski
2023-10-11 23:36 ` Nambiar, Amritha
2023-10-06 9:14 ` [net-next PATCH v4 03/10] ice: Add support in the driver for associating queue with napi Amritha Nambiar
2023-10-06 9:14 ` [net-next PATCH v4 04/10] netdev-genl: Add netlink framework functions for queue Amritha Nambiar
2023-10-11 2:25 ` Jakub Kicinski
2023-10-11 23:54 ` Nambiar, Amritha
2023-10-12 23:48 ` Jakub Kicinski [this message]
2023-10-13 0:24 ` Nambiar, Amritha
2023-10-13 0:36 ` Jakub Kicinski
2023-10-13 0:40 ` Nambiar, Amritha
2023-10-13 0:44 ` Jakub Kicinski
2023-10-06 9:15 ` [net-next PATCH v4 05/10] netdev-genl: spec: Extend netdev netlink spec in YAML for NAPI Amritha Nambiar
2023-10-06 9:15 ` [net-next PATCH v4 06/10] netdev-genl: Add netlink framework functions for napi Amritha Nambiar
2023-10-11 2:29 ` Jakub Kicinski
2023-10-11 23:55 ` Nambiar, Amritha
2023-10-06 9:15 ` [net-next PATCH v4 07/10] netdev-genl: spec: Add irq in netdev netlink YAML spec Amritha Nambiar
2023-10-06 9:15 ` [net-next PATCH v4 08/10] net: Add NAPI IRQ support Amritha Nambiar
2023-10-06 9:15 ` [net-next PATCH v4 09/10] netdev-genl: spec: Add PID in netdev netlink YAML spec Amritha Nambiar
2023-10-06 9:15 ` [net-next PATCH v4 10/10] netdev-genl: Add PID for the NAPI thread Amritha Nambiar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231012164853.7882fa86@kernel.org \
--to=kuba@kernel.org \
--cc=amritha.nambiar@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sridhar.samudrala@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).