DRV_LOG(ERR, "Invalid vDPA device: %s.", vdev->device->name);
return -1;
}
- if (priv->configured)
- ret |= mlx5_vdpa_lm_log(priv);
mlx5_vdpa_err_event_unset(priv);
mlx5_vdpa_cqe_event_unset(priv);
+ if (priv->configured)
+ ret |= mlx5_vdpa_lm_log(priv);
mlx5_vdpa_steer_unset(priv);
mlx5_vdpa_virtqs_release(priv);
mlx5_vdpa_event_qp_global_release(priv);
unsigned long tmp;
int n_cores = sysconf(_SC_NPROCESSORS_ONLN);
- if (strcmp(key, RTE_DEVARGS_KEY_CLASS) == 0)
- return 0;
errno = 0;
tmp = strtoul(val, NULL, 0);
if (errno) {
priv->hw_max_latency_us = (uint32_t)tmp;
} else if (strcmp(key, "hw_max_pending_comp") == 0) {
priv->hw_max_pending_comp = (uint32_t)tmp;
- } else {
- DRV_LOG(WARNING, "Invalid key %s.", key);
}
return 0;
}
static void
-mlx5_vdpa_config_get(struct rte_devargs *devargs, struct mlx5_vdpa_priv *priv)
+mlx5_vdpa_config_get(struct mlx5_kvargs_ctrl *mkvlist,
+ struct mlx5_vdpa_priv *priv)
{
- struct rte_kvargs *kvlist;
+ const char **params = (const char *[]){
+ "event_core",
+ "event_mode",
+ "event_us",
+ "hw_latency_mode",
+ "hw_max_latency_us",
+ "hw_max_pending_comp",
+ "no_traffic_time",
+ NULL,
+ };
priv->event_mode = MLX5_VDPA_EVENT_MODE_FIXED_TIMER;
priv->event_us = 0;
priv->event_core = -1;
priv->no_traffic_max = MLX5_VDPA_DEFAULT_NO_TRAFFIC_MAX;
- if (devargs == NULL)
- return;
- kvlist = rte_kvargs_parse(devargs->args, NULL);
- if (kvlist == NULL)
+ if (mkvlist == NULL)
return;
- rte_kvargs_process(kvlist, NULL, mlx5_vdpa_args_check_handler, priv);
- rte_kvargs_free(kvlist);
+ mlx5_kvargs_process(mkvlist, params, mlx5_vdpa_args_check_handler,
+ priv);
if (!priv->event_us &&
priv->event_mode == MLX5_VDPA_EVENT_MODE_DYNAMIC_TIMER)
priv->event_us = MLX5_VDPA_DEFAULT_TIMER_STEP_US;
}
static int
-mlx5_vdpa_dev_probe(struct mlx5_common_device *cdev)
+mlx5_vdpa_dev_probe(struct mlx5_common_device *cdev,
+ struct mlx5_kvargs_ctrl *mkvlist)
{
struct mlx5_vdpa_priv *priv = NULL;
struct mlx5_hca_attr *attr = &cdev->config.hca_attr;
DRV_LOG(ERR, "Failed to allocate VAR %u.", errno);
goto error;
}
+ priv->err_intr_handle =
+ rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_SHARED);
+ if (priv->err_intr_handle == NULL) {
+ DRV_LOG(ERR, "Fail to allocate intr_handle");
+ goto error;
+ }
priv->vdev = rte_vdpa_register_device(cdev->dev, &mlx5_vdpa_ops);
if (priv->vdev == NULL) {
DRV_LOG(ERR, "Failed to register vDPA device.");
rte_errno = rte_errno ? rte_errno : EINVAL;
goto error;
}
- mlx5_vdpa_config_get(cdev->dev->devargs, priv);
+ mlx5_vdpa_config_get(mkvlist, priv);
SLIST_INIT(&priv->mr_list);
pthread_mutex_init(&priv->vq_config_lock, NULL);
pthread_mutex_lock(&priv_list_lock);
if (priv) {
if (priv->var)
mlx5_glue->dv_free_var(priv->var);
+ rte_intr_instance_free(priv->err_intr_handle);
rte_free(priv);
}
return -rte_errno;
if (priv->vdev)
rte_vdpa_unregister_device(priv->vdev);
pthread_mutex_destroy(&priv->vq_config_lock);
+ rte_intr_instance_free(priv->err_intr_handle);
rte_free(priv);
}
return 0;