From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP; 20 Sep 2016 00:11:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,366,1470726000"; d="scan'208";a="11625526" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by orsmga004.jf.intel.com with ESMTP; 20 Sep 2016 00:11:22 -0700 Date: Tue, 20 Sep 2016 15:11:52 +0800 From: Yuanhan Liu To: "Kavanagh, Mark B" Cc: "'Dey, Souvik'" , "dev@dpdk.org" , "stephen@networkplumber.org" 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v4]net/virtio: add mtu set in virtio X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2016 07:11:25 -0000 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