[09/15] net/virtio: add virtio vDPA op to get protocol features
diff mbox series

Message ID 20190829080000.20806-10-maxime.coquelin@redhat.com
State New
Delegated to: Maxime Coquelin
Headers show
Series
  • Introduce Virtio vDPA driver
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Maxime Coquelin Aug. 29, 2019, 7:59 a.m. UTC
This patch implements the vDPA .get_protocol_features()
callback.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/virtio/virtio_vdpa.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Tiwei Bie Sept. 2, 2019, 6:46 a.m. UTC | #1
On Thu, Aug 29, 2019 at 09:59:54AM +0200, Maxime Coquelin wrote:
> This patch implements the vDPA .get_protocol_features()
> callback.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  drivers/net/virtio/virtio_vdpa.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/net/virtio/virtio_vdpa.c b/drivers/net/virtio/virtio_vdpa.c
> index 9e2af8313..fc52a8e92 100644
> --- a/drivers/net/virtio/virtio_vdpa.c
> +++ b/drivers/net/virtio/virtio_vdpa.c
> @@ -204,9 +204,22 @@ virtio_vdpa_get_features(int did, uint64_t *features)
>  	return 0;
>  }
>  
> +#define VDPA_SUPPORTED_PROTOCOL_FEATURES \
> +		(1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK | \
> +		 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ | \
> +		 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | \
> +		 1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER)

Looks better to add an empty line here.

> +static int
> +virtio_vdpa_get_protocol_features(int did __rte_unused, uint64_t *features)
> +{
> +	*features = VDPA_SUPPORTED_PROTOCOL_FEATURES;
> +	return 0;
> +}
> +
>  static struct rte_vdpa_dev_ops virtio_vdpa_ops = {
>  	.get_queue_num = virtio_vdpa_get_queue_num,
>  	.get_features = virtio_vdpa_get_features,
> +	.get_protocol_features = virtio_vdpa_get_protocol_features,
>  };
>  
>  static inline int
> -- 
> 2.21.0
> 

Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>

Patch
diff mbox series

diff --git a/drivers/net/virtio/virtio_vdpa.c b/drivers/net/virtio/virtio_vdpa.c
index 9e2af8313..fc52a8e92 100644
--- a/drivers/net/virtio/virtio_vdpa.c
+++ b/drivers/net/virtio/virtio_vdpa.c
@@ -204,9 +204,22 @@  virtio_vdpa_get_features(int did, uint64_t *features)
 	return 0;
 }
 
+#define VDPA_SUPPORTED_PROTOCOL_FEATURES \
+		(1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK | \
+		 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ | \
+		 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | \
+		 1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER)
+static int
+virtio_vdpa_get_protocol_features(int did __rte_unused, uint64_t *features)
+{
+	*features = VDPA_SUPPORTED_PROTOCOL_FEATURES;
+	return 0;
+}
+
 static struct rte_vdpa_dev_ops virtio_vdpa_ops = {
 	.get_queue_num = virtio_vdpa_get_queue_num,
 	.get_features = virtio_vdpa_get_features,
+	.get_protocol_features = virtio_vdpa_get_protocol_features,
 };
 
 static inline int