From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id DEB5F378E for ; Thu, 16 Feb 2017 22:17:06 +0100 (CET) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 534EA3D966; Thu, 16 Feb 2017 21:17:07 +0000 (UTC) Received: from [10.36.116.31] (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1GLH45E009123 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 16 Feb 2017 16:17:05 -0500 To: Aaron Conole References: <20170213142820.8964-1-maxime.coquelin@redhat.com> <20170213142820.8964-7-maxime.coquelin@redhat.com> Cc: sodey@sonusnet.com, yuanhan.liu@linux.intel.com, jianfeng.tan@intel.com, dev@dpdk.org From: Maxime Coquelin Message-ID: <6016b238-1c5d-9ca5-d576-c7db33e26a8b@redhat.com> Date: Thu, 16 Feb 2017 22:17:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 16 Feb 2017 21:17:07 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH 6/7] net/virtio: Add MTU feature support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2017 21:17:07 -0000 Hi Aaron, On 02/16/2017 08:31 PM, Aaron Conole wrote: > Maxime Coquelin writes: > >> This patch implements support for the Virtio MTU feature. >> When negotiated, the host shares its maximum supported MTU, >> which is used as initial MTU and as maximum MTU the application >> can set. >> >> Signed-off-by: Maxime Coquelin >> --- >> doc/guides/nics/features/virtio.ini | 1 + >> drivers/net/virtio/virtio_ethdev.c | 22 ++++++++++++++++++++-- >> drivers/net/virtio/virtio_ethdev.h | 3 ++- >> drivers/net/virtio/virtio_pci.h | 3 +++ >> 4 files changed, 26 insertions(+), 3 deletions(-) >> >> diff --git a/doc/guides/nics/features/virtio.ini b/doc/guides/nics/features/virtio.ini >> index 5164937..7bea075 100644 >> --- a/doc/guides/nics/features/virtio.ini >> +++ b/doc/guides/nics/features/virtio.ini >> @@ -24,3 +24,4 @@ ARMv8 = Y >> x86-32 = Y >> x86-64 = Y >> Usage doc = Y >> +MTU update = Y >> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c >> index d1ff234..ad3e6e1 100644 >> --- a/drivers/net/virtio/virtio_ethdev.c >> +++ b/drivers/net/virtio/virtio_ethdev.c >> @@ -721,10 +721,13 @@ virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) >> uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN + >> hw->vtnet_hdr_size; >> uint32_t frame_size = mtu + ether_hdr_len; >> + uint32_t max_frame_size = hw->max_mtu + ether_hdr_len; >> >> - if (mtu < ETHER_MIN_MTU || frame_size > VIRTIO_MAX_RX_PKTLEN) { >> + max_frame_size = RTE_MIN(max_frame_size, VIRTIO_MAX_RX_PKTLEN); >> + >> + if (mtu < ETHER_MIN_MTU || frame_size > max_frame_size) { >> PMD_INIT_LOG(ERR, "MTU should be between %d and %d", >> - ETHER_MIN_MTU, VIRTIO_MAX_RX_PKTLEN - ether_hdr_len); >> + ETHER_MIN_MTU, max_frame_size - ether_hdr_len); >> return -EINVAL; >> } >> return 0; >> @@ -1392,6 +1395,21 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) >> >> hw->max_queue_pairs = config->max_virtqueue_pairs; >> >> + if (vtpci_with_feature(hw, VIRTIO_NET_F_MTU)) { >> + vtpci_read_dev_config(hw, >> + offsetof(struct virtio_net_config, mtu), >> + &config->mtu, >> + sizeof(config->mtu)); > > I think we need to check the value here against the min mtu, right? Right. Moreover, we don't check it in Qemu. I need to add the check both DPDK and Qemu. Thanks, Maxime