DPDK patches and discussions
 help / color / mirror / Atom feed
From: Keiichi Watanabe <keiichiw@chromium.org>
To: dev@dpdk.org
Cc: dgreid@chromium.org, chirantan@chromium.org,
	Keiichi Watanabe <keiichiw@chromium.org>,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>, Ray Kinsella <mdr@ashroe.eu>,
	Neil Horman <nhorman@tuxdriver.com>
Subject: [dpdk-dev] [PATCH v2 1/2] vhost: Add API to get negotiated protocol features
Date: Mon, 22 Mar 2021 16:22:56 +0900	[thread overview]
Message-ID: <20210322072257.2017227-2-keiichiw@chromium.org> (raw)
In-Reply-To: <20210322072257.2017227-1-keiichiw@chromium.org>

Add rte_vhost_get_negotiated_protocol_features, which returns a set of
enabled protocol features.

Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
---
 lib/librte_vhost/rte_vhost.h | 15 +++++++++++++++
 lib/librte_vhost/version.map |  1 +
 lib/librte_vhost/vhost.c     | 14 ++++++++++++++
 3 files changed, 30 insertions(+)

diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h
index 010f16086..d0a8ae31f 100644
--- a/lib/librte_vhost/rte_vhost.h
+++ b/lib/librte_vhost/rte_vhost.h
@@ -567,6 +567,21 @@ rte_vhost_driver_get_queue_num(const char *path, uint32_t *queue_num);
  */
 int rte_vhost_get_negotiated_features(int vid, uint64_t *features);
 
+/**
+ * Get the protocol feature bits after negotiation
+ *
+ * @param vid
+ *  Vhost device ID
+ * @param protocol_features
+ *  A pointer to store the queried protocol feature bits
+ * @return
+ *  0 on success, -1 on failure
+ */
+__rte_experimental
+int
+rte_vhost_get_negotiated_protocol_features(int vid,
+					   uint64_t *protocol_features);
+
 /* Register callbacks. */
 int rte_vhost_driver_callback_register(const char *path,
 	struct vhost_device_ops const * const ops);
diff --git a/lib/librte_vhost/version.map b/lib/librte_vhost/version.map
index 9183d6f2f..95c4c0990 100644
--- a/lib/librte_vhost/version.map
+++ b/lib/librte_vhost/version.map
@@ -63,6 +63,7 @@ EXPERIMENTAL {
 	rte_vhost_va_from_guest_pa;
 	rte_vhost_extern_callback_register;
 	rte_vhost_driver_set_protocol_features;
+	rte_vhost_get_negotiated_protocol_features;
 	rte_vhost_set_inflight_desc_split;
 	rte_vhost_set_inflight_desc_packed;
 	rte_vhost_set_last_inflight_io_split;
diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index b83cf639e..c43248e4b 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -868,6 +868,20 @@ rte_vhost_get_negotiated_features(int vid, uint64_t *features)
 	return 0;
 }
 
+int
+rte_vhost_get_negotiated_protocol_features(int vid,
+					   uint64_t *protocol_features)
+{
+	struct virtio_net *dev;
+
+	dev = get_device(vid);
+	if (dev == NULL || protocol_features == NULL)
+		return -1;
+
+	*protocol_features = dev->protocol_features;
+	return 0;
+}
+
 int
 rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem)
 {
-- 
2.31.0.rc2.261.g7f71774620-goog


  reply	other threads:[~2021-03-22  7:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22  7:22 [dpdk-dev] [PATCH v2 0/2] " Keiichi Watanabe
2021-03-22  7:22 ` Keiichi Watanabe [this message]
2021-03-25 14:16   ` [dpdk-dev] [PATCH v2 1/2] " Maxime Coquelin
2021-03-31 16:45   ` Ferruh Yigit
2021-04-01  8:42     ` Kinsella, Ray
2021-04-01 16:05       ` Keiichi Watanabe
2021-04-01 16:28         ` Ferruh Yigit
2021-04-01 16:38           ` Keiichi Watanabe
2021-03-22  7:22 ` [dpdk-dev] [PATCH v2 2/2] examples/vhost_blk: Check protocol features before getting inflight info Keiichi Watanabe
2021-03-25 14:18   ` Maxime Coquelin
2021-03-31  6:45 ` [dpdk-dev] [PATCH v2 0/2] vhost: Add API to get negotiated protocol features Xia, Chenbo

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=20210322072257.2017227-2-keiichiw@chromium.org \
    --to=keiichiw@chromium.org \
    --cc=chenbo.xia@intel.com \
    --cc=chirantan@chromium.org \
    --cc=dev@dpdk.org \
    --cc=dgreid@chromium.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=mdr@ashroe.eu \
    --cc=nhorman@tuxdriver.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).