From: Jin Yu <jin.yu@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
Tiwei Bie <tiwei.bie@intel.com>,
Zhihong Wang <zhihong.wang@intel.com>
Cc: dev@dpdk.org, Jin Yu <jin.yu@intel.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH] vhost: add protocol feature check
Date: Wed, 25 Dec 2019 22:24:45 +0800 [thread overview]
Message-ID: <20191225142445.66106-1-jin.yu@intel.com> (raw)
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 <jin.yu@intel.com>
---
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;
+
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
next reply other threads:[~2019-12-25 6:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-25 14:24 Jin Yu [this message]
2020-01-13 2:52 ` Tiwei Bie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191225142445.66106-1-jin.yu@intel.com \
--to=jin.yu@intel.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=stable@dpdk.org \
--cc=tiwei.bie@intel.com \
--cc=zhihong.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).