netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: David Ahern <dahern@digitalocean.com>
Cc: Jason Wang <jasowang@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: virtio_net: can change MTU after installing program
Date: Wed, 26 Feb 2020 11:56:18 -0500	[thread overview]
Message-ID: <20200226115541-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <c8f874c6-3271-6bd1-f3b9-4d0b0786cd52@digitalocean.com>

On Wed, Feb 26, 2020 at 09:08:57AM -0700, David Ahern wrote:
> On 2/26/20 12:07 AM, Michael S. Tsirkin wrote:
> > 
> > Well the reason XDP wants to limit MTU is this:
> >     the MTU must be less than a page
> >     size to avoid having to handle XDP across multiple pages
> > 
> > however device mtu basically comes from dhcp.
> 
> Not necessarily.
> 
> > it is assumed that whoever configured it knew
> > what he's doing and configured mtu to match
> > what's going on on the underlying backend.
> > So we are trusting the user already.
> > 
> > But yes, one can configure mtu later and then it's too late
> > as xdp was attached.
> > 
> > 
> >>
> >>
> >> The simple solution is:
> >>
> >> @@ -2489,6 +2495,8 @@ static int virtnet_xdp_set(struct net_device *dev,
> >> struct bpf_prog *prog,
> >>                 }
> >>         }
> >>
> >> +       dev->max_mtu = prog ? max_sz : MAX_MTU;
> >> +
> >>         return 0;
> >>
> >>  err:
> > 
> > 
> > Well max MTU comes from the device ATM and supplies the limit
> > of the underlying backend. Why is it OK to set it to MAX_MTU?
> > That's just asking for trouble IMHO, traffic will not
> > be packetized properly.
> 
> I grabbed that from virtnet_probe() for sake of this discussion:
> 
>         /* MTU range: 68 - 65535 */
>         dev->min_mtu = MIN_MTU;
>         dev->max_mtu = MAX_MTU;
> 
> but yes I see the MTU probe now, so I guess that could be used instead
> of MAX_MTU.
> 
> > 
> > 
> >> The complicated solution is to implement ndo_change_mtu.
> >>
> >> The simple solution causes a user visible change with 'ip -d li sh' by
> >> showing a changing max mtu, but the ndo has a poor user experience in
> >> that it just fails EINVAL (their is no extack) which is confusing since,
> >> for example, 8192 is a totally legit MTU. Changing the max does return a
> >> nice extack message.
> > 
> > Just fail with EBUSY instead?
> > 
> 
> consistency. If other change_mtu functions fail EINVAL, then virtio net
> needs to follow suit.

Maybe we should change them all to EBUSY - that's not too hard ...

-- 
MST


  reply	other threads:[~2020-02-26 16:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26  9:33 Michael S. Tsirkin
2020-02-26  3:32 ` virtio_net: can change MTU after installing program David Ahern
2020-02-26  4:02   ` Jason Wang
2020-02-26  4:31     ` David Ahern
2020-02-26  5:53       ` Jason Wang
2020-02-26 16:04         ` David Ahern
2020-02-26  7:07   ` Michael S. Tsirkin
2020-02-26  7:37     ` Jason Wang
2020-02-26  8:39       ` Michael S. Tsirkin
2020-02-26  9:30         ` Jason Wang
2020-02-26  9:36           ` Michael S. Tsirkin
2020-02-26 16:08     ` David Ahern
2020-02-26 16:56       ` Michael S. Tsirkin [this message]
2020-02-26  9:51   ` Toke Høiland-Jørgensen
2020-02-26 16:03     ` David Ahern
2020-02-26 16:55       ` Michael S. Tsirkin
2020-02-26 16:58         ` David Ahern
2020-02-26 17:02           ` Michael S. Tsirkin
2020-02-27  1:37             ` Jakub Kicinski
2020-02-27  8:14               ` Michael S. Tsirkin
2020-02-27 17:16                 ` Jakub Kicinski
2020-02-27 19:26               ` Michael Chan
2020-02-27 19:45                 ` Jakub Kicinski
2020-02-27 21:37                 ` David Ahern

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=20200226115541-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=dahern@digitalocean.com \
    --cc=jasowang@redhat.com \
    --cc=netdev@vger.kernel.org \
    /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).