patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] vhost: add protocol feature check
@ 2019-12-25 14:24 Jin Yu
  2020-01-13  2:52 ` Tiwei Bie
  0 siblings, 1 reply; 2+ messages in thread
From: Jin Yu @ 2019-12-25 14:24 UTC (permalink / raw)
  To: Maxime Coquelin, Tiwei Bie, Zhihong Wang; +Cc: dev, Jin Yu, stable

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-13  2:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-25 14:24 [dpdk-stable] [PATCH] vhost: add protocol feature check Jin Yu
2020-01-13  2:52 ` Tiwei Bie

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git