[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1729824434.8051903-4-xuanzhuo@linux.alibaba.com>
Date: Fri, 25 Oct 2024 10:47:14 +0800
From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To: Jason Wang <jasowang@...hat.com>
Cc: netdev@...r.kernel.org,
"Michael S. Tsirkin" <mst@...hat.com>,
Eugenio Pérez <eperezma@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
virtualization@...ts.linux.dev
Subject: Re: [PATCH 2/5] virtio_net: introduce vi->mode
On Fri, 18 Oct 2024 15:48:38 +0800, Jason Wang <jasowang@...hat.com> wrote:
> On Mon, Oct 14, 2024 at 11:12 AM Xuan Zhuo <xuanzhuo@...ux.alibaba.com> wrote:
> >
> > Now, if we want to judge the rx work mode, we have to use such codes:
> >
> > 1. merge mode: vi->mergeable_rx_bufs
> > 2. big mode: vi->big_packets && !vi->mergeable_rx_bufs
> > 3. small: !vi->big_packets && !vi->mergeable_rx_bufs
> >
> > This is inconvenient and abstract, and we also have this use case:
> >
> > if (vi->mergeable_rx_bufs)
> > ....
> > else if (vi->big_packets)
> > ....
> > else
> >
> > For this case, I think switch-case is the better choice.
> >
> > So here I introduce vi->mode to record the virtio-net work mode.
> > That is helpful to judge the work mode and choose the branches.
> >
> > Signed-off-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> > ---
> > drivers/net/virtio_net.c | 61 +++++++++++++++++++++++++++++++---------
> > 1 file changed, 47 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index 59a99bbaf852..14809b614d62 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -385,6 +385,12 @@ struct control_buf {
> > virtio_net_ctrl_ack status;
> > };
> >
> > +enum virtnet_mode {
> > + VIRTNET_MODE_SMALL,
> > + VIRTNET_MODE_MERGE,
> > + VIRTNET_MODE_BIG
> > +};
>
> I'm not sure if this can ease or not.
>
> [...]
>
> > + if (vi->mergeable_rx_bufs)
> > + vi->mode = VIRTNET_MODE_MERGE;
> > + else if (vi->big_packets)
> > + vi->mode = VIRTNET_MODE_BIG;
>
> Maybe we can just say big_packets doesn't mean big mode.
>
> > + else
> > + vi->mode = VIRTNET_MODE_SMALL;
> > +
> > if (vi->any_header_sg)
> > dev->needed_headroom = vi->hdr_len;
>
> Anyhow this seems not a fix so it should be a separate series than patch 1?
I think this series is not about fixing the problem, the feature was disabled in
the last Linux version. This series is about turning the pre-mapped mode of rx
back on.
This commit tries to make things easier. The current code is very unintuitive
when we try to switch or check the virtio-net rx mode
Thanks.
>
> Thanks
>
> >
> > --
> > 2.32.0.3.g01195cf9f
> >
>
Powered by blists - more mailing lists