[RFC,17/21] regex/mlx5: use HCA attributes from context device
Checks
Commit Message
Use HCA attributes from context device structure, instead of query it
for itself.
Signed-off-by: Michael Baum <michaelba@nvidia.com>
---
drivers/regex/mlx5/mlx5_regex.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
@@ -126,24 +126,12 @@ mlx5_regex_dev_probe(struct mlx5_common_device *mlx5_dev)
{
struct mlx5_regex_priv *priv = NULL;
struct mlx5_dev_ctx *dev_ctx = &mlx5_dev->ctx;
- struct mlx5_hca_attr attr;
char name[RTE_REGEXDEV_NAME_MAX_LEN];
const char *ibdev_name = mlx5_os_get_ctx_device_name(dev_ctx->ctx);
int ret;
uint32_t val;
DRV_LOG(INFO, "Probe device \"%s\".", ibdev_name);
- ret = mlx5_devx_cmd_query_hca_attr(dev_ctx->ctx, &attr);
- if (ret) {
- DRV_LOG(ERR, "Unable to read HCA capabilities.");
- rte_errno = ENOTSUP;
- return -rte_errno;
- } else if (!attr.regex || attr.regexp_num_of_engines == 0) {
- DRV_LOG(ERR, "Not enough capabilities to support RegEx, maybe "
- "old FW/OFED version?");
- rte_errno = ENOTSUP;
- return -rte_errno;
- }
if (mlx5_regex_engines_status(dev_ctx->ctx, 2)) {
DRV_LOG(ERR, "RegEx engine error.");
rte_errno = ENOMEM;
@@ -156,7 +144,7 @@ mlx5_regex_dev_probe(struct mlx5_common_device *mlx5_dev)
rte_errno = ENOMEM;
return -rte_errno;
}
- priv->sq_ts_format = attr.sq_ts_format;
+ priv->sq_ts_format = dev_ctx->hca_attr.sq_ts_format;
priv->dev_ctx = dev_ctx;
priv->nb_engines = 2; /* attr.regexp_num_of_engines */
ret = mlx5_devx_regex_register_read(priv->dev_ctx->ctx, 0,
@@ -190,8 +178,8 @@ mlx5_regex_dev_probe(struct mlx5_common_device *mlx5_dev)
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 (!dev_ctx->hca_attr.umr_indirect_mkey_disabled &&
+ !dev_ctx->hca_attr.umr_modify_entity_size_disabled)
priv->has_umr = 1;
if (priv->has_umr)
priv->regexdev->enqueue = mlx5_regexdev_enqueue_gga;