[v2] net/virtio-user: fix advertising of protocol features

Message ID 20201218132352.15834-1-olivier.matz@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series [v2] net/virtio-user: fix advertising of protocol features |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Olivier Matz Dec. 18, 2020, 1:23 p.m. UTC
  When connected to a vhost-user backend, the flag
VHOST_USER_F_PROTOCOL_FEATURES is not advertised, preventing to do
multiqueue (the VHOST_USER_PROTOCOL_F_MQ protocol feature is ignored by
some backends if the VHOST_USER_F_PROTOCOL_FEATURES feature is not set).

When setting vhost-user features, advertise this flag if it was
advertised by our peer.

Fixes: 8e7561054ac7 ("net/virtio: support vhost-user protocol features")
Cc: stable@dpdk.org

Suggested-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---

v2
* fix obvious fallthrough case, sorry for the noise

 drivers/net/virtio/virtio_user/vhost_user.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Maxime Coquelin Dec. 22, 2020, 10:48 a.m. UTC | #1
On 12/18/20 2:23 PM, Olivier Matz wrote:
> When connected to a vhost-user backend, the flag
> VHOST_USER_F_PROTOCOL_FEATURES is not advertised, preventing to do
> multiqueue (the VHOST_USER_PROTOCOL_F_MQ protocol feature is ignored by
> some backends if the VHOST_USER_F_PROTOCOL_FEATURES feature is not set).
> 
> When setting vhost-user features, advertise this flag if it was
> advertised by our peer.
> 
> Fixes: 8e7561054ac7 ("net/virtio: support vhost-user protocol features")
> Cc: stable@dpdk.org
> 
> Suggested-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> ---
> 
> v2
> * fix obvious fallthrough case, sorry for the noise
> 
>  drivers/net/virtio/virtio_user/vhost_user.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
> index b93e65c60b..350eed4182 100644
> --- a/drivers/net/virtio/virtio_user/vhost_user.c
> +++ b/drivers/net/virtio/virtio_user/vhost_user.c
> @@ -297,13 +297,18 @@ vhost_user_sock(struct virtio_user_dev *dev,
>  		if (has_reply_ack)
>  			msg.flags |= VHOST_USER_NEED_REPLY_MASK;
>  		/* Fallthrough */
> -	case VHOST_USER_SET_FEATURES:
>  	case VHOST_USER_SET_PROTOCOL_FEATURES:
>  	case VHOST_USER_SET_LOG_BASE:
>  		msg.payload.u64 = *((__u64 *)arg);
>  		msg.size = sizeof(m.payload.u64);
>  		break;
>  
> +	case VHOST_USER_SET_FEATURES:
> +		msg.payload.u64 = *((__u64 *)arg) | (dev->device_features &
> +			(1ULL << VHOST_USER_F_PROTOCOL_FEATURES));
> +		msg.size = sizeof(m.payload.u64);
> +		break;
> +
>  	case VHOST_USER_SET_OWNER:
>  	case VHOST_USER_RESET_OWNER:
>  		break;
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks!
Maxime
  
Maxime Coquelin Jan. 8, 2021, 9:15 a.m. UTC | #2
On 12/18/20 2:23 PM, Olivier Matz wrote:
> When connected to a vhost-user backend, the flag
> VHOST_USER_F_PROTOCOL_FEATURES is not advertised, preventing to do
> multiqueue (the VHOST_USER_PROTOCOL_F_MQ protocol feature is ignored by
> some backends if the VHOST_USER_F_PROTOCOL_FEATURES feature is not set).
> 
> When setting vhost-user features, advertise this flag if it was
> advertised by our peer.
> 
> Fixes: 8e7561054ac7 ("net/virtio: support vhost-user protocol features")
> Cc: stable@dpdk.org
> 
> Suggested-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> ---
> 
> v2
> * fix obvious fallthrough case, sorry for the noise
> 
>  drivers/net/virtio/virtio_user/vhost_user.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)


Series applied to dpdk-next-virtio/main.

Thanks,
Maxime
  

Patch

diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index b93e65c60b..350eed4182 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -297,13 +297,18 @@  vhost_user_sock(struct virtio_user_dev *dev,
 		if (has_reply_ack)
 			msg.flags |= VHOST_USER_NEED_REPLY_MASK;
 		/* Fallthrough */
-	case VHOST_USER_SET_FEATURES:
 	case VHOST_USER_SET_PROTOCOL_FEATURES:
 	case VHOST_USER_SET_LOG_BASE:
 		msg.payload.u64 = *((__u64 *)arg);
 		msg.size = sizeof(m.payload.u64);
 		break;
 
+	case VHOST_USER_SET_FEATURES:
+		msg.payload.u64 = *((__u64 *)arg) | (dev->device_features &
+			(1ULL << VHOST_USER_F_PROTOCOL_FEATURES));
+		msg.size = sizeof(m.payload.u64);
+		break;
+
 	case VHOST_USER_SET_OWNER:
 	case VHOST_USER_RESET_OWNER:
 		break;