vhost: fix MTU device feature check
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Thu, 29 Jun 2017 07:58:10 +0000 (09:58 +0200)
committerYuanhan Liu <yliu@fridaylinux.org>
Sat, 1 Jul 2017 23:39:29 +0000 (01:39 +0200)
The MTU feature support check has to be done against MTU
feature bit mask, and not bit position.

Fixes: 72e8543093df ("vhost: add API to get MTU value")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
lib/librte_vhost/vhost.c

index 19c5a43..653152f 100644 (file)
@@ -272,7 +272,7 @@ rte_vhost_get_mtu(int vid, uint16_t *mtu)
        if (!(dev->flags & VIRTIO_DEV_READY))
                return -EAGAIN;
 
-       if (!(dev->features & VIRTIO_NET_F_MTU))
+       if (!(dev->features & (1ULL << VIRTIO_NET_F_MTU)))
                return -ENOTSUP;
 
        *mtu = dev->mtu;