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 4BD2727D for ; Tue, 26 Feb 2019 16:16:06 +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 A0F3E30A4C81 for ; Tue, 26 Feb 2019 15:16:05 +0000 (UTC) Received: from localhost (dhcp-192-241.str.redhat.com [10.33.192.241]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C98F600C4 for ; Tue, 26 Feb 2019 15:16:05 +0000 (UTC) Resent-From: Jens Freimann Resent-Date: Tue, 26 Feb 2019 16:16:03 +0100 Resent-Message-ID: <20190226151603.dt7okrydgxcdhjxd@jenstp.localdomain> Resent-To: stable@dpdk.org Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO zmta01.collab.prod.int.phx2.redhat.com) (10.5.81.8) by zmail25.collab.prod.int.phx2.redhat.com with LMTP; Tue, 5 Feb 2019 06:17:10 -0500 (EST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 1AE14186BBD for ; Tue, 5 Feb 2019 06:17:10 -0500 (EST) Received: by smtp.corp.redhat.com (Postfix) id 0EE6E5C21E; Tue, 5 Feb 2019 11:17:10 +0000 (UTC) Received: from localhost (dhcp-192-225.str.redhat.com [10.33.192.225]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F2806EE7E; Tue, 5 Feb 2019 11:17:03 +0000 (UTC) From: Jens Freimann To: dev@dpdk.org Cc: tiwei.bie@intel.com, maxime.coquelin@redhat.com Message-Id: <20190205111702.14782-1-jfreimann@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.43]); Tue, 26 Feb 2019 15:16:05 +0000 (UTC) Subject: [dpdk-stable] [PATCH v5] net/virtio: set offload flag for jumbo frames X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 26 Feb 2019 15:16:06 -0000 X-Original-Date: Tue, 5 Feb 2019 12:17:02 +0100 X-List-Received-Date: Tue, 26 Feb 2019 15:16:06 -0000 Port configuration fails because offload flags don't match the expected value when max-pkt-len is set to a value that should enable receive port offloading but doesn't. The .dev_infos_get callback can be called before the configure callback. At that time we don't know the maximum packet size yet because it is only set up when ports are started. So in virtio_dev_info_get() just always set the jumbo packet offload flag. Check the maximum packet length at device configure time, because then we have access to the max-pkt-len value provided by the user. If the max-pkt-len exceeds the maximum MTU supported by the device we remove the VIRTIO_NET_F_MTU flag from requested features. Fixes: a4996bd89c42 ("ethdev: new Rx/Tx offloads API") Cc: stable@dpdk.org Signed-off-by: Jens Freimann --- drivers/net/virtio/virtio_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 7c4c1df00..7c2fe76f3 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1972,6 +1972,8 @@ virtio_dev_configure(struct rte_eth_dev *dev) const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; const struct rte_eth_txmode *txmode = &dev->data->dev_conf.txmode; struct virtio_hw *hw = dev->data->dev_private; + uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN + + hw->vtnet_hdr_size; uint64_t rx_offloads = rxmode->offloads; uint64_t tx_offloads = txmode->offloads; uint64_t req_features; @@ -1986,6 +1988,9 @@ virtio_dev_configure(struct rte_eth_dev *dev) return ret; } + if (rxmode->max_rx_pkt_len > hw->max_mtu + ether_hdr_len) + req_features &= ~(1ULL << VIRTIO_NET_F_MTU); + if (rx_offloads & (DEV_RX_OFFLOAD_UDP_CKSUM | DEV_RX_OFFLOAD_TCP_CKSUM)) req_features |= (1ULL << VIRTIO_NET_F_GUEST_CSUM); @@ -2339,6 +2344,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) host_features = VTPCI_OPS(hw)->get_features(hw); dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP; + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME; if (host_features & (1ULL << VIRTIO_NET_F_GUEST_CSUM)) { dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_CKSUM | -- 2.17.2