DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] common/mlx5: update DevX error logging
@ 2022-07-05 14:48 Gregory Etelson
  2022-07-06 14:02 ` [PATCH v2] " Gregory Etelson
  2022-07-10 16:02 ` [PATCH v3] " Gregory Etelson
  0 siblings, 2 replies; 5+ messages in thread
From: Gregory Etelson @ 2022-07-05 14:48 UTC (permalink / raw)
  To: dev; +Cc: getelson, matan, rasland, stable, Viacheslav Ovsiienko

Current PMD logs all DevX errors at RTE_LOG_ERR level.

DevX interface can fail queue counters allocation on some hardware
types. That is a known issue.
PMD fallback to VERB API to allocate queue counters
when it detects the fault.
That DevX failure should not be logged as PMD error.

The patch provides DevX with flexible API that selects log level.

cc: stable@dpdk.org
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/mlx5_devx_cmds.c | 90 ++++++++++++++--------------
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 8880a9f3b5..35d977bfd6 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -20,20 +20,21 @@
 
 #define MLX5_DEVX_ERR_RC(x) ((x) > 0 ? -(x) : ((x) < 0 ? (x) : -1))
 
-static void
-mlx5_devx_err_log(void *out, const char *reason,
-		  const char *param, uint32_t value)
-{
-	rte_errno = errno;
-	if (!param)
-		DRV_LOG(ERR, "DevX %s failed errno=%d status=%#x syndrome=%#x",
-			reason, errno, MLX5_FW_STATUS(out),
-			MLX5_FW_SYNDROME(out));
-	else
-		DRV_LOG(ERR, "DevX %s %s=%#X failed errno=%d status=%#x syndrome=%#x",
-			reason, param, value, errno, MLX5_FW_STATUS(out),
-			MLX5_FW_SYNDROME(out));
-}
+#define DEVX_DRV_LOG(level, out, reason, param, value)				\
+do {										\
+	rte_errno = errno;							\
+	if (!(param)) {								\
+		DRV_LOG(level,							\
+			"DevX %s failed errno=%d status=%#x syndrome=%#x",	\
+			(reason), errno, MLX5_FW_STATUS((out)),			\
+			MLX5_FW_SYNDROME((out)));				\
+	} else {								\
+		DRV_LOG(level,							\
+			"DevX %s %s=%#X failed errno=%d status=%#x syndrome=%#x",\
+			(reason), (const char *)(param), (value), errno,         \
+			MLX5_FW_STATUS((out)), MLX5_FW_SYNDROME((out)));	\
+	}									\
+} while (0)
 
 static void *
 mlx5_devx_get_hca_cap(void *ctx, uint32_t *in, uint32_t *out,
@@ -49,7 +50,7 @@ mlx5_devx_get_hca_cap(void *ctx, uint32_t *in, uint32_t *out,
 	MLX5_SET(query_hca_cap_in, in, op_mod, flags);
 	rc = mlx5_glue->devx_general_cmd(ctx, in, size_in, out, size_out);
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "HCA capabilities", "func", flags >> 1);
+		DEVX_DRV_LOG(ERR, out, "HCA capabilities", "func", flags >> 1);
 		if (err)
 			*err = MLX5_DEVX_ERR_RC(rc);
 		return NULL;
@@ -102,7 +103,7 @@ mlx5_devx_cmd_register_read(void *ctx, uint16_t reg_id, uint32_t arg,
 					 MLX5_ST_SZ_BYTES(access_register_out) +
 					 sizeof(uint32_t) * dw_cnt);
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "read access", "NIC register", reg_id);
+		DEVX_DRV_LOG(ERR, out, "read access", "NIC register", reg_id);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	memcpy(data, &out[MLX5_ST_SZ_DW(access_register_out)],
@@ -153,7 +154,7 @@ mlx5_devx_cmd_register_write(void *ctx, uint16_t reg_id, uint32_t arg,
 	memcpy(ptr, data, dw_cnt * sizeof(uint32_t));
 	rc = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out));
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "write access", "NIC register", reg_id);
+		DEVX_DRV_LOG(ERR, out, "write access", "NIC register", reg_id);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	rc = mlx5_glue->devx_general_cmd(ctx, in,
@@ -161,7 +162,7 @@ mlx5_devx_cmd_register_write(void *ctx, uint16_t reg_id, uint32_t arg,
 					 dw_cnt * sizeof(uint32_t),
 					 out, sizeof(out));
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "write access", "NIC register", reg_id);
+		DEVX_DRV_LOG(ERR, out, "write access", "NIC register", reg_id);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	return 0;
@@ -199,7 +200,7 @@ mlx5_devx_cmd_flow_counter_alloc(void *ctx, uint32_t bulk_n_128)
 	dcs->obj = mlx5_glue->devx_obj_create(ctx, in,
 					      sizeof(in), out, sizeof(out));
 	if (!dcs->obj) {
-		mlx5_devx_err_log(out, "allocate counters", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "allocate counters", NULL, 0);
 		mlx5_free(dcs);
 		return NULL;
 	}
