[dpdk-dev] net/virtio: init MTU in case no control channel

Message ID 1515113654-2738-1-git-send-email-wangzhike@jd.com (mailing list archive)
State Superseded, archived
Delegated to: Yuanhan Liu
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

王志克 Jan. 5, 2018, 12:54 a.m. UTC
  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>
---
 drivers/net/virtio/virtio_ethdev.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Yang, Zhiyong Jan. 5, 2018, 2:11 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of zhike wang
> Sent: Friday, January 5, 2018 8:54 AM
> To: dev@dpdk.org
> Cc: zhike wang <wangzhike@jd.com>
> Subject: [dpdk-dev] [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>
> ---
>  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 21f2131..b7b3364 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1479,6 +1479,8 @@ static int virtio_dev_xstats_get_names(struct
> rte_eth_dev *dev,
>  	} 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;

Good catch!  It looks good to me.

Acked-by: Zhiyong Yang <zhiyong.yang@intel.com>

Thanks
Zhiyong
  
Thomas Monjalon Jan. 5, 2018, 10:25 a.m. UTC | #2
05/01/2018 01:54, zhike wang:
> 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>

Please use uppercases in your name:
	Zhike Wang
Thanks
  

Patch

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 21f2131..b7b3364 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1479,6 +1479,8 @@  static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
 	} 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);