diff mbox series

[v2] vhost: enable CONFIG feature for vdpa

Message ID 20221011025435.3769-1-chenh@yusur.tech (mailing list archive)
State New
Delegated to: Maxime Coquelin
Headers show
Series [v2] vhost: enable CONFIG feature for vdpa | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Hao Chen Oct. 11, 2022, 2:54 a.m. UTC
Enable this feature, so that libvirt or qemu can call vdpa vendor
driver's ops '.get_config' through 'vhost_net_get_config' to get
the mac address of the vdpa hardware without manual configuration.

v1->v2:
Move VHOST_USER_PROTOCOL_F_CONFIG from VHOST_USER_PROTOCOL_FEATURES
to function 'rte_vhost_driver_get_protocol_features'.

Signed-off-by: Hao Chen <chenh@yusur.tech>
---
 lib/vhost/socket.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Xia, Chenbo Nov. 3, 2022, 3:27 a.m. UTC | #1
> -----Original Message-----
> From: Hao Chen <chenh@yusur.tech>
> Sent: Tuesday, October 11, 2022 10:55 AM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; houyl@yusur.tech; zy@yusur.tech
> Subject: [PATCH v2] vhost: enable CONFIG feature for vdpa
> 
> Enable this feature, so that libvirt or qemu can call vdpa vendor
> driver's ops '.get_config' through 'vhost_net_get_config' to get
> the mac address of the vdpa hardware without manual configuration.
> 
> v1->v2:
> Move VHOST_USER_PROTOCOL_F_CONFIG from VHOST_USER_PROTOCOL_FEATURES
> to function 'rte_vhost_driver_get_protocol_features'.

Don't add above version info to commit log.

Refer to below link about where to add the info.
 
http://patchwork.dpdk.org/project/dpdk/patch/20221102111713.507-1-anoobj@marvell.com/

> 
> Signed-off-by: Hao Chen <chenh@yusur.tech>
> ---
>  lib/vhost/socket.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
> index a8df2d484a..df8f26a5bd 100644
> --- a/lib/vhost/socket.c
> +++ b/lib/vhost/socket.c
> @@ -808,6 +808,10 @@ rte_vhost_driver_get_protocol_features(const char
> *path,
>  	*protocol_features = vsocket->protocol_features
>  		& vdpa_protocol_features;
> 
> +	/* Get the unique features of vdpa */
> +	if (vdpa_protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_CONFIG))
> +		*protocol_features |= (1ULL << VHOST_USER_PROTOCOL_F_CONFIG);
> +

This makes think about what should 'vsocket->protocol_features' mean.
If we do like above, for every new protocol feature that some vdpa device can support
but built-in vhost-net can't support, such logic is needed.

Maybe we should define something like base protocol features that vhost lib
supports and some features for backend-specific. So for vdpa case, just do
'base_feature | vdpa_protocol_features'.

In current VHOST_USER_PROTOCOL_FEATURES, some are general feature that vhost lib
supports, but some seems not (like VHOST_USER_PROTOCOL_F_CRYPTO_SESSION).

@Maxime, what do you think?

Thanks,
Chenbo

>  unlock_exit:
>  	pthread_mutex_unlock(&vhost_user.mutex);
>  	return ret;
> --
> 2.34.1
diff mbox series

Patch

diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index a8df2d484a..df8f26a5bd 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -808,6 +808,10 @@  rte_vhost_driver_get_protocol_features(const char *path,
 	*protocol_features = vsocket->protocol_features
 		& vdpa_protocol_features;
 
+	/* Get the unique features of vdpa */
+	if (vdpa_protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_CONFIG))
+		*protocol_features |= (1ULL << VHOST_USER_PROTOCOL_F_CONFIG);
+
 unlock_exit:
 	pthread_mutex_unlock(&vhost_user.mutex);
 	return ret;