Re: [PATCH v1] add mtu set in virtio
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2016-08-29 19:32:55
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2016-08-29 19:32:55
On Sun, 28 Aug 2016 22:43:54 +0000 "Dey, Souvik" [off-list ref] 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.