From: Jianfeng Tan Date: Tue, 23 Jan 2018 09:52:43 +0000 (+0000) Subject: net/virtio-user: fix crash as features change X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0d6a8752ac9d1088fed721f81aaa9abbdab53be1;p=dpdk.git net/virtio-user: fix crash as features change Since commit 59fe5e17d930 ("vhost: propagate set features handling error"), vhost does not allow to set different features without reset. The virtio-user driver fails to reset the device in below commit. To fix, we send the reset message as stopping the device. Fixes: c12a26ee209e ("net/virtio-user: fix not properly reset device") Cc: stable@dpdk.org Reported-by: Lei Yao Reported-by: Tiwei Bie Signed-off-by: Jianfeng Tan Acked-by: Yuanhan Liu --- diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 7a70c1867f..3b5f737acf 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -142,6 +142,11 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) for (i = 0; i < dev->max_queue_pairs; ++i) dev->ops->enable_qp(dev, i, 0); + if (dev->ops->send_request(dev, VHOST_USER_RESET_OWNER, NULL) < 0) { + PMD_DRV_LOG(INFO, "Failed to reset the device\n"); + return -1; + } + return 0; }