+static int
+vdpa_blk_device_set_features_and_protocol(const char *path)
+{
+ uint64_t protocol_features = 0;
+ int ret;
+
+ ret = rte_vhost_driver_set_features(path, VHOST_BLK_FEATURES);
+ if (ret != 0) {
+ RTE_LOG(ERR, VDPA,
+ "rte_vhost_driver_set_features for %s failed.\n",
+ path);
+ goto out;
+ }
+
+ ret = rte_vhost_driver_disable_features(path,
+ VHOST_BLK_DISABLED_FEATURES);
+ if (ret != 0) {
+ RTE_LOG(ERR, VDPA,
+ "rte_vhost_driver_disable_features for %s failed.\n",
+ path);
+ goto out;
+ }
+
+ ret = rte_vhost_driver_get_protocol_features(path, &protocol_features);
+ if (ret != 0) {
+ RTE_LOG(ERR, VDPA,
+ "rte_vhost_driver_get_protocol_features for %s failed.\n",
+ path);
+ goto out;
+ }
+
+ protocol_features |= VHOST_BLK_PROTOCOL_FEATURES;
+
+ ret = rte_vhost_driver_set_protocol_features(path, protocol_features);
+ if (ret != 0) {
+ RTE_LOG(ERR, VDPA,
+ "rte_vhost_driver_set_protocol_features for %s failed.\n",
+ path);
+ }
+
+out:
+ return ret;
+}
+