+struct rte_vdpa_device *
+rte_vdpa_register_device(struct rte_device *rte_dev,
+ struct rte_vdpa_dev_ops *ops)
+{
+ struct rte_vdpa_device *dev;
+ int i;
+
+ if (vdpa_device_num >= MAX_VHOST_DEVICE || ops == NULL)
+ return NULL;
+
+ for (i = 0; i < MAX_VHOST_DEVICE; i++) {
+ dev = &vdpa_devices[i];
+ if (dev->ops == NULL)
+ continue;
+
+ if (dev->device == rte_dev)
+ return NULL;
+ }
+
+ for (i = 0; i < MAX_VHOST_DEVICE; i++) {
+ if (vdpa_devices[i].ops == NULL)
+ break;
+ }
+
+ if (i == MAX_VHOST_DEVICE)
+ return NULL;
+
+ dev = &vdpa_devices[i];
+ dev->device = rte_dev;
+ dev->ops = ops;
+ vdpa_device_num++;
+
+ return dev;
+}
+
+int
+rte_vdpa_unregister_device(struct rte_vdpa_device *vdev)
+{
+ int did = rte_vdpa_find_device_id(vdev);
+
+ if (did < 0 || vdpa_devices[did].ops == NULL)
+ return -1;
+
+ memset(&vdpa_devices[did], 0, sizeof(struct rte_vdpa_device));
+ vdpa_device_num--;
+
+ return 0;
+}
+