From: Stephen Hemminger Date: Fri, 7 Jul 2017 19:52:49 +0000 (-0700) Subject: net/virtio: do not falsely claim to do IP checksum X-Git-Tag: spdx-start~2543 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=4dab342b7522;p=dpdk.git net/virtio: do not falsely claim to do IP checksum 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. Fixes: 96cb6711939e ("net/virtio: support Rx checksum offload") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Acked-by: Yuanhan Liu --- diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 5c826f4774..ca607904fa 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))) {