vhost: fix vDPA set features
authorXiao Wang <xiao.w.wang@intel.com>
Wed, 25 Apr 2018 02:18:27 +0000 (10:18 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 27 Apr 2018 17:01:00 +0000 (18:01 +0100)
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 <xiao.w.wang@intel.com>
Acked-by: Zhihong Wang <zhihong.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/vhost_user.c

index 90194bf..7244e1c 100644 (file)
@@ -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;
 }