From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <maxime.coquelin@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by dpdk.org (Postfix) with ESMTP id E4EE12904;
 Thu, 29 Jun 2017 09:58:28 +0200 (CEST)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
 [10.5.11.13])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id 199503DBEE;
 Thu, 29 Jun 2017 07:58:28 +0000 (UTC)
DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 199503DBEE
Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com;
 dmarc=none (p=none dis=none) header.from=redhat.com
Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com;
 spf=pass smtp.mailfrom=maxime.coquelin@redhat.com
DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 199503DBEE
Received: from localhost.localdomain (ovpn-112-58.ams2.redhat.com
 [10.36.112.58])
 by smtp.corp.redhat.com (Postfix) with ESMTP id A1ED917A74;
 Thu, 29 Jun 2017 07:58:24 +0000 (UTC)
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org,
	yliu@fridaylinux.org
Cc: i.dyukov@samsung.com, jianfeng.tan@intel.com, stable@dpdk.org,
 Maxime Coquelin <maxime.coquelin@redhat.com>
Date: Thu, 29 Jun 2017 09:58:10 +0200
Message-Id: <20170629075810.4225-1-maxime.coquelin@redhat.com>
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.30]); Thu, 29 Jun 2017 07:58:28 +0000 (UTC)
Subject: [dpdk-stable] [PATCH] vhost: fix MTU device feature check
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Jun 2017 07:58:29 -0000

The MTU feature support check has to be done against MTU
feature bit mask, and not bit position.

Cc: stable@dpdk.org
Fixes: 72e8543093df ("vhost: add API to get MTU value")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---

This is a follow-up of Ivan's patch, which made me check I didn't
introduced same bug elsewhere.

 lib/librte_vhost/vhost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index 19c5a43..653152f 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -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;
-- 
2.9.4