From: Maxime Coquelin Date: Tue, 29 Sep 2020 16:14:01 +0000 (+0200) Subject: net/virtio: check protocol feature in user backend X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=44102e6298e788e4736befaa69cfd3d6f126830a;p=dpdk.git net/virtio: check protocol feature in user backend When sending set status message, move protocol feature check to vhost_user to be compatible with different backend types. Signed-off-by: Maxime Coquelin Reviewed-by: Chenbo Xia --- diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c index 12b6c7dbcf..ef290c357b 100644 --- a/drivers/net/virtio/virtio_user/vhost_user.c +++ b/drivers/net/virtio/virtio_user/vhost_user.c @@ -277,9 +277,13 @@ vhost_user_sock(struct virtio_user_dev *dev, msg.size = 0; switch (req) { + case VHOST_USER_GET_STATUS: + if (!(dev->protocol_features & + (1ULL << VHOST_USER_PROTOCOL_F_STATUS))) + return 0; + /* Fallthrough */ case VHOST_USER_GET_FEATURES: case VHOST_USER_GET_PROTOCOL_FEATURES: - case VHOST_USER_GET_STATUS: need_reply = 1; break; diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index b79a9f84aa..d7cd6b0346 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -788,9 +788,6 @@ virtio_user_send_status_update(struct virtio_user_dev *dev, uint8_t status) if (dev->backend_type != VIRTIO_USER_BACKEND_VHOST_USER) return 0; - if (!(dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_STATUS))) - return 0; - ret = dev->ops->send_request(dev, VHOST_USER_SET_STATUS, &arg); if (ret) { PMD_INIT_LOG(ERR, "VHOST_USER_SET_STATUS failed (%d): %s", ret, @@ -811,9 +808,6 @@ virtio_user_update_status(struct virtio_user_dev *dev) if (dev->backend_type != VIRTIO_USER_BACKEND_VHOST_USER) return 0; - if (!(dev->protocol_features & (1UL << VHOST_USER_PROTOCOL_F_STATUS))) - return 0; - err = dev->ops->send_request(dev, VHOST_USER_GET_STATUS, &ret); if (err) { PMD_INIT_LOG(ERR, "VHOST_USER_GET_STATUS failed (%d): %s", err,