From: Xiao Wang Date: Wed, 25 Apr 2018 02:18:27 +0000 (+0800) Subject: vhost: fix vDPA set features X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=dfdf4b84b8d03e08c5949fe81e85eb8ce5b2ee52;p=dpdk.git vhost: fix vDPA set features We should call set_features callback after setting features in virtio_net structure, otherwise vDPA driver cannot get the right features. Fixes: 07718b4f87aa ("vhost: adapt library for selective datapath") Signed-off-by: Xiao Wang Acked-by: Zhihong Wang Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 90194bf09d..7244e1c06b 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -214,11 +214,6 @@ vhost_user_set_features(struct virtio_net *dev, uint64_t features) dev->notify_ops->features_changed(dev->vid, features); } - did = dev->vdpa_dev_id; - vdpa_dev = rte_vdpa_get_device(did); - if (vdpa_dev && vdpa_dev->ops->set_features) - vdpa_dev->ops->set_features(dev->vid); - dev->features = features; if (dev->features & ((1 << VIRTIO_NET_F_MRG_RXBUF) | (1ULL << VIRTIO_F_VERSION_1))) { @@ -252,6 +247,11 @@ vhost_user_set_features(struct virtio_net *dev, uint64_t features) } } + did = dev->vdpa_dev_id; + vdpa_dev = rte_vdpa_get_device(did); + if (vdpa_dev && vdpa_dev->ops->set_features) + vdpa_dev->ops->set_features(dev->vid); + return 0; }