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 57AF41B4D6 for ; Fri, 1 Feb 2019 16:13:17 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EB8CEAD897; Fri, 1 Feb 2019 15:13:15 +0000 (UTC) Received: from localhost (ovpn-117-36.ams2.redhat.com [10.36.117.36]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 474EB19CB3; Fri, 1 Feb 2019 15:13:14 +0000 (UTC) Date: Fri, 1 Feb 2019 16:13:12 +0100 From: Jens Freimann To: Ilya Maximets Cc: dev@dpdk.org, tiwei.bie@intel.com, maxime.coquelin@redhat.com Message-ID: <20190201151312.432t55b4relhqv3d@jenstp.localdomain> References: <20190201100348.6730-1-jfreimann@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 01 Feb 2019 15:13:16 +0000 (UTC) Subject: Re: [dpdk-dev] [v4] net/virtio: set offload flag for jumbo frames 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: Fri, 01 Feb 2019 15:13:17 -0000 On Fri, Feb 01, 2019 at 05:27:37PM +0300, Ilya Maximets wrote: >On 01.02.2019 13:03, Jens Freimann wrote: >> + if (host_features & (1ULL << VIRTIO_NET_F_MTU)) { >> + uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN + >> + hw->vtnet_hdr_size; >> + if (dev->data->dev_conf.rxmode.max_rx_pkt_len <= >> + hw->max_mtu + ether_hdr_len) >> + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME; >> + } else { >> + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME; >> + } >> + > >As I wrote for v3, hw->max_mtu already calculated taking VIRTIO_NET_F_MTU >into account. If VIRTIO_NET_F_MTU is not set, hw->max_mtu is equal to >"VIRTIO_MAX_RX_PKTLEN - ETHER_HDR_LEN - VLAN_TAG_LEN - hw->vtnet_hdr_size". >i.e. "hw->max_mtu + ether_hdr_len" equal to VIRTIO_MAX_RX_PKTLEN which is >larger or equal to rxmode.max_rx_pkt_len. >So, there is no need to check for VIRTIO_NET_F_MTU here. You may just perform >same check for both cases. I should read more carefully :). I think I get what you mean now. hw->max_mtu already includes ether_hdr_len, so it doesn't need re-calculation here. And in case of VIRTIO_NET_F_MTU the mtu is checked during feature negotiation. So it basically boils down to if (dev->data->dev_conf.rxmode.max_rx_pkt_len <= w->max_mtu) dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME; >This doesn't give any performance or so, but will simplify the code. Thanks for the review! regards, Jens