Skip to contentSkip to conversation

vhost: enable CONFIG feature for vdpa

PATCH In review Hao Chen 2 participants 2 messages Oct 11, 2022 – Nov 3, 2022

lore
Share & tools
lore

Hao Chen

author
#0 lore raw

PATCH v2 1/1 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'.

---
 lib/vhost/socket.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/vhost/socket.c +4 -0
index a8df2d484a..df8f26a5bd 100644
@@ -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;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines

-----Original Message-----
From: Hao Chen <[email protected]>
Sent: Tuesday, October 11, 2022 10:55 AM
To: [email protected]; Xia, Chenbo <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: [PATCH v2] vhost: enable CONFIG feature for vdpa

Quoted 7 lines

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/[email protected]/

Quoted 11 lines
---
 lib/vhost/socket.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/vhost/socket.c +0 -0
index a8df2d484a..df8f26a5bd 100644

lib/vhost/socket.c rte_vhost_driver_get_protocol_features(const char · line 815

Quoted 8 lines
lib/vhost/socket.c +4 -0
@@ -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

Quoted 5 lines
lib/vhost/socket.c +0 -0
 unlock_exit:
 	pthread_mutex_unlock(&vhost_user.mutex);

return ret;
--
2.34.1