From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3A591A04F0 for ; Mon, 13 Jan 2020 03:52:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F40911D5F5; Mon, 13 Jan 2020 03:52:37 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 3EE4E1D5E0; Mon, 13 Jan 2020 03:52:34 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jan 2020 18:52:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,427,1571727600"; d="scan'208";a="304722867" Received: from dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.74]) by orsmga001.jf.intel.com with ESMTP; 12 Jan 2020 18:52:32 -0800 Date: Mon, 13 Jan 2020 10:52:32 +0800 From: Tiwei Bie To: Jin Yu Cc: Maxime Coquelin , Zhihong Wang , dev@dpdk.org, stable@dpdk.org Message-ID: <20200113025232.GA86373@___> References: <20191225142445.66106-1-jin.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191225142445.66106-1-jin.yu@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-stable] [PATCH] vhost: add protocol feature check X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Wed, Dec 25, 2019 at 10:24:45PM +0800, Jin Yu wrote: > Add VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD check in > getting inflight ring functions. > > Fixes: 4d891f77ddfa ("vhost: add APIs to get inflight ring") > Cc: stable@dpdk.org > > Signed-off-by: Jin Yu > --- > lib/librte_vhost/vhost.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c > index 1cbe948f7..dfb71732b 100644 > --- a/lib/librte_vhost/vhost.c > +++ b/lib/librte_vhost/vhost.c > @@ -862,6 +862,10 @@ rte_vhost_get_vhost_ring_inflight(int vid, uint16_t vring_idx, > if (unlikely(!dev)) > return -1; > > + if (unlikely(!(dev->protocol_features & > + (1ULL << VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)))) > + return 0; Why this is needed? The caller needs to know whether _INFLIGHT_SHMFD is negotiated or not anyway. Even if rte_vhost_get_vhost_ring_inflight() returns success, the inflight info returned is still invalid. > + > if (vring_idx >= VHOST_MAX_VRING) > return -1; > > @@ -1431,6 +1435,10 @@ rte_vhost_get_vring_base_from_inflight(int vid, > if (dev == NULL || last_avail_idx == NULL || last_used_idx == NULL) > return -1; > > + if (unlikely(!(dev->protocol_features & > + (1ULL << VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)))) > + return 0; > + > if (!vq_is_packed(dev)) > return -1; > > -- > 2.17.2 >