virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio_net: enable big packets for large MTU values
@ 2017-03-29 12:38 Michael S. Tsirkin
  2017-03-29 16:13 ` Michael S. Tsirkin
  2017-03-30  4:03 ` Jason Wang
  0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2017-03-29 12:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, virtualization

If one enables e.g. jumbo frames without mergeable
buffers, packets won't fit in 1500 byte buffers
we use. Switch to big packet mode instead.
TODO: make sizing more exact, possibly extend small
packet mode to use larger pages.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/net/virtio_net.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index e0fb3707..9dc31dc 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2428,6 +2428,10 @@ static int virtnet_probe(struct virtio_device *vdev)
 			dev->mtu = mtu;
 			dev->max_mtu = mtu;
 		}
+
+		/* TODO: size buffers correctly in this case. */
+		if (dev->mtu > ETH_DATA_LEN)
+			vi->big_packets = true;
 	}
 
 	if (vi->any_header_sg)
-- 
MST

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] virtio_net: enable big packets for large MTU values
  2017-03-29 12:38 [PATCH] virtio_net: enable big packets for large MTU values Michael S. Tsirkin
@ 2017-03-29 16:13 ` Michael S. Tsirkin
  2017-03-30  4:03 ` Jason Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2017-03-29 16:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, virtualization

On Wed, Mar 29, 2017 at 03:38:09PM +0300, Michael S. Tsirkin wrote:
> If one enables e.g. jumbo frames without mergeable
> buffers, packets won't fit in 1500 byte buffers
> we use. Switch to big packet mode instead.
> TODO: make sizing more exact, possibly extend small
> packet mode to use larger pages.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Fixes: 14de9d114a82 ("virtio-net: Add initial MTU advice feature")

> ---
>  drivers/net/virtio_net.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index e0fb3707..9dc31dc 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2428,6 +2428,10 @@ static int virtnet_probe(struct virtio_device *vdev)
>  			dev->mtu = mtu;
>  			dev->max_mtu = mtu;
>  		}
> +
> +		/* TODO: size buffers correctly in this case. */
> +		if (dev->mtu > ETH_DATA_LEN)
> +			vi->big_packets = true;
>  	}
>  
>  	if (vi->any_header_sg)
> -- 
> MST

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] virtio_net: enable big packets for large MTU values
  2017-03-29 12:38 [PATCH] virtio_net: enable big packets for large MTU values Michael S. Tsirkin
  2017-03-29 16:13 ` Michael S. Tsirkin
@ 2017-03-30  4:03 ` Jason Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2017-03-30  4:03 UTC (permalink / raw)
  To: Michael S. Tsirkin, linux-kernel; +Cc: netdev, virtualization



On 2017年03月29日 20:38, Michael S. Tsirkin wrote:
> If one enables e.g. jumbo frames without mergeable
> buffers, packets won't fit in 1500 byte buffers
> we use. Switch to big packet mode instead.
> TODO: make sizing more exact, possibly extend small
> packet mode to use larger pages.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>   drivers/net/virtio_net.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index e0fb3707..9dc31dc 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2428,6 +2428,10 @@ static int virtnet_probe(struct virtio_device *vdev)
>   			dev->mtu = mtu;
>   			dev->max_mtu = mtu;
>   		}
> +
> +		/* TODO: size buffers correctly in this case. */
> +		if (dev->mtu > ETH_DATA_LEN)
> +			vi->big_packets = true;
>   	}
>   
>   	if (vi->any_header_sg)

Ok, I think maybe we should fail the probe of small buffer in this case 
and decrease the max_mtu to ETH_DATA_LEN if small buffer is used (since 
user are allowed to increase the mtu).

Thanks
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-30  4:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-29 12:38 [PATCH] virtio_net: enable big packets for large MTU values Michael S. Tsirkin
2017-03-29 16:13 ` Michael S. Tsirkin
2017-03-30  4:03 ` Jason Wang

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).