From: "Toke Høiland-Jørgensen" <toke@redhat•com>
To: Paolo Abeni <pabeni@redhat•com>, netdev@vger•kernel.org
Cc: "David S. Miller" <davem@davemloft•net>,
Jakub Kicinski <kuba@kernel•org>
Subject: Re: [RFC PATCH 1/3] veth: implement support for set_channel ethtool op
Date: Fri, 09 Jul 2021 13:36:22 +0200 [thread overview]
Message-ID: <87zguvu3bd.fsf@toke.dk> (raw)
In-Reply-To: <1c3d691c01121e4110f23d5947b2809d5cce056b.camel@redhat.com>
Paolo Abeni <pabeni@redhat•com> writes:
> Hello,
>
> On Fri, 2021-07-09 at 12:15 +0200, Toke Høiland-Jørgensen wrote:
>> > @@ -224,10 +226,49 @@ static void veth_get_channels(struct net_device *dev,
>> > {
>> > channels->tx_count = dev->real_num_tx_queues;
>> > channels->rx_count = dev->real_num_rx_queues;
>> > - channels->max_tx = dev->real_num_tx_queues;
>> > - channels->max_rx = dev->real_num_rx_queues;
>> > + channels->max_tx = dev->num_tx_queues;
>> > + channels->max_rx = dev->num_rx_queues;
>> > channels->combined_count = min(dev->real_num_rx_queues, dev->real_num_tx_queues);
>> > - channels->max_combined = min(dev->real_num_rx_queues, dev->real_num_tx_queues);
>> > + channels->max_combined = min(dev->num_rx_queues, dev->num_tx_queues);
>> > +}
>> > +
>> > +static int veth_close(struct net_device *dev);
>> > +static int veth_open(struct net_device *dev);
>> > +
>> > +static int veth_set_channels(struct net_device *dev,
>> > + struct ethtool_channels *ch)
>> > +{
>> > + struct veth_priv *priv = netdev_priv(dev);
>> > + struct veth_priv *peer_priv;
>> > +
>> > + /* accept changes only on rx/tx */
>> > + if (ch->combined_count != min(dev->real_num_rx_queues, dev->real_num_tx_queues))
>> > + return -EINVAL;
>> > +
>> > + /* respect contraint posed at device creation time */
>> > + if (ch->rx_count > dev->num_rx_queues || ch->tx_count > dev->num_tx_queues)
>> > + return -EINVAL;
>> > +
>> > + if (!ch->rx_count || !ch->tx_count)
>> > + return -EINVAL;
>> > +
>> > + /* avoid braking XDP, if that is enabled */
>> > + if (priv->_xdp_prog && ch->rx_count < priv->peer->real_num_tx_queues)
>> > + return -EINVAL;
>> > +
>> > + peer_priv = netdev_priv(priv->peer);
>> > + if (peer_priv->_xdp_prog && ch->tx_count > priv->peer->real_num_rx_queues)
>> > + return -EINVAL;
>>
>> An XDP program could be loaded later, so I think it's better to enforce
>> this constraint unconditionally.
>
> The relevant check is already present in veth_xdp_set(), the load will
> be rejected with an appropriate extack message.
Ah, right, of course; silly me, that's fine then... :)
> I enforcing the above contraint uncontiditionally will make impossible
> changing the number of real queues at runtime, as we must update dev
> and peer in different moments.
>
>> (What happens on the regular xmit path if the number of TX queues is out
>> of sync with the peer RX queues, BTW?)
>
> if tx < rx, the higly number of rx queue will not be used, if rx < tx,
> XDP/gro can't take place: the normal veth path is used.
Right, OK, that's probably also fine then :)
-Toke
next prev parent reply other threads:[~2021-07-09 11:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-09 9:39 [RFC PATCH 0/3] veth: more flexible channels number configuration Paolo Abeni
2021-07-09 9:39 ` [RFC PATCH 1/3] veth: implement support for set_channel ethtool op Paolo Abeni
2021-07-09 10:15 ` Toke Høiland-Jørgensen
2021-07-09 10:49 ` Paolo Abeni
2021-07-09 11:36 ` Toke Høiland-Jørgensen [this message]
2021-07-09 14:38 ` Paolo Abeni
2021-07-09 15:23 ` Toke Høiland-Jørgensen
2021-07-09 16:35 ` Paolo Abeni
2021-07-09 19:56 ` Jakub Kicinski
2021-07-09 19:54 ` Jakub Kicinski
2021-07-12 1:44 ` David Ahern
2021-07-12 10:45 ` Paolo Abeni
2021-07-12 15:23 ` Jakub Kicinski
2021-07-09 9:39 ` [RFC PATCH 2/3] veth: make queues nr configurable via kernel module params Paolo Abeni
2021-07-09 10:24 ` Toke Høiland-Jørgensen
2021-07-09 15:33 ` Paolo Abeni
2021-07-09 16:12 ` Toke Høiland-Jørgensen
2021-07-09 9:39 ` [RFC PATCH 3/3] selftests: net: veth: add tests for set_channel Paolo Abeni
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=87zguvu3bd.fsf@toke.dk \
--to=toke@redhat$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=kuba@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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