[dpdk-dev] [PATCH] net/mlx5: remove redundant new line char in logs

Dekel Peled dekelp at mellanox.com
Wed Oct 30 09:42:08 CET 2019


DRV_LOG macro is used to print log messages, one per line.
In several locations this macro is used with redundant '\n' character
at the end of the log message, causing blank lines between log lines.

This patch removes the '\n' character where it is redundant.

Signed-off-by: Dekel Peled <dekelp at mellanox.com>
---
 drivers/net/mlx5/mlx5.c           | 14 +++++++-------
 drivers/net/mlx5/mlx5_devx_cmds.c |  8 ++++----
 drivers/net/mlx5/mlx5_flow.c      |  8 ++++----
 drivers/net/mlx5/mlx5_rxtx.c      | 20 +++++++++-----------
 4 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 6e48d43..73b4ae3 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -819,7 +819,7 @@ struct mlx5_flow_id_pool *
 						 SOCKET_ID_ANY, 0);
 			if (mz == NULL) {
 				DRV_LOG(ERR,
-					"Cannot allocate mlx5 shared data\n");
+					"Cannot allocate mlx5 shared data");
 				ret = -rte_errno;
 				goto error;
 			}
@@ -831,7 +831,7 @@ struct mlx5_flow_id_pool *
 			mz = rte_memzone_lookup(MZ_MLX5_PMD_SHARED_DATA);
 			if (mz == NULL) {
 				DRV_LOG(ERR,
-					"Cannot attach mlx5 shared data\n");
+					"Cannot attach mlx5 shared data");
 				ret = -rte_errno;
 				goto error;
 			}
