[dpdk-dev] [PATCH 10/20] regex/mlx5: add engine status check
Ori Kam
orika at mellanox.com
Sun Jul 5 11:23:37 CEST 2020
This commit checks the engine status.
Signed-off-by: Ori Kam <orika at mellanox.com>
---
drivers/regex/mlx5/mlx5_regex.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c
index d264ecd..c469a10 100644
--- a/drivers/regex/mlx5/mlx5_regex.c
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -17,6 +17,7 @@
#include "mlx5_regex.h"
#include "mlx5_regex_utils.h"
+#include "mlx5_rxp_csrs.h"
int mlx5_regex_logtype;
@@ -49,6 +50,28 @@
mlx5_glue->free_device_list(ibv_list);
return ibv_match;
}
+static int
+mlx5_regex_engines_status(struct ibv_context *ctx, int num_engines)
+{
+ uint32_t fpga_ident = 0;
+ int err;
+ int i;
+
+ for (i = 0; i < num_engines; i++) {
+ err = mlx5_devx_regex_register_read(ctx, i,
+ MLX5_RXP_CSR_IDENTIFIER,
+ &fpga_ident);
+ fpga_ident = (fpga_ident & (0x0000FFFF));
+ if (err || fpga_ident != MLX5_RXP_IDENTIFER) {
+ DRV_LOG(ERR, "Failed setup RXP %d err %d database "
+ "memory 0x%x", i, err, fpga_ident);
+ if (!err)
+ err = EINVAL;
+ return err;
+ }
+ }
+ return 0;
+}
static void
mlx5_regex_get_name(char *name, struct rte_pci_device *pci_dev __rte_unused)
@@ -109,6 +132,11 @@
rte_errno = ENOTSUP;
goto error;
}
+ if (mlx5_regex_engines_status(ctx, 2)) {
+ DRV_LOG(ERR, "RegEx engine error.");
+ rte_errno = ENOMEM;
+ goto error;
+ }
priv = rte_zmalloc("mlx5 regex device private", sizeof(*priv),
RTE_CACHE_LINE_SIZE);
if (!priv) {
--
1.8.3.1
More information about the dev
mailing list