Thread (5 messages) 5 messages, 2 authors, 2016-08-29

Re: [PATCH v1] add mtu set in virtio

From: Dey, Souvik <hidden>
Date: 2016-08-28 22:43:58

Hi ,
	Currently as you have mentioned, I have changed the code to:
static int 
 virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) 
 {
    struct virtio_hw *hw = dev->data->dev_private;
-   if (unlikely(mtu < (uint32_t)hw->vtnet_hdr_size + ETHER_HDR_LEN)) {
-       return -1;
+   if (unlikely(mtu < VIRTIO_MIN_RX_BUFSIZE || mtu > VIRTIO_MAX_RX_PKTLEN)) {
+	   PMD_INIT_LOG(ERR,"Mtu should be between 64 and 9728."
+       return -EINVAL;
    }
    return 0;
 }

Yes, we should support till 64K as the kernel does , but I need to go through the changes and test it properly before submitting it for review. Moreover I was thinking with the changes in the mtu, we should also support multi-segment buffers in kni. What do you suggest ?

--
Regards,
Souvik

-----Original Message-----
From: Stephen Hemminger [mailto:stephen@networkplumber.org] 
Sent: Saturday, August 27, 2016 8:16 PM
To: Dey, Souvik <redacted>
Cc: huawei.xie@intel.com; yuanhan.liu@linux.intel.com; dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v1] add mtu set in virtio

On Fri, 26 Aug 2016 20:54:28 -0400
souvikdey33 [off-list ref] wrote:
This functionality is required mostly in the cloud infrastructure.
For example, if we use gre or vxlan network between compute and 
controller, then we should not use 1500 mtu in the guest as with 
encapsulation the sixe of the packet will be more and will get dropped 
in the infrastructure. So, in that case we should honor the mtu size 
sent by the dhcp server and configure the same on the virtual 
interfaces in the guest. This will also keep a consistent mtu through 
out the infrastructure.

souvikdey33 (1):
  Signed-off-by: Souvik Dey [off-list ref]

 drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Thanks for the patch, it is a good step forward but it looks like more code is needed to do this safely. At a minimum, need to check that MTU is not greater than VIRTIO_MAX_RX_PKTLEN.
And error return should be negative errno not -1.

Something like:
   if (mtu < VIRTIO_MIN_MTU || mtu > VIRTIO_MAX_RX_PKTLEN)
	return -EINVAL;

Looking at Linux driver, it allows MTU of up to 64K, yet DPDK only allows 9728.  That should probably be fixed.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help