@@ -2019,7 +2019,7 @@ struct mlx5_flow_id_pool *
 			      MLX5DV_DEVX_PORT_MATCH_REG_C_0;
 	err = mlx5_glue->devx_port_query(sh->ctx, spawn->ibv_port, &devx_port);
 	if (err) {
-		DRV_LOG(WARNING, "can't query devx port %d on device %s\n",
+		DRV_LOG(WARNING, "can't query devx port %d on device %s",
 			spawn->ibv_port, spawn->ibv_dev->name);
 		devx_port.comp_mask = 0;
 	}
@@ -2028,14 +2028,14 @@ struct mlx5_flow_id_pool *
 		priv->vport_meta_mask = devx_port.reg_c_0.mask;
 		if (!priv->vport_meta_mask) {
 			DRV_LOG(ERR, "vport zero mask for port %d"
-				     " on bonding device %s\n",
+				     " on bonding device %s",
 				     spawn->ibv_port, spawn->ibv_dev->name);
 			err = ENOTSUP;
 			goto error;
 		}
 		if (priv->vport_meta_tag & ~priv->vport_meta_mask) {
 			DRV_LOG(ERR, "invalid vport tag for port %d"
-				     " on bonding device %s\n",
+				     " on bonding device %s",
 				     spawn->ibv_port, spawn->ibv_dev->name);
 			err = ENOTSUP;
 			goto error;
@@ -2044,7 +2044,7 @@ struct mlx5_flow_id_pool *
 		priv->vport_id = devx_port.vport_num;
 	} else if (spawn->pf_bond >= 0) {
 		DRV_LOG(ERR, "can't deduce vport index for port %d"
-			     " on bonding device %s\n",
+			     " on bonding device %s",
 			     spawn->ibv_port, spawn->ibv_dev->name);
 		err = ENOTSUP;
 		goto error;
@@ -2191,7 +2191,7 @@ struct mlx5_flow_id_pool *
 		priv->counter_fallback = 1;
 #endif
 		if (priv->counter_fallback)
-			DRV_LOG(INFO, "Use fall-back DV counter management\n");
+			DRV_LOG(INFO, "Use fall-back DV counter management");
 		/* Check for LRO support. */
 		if (config.dest_tir && config.hca_attr.lro_cap &&
 		    config.dv_flow_en) {
diff --git a/drivers/net/mlx5/mlx5_devx_cmds.c b/drivers/net/mlx5/mlx5_devx_cmds.c
index 3471a9b..d6e89b6 100644
--- a/drivers/net/mlx5/mlx5_devx_cmds.c
+++ b/drivers/net/mlx5/mlx5_devx_cmds.c
@@ -40,7 +40,7 @@ struct mlx5_devx_obj *
 	dcs->obj = mlx5_glue->devx_obj_create(ctx, in,
 					      sizeof(in), out, sizeof(out));
 	if (!dcs->obj) {
-		DRV_LOG(ERR, "Can't allocate counters - error %d\n", errno);
+		DRV_LOG(ERR, "Can't allocate counters - error %d", errno);
 		rte_errno = errno;
 		rte_free(dcs);
 		return NULL;
@@ -111,7 +111,7 @@ struct mlx5_devx_obj *
 						     out_len, async_id,
 						     cmd_comp);
 	if (rc) {
-		DRV_LOG(ERR, "Failed to query devx counters with rc %d\n ", rc);
+		DRV_LOG(ERR, "Failed to query devx counters with rc %d", rc);
 		rte_errno = rc;
 		return -rc;
 	}
@@ -171,7 +171,7 @@ struct mlx5_devx_obj *
 	mkey->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out,
 					       sizeof(out));
 	if (!mkey->obj) {
-		DRV_LOG(ERR, "Can't create mkey - error %d\n", errno);
+		DRV_LOG(ERR, "Can't create mkey - error %d", errno);
 		rte_errno = errno;
 		rte_free(mkey);
 		return NULL;
@@ -202,7 +202,7 @@ struct mlx5_devx_obj *
 	if (status) {
 		int syndrome = MLX5_GET(query_flow_counter_out, out, syndrome);
 
-		DRV_LOG(ERR, "Bad devX status %x, syndrome = %x\n", status,
+		DRV_LOG(ERR, "Bad devX status %x, syndrome = %x", status,
 			syndrome);
 	}
 	return status;
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 5f01f9c..b4b08f4 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3136,7 +3136,7 @@ struct rte_flow *
 	if (!flow) {
 		DRV_LOG(DEBUG,
 			"Failed to create ctrl flow: rte_errno(%d),"
-			" type(%d), message(%s)\n",
+			" type(%d), message(%s)",
 			rte_errno, error.type,
 			error.message ? error.message : " (no stated reason)");
 		return -rte_errno;
@@ -3856,10 +3856,10 @@ struct rte_flow *
 	cont = MLX5_CNT_CONTAINER(sh, 1, 0);
 	pools_n += rte_atomic16_read(&cont->n_valid);
 	us = MLX5_POOL_QUERY_FREQ_US / pools_n;
-	DRV_LOG(DEBUG, "Set alarm for %u pools each %u us\n", pools_n, us);
+	DRV_LOG(DEBUG, "Set alarm for %u pools each %u us", pools_n, us);
 	if (rte_eal_alarm_set(us, mlx5_flow_query_alarm, sh)) {
 		sh->cmng.query_thread_on = 0;
-		DRV_LOG(ERR, "Cannot reinitialize query alarm\n");
+		DRV_LOG(ERR, "Cannot reinitialize query alarm");
 	} else {
 		sh->cmng.query_thread_on = 1;
 	}
@@ -3931,7 +3931,7 @@ struct rte_flow *
 					       (uint64_t)(uintptr_t)pool);
 	if (ret) {
 		DRV_LOG(ERR, "Failed to trigger asynchronous query for dcs ID"
-			" %d\n", pool->min_dcs->id);
+			" %d", pool->min_dcs->id);
 		pool->raw_hw = NULL;
 		goto set_alarm;
 	}
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index f597c89..7f99f22 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -583,18 +583,16 @@ enum mlx5_txcmp_code {
 	MKSTR(path, "%s/%s", MLX5_SYSTEM_LOG_DIR, fname);
 	fd = fopen(path, "a+");
 	if (!fd) {
-		DRV_LOG(WARNING, "cannot open %s for debug dump\n",
-			path);
+		DRV_LOG(WARNING, "cannot open %s for debug dump", path);
 		MKSTR(path2, "./%s", fname);
 		fd = fopen(path2, "a+");
 		if (!fd) {
-			DRV_LOG(ERR, "cannot open %s for debug dump\n",
-				path2);
+			DRV_LOG(ERR, "cannot open %s for debug dump", path2);
 			return;
 		}
-		DRV_LOG(INFO, "New debug dump in file %s\n", path2);
+		DRV_LOG(INFO, "New debug dump in file %s", path2);
 	} else {
-		DRV_LOG(INFO, "New debug dump in file %s\n", path);
+		DRV_LOG(INFO, "New debug dump in file %s", path);
 	}
 	if (hex_title)
 		rte_hexdump(fd, hex_title, buf, hex_len);
@@ -850,7 +848,7 @@ enum mlx5_txcmp_code {
 						      &rq_attr);
 		}
 		if (ret) {
-			DRV_LOG(ERR, "Cannot change Rx WQ state to %u  - %s\n",
+			DRV_LOG(ERR, "Cannot change Rx WQ state to %u  - %s",
 					sm->state, strerror(errno));
 			rte_errno = errno;
 			return ret;
@@ -868,7 +866,7 @@ enum mlx5_txcmp_code {
 		ret = mlx5_glue->modify_qp(qp, &mod, IBV_QP_STATE);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change the Tx QP state to RESET "
-				"%s\n", strerror(errno));
+				"%s", strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
@@ -876,7 +874,7 @@ enum mlx5_txcmp_code {
 		ret = mlx5_glue->modify_qp(qp, &mod,
 					   (IBV_QP_STATE | IBV_QP_PORT));
 		if (ret) {
-			DRV_LOG(ERR, "Cannot change Tx QP state to INIT %s\n",
+			DRV_LOG(ERR, "Cannot change Tx QP state to INIT %s",
 				strerror(errno));
 			rte_errno = errno;
 			return ret;
@@ -884,7 +882,7 @@ enum mlx5_txcmp_code {
 		mod.qp_state = IBV_QPS_RTR;
 		ret = mlx5_glue->modify_qp(qp, &mod, IBV_QP_STATE);
 		if (ret) {
-			DRV_LOG(ERR, "Cannot change Tx QP state to RTR %s\n",
+			DRV_LOG(ERR, "Cannot change Tx QP state to RTR %s",
 				strerror(errno));
 			rte_errno = errno;
 			return ret;
@@ -892,7 +890,7 @@ enum mlx5_txcmp_code {
 		mod.qp_state = IBV_QPS_RTS;
 		ret = mlx5_glue->modify_qp(qp, &mod, IBV_QP_STATE);
 		if (ret) {
-			DRV_LOG(ERR, "Cannot change Tx QP state to RTS %s\n",
+			DRV_LOG(ERR, "Cannot change Tx QP state to RTS %s",
 				strerror(errno));
 			rte_errno = errno;
 			return ret;
-- 
1.8.3.1



More information about the dev mailing list