@@ -377,9 +378,8 @@ mlx5_devx_cmd_mkey_create(void *ctx,
 	mkey->obj = mlx5_glue->devx_obj_create(ctx, in, in_size_dw * 4, out,
 					       sizeof(out));
 	if (!mkey->obj) {
-		mlx5_devx_err_log(out,
-				  klm_num ? "create indirect mkey" : "create direct key",
-				  NULL, 0);
+		DEVX_DRV_LOG(ERR, out, klm_num ? "create indirect mkey"
+					       : "create direct key", NULL, 0);
 		mlx5_free(mkey);
 		return NULL;
 	}
@@ -470,7 +470,7 @@ mlx5_devx_cmd_query_nic_vport_context(void *ctx,
 					 in, sizeof(in),
 					 out, sizeof(out));
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "query NIC vport context", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "query NIC vport context", NULL, 0);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	vctx = MLX5_ADDR_OF(query_nic_vport_context_out, out,
@@ -717,7 +717,7 @@ mlx5_devx_cmd_create_flex_parser(void *ctx,
 	parse_flex_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							 out, sizeof(out));
 	if (!parse_flex_obj->obj) {
-		mlx5_devx_err_log(out, "create FLEX PARSE GRAPH", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create FLEX PARSE GRAPH", NULL, 0);
 		mlx5_free(parse_flex_obj);
 		return NULL;
 	}
@@ -1292,7 +1292,7 @@ mlx5_devx_cmd_create_rq(void *ctx,
 	rq->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						  out, sizeof(out));
 	if (!rq->obj) {
-		mlx5_devx_err_log(out, "create RQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create RQ", NULL, 0);
 		mlx5_free(rq);
 		return NULL;
 	}
@@ -1391,7 +1391,7 @@ mlx5_devx_cmd_create_rmp(void *ctx,
 	rmp->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 					      sizeof(out));
 	if (!rmp->obj) {
-		mlx5_devx_err_log(out, "create RMP", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create RMP", NULL, 0);
 		mlx5_free(rmp);
 		return NULL;
 	}
@@ -1459,7 +1459,7 @@ mlx5_devx_cmd_create_tir(void *ctx,
 	tir->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						   out, sizeof(out));
 	if (!tir->obj) {
-		mlx5_devx_err_log(out, "create TIR", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create TIR", NULL, 0);
 		mlx5_free(tir);
 		return NULL;
 	}
@@ -1597,7 +1597,7 @@ mlx5_devx_cmd_create_rqt(void *ctx,
 	rqt->obj = mlx5_glue->devx_obj_create(ctx, in, inlen, out, sizeof(out));
 	mlx5_free(in);
 	if (!rqt->obj) {
-		mlx5_devx_err_log(out, "create RQT", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create RQT", NULL, 0);
 		mlx5_free(rqt);
 		return NULL;
 	}
@@ -1711,7 +1711,7 @@ mlx5_devx_cmd_create_sq(void *ctx,
 	sq->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 					     out, sizeof(out));
 	if (!sq->obj) {
-		mlx5_devx_err_log(out, "create SQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create SQ", NULL, 0);
 		mlx5_free(sq);
 		return NULL;
 	}
@@ -1794,7 +1794,7 @@ mlx5_devx_cmd_create_tis(void *ctx,
 	tis->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 					      out, sizeof(out));
 	if (!tis->obj) {
-		mlx5_devx_err_log(out, "create TIS", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create TIS", NULL, 0);
 		mlx5_free(tis);
 		return NULL;
 	}
@@ -1828,7 +1828,7 @@ mlx5_devx_cmd_create_td(void *ctx)
 	td->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 					     out, sizeof(out));
 	if (!td->obj) {
-		mlx5_devx_err_log(out, "create TIS", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create TIS", NULL, 0);
 		mlx5_free(td);
 		return NULL;
 	}
@@ -1948,7 +1948,7 @@ mlx5_devx_cmd_create_cq(void *ctx, struct mlx5_devx_cq_attr *attr)
 	cq_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						 sizeof(out));
 	if (!cq_obj->obj) {
-		mlx5_devx_err_log(out, "create CQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CQ", NULL, 0);
 		mlx5_free(cq_obj);
 		return NULL;
 	}
@@ -2024,7 +2024,7 @@ mlx5_devx_cmd_create_virtq(void *ctx,
 	virtq_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						    sizeof(out));
 	if (!virtq_obj->obj) {
-		mlx5_devx_err_log(out, "create VIRTQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create VIRTQ", NULL, 0);
 		mlx5_free(virtq_obj);
 		return NULL;
 	}
@@ -2257,7 +2257,7 @@ mlx5_devx_cmd_create_qp(void *ctx,
 	qp_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						 sizeof(out));
 	if (!qp_obj->obj) {
-		mlx5_devx_err_log(out, "create QP", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create QP", NULL, 0);
 		mlx5_free(qp_obj);
 		return NULL;
 	}
@@ -2378,8 +2378,8 @@ mlx5_devx_cmd_create_virtio_q_counters(void *ctx)
 	couners_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						      sizeof(out));
 	if (!couners_obj->obj) {
-		mlx5_devx_err_log(out, "create virtio queue counters Obj",
-				  NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create virtio queue counters Obj", NULL,
+			     0);
 		mlx5_free(couners_obj);
 		return NULL;
 	}
@@ -2461,7 +2461,7 @@ mlx5_devx_cmd_create_flow_hit_aso_obj(void *ctx, uint32_t pd)
 	flow_hit_aso_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							   out, sizeof(out));
 	if (!flow_hit_aso_obj->obj) {
-		mlx5_devx_err_log(out, "create FLOW_HIT_ASO", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create FLOW_HIT_ASO", NULL, 0);
 		mlx5_free(flow_hit_aso_obj);
 		return NULL;
 	}
@@ -2548,7 +2548,7 @@ mlx5_devx_cmd_create_flow_meter_aso_obj(void *ctx, uint32_t pd,
 							ctx, in, sizeof(in),
 							out, sizeof(out));
 	if (!flow_meter_aso_obj->obj) {
-		mlx5_devx_err_log(out, "create FLOW_METTER_ASO", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create FLOW_METTER_ASO", NULL, 0);
 		mlx5_free(flow_meter_aso_obj);
 		return NULL;
 	}
@@ -2598,7 +2598,7 @@ mlx5_devx_cmd_create_conn_track_offload_obj(void *ctx, uint32_t pd,
 	ct_aso_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						     out, sizeof(out));
 	if (!ct_aso_obj->obj) {
-		mlx5_devx_err_log(out, "create CONN_TRACK_OFFLOAD", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CONN_TRACK_OFFLOAD", NULL, 0);
 		mlx5_free(ct_aso_obj);
 		return NULL;
 	}
@@ -2650,7 +2650,7 @@ mlx5_devx_cmd_create_geneve_tlv_option(void *ctx,
 	geneve_tlv_opt_obj->obj = mlx5_glue->devx_obj_create(ctx, in,
 					sizeof(in), out, sizeof(out));
 	if (!geneve_tlv_opt_obj->obj) {
-		mlx5_devx_err_log(out, "create GENEVE TLV", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create GENEVE TLV", NULL, 0);
 		mlx5_free(geneve_tlv_opt_obj);
 		return NULL;
 	}
@@ -2712,7 +2712,7 @@ mlx5_devx_cmd_queue_counter_alloc(void *ctx)
 	dcs->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 					      sizeof(out));
 	if (!dcs->obj) {
-		mlx5_devx_err_log(out, "create q counter set", NULL, 0);
+		DEVX_DRV_LOG(DEBUG, out, "create q counter set", NULL, 0);
 		mlx5_free(dcs);
 		return NULL;
 	}
@@ -2799,7 +2799,7 @@ mlx5_devx_cmd_create_dek_obj(void *ctx, struct mlx5_devx_dek_attr *attr)
 	dek_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						  out, sizeof(out));
 	if (dek_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create DEK", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create DEK", NULL, 0);
 		mlx5_free(dek_obj);
 		return NULL;
 	}
@@ -2846,7 +2846,7 @@ mlx5_devx_cmd_create_import_kek_obj(void *ctx,
 	import_kek_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							 out, sizeof(out));
 	if (import_kek_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create IMPORT_KEK", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create IMPORT_KEK", NULL, 0);
 		mlx5_free(import_kek_obj);
 		return NULL;
 	}
@@ -2894,7 +2894,7 @@ mlx5_devx_cmd_create_credential_obj(void *ctx,
 	credential_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							 out, sizeof(out));
 	if (credential_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create CREDENTIAL", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CREDENTIAL", NULL, 0);
 		mlx5_free(credential_obj);
 		return NULL;
 	}
@@ -2945,7 +2945,7 @@ mlx5_devx_cmd_create_crypto_login_obj(void *ctx,
 	crypto_login_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							   out, sizeof(out));
 	if (crypto_login_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create CRYPTO_LOGIN", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CRYPTO_LOGIN", NULL, 0);
 		mlx5_free(crypto_login_obj);
 		return NULL;
 	}
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] common/mlx5: update DevX error logging
  2022-07-05 14:48 [PATCH] common/mlx5: update DevX error logging Gregory Etelson
@ 2022-07-06 14:02 ` Gregory Etelson
  2022-07-08 14:23   ` Thomas Monjalon
  2022-07-10 16:02 ` [PATCH v3] " Gregory Etelson
  1 sibling, 1 reply; 5+ messages in thread
From: Gregory Etelson @ 2022-07-06 14:02 UTC (permalink / raw)
  To: dev; +Cc: getelson, matan, rasland, stable, Viacheslav Ovsiienko

Current PMD logs all DevX errors at error level.

DevX interface can fail queue counters allocation on some hardware
types. That is a known issue.
PMD fallback to VERB API to allocate queue counters
when it detects the fault.
That DevX failure should not be logged as PMD error.

The patch provides DevX with flexible API that selects log level.

cc: stable@dpdk.org
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
v2: fix warnings in old gcc versions
---
 drivers/common/mlx5/mlx5_devx_cmds.c | 98 +++++++++++++++-------------
 1 file changed, 53 insertions(+), 45 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 8880a9f3b5..fb33023138 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -20,20 +20,29 @@
 
 #define MLX5_DEVX_ERR_RC(x) ((x) > 0 ? -(x) : ((x) < 0 ? (x) : -1))
 
-static void
-mlx5_devx_err_log(void *out, const char *reason,
-		  const char *param, uint32_t value)
-{
-	rte_errno = errno;
-	if (!param)
-		DRV_LOG(ERR, "DevX %s failed errno=%d status=%#x syndrome=%#x",
-			reason, errno, MLX5_FW_STATUS(out),
-			MLX5_FW_SYNDROME(out));
-	else
-		DRV_LOG(ERR, "DevX %s %s=%#X failed errno=%d status=%#x syndrome=%#x",
-			reason, param, value, errno, MLX5_FW_STATUS(out),
-			MLX5_FW_SYNDROME(out));
-}
+#define DEVX_DRV_LOG(level, out, reason, param, value)				\
+do {										\
+	/*									\
+	 * Some (old) GCC compilers like 7.5.0 and aarch64 GCC 7.1-2017.08	\
+	 * do not expand correctly when the macro invoked when the `param`	\
+	 * is `NULL`.								\
+	 * Use `local_param` to avoid direct `NULL` expansion.			\
+	 */									\
+	const char *local_param = (const char *)param; 				\
+										\
+	rte_errno = errno;							\
+	if (!local_param) {							\
+		DRV_LOG(level,							\
+			"DevX %s failed errno=%d status=%#x syndrome=%#x",	\
+			(reason), errno, MLX5_FW_STATUS((out)),			\
+			MLX5_FW_SYNDROME((out)));				\
+	} else {								\
+		DRV_LOG(level,							\
+			"DevX %s %s=%#X failed errno=%d status=%#x syndrome=%#x",\
+			(reason), local_param, (value), errno,         		\
+			MLX5_FW_STATUS((out)), MLX5_FW_SYNDROME((out)));	\
+	}									\
+} while (0)
 
 static void *
 mlx5_devx_get_hca_cap(void *ctx, uint32_t *in, uint32_t *out,
@@ -49,7 +58,7 @@ mlx5_devx_get_hca_cap(void *ctx, uint32_t *in, uint32_t *out,
 	MLX5_SET(query_hca_cap_in, in, op_mod, flags);
 	rc = mlx5_glue->devx_general_cmd(ctx, in, size_in, out, size_out);
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "HCA capabilities", "func", flags >> 1);
+		DEVX_DRV_LOG(ERR, out, "HCA capabilities", "func", flags >> 1);
 		if (err)
 			*err = MLX5_DEVX_ERR_RC(rc);
 		return NULL;
@@ -102,7 +111,7 @@ mlx5_devx_cmd_register_read(void *ctx, uint16_t reg_id, uint32_t arg,
 					 MLX5_ST_SZ_BYTES(access_register_out) +
 					 sizeof(uint32_t) * dw_cnt);
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "read access", "NIC register", reg_id);
+		DEVX_DRV_LOG(ERR, out, "read access", "NIC register", reg_id);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	memcpy(data, &out[MLX5_ST_SZ_DW(access_register_out)],
@@ -153,7 +162,7 @@ mlx5_devx_cmd_register_write(void *ctx, uint16_t reg_id, uint32_t arg,
 	memcpy(ptr, data, dw_cnt * sizeof(uint32_t));
 	rc = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out));
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "write access", "NIC register", reg_id);
+		DEVX_DRV_LOG(ERR, out, "write access", "NIC register", reg_id);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	rc = mlx5_glue->devx_general_cmd(ctx, in,
@@ -161,7 +170,7 @@ mlx5_devx_cmd_register_write(void *ctx, uint16_t reg_id, uint32_t arg,
 					 dw_cnt * sizeof(uint32_t),
 					 out, sizeof(out));
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "write access", "NIC register", reg_id);
+		DEVX_DRV_LOG(ERR, out, "write access", "NIC register", reg_id);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	return 0;
@@ -199,7 +208,7 @@ mlx5_devx_cmd_flow_counter_alloc(void *ctx, uint32_t bulk_n_128)
 	dcs->obj = mlx5_glue->devx_obj_create(ctx, in,
 					      sizeof(in), out, sizeof(out));
 	if (!dcs->obj) {
-		mlx5_devx_err_log(out, "allocate counters", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "allocate counters", NULL, 0);
 		mlx5_free(dcs);
 		return NULL;
 	}
@@ -377,9 +386,8 @@ mlx5_devx_cmd_mkey_create(void *ctx,
 	mkey->obj = mlx5_glue->devx_obj_create(ctx, in, in_size_dw * 4, out,
 					       sizeof(out));
 	if (!mkey->obj) {
-		mlx5_devx_err_log(out,
-				  klm_num ? "create indirect mkey" : "create direct key",
-				  NULL, 0);
+		DEVX_DRV_LOG(ERR, out, klm_num ? "create indirect mkey"
+					       : "create direct key", NULL, 0);
 		mlx5_free(mkey);
 		return NULL;
 	}
@@ -470,7 +478,7 @@ mlx5_devx_cmd_query_nic_vport_context(void *ctx,
 					 in, sizeof(in),
 					 out, sizeof(out));
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "query NIC vport context", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "query NIC vport context", NULL, 0);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	vctx = MLX5_ADDR_OF(query_nic_vport_context_out, out,
@@ -717,7 +725,7 @@ mlx5_devx_cmd_create_flex_parser(void *ctx,
 	parse_flex_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							 out, sizeof(out));
 	if (!parse_flex_obj->obj) {
-		mlx5_devx_err_log(out, "create FLEX PARSE GRAPH", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create FLEX PARSE GRAPH", NULL, 0);
 		mlx5_free(parse_flex_obj);
 		return NULL;
 	}
@@ -1292,7 +1300,7 @@ mlx5_devx_cmd_create_rq(void *ctx,
 	rq->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						  out, sizeof(out));
 	if (!rq->obj) {
-		mlx5_devx_err_log(out, "create RQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create RQ", NULL, 0);
 		mlx5_free(rq);
 		return NULL;
 	}
@@ -1391,7 +1399,7 @@ mlx5_devx_cmd_create_rmp(void *ctx,
 	rmp->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 					      sizeof(out));
 	if (!rmp->obj) {
-		mlx5_devx_err_log(out, "create RMP", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create RMP", NULL, 0);
 		mlx5_free(rmp);
 		return NULL;
 	}
@@ -1459,7 +1467,7 @@ mlx5_devx_cmd_create_tir(void *ctx,
 	tir->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						   out, sizeof(out));
 	if (!tir->obj) {
-		mlx5_devx_err_log(out, "create TIR", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create TIR", NULL, 0);
 		mlx5_free(tir);
 		return NULL;
 	}
@@ -1597,7 +1605,7 @@ mlx5_devx_cmd_create_rqt(void *ctx,
 	rqt->obj = mlx5_glue->devx_obj_create(ctx, in, inlen, out, sizeof(out));
 	mlx5_free(in);
 	if (!rqt->obj) {
-		mlx5_devx_err_log(out, "create RQT", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create RQT", NULL, 0);
 		mlx5_free(rqt);
 		return NULL;
 	}
@@ -1711,7 +1719,7 @@ mlx5_devx_cmd_create_sq(void *ctx,
 	sq->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 					     out, sizeof(out));
 	if (!sq->obj) {
-		mlx5_devx_err_log(out, "create SQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create SQ", NULL, 0);
 		mlx5_free(sq);
 		return NULL;
 	}
@@ -1794,7 +1802,7 @@ mlx5_devx_cmd_create_tis(void *ctx,
 	tis->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 					      out, sizeof(out));
 	if (!tis->obj) {
-		mlx5_devx_err_log(out, "create TIS", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create TIS", NULL, 0);
 		mlx5_free(tis);
 		return NULL;
 	}
@@ -1828,7 +1836,7 @@ mlx5_devx_cmd_create_td(void *ctx)
 	td->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 					     out, sizeof(out));
 	if (!td->obj) {
-		mlx5_devx_err_log(out, "create TIS", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create TIS", NULL, 0);
 		mlx5_free(td);
 		return NULL;
 	}
@@ -1948,7 +1956,7 @@ mlx5_devx_cmd_create_cq(void *ctx, struct mlx5_devx_cq_attr *attr)
 	cq_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						 sizeof(out));
 	if (!cq_obj->obj) {
-		mlx5_devx_err_log(out, "create CQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CQ", NULL, 0);
 		mlx5_free(cq_obj);
 		return NULL;
 	}
@@ -2024,7 +2032,7 @@ mlx5_devx_cmd_create_virtq(void *ctx,
 	virtq_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						    sizeof(out));
 	if (!virtq_obj->obj) {
-		mlx5_devx_err_log(out, "create VIRTQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create VIRTQ", NULL, 0);
 		mlx5_free(virtq_obj);
 		return NULL;
 	}
@@ -2257,7 +2265,7 @@ mlx5_devx_cmd_create_qp(void *ctx,
 	qp_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						 sizeof(out));
 	if (!qp_obj->obj) {
-		mlx5_devx_err_log(out, "create QP", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create QP", NULL, 0);
 		mlx5_free(qp_obj);
 		return NULL;
 	}
@@ -2378,8 +2386,8 @@ mlx5_devx_cmd_create_virtio_q_counters(void *ctx)
 	couners_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						      sizeof(out));
 	if (!couners_obj->obj) {
-		mlx5_devx_err_log(out, "create virtio queue counters Obj",
-				  NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create virtio queue counters Obj", NULL,
+			     0);
 		mlx5_free(couners_obj);
 		return NULL;
 	}
@@ -2461,7 +2469,7 @@ mlx5_devx_cmd_create_flow_hit_aso_obj(void *ctx, uint32_t pd)
 	flow_hit_aso_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							   out, sizeof(out));
 	if (!flow_hit_aso_obj->obj) {
-		mlx5_devx_err_log(out, "create FLOW_HIT_ASO", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create FLOW_HIT_ASO", NULL, 0);
 		mlx5_free(flow_hit_aso_obj);
 		return NULL;
 	}
@@ -2548,7 +2556,7 @@ mlx5_devx_cmd_create_flow_meter_aso_obj(void *ctx, uint32_t pd,
 							ctx, in, sizeof(in),
 							out, sizeof(out));
 	if (!flow_meter_aso_obj->obj) {
-		mlx5_devx_err_log(out, "create FLOW_METTER_ASO", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create FLOW_METTER_ASO", NULL, 0);
 		mlx5_free(flow_meter_aso_obj);
 		return NULL;
 	}
@@ -2598,7 +2606,7 @@ mlx5_devx_cmd_create_conn_track_offload_obj(void *ctx, uint32_t pd,
 	ct_aso_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						     out, sizeof(out));
 	if (!ct_aso_obj->obj) {
-		mlx5_devx_err_log(out, "create CONN_TRACK_OFFLOAD", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CONN_TRACK_OFFLOAD", NULL, 0);
 		mlx5_free(ct_aso_obj);
 		return NULL;
 	}
@@ -2650,7 +2658,7 @@ mlx5_devx_cmd_create_geneve_tlv_option(void *ctx,
 	geneve_tlv_opt_obj->obj = mlx5_glue->devx_obj_create(ctx, in,
 					sizeof(in), out, sizeof(out));
 	if (!geneve_tlv_opt_obj->obj) {
-		mlx5_devx_err_log(out, "create GENEVE TLV", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create GENEVE TLV", NULL, 0);
 		mlx5_free(geneve_tlv_opt_obj);
 		return NULL;
 	}
@@ -2712,7 +2720,7 @@ mlx5_devx_cmd_queue_counter_alloc(void *ctx)
 	dcs->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 					      sizeof(out));
 	if (!dcs->obj) {
-		mlx5_devx_err_log(out, "create q counter set", NULL, 0);
+		DEVX_DRV_LOG(DEBUG, out, "create q counter set", NULL, 0);
 		mlx5_free(dcs);
 		return NULL;
 	}
@@ -2799,7 +2807,7 @@ mlx5_devx_cmd_create_dek_obj(void *ctx, struct mlx5_devx_dek_attr *attr)
 	dek_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						  out, sizeof(out));
 	if (dek_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create DEK", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create DEK", NULL, 0);
 		mlx5_free(dek_obj);
 		return NULL;
 	}
@@ -2846,7 +2854,7 @@ mlx5_devx_cmd_create_import_kek_obj(void *ctx,
 	import_kek_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							 out, sizeof(out));
 	if (import_kek_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create IMPORT_KEK", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create IMPORT_KEK", NULL, 0);
 		mlx5_free(import_kek_obj);
 		return NULL;
 	}
@@ -2894,7 +2902,7 @@ mlx5_devx_cmd_create_credential_obj(void *ctx,
 	credential_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							 out, sizeof(out));
 	if (credential_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create CREDENTIAL", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CREDENTIAL", NULL, 0);
 		mlx5_free(credential_obj);
 		return NULL;
 	}
@@ -2945,7 +2953,7 @@ mlx5_devx_cmd_create_crypto_login_obj(void *ctx,
 	crypto_login_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							   out, sizeof(out));
 	if (crypto_login_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create CRYPTO_LOGIN", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CRYPTO_LOGIN", NULL, 0);
 		mlx5_free(crypto_login_obj);
 		return NULL;
 	}
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] common/mlx5: update DevX error logging
  2022-07-06 14:02 ` [PATCH v2] " Gregory Etelson
@ 2022-07-08 14:23   ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2022-07-08 14:23 UTC (permalink / raw)
  To: Gregory Etelson; +Cc: dev, stable, matan, rasland, stable, Viacheslav Ovsiienko

06/07/2022 16:02, Gregory Etelson:
> Current PMD logs all DevX errors at error level.
> 
> DevX interface can fail queue counters allocation on some hardware
> types. That is a known issue.
> PMD fallback to VERB API to allocate queue counters
> when it detects the fault.
> That DevX failure should not be logged as PMD error.
> 
> The patch provides DevX with flexible API that selects log level.
> 
> cc: stable@dpdk.org

Why is there this cc line?

> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3] common/mlx5: update DevX error logging
  2022-07-05 14:48 [PATCH] common/mlx5: update DevX error logging Gregory Etelson
  2022-07-06 14:02 ` [PATCH v2] " Gregory Etelson
@ 2022-07-10 16:02 ` Gregory Etelson
  2022-08-14 13:51   ` Raslan Darawsheh
  1 sibling, 1 reply; 5+ messages in thread
From: Gregory Etelson @ 2022-07-10 16:02 UTC (permalink / raw)
  To: dev; +Cc: getelson, matan, rasland, thomas, Viacheslav Ovsiienko

Current PMD logs all DevX errors at error level.

DevX interface can fail queue counters allocation on some hardware
types. That is a known issue.
PMD fallback to VERB API to allocate queue counters
when it detects the fault.
That DevX failure should not be logged as PMD error.

The patch provides DevX with flexible API that selects log level.

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
v2: fix warnings in old gcc versions
v3: remove cc stable
---
 drivers/common/mlx5/mlx5_devx_cmds.c | 98 +++++++++++++++-------------
 1 file changed, 53 insertions(+), 45 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 8880a9f3b5..fb33023138 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -20,20 +20,29 @@
 
 #define MLX5_DEVX_ERR_RC(x) ((x) > 0 ? -(x) : ((x) < 0 ? (x) : -1))
 
-static void
-mlx5_devx_err_log(void *out, const char *reason,
-		  const char *param, uint32_t value)
-{
-	rte_errno = errno;
-	if (!param)
-		DRV_LOG(ERR, "DevX %s failed errno=%d status=%#x syndrome=%#x",
-			reason, errno, MLX5_FW_STATUS(out),
-			MLX5_FW_SYNDROME(out));
-	else
-		DRV_LOG(ERR, "DevX %s %s=%#X failed errno=%d status=%#x syndrome=%#x",
-			reason, param, value, errno, MLX5_FW_STATUS(out),
-			MLX5_FW_SYNDROME(out));
-}
+#define DEVX_DRV_LOG(level, out, reason, param, value)				\
+do {										\
+	/*									\
+	 * Some (old) GCC compilers like 7.5.0 and aarch64 GCC 7.1-2017.08	\
+	 * do not expand correctly when the macro invoked when the `param`	\
+	 * is `NULL`.								\
+	 * Use `local_param` to avoid direct `NULL` expansion.			\
+	 */									\
+	const char *local_param = (const char *)param; 				\
+										\
+	rte_errno = errno;							\
+	if (!local_param) {							\
+		DRV_LOG(level,							\
+			"DevX %s failed errno=%d status=%#x syndrome=%#x",	\
+			(reason), errno, MLX5_FW_STATUS((out)),			\
+			MLX5_FW_SYNDROME((out)));				\
+	} else {								\
+		DRV_LOG(level,							\
+			"DevX %s %s=%#X failed errno=%d status=%#x syndrome=%#x",\
+			(reason), local_param, (value), errno,         		\
+			MLX5_FW_STATUS((out)), MLX5_FW_SYNDROME((out)));	\
+	}									\
+} while (0)
 
 static void *
 mlx5_devx_get_hca_cap(void *ctx, uint32_t *in, uint32_t *out,
@@ -49,7 +58,7 @@ mlx5_devx_get_hca_cap(void *ctx, uint32_t *in, uint32_t *out,
 	MLX5_SET(query_hca_cap_in, in, op_mod, flags);
 	rc = mlx5_glue->devx_general_cmd(ctx, in, size_in, out, size_out);
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "HCA capabilities", "func", flags >> 1);
+		DEVX_DRV_LOG(ERR, out, "HCA capabilities", "func", flags >> 1);
 		if (err)
 			*err = MLX5_DEVX_ERR_RC(rc);
 		return NULL;
@@ -102,7 +111,7 @@ mlx5_devx_cmd_register_read(void *ctx, uint16_t reg_id, uint32_t arg,
 					 MLX5_ST_SZ_BYTES(access_register_out) +
 					 sizeof(uint32_t) * dw_cnt);
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "read access", "NIC register", reg_id);
+		DEVX_DRV_LOG(ERR, out, "read access", "NIC register", reg_id);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	memcpy(data, &out[MLX5_ST_SZ_DW(access_register_out)],
@@ -153,7 +162,7 @@ mlx5_devx_cmd_register_write(void *ctx, uint16_t reg_id, uint32_t arg,
 	memcpy(ptr, data, dw_cnt * sizeof(uint32_t));
 	rc = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out));
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "write access", "NIC register", reg_id);
+		DEVX_DRV_LOG(ERR, out, "write access", "NIC register", reg_id);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	rc = mlx5_glue->devx_general_cmd(ctx, in,
@@ -161,7 +170,7 @@ mlx5_devx_cmd_register_write(void *ctx, uint16_t reg_id, uint32_t arg,
 					 dw_cnt * sizeof(uint32_t),
 					 out, sizeof(out));
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "write access", "NIC register", reg_id);
+		DEVX_DRV_LOG(ERR, out, "write access", "NIC register", reg_id);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	return 0;
@@ -199,7 +208,7 @@ mlx5_devx_cmd_flow_counter_alloc(void *ctx, uint32_t bulk_n_128)
 	dcs->obj = mlx5_glue->devx_obj_create(ctx, in,
 					      sizeof(in), out, sizeof(out));
 	if (!dcs->obj) {
-		mlx5_devx_err_log(out, "allocate counters", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "allocate counters", NULL, 0);
 		mlx5_free(dcs);
 		return NULL;
 	}
@@ -377,9 +386,8 @@ mlx5_devx_cmd_mkey_create(void *ctx,
 	mkey->obj = mlx5_glue->devx_obj_create(ctx, in, in_size_dw * 4, out,
 					       sizeof(out));
 	if (!mkey->obj) {
-		mlx5_devx_err_log(out,
-				  klm_num ? "create indirect mkey" : "create direct key",
-				  NULL, 0);
+		DEVX_DRV_LOG(ERR, out, klm_num ? "create indirect mkey"
+					       : "create direct key", NULL, 0);
 		mlx5_free(mkey);
 		return NULL;
 	}
@@ -470,7 +478,7 @@ mlx5_devx_cmd_query_nic_vport_context(void *ctx,
 					 in, sizeof(in),
 					 out, sizeof(out));
 	if (rc || MLX5_FW_STATUS(out)) {
-		mlx5_devx_err_log(out, "query NIC vport context", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "query NIC vport context", NULL, 0);
 		return MLX5_DEVX_ERR_RC(rc);
 	}
 	vctx = MLX5_ADDR_OF(query_nic_vport_context_out, out,
@@ -717,7 +725,7 @@ mlx5_devx_cmd_create_flex_parser(void *ctx,
 	parse_flex_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							 out, sizeof(out));
 	if (!parse_flex_obj->obj) {
-		mlx5_devx_err_log(out, "create FLEX PARSE GRAPH", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create FLEX PARSE GRAPH", NULL, 0);
 		mlx5_free(parse_flex_obj);
 		return NULL;
 	}
@@ -1292,7 +1300,7 @@ mlx5_devx_cmd_create_rq(void *ctx,
 	rq->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						  out, sizeof(out));
 	if (!rq->obj) {
-		mlx5_devx_err_log(out, "create RQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create RQ", NULL, 0);
 		mlx5_free(rq);
 		return NULL;
 	}
@@ -1391,7 +1399,7 @@ mlx5_devx_cmd_create_rmp(void *ctx,
 	rmp->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 					      sizeof(out));
 	if (!rmp->obj) {
-		mlx5_devx_err_log(out, "create RMP", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create RMP", NULL, 0);
 		mlx5_free(rmp);
 		return NULL;
 	}
@@ -1459,7 +1467,7 @@ mlx5_devx_cmd_create_tir(void *ctx,
 	tir->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						   out, sizeof(out));
 	if (!tir->obj) {
-		mlx5_devx_err_log(out, "create TIR", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create TIR", NULL, 0);
 		mlx5_free(tir);
 		return NULL;
 	}
@@ -1597,7 +1605,7 @@ mlx5_devx_cmd_create_rqt(void *ctx,
 	rqt->obj = mlx5_glue->devx_obj_create(ctx, in, inlen, out, sizeof(out));
 	mlx5_free(in);
 	if (!rqt->obj) {
-		mlx5_devx_err_log(out, "create RQT", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create RQT", NULL, 0);
 		mlx5_free(rqt);
 		return NULL;
 	}
@@ -1711,7 +1719,7 @@ mlx5_devx_cmd_create_sq(void *ctx,
 	sq->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 					     out, sizeof(out));
 	if (!sq->obj) {
-		mlx5_devx_err_log(out, "create SQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create SQ", NULL, 0);
 		mlx5_free(sq);
 		return NULL;
 	}
@@ -1794,7 +1802,7 @@ mlx5_devx_cmd_create_tis(void *ctx,
 	tis->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 					      out, sizeof(out));
 	if (!tis->obj) {
-		mlx5_devx_err_log(out, "create TIS", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create TIS", NULL, 0);
 		mlx5_free(tis);
 		return NULL;
 	}
@@ -1828,7 +1836,7 @@ mlx5_devx_cmd_create_td(void *ctx)
 	td->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 					     out, sizeof(out));
 	if (!td->obj) {
-		mlx5_devx_err_log(out, "create TIS", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create TIS", NULL, 0);
 		mlx5_free(td);
 		return NULL;
 	}
@@ -1948,7 +1956,7 @@ mlx5_devx_cmd_create_cq(void *ctx, struct mlx5_devx_cq_attr *attr)
 	cq_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						 sizeof(out));
 	if (!cq_obj->obj) {
-		mlx5_devx_err_log(out, "create CQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CQ", NULL, 0);
 		mlx5_free(cq_obj);
 		return NULL;
 	}
@@ -2024,7 +2032,7 @@ mlx5_devx_cmd_create_virtq(void *ctx,
 	virtq_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						    sizeof(out));
 	if (!virtq_obj->obj) {
-		mlx5_devx_err_log(out, "create VIRTQ", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create VIRTQ", NULL, 0);
 		mlx5_free(virtq_obj);
 		return NULL;
 	}
@@ -2257,7 +2265,7 @@ mlx5_devx_cmd_create_qp(void *ctx,
 	qp_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						 sizeof(out));
 	if (!qp_obj->obj) {
-		mlx5_devx_err_log(out, "create QP", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create QP", NULL, 0);
 		mlx5_free(qp_obj);
 		return NULL;
 	}
@@ -2378,8 +2386,8 @@ mlx5_devx_cmd_create_virtio_q_counters(void *ctx)
 	couners_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 						      sizeof(out));
 	if (!couners_obj->obj) {
-		mlx5_devx_err_log(out, "create virtio queue counters Obj",
-				  NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create virtio queue counters Obj", NULL,
+			     0);
 		mlx5_free(couners_obj);
 		return NULL;
 	}
@@ -2461,7 +2469,7 @@ mlx5_devx_cmd_create_flow_hit_aso_obj(void *ctx, uint32_t pd)
 	flow_hit_aso_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							   out, sizeof(out));
 	if (!flow_hit_aso_obj->obj) {
-		mlx5_devx_err_log(out, "create FLOW_HIT_ASO", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create FLOW_HIT_ASO", NULL, 0);
 		mlx5_free(flow_hit_aso_obj);
 		return NULL;
 	}
@@ -2548,7 +2556,7 @@ mlx5_devx_cmd_create_flow_meter_aso_obj(void *ctx, uint32_t pd,
 							ctx, in, sizeof(in),
 							out, sizeof(out));
 	if (!flow_meter_aso_obj->obj) {
-		mlx5_devx_err_log(out, "create FLOW_METTER_ASO", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create FLOW_METTER_ASO", NULL, 0);
 		mlx5_free(flow_meter_aso_obj);
 		return NULL;
 	}
@@ -2598,7 +2606,7 @@ mlx5_devx_cmd_create_conn_track_offload_obj(void *ctx, uint32_t pd,
 	ct_aso_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						     out, sizeof(out));
 	if (!ct_aso_obj->obj) {
-		mlx5_devx_err_log(out, "create CONN_TRACK_OFFLOAD", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CONN_TRACK_OFFLOAD", NULL, 0);
 		mlx5_free(ct_aso_obj);
 		return NULL;
 	}
@@ -2650,7 +2658,7 @@ mlx5_devx_cmd_create_geneve_tlv_option(void *ctx,
 	geneve_tlv_opt_obj->obj = mlx5_glue->devx_obj_create(ctx, in,
 					sizeof(in), out, sizeof(out));
 	if (!geneve_tlv_opt_obj->obj) {
-		mlx5_devx_err_log(out, "create GENEVE TLV", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create GENEVE TLV", NULL, 0);
 		mlx5_free(geneve_tlv_opt_obj);
 		return NULL;
 	}
@@ -2712,7 +2720,7 @@ mlx5_devx_cmd_queue_counter_alloc(void *ctx)
 	dcs->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 					      sizeof(out));
 	if (!dcs->obj) {
-		mlx5_devx_err_log(out, "create q counter set", NULL, 0);
+		DEVX_DRV_LOG(DEBUG, out, "create q counter set", NULL, 0);
 		mlx5_free(dcs);
 		return NULL;
 	}
@@ -2799,7 +2807,7 @@ mlx5_devx_cmd_create_dek_obj(void *ctx, struct mlx5_devx_dek_attr *attr)
 	dek_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 						  out, sizeof(out));
 	if (dek_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create DEK", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create DEK", NULL, 0);
 		mlx5_free(dek_obj);
 		return NULL;
 	}
@@ -2846,7 +2854,7 @@ mlx5_devx_cmd_create_import_kek_obj(void *ctx,
 	import_kek_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							 out, sizeof(out));
 	if (import_kek_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create IMPORT_KEK", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create IMPORT_KEK", NULL, 0);
 		mlx5_free(import_kek_obj);
 		return NULL;
 	}
@@ -2894,7 +2902,7 @@ mlx5_devx_cmd_create_credential_obj(void *ctx,
 	credential_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							 out, sizeof(out));
 	if (credential_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create CREDENTIAL", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CREDENTIAL", NULL, 0);
 		mlx5_free(credential_obj);
 		return NULL;
 	}
@@ -2945,7 +2953,7 @@ mlx5_devx_cmd_create_crypto_login_obj(void *ctx,
 	crypto_login_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in),
 							   out, sizeof(out));
 	if (crypto_login_obj->obj == NULL) {
-		mlx5_devx_err_log(out, "create CRYPTO_LOGIN", NULL, 0);
+		DEVX_DRV_LOG(ERR, out, "create CRYPTO_LOGIN", NULL, 0);
 		mlx5_free(crypto_login_obj);
 		return NULL;
 	}
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v3] common/mlx5: update DevX error logging
  2022-07-10 16:02 ` [PATCH v3] " Gregory Etelson
@ 2022-08-14 13:51   ` Raslan Darawsheh
  0 siblings, 0 replies; 5+ messages in thread
From: Raslan Darawsheh @ 2022-08-14 13:51 UTC (permalink / raw)
  To: Gregory Etelson, dev
  Cc: Matan Azrad, NBU-Contact-Thomas Monjalon (EXTERNAL), Slava Ovsiienko

Hi,

> -----Original Message-----
> From: Gregory Etelson <getelson@nvidia.com>
> Sent: Sunday, July 10, 2022 7:03 PM
> To: dev@dpdk.org
> Cc: Gregory Etelson <getelson@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Raslan Darawsheh <rasland@nvidia.com>; NBU-
> Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>; Slava
> Ovsiienko <viacheslavo@nvidia.com>
> Subject: [PATCH v3] common/mlx5: update DevX error logging
> 
> Current PMD logs all DevX errors at error level.
> 
> DevX interface can fail queue counters allocation on some hardware types.
> That is a known issue.
> PMD fallback to VERB API to allocate queue counters when it detects the
> fault.
> That DevX failure should not be logged as PMD error.
> 
> The patch provides DevX with flexible API that selects log level.
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
> v2: fix warnings in old gcc versions
> v3: remove cc stable

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-14 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 14:48 [PATCH] common/mlx5: update DevX error logging Gregory Etelson
2022-07-06 14:02 ` [PATCH v2] " Gregory Etelson
2022-07-08 14:23   ` Thomas Monjalon
2022-07-10 16:02 ` [PATCH v3] " Gregory Etelson
2022-08-14 13:51   ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).