X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_vhost%2Fvdpa.c;h=ae6fdd24edbece10206ec5c27b961868977c797a;hb=83c2047c5fe82fb25674c3053d4871838e7455cb;hp=e41c73eb9a2f4ae017868e445b83367c1cac3322;hpb=e91ac959fadcfb10e7cf82e5b9c239cc36929e7a;p=dpdk.git diff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c index e41c73eb9a..ae6fdd24ed 100644 --- a/lib/librte_vhost/vdpa.c +++ b/lib/librte_vhost/vdpa.c @@ -17,6 +17,7 @@ #include #include "rte_vdpa.h" +#include "rte_vdpa_dev.h" #include "vhost.h" /** Double linked list of vDPA devices. */ @@ -76,6 +77,16 @@ rte_vdpa_register_device(struct rte_device *rte_dev, if (ops == NULL) return NULL; + /* Check mandatory ops are implemented */ + if (!ops->get_queue_num || !ops->get_features || + !ops->get_protocol_features || !ops->dev_conf || + !ops->dev_close || !ops->set_vring_state || + !ops->set_features) { + VHOST_LOG_CONFIG(ERR, + "Some mandatory vDPA ops aren't implemented\n"); + return NULL; + } + rte_spinlock_lock(&vdpa_device_list_lock); /* Check the device hasn't been register already */ dev = __vdpa_find_device_by_name(rte_dev->name);