vhost: fix checking of device features
authorIvan Dyukov <i.dyukov@samsung.com>
Wed, 28 Jun 2017 12:40:31 +0000 (15:40 +0300)
committerYuanhan Liu <yliu@fridaylinux.org>
Sat, 1 Jul 2017 23:38:39 +0000 (01:38 +0200)
To compare enabled features in current device we must use bit
mask instead of bit position.

Fixes: c843af3aa13e ("vhost: access header only if offloading is supported")
Cc: stable@dpdk.org
Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
lib/librte_vhost/virtio_net.c

index 88b74f1..a5f0eeb 100644 (file)
@@ -615,9 +615,11 @@ static inline bool
 virtio_net_with_host_offload(struct virtio_net *dev)
 {
        if (dev->features &
-                       (VIRTIO_NET_F_CSUM | VIRTIO_NET_F_HOST_ECN |
-                        VIRTIO_NET_F_HOST_TSO4 | VIRTIO_NET_F_HOST_TSO6 |
-                        VIRTIO_NET_F_HOST_UFO))
+                       ((1ULL << VIRTIO_NET_F_CSUM) |
+                        (1ULL << VIRTIO_NET_F_HOST_ECN) |
+                        (1ULL << VIRTIO_NET_F_HOST_TSO4) |
+                        (1ULL << VIRTIO_NET_F_HOST_TSO6) |
+                        (1ULL << VIRTIO_NET_F_HOST_UFO)))
                return true;
 
        return false;