From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [PATCH 1/2] virtio: don't falsely claim to do IP checksum Date: Fri, 7 Jul 2017 12:52:49 -0700 Message-ID: <20170707195250.22259-2-stephen@networkplumber.org> References: <20170707195250.22259-1-stephen@networkplumber.org> Cc: dev@dpdk.org, Stephen Hemminger To: yliu@fridaylinux.org, maxime.coquelin@redhat.com Return-path: Received: from mail-pf0-f171.google.com (mail-pf0-f171.google.com [209.85.192.171]) by dpdk.org (Postfix) with ESMTP id 071E1235 for ; Fri, 7 Jul 2017 21:53:00 +0200 (CEST) Received: by mail-pf0-f171.google.com with SMTP id q85so21708453pfq.1 for ; Fri, 07 Jul 2017 12:52:59 -0700 (PDT) In-Reply-To: <20170707195250.22259-1-stephen@networkplumber.org> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The virtio driver is confused about the meaning of the ip_checksum flag. In DPDK, ip_checksum means the hardware is capable of checking the Layer 3 IP checksum. But KVM/QEMU does not do that. The flag VIRTIO_NET_F_GUEST_CSUM controls whether the receive side does Layer 4 (TCP/UDP) checksum offload. Fix by erroring out any requests to do IP checksum. Signed-off-by: Stephen Hemminger --- drivers/net/virtio/virtio_ethdev.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 5c826f47740c..ca607904fa37 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1664,8 +1664,13 @@ virtio_dev_configure(struct rte_eth_dev *dev) PMD_INIT_LOG(DEBUG, "configure"); req_features = VIRTIO_PMD_DEFAULT_GUEST_FEATURES; - if (rxmode->hw_ip_checksum) - req_features |= (1ULL << VIRTIO_NET_F_GUEST_CSUM); + + /* Virtio does L4 checksum but not L3! */ + if (rxmode->hw_ip_checksum) { + PMD_DRV_LOG(NOTICE, + "virtio does not support IP checksum"); + return -ENOTSUP; + } if (rxmode->enable_lro) req_features |= (1ULL << VIRTIO_NET_F_GUEST_TSO4) | @@ -1678,13 +1683,6 @@ 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 ip 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