From 240da8b2143b7be372cf6388f028b26b15f16776 Mon Sep 17 00:00:00 2001 From: Zhike Wang <wangzhike@jd.com> Date: Fri, 5 Jan 2018 02:28:06 -0800 Subject: [PATCH] net/virtio: init MTU in case no control channel The max_mtu is kept as zero in case no CRTL channel, which leads to failure when calling virtio_mtu_set(). Signed-off-by: Zhike Wang <wangzhike@jd.com> Acked-by: Zhiyong Yang <zhiyong.yang@intel.com> Acked-by: Yuanhan Liu <yliu@fridaylinux.org> --- drivers/net/virtio/virtio_ethdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index ebb968c4bb..954989efc0 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1482,6 +1482,8 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) } else { PMD_INIT_LOG(DEBUG, "config->max_virtqueue_pairs=1"); hw->max_queue_pairs = 1; + hw->max_mtu = VIRTIO_MAX_RX_PKTLEN - ETHER_HDR_LEN - + VLAN_TAG_LEN - hw->vtnet_hdr_size; } ret = virtio_alloc_queues(eth_dev); -- 2.39.5