From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 30A10199BE; Thu, 7 Sep 2017 14:14:04 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id E4AFBCD5C2; Thu, 7 Sep 2017 14:10:16 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org, yliu@fridaylinux.org, maxime.coquelin@redhat.com Cc: stephen@networkplumber.org, stable@dpdk.org Date: Thu, 7 Sep 2017 14:13:39 +0200 Message-Id: <20170907121347.16208-3-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170907121347.16208-1-olivier.matz@6wind.com> References: <20170831134015.1383-1-olivier.matz@6wind.com> <20170907121347.16208-1-olivier.matz@6wind.com> Subject: [dpdk-stable] [PATCH v2 02/10] net/virtio: revert "do not falsely claim to do IP checksum" 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: , X-List-Received-Date: Thu, 07 Sep 2017 12:14:04 -0000 This reverts commit 4dab342b7522 ("net/virtio: do not falsely claim to do IP checksum"). The description of rxmode->hw_ip_checksum is: hw_ip_checksum : 1, /**< IP/UDP/TCP checksum offload enable. */ Despite its name, this field can be set by an application to enable L3 and L4 checksums. In case of virtio, only L4 checksum is supported and L3 checksums flags will always be set to "unknown". Fixes: 4dab342b7522 ("net/virtio: do not falsely claim to do IP checksum") Cc: stable@dpdk.org Signed-off-by: Olivier Matz --- drivers/net/virtio/virtio_ethdev.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index eb2d95acd..7a84817e5 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1671,12 +1671,13 @@ virtio_dev_configure(struct rte_eth_dev *dev) return ret; } - /* Virtio does L4 checksum but not L3! */ - if (rxmode->hw_ip_checksum) { - PMD_DRV_LOG(NOTICE, - "virtio does not support IP checksum"); - return -ENOTSUP; - } + /* The name hw_ip_checksum is a bit confusing since it can be + * set by the application to request L3 and/or L4 checksums. In + * case of virtio, only L4 checksum is supported. + */ + if (rxmode->hw_ip_checksum) + req_features |= (1ULL << VIRTIO_NET_F_GUEST_CSUM); + if (rxmode->enable_lro) req_features |= (1ULL << VIRTIO_NET_F_GUEST_TSO4) | @@ -1689,6 +1690,13 @@ virtio_dev_configure(struct rte_eth_dev *dev) return ret; } + if (rxmode->hw_ip_checksum && + !vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM)) { + PMD_DRV_LOG(NOTICE, + "rx checksum not available on this host"); + return -ENOTSUP; + } + if (rxmode->enable_lro && (!vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) || !vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4))) { -- 2.11.0