[PATCH net] virtio-net: alloc big buffers also when guest can receive UFO

Subsystems: networking drivers, the rest, virtio net driver

STALE4559d

5 messages, 2 authors, 2014-02-13 · open the first message on its own page

[PATCH net] virtio-net: alloc big buffers also when guest can receive UFO

From: Jason Wang <hidden>
Date: 2014-02-12 05:43:40

We should alloc big buffers also when guest can receive UFO
pakcets. Otherwise the big packets will be truncated when mergeable rx
buffer is disabled.

Fixes 5c5167515d80f78f6bb538492c423adcae31ad65
(virtio-net: Allow UFO feature to be set and advertised.)

Cc: Rusty Russell <redacted>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Sridhar Samudrala <redacted>
Signed-off-by: Jason Wang <redacted>
---
 drivers/net/virtio_net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index d75f8ed..5632a99 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1711,7 +1711,8 @@ static int virtnet_probe(struct virtio_device *vdev)
 	/* If we can receive ANY GSO packets, we must allocate large ones. */
 	if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
 	    virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) ||
-	    virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN))
+	    virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) ||
+	    virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO))
 		vi->big_packets = true;
 
 	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
-- 
1.8.3.2

Re: [PATCH net] virtio-net: alloc big buffers also when guest can receive UFO

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2014-02-12 11:55:20

On Wed, Feb 12, 2014 at 01:43:28PM +0800, Jason Wang wrote:
We should alloc big buffers also when guest can receive UFO
pakcets. Otherwise the big packets will be truncated when mergeable rx
buffer is disabled.
Not truncated, they will be dropped.
Fixes 5c5167515d80f78f6bb538492c423adcae31ad65
(virtio-net: Allow UFO feature to be set and advertised.)

Cc: Rusty Russell <redacted>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Sridhar Samudrala <redacted>
Signed-off-by: Jason Wang <redacted>
Acked-by: Michael S. Tsirkin <mst@redhat.com>

for patch but please fix commit message.

quoted hunk
---
 drivers/net/virtio_net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index d75f8ed..5632a99 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1711,7 +1711,8 @@ static int virtnet_probe(struct virtio_device *vdev)
 	/* If we can receive ANY GSO packets, we must allocate large ones. */
 	if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
 	    virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) ||
-	    virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN))
+	    virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) ||
+	    virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO))
 		vi->big_packets = true;
 
 	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
-- 
1.8.3.2

Re: [PATCH net] virtio-net: alloc big buffers also when guest can receive UFO

From: Jason Wang <hidden>
Date: 2014-02-13 03:02:32

On 02/12/2014 07:59 PM, Michael S. Tsirkin wrote:
On Wed, Feb 12, 2014 at 01:43:28PM +0800, Jason Wang wrote:
quoted
quoted
We should alloc big buffers also when guest can receive UFO
pakcets. Otherwise the big packets will be truncated when mergeable rx
buffer is disabled.
Not truncated, they will be dropped.
Why dropped? We enable the ufo on tap0 if VIRTIO_NET_F_GUEST_UFO is
negotiated. So skb was queued on the receive queue. But since the
receive buffer is small, it will be truncated during tun_put_user().

Re: [PATCH net] virtio-net: alloc big buffers also when guest can receive UFO

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2014-02-13 05:11:09

On Thu, Feb 13, 2014 at 11:02:13AM +0800, Jason Wang wrote:
On 02/12/2014 07:59 PM, Michael S. Tsirkin wrote:
quoted
On Wed, Feb 12, 2014 at 01:43:28PM +0800, Jason Wang wrote:
quoted
quoted
We should alloc big buffers also when guest can receive UFO
pakcets. Otherwise the big packets will be truncated when mergeable rx
buffer is disabled.
Not truncated, they will be dropped.
Why dropped? We enable the ufo on tap0 if VIRTIO_NET_F_GUEST_UFO is
negotiated. So skb was queued on the receive queue. But since the
receive buffer is small, it will be truncated during tun_put_user().
Hypervisor shouldn't truncate packets silently - if it does
it's a hypervisor bug. Passing malformed packets to guest is
a bad idea.

-- 
MST

Re: [PATCH net] virtio-net: alloc big buffers also when guest can receive UFO

From: Jason Wang <hidden>
Date: 2014-02-13 05:41:13

On 02/13/2014 01:15 PM, Michael S. Tsirkin wrote:
On Thu, Feb 13, 2014 at 11:02:13AM +0800, Jason Wang wrote:
quoted
On 02/12/2014 07:59 PM, Michael S. Tsirkin wrote:
quoted
On Wed, Feb 12, 2014 at 01:43:28PM +0800, Jason Wang wrote:
quoted
quoted
We should alloc big buffers also when guest can receive UFO
pakcets. Otherwise the big packets will be truncated when mergeable rx
buffer is disabled.
Not truncated, they will be dropped.
Why dropped? We enable the ufo on tap0 if VIRTIO_NET_F_GUEST_UFO is
negotiated. So skb was queued on the receive queue. But since the
receive buffer is small, it will be truncated during tun_put_user().
Hypervisor shouldn't truncate packets silently - if it does
it's a hypervisor bug. Passing malformed packets to guest is
a bad idea.
Yes, but the commit log describes the current behaviour so it was ok?

Btw, dropping the packets silently is still not good. Virito needs a
method to report rx errors to guest.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help