From c665d9a231945181af0a6e6fbeae7f56657f964a Mon Sep 17 00:00:00 2001 From: Ivan Dyukov Date: Wed, 28 Jun 2017 15:40:31 +0300 Subject: [PATCH] vhost: fix checking of device features 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 Reviewed-by: Maxime Coquelin Acked-by: Yuanhan Liu --- lib/librte_vhost/virtio_net.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 88b74f172c..a5f0eebaa8 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -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; -- 2.20.1