[dpdk-dev] [PATCH v4]net/virtio: add mtu set in virtio

Yuanhan Liu yuanhan.liu at linux.intel.com
Fri Sep 9 17:42:29 CEST 2016


On Fri, Sep 09, 2016 at 03:33:32PM +0000, Dey, Souvik wrote:
> Hi Mark,
> 
> Yes I thought I did that change. Sorry once again.. making too many mistakes. Changed it . Thanks. 
> The MTU here is L3 MTU.  Setting this will help in reducing the fragmented/multi-segmented packets and also in case we want to reduce the MTU below 1500, to support VXLAN or GRE tunnel for the packets in openstack and cloud environments.  
> 
> ---
>  drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 07d6449..da16ad4 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> 
> static int virtio_dev_queue_stats_mapping_set(
>  	__rte_unused struct rte_eth_dev *eth_dev,
> @@ -652,6 +653,16 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev)
>  		PMD_INIT_LOG(ERR, "Failed to disable allmulticast");
>  }
>  
> +static int
> +virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> +{
> +	struct virtio_hw *hw = dev->data->dev_private;
> +	if (mtu < VIRTIO_MIN_RX_BUFSIZE || mtu > VIRTIO_MAX_RX_PKTLEN) {
> +		PMD_INIT_LOG(ERR, "Mtu should be between VIRTIO_MIN_RX_BUFSIZE and VIRTIO_MAX_RX_PKTLEN \n");

Unfortunately, that is still broken, in two ways:

- we should avoid long lines over 80 chars

- the range will not be correctly showed in the message, because ... (well,
  you know it).

	--yliu


More information about the dev mailing list