mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alvaro Karsz <alvaro.karsz@solid-run.com>
To: mst@redhat.com, jasowang@redhat.com
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	xuanzhuo@linux.alibaba.com,
	Alvaro Karsz <alvaro.karsz@solid-run.com>
Subject: [RFC PATCH net 0/3] virtio-net: allow usage of small vrings
Date: Sun, 30 Apr 2023 16:15:15 +0300	[thread overview]
Message-ID: <20230430131518.2708471-1-alvaro.karsz@solid-run.com> (raw)

At the moment, if a virtio network device uses vrings with less than
MAX_SKB_FRAGS + 2 entries, the device won't be functional.

The following condition vq->num_free >= 2 + MAX_SKB_FRAGS will always
evaluate to false, leading to TX timeouts.

This patchset attempts this fix this bug, and to allow small rings down
to 4 entries.

The first patch introduces a new mechanism in virtio core - it allows to
block features in probe time.

If a virtio drivers blocks features and fails probe, virtio core will
reset the device, re-negotiate the features and probe again.

This is needed since some virtio net features are not supported with
small rings.

This patchset follows a discussion in the mailing list [1].

This fixes only part of the bug, rings with less than 4 entries won't
work.
My intention is to split the effort and fix the RING_SIZE < 4 case in a
follow up patchset.

Maybe we should fail probe if RING_SIZE < 4 until the follow up patchset?

I tested the patchset with SNET DPU (drivers/vdpa/solidrun), with packed
and split VQs, with rings down to 4 entries, with and without
VIRTIO_NET_F_MRG_RXBUF, with big MTUs.

I would appreciate more testing.
Xuan: I wasn't able to test XDP with my setup, maybe you can help with
that?

[1] https://lore.kernel.org/lkml/20230416074607.292616-1-alvaro.karsz@solid-run.com/

Alvaro Karsz (3):
  virtio: re-negotiate features if probe fails and features are blocked
  virtio-net: allow usage of vrings smaller than MAX_SKB_FRAGS + 2
  virtio-net: block ethtool from converting a ring to a small ring

 drivers/net/virtio_net.c | 161 +++++++++++++++++++++++++++++++++++++--
 drivers/virtio/virtio.c  |  73 +++++++++++++-----
 include/linux/virtio.h   |   3 +
 3 files changed, 212 insertions(+), 25 deletions(-)

-- 
2.34.1


             reply	other threads:[~2023-04-30 13:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-30 13:15 Alvaro Karsz [this message]
2023-04-30 13:15 ` [RFC PATCH net 1/3] virtio: re-negotiate features if probe fails and features are blocked Alvaro Karsz
2023-04-30 13:27   ` Michael S. Tsirkin
2023-04-30 18:18     ` Alvaro Karsz
2023-04-30 13:15 ` [RFC PATCH net 2/3] virtio-net: allow usage of vrings smaller than MAX_SKB_FRAGS + 2 Alvaro Karsz
2023-04-30 14:05   ` Michael S. Tsirkin
2023-04-30 18:54     ` Alvaro Karsz
2023-05-01 10:20       ` Michael S. Tsirkin
2023-05-01 11:59         ` Alvaro Karsz
2023-06-02 11:30           ` Michael S. Tsirkin
2023-04-30 13:15 ` [RFC PATCH net 3/3] virtio-net: block ethtool from converting a ring to a small ring Alvaro Karsz
2023-04-30 14:06 ` [RFC PATCH net 0/3] virtio-net: allow usage of small vrings Michael S. Tsirkin
2023-04-30 18:15   ` Alvaro Karsz
2023-05-01 10:27     ` Michael S. Tsirkin
2023-05-01 11:41       ` Alvaro Karsz
2023-06-02 11:29         ` Michael S. Tsirkin
2023-06-17  7:44 ` Michael S. Tsirkin

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=20230430131518.2708471-1-alvaro.karsz@solid-run.com \
    --to=alvaro.karsz@solid-run.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xuanzhuo@linux.alibaba.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

all inboxes | Powered by JetHome®