vhost: enable CONFIG feature for vdpa
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
@@ -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
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:
MoveVHOST_USER_PROTOCOL_F_CONFIGfromVHOST_USER_PROTOCOL_FEATURESto 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
Signed-off-by Hao Chen <[email protected]>--- lib/vhost/socket.c | 4 ++++ 1 file changed, 4 insertions(+)lib/vhost/socket.c +0
-0
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
-0unlock_exit:pthread_mutex_unlock (&vhost_user.mutex);return ret;
--
2.34.1