X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fregex%2Fmlx5%2Fmlx5_regex.c;h=b39181ebb57869c5d98da3871c2a3861420fdf1f;hb=fb690f71bdb4c024838f6fa5b9a1f6277e691ae1;hp=f915a9d047b4aa82ae6d4dbdcc38182d492bfad8;hpb=ca1418ce39108e7c2a778a14448457ad1264b183;p=dpdk.git diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index f915a9d047..b39181ebb5 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -125,18 +125,13 @@ static int mlx5_regex_dev_probe(struct mlx5_common_device *cdev) { struct mlx5_regex_priv *priv = NULL; - struct mlx5_hca_attr attr; + struct mlx5_hca_attr *attr = &cdev->config.hca_attr; char name[RTE_REGEXDEV_NAME_MAX_LEN]; int ret; uint32_t val; - ret = mlx5_devx_cmd_query_hca_attr(cdev->ctx, &attr); - if (ret) { - DRV_LOG(ERR, "Unable to read HCA capabilities."); - rte_errno = ENOTSUP; - return -rte_errno; - } else if (((!attr.regex) && (!attr.mmo_regex_sq_en) && - (!attr.mmo_regex_qp_en)) || attr.regexp_num_of_engines == 0) { + if ((!attr->regex && !attr->mmo_regex_sq_en && !attr->mmo_regex_qp_en) + || attr->regexp_num_of_engines == 0) { DRV_LOG(ERR, "Not enough capabilities to support RegEx, maybe " "old FW/OFED version?"); rte_errno = ENOTSUP; @@ -154,9 +149,8 @@ mlx5_regex_dev_probe(struct mlx5_common_device *cdev) rte_errno = ENOMEM; return -rte_errno; } - priv->mmo_regex_qp_cap = attr.mmo_regex_qp_en; - priv->mmo_regex_sq_cap = attr.mmo_regex_sq_en; - priv->qp_ts_format = attr.qp_ts_format; + priv->mmo_regex_qp_cap = attr->mmo_regex_qp_en; + priv->mmo_regex_sq_cap = attr->mmo_regex_sq_en; priv->cdev = cdev; priv->nb_engines = 2; /* attr.regexp_num_of_engines */ ret = mlx5_devx_regex_register_read(priv->cdev->ctx, 0, @@ -187,17 +181,11 @@ mlx5_regex_dev_probe(struct mlx5_common_device *cdev) rte_errno = ENOMEM; goto error; } - priv->pd = mlx5_glue->alloc_pd(priv->cdev->ctx); - if (!priv->pd) { - DRV_LOG(ERR, "can't allocate pd."); - rte_errno = ENOMEM; - goto error; - } priv->regexdev->dev_ops = &mlx5_regexdev_ops; priv->regexdev->enqueue = mlx5_regexdev_enqueue; #ifdef HAVE_MLX5_UMR_IMKEY - if (!attr.umr_indirect_mkey_disabled && - !attr.umr_modify_entity_size_disabled) + if (!attr->umr_indirect_mkey_disabled && + !attr->umr_modify_entity_size_disabled) priv->has_umr = 1; if (priv->has_umr) priv->regexdev->enqueue = mlx5_regexdev_enqueue_gga; @@ -206,11 +194,7 @@ mlx5_regex_dev_probe(struct mlx5_common_device *cdev) priv->regexdev->device = cdev->dev; priv->regexdev->data->dev_private = priv; priv->regexdev->state = RTE_REGEXDEV_READY; - priv->mr_scache.reg_mr_cb = mlx5_common_verbs_reg_mr; - priv->mr_scache.dereg_mr_cb = mlx5_common_verbs_dereg_mr; - ret = mlx5_mr_btree_init(&priv->mr_scache.cache, - MLX5_MR_BTREE_CACHE_N * 2, - rte_socket_id()); + ret = mlx5_mr_create_cache(&priv->mr_scache, rte_socket_id()); if (ret) { DRV_LOG(ERR, "MR init tree failed."); rte_errno = ENOMEM; @@ -230,8 +214,6 @@ mlx5_regex_dev_probe(struct mlx5_common_device *cdev) return 0; error: - if (priv->pd) - mlx5_glue->dealloc_pd(priv->pd); if (priv->uar) mlx5_glue->devx_free_uar(priv->uar); if (priv->regexdev) @@ -264,8 +246,6 @@ mlx5_regex_dev_remove(struct mlx5_common_device *cdev) NULL); if (priv->mr_scache.cache.table) mlx5_mr_release_cache(&priv->mr_scache); - if (priv->pd) - mlx5_glue->dealloc_pd(priv->pd); if (priv->uar) mlx5_glue->devx_free_uar(priv->uar); if (priv->regexdev)