From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v4]net/virtio: add mtu set in virtio Date: Tue, 20 Sep 2016 15:11:52 +0800 Message-ID: <20160920071152.GR23158@yliu-dev.sh.intel.com> References: <20160909070009.GS23158@yliu-dev.sh.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: "'Dey, Souvik'" , "dev@dpdk.org" , "stephen@networkplumber.org" To: "Kavanagh, Mark B" Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 0BB75CE7 for ; Tue, 20 Sep 2016 09:11:24 +0200 (CEST) Content-Disposition: inline In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Sep 14, 2016 at 12:15:37PM +0000, Kavanagh, Mark B wrote: > > > >>+{ > >>+       struct rte_eth_dev_info dev_info; > >>+       uint32_t ether_hdr_len = ETHER_HDR_LEN + ETHER_CRC_LEN + > >>+VLAN_TAG_LEN; > >>+       uint32_t frame_size = mtu + ether_hdr_len; > >>+ > >>+       virtio_dev_info_get(dev, &dev_info); > >>+ > >>+       if (mtu < dev_info.min_rx_bufsize || frame_size > > >>+dev_info.max_rx_pktlen) { > > > >It's not clear to me whether 'mtu' in this case should be compared with ETHER_MIN_MTU, as per > >other DPDK drivers, or alternatively whether 'frame_size' should be compared with > >dev_info.min_rx_bufsize. > >Any thoughts? > >[Dey, Souvik] I am not sure why virtio min_rx_bufsize is less than ETHER_MIN_MTU, i think it > >will be good to have the compare statement as > >If(frame_size < ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen) , then error. What do > >you suggest ? > > Again, this all depends on what 'mtu' means in this context. > > Since you mentioned previously that it relates to the packet (i.e. L3) length, and not the frame (i.e. L2) length, I would suggest that the comparison should be: > > if (mtu < ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen) > > Yuanhan, any thoughts on this? I think you are right. At least, that's how the ixgbe PMD driver code looks like. --yliu