+static struct mlx5_vdpa_priv *
+mlx5_vdpa_find_priv_resource_by_did(int did)
+{
+ struct mlx5_vdpa_priv *priv;
+ int found = 0;
+
+ pthread_mutex_lock(&priv_list_lock);
+ TAILQ_FOREACH(priv, &priv_list, next) {
+ if (did == priv->id) {
+ found = 1;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&priv_list_lock);
+ if (!found) {
+ DRV_LOG(ERR, "Invalid device id: %d.", did);
+ rte_errno = EINVAL;
+ return NULL;
+ }
+ return priv;
+}
+
+static int
+mlx5_vdpa_get_queue_num(int did, uint32_t *queue_num)
+{
+ struct mlx5_vdpa_priv *priv = mlx5_vdpa_find_priv_resource_by_did(did);
+
+ if (priv == NULL) {
+ DRV_LOG(ERR, "Invalid device id: %d.", did);
+ return -1;
+ }
+ *queue_num = priv->caps.max_num_virtio_queues;
+ return 0;
+}
+