[dpdk-dev] [PATCH v1] add mtu set in virtio

Stephen Hemminger stephen at networkplumber.org
Mon Aug 29 21:33:06 CEST 2016


On Sun, 28 Aug 2016 22:43:54 +0000
"Dey, Souvik" <sodey at sonusnet.com> wrote:

> 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 ?

This looks good, but you really don't need likely/unlikely in this code.
It is not at all performance critical.


More information about the dev mailing list