[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240429104741.3a628fe6@kernel.org>
Date: Mon, 29 Apr 2024 10:47:41 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Heng Qi <hengqi@...ux.alibaba.com>
Cc: netdev@...r.kernel.org, virtualization@...ts.linux.dev, "David S .
Miller" <davem@...emloft.net>, Paolo Abeni <pabeni@...hat.com>, Eric
Dumazet <edumazet@...gle.com>, Jason Wang <jasowang@...hat.com>, "Michael S
. Tsirkin" <mst@...hat.com>, Brett Creeley <bcreeley@....com>, Ratheesh
Kannoth <rkannoth@...vell.com>, Alexander Lobakin
<aleksander.lobakin@...el.com>, Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Tal
Gilboa <talgi@...dia.com>, Jonathan Corbet <corbet@....net>,
linux-doc@...r.kernel.org, Maxime Chevallier
<maxime.chevallier@...tlin.com>, Jiri Pirko <jiri@...nulli.us>, Paul
Greenwalt <paul.greenwalt@...el.com>, Ahmed Zaki <ahmed.zaki@...el.com>,
Vladimir Oltean <vladimir.oltean@....com>, Kory Maincent
<kory.maincent@...tlin.com>, Andrew Lunn <andrew@...n.ch>, "justinstitt @
google . com" <justinstitt@...gle.com>
Subject: Re: [PATCH net-next v10 2/4] ethtool: provide customized dim
profile management
On Sun, 28 Apr 2024 22:49:09 +0800 Heng Qi wrote:
> >> +#if IS_ENABLED(CONFIG_DIMLIB)
> >> + if (dev->irq_moder) {
> > This may be NULL
>
>
> Do you mean dev may be null or dev->irq_moder may be null?
> The former has been excluded (see const struct ethtool_ops *ops
>
> = req_info->dev->ethtool_ops;).
>
> And we are ruling out the latter using 'if (dev->irq_moder)'.
>
> Or something else?
Hm, I must have misread something here.
> >> + nla_for_each_nested_type(nest, ETHTOOL_A_PROFILE_IRQ_MODERATION, nests, rem) {
> >> + ret = nla_parse_nested(moder,
> >> + ARRAY_SIZE(coalesce_irq_moderation_policy) - 1,
> >> + nest, coalesce_irq_moderation_policy,
> >> + extack);
> >> + if (ret)
> >> + return ret;
> >> +
> >> + if (!NL_REQ_ATTR_CHECK(extack, nest, moder, ETHTOOL_A_IRQ_MODERATION_USEC)) {
> >> + if (irq_moder->coal_flags & DIM_COALESCE_USEC)
> > There are 3 options here, not 2:
> >
> > if (irq_moder->coal_flags & flag) {
> > if (NL_REQ_ATTR_CHECK())
> > val = nla_get_u32(...);
> > else
> > return -EINVAL;
> > } else {
> > if (moder[attr_type)) {
> > BAD_ATTR()
> > return -EOPNOTSUPP;
> > }
> > }
>
> Maybe we missed something.
>
> As shown in the commit log, the user is allowed to modify only
> a certain fields in irq-moderation. It is assumed that the driver
> supports modification of usec and pkts, but the user may only
> modify usec and only fill in the usec attr.
>
> Therefore, the kernel only gets usec attr here. Of course, the user
> may have passed in 5 groups of "n, n, n", which means that nothing
> is modified, and rx_profile and irq_moderation attrs are all empty.
What you describe sounds good, but it's not what the code seems to be
doing. NL_REQ_ATTR_CHECK() will set an error attribute if the attr is
not present.
Powered by blists - more mailing lists