Skip to contentSkip to conversation

Detect superfluous newline in logs

RFC Superseded David Marchand 12 participants 122 messages Nov 17, 2023 – Dec 21, 2023 Page 2 of 2

Subsystems (2)
lore
Share & tools
lore
#80 lore raw

PATCH v3 13/14 lib: replace logging helpers

In reply to David Marchand

This is a preparation step before the next change.

Many libraries have their own logging helpers that do not add a newline in their format string.
Some previous changes fixed places where some of those helpers are called without a trailing newline.
Using RTE_LOG_LINE in the existing helpers will ensure we don't introduce new issues in the future.

The problem is that if we simply convert to the RTE_LOG_LINE helper, a future fix may introduce a regression since the logging helper change won't be backported.

To address this concern, rename existing helpers: backporting a call to them will trigger some conflict or build issue in LTS branches.

Note:
- bpf and vhost that still has some debug multilines messages, a direct call to RTE_LOG/RTE_LOG_DP is used: this will make it easier to notice such special cases,
- about previously publicly exposed logging helpers, when such helper is not publicly used (iow in public inline API), it is removed from the public API (this is the case for the member library),

---
Changes since RFC v2:
- kept a RTE_ prefix for bpf log macro to avoid potential collision with external code,

---
 lib/bpf/bpf.c                        |   2 +-
 lib/bpf/bpf_convert.c                |  16 +-
 lib/bpf/bpf_exec.c                   |  12 +-
 lib/bpf/bpf_impl.h                   |   5 +-
 lib/bpf/bpf_jit_arm64.c              |   8 +-
 lib/bpf/bpf_jit_x86.c                |   4 +-
 lib/bpf/bpf_load.c                   |   2 +-
 lib/bpf/bpf_load_elf.c               |  24 +-
 lib/bpf/bpf_pkt.c                    |   4 +-
 lib/bpf/bpf_stub.c                   |   4 +-
 lib/bpf/bpf_validate.c               |  38 +-
 lib/ethdev/ethdev_driver.c           |  44 +-
 lib/ethdev/ethdev_pci.h              |   2 +-
 lib/ethdev/ethdev_private.c          |  10 +-
 lib/ethdev/rte_class_eth.c           |   2 +-
 lib/ethdev/rte_ethdev.c              | 878 +++++++++++++--------------
 lib/ethdev/rte_ethdev.h              |  52 +-
 lib/ethdev/rte_ethdev_cman.c         |  16 +-
 lib/ethdev/rte_ethdev_telemetry.c    |  44 +-
 lib/ethdev/rte_flow.c                |  64 +-
 lib/ethdev/rte_flow.h                |   3 -
 lib/ethdev/sff_telemetry.c           |  30 +-
 lib/member/member.h                  |  14 +
 lib/member/rte_member.c              |  15 +-
 lib/member/rte_member.h              |   9 -
 lib/member/rte_member_heap.h         |  39 +-
 lib/member/rte_member_ht.c           |  13 +-
 lib/member/rte_member_sketch.c       |  41 +-
 lib/member/rte_member_vbf.c          |   9 +-
 lib/pdump/rte_pdump.c                | 112 ++--
 lib/power/power_acpi_cpufreq.c       |  10 +-
 lib/power/power_amd_pstate_cpufreq.c |  12 +-
 lib/power/power_common.c             |   4 +-
 lib/power/power_common.h             |   6 +-
 lib/power/power_cppc_cpufreq.c       |  12 +-
 lib/power/power_intel_uncore.c       |   4 +-
 lib/power/power_pstate_cpufreq.c     |  12 +-
 lib/regexdev/rte_regexdev.c          |  86 +--
 lib/regexdev/rte_regexdev.h          |  14 +-
 lib/telemetry/telemetry.c            |  41 +-
 lib/vhost/iotlb.c                    |  18 +-
 lib/vhost/socket.c                   | 102 ++--
 lib/vhost/vdpa.c                     |   8 +-
 lib/vhost/vduse.c                    | 120 ++--
 lib/vhost/vduse.h                    |   4 +-
 lib/vhost/vhost.c                    | 118 ++--
 lib/vhost/vhost.h                    |  24 +-
 lib/vhost/vhost_user.c               | 508 ++++++++--------
 lib/vhost/virtio_net.c               | 188 +++---
 lib/vhost/virtio_net_ctrl.c          |  38 +-
 50 files changed, 1431 insertions(+), 1414 deletions(-)
 create mode 100644 lib/member/member.h
lib/bpf/bpf.c +1 -1
index 8a0254d8bb..bbe75c8bfe 100644
@@ -44,7 +44,7 @@ __rte_bpf_jit(struct rte_bpf *bpf)
 #endif
 
 	if (rc != 0)
-		RTE_BPF_LOG(WARNING, "%s(%p) failed, error code: %d;\n",
+		RTE_BPF_LOG_LINE(WARNING, "%s(%p) failed, error code: %d;",
 			__func__, bpf, rc);
 	return rc;
 }
lib/bpf/bpf_convert.c +8 -8
index d441be6663..d7ff2b4325 100644
@@ -226,8 +226,8 @@ static bool convert_bpf_load(const struct bpf_insn *fp,
 	case SKF_AD_OFF + SKF_AD_RANDOM:
 	case SKF_AD_OFF + SKF_AD_ALU_XOR_X:
 		/* Linux has special negative offsets to access meta-data. */
-		RTE_BPF_LOG(ERR,
-			    "rte_bpf_convert: socket offset %d not supported\n",
+		RTE_BPF_LOG_LINE(ERR,
+			    "rte_bpf_convert: socket offset %d not supported",
 			    fp->k - SKF_AD_OFF);
 		return true;
 	default:
@@ -246,7 +246,7 @@ static int bpf_convert_filter(const struct bpf_insn *prog, size_t len,
 	uint8_t bpf_src;
 
 	if (len > BPF_MAXINSNS) {
-		RTE_BPF_LOG(ERR, "%s: cBPF program too long (%zu insns)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s: cBPF program too long (%zu insns)",
 			    __func__, len);
 		return -EINVAL;
 	}
@@ -482,7 +482,7 @@ static int bpf_convert_filter(const struct bpf_insn *prog, size_t len,
 
 			/* Unknown instruction. */
 		default:
-			RTE_BPF_LOG(ERR, "%s: Unknown instruction!: %#x\n",
+			RTE_BPF_LOG_LINE(ERR, "%s: Unknown instruction!: %#x",
 				    __func__, fp->code);
 			goto err;
 		}
@@ -526,7 +526,7 @@ rte_bpf_convert(const struct bpf_program *prog)
 	int ret;
 
 	if (prog == NULL) {
-		RTE_BPF_LOG(ERR, "%s: NULL program\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: NULL program", __func__);
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -534,12 +534,12 @@ rte_bpf_convert(const struct bpf_program *prog)
 	/* 1st pass: calculate the eBPF program length */
 	ret = bpf_convert_filter(prog->bf_insns, prog->bf_len, NULL, &ebpf_len);
 	if (ret < 0) {
-		RTE_BPF_LOG(ERR, "%s: cannot get eBPF length\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: cannot get eBPF length", __func__);
 		rte_errno = -ret;
 		return NULL;
 	}
 
-	RTE_BPF_LOG(DEBUG, "%s: prog len cBPF=%u -> eBPF=%u\n",
+	RTE_BPF_LOG_LINE(DEBUG, "%s: prog len cBPF=%u -> eBPF=%u",
 		    __func__, prog->bf_len, ebpf_len);
 
 	prm = rte_zmalloc("bpf_filter",
@@ -555,7 +555,7 @@ rte_bpf_convert(const struct bpf_program *prog)
 	/* 2nd pass: remap cBPF to eBPF instructions  */
 	ret = bpf_convert_filter(prog->bf_insns, prog->bf_len, ebpf, &ebpf_len);
 	if (ret < 0) {
-		RTE_BPF_LOG(ERR, "%s: cannot convert cBPF to eBPF\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: cannot convert cBPF to eBPF", __func__);
 		free(prm);
 		rte_errno = -ret;
 		return NULL;
lib/bpf/bpf_exec.c +6 -6
index 09f4a9a571..5d597ec170 100644
@@ -43,8 +43,8 @@
 
 #define BPF_DIV_ZERO_CHECK(bpf, reg, ins, type) do { \
 	if ((type)(reg)[(ins)->src_reg] == 0) { \
-		RTE_BPF_LOG(ERR, \
-			"%s(%p): division by 0 at pc: %#zx;\n", \
+		RTE_BPF_LOG_LINE(ERR, \
+			"%s(%p): division by 0 at pc: %#zx;", \
 			__func__, bpf, \
 			(uintptr_t)(ins) - (uintptr_t)(bpf)->prm.ins); \
 		return 0; \
@@ -136,8 +136,8 @@ bpf_ld_mbuf(const struct rte_bpf *bpf, uint64_t reg[EBPF_REG_NUM],
 	mb = (const struct rte_mbuf *)(uintptr_t)reg[EBPF_REG_6];
 	p = rte_pktmbuf_read(mb, off, len, reg + EBPF_REG_0);
 	if (p == NULL)
-		RTE_BPF_LOG(DEBUG, "%s(bpf=%p, mbuf=%p, ofs=%u, len=%u): "
-			"load beyond packet boundary at pc: %#zx;\n",
+		RTE_BPF_LOG_LINE(DEBUG, "%s(bpf=%p, mbuf=%p, ofs=%u, len=%u): "
+			"load beyond packet boundary at pc: %#zx;",
 			__func__, bpf, mb, off, len,
 			(uintptr_t)(ins) - (uintptr_t)(bpf)->prm.ins);
 	return p;
@@ -462,8 +462,8 @@ bpf_exec(const struct rte_bpf *bpf, uint64_t reg[EBPF_REG_NUM])
 		case (BPF_JMP | EBPF_EXIT):
 			return reg[EBPF_REG_0];
 		default:
-			RTE_BPF_LOG(ERR,
-				"%s(%p): invalid opcode %#x at pc: %#zx;\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"%s(%p): invalid opcode %#x at pc: %#zx;",
 				__func__, bpf, ins->code,
 				(uintptr_t)ins - (uintptr_t)bpf->prm.ins);
 			return 0;
lib/bpf/bpf_impl.h +3 -2
index b483569071..6a82ae4ef2 100644
@@ -27,9 +27,10 @@ int __rte_bpf_jit_x86(struct rte_bpf *bpf);
 int __rte_bpf_jit_arm64(struct rte_bpf *bpf);
 
 extern int rte_bpf_logtype;
+#define RTE_LOGTYPE_BPF rte_bpf_logtype
 
-#define	RTE_BPF_LOG(lvl, fmt, args...) \
-	rte_log(RTE_LOG_## lvl, rte_bpf_logtype, fmt, ##args)
+#define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
+	RTE_LOG(lvl, BPF, fmt "\n", ##args)
 
 static inline size_t
 bpf_size(uint32_t bpf_op_sz)
lib/bpf/bpf_jit_arm64.c +4 -4
index f9ddafd7dc..96b8cd2e03 100644
@@ -98,8 +98,8 @@ check_invalid_args(struct a64_jit_ctx *ctx, uint32_t limit)
 
 	for (idx = 0; idx < limit; idx++) {
 		if (rte_le_to_cpu_32(ctx->ins[idx]) == A64_INVALID_OP_CODE) {
-			RTE_BPF_LOG(ERR,
-				"%s: invalid opcode at %u;\n", __func__, idx);
+			RTE_BPF_LOG_LINE(ERR,
+				"%s: invalid opcode at %u;", __func__, idx);
 			return -EINVAL;
 		}
 	}
@@ -1378,8 +1378,8 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf)
 			emit_epilogue(ctx);
 			break;
 		default:
-			RTE_BPF_LOG(ERR,
-				"%s(%p): invalid opcode %#x at pc: %u;\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"%s(%p): invalid opcode %#x at pc: %u;",
 				__func__, bpf, ins->code, i);
 			return -EINVAL;
 		}
lib/bpf/bpf_jit_x86.c +2 -2
index a73b2006db..4d74e418f8 100644
@@ -1476,8 +1476,8 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf)
 			emit_epilog(st);
 			break;
 		default:
-			RTE_BPF_LOG(ERR,
-				"%s(%p): invalid opcode %#x at pc: %u;\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"%s(%p): invalid opcode %#x at pc: %u;",
 				__func__, bpf, ins->code, i);
 			return -EINVAL;
 		}
lib/bpf/bpf_load.c +1 -1
index 45ce9210da..de43347405 100644
@@ -98,7 +98,7 @@ rte_bpf_load(const struct rte_bpf_prm *prm)
 
 	if (rc != 0) {
 		rte_errno = -rc;
-		RTE_BPF_LOG(ERR, "%s: %d-th xsym is invalid\n", __func__, i);
+		RTE_BPF_LOG_LINE(ERR, "%s: %d-th xsym is invalid", __func__, i);
 		return NULL;
 	}
 
lib/bpf/bpf_load_elf.c +12 -12
index 02a5d8ba0d..e0abd3c856 100644
@@ -84,8 +84,8 @@ resolve_xsym(const char *sn, size_t ofs, struct ebpf_insn *ins, size_t ins_sz,
 		 * as an ordinary EBPF_CALL.
 		 */
 		if (ins[idx].src_reg == EBPF_PSEUDO_CALL) {
-			RTE_BPF_LOG(INFO, "%s(%u): "
-				"EBPF_PSEUDO_CALL to external function: %s\n",
+			RTE_BPF_LOG_LINE(INFO, "%s(%u): "
+				"EBPF_PSEUDO_CALL to external function: %s",
 				__func__, idx, sn);
 			ins[idx].src_reg = EBPF_REG_0;
 		}
@@ -121,7 +121,7 @@ check_elf_header(const Elf64_Ehdr *eh)
 		err = "unexpected machine type";
 
 	if (err != NULL) {
-		RTE_BPF_LOG(ERR, "%s(): %s\n", __func__, err);
+		RTE_BPF_LOG_LINE(ERR, "%s(): %s", __func__, err);
 		return -EINVAL;
 	}
 
@@ -144,7 +144,7 @@ find_elf_code(Elf *elf, const char *section, Elf_Data **psd, size_t *pidx)
 	eh = elf64_getehdr(elf);
 	if (eh == NULL) {
 		rc = elf_errno();
-		RTE_BPF_LOG(ERR, "%s(%p, %s) error code: %d(%s)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p, %s) error code: %d(%s)",
 			__func__, elf, section, rc, elf_errmsg(rc));
 		return -EINVAL;
 	}
@@ -167,7 +167,7 @@ find_elf_code(Elf *elf, const char *section, Elf_Data **psd, size_t *pidx)
 	if (sd == NULL || sd->d_size == 0 ||
 			sd->d_size % sizeof(struct ebpf_insn) != 0) {
 		rc = elf_errno();
-		RTE_BPF_LOG(ERR, "%s(%p, %s) error code: %d(%s)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p, %s) error code: %d(%s)",
 			__func__, elf, section, rc, elf_errmsg(rc));
 		return -EINVAL;
 	}
@@ -216,8 +216,8 @@ process_reloc(Elf *elf, size_t sym_idx, Elf64_Rel *re, size_t re_sz,
 
 		rc = resolve_xsym(sn, ofs, ins, ins_sz, prm);
 		if (rc != 0) {
-			RTE_BPF_LOG(ERR,
-				"resolve_xsym(%s, %zu) error code: %d\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"resolve_xsym(%s, %zu) error code: %d",
 				sn, ofs, rc);
 			return rc;
 		}
@@ -309,7 +309,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 	fd = open(fname, O_RDONLY);
 	if (fd < 0) {
 		rc = errno;
-		RTE_BPF_LOG(ERR, "%s(%s) error code: %d(%s)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%s) error code: %d(%s)",
 			__func__, fname, rc, strerror(rc));
 		rte_errno = EINVAL;
 		return NULL;
@@ -319,15 +319,15 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 	close(fd);
 
 	if (bpf == NULL) {
-		RTE_BPF_LOG(ERR,
+		RTE_BPF_LOG_LINE(ERR,
 			"%s(fname=\"%s\", sname=\"%s\") failed, "
-			"error code: %d\n",
+			"error code: %d",
 			__func__, fname, sname, rte_errno);
 		return NULL;
 	}
 
-	RTE_BPF_LOG(INFO, "%s(fname=\"%s\", sname=\"%s\") "
-		"successfully creates %p(jit={.func=%p,.sz=%zu});\n",
+	RTE_BPF_LOG_LINE(INFO, "%s(fname=\"%s\", sname=\"%s\") "
+		"successfully creates %p(jit={.func=%p,.sz=%zu});",
 		__func__, fname, sname, bpf, bpf->jit.func, bpf->jit.sz);
 	return bpf;
 }
lib/bpf/bpf_pkt.c +2 -2
index 7a8e4a6ef4..793a75ded9 100644
@@ -512,7 +512,7 @@ bpf_eth_elf_load(struct bpf_eth_cbh *cbh, uint16_t port, uint16_t queue,
 		ftx = select_tx_callback(prm->prog_arg.type, flags);
 
 	if (frx == NULL && ftx == NULL) {
-		RTE_BPF_LOG(ERR, "%s(%u, %u): no callback selected;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%u, %u): no callback selected;",
 			__func__, port, queue);
 		return -EINVAL;
 	}
@@ -524,7 +524,7 @@ bpf_eth_elf_load(struct bpf_eth_cbh *cbh, uint16_t port, uint16_t queue,
 	rte_bpf_get_jit(bpf, &jit);
 
 	if ((flags & RTE_BPF_ETH_F_JIT) != 0 && jit.func == NULL) {
-		RTE_BPF_LOG(ERR, "%s(%u, %u): no JIT generated;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%u, %u): no JIT generated;",
 			__func__, port, queue);
 		rte_bpf_destroy(bpf);
 		return -ENOTSUP;
lib/bpf/bpf_stub.c +2 -2
index 83c2203622..1babb16bde 100644
@@ -19,7 +19,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 		return NULL;
 	}
 
-	RTE_BPF_LOG(ERR, "%s() is not supported, rebuild with libelf installed\n",
+	RTE_BPF_LOG_LINE(ERR, "%s() is not supported, rebuild with libelf installed",
 		__func__);
 	rte_errno = ENOTSUP;
 	return NULL;
@@ -35,7 +35,7 @@ rte_bpf_convert(const struct bpf_program *prog)
 		return NULL;
 	}
 
-	RTE_BPF_LOG(ERR, "%s() is not supported, rebuild with libpcap installed\n",
+	RTE_BPF_LOG_LINE(ERR, "%s() is not supported, rebuild with libpcap installed",
 		__func__);
 	rte_errno = ENOTSUP;
 	return NULL;
lib/bpf/bpf_validate.c +19 -19
index f246b3c5eb..79be5e917d 100644
@@ -1812,15 +1812,15 @@ add_edge(struct bpf_verifier *bvf, struct inst_node *node, uint32_t nidx)
 	uint32_t ne;
 
 	if (nidx > bvf->prm->nb_ins) {
-		RTE_BPF_LOG(ERR, "%s: program boundary violation at pc: %u, "
-			"next pc: %u\n",
+		RTE_BPF_LOG_LINE(ERR, "%s: program boundary violation at pc: %u, "
+			"next pc: %u",
 			__func__, get_node_idx(bvf, node), nidx);
 		return -EINVAL;
 	}
 
 	ne = node->nb_edge;
 	if (ne >= RTE_DIM(node->edge_dest)) {
-		RTE_BPF_LOG(ERR, "%s: internal error at pc: %u\n",
+		RTE_BPF_LOG_LINE(ERR, "%s: internal error at pc: %u",
 			__func__, get_node_idx(bvf, node));
 		return -EINVAL;
 	}
@@ -1927,7 +1927,7 @@ log_unreachable(const struct bpf_verifier *bvf)
 
 		if (node->colour == WHITE &&
 				ins->code != (BPF_LD | BPF_IMM | EBPF_DW))
-			RTE_BPF_LOG(ERR, "unreachable code at pc: %u;\n", i);
+			RTE_BPF_LOG_LINE(ERR, "unreachable code at pc: %u;", i);
 	}
 }
 
@@ -1948,8 +1948,8 @@ log_loop(const struct bpf_verifier *bvf)
 
 		for (j = 0; j != node->nb_edge; j++) {
 			if (node->edge_type[j] == BACK_EDGE)
-				RTE_BPF_LOG(ERR,
-					"loop at pc:%u --> pc:%u;\n",
+				RTE_BPF_LOG_LINE(ERR,
+					"loop at pc:%u --> pc:%u;",
 					i, node->edge_dest[j]);
 		}
 	}
@@ -1979,7 +1979,7 @@ validate(struct bpf_verifier *bvf)
 
 		err = check_syntax(ins);
 		if (err != 0) {
-			RTE_BPF_LOG(ERR, "%s: %s at pc: %u\n",
+			RTE_BPF_LOG_LINE(ERR, "%s: %s at pc: %u",
 				__func__, err, i);
 			rc |= -EINVAL;
 		}
@@ -2048,7 +2048,7 @@ validate(struct bpf_verifier *bvf)
 
 	dfs(bvf);
 
-	RTE_BPF_LOG(DEBUG, "%s(%p) stats:\n"
+	RTE_LOG(DEBUG, BPF, "%s(%p) stats:\n"
 		"nb_nodes=%u;\n"
 		"nb_jcc_nodes=%u;\n"
 		"node_color={[WHITE]=%u, [GREY]=%u,, [BLACK]=%u};\n"
@@ -2062,7 +2062,7 @@ validate(struct bpf_verifier *bvf)
 		bvf->edge_type[BACK_EDGE], bvf->edge_type[CROSS_EDGE]);
 
 	if (bvf->node_colour[BLACK] != bvf->nb_nodes) {
-		RTE_BPF_LOG(ERR, "%s(%p) unreachable instructions;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p) unreachable instructions;",
 			__func__, bvf);
 		log_unreachable(bvf);
 		return -EINVAL;
@@ -2070,13 +2070,13 @@ validate(struct bpf_verifier *bvf)
 
 	if (bvf->node_colour[GREY] != 0 || bvf->node_colour[WHITE] != 0 ||
 			bvf->edge_type[UNKNOWN_EDGE] != 0) {
-		RTE_BPF_LOG(ERR, "%s(%p) DFS internal error;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p) DFS internal error;",
 			__func__, bvf);
 		return -EINVAL;
 	}
 
 	if (bvf->edge_type[BACK_EDGE] != 0) {
-		RTE_BPF_LOG(ERR, "%s(%p) loops detected;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p) loops detected;",
 			__func__, bvf);
 		log_loop(bvf);
 		return -EINVAL;
@@ -2144,8 +2144,8 @@ save_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 	/* get new eval_state for this node */
 	st = pull_eval_state(bvf);
 	if (st == NULL) {
-		RTE_BPF_LOG(ERR,
-			"%s: internal error (out of space) at pc: %u\n",
+		RTE_BPF_LOG_LINE(ERR,
+			"%s: internal error (out of space) at pc: %u",
 			__func__, get_node_idx(bvf, node));
 		return -ENOMEM;
 	}
@@ -2157,7 +2157,7 @@ save_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 	node->evst = bvf->evst;
 	bvf->evst = st;
 
-	RTE_BPF_LOG(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;\n",
+	RTE_BPF_LOG_LINE(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;",
 		__func__, bvf, get_node_idx(bvf, node), node->evst, bvf->evst);
 
 	return 0;
@@ -2169,7 +2169,7 @@ save_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 static void
 restore_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 {
-	RTE_BPF_LOG(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;\n",
+	RTE_BPF_LOG_LINE(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;",
 		__func__, bvf, get_node_idx(bvf, node), bvf->evst, node->evst);
 
 	bvf->evst = node->evst;
@@ -2184,12 +2184,12 @@ log_dbg_eval_state(const struct bpf_verifier *bvf, const struct ebpf_insn *ins,
 	const struct bpf_eval_state *st;
 	const struct bpf_reg_val *rv;
 
-	RTE_BPF_LOG(DEBUG, "%s(pc=%u):\n", __func__, pc);
+	RTE_BPF_LOG_LINE(DEBUG, "%s(pc=%u):", __func__, pc);
 
 	st = bvf->evst;
 	rv = st->rv + ins->dst_reg;
 
-	RTE_BPF_LOG(DEBUG,
+	RTE_LOG(DEBUG, BPF,
 		"r%u={\n"
 		"\tv={type=%u, size=%zu},\n"
 		"\tmask=0x%" PRIx64 ",\n"
@@ -2263,7 +2263,7 @@ evaluate(struct bpf_verifier *bvf)
 			if (ins_chk[op].eval != NULL && rc == 0) {
 				err = ins_chk[op].eval(bvf, ins + idx);
 				if (err != NULL) {
-					RTE_BPF_LOG(ERR, "%s: %s at pc: %u\n",
+					RTE_BPF_LOG_LINE(ERR, "%s: %s at pc: %u",
 						__func__, err, idx);
 					rc = -EINVAL;
 				}
@@ -2312,7 +2312,7 @@ __rte_bpf_validate(struct rte_bpf *bpf)
 			bpf->prm.prog_arg.type != RTE_BPF_ARG_PTR &&
 			(sizeof(uint64_t) != sizeof(uintptr_t) ||
 			bpf->prm.prog_arg.type != RTE_BPF_ARG_PTR_MBUF)) {
-		RTE_BPF_LOG(ERR, "%s: unsupported argument type\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: unsupported argument type", __func__);
 		return -ENOTSUP;
 	}
 
lib/ethdev/ethdev_driver.c +22 -22

132 lines not on this page · raw message

lib/ethdev/ethdev_pci.h +1 -1
index ddb559aa95..737fff1833 100644
@@ -31,7 +31,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
 	struct rte_pci_device *pci_dev)
 {
 	if ((eth_dev == NULL) || (pci_dev == NULL)) {
-		RTE_ETHDEV_LOG(ERR, "NULL pointer eth_dev=%p pci_dev=%p\n",
+		RTE_ETHDEV_LOG_LINE(ERR, "NULL pointer eth_dev=%p pci_dev=%p",
 			(void *)eth_dev, (void *)pci_dev);
 		return;
 	}
lib/ethdev/ethdev_private.c +5 -5
index 0e1c7b23c1..a656df293c 100644
@@ -182,7 +182,7 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)
 		RTE_DIM(eth_da->representor_ports));
 done:
 	if (str == NULL)
-		RTE_ETHDEV_LOG(ERR, "wrong representor format: %s\n", str);
+		RTE_ETHDEV_LOG_LINE(ERR, "wrong representor format: %s", str);
 	return str == NULL ? -1 : 0;
 }
 
@@ -214,7 +214,7 @@ dummy_eth_rx_burst(void *rxq,
 
 	port_id = queue - per_port_queues;
 	if (port_id < RTE_DIM(per_port_queues) && !queue->rx_warn_once) {
-		RTE_ETHDEV_LOG(ERR, "lcore %u called rx_pkt_burst for not ready port %"PRIuPTR"\n",
+		RTE_ETHDEV_LOG_LINE(ERR, "lcore %u called rx_pkt_burst for not ready port %"PRIuPTR,
 			rte_lcore_id(), port_id);
 		rte_dump_stack();
 		queue->rx_warn_once = true;
@@ -233,7 +233,7 @@ dummy_eth_tx_burst(void *txq,
 
 	port_id = queue - per_port_queues;
 	if (port_id < RTE_DIM(per_port_queues) && !queue->tx_warn_once) {
-		RTE_ETHDEV_LOG(ERR, "lcore %u called tx_pkt_burst for not ready port %"PRIuPTR"\n",
+		RTE_ETHDEV_LOG_LINE(ERR, "lcore %u called tx_pkt_burst for not ready port %"PRIuPTR,
 			rte_lcore_id(), port_id);
 		rte_dump_stack();
 		queue->tx_warn_once = true;
@@ -337,7 +337,7 @@ eth_dev_shared_data_prepare(void)
 				sizeof(*eth_dev_shared_data),
 				rte_socket_id(), flags);
 		if (mz == NULL) {
-			RTE_ETHDEV_LOG(ERR, "Cannot allocate ethdev shared data\n");
+			RTE_ETHDEV_LOG_LINE(ERR, "Cannot allocate ethdev shared data");
 			goto out;
 		}
 
@@ -355,7 +355,7 @@ eth_dev_shared_data_prepare(void)
 			/* Clean remaining any traces of a previous shared mem */
 			eth_dev_shared_mz = NULL;
 			eth_dev_shared_data = NULL;
-			RTE_ETHDEV_LOG(ERR, "Cannot lookup ethdev shared data\n");
+			RTE_ETHDEV_LOG_LINE(ERR, "Cannot lookup ethdev shared data");
 			goto out;
 		}
 		if (mz == eth_dev_shared_mz && mz->addr == eth_dev_shared_data)
lib/ethdev/rte_class_eth.c +1 -1
index 311beb17cb..bc003db8af 100644
@@ -165,7 +165,7 @@ eth_dev_iterate(const void *start,
 			valid_keys = eth_params_keys;
 		kvargs = rte_kvargs_parse(str, valid_keys);
 		if (kvargs == NULL) {
-			RTE_ETHDEV_LOG(ERR, "cannot parse argument list\n");
+			RTE_ETHDEV_LOG_LINE(ERR, "cannot parse argument list");
 			rte_errno = EINVAL;
 			return NULL;
 		}
lib/ethdev/rte_ethdev.c +439 -439

2,395 lines not on this page · raw message

lib/ethdev/rte_ethdev.h +27 -25

39 lines not on this page · raw message

lib/ethdev/rte_ethdev_cman.c +8 -8
index a9c4637521..41e38bdc89 100644

Lines of this file are not shown. View the raw message.

lib/ethdev/rte_ethdev_telemetry.c +22 -22

44 lines not on this page · raw message

lib/ethdev/rte_flow.c +33 -31

64 lines not on this page · raw message

lib/ethdev/rte_flow.h +0 -3
index affdc8121b..78b6bbb159 100644

Lines of this file are not shown. View the raw message.

lib/ethdev/sff_telemetry.c +15 -15
index f29e7fa882..b3f239d967 100644

Lines of this file are not shown. View the raw message.

lib/member/member.h new file +14 -0
new file mode 100644
index 0000000000..ce150f7689

Lines of this file are not shown. View the raw message.

lib/member/rte_member.c +8 -7
index 8f859f7fbd..57eb7affab 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member.h +0 -9
index b585904368..3278bbb5c1 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member_heap.h +20 -19
index 9c4a01aebe..e0a3d54eab 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member_ht.c +7 -6
index a85561b472..357097ff4b 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member_sketch.c +21 -20

41 lines not on this page · raw message

lib/member/rte_member_vbf.c +5 -4
index 5a0c51ecc0..5ad9487fad 100644

Lines of this file are not shown. View the raw message.

lib/pdump/rte_pdump.c +56 -56

112 lines not on this page · raw message

lib/power/power_acpi_cpufreq.c +5 -5
index dd143f2cc8..aecfdfa15d 100644

Lines of this file are not shown. View the raw message.

lib/power/power_amd_pstate_cpufreq.c +6 -6
index 44581fd48b..f8f43a49b2 100644

Lines of this file are not shown. View the raw message.

lib/power/power_common.c +2 -2
index bc57642cd1..b3d438c4de 100644

Lines of this file are not shown. View the raw message.

lib/power/power_common.h +3 -3
index c3fcbf4c10..ea2febbd86 100644

Lines of this file are not shown. View the raw message.

lib/power/power_cppc_cpufreq.c +6 -6
index 83e1e62830..31eb6942a2 100644

Lines of this file are not shown. View the raw message.

lib/power/power_intel_uncore.c +2 -2
index 0ee8e603d2..2cc3045056 100644

Lines of this file are not shown. View the raw message.

lib/power/power_pstate_cpufreq.c +6 -6
index 56aa302b5d..ca704e672c 100644

Lines of this file are not shown. View the raw message.

lib/regexdev/rte_regexdev.c +43 -43

86 lines not on this page · raw message

lib/regexdev/rte_regexdev.h +8 -6
index d50af775b5..dc111317a5 100644

Lines of this file are not shown. View the raw message.

lib/telemetry/telemetry.c +22 -19

41 lines not on this page · raw message

lib/vhost/iotlb.c +9 -9
index 10ab77262e..f2c275a7d7 100644

Lines of this file are not shown. View the raw message.

lib/vhost/socket.c +51 -51

102 lines not on this page · raw message

lib/vhost/vdpa.c +4 -4
index 219eef879c..9776fc07a9 100644

Lines of this file are not shown. View the raw message.

lib/vhost/vduse.c +60 -60

120 lines not on this page · raw message

lib/vhost/vduse.h +2 -2
index 4879b1f900..0d8f3f1205 100644

Lines of this file are not shown. View the raw message.

lib/vhost/vhost.c +59 -59

118 lines not on this page · raw message

lib/vhost/vhost.h +12 -12
index 5f24911190..5a74d0e628 100644

Lines of this file are not shown. View the raw message.

lib/vhost/vhost_user.c +254 -254

508 lines not on this page · raw message

lib/vhost/virtio_net.c +94 -94

188 lines not on this page · raw message

lib/vhost/virtio_net_ctrl.c +19 -19
index c4847f84ed..8f78122361 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.

#81 lore raw

PATCH v3 14/14 lib: use per line logging in helpers

In reply to David Marchand

Use RTE_LOG_LINE in existing macros that append a \n.

---
Changes since RFC v1:
- converted all logging helpers in lib/,

---
 lib/bbdev/rte_bbdev.c                      |  5 +++--
 lib/bpf/bpf_impl.h                         |  2 +-
 lib/cfgfile/rte_cfgfile.c                  |  4 ++--
 lib/compressdev/rte_compressdev_internal.h |  5 +++--
 lib/cryptodev/rte_cryptodev.h              | 16 +++++++---------
 lib/dmadev/rte_dmadev.c                    |  6 ++++--
 lib/ethdev/rte_ethdev.h                    |  3 +--
 lib/eventdev/eventdev_pmd.h                |  8 ++++----
 lib/eventdev/rte_event_timer_adapter.c     | 17 ++++++++++-------
 lib/gpudev/gpudev.c                        |  6 ++++--
 lib/graph/graph_private.h                  |  5 +++--
 lib/member/member.h                        |  4 ++--
 lib/metrics/rte_metrics_telemetry.c        |  4 ++--
 lib/mldev/rte_mldev.h                      |  5 +++--
 lib/net/rte_net_crc.c                      |  8 ++++----
 lib/node/node_private.h                    |  6 ++++--
 lib/pdump/rte_pdump.c                      |  5 ++---
 lib/power/power_common.h                   |  2 +-
 lib/rawdev/rte_rawdev_pmd.h                |  4 ++--
 lib/rcu/rte_rcu_qsbr.h                     |  8 +++-----
 lib/regexdev/rte_regexdev.h                |  3 +--
 lib/stack/stack_pvt.h                      |  4 ++--
 lib/telemetry/telemetry.c                  |  4 +---
 lib/vhost/vhost.h                          |  8 ++++----
 lib/vhost/vhost_crypto.c                   |  6 +++---
 25 files changed, 76 insertions(+), 72 deletions(-)
lib/bbdev/rte_bbdev.c +3 -2
index e09bb97abb..13bde3c25b 100644
@@ -28,10 +28,11 @@
 
 /* BBDev library logging ID */
 RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE);
+#define RTE_LOGTYPE_BBDEV bbdev_logtype
 
 /* Helper macro for logging */
-#define rte_bbdev_log(level, fmt, ...) \
-	rte_log(RTE_LOG_ ## level, bbdev_logtype, fmt "\n", ##__VA_ARGS__)
+#define rte_bbdev_log(level, ...) \
+	RTE_LOG_LINE(level, BBDEV, "" __VA_ARGS__)
 
 #define rte_bbdev_log_debug(fmt, ...) \
 	rte_bbdev_log(DEBUG, RTE_STR(__LINE__) ":%s() " fmt, __func__, \
lib/bpf/bpf_impl.h +1 -1
index 6a82ae4ef2..1a3d97d0c7 100644
@@ -30,7 +30,7 @@ extern int rte_bpf_logtype;
 #define RTE_LOGTYPE_BPF rte_bpf_logtype
 
 #define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
-	RTE_LOG(lvl, BPF, fmt "\n", ##args)
+	RTE_LOG_LINE(lvl, BPF, fmt, ##args)
 
 static inline size_t
 bpf_size(uint32_t bpf_op_sz)
lib/cfgfile/rte_cfgfile.c +2 -2
index 2f9cc0722a..6a5e4fd942 100644
@@ -29,10 +29,10 @@ struct rte_cfgfile {
 
 /* Setting up dynamic logging 8< */
 RTE_LOG_REGISTER_DEFAULT(cfgfile_logtype, INFO);
+#define RTE_LOGTYPE_CFGFILE cfgfile_logtype
 
 #define CFG_LOG(level, fmt, args...)					\
-	rte_log(RTE_LOG_ ## level, cfgfile_logtype, "%s(): " fmt "\n",	\
-		__func__, ## args)
+	RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## args)
 /* >8 End of setting up dynamic logging */
 
 /** when we resize a file structure, how many extra entries
lib/compressdev/rte_compressdev_internal.h +3 -2
index b3b193e3ee..01b7764282 100644
@@ -21,9 +21,10 @@ extern "C" {
 
 /* Logging Macros */
 extern int compressdev_logtype;
+#define RTE_LOGTYPE_COMPRESSDEV compressdev_logtype
+
 #define COMPRESSDEV_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, compressdev_logtype, "%s(): " fmt "\n", \
-			__func__, ##args)
+	RTE_LOG_LINE(level, COMPRESSDEV, "%s(): " fmt, __func__, ## args)
 
 /**
  * Dequeue processed packets from queue pair of a device.
lib/cryptodev/rte_cryptodev.h +7 -9
index 30ad2d9a95..83c8d44349 100644
@@ -36,23 +36,21 @@ extern int rte_cryptodev_logtype;
 
 /* Logging Macros */
 #define CDEV_LOG_ERR(...) \
-	RTE_LOG(ERR, CRYPTODEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+	RTE_LOG_LINE(ERR, CRYPTODEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,), \
 			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
 #define CDEV_LOG_INFO(...) \
-	RTE_LOG(INFO, CRYPTODEV, \
-		RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(INFO, CRYPTODEV, "" __VA_ARGS__)
 
 #define CDEV_LOG_DEBUG(...) \
-	RTE_LOG(DEBUG, CRYPTODEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+	RTE_LOG_LINE(DEBUG, CRYPTODEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,), \
 			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
 #define CDEV_PMD_TRACE(...) \
-	RTE_LOG(DEBUG, CRYPTODEV, \
-		RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+	RTE_LOG_LINE(DEBUG, CRYPTODEV, \
+		RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__,), \
 			dev, __func__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
 /**
lib/dmadev/rte_dmadev.c +4 -2
index 009a21849a..c1a166858c 100644
@@ -32,9 +32,11 @@ static struct {
 } *dma_devices_shared_data;
 
 RTE_LOG_REGISTER_DEFAULT(rte_dma_logtype, INFO);
+#define RTE_LOGTYPE_DMA rte_dma_logtype
+
 #define RTE_DMA_LOG(level, ...) \
-	rte_log(RTE_LOG_ ## level, rte_dma_logtype, RTE_FMT("dma: " \
-		RTE_FMT_HEAD(__VA_ARGS__,) "\n", RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(level, DMA, RTE_FMT("dma: " RTE_FMT_HEAD(__VA_ARGS__,), \
+		RTE_FMT_TAIL(__VA_ARGS__,)))
 
 int
 rte_dma_dev_max(size_t dev_max)
lib/ethdev/rte_ethdev.h +1 -2
index 18debce99c..21e3a21903 100644
@@ -179,8 +179,7 @@ extern int rte_eth_dev_logtype;
 #define RTE_LOGTYPE_ETHDEV rte_eth_dev_logtype
 
 #define RTE_ETHDEV_LOG_LINE(level, ...) \
-	RTE_LOG(level, ETHDEV, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-		RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(level, ETHDEV, "" __VA_ARGS__)
 
 struct rte_mbuf;
 
lib/eventdev/eventdev_pmd.h +4 -4
index 2ec5aec0a8..50cf7d9057 100644
@@ -33,14 +33,14 @@ extern "C" {
 
 /* Logging Macros */
 #define RTE_EDEV_LOG_ERR(...) \
-	RTE_LOG(ERR, EVENTDEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+	RTE_LOG_LINE(ERR, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,), \
 			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
 #define RTE_EDEV_LOG_DEBUG(...) \
-	RTE_LOG(DEBUG, EVENTDEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+	RTE_LOG_LINE(DEBUG, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,), \
 			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 #else
 #define RTE_EDEV_LOG_DEBUG(...) (void)0
lib/eventdev/rte_event_timer_adapter.c +10 -7
index 3f22e85173..6ebb7b257e 100644
@@ -30,27 +30,30 @@
 #define DATA_MZ_NAME_FORMAT "rte_event_timer_adapter_data_%d"
 
 RTE_LOG_REGISTER_SUFFIX(evtim_logtype, adapter.timer, NOTICE);
+#define RTE_LOGTYPE_EVTIM evtim_logtype
 RTE_LOG_REGISTER_SUFFIX(evtim_buffer_logtype, adapter.timer, NOTICE);
+#define RTE_LOGTYPE_EVTIM_BUF evtim_buffer_logtype
 RTE_LOG_REGISTER_SUFFIX(evtim_svc_logtype, adapter.timer.svc, NOTICE);
+#define RTE_LOGTYPE_EVTIM_SVC evtim_svc_logtype
 
 static struct rte_event_timer_adapter *adapters;
 
 static const struct event_timer_adapter_ops swtim_ops;
 
 #define EVTIM_LOG(level, logtype, ...) \
-	rte_log(RTE_LOG_ ## level, logtype, \
-		RTE_FMT("EVTIMER: %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) \
-			"\n", __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(level, logtype, \
+		RTE_FMT("EVTIMER: %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,), \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
-#define EVTIM_LOG_ERR(...) EVTIM_LOG(ERR, evtim_logtype, __VA_ARGS__)
+#define EVTIM_LOG_ERR(...) EVTIM_LOG(ERR, EVTIM, __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
 #define EVTIM_LOG_DBG(...) \
-	EVTIM_LOG(DEBUG, evtim_logtype, __VA_ARGS__)
+	EVTIM_LOG(DEBUG, EVTIM, __VA_ARGS__)
 #define EVTIM_BUF_LOG_DBG(...) \
-	EVTIM_LOG(DEBUG, evtim_buffer_logtype, __VA_ARGS__)
+	EVTIM_LOG(DEBUG, EVTIM_BUF, __VA_ARGS__)
 #define EVTIM_SVC_LOG_DBG(...) \
-	EVTIM_LOG(DEBUG, evtim_svc_logtype, __VA_ARGS__)
+	EVTIM_LOG(DEBUG, EVTIM_SVC, __VA_ARGS__)
 #else
 #define EVTIM_LOG_DBG(...) (void)0
 #define EVTIM_BUF_LOG_DBG(...) (void)0
lib/gpudev/gpudev.c +4 -2
index 6845d18b4d..79118c3e94 100644
@@ -17,9 +17,11 @@
 
 /* Logging */
 RTE_LOG_REGISTER_DEFAULT(gpu_logtype, NOTICE);
+#define RTE_LOGTYPE_GPUDEV gpu_logtype
+
 #define GPU_LOG(level, ...) \
-	rte_log(RTE_LOG_ ## level, gpu_logtype, RTE_FMT("gpu: " \
-		RTE_FMT_HEAD(__VA_ARGS__, ) "\n", RTE_FMT_TAIL(__VA_ARGS__, )))
+	RTE_LOG_LINE(level, GPUDEV, RTE_FMT("gpu: " RTE_FMT_HEAD(__VA_ARGS__, ), \
+		RTE_FMT_TAIL(__VA_ARGS__, )))
 
 /* Set any driver error as EPERM */
 #define GPU_DRV_RET(function) \
lib/graph/graph_private.h +3 -2
index d0ef13b205..672a034287 100644
@@ -18,10 +18,11 @@
 #include "rte_graph_worker.h"
 
 extern int rte_graph_logtype;
+#define RTE_LOGTYPE_GRAPH rte_graph_logtype
 
 #define GRAPH_LOG(level, ...)                                                  \
-	rte_log(RTE_LOG_##level, rte_graph_logtype,                            \
-		RTE_FMT("GRAPH: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ) "\n",    \
+	RTE_LOG_LINE(level, GRAPH,                                             \
+		RTE_FMT("GRAPH: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ),         \
 			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__, )))
 
 #define graph_err(...) GRAPH_LOG(ERR, __VA_ARGS__)
lib/member/member.h +2 -2
index ce150f7689..56dd2782a6 100644
@@ -8,7 +8,7 @@ extern int librte_member_logtype;
 #define RTE_LOGTYPE_MEMBER librte_member_logtype
 
 #define MEMBER_LOG(level, ...) \
-	RTE_LOG(level,  MEMBER, \
-		RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+	RTE_LOG_LINE(level,  MEMBER, \
+		RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__,), \
 			__func__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
lib/metrics/rte_metrics_telemetry.c +2 -2
index 1d133e1f8c..b8c9d75a7d 100644
@@ -16,11 +16,11 @@
 struct telemetry_metrics_data tel_met_data;
 
 int metrics_log_level;
+#define RTE_LOGTYPE_METRICS metrics_log_level
 
 /* Logging Macros */
 #define METRICS_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ##level, metrics_log_level, "%s(): "fmt "\n", \
-		__func__, ##args)
+	RTE_LOG_LINE(level, METRICS, "%s(): "fmt, __func__, ## args)
 
 #define METRICS_LOG_ERR(fmt, args...) \
 	METRICS_LOG(ERR, fmt, ## args)
lib/mldev/rte_mldev.h +3 -2
index 63b2670bb0..5cf6f0566f 100644
@@ -144,9 +144,10 @@ extern "C" {
 
 /* Logging Macro */
 extern int rte_ml_dev_logtype;
+#define RTE_LOGTYPE_MLDEV rte_ml_dev_logtype
 
-#define RTE_MLDEV_LOG(level, fmt, args...)                                                         \
-	rte_log(RTE_LOG_##level, rte_ml_dev_logtype, "%s(): " fmt "\n", __func__, ##args)
+#define RTE_MLDEV_LOG(level, fmt, args...) \
+	RTE_LOG_LINE(level, MLDEV, "%s(): " fmt, __func__, ##args)
 
 #define RTE_ML_STR_MAX 128
 /**< Maximum length of name string */
lib/net/rte_net_crc.c +4 -4
index 900d6de7f4..b401ea3dd8 100644
@@ -70,11 +70,11 @@ static const rte_net_crc_handler handlers_neon[] = {
 
 static uint16_t max_simd_bitwidth;
 
-#define NET_LOG(level, fmt, args...)					\
-	rte_log(RTE_LOG_ ## level, libnet_logtype, "%s(): " fmt "\n",	\
-		__func__, ## args)
-
 RTE_LOG_REGISTER_DEFAULT(libnet_logtype, INFO);
+#define RTE_LOGTYPE_NET libnet_logtype
+
+#define NET_LOG(level, fmt, args...) \
+	RTE_LOG_LINE(level, NET, "%s(): " fmt, __func__, ## args)
 
 /* Scalar handling */
 
lib/node/node_private.h +4 -2
index 26135aaa5b..5702146db4 100644
@@ -11,9 +11,11 @@
 #include <rte_mbuf_dyn.h>
 
 extern int rte_node_logtype;
+#define RTE_LOGTYPE_NODE rte_node_logtype
+
 #define NODE_LOG(level, node_name, ...)                                        \
-	rte_log(RTE_LOG_##level, rte_node_logtype,                             \
-		RTE_FMT("NODE %s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ) "\n",  \
+	RTE_LOG_LINE(level, NODE,                                              \
+		RTE_FMT("NODE %s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ),       \
 			node_name, __func__, __LINE__,                         \
 			RTE_FMT_TAIL(__VA_ARGS__, )))
 
lib/pdump/rte_pdump.c +2 -3
index 70963e7ee7..f6160f9911 100644
@@ -18,9 +18,8 @@
 RTE_LOG_REGISTER_DEFAULT(pdump_logtype, NOTICE);
 #define RTE_LOGTYPE_PDUMP pdump_logtype
 
-#define PDUMP_LOG_LINE(level, fmt, args...)		\
-	RTE_LOG(level, PDUMP, "%s(): " fmt "\n",	\
-		__func__, ## args)
+#define PDUMP_LOG_LINE(level, fmt, args...) \
+	RTE_LOG_LINE(level, PDUMP, "%s(): " fmt, __func__, ## args)
 
 /* Used for the multi-process communication */
 #define PDUMP_MP	"mp_pdump"
lib/power/power_common.h +1 -1
index ea2febbd86..4e32548169 100644
@@ -15,7 +15,7 @@ extern int power_logtype;
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
 #define POWER_DEBUG_LOG(fmt, args...) \
-	RTE_LOG(ERR, POWER, "%s: " fmt "\n", __func__, ## args)
+	RTE_LOG_LINE(ERR, POWER, "%s: " fmt, __func__, ## args)
 #else
 #define POWER_DEBUG_LOG(fmt, args...)
 #endif
lib/rawdev/rte_rawdev_pmd.h +2 -2
index 7b9ef1d09f..7173282c66 100644
@@ -27,11 +27,11 @@ extern "C" {
 #include "rte_rawdev.h"
 
 extern int librawdev_logtype;
+#define RTE_LOGTYPE_RAWDEV librawdev_logtype
 
 /* Logging Macros */
 #define RTE_RDEV_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, librawdev_logtype, "%s(): " fmt "\n", \
-		__func__, ##args)
+	RTE_LOG_LINE(level, RAWDEV, "%s(): " fmt, __func__, ##args)
 
 #define RTE_RDEV_ERR(fmt, args...) \
 	RTE_RDEV_LOG(ERR, fmt, ## args)
lib/rcu/rte_rcu_qsbr.h +3 -5
index 0dca8310c0..23c9f89805 100644
@@ -40,17 +40,15 @@ extern int rte_rcu_log_type;
 
 #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
 #define __RTE_RCU_DP_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, rte_rcu_log_type, \
-		"%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args)
 #else
 #define __RTE_RCU_DP_LOG(level, fmt, args...)
 #endif
 
 #if defined(RTE_LIBRTE_RCU_DEBUG)
-#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...) do {\
+#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...) do { \
 	if (v->qsbr_cnt[thread_id].lock_cnt) \
-		rte_log(RTE_LOG_ ## level, rte_rcu_log_type, \
-			"%s(): " fmt "\n", __func__, ## args); \
+		RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args); \
 } while (0)
 #else
 #define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...)
lib/regexdev/rte_regexdev.h +1 -2
index dc111317a5..a50b841b1e 100644
@@ -209,8 +209,7 @@ extern int rte_regexdev_logtype;
 #define RTE_LOGTYPE_REGEXDEV rte_regexdev_logtype
 
 #define RTE_REGEXDEV_LOG_LINE(level, ...) \
-	RTE_LOG(level, REGEXDEV, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-		RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(level, REGEXDEV, "" __VA_ARGS__)
 
 /* Macros to check for valid port */
 #define RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, retval) do { \
lib/stack/stack_pvt.h +2 -2
index c7eab4027d..2dce42a9da 100644
@@ -8,10 +8,10 @@
 #include <rte_log.h>
 
 extern int stack_logtype;
+#define RTE_LOGTYPE_STACK stack_logtype
 
 #define STACK_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ##level, stack_logtype, "%s(): "fmt "\n", \
-		__func__, ##args)
+	RTE_LOG_LINE(level, STACK, "%s(): "fmt, __func__, ##args)
 
 #define STACK_LOG_ERR(fmt, args...) \
 	STACK_LOG(ERR, fmt, ## args)
lib/telemetry/telemetry.c +1 -3
index 5c655e2b25..31e2391867 100644
@@ -57,9 +57,7 @@ static rte_cpuset_t *thread_cpuset;
 
 RTE_LOG_REGISTER_DEFAULT(logtype, WARNING);
 #define RTE_LOGTYPE_TMTY logtype
-#define TMTY_LOG_LINE(l, ...) \
-	RTE_LOG(l, TMTY,  RTE_FMT("TELEMETRY: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-		RTE_FMT_TAIL(__VA_ARGS__,)))
+#define TMTY_LOG_LINE(l, ...) RTE_LOG_LINE(l, TMTY, "TELEMETRY: " __VA_ARGS__)
 
 /* list of command callbacks, with one command registered by default */
 static struct cmd_callback *callbacks;
lib/vhost/vhost.h +4 -4
index 5a74d0e628..25c0f86e55 100644
@@ -678,12 +678,12 @@ extern int vhost_data_log_level;
 #define RTE_LOGTYPE_VHOST_DATA vhost_data_log_level
 
 #define VHOST_CONFIG_LOG(prefix, level, fmt, args...)		\
-	RTE_LOG(level, VHOST_CONFIG,				\
-		"VHOST_CONFIG: (%s) " fmt "\n", prefix, ##args)
+	RTE_LOG_LINE(level, VHOST_CONFIG,			\
+		"VHOST_CONFIG: (%s) " fmt, prefix, ##args)
 
 #define VHOST_DATA_LOG(prefix, level, fmt, args...)		\
-	RTE_LOG_DP(level, VHOST_DATA,				\
-		"VHOST_DATA: (%s) " fmt "\n", prefix, ##args)
+	RTE_LOG_DP_LINE(level, VHOST_DATA,			\
+		"VHOST_DATA: (%s) " fmt, prefix, ##args)
 
 #ifdef RTE_LIBRTE_VHOST_DEBUG
 #define VHOST_MAX_PRINT_BUFF 6072
lib/vhost/vhost_crypto.c +3 -3
index 6e5443e5f8..3704fbbb3d 100644
@@ -21,15 +21,15 @@ RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
 #define RTE_LOGTYPE_VHOST_CRYPTO	vhost_crypto_logtype
 
 #define VC_LOG_ERR(fmt, args...)				\
-	RTE_LOG(ERR, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+	RTE_LOG_LINE(ERR, VHOST_CRYPTO, "%s() line %u: " fmt,	\
 		__func__, __LINE__, ## args)
 #define VC_LOG_INFO(fmt, args...)				\
-	RTE_LOG(INFO, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+	RTE_LOG_LINE(INFO, VHOST_CRYPTO, "%s() line %u: " fmt,	\
 		__func__, __LINE__, ## args)
 
 #ifdef RTE_LIBRTE_VHOST_DEBUG
 #define VC_LOG_DBG(fmt, args...)				\
-	RTE_LOG(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+	RTE_LOG_LINE(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt,	\
 		__func__, __LINE__, ## args)
 #else
 #define VC_LOG_DBG(fmt, args...)
Signature · 1 line
2.43.0
#82 lore raw

v4 cover Detect superfluous newline in logs

In reply to David Marchand

Getting readable and consistent logs is important when running a DPDK application, especially when troubleshooting.
A common issue with logs is when a DPDK change do not add (or on the contrary add too many \n) in the format string.

This issue would only get noticed when actually hitting this log (which may be a situation hard to reach).

This series proposes to introduce a new RTE_LOG_LINE helper that is responsible for logging a one line message and spews a build error (with gcc) if any \n is part of the format string.

Because this is still a RFC and a lot of changes are added in this v2, no ack from the v1 has been kept.

Since the v1 discussion on the cover letter, I changed my mind, and made the choice to break existing logging helpers exported in the public API. The reasoning is that those should not be used in the first place:
logs should be produced only by the library that registers the logtype.

Some multiline logging for debugging and the test assert macros are still present, but in this case an explicit call to RTE_LOG() is done. This can be checked with a simple:

$ git grep 'RTE_LOG(' -- lib/ :^lib/log/
lib/acl/acl_bld.c:      RTE_LOG(DEBUG, ACL, "Build phase for ACL \"%s\":\n"
lib/acl/acl_gen.c:      RTE_LOG(DEBUG, ACL, "Gen phase for ACL \"%s\":\n"
lib/bpf/bpf_validate.c: RTE_LOG(DEBUG, BPF, "%s(%p) stats:\n"
lib/bpf/bpf_validate.c: RTE_LOG(DEBUG, BPF,
lib/eal/common/eal_common_debug.c:              RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
lib/eal/include/rte_test.h:             RTE_LOG(ERR, EAL, "Test assert %s line %d failed: "           \
lib/ip_frag/ip_frag_common.h:#define    IP_FRAG_LOG(lvl, fmt, args...)  RTE_LOG(lvl, IPFRAG, fmt, ##args)
lib/sched/rte_sched.c:  RTE_LOG(DEBUG, SCHED, "Low level config for pipe profile %u:\n"
lib/sched/rte_sched.c:  RTE_LOG(DEBUG, SCHED, "Low level config for subport profile %u:\n"

Changes since v3:
- fixed some checkpatch complaints,

Changes since RFC v2:
- sent as non RFC,
- fixed format string crossing line boundaries,
- avoided potential collision with BPF_ namespace,

Changes since RFC v1:
- rebased after Stephen log changes,
- added more fixes as I was making progress on the topic,
- added a check so dpdk developers stop using RTE_LOG(),
- added preparation patches, like "lib: replace logging helpers",
- converted all libraries, keeping some special cases with explicit calls to RTE_LOG,

Signature · 232 lines
David Marchand

David Marchand (14):
  hash: remove some dead code
  regexdev: fix logtype register
  lib: use dedicated logtypes and macros
  lib: add newline in logs
  lib: remove redundant newline from logs
  eal/linux: remove log paraphrasing the doc
  bpf: remove log level in internal helper
  lib: simplify multilines log messages
  rcu: introduce a logging helper
  vhost: improve log for memory dumping configuration
  log: add a per line log helper
  lib: convert to per line logging
  lib: replace logging helpers
  lib: use per line logging in helpers

 devtools/checkpatches.sh                   |   8 +
 drivers/crypto/ipsec_mb/ipsec_mb_ops.c     |   2 +-
 lib/acl/acl_bld.c                          |  28 +-
 lib/acl/acl_gen.c                          |   8 +-
 lib/acl/rte_acl.c                          |   8 +-
 lib/acl/tb_mem.c                           |   4 +-
 lib/bbdev/rte_bbdev.c                      |  11 +-
 lib/bpf/bpf.c                              |   2 +-
 lib/bpf/bpf_convert.c                      |  16 +-
 lib/bpf/bpf_exec.c                         |  12 +-
 lib/bpf/bpf_impl.h                         |   5 +-
 lib/bpf/bpf_jit_arm64.c                    |   8 +-
 lib/bpf/bpf_jit_x86.c                      |   4 +-
 lib/bpf/bpf_load.c                         |   2 +-
 lib/bpf/bpf_load_elf.c                     |  24 +-
 lib/bpf/bpf_pkt.c                          |   4 +-
 lib/bpf/bpf_stub.c                         |   6 +-
 lib/bpf/bpf_validate.c                     |  44 +-
 lib/cfgfile/rte_cfgfile.c                  |  18 +-
 lib/compressdev/rte_compressdev_internal.h |   5 +-
 lib/compressdev/rte_compressdev_pmd.c      |   4 +-
 lib/cryptodev/rte_cryptodev.c              |   4 +-
 lib/cryptodev/rte_cryptodev.h              |  22 +-
 lib/dispatcher/rte_dispatcher.c            |  12 +-
 lib/dmadev/rte_dmadev.c                    |   8 +-
 lib/eal/common/eal_common_bus.c            |  22 +-
 lib/eal/common/eal_common_class.c          |   4 +-
 lib/eal/common/eal_common_config.c         |   2 +-
 lib/eal/common/eal_common_debug.c          |   6 +-
 lib/eal/common/eal_common_dev.c            |  80 +-
 lib/eal/common/eal_common_devargs.c        |  18 +-
 lib/eal/common/eal_common_dynmem.c         |  34 +-
 lib/eal/common/eal_common_fbarray.c        |  12 +-
 lib/eal/common/eal_common_interrupts.c     |  38 +-
 lib/eal/common/eal_common_lcore.c          |  26 +-
 lib/eal/common/eal_common_memalloc.c       |  12 +-
 lib/eal/common/eal_common_memory.c         |  66 +-
 lib/eal/common/eal_common_memzone.c        |  24 +-
 lib/eal/common/eal_common_options.c        | 236 +++---
 lib/eal/common/eal_common_proc.c           | 112 +--
 lib/eal/common/eal_common_tailqs.c         |  12 +-
 lib/eal/common/eal_common_thread.c         |  12 +-
 lib/eal/common/eal_common_timer.c          |   6 +-
 lib/eal/common/eal_common_trace_utils.c    |   2 +-
 lib/eal/common/eal_trace.h                 |   4 +-
 lib/eal/common/hotplug_mp.c                |  54 +-
 lib/eal/common/malloc_elem.c               |   6 +-
 lib/eal/common/malloc_heap.c               |  40 +-
 lib/eal/common/malloc_mp.c                 |  72 +-
 lib/eal/common/rte_keepalive.c             |   2 +-
 lib/eal/common/rte_malloc.c                |  10 +-
 lib/eal/common/rte_service.c               |   8 +-
 lib/eal/freebsd/eal.c                      |  75 +-
 lib/eal/freebsd/eal_alarm.c                |   2 +-
 lib/eal/freebsd/eal_dev.c                  |   8 +-
 lib/eal/freebsd/eal_hugepage_info.c        |  22 +-
 lib/eal/freebsd/eal_interrupts.c           |  60 +-
 lib/eal/freebsd/eal_lcore.c                |   2 +-
 lib/eal/freebsd/eal_memalloc.c             |  10 +-
 lib/eal/freebsd/eal_memory.c               |  34 +-
 lib/eal/freebsd/eal_thread.c               |   2 +-
 lib/eal/freebsd/eal_timer.c                |  10 +-
 lib/eal/linux/eal.c                        | 122 +--
 lib/eal/linux/eal_alarm.c                  |   2 +-
 lib/eal/linux/eal_dev.c                    |  40 +-
 lib/eal/linux/eal_hugepage_info.c          |  38 +-
 lib/eal/linux/eal_interrupts.c             | 116 +--
 lib/eal/linux/eal_lcore.c                  |   4 +-
 lib/eal/linux/eal_memalloc.c               | 120 +--
 lib/eal/linux/eal_memory.c                 | 208 ++---
 lib/eal/linux/eal_thread.c                 |   4 +-
 lib/eal/linux/eal_timer.c                  |  14 +-
 lib/eal/linux/eal_vfio.c                   | 270 +++----
 lib/eal/linux/eal_vfio_mp_sync.c           |   4 +-
 lib/eal/riscv/rte_cycles.c                 |   4 +-
 lib/eal/unix/eal_filesystem.c              |  14 +-
 lib/eal/unix/eal_firmware.c                |   2 +-
 lib/eal/unix/eal_unix_memory.c             |   8 +-
 lib/eal/unix/rte_thread.c                  |  34 +-
 lib/eal/windows/eal.c                      |  36 +-
 lib/eal/windows/eal_alarm.c                |  12 +-
 lib/eal/windows/eal_debug.c                |   8 +-
 lib/eal/windows/eal_dev.c                  |   8 +-
 lib/eal/windows/eal_hugepages.c            |  10 +-
 lib/eal/windows/eal_interrupts.c           |  10 +-
 lib/eal/windows/eal_lcore.c                |   7 +-
 lib/eal/windows/eal_memalloc.c             |  50 +-
 lib/eal/windows/eal_memory.c               |  22 +-
 lib/eal/windows/eal_windows.h              |   4 +-
 lib/eal/windows/include/rte_windows.h      |   6 +-
 lib/eal/windows/rte_thread.c               |  28 +-
 lib/efd/rte_efd.c                          |  58 +-
 lib/ethdev/ethdev_driver.c                 |  44 +-
 lib/ethdev/ethdev_pci.h                    |   2 +-
 lib/ethdev/ethdev_private.c                |  10 +-
 lib/ethdev/rte_class_eth.c                 |   2 +-
 lib/ethdev/rte_ethdev.c                    | 854 ++++++++++-----------
 lib/ethdev/rte_ethdev.h                    |  51 +-
 lib/ethdev/rte_ethdev_cman.c               |  16 +-
 lib/ethdev/rte_ethdev_telemetry.c          |  44 +-
 lib/ethdev/rte_flow.c                      |  64 +-
 lib/ethdev/rte_flow.h                      |   3 -
 lib/ethdev/sff_telemetry.c                 |  30 +-
 lib/eventdev/eventdev_pmd.h                |  18 +-
 lib/eventdev/rte_event_crypto_adapter.c    |  12 +-
 lib/eventdev/rte_event_dma_adapter.c       |  18 +-
 lib/eventdev/rte_event_eth_rx_adapter.c    |  40 +-
 lib/eventdev/rte_event_eth_tx_adapter.c    |   2 +-
 lib/eventdev/rte_event_timer_adapter.c     |  21 +-
 lib/eventdev/rte_eventdev.c                |  10 +-
 lib/fib/rte_fib.c                          |  14 +-
 lib/fib/rte_fib6.c                         |  14 +-
 lib/gpudev/gpudev.c                        |   6 +-
 lib/graph/graph_private.h                  |   7 +-
 lib/hash/rte_cuckoo_hash.c                 |  52 +-
 lib/hash/rte_cuckoo_hash.h                 |  11 -
 lib/hash/rte_fbk_hash.c                    |   4 +-
 lib/hash/rte_hash_crc.c                    |  12 +-
 lib/hash/rte_thash.c                       |  20 +-
 lib/hash/rte_thash_gfni.c                  |   8 +-
 lib/ip_frag/rte_ip_frag_common.c           |   8 +-
 lib/latencystats/rte_latencystats.c        |  41 +-
 lib/log/log.c                              |   6 +-
 lib/log/rte_log.h                          |  21 +
 lib/lpm/rte_lpm.c                          |  12 +-
 lib/lpm/rte_lpm6.c                         |  10 +-
 lib/mbuf/rte_mbuf.c                        |  14 +-
 lib/mbuf/rte_mbuf_dyn.c                    |  14 +-
 lib/mbuf/rte_mbuf_pool_ops.c               |   4 +-
 lib/member/member.h                        |  14 +
 lib/member/rte_member.c                    |  15 +-
 lib/member/rte_member.h                    |   9 -
 lib/member/rte_member_heap.h               |  39 +-
 lib/member/rte_member_ht.c                 |  13 +-
 lib/member/rte_member_sketch.c             |  41 +-
 lib/member/rte_member_vbf.c                |   9 +-
 lib/mempool/rte_mempool.c                  |  24 +-
 lib/mempool/rte_mempool.h                  |   2 +-
 lib/mempool/rte_mempool_ops.c              |  10 +-
 lib/metrics/rte_metrics_telemetry.c        |   6 +-
 lib/mldev/rte_mldev.c                      | 102 +--
 lib/mldev/rte_mldev.h                      |   5 +-
 lib/net/rte_net_crc.c                      |  14 +-
 lib/node/ethdev_rx.c                       |   4 +-
 lib/node/ip4_lookup.c                      |   2 +-
 lib/node/ip6_lookup.c                      |   2 +-
 lib/node/kernel_rx.c                       |   8 +-
 lib/node/kernel_tx.c                       |   4 +-
 lib/node/node_private.h                    |   8 +-
 lib/pdump/rte_pdump.c                      | 113 ++-
 lib/pipeline/rte_pipeline.c                | 228 +++---
 lib/port/rte_port_ethdev.c                 |  18 +-
 lib/port/rte_port_eventdev.c               |  18 +-
 lib/port/rte_port_fd.c                     |  24 +-
 lib/port/rte_port_frag.c                   |  14 +-
 lib/port/rte_port_ras.c                    |  12 +-
 lib/port/rte_port_ring.c                   |  18 +-
 lib/port/rte_port_sched.c                  |  12 +-
 lib/port/rte_port_source_sink.c            |  48 +-
 lib/port/rte_port_sym_crypto.c             |  18 +-
 lib/power/guest_channel.c                  |  36 +-
 lib/power/power_acpi_cpufreq.c             | 116 +--
 lib/power/power_amd_pstate_cpufreq.c       | 132 ++--
 lib/power/power_common.c                   |  14 +-
 lib/power/power_common.h                   |   6 +-
 lib/power/power_cppc_cpufreq.c             | 130 ++--
 lib/power/power_intel_uncore.c             |  72 +-
 lib/power/power_kvm_vm.c                   |  22 +-
 lib/power/power_pstate_cpufreq.c           | 156 ++--
 lib/power/rte_power.c                      |  22 +-
 lib/power/rte_power_pmd_mgmt.c             |  34 +-
 lib/power/rte_power_uncore.c               |  14 +-
 lib/rawdev/rte_rawdev_pmd.h                |   4 +-
 lib/rcu/rte_rcu_qsbr.c                     |  66 +-
 lib/rcu/rte_rcu_qsbr.h                     |  17 +-
 lib/regexdev/rte_regexdev.c                |  88 +--
 lib/regexdev/rte_regexdev.h                |  13 +-
 lib/reorder/rte_reorder.c                  |  32 +-
 lib/rib/rte_rib.c                          |  10 +-
 lib/rib/rte_rib6.c                         |  10 +-
 lib/ring/rte_ring.c                        |  24 +-
 lib/sched/rte_pie.c                        |  18 +-
 lib/sched/rte_sched.c                      | 274 +++----
 lib/stack/rte_stack.c                      |   8 +-
 lib/stack/stack_pvt.h                      |   4 +-
 lib/table/rte_table_acl.c                  |  72 +-
 lib/table/rte_table_array.c                |  16 +-
 lib/table/rte_table_hash_cuckoo.c          |  22 +-
 lib/table/rte_table_hash_ext.c             |  22 +-
 lib/table/rte_table_hash_key16.c           |  38 +-
 lib/table/rte_table_hash_key32.c           |  38 +-
 lib/table/rte_table_hash_key8.c            |  38 +-
 lib/table/rte_table_hash_lru.c             |  22 +-
 lib/table/rte_table_lpm.c                  |  42 +-
 lib/table/rte_table_lpm_ipv6.c             |  44 +-
 lib/table/rte_table_stub.c                 |   4 +-
 lib/telemetry/telemetry.c                  |  39 +-
 lib/vhost/fd_man.c                         |   8 +-
 lib/vhost/iotlb.c                          |  36 +-
 lib/vhost/socket.c                         | 102 +--
 lib/vhost/vdpa.c                           |   8 +-
 lib/vhost/vduse.c                          | 120 +--
 lib/vhost/vduse.h                          |   4 +-
 lib/vhost/vhost.c                          | 118 +--
 lib/vhost/vhost.h                          |  24 +-
 lib/vhost/vhost_crypto.c                   |  12 +-
 lib/vhost/vhost_user.c                     | 530 ++++++-------
 lib/vhost/virtio_net.c                     | 188 ++---
 lib/vhost/virtio_net_ctrl.c                |  38 +-
 209 files changed, 3986 insertions(+), 3971 deletions(-)
 create mode 100644 lib/member/member.h

-- 
2.43.0
#83 lore raw

PATCH v4 1/14 hash: remove some dead code

This macro is not used.

Fixes 769b2de7fb52 ("hash: implement RCU resources reclamation")
---
 lib/hash/rte_cuckoo_hash.h | 11 -----------
 1 file changed, 11 deletions(-)
lib/hash/rte_cuckoo_hash.h +0 -11
index f7afc4dd79..8ea793c66e 100644
@@ -29,17 +29,6 @@
 #define RETURN_IF_TRUE(cond, retval)
 #endif
 
-#if defined(RTE_LIBRTE_HASH_DEBUG)
-#define ERR_IF_TRUE(cond, fmt, args...) do { \
-	if (cond) { \
-		RTE_LOG(ERR, HASH, fmt, ##args); \
-		return; \
-	} \
-} while (0)
-#else
-#define ERR_IF_TRUE(cond, fmt, args...)
-#endif
-
 #include <rte_hash_crc.h>
 #include <rte_jhash.h>
 
Signature · 1 line
2.43.0
#84 lore raw

PATCH v4 2/14 regexdev: fix logtype register

In reply to David Marchand

This library logtype was not initialized so its logs would end up under the 0 logtype, iow, RTE_LOGTYPE_EAL.

Fixes b25246beaefc ("regexdev: add core functions")
---
 lib/regexdev/rte_regexdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/regexdev/rte_regexdev.c +1 -1
index caec069182..d38a85eb0b 100644
@@ -19,7 +19,7 @@ static struct {
 	struct rte_regexdev_data data[RTE_MAX_REGEXDEV_DEVS];
 } *rte_regexdev_shared_data;
 
-int rte_regexdev_logtype;
+RTE_LOG_REGISTER_DEFAULT(rte_regexdev_logtype, INFO);
 
 static uint16_t
 regexdev_find_free_dev(void)
Signature · 1 line
2.43.0
Acked-by on v4 2/14
#85 lore raw

Re: [PATCH v4 02/14] regexdev: fix logtype register

Quoted 10 lines · On Mon, 18 Dec 2023 15:37:51 +0100 David Marchand <[email protected]>…

This library logtype was not initialized so its logs would end up under the 0 logtype, iow, RTE_LOGTYPE_EAL.

Fixes b25246beaefc ("regexdev: add core functions")
#86 lore raw

PATCH v4 3/14 lib: use dedicated logtypes and macros

In reply to David Marchand

No printf!
When a dedicated log helper exists, use it.
And no usurpation please: a library should log under its logtype (see the eventdev rx adapter update for example).

Note: the RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET macro is renamed for consistency with the rest of eventdev (private) macros.

---
 lib/cryptodev/rte_cryptodev.c           |  2 +-
 lib/ethdev/ethdev_driver.c              |  4 ++--
 lib/ethdev/ethdev_private.c             |  2 +-
 lib/ethdev/rte_class_eth.c              |  2 +-
 lib/eventdev/rte_event_dma_adapter.c    |  4 ++--
 lib/eventdev/rte_event_eth_rx_adapter.c | 12 ++++++------
 lib/eventdev/rte_eventdev.c             |  6 +++---
 lib/mempool/rte_mempool_ops.c           |  2 +-
 8 files changed, 17 insertions(+), 17 deletions(-)
lib/cryptodev/rte_cryptodev.c +1 -1
index 25e3ec12d1..ead8c9a623 100644
@@ -2684,7 +2684,7 @@ rte_cryptodev_driver_id_get(const char *name)
 	int driver_id = -1;
 
 	if (name == NULL) {
-		RTE_LOG(DEBUG, CRYPTODEV, "name pointer NULL");
+		CDEV_LOG_DEBUG("name pointer NULL");
 		return -1;
 	}
 
lib/ethdev/ethdev_driver.c +2 -2
index fff4b7b4cd..55a9dcc565 100644
@@ -487,7 +487,7 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)
 		pair = &args.pairs[i];
 		if (strcmp("representor", pair->key) == 0) {
 			if (eth_da->type != RTE_ETH_REPRESENTOR_NONE) {
-				RTE_LOG(ERR, EAL, "duplicated representor key: %s\n",
+				RTE_ETHDEV_LOG(ERR, "duplicated representor key: %s\n",
 					dargs);
 				result = -1;
 				goto parse_cleanup;
@@ -713,7 +713,7 @@ rte_eth_representor_id_get(uint16_t port_id,
 		if (info->ranges[i].controller != controller)
 			continue;
 		if (info->ranges[i].id_end < info->ranges[i].id_base) {
-			RTE_LOG(WARNING, EAL, "Port %hu invalid representor ID Range %u - %u, entry %d\n",
+			RTE_ETHDEV_LOG(WARNING, "Port %hu invalid representor ID Range %u - %u, entry %d\n",
 				port_id, info->ranges[i].id_base,
 				info->ranges[i].id_end, i);
 			continue;
lib/ethdev/ethdev_private.c +1 -1
index e98b7188b0..0e1c7b23c1 100644
@@ -182,7 +182,7 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)
 		RTE_DIM(eth_da->representor_ports));
 done:
 	if (str == NULL)
-		RTE_LOG(ERR, EAL, "wrong representor format: %s\n", str);
+		RTE_ETHDEV_LOG(ERR, "wrong representor format: %s\n", str);
 	return str == NULL ? -1 : 0;
 }
 
lib/ethdev/rte_class_eth.c +1 -1
index b61dae849d..311beb17cb 100644
@@ -165,7 +165,7 @@ eth_dev_iterate(const void *start,
 			valid_keys = eth_params_keys;
 		kvargs = rte_kvargs_parse(str, valid_keys);
 		if (kvargs == NULL) {
-			RTE_LOG(ERR, EAL, "cannot parse argument list\n");
+			RTE_ETHDEV_LOG(ERR, "cannot parse argument list\n");
 			rte_errno = EINVAL;
 			return NULL;
 		}
lib/eventdev/rte_event_dma_adapter.c +2 -2
index af4b5ad388..cbf9405438 100644
@@ -1046,7 +1046,7 @@ rte_event_dma_adapter_vchan_add(uint8_t id, int16_t dma_dev_id, uint16_t vchan,
 							sizeof(struct dma_vchan_info),
 							0, adapter->socket_id);
 			if (dev_info->vchanq == NULL) {
-				printf("Queue pair add not supported\n");
+				RTE_EDEV_LOG_ERR("Queue pair add not supported");
 				return -ENOMEM;
 			}
 		}
@@ -1057,7 +1057,7 @@ rte_event_dma_adapter_vchan_add(uint8_t id, int16_t dma_dev_id, uint16_t vchan,
 						sizeof(struct dma_vchan_info),
 						0, adapter->socket_id);
 			if (dev_info->tqmap == NULL) {
-				printf("tq pair add not supported\n");
+				RTE_EDEV_LOG_ERR("tq pair add not supported");
 				return -ENOMEM;
 			}
 		}
lib/eventdev/rte_event_eth_rx_adapter.c +6 -6
index 6db03adf04..82ae31712d 100644
@@ -314,9 +314,9 @@ rxa_event_buf_get(struct event_eth_rx_adapter *rx_adapter, uint16_t eth_dev_id,
 	} \
 } while (0)
 
-#define RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(port_id, retval) do { \
+#define RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(port_id, retval) do { \
 	if (!rte_eth_dev_is_valid_port(port_id)) { \
-		RTE_ETHDEV_LOG(ERR, "Invalid port_id=%u\n", port_id); \
+		RTE_EDEV_LOG_ERR("Invalid port_id=%u", port_id); \
 		ret = retval; \
 		goto error; \
 	} \
@@ -3671,7 +3671,7 @@ handle_rxa_get_queue_conf(const char *cmd __rte_unused,
 
 	/* Get device ID from parameter string */
 	eth_dev_id = strtoul(token, NULL, 10);
-	RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
+	RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
 
 	token = strtok(NULL, ",");
 	RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1);
@@ -3743,7 +3743,7 @@ handle_rxa_get_queue_stats(const char *cmd __rte_unused,
 
 	/* Get device ID from parameter string */
 	eth_dev_id = strtoul(token, NULL, 10);
-	RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
+	RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
 
 	token = strtok(NULL, ",");
 	RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1);
@@ -3813,7 +3813,7 @@ handle_rxa_queue_stats_reset(const char *cmd __rte_unused,
 
 	/* Get device ID from parameter string */
 	eth_dev_id = strtoul(token, NULL, 10);
-	RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
+	RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
 
 	token = strtok(NULL, ",");
 	RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1);
@@ -3868,7 +3868,7 @@ handle_rxa_instance_get(const char *cmd __rte_unused,
 
 	/* Get device ID from parameter string */
 	eth_dev_id = strtoul(token, NULL, 10);
-	RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
+	RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
 
 	token = strtok(NULL, ",");
 	RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1);
lib/eventdev/rte_eventdev.c +3 -3
index 0ca32d6721..ae50821a3f 100644
@@ -1428,8 +1428,8 @@ rte_event_vector_pool_create(const char *name, unsigned int n,
 	int ret;
 
 	if (!nb_elem) {
-		RTE_LOG(ERR, EVENTDEV,
-			"Invalid number of elements=%d requested\n", nb_elem);
+		RTE_EDEV_LOG_ERR("Invalid number of elements=%d requested",
+			nb_elem);
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -1444,7 +1444,7 @@ rte_event_vector_pool_create(const char *name, unsigned int n,
 	mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
-		RTE_LOG(ERR, EVENTDEV, "error setting mempool handler\n");
+		RTE_EDEV_LOG_ERR("error setting mempool handler");
 		goto err;
 	}
 
lib/mempool/rte_mempool_ops.c +1 -1
index ae1d288f27..e871de9ec9 100644
@@ -46,7 +46,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h)
 
 	if (strlen(h->name) >= sizeof(ops->name) - 1) {
 		rte_spinlock_unlock(&rte_mempool_ops_table.sl);
-		RTE_LOG(DEBUG, EAL, "%s(): mempool_ops <%s>: name too long\n",
+		RTE_LOG(DEBUG, MEMPOOL, "%s(): mempool_ops <%s>: name too long\n",
 				__func__, h->name);
 		rte_errno = EEXIST;
 		return -EEXIST;
Signature · 1 line
2.43.0
#87 lore raw

PATCH v4 4/14 lib: add newline in logs

In reply to David Marchand

Fix places leading to a log message not terminated with a newline.

---
 lib/eal/common/eal_common_options.c |  2 +-
 lib/eal/linux/eal_hugepage_info.c   |  2 +-
 lib/eal/linux/eal_interrupts.c      |  2 +-
 lib/ethdev/ethdev_pci.h             |  2 +-
 lib/ethdev/rte_ethdev.c             | 40 ++++++++++++++---------------
 lib/lpm/rte_lpm6.c                  |  6 ++---
 lib/power/guest_channel.c           |  2 +-
 lib/power/rte_power_pmd_mgmt.c      |  6 ++---
 8 files changed, 31 insertions(+), 31 deletions(-)
lib/eal/common/eal_common_options.c +1 -1
index a6d21f1cba..e9ba01fb89 100644
@@ -2141,7 +2141,7 @@ rte_vect_set_max_simd_bitwidth(uint16_t bitwidth)
 	struct internal_config *internal_conf =
 		eal_get_internal_configuration();
 	if (internal_conf->max_simd_bitwidth.forced) {
-		RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - user runtime override enabled");
+		RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - user runtime override enabled\n");
 		return -EPERM;
 	}
 
lib/eal/linux/eal_hugepage_info.c +1 -1
index 581d9dfc91..36a495fb1f 100644
@@ -403,7 +403,7 @@ inspect_hugedir_cb(const struct walk_hugedir_data *whd)
 	struct stat st;
 
 	if (fstat(whd->file_fd, &st) < 0)
-		RTE_LOG(DEBUG, EAL, "%s(): stat(\"%s\") failed: %s",
+		RTE_LOG(DEBUG, EAL, "%s(): stat(\"%s\") failed: %s\n",
 				__func__, whd->file_name, strerror(errno));
 	else
 		(*total_size) += st.st_size;
lib/eal/linux/eal_interrupts.c +1 -1
index d4919dff45..eabac24992 100644
@@ -1542,7 +1542,7 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
 		/* only check, initialization would be done in vdev driver.*/
 		if ((uint64_t)rte_intr_efd_counter_size_get(intr_handle) >
 		    sizeof(union rte_intr_read_buffer)) {
-			RTE_LOG(ERR, EAL, "the efd_counter_size is oversized");
+			RTE_LOG(ERR, EAL, "the efd_counter_size is oversized\n");
 			return -EINVAL;
 		}
 	} else {
lib/ethdev/ethdev_pci.h +1 -1
index 320e3e0093..ddb559aa95 100644
@@ -31,7 +31,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
 	struct rte_pci_device *pci_dev)
 {
 	if ((eth_dev == NULL) || (pci_dev == NULL)) {
-		RTE_ETHDEV_LOG(ERR, "NULL pointer eth_dev=%p pci_dev=%p",
+		RTE_ETHDEV_LOG(ERR, "NULL pointer eth_dev=%p pci_dev=%p\n",
 			(void *)eth_dev, (void *)pci_dev);
 		return;
 	}
lib/ethdev/rte_ethdev.c +20 -20
index 3858983fcc..b9d99ece15 100644
@@ -724,7 +724,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
 	uint16_t pid;
 
 	if (name == NULL) {
-		RTE_ETHDEV_LOG(ERR, "Cannot get port ID from NULL name");
+		RTE_ETHDEV_LOG(ERR, "Cannot get port ID from NULL name\n");
 		return -EINVAL;
 	}
 
@@ -2394,41 +2394,41 @@ rte_eth_rx_hairpin_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 		nb_rx_desc = cap.max_nb_desc;
 	if (nb_rx_desc > cap.max_nb_desc) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for nb_rx_desc(=%hu), should be: <= %hu",
+			"Invalid value for nb_rx_desc(=%hu), should be: <= %hu\n",
 			nb_rx_desc, cap.max_nb_desc);
 		return -EINVAL;
 	}
 	if (conf->peer_count > cap.max_rx_2_tx) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for number of peers for Rx queue(=%u), should be: <= %hu",
+			"Invalid value for number of peers for Rx queue(=%u), should be: <= %hu\n",
 			conf->peer_count, cap.max_rx_2_tx);
 		return -EINVAL;
 	}
 	if (conf->use_locked_device_memory && !cap.rx_cap.locked_device_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use locked device memory for Rx queue, which is not supported");
+			"Attempt to use locked device memory for Rx queue, which is not supported\n");
 		return -EINVAL;
 	}
 	if (conf->use_rte_memory && !cap.rx_cap.rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use DPDK memory for Rx queue, which is not supported");
+			"Attempt to use DPDK memory for Rx queue, which is not supported\n");
 		return -EINVAL;
 	}
 	if (conf->use_locked_device_memory && conf->use_rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use mutually exclusive memory settings for Rx queue");
+			"Attempt to use mutually exclusive memory settings for Rx queue\n");
 		return -EINVAL;
 	}
 	if (conf->force_memory &&
 	    !conf->use_locked_device_memory &&
 	    !conf->use_rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to force Rx queue memory settings, but none is set");
+			"Attempt to force Rx queue memory settings, but none is set\n");
 		return -EINVAL;
 	}
 	if (conf->peer_count == 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for number of peers for Rx queue(=%u), should be: > 0",
+			"Invalid value for number of peers for Rx queue(=%u), should be: > 0\n",
 			conf->peer_count);
 		return -EINVAL;
 	}
@@ -2438,7 +2438,7 @@ rte_eth_rx_hairpin_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 			count++;
 	}
 	if (count > cap.max_nb_queues) {
-		RTE_ETHDEV_LOG(ERR, "To many Rx hairpin queues max is %d",
+		RTE_ETHDEV_LOG(ERR, "To many Rx hairpin queues max is %d\n",
 		cap.max_nb_queues);
 		return -EINVAL;
 	}
@@ -2597,41 +2597,41 @@ rte_eth_tx_hairpin_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 		nb_tx_desc = cap.max_nb_desc;
 	if (nb_tx_desc > cap.max_nb_desc) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for nb_tx_desc(=%hu), should be: <= %hu",
+			"Invalid value for nb_tx_desc(=%hu), should be: <= %hu\n",
 			nb_tx_desc, cap.max_nb_desc);
 		return -EINVAL;
 	}
 	if (conf->peer_count > cap.max_tx_2_rx) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for number of peers for Tx queue(=%u), should be: <= %hu",
+			"Invalid value for number of peers for Tx queue(=%u), should be: <= %hu\n",
 			conf->peer_count, cap.max_tx_2_rx);
 		return -EINVAL;
 	}
 	if (conf->use_locked_device_memory && !cap.tx_cap.locked_device_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use locked device memory for Tx queue, which is not supported");
+			"Attempt to use locked device memory for Tx queue, which is not supported\n");
 		return -EINVAL;
 	}
 	if (conf->use_rte_memory && !cap.tx_cap.rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use DPDK memory for Tx queue, which is not supported");
+			"Attempt to use DPDK memory for Tx queue, which is not supported\n");
 		return -EINVAL;
 	}
 	if (conf->use_locked_device_memory && conf->use_rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use mutually exclusive memory settings for Tx queue");
+			"Attempt to use mutually exclusive memory settings for Tx queue\n");
 		return -EINVAL;
 	}
 	if (conf->force_memory &&
 	    !conf->use_locked_device_memory &&
 	    !conf->use_rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to force Tx queue memory settings, but none is set");
+			"Attempt to force Tx queue memory settings, but none is set\n");
 		return -EINVAL;
 	}
 	if (conf->peer_count == 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for number of peers for Tx queue(=%u), should be: > 0",
+			"Invalid value for number of peers for Tx queue(=%u), should be: > 0\n",
 			conf->peer_count);
 		return -EINVAL;
 	}
@@ -2641,7 +2641,7 @@ rte_eth_tx_hairpin_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 			count++;
 	}
 	if (count > cap.max_nb_queues) {
-		RTE_ETHDEV_LOG(ERR, "To many Tx hairpin queues max is %d",
+		RTE_ETHDEV_LOG(ERR, "To many Tx hairpin queues max is %d\n",
 		cap.max_nb_queues);
 		return -EINVAL;
 	}
@@ -6716,7 +6716,7 @@ rte_eth_ip_reassembly_capability_get(uint16_t port_id,
 	}
 
 	if (reassembly_capa == NULL) {
-		RTE_ETHDEV_LOG(ERR, "Cannot get reassembly capability to NULL");
+		RTE_ETHDEV_LOG(ERR, "Cannot get reassembly capability to NULL\n");
 		return -EINVAL;
 	}
 
@@ -6752,7 +6752,7 @@ rte_eth_ip_reassembly_conf_get(uint16_t port_id,
 	}
 
 	if (conf == NULL) {
-		RTE_ETHDEV_LOG(ERR, "Cannot get reassembly info to NULL");
+		RTE_ETHDEV_LOG(ERR, "Cannot get reassembly info to NULL\n");
 		return -EINVAL;
 	}
 
@@ -6780,7 +6780,7 @@ rte_eth_ip_reassembly_conf_set(uint16_t port_id,
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(ERR,
 			"Device with port_id=%u is not configured.\n"
-			"Cannot set IP reassembly configuration",
+			"Cannot set IP reassembly configuration\n",
 			port_id);
 		return -EINVAL;
 	}
lib/lpm/rte_lpm6.c +3 -3
index 873cc8bc26..24ce7dd022 100644
@@ -280,7 +280,7 @@ rte_lpm6_create(const char *name, int socket_id,
 
 	rules_tbl = rte_hash_create(&rule_hash_tbl_params);
 	if (rules_tbl == NULL) {
-		RTE_LOG(ERR, LPM, "LPM rules hash table allocation failed: %s (%d)",
+		RTE_LOG(ERR, LPM, "LPM rules hash table allocation failed: %s (%d)\n",
 				  rte_strerror(rte_errno), rte_errno);
 		goto fail_wo_unlock;
 	}
@@ -290,7 +290,7 @@ rte_lpm6_create(const char *name, int socket_id,
 			sizeof(uint32_t) * config->number_tbl8s,
 			RTE_CACHE_LINE_SIZE);
 	if (tbl8_pool == NULL) {
-		RTE_LOG(ERR, LPM, "LPM tbl8 pool allocation failed: %s (%d)",
+		RTE_LOG(ERR, LPM, "LPM tbl8 pool allocation failed: %s (%d)\n",
 				  rte_strerror(rte_errno), rte_errno);
 		rte_errno = ENOMEM;
 		goto fail_wo_unlock;
@@ -301,7 +301,7 @@ rte_lpm6_create(const char *name, int socket_id,
 			sizeof(struct rte_lpm_tbl8_hdr) * config->number_tbl8s,
 			RTE_CACHE_LINE_SIZE);
 	if (tbl8_hdrs == NULL) {
-		RTE_LOG(ERR, LPM, "LPM tbl8 headers allocation failed: %s (%d)",
+		RTE_LOG(ERR, LPM, "LPM tbl8 headers allocation failed: %s (%d)\n",
 				  rte_strerror(rte_errno), rte_errno);
 		rte_errno = ENOMEM;
 		goto fail_wo_unlock;
lib/power/guest_channel.c +1 -1
index cc05347425..a6f2097d5b 100644
@@ -90,7 +90,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	flags |= O_NONBLOCK;
 	if (fcntl(fd, F_SETFL, flags) < 0) {
 		RTE_LOG(ERR, GUEST_CHANNEL, "Failed on setting non-blocking mode for "
-				"file %s", fd_path);
+				"file %s\n", fd_path);
 		goto error;
 	}
 	/* QEMU needs a delay after connection */
lib/power/rte_power_pmd_mgmt.c +3 -3
index 38f8384085..6f18ed0adf 100644
@@ -686,7 +686,7 @@ int
 rte_power_pmd_mgmt_set_pause_duration(unsigned int duration)
 {
 	if (duration == 0) {
-		RTE_LOG(ERR, POWER, "Pause duration must be greater than 0, value unchanged");
+		RTE_LOG(ERR, POWER, "Pause duration must be greater than 0, value unchanged\n");
 		return -EINVAL;
 	}
 	pause_duration = duration;
@@ -709,7 +709,7 @@ rte_power_pmd_mgmt_set_scaling_freq_min(unsigned int lcore, unsigned int min)
 	}
 
 	if (min > scale_freq_max[lcore]) {
-		RTE_LOG(ERR, POWER, "Invalid min frequency: Cannot be greater than max frequency");
+		RTE_LOG(ERR, POWER, "Invalid min frequency: Cannot be greater than max frequency\n");
 		return -EINVAL;
 	}
 	scale_freq_min[lcore] = min;
@@ -729,7 +729,7 @@ rte_power_pmd_mgmt_set_scaling_freq_max(unsigned int lcore, unsigned int max)
 	if (max == 0)
 		max = UINT32_MAX;
 	if (max < scale_freq_min[lcore]) {
-		RTE_LOG(ERR, POWER, "Invalid max frequency: Cannot be less than min frequency");
+		RTE_LOG(ERR, POWER, "Invalid max frequency: Cannot be less than min frequency\n");
 		return -EINVAL;
 	}
 
Signature · 1 line
2.43.0
#88 lore raw

PATCH v4 5/14 lib: remove redundant newline from logs

In reply to David Marchand

Fix places where two newline characters may be logged.

---
Changes since RFC v1:
- split fixes on direct calls to printf or RTE_LOG in a previous patch,

---
 drivers/crypto/ipsec_mb/ipsec_mb_ops.c  |   2 +-
 lib/bbdev/rte_bbdev.c                   |   6 +-
 lib/cfgfile/rte_cfgfile.c               |  14 ++--
 lib/compressdev/rte_compressdev_pmd.c   |   4 +-
 lib/cryptodev/rte_cryptodev.c           |   2 +-
 lib/dispatcher/rte_dispatcher.c         |  12 +--
 lib/dmadev/rte_dmadev.c                 |   2 +-
 lib/eal/windows/eal_memory.c            |   2 +-
 lib/eventdev/eventdev_pmd.h             |   6 +-
 lib/eventdev/rte_event_crypto_adapter.c |  12 +--
 lib/eventdev/rte_event_dma_adapter.c    |  14 ++--
 lib/eventdev/rte_event_eth_rx_adapter.c |  28 +++----
 lib/eventdev/rte_event_eth_tx_adapter.c |   2 +-
 lib/eventdev/rte_event_timer_adapter.c  |   4 +-
 lib/eventdev/rte_eventdev.c             |   4 +-
 lib/metrics/rte_metrics_telemetry.c     |   2 +-
 lib/mldev/rte_mldev.c                   | 102 ++++++++++++------------
 lib/net/rte_net_crc.c                   |   6 +-
 lib/node/ethdev_rx.c                    |   4 +-
 lib/node/ip4_lookup.c                   |   2 +-
 lib/node/ip6_lookup.c                   |   2 +-
 lib/node/kernel_rx.c                    |   8 +-
 lib/node/kernel_tx.c                    |   4 +-
 lib/rcu/rte_rcu_qsbr.c                  |   4 +-
 lib/rcu/rte_rcu_qsbr.h                  |   8 +-
 lib/stack/rte_stack.c                   |   8 +-
 lib/vhost/vhost_crypto.c                |   6 +-
 27 files changed, 135 insertions(+), 135 deletions(-)
drivers/crypto/ipsec_mb/ipsec_mb_ops.c +1 -1
index 52d6d010c7..f21f9cc5a0 100644
@@ -407,7 +407,7 @@ ipsec_mb_ipc_request(const struct rte_mp_msg *mp_msg, const void *peer)
 		resp_param->result = ipsec_mb_qp_release(dev, qp_id);
 		break;
 	default:
-		CDEV_LOG_ERR("invalid mp request type\n");
+		CDEV_LOG_ERR("invalid mp request type");
 	}
 
 out:
lib/bbdev/rte_bbdev.c +3 -3
index cfebea09c7..e09bb97abb 100644
@@ -1106,12 +1106,12 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
 
 	intr_handle = dev->intr_handle;
 	if (intr_handle == NULL) {
-		rte_bbdev_log(ERR, "Device %u intr handle unset\n", dev_id);
+		rte_bbdev_log(ERR, "Device %u intr handle unset", dev_id);
 		return -ENOTSUP;
 	}
 
 	if (queue_id >= RTE_MAX_RXTX_INTR_VEC_ID) {
-		rte_bbdev_log(ERR, "Device %u queue_id %u is too big\n",
+		rte_bbdev_log(ERR, "Device %u queue_id %u is too big",
 				dev_id, queue_id);
 		return -ENOTSUP;
 	}
@@ -1120,7 +1120,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
 	ret = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
 	if (ret && (ret != -EEXIST)) {
 		rte_bbdev_log(ERR,
-				"dev %u q %u int ctl error op %d epfd %d vec %u\n",
+				"dev %u q %u int ctl error op %d epfd %d vec %u",
 				dev_id, queue_id, op, epfd, vec);
 		return ret;
 	}
lib/cfgfile/rte_cfgfile.c +7 -7
index eefba6e408..2f9cc0722a 100644
@@ -137,7 +137,7 @@ rte_cfgfile_check_params(const struct rte_cfgfile_parameters *params)
 	unsigned int i;
 
 	if (!params) {
-		CFG_LOG(ERR, "missing cfgfile parameters\n");
+		CFG_LOG(ERR, "missing cfgfile parameters");
 		return -EINVAL;
 	}
 
@@ -150,7 +150,7 @@ rte_cfgfile_check_params(const struct rte_cfgfile_parameters *params)
 	}
 
 	if (valid_comment == 0)	{
-		CFG_LOG(ERR, "invalid comment characters %c\n",
+		CFG_LOG(ERR, "invalid comment characters %c",
 		       params->comment_character);
 		return -ENOTSUP;
 	}
@@ -188,7 +188,7 @@ rte_cfgfile_load_with_params(const char *filename, int flags,
 		lineno++;
 		if ((len >= sizeof(buffer) - 1) && (buffer[len-1] != '\n')) {
 			CFG_LOG(ERR, " line %d - no \\n found on string. "
-					"Check if line too long\n", lineno);
+					"Check if line too long", lineno);
 			goto error1;
 		}
 		/* skip parsing if comment character found */
@@ -209,7 +209,7 @@ rte_cfgfile_load_with_params(const char *filename, int flags,
 			char *end = memchr(buffer, ']', len);
 			if (end == NULL) {
 				CFG_LOG(ERR,
-					"line %d - no terminating ']' character found\n",
+					"line %d - no terminating ']' character found",
 					lineno);
 				goto error1;
 			}
@@ -225,7 +225,7 @@ rte_cfgfile_load_with_params(const char *filename, int flags,
 			split[1] = memchr(buffer, '=', len);
 			if (split[1] == NULL) {
 				CFG_LOG(ERR,
-					"line %d - no '=' character found\n",
+					"line %d - no '=' character found",
 					lineno);
 				goto error1;
 			}
@@ -249,7 +249,7 @@ rte_cfgfile_load_with_params(const char *filename, int flags,
 			if (!(flags & CFG_FLAG_EMPTY_VALUES) &&
 					(*split[1] == '\0')) {
 				CFG_LOG(ERR,
-					"line %d - cannot use empty values\n",
+					"line %d - cannot use empty values",
 					lineno);
 				goto error1;
 			}
@@ -414,7 +414,7 @@ int rte_cfgfile_set_entry(struct rte_cfgfile *cfg, const char *sectionname,
 			return 0;
 		}
 
-	CFG_LOG(ERR, "entry name doesn't exist\n");
+	CFG_LOG(ERR, "entry name doesn't exist");
 	return -EINVAL;
 }
 
lib/compressdev/rte_compressdev_pmd.c +2 -2
index 156bccd972..762b44f03e 100644
@@ -100,12 +100,12 @@ rte_compressdev_pmd_create(const char *name,
 	struct rte_compressdev *compressdev;
 
 	if (params->name[0] != '\0') {
-		COMPRESSDEV_LOG(INFO, "User specified device name = %s\n",
+		COMPRESSDEV_LOG(INFO, "User specified device name = %s",
 				params->name);
 		name = params->name;
 	}
 
-	COMPRESSDEV_LOG(INFO, "Creating compressdev %s\n", name);
+	COMPRESSDEV_LOG(INFO, "Creating compressdev %s", name);
 
 	COMPRESSDEV_LOG(INFO, "Init parameters - name: %s, socket id: %d",
 			name, params->socket_id);
lib/cryptodev/rte_cryptodev.c +1 -1
index ead8c9a623..b233c0ecd7 100644
@@ -2074,7 +2074,7 @@ rte_cryptodev_sym_session_create(uint8_t dev_id,
 	}
 
 	if (xforms == NULL) {
-		CDEV_LOG_ERR("Invalid xform\n");
+		CDEV_LOG_ERR("Invalid xform");
 		rte_errno = EINVAL;
 		return NULL;
 	}
lib/dispatcher/rte_dispatcher.c +6 -6
index 10d02edde9..95dd41b818 100644
@@ -246,7 +246,7 @@ evd_service_register(struct rte_dispatcher *dispatcher)
 	rc = rte_service_component_register(&service, &dispatcher->service_id);
 	if (rc != 0)
 		RTE_EDEV_LOG_ERR("Registration of dispatcher service "
-				 "%s failed with error code %d\n",
+				 "%s failed with error code %d",
 				 service.name, rc);
 
 	return rc;
@@ -260,7 +260,7 @@ evd_service_unregister(struct rte_dispatcher *dispatcher)
 	rc = rte_service_component_unregister(dispatcher->service_id);
 	if (rc != 0)
 		RTE_EDEV_LOG_ERR("Unregistration of dispatcher service "
-				 "failed with error code %d\n", rc);
+				 "failed with error code %d", rc);
 
 	return rc;
 }
@@ -279,7 +279,7 @@ rte_dispatcher_create(uint8_t event_dev_id)
 				  RTE_CACHE_LINE_SIZE, socket_id);
 
 	if (dispatcher == NULL) {
-		RTE_EDEV_LOG_ERR("Unable to allocate memory for dispatcher\n");
+		RTE_EDEV_LOG_ERR("Unable to allocate memory for dispatcher");
 		rte_errno = ENOMEM;
 		return NULL;
 	}
@@ -483,7 +483,7 @@ evd_lcore_uninstall_handler(struct rte_dispatcher_lcore *lcore,
 	unreg_handler = evd_lcore_get_handler_by_id(lcore, handler_id);
 
 	if (unreg_handler == NULL) {
-		RTE_EDEV_LOG_ERR("Invalid handler id %d\n", handler_id);
+		RTE_EDEV_LOG_ERR("Invalid handler id %d", handler_id);
 		return -EINVAL;
 	}
 
@@ -602,7 +602,7 @@ rte_dispatcher_finalize_unregister(struct rte_dispatcher *dispatcher,
 	unreg_finalizer = evd_get_finalizer_by_id(dispatcher, finalizer_id);
 
 	if (unreg_finalizer == NULL) {
-		RTE_EDEV_LOG_ERR("Invalid finalizer id %d\n", finalizer_id);
+		RTE_EDEV_LOG_ERR("Invalid finalizer id %d", finalizer_id);
 		return -EINVAL;
 	}
 
@@ -636,7 +636,7 @@ evd_set_service_runstate(struct rte_dispatcher *dispatcher, int state)
 	 */
 	if (rc != 0)
 		RTE_EDEV_LOG_ERR("Unexpected error %d occurred while setting "
-				 "service component run state to %d\n", rc,
+				 "service component run state to %d", rc,
 				 state);
 
 	RTE_VERIFY(rc == 0);
lib/dmadev/rte_dmadev.c +1 -1
index 4e5e420c82..009a21849a 100644
@@ -726,7 +726,7 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
 		return -EINVAL;
 
 	if (vchan >= dev->data->dev_conf.nb_vchans) {
-		RTE_DMA_LOG(ERR, "Device %u vchan %u out of range\n", dev_id, vchan);
+		RTE_DMA_LOG(ERR, "Device %u vchan %u out of range", dev_id, vchan);
 		return -EINVAL;
 	}
 
lib/eal/windows/eal_memory.c +1 -1
index 31410a41fd..fd39155163 100644
@@ -110,7 +110,7 @@ eal_mem_win32api_init(void)
 	VirtualAlloc2_ptr = (VirtualAlloc2_type)(
 		(void *)GetProcAddress(library, function));
 	if (VirtualAlloc2_ptr == NULL) {
-		RTE_LOG_WIN32_ERR("GetProcAddress(\"%s\", \"%s\")\n",
+		RTE_LOG_WIN32_ERR("GetProcAddress(\"%s\", \"%s\")",
 			library_name, function);
 
 		/* Contrary to the docs, Server 2016 is not supported. */
lib/eventdev/eventdev_pmd.h +3 -3
index 30bd90085c..2ec5aec0a8 100644
@@ -49,14 +49,14 @@ extern "C" {
 /* Macros to check for valid device */
 #define RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, retval) do { \
 	if (!rte_event_pmd_is_valid_dev((dev_id))) { \
-		RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
+		RTE_EDEV_LOG_ERR("Invalid dev_id=%d", dev_id); \
 		return retval; \
 	} \
 } while (0)
 
 #define RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, errno, retval) do { \
 	if (!rte_event_pmd_is_valid_dev((dev_id))) { \
-		RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
+		RTE_EDEV_LOG_ERR("Invalid dev_id=%d", dev_id); \
 		rte_errno = errno; \
 		return retval; \
 	} \
@@ -64,7 +64,7 @@ extern "C" {
 
 #define RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id) do { \
 	if (!rte_event_pmd_is_valid_dev((dev_id))) { \
-		RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
+		RTE_EDEV_LOG_ERR("Invalid dev_id=%d", dev_id); \
 		return; \
 	} \
 } while (0)
lib/eventdev/rte_event_crypto_adapter.c +6 -6
index 1b435c9f0e..d46595d190 100644
@@ -133,7 +133,7 @@ static struct event_crypto_adapter **event_crypto_adapter;
 /* Macros to check for valid adapter */
 #define EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) do { \
 	if (!eca_valid_id(id)) { \
-		RTE_EDEV_LOG_ERR("Invalid crypto adapter id = %d\n", id); \
+		RTE_EDEV_LOG_ERR("Invalid crypto adapter id = %d", id); \
 		return retval; \
 	} \
 } while (0)
@@ -309,7 +309,7 @@ eca_default_config_cb(uint8_t id, uint8_t dev_id,
 
 	ret = rte_event_dev_configure(dev_id, &dev_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("failed to configure event dev %u\n", dev_id);
+		RTE_EDEV_LOG_ERR("failed to configure event dev %u", dev_id);
 		if (started) {
 			if (rte_event_dev_start(dev_id))
 				return -EIO;
@@ -319,7 +319,7 @@ eca_default_config_cb(uint8_t id, uint8_t dev_id,
 
 	ret = rte_event_port_setup(dev_id, port_id, port_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("failed to setup event port %u\n", port_id);
+		RTE_EDEV_LOG_ERR("failed to setup event port %u", port_id);
 		return ret;
 	}
 
@@ -391,7 +391,7 @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id,
 					sizeof(struct crypto_device_info), 0,
 					socket_id);
 	if (adapter->cdevs == NULL) {
-		RTE_EDEV_LOG_ERR("Failed to get mem for crypto devices\n");
+		RTE_EDEV_LOG_ERR("Failed to get mem for crypto devices");
 		eca_circular_buffer_free(&adapter->ebuf);
 		rte_free(adapter);
 		return -ENOMEM;
@@ -1403,7 +1403,7 @@ rte_event_crypto_adapter_runtime_params_set(uint8_t id,
 	EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
 
 	if (params == NULL) {
-		RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+		RTE_EDEV_LOG_ERR("params pointer is NULL");
 		return -EINVAL;
 	}
 
@@ -1436,7 +1436,7 @@ rte_event_crypto_adapter_runtime_params_get(uint8_t id,
 	EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
 
 	if (params == NULL) {
-		RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+		RTE_EDEV_LOG_ERR("params pointer is NULL");
 		return -EINVAL;
 	}
 
lib/eventdev/rte_event_dma_adapter.c +7 -7
index cbf9405438..4196164305 100644
@@ -20,7 +20,7 @@
 #define EVENT_DMA_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) \
 	do { \
 		if (!edma_adapter_valid_id(id)) { \
-			RTE_EDEV_LOG_ERR("Invalid DMA adapter id = %d\n", id); \
+			RTE_EDEV_LOG_ERR("Invalid DMA adapter id = %d", id); \
 			return retval; \
 		} \
 	} while (0)
@@ -313,7 +313,7 @@ edma_default_config_cb(uint8_t id, uint8_t evdev_id, struct rte_event_dma_adapte
 
 	ret = rte_event_dev_configure(evdev_id, &dev_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("Failed to configure event dev %u\n", evdev_id);
+		RTE_EDEV_LOG_ERR("Failed to configure event dev %u", evdev_id);
 		if (started) {
 			if (rte_event_dev_start(evdev_id))
 				return -EIO;
@@ -323,7 +323,7 @@ edma_default_config_cb(uint8_t id, uint8_t evdev_id, struct rte_event_dma_adapte
 
 	ret = rte_event_port_setup(evdev_id, port_id, port_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("Failed to setup event port %u\n", port_id);
+		RTE_EDEV_LOG_ERR("Failed to setup event port %u", port_id);
 		return ret;
 	}
 
@@ -407,7 +407,7 @@ rte_event_dma_adapter_create_ext(uint8_t id, uint8_t evdev_id,
 					       num_dma_dev * sizeof(struct dma_device_info), 0,
 					       socket_id);
 	if (adapter->dma_devs == NULL) {
-		RTE_EDEV_LOG_ERR("Failed to get memory for DMA devices\n");
+		RTE_EDEV_LOG_ERR("Failed to get memory for DMA devices");
 		edma_circular_buffer_free(&adapter->ebuf);
 		rte_free(adapter);
 		return -ENOMEM;
@@ -417,7 +417,7 @@ rte_event_dma_adapter_create_ext(uint8_t id, uint8_t evdev_id,
 	for (i = 0; i < num_dma_dev; i++) {
 		ret = rte_dma_info_get(i, &info);
 		if (ret) {
-			RTE_EDEV_LOG_ERR("Failed to get dma device info\n");
+			RTE_EDEV_LOG_ERR("Failed to get dma device info");
 			edma_circular_buffer_free(&adapter->ebuf);
 			rte_free(adapter);
 			return ret;
@@ -1297,7 +1297,7 @@ rte_event_dma_adapter_runtime_params_set(uint8_t id,
 	EVENT_DMA_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
 
 	if (params == NULL) {
-		RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+		RTE_EDEV_LOG_ERR("params pointer is NULL");
 		return -EINVAL;
 	}
 
@@ -1326,7 +1326,7 @@ rte_event_dma_adapter_runtime_params_get(uint8_t id,
 	EVENT_DMA_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
 
 	if (params == NULL) {
-		RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+		RTE_EDEV_LOG_ERR("params pointer is NULL");
 		return -EINVAL;
 	}
 
lib/eventdev/rte_event_eth_rx_adapter.c +14 -14
index 82ae31712d..1b83a55b5c 100644
@@ -293,14 +293,14 @@ rxa_event_buf_get(struct event_eth_rx_adapter *rx_adapter, uint16_t eth_dev_id,
 
 #define RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) do { \
 	if (!rxa_validate_id(id)) { \
-		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d\n", id); \
+		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \
 		return retval; \
 	} \
 } while (0)
 
 #define RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_GOTO_ERR_RET(id, retval) do { \
 	if (!rxa_validate_id(id)) { \
-		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d\n", id); \
+		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \
 		ret = retval; \
 		goto error; \
 	} \
@@ -308,7 +308,7 @@ rxa_event_buf_get(struct event_eth_rx_adapter *rx_adapter, uint16_t eth_dev_id,
 
 #define RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, retval) do { \
 	if ((token) == NULL || strlen(token) == 0 || !isdigit(*token)) { \
-		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter token\n"); \
+		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter token"); \
 		ret = retval; \
 		goto error; \
 	} \
@@ -1540,7 +1540,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
 
 	ret = rte_event_dev_configure(dev_id, &dev_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("failed to configure event dev %u\n",
+		RTE_EDEV_LOG_ERR("failed to configure event dev %u",
 						dev_id);
 		if (started) {
 			if (rte_event_dev_start(dev_id))
@@ -1551,7 +1551,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
 
 	ret = rte_event_port_setup(dev_id, port_id, port_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("failed to setup event port %u\n",
+		RTE_EDEV_LOG_ERR("failed to setup event port %u",
 					port_id);
 		return ret;
 	}
@@ -1628,7 +1628,7 @@ rxa_create_intr_thread(struct event_eth_rx_adapter *rx_adapter)
 	if (!err)
 		return 0;
 
-	RTE_EDEV_LOG_ERR("Failed to create interrupt thread err = %d\n", err);
+	RTE_EDEV_LOG_ERR("Failed to create interrupt thread err = %d", err);
 	rte_free(rx_adapter->epoll_events);
 error:
 	rte_ring_free(rx_adapter->intr_ring);
@@ -1644,12 +1644,12 @@ rxa_destroy_intr_thread(struct event_eth_rx_adapter *rx_adapter)
 
 	err = pthread_cancel((pthread_t)rx_adapter->rx_intr_thread.opaque_id);
 	if (err)
-		RTE_EDEV_LOG_ERR("Can't cancel interrupt thread err = %d\n",
+		RTE_EDEV_LOG_ERR("Can't cancel interrupt thread err = %d",
 				err);
 
 	err = rte_thread_join(rx_adapter->rx_intr_thread, NULL);
 	if (err)
-		RTE_EDEV_LOG_ERR("Can't join interrupt thread err = %d\n", err);
+		RTE_EDEV_LOG_ERR("Can't join interrupt thread err = %d", err);
 
 	rte_free(rx_adapter->epoll_events);
 	rte_ring_free(rx_adapter->intr_ring);
@@ -1915,7 +1915,7 @@ rxa_init_service(struct event_eth_rx_adapter *rx_adapter, uint8_t id)
 	if (rte_mbuf_dyn_rx_timestamp_register(
 			&event_eth_rx_timestamp_dynfield_offset,
 			&event_eth_rx_timestamp_dynflag) != 0) {
-		RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf\n");
+		RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf");
 		return -rte_errno;
 	}
 
@@ -2445,7 +2445,7 @@ rxa_create(uint8_t id, uint8_t dev_id,
 			    RTE_DIM(default_rss_key));
 
 	if (rx_adapter->eth_devices == NULL) {
-		RTE_EDEV_LOG_ERR("failed to get mem for eth devices\n");
+		RTE_EDEV_LOG_ERR("failed to get mem for eth devices");
 		rte_free(rx_adapter);
 		return -ENOMEM;
 	}
@@ -2497,12 +2497,12 @@ rxa_config_params_validate(struct rte_event_eth_rx_adapter_params *rxa_params,
 		return 0;
 	} else if (!rxa_params->use_queue_event_buf &&
 		    rxa_params->event_buf_size == 0) {
-		RTE_EDEV_LOG_ERR("event buffer size can't be zero\n");
+		RTE_EDEV_LOG_ERR("event buffer size can't be zero");
 		return -EINVAL;
 	} else if (rxa_params->use_queue_event_buf &&
 		   rxa_params->event_buf_size != 0) {
 		RTE_EDEV_LOG_ERR("event buffer size needs to be configured "
-				 "as part of queue add\n");
+				 "as part of queue add");
 		return -EINVAL;
 	}
 
@@ -3597,7 +3597,7 @@ handle_rxa_stats(const char *cmd __rte_unused,
 	/* Get Rx adapter stats */
 	if (rte_event_eth_rx_adapter_stats_get(rx_adapter_id,
 					       &rx_adptr_stats)) {
-		RTE_EDEV_LOG_ERR("Failed to get Rx adapter stats\n");
+		RTE_EDEV_LOG_ERR("Failed to get Rx adapter stats");
 		return -1;
 	}
 
@@ -3636,7 +3636,7 @@ handle_rxa_stats_reset(const char *cmd __rte_unused,
 
 	/* Reset Rx adapter stats */
 	if (rte_event_eth_rx_adapter_stats_reset(rx_adapter_id)) {
-		RTE_EDEV_LOG_ERR("Failed to reset Rx adapter stats\n");
+		RTE_EDEV_LOG_ERR("Failed to reset Rx adapter stats");
 		return -1;
 	}
 
lib/eventdev/rte_event_eth_tx_adapter.c +1 -1
index 360d5caf6a..56435be991 100644
@@ -334,7 +334,7 @@ txa_service_conf_cb(uint8_t __rte_unused id, uint8_t dev_id,
 
 	ret = rte_event_port_setup(dev_id, port_id, pc);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("failed to setup event port %u\n",
+		RTE_EDEV_LOG_ERR("failed to setup event port %u",
 					port_id);
 		if (started) {
 			if (rte_event_dev_start(dev_id))
lib/eventdev/rte_event_timer_adapter.c +2 -2
index 27466707bc..3f22e85173 100644
@@ -106,7 +106,7 @@ default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id,
 
 	ret = rte_event_dev_configure(dev_id, &dev_conf);
 	if (ret < 0) {
-		EVTIM_LOG_ERR("failed to configure event dev %u\n", dev_id);
+		EVTIM_LOG_ERR("failed to configure event dev %u", dev_id);
 		if (started)
 			if (rte_event_dev_start(dev_id))
 				return -EIO;
@@ -116,7 +116,7 @@ default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id,
 
 	ret = rte_event_port_setup(dev_id, port_id, port_conf);
 	if (ret < 0) {
-		EVTIM_LOG_ERR("failed to setup event port %u on event dev %u\n",
+		EVTIM_LOG_ERR("failed to setup event port %u on event dev %u",
 			      port_id, dev_id);
 		return ret;
 	}
lib/eventdev/rte_eventdev.c +2 -2
index ae50821a3f..157752868d 100644
@@ -1007,13 +1007,13 @@ rte_event_port_profile_links_set(uint8_t dev_id, uint8_t port_id, const uint8_t
 	}
 
 	if (*dev->dev_ops->port_link == NULL) {
-		RTE_EDEV_LOG_ERR("Function not supported\n");
+		RTE_EDEV_LOG_ERR("Function not supported");
 		rte_errno = ENOTSUP;
 		return 0;
 	}
 
 	if (profile_id && *dev->dev_ops->port_link_profile == NULL) {
-		RTE_EDEV_LOG_ERR("Function not supported\n");
+		RTE_EDEV_LOG_ERR("Function not supported");
 		rte_errno = ENOTSUP;
 		return 0;
 	}
lib/metrics/rte_metrics_telemetry.c +1 -1
index 5be21b2e86..1d133e1f8c 100644
@@ -363,7 +363,7 @@ rte_metrics_tel_stat_names_to_ids(const char * const *stat_names,
 			}
 		}
 		if (j == num_metrics) {
-			METRICS_LOG_WARN("Invalid stat name %s\n",
+			METRICS_LOG_WARN("Invalid stat name %s",
 					stat_names[i]);
 			free(names);
 			return -EINVAL;
lib/mldev/rte_mldev.c +51 -51

394 lines not on this page · raw message

lib/net/rte_net_crc.c +3 -3
index a685f9e7bb..900d6de7f4 100644
@@ -179,7 +179,7 @@ avx512_vpclmulqdq_get_handlers(void)
 			max_simd_bitwidth >= RTE_VECT_SIMD_512)
 		return handlers_avx512;
 #endif
-	NET_LOG(INFO, "Requirements not met, can't use AVX512\n");
+	NET_LOG(INFO, "Requirements not met, can't use AVX512");
 	return NULL;
 }
 
@@ -205,7 +205,7 @@ sse42_pclmulqdq_get_handlers(void)
 			max_simd_bitwidth >= RTE_VECT_SIMD_128)
 		return handlers_sse42;
 #endif
-	NET_LOG(INFO, "Requirements not met, can't use SSE\n");
+	NET_LOG(INFO, "Requirements not met, can't use SSE");
 	return NULL;
 }
 
@@ -231,7 +231,7 @@ neon_pmull_get_handlers(void)
 			max_simd_bitwidth >= RTE_VECT_SIMD_128)
 		return handlers_neon;
 #endif
-	NET_LOG(INFO, "Requirements not met, can't use NEON\n");
+	NET_LOG(INFO, "Requirements not met, can't use NEON");
 	return NULL;
 }
 
lib/node/ethdev_rx.c +2 -2
index 3e8fac1df4..475eff6abe 100644
@@ -160,13 +160,13 @@ ethdev_ptype_setup(uint16_t port, uint16_t queue)
 
 	if (!l3_ipv4 || !l3_ipv6) {
 		node_info("ethdev_rx",
-			  "Enabling ptype callback for required ptypes on port %u\n",
+			  "Enabling ptype callback for required ptypes on port %u",
 			  port);
 
 		if (!rte_eth_add_rx_callback(port, queue, eth_pkt_parse_cb,
 					     NULL)) {
 			node_err("ethdev_rx",
-				 "Failed to add rx ptype cb: port=%d, queue=%d\n",
+				 "Failed to add rx ptype cb: port=%d, queue=%d",
 				 port, queue);
 			return -EINVAL;
 		}
lib/node/ip4_lookup.c +1 -1
index 0dbfde64fe..18955971f6 100644
@@ -143,7 +143,7 @@ rte_node_ip4_route_add(uint32_t ip, uint8_t depth, uint16_t next_hop,
 				  ip, depth, val);
 		if (ret < 0) {
 			node_err("ip4_lookup",
-				 "Unable to add entry %s / %d nh (%x) to LPM table on sock %d, rc=%d\n",
+				 "Unable to add entry %s / %d nh (%x) to LPM table on sock %d, rc=%d",
 				 abuf, depth, val, socket, ret);
 			return ret;
 		}
lib/node/ip6_lookup.c +1 -1
index 6f56eb5ec5..309964f60f 100644
@@ -283,7 +283,7 @@ rte_node_ip6_route_add(const uint8_t *ip, uint8_t depth, uint16_t next_hop,
 		if (ret < 0) {
 			node_err("ip6_lookup",
 				 "Unable to add entry %s / %d nh (%x) to LPM "
-				 "table on sock %d, rc=%d\n",
+				 "table on sock %d, rc=%d",
 				 abuf, depth, val, socket, ret);
 			return ret;
 		}
lib/node/kernel_rx.c +4 -4
index 2dba7c8cc7..6c20cdbb1e 100644
@@ -134,7 +134,7 @@ kernel_rx_node_do(struct rte_graph *graph, struct rte_node *node, kernel_rx_node
 			if (len == 0 || len == 0xFFFF) {
 				rte_pktmbuf_free(m);
 				if (rx->idx <= 0)
-					node_dbg("kernel_rx", "rx_mbuf array is empty\n");
+					node_dbg("kernel_rx", "rx_mbuf array is empty");
 				rx->idx--;
 				break;
 			}
@@ -207,20 +207,20 @@ kernel_rx_node_init(const struct rte_graph *graph, struct rte_node *node)
 	RTE_VERIFY(elem != NULL);
 
 	if (ctx->pktmbuf_pool == NULL) {
-		node_err("kernel_rx", "Invalid mbuf pool on graph %s\n", graph->name);
+		node_err("kernel_rx", "Invalid mbuf pool on graph %s", graph->name);
 		return -EINVAL;
 	}
 
 	recv_info = rte_zmalloc_socket("kernel_rx_info", sizeof(kernel_rx_info_t),
 				       RTE_CACHE_LINE_SIZE, graph->socket);
 	if (!recv_info) {
-		node_err("kernel_rx", "Kernel recv_info is NULL\n");
+		node_err("kernel_rx", "Kernel recv_info is NULL");
 		return -ENOMEM;
 	}
 
 	sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
 	if (sock < 0) {
-		node_err("kernel_rx", "Unable to open RAW socket\n");
+		node_err("kernel_rx", "Unable to open RAW socket");
 		return sock;
 	}
 
lib/node/kernel_tx.c +2 -2
index 27d1808c71..3a96741622 100644
@@ -36,7 +36,7 @@ kernel_tx_process_mbuf(struct rte_node *node, struct rte_mbuf **mbufs, uint16_t
 		sin.sin_addr.s_addr = ip4->dst_addr;
 
 		if (sendto(ctx->sock, buf, len, 0, (struct sockaddr *)&sin, sizeof(sin)) < 0)
-			node_err("kernel_tx", "Unable to send packets: %s\n", strerror(errno));
+			node_err("kernel_tx", "Unable to send packets: %s", strerror(errno));
 	}
 }
 
@@ -87,7 +87,7 @@ kernel_tx_node_init(const struct rte_graph *graph __rte_unused, struct rte_node
 
 	ctx->sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
 	if (ctx->sock < 0)
-		node_err("kernel_tx", "Unable to open RAW socket\n");
+		node_err("kernel_tx", "Unable to open RAW socket");
 
 	return 0;
 }
lib/rcu/rte_rcu_qsbr.c +2 -2
index a9f3d6cc98..41a44be4b9 100644
@@ -92,7 +92,7 @@ rte_rcu_qsbr_thread_register(struct rte_rcu_qsbr *v, unsigned int thread_id)
 		return 1;
 	}
 
-	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u\n",
+	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u",
 				v->qsbr_cnt[thread_id].lock_cnt);
 
 	id = thread_id & __RTE_QSBR_THRID_MASK;
@@ -144,7 +144,7 @@ rte_rcu_qsbr_thread_unregister(struct rte_rcu_qsbr *v, unsigned int thread_id)
 		return 1;
 	}
 
-	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u\n",
+	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u",
 				v->qsbr_cnt[thread_id].lock_cnt);
 
 	id = thread_id & __RTE_QSBR_THRID_MASK;
lib/rcu/rte_rcu_qsbr.h +4 -4
index 5979fb0efb..6b908e7ee0 100644
@@ -299,7 +299,7 @@ rte_rcu_qsbr_thread_online(struct rte_rcu_qsbr *v, unsigned int thread_id)
 
 	RTE_ASSERT(v != NULL && thread_id < v->max_threads);
 
-	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u\n",
+	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u",
 				v->qsbr_cnt[thread_id].lock_cnt);
 
 	/* Copy the current value of token.
@@ -350,7 +350,7 @@ rte_rcu_qsbr_thread_offline(struct rte_rcu_qsbr *v, unsigned int thread_id)
 {
 	RTE_ASSERT(v != NULL && thread_id < v->max_threads);
 
-	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u\n",
+	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u",
 				v->qsbr_cnt[thread_id].lock_cnt);
 
 	/* The reader can go offline only after the load of the
@@ -427,7 +427,7 @@ rte_rcu_qsbr_unlock(__rte_unused struct rte_rcu_qsbr *v,
 				1, rte_memory_order_release);
 
 	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, WARNING,
-				"Lock counter %u. Nested locks?\n",
+				"Lock counter %u. Nested locks?",
 				v->qsbr_cnt[thread_id].lock_cnt);
 #endif
 }
@@ -481,7 +481,7 @@ rte_rcu_qsbr_quiescent(struct rte_rcu_qsbr *v, unsigned int thread_id)
 
 	RTE_ASSERT(v != NULL && thread_id < v->max_threads);
 
-	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u\n",
+	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u",
 				v->qsbr_cnt[thread_id].lock_cnt);
 
 	/* Acquire the changes to the shared data structure released
lib/stack/rte_stack.c +4 -4
index 1fabec2bfe..1dab6d6645 100644
@@ -56,7 +56,7 @@ rte_stack_create(const char *name, unsigned int count, int socket_id,
 	int ret;
 
 	if (flags & ~(RTE_STACK_F_LF)) {
-		STACK_LOG_ERR("Unsupported stack flags %#x\n", flags);
+		STACK_LOG_ERR("Unsupported stack flags %#x", flags);
 		return NULL;
 	}
 
@@ -65,7 +65,7 @@ rte_stack_create(const char *name, unsigned int count, int socket_id,
 #endif
 #if !defined(RTE_STACK_LF_SUPPORTED)
 	if (flags & RTE_STACK_F_LF) {
-		STACK_LOG_ERR("Lock-free stack is not supported on your platform\n");
+		STACK_LOG_ERR("Lock-free stack is not supported on your platform");
 		rte_errno = ENOTSUP;
 		return NULL;
 	}
@@ -82,7 +82,7 @@ rte_stack_create(const char *name, unsigned int count, int socket_id,
 
 	te = rte_zmalloc("STACK_TAILQ_ENTRY", sizeof(*te), 0);
 	if (te == NULL) {
-		STACK_LOG_ERR("Cannot reserve memory for tailq\n");
+		STACK_LOG_ERR("Cannot reserve memory for tailq");
 		rte_errno = ENOMEM;
 		return NULL;
 	}
@@ -92,7 +92,7 @@ rte_stack_create(const char *name, unsigned int count, int socket_id,
 	mz = rte_memzone_reserve_aligned(mz_name, sz, socket_id,
 					 0, __alignof__(*s));
 	if (mz == NULL) {
-		STACK_LOG_ERR("Cannot reserve stack memzone!\n");
+		STACK_LOG_ERR("Cannot reserve stack memzone!");
 		rte_mcfg_tailq_write_unlock();
 		rte_free(te);
 		return NULL;
lib/vhost/vhost_crypto.c +3 -3
index 3e1ef1ac25..6e5443e5f8 100644
@@ -245,7 +245,7 @@ transform_cipher_param(struct rte_crypto_sym_xform *xform,
 		return ret;
 
 	if (param->cipher_key_len > VHOST_USER_CRYPTO_MAX_CIPHER_KEY_LENGTH) {
-		VC_LOG_DBG("Invalid cipher key length\n");
+		VC_LOG_DBG("Invalid cipher key length");
 		return -VIRTIO_CRYPTO_BADMSG;
 	}
 
@@ -301,7 +301,7 @@ transform_chain_param(struct rte_crypto_sym_xform *xforms,
 		return ret;
 
 	if (param->cipher_key_len > VHOST_USER_CRYPTO_MAX_CIPHER_KEY_LENGTH) {
-		VC_LOG_DBG("Invalid cipher key length\n");
+		VC_LOG_DBG("Invalid cipher key length");
 		return -VIRTIO_CRYPTO_BADMSG;
 	}
 
@@ -321,7 +321,7 @@ transform_chain_param(struct rte_crypto_sym_xform *xforms,
 		return ret;
 
 	if (param->auth_key_len > VHOST_USER_CRYPTO_MAX_HMAC_KEY_LENGTH) {
-		VC_LOG_DBG("Invalid auth key length\n");
+		VC_LOG_DBG("Invalid auth key length");
 		return -VIRTIO_CRYPTO_BADMSG;
 	}
 
Signature · 1 line
2.43.0
#89 lore raw

PATCH v4 6/14 eal/linux: remove log paraphrasing the doc

In reply to David Marchand

An error log message does not need to paraphrase the DPDK documentation.

---
 lib/eal/linux/eal_timer.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
lib/eal/linux/eal_timer.c +1 -5
index 3a30284e3a..df9ad61ae9 100644
@@ -152,11 +152,7 @@ rte_eal_hpet_init(int make_default)
 	}
 	eal_hpet = mmap(NULL, 1024, PROT_READ, MAP_SHARED, fd, 0);
 	if (eal_hpet == MAP_FAILED) {
-		RTE_LOG(ERR, EAL, "ERROR: Cannot mmap "DEV_HPET"!\n"
-				"Please enable CONFIG_HPET_MMAP in your kernel configuration "
-				"to allow HPET support.\n"
-				"To run without using HPET, unset RTE_LIBEAL_USE_HPET "
-				"in your build configuration or use '--no-hpet' EAL flag.\n");
+		RTE_LOG(ERR, EAL, "ERROR: Cannot mmap "DEV_HPET"!\n");
 		close(fd);
 		internal_conf->no_hpet = 1;
 		return -1;
Signature · 1 line
2.43.0
#90 lore raw

PATCH v4 7/14 bpf: remove log level in internal helper

In reply to David Marchand

There is no other log level than debug, simplify this helper.

---
 lib/bpf/bpf_validate.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
lib/bpf/bpf_validate.c +5 -5
index 95b9ef99ef..f246b3c5eb 100644
@@ -2178,18 +2178,18 @@ restore_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 }
 
 static void
-log_eval_state(const struct bpf_verifier *bvf, const struct ebpf_insn *ins,
-	uint32_t pc, int32_t loglvl)
+log_dbg_eval_state(const struct bpf_verifier *bvf, const struct ebpf_insn *ins,
+	uint32_t pc)
 {
 	const struct bpf_eval_state *st;
 	const struct bpf_reg_val *rv;
 
-	rte_log(loglvl, rte_bpf_logtype, "%s(pc=%u):\n", __func__, pc);
+	RTE_BPF_LOG(DEBUG, "%s(pc=%u):\n", __func__, pc);
 
 	st = bvf->evst;
 	rv = st->rv + ins->dst_reg;
 
-	rte_log(loglvl, rte_bpf_logtype,
+	RTE_BPF_LOG(DEBUG,
 		"r%u={\n"
 		"\tv={type=%u, size=%zu},\n"
 		"\tmask=0x%" PRIx64 ",\n"
@@ -2269,7 +2269,7 @@ evaluate(struct bpf_verifier *bvf)
 				}
 			}
 
-			log_eval_state(bvf, ins + idx, idx, RTE_LOG_DEBUG);
+			log_dbg_eval_state(bvf, ins + idx, idx);
 			bvf->evin = NULL;
 		}
 
Signature · 1 line
2.43.0
#91 lore raw

PATCH v4 8/14 lib: simplify multilines log messages

In reply to David Marchand

Those error log messages don't need to span on multiple lines.

---
Changes since RFC v2:
- fixed format string crossing line boundaries,

---
 lib/acl/tb_mem.c                |  4 ++--
 lib/bpf/bpf_stub.c              |  6 ++----
 lib/eal/windows/eal_hugepages.c |  4 ++--
 lib/ethdev/rte_ethdev.c         | 12 ++++--------
 4 files changed, 10 insertions(+), 16 deletions(-)
lib/acl/tb_mem.c +2 -2
index 6a9d96aaed..4ee65b23da 100644
@@ -26,8 +26,8 @@ tb_pool(struct tb_mem_pool *pool, size_t sz)
 	size = sz + pool->alignment - 1;
 	block = calloc(1, size + sizeof(*pool->block));
 	if (block == NULL) {
-		RTE_LOG(ERR, ACL, "%s(%zu)\n failed, currently allocated "
-			"by pool: %zu bytes\n", __func__, sz, pool->alloc);
+		RTE_LOG(ERR, ACL, "%s(%zu) failed, currently allocated by pool: %zu bytes\n",
+			__func__, sz, pool->alloc);
 		siglongjmp(pool->fail, -ENOMEM);
 		return NULL;
 	}
lib/bpf/bpf_stub.c +2 -4
index ebc5343896..83c2203622 100644
@@ -19,8 +19,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 		return NULL;
 	}
 
-	RTE_BPF_LOG(ERR, "%s() is not supported with current config\n"
-		"rebuild with libelf installed\n",
+	RTE_BPF_LOG(ERR, "%s() is not supported, rebuild with libelf installed\n",
 		__func__);
 	rte_errno = ENOTSUP;
 	return NULL;
@@ -36,8 +35,7 @@ rte_bpf_convert(const struct bpf_program *prog)
 		return NULL;
 	}
 
-	RTE_BPF_LOG(ERR, "%s() is not supported with current config\n"
-		"rebuild with libpcap installed\n",
+	RTE_BPF_LOG(ERR, "%s() is not supported, rebuild with libpcap installed\n",
 		__func__);
 	rte_errno = ENOTSUP;
 	return NULL;
lib/eal/windows/eal_hugepages.c +2 -2
index b007dceb39..775c67e4c4 100644
@@ -105,8 +105,8 @@ int
 eal_hugepage_info_init(void)
 {
 	if (hugepage_claim_privilege() < 0) {
-		RTE_LOG(ERR, EAL, "Cannot claim hugepage privilege\n"
-		"Verify that large-page support privilege is assigned to the current user\n");
+		RTE_LOG(ERR, EAL,
+			"Cannot claim hugepage privilege, check large-page support privilege\n");
 		return -1;
 	}
 
lib/ethdev/rte_ethdev.c +4 -8
index b9d99ece15..9dd0efa9d8 100644
@@ -6709,8 +6709,7 @@ rte_eth_ip_reassembly_capability_get(uint16_t port_id,
 
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Device with port_id=%u is not configured.\n"
-			"Cannot get IP reassembly capability\n",
+			"port_id=%u is not configured, cannot get IP reassembly capability\n",
 			port_id);
 		return -EINVAL;
 	}
@@ -6745,8 +6744,7 @@ rte_eth_ip_reassembly_conf_get(uint16_t port_id,
 
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Device with port_id=%u is not configured.\n"
-			"Cannot get IP reassembly configuration\n",
+			"port_id=%u is not configured, cannot get IP reassembly configuration\n",
 			port_id);
 		return -EINVAL;
 	}
@@ -6779,16 +6777,14 @@ rte_eth_ip_reassembly_conf_set(uint16_t port_id,
 
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Device with port_id=%u is not configured.\n"
-			"Cannot set IP reassembly configuration\n",
+			"port_id=%u is not configured, cannot set IP reassembly configuration\n",
 			port_id);
 		return -EINVAL;
 	}
 
 	if (dev->data->dev_started != 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Device with port_id=%u started,\n"
-			"cannot configure IP reassembly params.\n",
+			"port_id=%u is started, cannot configure IP reassembly params.\n",
 			port_id);
 		return -EINVAL;
 	}
Signature · 1 line
2.43.0
#92 lore raw

PATCH v4 9/14 rcu: introduce a logging helper

In reply to David Marchand

Add a simple helper for logging messages in this library.

---
 lib/rcu/rte_rcu_qsbr.c | 62 ++++++++++++++++--------------------------
 lib/rcu/rte_rcu_qsbr.h |  1 +
 2 files changed, 24 insertions(+), 39 deletions(-)
lib/rcu/rte_rcu_qsbr.c +23 -39
index 41a44be4b9..5b6530788a 100644
@@ -19,6 +19,9 @@
 #include "rte_rcu_qsbr.h"
 #include "rcu_qsbr_pvt.h"
 
+#define RCU_LOG(level, fmt, args...) \
+	RTE_LOG(level, RCU, "%s(): " fmt "\n", __func__, ## args)
+
 /* Get the memory size of QSBR variable */
 size_t
 rte_rcu_qsbr_get_memsize(uint32_t max_threads)
@@ -26,9 +29,7 @@ rte_rcu_qsbr_get_memsize(uint32_t max_threads)
 	size_t sz;
 
 	if (max_threads == 0) {
-		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
-			"%s(): Invalid max_threads %u\n",
-			__func__, max_threads);
+		RCU_LOG(ERR, "Invalid max_threads %u", max_threads);
 		rte_errno = EINVAL;
 
 		return 1;
@@ -52,8 +53,7 @@ rte_rcu_qsbr_init(struct rte_rcu_qsbr *v, uint32_t max_threads)
 	size_t sz;
 
 	if (v == NULL) {
-		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
-			"%s(): Invalid input parameter\n", __func__);
+		RCU_LOG(ERR, "Invalid input parameter");
 		rte_errno = EINVAL;
 
 		return 1;
@@ -85,8 +85,7 @@ rte_rcu_qsbr_thread_register(struct rte_rcu_qsbr *v, unsigned int thread_id)
 	uint64_t old_bmap, new_bmap;
 
 	if (v == NULL || thread_id >= v->max_threads) {
-		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
-			"%s(): Invalid input parameter\n", __func__);
+		RCU_LOG(ERR, "Invalid input parameter");
 		rte_errno = EINVAL;
 
 		return 1;
@@ -137,8 +136,7 @@ rte_rcu_qsbr_thread_unregister(struct rte_rcu_qsbr *v, unsigned int thread_id)
 	uint64_t old_bmap, new_bmap;
 
 	if (v == NULL || thread_id >= v->max_threads) {
-		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
-			"%s(): Invalid input parameter\n", __func__);
+		RCU_LOG(ERR, "Invalid input parameter");
 		rte_errno = EINVAL;
 
 		return 1;
@@ -211,8 +209,7 @@ rte_rcu_qsbr_dump(FILE *f, struct rte_rcu_qsbr *v)
 	uint32_t i, t, id;
 
 	if (v == NULL || f == NULL) {
-		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
-			"%s(): Invalid input parameter\n", __func__);
+		RCU_LOG(ERR, "Invalid input parameter");
 		rte_errno = EINVAL;
 
 		return 1;
@@ -282,8 +279,7 @@ rte_rcu_qsbr_dq_create(const struct rte_rcu_qsbr_dq_parameters *params)
 		params->v == NULL || params->name == NULL ||
 		params->size == 0 || params->esize == 0 ||
 		(params->esize % 4 != 0)) {
-		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
-			"%s(): Invalid input parameter\n", __func__);
+		RCU_LOG(ERR, "Invalid input parameter");
 		rte_errno = EINVAL;
 
 		return NULL;
@@ -293,9 +289,10 @@ rte_rcu_qsbr_dq_create(const struct rte_rcu_qsbr_dq_parameters *params)
 	 */
 	if ((params->trigger_reclaim_limit <= params->size) &&
 	    (params->max_reclaim_size == 0)) {
-		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
-			"%s(): Invalid input parameter, size = %u, trigger_reclaim_limit = %u, max_reclaim_size = %u\n",
-			__func__, params->size, params->trigger_reclaim_limit,
+		RCU_LOG(ERR,
+			"Invalid input parameter, size = %u, trigger_reclaim_limit = %u, "
+			"max_reclaim_size = %u",
+			params->size, params->trigger_reclaim_limit,
 			params->max_reclaim_size);
 		rte_errno = EINVAL;
 
@@ -328,8 +325,7 @@ rte_rcu_qsbr_dq_create(const struct rte_rcu_qsbr_dq_parameters *params)
 			__RTE_QSBR_TOKEN_SIZE + params->esize,
 			qs_fifo_size, SOCKET_ID_ANY, flags);
 	if (dq->r == NULL) {
-		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
-			"%s(): defer queue create failed\n", __func__);
+		RCU_LOG(ERR, "defer queue create failed");
 		rte_free(dq);
 		return NULL;
 	}
@@ -354,8 +350,7 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq *dq, void *e)
 	uint32_t cur_size;
 
 	if (dq == NULL || e == NULL) {
-		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
-			"%s(): Invalid input parameter\n", __func__);
+		RCU_LOG(ERR, "Invalid input parameter");
 		rte_errno = EINVAL;
 
 		return 1;
@@ -372,8 +367,7 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq *dq, void *e)
 	 */
 	cur_size = rte_ring_count(dq->r);
 	if (cur_size > dq->trigger_reclaim_limit) {
-		rte_log(RTE_LOG_INFO, rte_rcu_log_type,
-			"%s(): Triggering reclamation\n", __func__);
+		RCU_LOG(INFO, "Triggering reclamation");
 		rte_rcu_qsbr_dq_reclaim(dq, dq->max_reclaim_size,
 						NULL, NULL, NULL);
 	}
@@ -391,23 +385,18 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq *dq, void *e)
 	 * Enqueue uses the configured flags when the DQ was created.
 	 */
 	if (rte_ring_enqueue_elem(dq->r, data, dq->esize) != 0) {
-		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
-			"%s(): Enqueue failed\n", __func__);
+		RCU_LOG(ERR, "Enqueue failed");
 		/* Note that the token generated above is not used.
 		 * Other than wasting tokens, it should not cause any
 		 * other issues.
 		 */
-		rte_log(RTE_LOG_INFO, rte_rcu_log_type,
-			"%s(): Skipped enqueuing token = %" PRIu64 "\n",
-			__func__, dq_elem->token);
+		RCU_LOG(INFO, "Skipped enqueuing token = %" PRIu64, dq_elem->token);
 
 		rte_errno = ENOSPC;
 		return 1;
 	}
 
-	rte_log(RTE_LOG_INFO, rte_rcu_log_type,
-		"%s(): Enqueued token = %" PRIu64 "\n",
-		__func__, dq_elem->token);
+	RCU_LOG(INFO, "Enqueued token = %" PRIu64, dq_elem->token);
 
 	return 0;
 }
@@ -422,8 +411,7 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq, unsigned int n,
 	__rte_rcu_qsbr_dq_elem_t *dq_elem;
 
 	if (dq == NULL || n == 0) {
-		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
-			"%s(): Invalid input parameter\n", __func__);
+		RCU_LOG(ERR, "Invalid input parameter");
 		rte_errno = EINVAL;
 
 		return 1;
@@ -445,17 +433,14 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq, unsigned int n,
 		}
 		rte_ring_dequeue_elem_finish(dq->r, 1);
 
-		rte_log(RTE_LOG_INFO, rte_rcu_log_type,
-			"%s(): Reclaimed token = %" PRIu64 "\n",
-			__func__, dq_elem->token);
+		RCU_LOG(INFO, "Reclaimed token = %" PRIu64, dq_elem->token);
 
 		dq->free_fn(dq->p, dq_elem->elem, 1);
 
 		cnt++;
 	}
 
-	rte_log(RTE_LOG_INFO, rte_rcu_log_type,
-		"%s(): Reclaimed %u resources\n", __func__, cnt);
+	RCU_LOG(INFO, "Reclaimed %u resources", cnt);
 
 	if (freed != NULL)
 		*freed = cnt;
@@ -472,8 +457,7 @@ rte_rcu_qsbr_dq_delete(struct rte_rcu_qsbr_dq *dq)
 	unsigned int pending;
 
 	if (dq == NULL) {
-		rte_log(RTE_LOG_DEBUG, rte_rcu_log_type,
-			"%s(): Invalid input parameter\n", __func__);
+		RCU_LOG(DEBUG, "Invalid input parameter");
 
 		return 0;
 	}
lib/rcu/rte_rcu_qsbr.h +1 -0
index 6b908e7ee0..0dca8310c0 100644
@@ -36,6 +36,7 @@ extern "C" {
 #include <rte_ring.h>
 
 extern int rte_rcu_log_type;
+#define RTE_LOGTYPE_RCU rte_rcu_log_type
 
 #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
 #define __RTE_RCU_DP_LOG(level, fmt, args...) \
Signature · 1 line
2.43.0
#93 lore raw

PATCH v4 10/14 vhost: improve log for memory dumping configuration

In reply to David Marchand

Add the device name as a prefix of logs associated to madvise() calls.

---
 lib/vhost/iotlb.c      | 18 +++++++++---------
 lib/vhost/vhost.h      |  2 +-
 lib/vhost/vhost_user.c | 26 +++++++++++++-------------
 3 files changed, 23 insertions(+), 23 deletions(-)
lib/vhost/iotlb.c +9 -9
index 87ac0e5126..10ab77262e 100644
@@ -54,16 +54,16 @@ vhost_user_iotlb_share_page(struct vhost_iotlb_entry *a, struct vhost_iotlb_entr
 }
 
 static void
-vhost_user_iotlb_set_dump(struct vhost_iotlb_entry *node)
+vhost_user_iotlb_set_dump(struct virtio_net *dev, struct vhost_iotlb_entry *node)
 {
 	uint64_t start;
 
 	start = node->uaddr + node->uoffset;
-	mem_set_dump((void *)(uintptr_t)start, node->size, true, RTE_BIT64(node->page_shift));
+	mem_set_dump(dev, (void *)(uintptr_t)start, node->size, true, RTE_BIT64(node->page_shift));
 }
 
 static void
-vhost_user_iotlb_clear_dump(struct vhost_iotlb_entry *node,
+vhost_user_iotlb_clear_dump(struct virtio_net *dev, struct vhost_iotlb_entry *node,
 		struct vhost_iotlb_entry *prev, struct vhost_iotlb_entry *next)
 {
 	uint64_t start, end;
@@ -80,7 +80,7 @@ vhost_user_iotlb_clear_dump(struct vhost_iotlb_entry *node,
 		end = RTE_ALIGN_FLOOR(end, RTE_BIT64(node->page_shift));
 
 	if (end > start)
-		mem_set_dump((void *)(uintptr_t)start, end - start, false,
+		mem_set_dump(dev, (void *)(uintptr_t)start, end - start, false,
 			RTE_BIT64(node->page_shift));
 }
 
@@ -204,7 +204,7 @@ vhost_user_iotlb_cache_remove_all(struct virtio_net *dev)
 	vhost_user_iotlb_wr_lock_all(dev);
 
 	RTE_TAILQ_FOREACH_SAFE(node, &dev->iotlb_list, next, temp_node) {
-		vhost_user_iotlb_clear_dump(node, NULL, NULL);
+		vhost_user_iotlb_clear_dump(dev, node, NULL, NULL);
 
 		TAILQ_REMOVE(&dev->iotlb_list, node, next);
 		vhost_user_iotlb_remove_notify(dev, node);
@@ -230,7 +230,7 @@ vhost_user_iotlb_cache_random_evict(struct virtio_net *dev)
 		if (!entry_idx) {
 			struct vhost_iotlb_entry *next_node = RTE_TAILQ_NEXT(node, next);
 
-			vhost_user_iotlb_clear_dump(node, prev_node, next_node);
+			vhost_user_iotlb_clear_dump(dev, node, prev_node, next_node);
 
 			TAILQ_REMOVE(&dev->iotlb_list, node, next);
 			vhost_user_iotlb_remove_notify(dev, node);
@@ -285,7 +285,7 @@ vhost_user_iotlb_cache_insert(struct virtio_net *dev, uint64_t iova, uint64_t ua
 			vhost_user_iotlb_pool_put(dev, new_node);
 			goto unlock;
 		} else if (node->iova > new_node->iova) {
-			vhost_user_iotlb_set_dump(new_node);
+			vhost_user_iotlb_set_dump(dev, new_node);
 
 			TAILQ_INSERT_BEFORE(node, new_node, next);
 			dev->iotlb_cache_nr++;
@@ -293,7 +293,7 @@ vhost_user_iotlb_cache_insert(struct virtio_net *dev, uint64_t iova, uint64_t ua
 		}
 	}
 
-	vhost_user_iotlb_set_dump(new_node);
+	vhost_user_iotlb_set_dump(dev, new_node);
 
 	TAILQ_INSERT_TAIL(&dev->iotlb_list, new_node, next);
 	dev->iotlb_cache_nr++;
@@ -322,7 +322,7 @@ vhost_user_iotlb_cache_remove(struct virtio_net *dev, uint64_t iova, uint64_t si
 		if (iova < node->iova + node->size) {
 			struct vhost_iotlb_entry *next_node = RTE_TAILQ_NEXT(node, next);
 
-			vhost_user_iotlb_clear_dump(node, prev_node, next_node);
+			vhost_user_iotlb_clear_dump(dev, node, prev_node, next_node);
 
 			TAILQ_REMOVE(&dev->iotlb_list, node, next);
 			vhost_user_iotlb_remove_notify(dev, node);
lib/vhost/vhost.h +1 -1
index f8624fba3d..5f24911190 100644
@@ -1062,6 +1062,6 @@ mbuf_is_consumed(struct rte_mbuf *m)
 	return true;
 }
 
-void mem_set_dump(void *ptr, size_t size, bool enable, uint64_t alignment);
+void mem_set_dump(struct virtio_net *dev, void *ptr, size_t size, bool enable, uint64_t alignment);
 
 #endif /* _VHOST_NET_CDEV_H_ */
lib/vhost/vhost_user.c +13 -13
index e36312181a..413f068bcd 100644
@@ -763,7 +763,7 @@ hua_to_alignment(struct rte_vhost_memory *mem, void *ptr)
 }
 
 void
-mem_set_dump(void *ptr, size_t size, bool enable, uint64_t pagesz)
+mem_set_dump(struct virtio_net *dev, void *ptr, size_t size, bool enable, uint64_t pagesz)
 {
 #ifdef MADV_DONTDUMP
 	void *start = RTE_PTR_ALIGN_FLOOR(ptr, pagesz);
@@ -771,8 +771,8 @@ mem_set_dump(void *ptr, size_t size, bool enable, uint64_t pagesz)
 	size_t len = end - (uintptr_t)start;
 
 	if (madvise(start, len, enable ? MADV_DODUMP : MADV_DONTDUMP) == -1) {
-		rte_log(RTE_LOG_INFO, vhost_config_log_level,
-			"VHOST_CONFIG: could not set coredump preference (%s).\n", strerror(errno));
+		VHOST_LOG_CONFIG(dev->ifname, INFO,
+			"could not set coredump preference (%s).\n", strerror(errno));
 	}
 #endif
 }
@@ -807,7 +807,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 			return;
 		}
 
-		mem_set_dump(vq->desc_packed, len, true,
+		mem_set_dump(dev, vq->desc_packed, len, true,
 			hua_to_alignment(dev->mem, vq->desc_packed));
 		numa_realloc(&dev, &vq);
 		*pdev = dev;
@@ -824,7 +824,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 			return;
 		}
 
-		mem_set_dump(vq->driver_event, len, true,
+		mem_set_dump(dev, vq->driver_event, len, true,
 			hua_to_alignment(dev->mem, vq->driver_event));
 		len = sizeof(struct vring_packed_desc_event);
 		vq->device_event = (struct vring_packed_desc_event *)
@@ -837,7 +837,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 			return;
 		}
 
-		mem_set_dump(vq->device_event, len, true,
+		mem_set_dump(dev, vq->device_event, len, true,
 			hua_to_alignment(dev->mem, vq->device_event));
 		vq->access_ok = true;
 		return;
@@ -855,7 +855,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 		return;
 	}
 
-	mem_set_dump(vq->desc, len, true, hua_to_alignment(dev->mem, vq->desc));
+	mem_set_dump(dev, vq->desc, len, true, hua_to_alignment(dev->mem, vq->desc));
 	numa_realloc(&dev, &vq);
 	*pdev = dev;
 	*pvq = vq;
@@ -871,7 +871,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 		return;
 	}
 
-	mem_set_dump(vq->avail, len, true, hua_to_alignment(dev->mem, vq->avail));
+	mem_set_dump(dev, vq->avail, len, true, hua_to_alignment(dev->mem, vq->avail));
 	len = sizeof(struct vring_used) +
 		sizeof(struct vring_used_elem) * vq->size;
 	if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX))
@@ -884,7 +884,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 		return;
 	}
 
-	mem_set_dump(vq->used, len, true, hua_to_alignment(dev->mem, vq->used));
+	mem_set_dump(dev, vq->used, len, true, hua_to_alignment(dev->mem, vq->used));
 
 	if (vq->last_used_idx != vq->used->idx) {
 		VHOST_LOG_CONFIG(dev->ifname, WARNING,
@@ -1274,7 +1274,7 @@ vhost_user_mmap_region(struct virtio_net *dev,
 	region->mmap_addr = mmap_addr;
 	region->mmap_size = mmap_size;
 	region->host_user_addr = (uint64_t)(uintptr_t)mmap_addr + mmap_offset;
-	mem_set_dump(mmap_addr, mmap_size, false, alignment);
+	mem_set_dump(dev, mmap_addr, mmap_size, false, alignment);
 
 	if (dev->async_copy) {
 		if (add_guest_pages(dev, region, alignment) < 0) {
@@ -1580,7 +1580,7 @@ inflight_mem_alloc(struct virtio_net *dev, const char *name, size_t size, int *f
 	}
 
 	alignment = get_blk_size(mfd);
-	mem_set_dump(ptr, size, false, alignment);
+	mem_set_dump(dev, ptr, size, false, alignment);
 	*fd = mfd;
 	return ptr;
 }
@@ -1789,7 +1789,7 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev,
 		dev->inflight_info->fd = -1;
 	}
 
-	mem_set_dump(addr, mmap_size, false, get_blk_size(fd));
+	mem_set_dump(dev, addr, mmap_size, false, get_blk_size(fd));
 	dev->inflight_info->fd = fd;
 	dev->inflight_info->addr = addr;
 	dev->inflight_info->size = mmap_size;
@@ -2343,7 +2343,7 @@ vhost_user_set_log_base(struct virtio_net **pdev,
 	dev->log_addr = (uint64_t)(uintptr_t)addr;
 	dev->log_base = dev->log_addr + off;
 	dev->log_size = size;
-	mem_set_dump(addr, size + off, false, alignment);
+	mem_set_dump(dev, addr, size + off, false, alignment);
 
 	for (i = 0; i < dev->nr_vring; i++) {
 		struct vhost_virtqueue *vq = dev->virtqueue[i];
Signature · 1 line
2.43.0
#94 lore raw

PATCH v4 11/14 log: add a per line log helper

In reply to David Marchand

gcc builtin __builtin_strchr can be used as a static assertion to check whether passed format strings contain a \n.
This can be useful to detect double \n in log messages.

---
Changes since v3:
- fixed some checkpatch complaints,

Changes since RFC v1:
- added a check in checkpatches.sh,

---
 devtools/checkpatches.sh |  8 ++++++++
 lib/log/rte_log.h        | 21 +++++++++++++++++++++
 2 files changed, 29 insertions(+)
devtools/checkpatches.sh +8 -0
index 10b79ca2bc..10d1bf490b 100755
@@ -53,6 +53,14 @@ print_usage () {
 check_forbidden_additions() { # <patch>
 	res=0
 
+	# refrain from new calls to RTE_LOG
+	awk -v FOLDERS="lib" \
+		-v EXPRESSIONS="RTE_LOG\\\(" \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Prefer RTE_LOG_LINE' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# refrain from new additions of rte_panic() and rte_exit()
 	# multiple folders and expressions are separated by spaces
 	awk -v FOLDERS="lib drivers" \
lib/log/rte_log.h +21 -0
index 3394746103..637e9dcc9a 100644
@@ -17,6 +17,7 @@
 extern "C" {
 #endif
 
+#include <assert.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdarg.h>
@@ -358,6 +359,26 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
 		 RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) :	\
 	 0)
 
+#ifdef RTE_TOOLCHAIN_GCC
+#define RTE_LOG_CHECK_NO_NEWLINE(fmt) \
+	static_assert(!__builtin_strchr(fmt, '\n'), \
+		"This log format string contains a \\n")
+#else
+#define RTE_LOG_CHECK_NO_NEWLINE(...)
+#endif
+
+#define RTE_LOG_LINE(l, t, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
+	RTE_LOG(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
+#define RTE_LOG_DP_LINE(l, t, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
+	RTE_LOG_DP(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
 #define RTE_LOG_REGISTER_IMPL(type, name, level)			    \
 int type;								    \
 RTE_INIT(__##type)							    \
Signature · 1 line
2.43.0
#95 lore raw

Re: [PATCH v4 11/14] log: add a per line log helper

18/12/2023 15:38, David Marchand:

lib/log/rte_log.h int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) · line 368

Quoted 7 lines
lib/log/rte_log.h +7 -0
+#ifdef RTE_TOOLCHAIN_GCC
+#define RTE_LOG_CHECK_NO_NEWLINE(fmt) \
+	static_assert(!__builtin_strchr(fmt, '\n'), \
+		"This log format string contains a \\n")
+#else
+#define RTE_LOG_CHECK_NO_NEWLINE(...)
+#endif

No support in clang?

lib/log/rte_log.h int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) · line 380

Quoted 11 lines
lib/log/rte_log.h +11 -0
+#define RTE_LOG_LINE(l, t, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
+	RTE_LOG(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
+#define RTE_LOG_DP_LINE(l, t, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
+	RTE_LOG_DP(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)

I don't think we need a space between __VA_ARGS__ and the comma.

#96 lore raw

Re: [PATCH v4 11/14] log: add a per line log helper

Quoted 10 lines · On Tue, 19 Dec 2023 16:45:19 +0100 Thomas Monjalon <[email protected]> wrote:

18/12/2023 15:38, David Marchand:

lib/log/rte_log.h int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) · line 368

Quoted 7 lines
lib/log/rte_log.h +7 -0
+#ifdef RTE_TOOLCHAIN_GCC
+#define RTE_LOG_CHECK_NO_NEWLINE(fmt) \
+	static_assert(!__builtin_strchr(fmt, '\n'), \
+		"This log format string contains a \\n")
+#else
+#define RTE_LOG_CHECK_NO_NEWLINE(...)
+#endif  

No support in clang?

clang has static assert, but probably not builtin_strchr

#97 lore raw

Re: [PATCH v4 11/14] log: add a per line log helper

Quoted 15 lines · Stephen Hemminger
Quoted 10 lines · On Tue, 19 Dec 2023 16:45:19 +0100 Thomas Monjalon <[email protected]> wrote:

18/12/2023 15:38, David Marchand:

lib/log/rte_log.h int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) · line 368

Quoted 7 lines
lib/log/rte_log.h +7 -0
+#ifdef RTE_TOOLCHAIN_GCC
+#define RTE_LOG_CHECK_NO_NEWLINE(fmt) \
+   static_assert(!__builtin_strchr(fmt, '\n'), \
+           "This log format string contains a \\n")
+#else
+#define RTE_LOG_CHECK_NO_NEWLINE(...)
+#endif

No support in clang?

Quoted 1 line

clang has static assert, but probably not builtin_strchr

clang seems to have support for __builtin_strchr (which was not obvious to me when I first looked at it).
Testing with clang ("thanks" to net/mlx4), I realised that this check relies on some gnu extension (constant folding) which breaks compilation with -pedantic.

An additional check on PEDANTIC is needed, and I can then add support for clang.

Signature · 1 line
David Marchand
#98 lore raw

PATCH v4 12/14 lib: convert to per line logging

In reply to David Marchand

Convert many libraries that call RTE_LOG(... "\n", ...) to RTE_LOG_LINE.

Note:
- for acl and sched libraries that still has some debug multilines messages, a direct call to RTE_LOG is used: this will make it easier to notice such special cases,

---
Changes since v3:
- fixed some checkpatch complaints,

---
 lib/acl/acl_bld.c                       |  28 +--
 lib/acl/acl_gen.c                       |   8 +-
 lib/acl/rte_acl.c                       |   8 +-
 lib/acl/tb_mem.c                        |   2 +-
 lib/eal/common/eal_common_bus.c         |  22 +-
 lib/eal/common/eal_common_class.c       |   4 +-
 lib/eal/common/eal_common_config.c      |   2 +-
 lib/eal/common/eal_common_debug.c       |   6 +-
 lib/eal/common/eal_common_dev.c         |  80 +++----
 lib/eal/common/eal_common_devargs.c     |  18 +-
 lib/eal/common/eal_common_dynmem.c      |  34 +--
 lib/eal/common/eal_common_fbarray.c     |  12 +-
 lib/eal/common/eal_common_interrupts.c  |  38 ++--
 lib/eal/common/eal_common_lcore.c       |  26 +--
 lib/eal/common/eal_common_memalloc.c    |  12 +-
 lib/eal/common/eal_common_memory.c      |  66 +++---
 lib/eal/common/eal_common_memzone.c     |  24 +--
 lib/eal/common/eal_common_options.c     | 236 ++++++++++----------
 lib/eal/common/eal_common_proc.c        | 112 +++++-----
 lib/eal/common/eal_common_tailqs.c      |  12 +-
 lib/eal/common/eal_common_thread.c      |  12 +-
 lib/eal/common/eal_common_timer.c       |   6 +-
 lib/eal/common/eal_common_trace_utils.c |   2 +-
 lib/eal/common/eal_trace.h              |   4 +-
 lib/eal/common/hotplug_mp.c             |  54 ++---
 lib/eal/common/malloc_elem.c            |   6 +-
 lib/eal/common/malloc_heap.c            |  40 ++--
 lib/eal/common/malloc_mp.c              |  72 +++----
 lib/eal/common/rte_keepalive.c          |   2 +-
 lib/eal/common/rte_malloc.c             |  10 +-
 lib/eal/common/rte_service.c            |   8 +-
 lib/eal/freebsd/eal.c                   |  75 +++----
 lib/eal/freebsd/eal_alarm.c             |   2 +-
 lib/eal/freebsd/eal_dev.c               |   8 +-
 lib/eal/freebsd/eal_hugepage_info.c     |  22 +-
 lib/eal/freebsd/eal_interrupts.c        |  60 +++---
 lib/eal/freebsd/eal_lcore.c             |   2 +-
 lib/eal/freebsd/eal_memalloc.c          |  10 +-
 lib/eal/freebsd/eal_memory.c            |  34 +--
 lib/eal/freebsd/eal_thread.c            |   2 +-
 lib/eal/freebsd/eal_timer.c             |  10 +-
 lib/eal/linux/eal.c                     | 122 +++++------
 lib/eal/linux/eal_alarm.c               |   2 +-
 lib/eal/linux/eal_dev.c                 |  40 ++--
 lib/eal/linux/eal_hugepage_info.c       |  38 ++--
 lib/eal/linux/eal_interrupts.c          | 116 +++++-----
 lib/eal/linux/eal_lcore.c               |   4 +-
 lib/eal/linux/eal_memalloc.c            | 120 +++++------
 lib/eal/linux/eal_memory.c              | 208 +++++++++---------
 lib/eal/linux/eal_thread.c              |   4 +-
 lib/eal/linux/eal_timer.c               |  10 +-
 lib/eal/linux/eal_vfio.c                | 270 +++++++++++------------
 lib/eal/linux/eal_vfio_mp_sync.c        |   4 +-
 lib/eal/riscv/rte_cycles.c              |   4 +-
 lib/eal/unix/eal_filesystem.c           |  14 +-
 lib/eal/unix/eal_firmware.c             |   2 +-
 lib/eal/unix/eal_unix_memory.c          |   8 +-
 lib/eal/unix/rte_thread.c               |  34 +--
 lib/eal/windows/eal.c                   |  36 ++--
 lib/eal/windows/eal_alarm.c             |  12 +-
 lib/eal/windows/eal_debug.c             |   8 +-
 lib/eal/windows/eal_dev.c               |   8 +-
 lib/eal/windows/eal_hugepages.c         |  10 +-
 lib/eal/windows/eal_interrupts.c        |  10 +-
 lib/eal/windows/eal_lcore.c             |   7 +-
 lib/eal/windows/eal_memalloc.c          |  50 ++---
 lib/eal/windows/eal_memory.c            |  20 +-
 lib/eal/windows/eal_windows.h           |   4 +-
 lib/eal/windows/include/rte_windows.h   |   6 +-
 lib/eal/windows/rte_thread.c            |  28 +--
 lib/efd/rte_efd.c                       |  58 ++---
 lib/fib/rte_fib.c                       |  14 +-
 lib/fib/rte_fib6.c                      |  14 +-
 lib/hash/rte_cuckoo_hash.c              |  52 ++---
 lib/hash/rte_fbk_hash.c                 |   4 +-
 lib/hash/rte_hash_crc.c                 |  12 +-
 lib/hash/rte_thash.c                    |  20 +-
 lib/hash/rte_thash_gfni.c               |   8 +-
 lib/ip_frag/rte_ip_frag_common.c        |   8 +-
 lib/latencystats/rte_latencystats.c     |  41 ++--
 lib/log/log.c                           |   6 +-
 lib/lpm/rte_lpm.c                       |  12 +-
 lib/lpm/rte_lpm6.c                      |  10 +-
 lib/mbuf/rte_mbuf.c                     |  14 +-
 lib/mbuf/rte_mbuf_dyn.c                 |  14 +-
 lib/mbuf/rte_mbuf_pool_ops.c            |   4 +-
 lib/mempool/rte_mempool.c               |  24 +--
 lib/mempool/rte_mempool.h               |   2 +-
 lib/mempool/rte_mempool_ops.c           |  10 +-
 lib/pipeline/rte_pipeline.c             | 228 ++++++++++----------
 lib/port/rte_port_ethdev.c              |  18 +-
 lib/port/rte_port_eventdev.c            |  18 +-
 lib/port/rte_port_fd.c                  |  24 +--
 lib/port/rte_port_frag.c                |  14 +-
 lib/port/rte_port_ras.c                 |  12 +-
 lib/port/rte_port_ring.c                |  18 +-
 lib/port/rte_port_sched.c               |  12 +-
 lib/port/rte_port_source_sink.c         |  48 ++---
 lib/port/rte_port_sym_crypto.c          |  18 +-
 lib/power/guest_channel.c               |  38 ++--
 lib/power/power_acpi_cpufreq.c          | 106 ++++-----
 lib/power/power_amd_pstate_cpufreq.c    | 120 +++++------
 lib/power/power_common.c                |  10 +-
 lib/power/power_cppc_cpufreq.c          | 118 +++++-----
 lib/power/power_intel_uncore.c          |  68 +++---
 lib/power/power_kvm_vm.c                |  22 +-
 lib/power/power_pstate_cpufreq.c        | 144 ++++++-------
 lib/power/rte_power.c                   |  22 +-
 lib/power/rte_power_pmd_mgmt.c          |  34 +--
 lib/power/rte_power_uncore.c            |  14 +-
 lib/rcu/rte_rcu_qsbr.c                  |   2 +-
 lib/reorder/rte_reorder.c               |  32 +--
 lib/rib/rte_rib.c                       |  10 +-
 lib/rib/rte_rib6.c                      |  10 +-
 lib/ring/rte_ring.c                     |  24 +--
 lib/sched/rte_pie.c                     |  18 +-
 lib/sched/rte_sched.c                   | 274 ++++++++++++------------
 lib/table/rte_table_acl.c               |  72 +++----
 lib/table/rte_table_array.c             |  16 +-
 lib/table/rte_table_hash_cuckoo.c       |  22 +-
 lib/table/rte_table_hash_ext.c          |  22 +-
 lib/table/rte_table_hash_key16.c        |  38 ++--
 lib/table/rte_table_hash_key32.c        |  38 ++--
 lib/table/rte_table_hash_key8.c         |  38 ++--
 lib/table/rte_table_hash_lru.c          |  22 +-
 lib/table/rte_table_lpm.c               |  42 ++--
 lib/table/rte_table_lpm_ipv6.c          |  44 ++--
 lib/table/rte_table_stub.c              |   4 +-
 lib/vhost/fd_man.c                      |   8 +-
 129 files changed, 2280 insertions(+), 2279 deletions(-)
lib/acl/acl_bld.c +14 -14
index eaf8770415..27bdd6b9a1 100644
@@ -1017,8 +1017,8 @@ build_trie(struct acl_build_context *context, struct rte_acl_build_rule *head,
 				break;
 
 			default:
-				RTE_LOG(ERR, ACL,
-					"Error in rule[%u] type - %hhu\n",
+				RTE_LOG_LINE(ERR, ACL,
+					"Error in rule[%u] type - %hhu",
 					rule->f->data.userdata,
 					rule->config->defs[n].type);
 				return NULL;
@@ -1374,7 +1374,7 @@ acl_build_tries(struct acl_build_context *context,
 
 		last = build_one_trie(context, rule_sets, n, context->node_max);
 		if (context->bld_tries[n].trie == NULL) {
-			RTE_LOG(ERR, ACL, "Build of %u-th trie failed\n", n);
+			RTE_LOG_LINE(ERR, ACL, "Build of %u-th trie failed", n);
 			return -ENOMEM;
 		}
 
@@ -1383,8 +1383,8 @@ acl_build_tries(struct acl_build_context *context,
 			break;
 
 		if (num_tries == RTE_DIM(context->tries)) {
-			RTE_LOG(ERR, ACL,
-				"Exceeded max number of tries: %u\n",
+			RTE_LOG_LINE(ERR, ACL,
+				"Exceeded max number of tries: %u",
 				num_tries);
 			return -ENOMEM;
 		}
@@ -1409,7 +1409,7 @@ acl_build_tries(struct acl_build_context *context,
 		 */
 		last = build_one_trie(context, rule_sets, n, INT32_MAX);
 		if (context->bld_tries[n].trie == NULL || last != NULL) {
-			RTE_LOG(ERR, ACL, "Build of %u-th trie failed\n", n);
+			RTE_LOG_LINE(ERR, ACL, "Build of %u-th trie failed", n);
 			return -ENOMEM;
 		}
 
@@ -1435,8 +1435,8 @@ acl_build_log(const struct acl_build_context *ctx)
 
 	for (n = 0; n < RTE_DIM(ctx->tries); n++) {
 		if (ctx->tries[n].count != 0)
-			RTE_LOG(DEBUG, ACL,
-				"trie %u: number of rules: %u, indexes: %u\n",
+			RTE_LOG_LINE(DEBUG, ACL,
+				"trie %u: number of rules: %u, indexes: %u",
 				n, ctx->tries[n].count,
 				ctx->tries[n].num_data_indexes);
 	}
@@ -1526,8 +1526,8 @@ acl_bld(struct acl_build_context *bcx, struct rte_acl_ctx *ctx,
 
 	/* build phase runs out of memory. */
 	if (rc != 0) {
-		RTE_LOG(ERR, ACL,
-			"ACL context: %s, %s() failed with error code: %d\n",
+		RTE_LOG_LINE(ERR, ACL,
+			"ACL context: %s, %s() failed with error code: %d",
 			bcx->acx->name, __func__, rc);
 		return rc;
 	}
@@ -1568,8 +1568,8 @@ acl_check_bld_param(struct rte_acl_ctx *ctx, const struct rte_acl_config *cfg)
 
 	for (i = 0; i != cfg->num_fields; i++) {
 		if (cfg->defs[i].type > RTE_ACL_FIELD_TYPE_BITMASK) {
-			RTE_LOG(ERR, ACL,
-			"ACL context: %s, invalid type: %hhu for %u-th field\n",
+			RTE_LOG_LINE(ERR, ACL,
+			"ACL context: %s, invalid type: %hhu for %u-th field",
 			ctx->name, cfg->defs[i].type, i);
 			return -EINVAL;
 		}
@@ -1580,8 +1580,8 @@ acl_check_bld_param(struct rte_acl_ctx *ctx, const struct rte_acl_config *cfg)
 			;
 
 		if (j == RTE_DIM(field_sizes)) {
-			RTE_LOG(ERR, ACL,
-			"ACL context: %s, invalid size: %hhu for %u-th field\n",
+			RTE_LOG_LINE(ERR, ACL,
+			"ACL context: %s, invalid size: %hhu for %u-th field",
 			ctx->name, cfg->defs[i].size, i);
 			return -EINVAL;
 		}
lib/acl/acl_gen.c +4 -4
index 03a47ea231..2f612df1e0 100644
@@ -471,9 +471,9 @@ rte_acl_gen(struct rte_acl_ctx *ctx, struct rte_acl_trie *trie,
 		XMM_SIZE;
 
 	if (total_size > max_size) {
-		RTE_LOG(DEBUG, ACL,
+		RTE_LOG_LINE(DEBUG, ACL,
 			"Gen phase for ACL ctx \"%s\" exceeds max_size limit, "
-			"bytes required: %zu, allowed: %zu\n",
+			"bytes required: %zu, allowed: %zu",
 			ctx->name, total_size, max_size);
 		return -ERANGE;
 	}
@@ -481,8 +481,8 @@ rte_acl_gen(struct rte_acl_ctx *ctx, struct rte_acl_trie *trie,
 	mem = rte_zmalloc_socket(ctx->name, total_size, RTE_CACHE_LINE_SIZE,
 			ctx->socket_id);
 	if (mem == NULL) {
-		RTE_LOG(ERR, ACL,
-			"allocation of %zu bytes on socket %d for %s failed\n",
+		RTE_LOG_LINE(ERR, ACL,
+			"allocation of %zu bytes on socket %d for %s failed",
 			total_size, ctx->socket_id, ctx->name);
 		return -ENOMEM;
 	}
lib/acl/rte_acl.c +4 -4
index 760c3587d4..bec26d0a22 100644
@@ -399,15 +399,15 @@ rte_acl_create(const struct rte_acl_param *param)
 		te = rte_zmalloc("ACL_TAILQ_ENTRY", sizeof(*te), 0);
 
 		if (te == NULL) {
-			RTE_LOG(ERR, ACL, "Cannot allocate tailq entry!\n");
+			RTE_LOG_LINE(ERR, ACL, "Cannot allocate tailq entry!");
 			goto exit;
 		}
 
 		ctx = rte_zmalloc_socket(name, sz, RTE_CACHE_LINE_SIZE, param->socket_id);
 
 		if (ctx == NULL) {
-			RTE_LOG(ERR, ACL,
-				"allocation of %zu bytes on socket %d for %s failed\n",
+			RTE_LOG_LINE(ERR, ACL,
+				"allocation of %zu bytes on socket %d for %s failed",
 				sz, param->socket_id, name);
 			rte_free(te);
 			goto exit;
@@ -473,7 +473,7 @@ rte_acl_add_rules(struct rte_acl_ctx *ctx, const struct rte_acl_rule *rules,
 			((uintptr_t)rules + i * ctx->rule_sz);
 		rc = acl_check_rule(&rv->data);
 		if (rc != 0) {
-			RTE_LOG(ERR, ACL, "%s(%s): rule #%u is invalid\n",
+			RTE_LOG_LINE(ERR, ACL, "%s(%s): rule #%u is invalid",
 				__func__, ctx->name, i + 1);
 			return rc;
 		}
lib/acl/tb_mem.c +1 -1
index 4ee65b23da..7914899363 100644
@@ -26,7 +26,7 @@ tb_pool(struct tb_mem_pool *pool, size_t sz)
 	size = sz + pool->alignment - 1;
 	block = calloc(1, size + sizeof(*pool->block));
 	if (block == NULL) {
-		RTE_LOG(ERR, ACL, "%s(%zu) failed, currently allocated by pool: %zu bytes\n",
+		RTE_LOG_LINE(ERR, ACL, "%s(%zu) failed, currently allocated by pool: %zu bytes",
 			__func__, sz, pool->alloc);
 		siglongjmp(pool->fail, -ENOMEM);
 		return NULL;
lib/eal/common/eal_common_bus.c +11 -11
index acac14131a..456f27112c 100644
@@ -35,14 +35,14 @@ rte_bus_register(struct rte_bus *bus)
 	RTE_VERIFY(!bus->plug || bus->unplug);
 
 	TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", rte_bus_name(bus));
+	RTE_LOG_LINE(DEBUG, EAL, "Registered [%s] bus.", rte_bus_name(bus));
 }
 
 void
 rte_bus_unregister(struct rte_bus *bus)
 {
 	TAILQ_REMOVE(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", rte_bus_name(bus));
+	RTE_LOG_LINE(DEBUG, EAL, "Unregistered [%s] bus.", rte_bus_name(bus));
 }
 
 /* Scan all the buses for registered devices */
@@ -55,7 +55,7 @@ rte_bus_scan(void)
 	TAILQ_FOREACH(bus, &rte_bus_list, next) {
 		ret = bus->scan();
 		if (ret)
-			RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n",
+			RTE_LOG_LINE(ERR, EAL, "Scan for (%s) bus failed.",
 				rte_bus_name(bus));
 	}
 
@@ -77,14 +77,14 @@ rte_bus_probe(void)
 
 		ret = bus->probe();
 		if (ret)
-			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
+			RTE_LOG_LINE(ERR, EAL, "Bus (%s) probe failed.",
 				rte_bus_name(bus));
 	}
 
 	if (vbus) {
 		ret = vbus->probe();
 		if (ret)
-			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
+			RTE_LOG_LINE(ERR, EAL, "Bus (%s) probe failed.",
 				rte_bus_name(vbus));
 	}
 
@@ -133,7 +133,7 @@ rte_bus_dump(FILE *f)
 	TAILQ_FOREACH(bus, &rte_bus_list, next) {
 		ret = bus_dump_one(f, bus);
 		if (ret) {
-			RTE_LOG(ERR, EAL, "Unable to write to stream (%d)\n",
+			RTE_LOG_LINE(ERR, EAL, "Unable to write to stream (%d)",
 				ret);
 			break;
 		}
@@ -235,15 +235,15 @@ rte_bus_get_iommu_class(void)
 			continue;
 
 		bus_iova_mode = bus->get_iommu_class();
-		RTE_LOG(DEBUG, EAL, "Bus %s wants IOVA as '%s'\n",
+		RTE_LOG_LINE(DEBUG, EAL, "Bus %s wants IOVA as '%s'",
 			rte_bus_name(bus),
 			bus_iova_mode == RTE_IOVA_DC ? "DC" :
 			(bus_iova_mode == RTE_IOVA_PA ? "PA" : "VA"));
 		if (bus_iova_mode == RTE_IOVA_PA) {
 			buses_want_pa = true;
 			if (!RTE_IOVA_IN_MBUF)
-				RTE_LOG(WARNING, EAL,
-					"Bus %s wants IOVA as PA not compatible with 'enable_iova_as_pa=false' build option.\n",
+				RTE_LOG_LINE(WARNING, EAL,
+					"Bus %s wants IOVA as PA not compatible with 'enable_iova_as_pa=false' build option.",
 					rte_bus_name(bus));
 		} else if (bus_iova_mode == RTE_IOVA_VA)
 			buses_want_va = true;
@@ -255,8 +255,8 @@ rte_bus_get_iommu_class(void)
 	} else {
 		mode = RTE_IOVA_DC;
 		if (buses_want_va) {
-			RTE_LOG(WARNING, EAL, "Some buses want 'VA' but forcing 'DC' because other buses want 'PA'.\n");
-			RTE_LOG(WARNING, EAL, "Depending on the final decision by the EAL, not all buses may be able to initialize.\n");
+			RTE_LOG_LINE(WARNING, EAL, "Some buses want 'VA' but forcing 'DC' because other buses want 'PA'.");
+			RTE_LOG_LINE(WARNING, EAL, "Depending on the final decision by the EAL, not all buses may be able to initialize.");
 		}
 	}
 
lib/eal/common/eal_common_class.c +2 -2
index 0187076af1..02a983b286 100644
@@ -19,14 +19,14 @@ rte_class_register(struct rte_class *class)
 	RTE_VERIFY(class->name && strlen(class->name));
 
 	TAILQ_INSERT_TAIL(&rte_class_list, class, next);
-	RTE_LOG(DEBUG, EAL, "Registered [%s] device class.\n", class->name);
+	RTE_LOG_LINE(DEBUG, EAL, "Registered [%s] device class.", class->name);
 }
 
 void
 rte_class_unregister(struct rte_class *class)
 {
 	TAILQ_REMOVE(&rte_class_list, class, next);
-	RTE_LOG(DEBUG, EAL, "Unregistered [%s] device class.\n", class->name);
+	RTE_LOG_LINE(DEBUG, EAL, "Unregistered [%s] device class.", class->name);
 }
 
 struct rte_class *
lib/eal/common/eal_common_config.c +1 -1
index 0daf0f3188..4b6530f2fb 100644
@@ -31,7 +31,7 @@ int
 eal_set_runtime_dir(const char *run_dir)
 {
 	if (strlcpy(runtime_dir, run_dir, PATH_MAX) >= PATH_MAX) {
-		RTE_LOG(ERR, EAL, "Runtime directory string too long\n");
+		RTE_LOG_LINE(ERR, EAL, "Runtime directory string too long");
 		return -1;
 	}
 
lib/eal/common/eal_common_debug.c +3 -3
index 9cac9c6390..065843f34e 100644
@@ -16,7 +16,7 @@ __rte_panic(const char *funcname, const char *format, ...)
 {
 	va_list ap;
 
-	rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n", funcname);
+	RTE_LOG_LINE(CRIT, EAL, "PANIC in %s():", funcname);
 	va_start(ap, format);
 	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
 	va_end(ap);
@@ -42,7 +42,7 @@ rte_exit(int exit_code, const char *format, ...)
 	va_end(ap);
 
 	if (rte_eal_cleanup() != 0 && rte_errno != EALREADY)
-		RTE_LOG(CRIT, EAL,
-			"EAL could not release all resources\n");
+		RTE_LOG_LINE(CRIT, EAL,
+			"EAL could not release all resources");
 	exit(exit_code);
 }
lib/eal/common/eal_common_dev.c +40 -40

226 lines not on this page · raw message

lib/eal/common/eal_common_devargs.c +9 -9
index fb5d0a293b..dbf5affa76 100644
@@ -39,12 +39,12 @@ devargs_bus_parse_default(struct rte_devargs *devargs,
 	/* Parse devargs name from bus key-value list. */
 	name = rte_kvargs_get(bus_args, "name");
 	if (name == NULL) {
-		RTE_LOG(DEBUG, EAL, "devargs name not found: %s\n",
+		RTE_LOG_LINE(DEBUG, EAL, "devargs name not found: %s",
 			devargs->data);
 		return 0;
 	}
 	if (rte_strscpy(devargs->name, name, sizeof(devargs->name)) < 0) {
-		RTE_LOG(ERR, EAL, "devargs name too long: %s\n",
+		RTE_LOG_LINE(ERR, EAL, "devargs name too long: %s",
 			devargs->data);
 		return -E2BIG;
 	}
@@ -79,7 +79,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
 	if (devargs->data != devstr) {
 		devargs->data = strdup(devstr);
 		if (devargs->data == NULL) {
-			RTE_LOG(ERR, EAL, "OOM\n");
+			RTE_LOG_LINE(ERR, EAL, "OOM");
 			ret = -ENOMEM;
 			goto get_out;
 		}
@@ -133,7 +133,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
 			devargs->bus_str = layers[i].str;
 			devargs->bus = rte_bus_find_by_name(kv->value);
 			if (devargs->bus == NULL) {
-				RTE_LOG(ERR, EAL, "Could not find bus \"%s\"\n",
+				RTE_LOG_LINE(ERR, EAL, "Could not find bus \"%s\"",
 					kv->value);
 				ret = -EFAULT;
 				goto get_out;
@@ -142,7 +142,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
 			devargs->cls_str = layers[i].str;
 			devargs->cls = rte_class_find_by_name(kv->value);
 			if (devargs->cls == NULL) {
-				RTE_LOG(ERR, EAL, "Could not find class \"%s\"\n",
+				RTE_LOG_LINE(ERR, EAL, "Could not find class \"%s\"",
 					kv->value);
 				ret = -EFAULT;
 				goto get_out;
@@ -217,7 +217,7 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev)
 		da->name[i] = devname[i];
 		i++;
 		if (i == maxlen) {
-			RTE_LOG(WARNING, EAL, "Parsing \"%s\": device name should be shorter than %zu\n",
+			RTE_LOG_LINE(WARNING, EAL, "Parsing \"%s\": device name should be shorter than %zu",
 				dev, maxlen);
 			da->name[i - 1] = '\0';
 			return -EINVAL;
@@ -227,7 +227,7 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev)
 	if (bus == NULL) {
 		bus = rte_bus_find_by_device_name(da->name);
 		if (bus == NULL) {
-			RTE_LOG(ERR, EAL, "failed to parse device \"%s\"\n",
+			RTE_LOG_LINE(ERR, EAL, "failed to parse device \"%s\"",
 				da->name);
 			return -EFAULT;
 		}
@@ -239,7 +239,7 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev)
 	else
 		da->data = strdup("");
 	if (da->data == NULL) {
-		RTE_LOG(ERR, EAL, "not enough memory to parse arguments\n");
+		RTE_LOG_LINE(ERR, EAL, "not enough memory to parse arguments");
 		return -ENOMEM;
 	}
 	da->drv_str = da->data;
@@ -266,7 +266,7 @@ rte_devargs_parsef(struct rte_devargs *da, const char *format, ...)
 	len += 1;
 	dev = calloc(1, (size_t)len);
 	if (dev == NULL) {
-		RTE_LOG(ERR, EAL, "not enough memory to parse device\n");
+		RTE_LOG_LINE(ERR, EAL, "not enough memory to parse device");
 		return -ENOMEM;
 	}
 
lib/eal/common/eal_common_dynmem.c +17 -17
index 95da55d9b0..721cb63bf2 100644
@@ -76,7 +76,7 @@ eal_dynmem_memseg_lists_init(void)
 	n_memtypes = internal_conf->num_hugepage_sizes * rte_socket_count();
 	memtypes = calloc(n_memtypes, sizeof(*memtypes));
 	if (memtypes == NULL) {
-		RTE_LOG(ERR, EAL, "Cannot allocate space for memory types\n");
+		RTE_LOG_LINE(ERR, EAL, "Cannot allocate space for memory types");
 		return -1;
 	}
 
@@ -101,8 +101,8 @@ eal_dynmem_memseg_lists_init(void)
 			memtypes[cur_type].page_sz = hugepage_sz;
 			memtypes[cur_type].socket_id = socket_id;
 
-			RTE_LOG(DEBUG, EAL, "Detected memory type: "
-				"socket_id:%u hugepage_sz:%" PRIu64 "\n",
+			RTE_LOG_LINE(DEBUG, EAL, "Detected memory type: "
+				"socket_id:%u hugepage_sz:%" PRIu64,
 				socket_id, hugepage_sz);
 		}
 	}
@@ -120,7 +120,7 @@ eal_dynmem_memseg_lists_init(void)
 	max_seglists_per_type = RTE_MAX_MEMSEG_LISTS / n_memtypes;
 
 	if (max_seglists_per_type == 0) {
-		RTE_LOG(ERR, EAL, "Cannot accommodate all memory types, please increase RTE_MAX_MEMSEG_LISTS\n");
+		RTE_LOG_LINE(ERR, EAL, "Cannot accommodate all memory types, please increase RTE_MAX_MEMSEG_LISTS");
 		goto out;
 	}
 
@@ -171,15 +171,15 @@ eal_dynmem_memseg_lists_init(void)
 		/* limit number of segment lists according to our maximum */
 		n_seglists = RTE_MIN(n_seglists, max_seglists_per_type);
 
-		RTE_LOG(DEBUG, EAL, "Creating %i segment lists: "
-				"n_segs:%i socket_id:%i hugepage_sz:%" PRIu64 "\n",
+		RTE_LOG_LINE(DEBUG, EAL, "Creating %i segment lists: "
+				"n_segs:%i socket_id:%i hugepage_sz:%" PRIu64,
 			n_seglists, n_segs, socket_id, pagesz);
 
 		/* create all segment lists */
 		for (cur_seglist = 0; cur_seglist < n_seglists; cur_seglist++) {
 			if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
-				RTE_LOG(ERR, EAL,
-					"No more space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS\n");
+				RTE_LOG_LINE(ERR, EAL,
+					"No more space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS");
 				goto out;
 			}
 			msl = &mcfg->memsegs[msl_idx++];
@@ -189,7 +189,7 @@ eal_dynmem_memseg_lists_init(void)
 				goto out;
 
 			if (eal_memseg_list_alloc(msl, 0)) {
-				RTE_LOG(ERR, EAL, "Cannot allocate VA space for memseg list\n");
+				RTE_LOG_LINE(ERR, EAL, "Cannot allocate VA space for memseg list");
 				goto out;
 			}
 		}
@@ -287,9 +287,9 @@ eal_dynmem_hugepage_init(void)
 			if (num_pages == 0)
 				continue;
 
-			RTE_LOG(DEBUG, EAL,
+			RTE_LOG_LINE(DEBUG, EAL,
 				"Allocating %u pages of size %" PRIu64 "M "
-				"on socket %i\n",
+				"on socket %i",
 				num_pages, hpi->hugepage_sz >> 20, socket_id);
 
 			/* we may not be able to allocate all pages in one go,
@@ -307,7 +307,7 @@ eal_dynmem_hugepage_init(void)
 
 				pages = malloc(sizeof(*pages) * needed);
 				if (pages == NULL) {
-					RTE_LOG(ERR, EAL, "Failed to malloc pages\n");
+					RTE_LOG_LINE(ERR, EAL, "Failed to malloc pages");
 					return -1;
 				}
 
@@ -342,7 +342,7 @@ eal_dynmem_hugepage_init(void)
 				continue;
 			if (rte_mem_alloc_validator_register("socket-limit",
 					limits_callback, i, limit))
-				RTE_LOG(ERR, EAL, "Failed to register socket limits validator callback\n");
+				RTE_LOG_LINE(ERR, EAL, "Failed to register socket limits validator callback");
 		}
 	}
 	return 0;
@@ -515,8 +515,8 @@ eal_dynmem_calc_num_pages_per_socket(
 				internal_conf->socket_mem[socket] / 0x100000);
 			available = requested -
 				((unsigned int)(memory[socket] / 0x100000));
-			RTE_LOG(ERR, EAL, "Not enough memory available on "
-				"socket %u! Requested: %uMB, available: %uMB\n",
+			RTE_LOG_LINE(ERR, EAL, "Not enough memory available on "
+				"socket %u! Requested: %uMB, available: %uMB",
 				socket, requested, available);
 			return -1;
 		}
@@ -526,8 +526,8 @@ eal_dynmem_calc_num_pages_per_socket(
 	if (total_mem > 0) {
 		requested = (unsigned int)(internal_conf->memory / 0x100000);
 		available = requested - (unsigned int)(total_mem / 0x100000);
-		RTE_LOG(ERR, EAL, "Not enough memory available! "
-			"Requested: %uMB, available: %uMB\n",
+		RTE_LOG_LINE(ERR, EAL, "Not enough memory available! "
+			"Requested: %uMB, available: %uMB",
 			requested, available);
 		return -1;
 	}
lib/eal/common/eal_common_fbarray.c +6 -6
index 2055bfa57d..7b90e01500 100644
@@ -83,7 +83,7 @@ resize_and_map(int fd, const char *path, void *addr, size_t len)
 	void *map_addr;
 
 	if (eal_file_truncate(fd, len)) {
-		RTE_LOG(ERR, EAL, "Cannot truncate %s\n", path);
+		RTE_LOG_LINE(ERR, EAL, "Cannot truncate %s", path);
 		return -1;
 	}
 
@@ -755,7 +755,7 @@ rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,
 		void *new_data = rte_mem_map(data, mmap_len,
 			RTE_PROT_READ | RTE_PROT_WRITE, flags, fd, 0);
 		if (new_data == NULL) {
-			RTE_LOG(DEBUG, EAL, "%s(): couldn't remap anonymous memory: %s\n",
+			RTE_LOG_LINE(DEBUG, EAL, "%s(): couldn't remap anonymous memory: %s",
 					__func__, rte_strerror(rte_errno));
 			goto fail;
 		}
@@ -770,12 +770,12 @@ rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,
 		 */
 		fd = eal_file_open(path, EAL_OPEN_CREATE | EAL_OPEN_READWRITE);
 		if (fd < 0) {
-			RTE_LOG(DEBUG, EAL, "%s(): couldn't open %s: %s\n",
+			RTE_LOG_LINE(DEBUG, EAL, "%s(): couldn't open %s: %s",
 				__func__, path, rte_strerror(rte_errno));
 			goto fail;
 		} else if (eal_file_lock(
 				fd, EAL_FLOCK_EXCLUSIVE, EAL_FLOCK_RETURN)) {
-			RTE_LOG(DEBUG, EAL, "%s(): couldn't lock %s: %s\n",
+			RTE_LOG_LINE(DEBUG, EAL, "%s(): couldn't lock %s: %s",
 				__func__, path, rte_strerror(rte_errno));
 			rte_errno = EBUSY;
 			goto fail;
@@ -1017,7 +1017,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)
 		 */
 		fd = tmp->fd;
 		if (eal_file_lock(fd, EAL_FLOCK_EXCLUSIVE, EAL_FLOCK_RETURN)) {
-			RTE_LOG(DEBUG, EAL, "Cannot destroy fbarray - another process is using it\n");
+			RTE_LOG_LINE(DEBUG, EAL, "Cannot destroy fbarray - another process is using it");
 			rte_errno = EBUSY;
 			ret = -1;
 			goto out;
@@ -1026,7 +1026,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)
 		/* we're OK to destroy the file */
 		eal_get_fbarray_path(path, sizeof(path), arr->name);
 		if (unlink(path)) {
-			RTE_LOG(DEBUG, EAL, "Cannot unlink fbarray: %s\n",
+			RTE_LOG_LINE(DEBUG, EAL, "Cannot unlink fbarray: %s",
 				strerror(errno));
 			rte_errno = errno;
 			/*
lib/eal/common/eal_common_interrupts.c +19 -19
index 97b64fed58..6a5723a068 100644
@@ -15,7 +15,7 @@
 /* Macros to check for valid interrupt handle */
 #define CHECK_VALID_INTR_HANDLE(intr_handle) do { \
 	if (intr_handle == NULL) { \
-		RTE_LOG(DEBUG, EAL, "Interrupt instance unallocated\n"); \
+		RTE_LOG_LINE(DEBUG, EAL, "Interrupt instance unallocated"); \
 		rte_errno = EINVAL; \
 		goto fail; \
 	} \
@@ -37,7 +37,7 @@ struct rte_intr_handle *rte_intr_instance_alloc(uint32_t flags)
 	 * defined flags.
 	 */
 	if ((flags & ~RTE_INTR_INSTANCE_KNOWN_FLAGS) != 0) {
-		RTE_LOG(DEBUG, EAL, "Invalid alloc flag passed 0x%x\n", flags);
+		RTE_LOG_LINE(DEBUG, EAL, "Invalid alloc flag passed 0x%x", flags);
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -48,7 +48,7 @@ struct rte_intr_handle *rte_intr_instance_alloc(uint32_t flags)
 	else
 		intr_handle = calloc(1, sizeof(*intr_handle));
 	if (intr_handle == NULL) {
-		RTE_LOG(ERR, EAL, "Failed to allocate intr_handle\n");
+		RTE_LOG_LINE(ERR, EAL, "Failed to allocate intr_handle");
 		rte_errno = ENOMEM;
 		return NULL;
 	}
@@ -61,7 +61,7 @@ struct rte_intr_handle *rte_intr_instance_alloc(uint32_t flags)
 			sizeof(int));
 	}
 	if (intr_handle->efds == NULL) {
-		RTE_LOG(ERR, EAL, "Fail to allocate event fd list\n");
+		RTE_LOG_LINE(ERR, EAL, "Fail to allocate event fd list");
 		rte_errno = ENOMEM;
 		goto fail;
 	}
@@ -75,7 +75,7 @@ struct rte_intr_handle *rte_intr_instance_alloc(uint32_t flags)
 			sizeof(struct rte_epoll_event));
 	}
 	if (intr_handle->elist == NULL) {
-		RTE_LOG(ERR, EAL, "fail to allocate event fd list\n");
+		RTE_LOG_LINE(ERR, EAL, "fail to allocate event fd list");
 		rte_errno = ENOMEM;
 		goto fail;
 	}
@@ -100,7 +100,7 @@ struct rte_intr_handle *rte_intr_instance_dup(const struct rte_intr_handle *src)
 	struct rte_intr_handle *intr_handle;
 
 	if (src == NULL) {
-		RTE_LOG(DEBUG, EAL, "Source interrupt instance unallocated\n");
+		RTE_LOG_LINE(DEBUG, EAL, "Source interrupt instance unallocated");
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -129,7 +129,7 @@ int rte_intr_event_list_update(struct rte_intr_handle *intr_handle, int size)
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (size == 0) {
-		RTE_LOG(DEBUG, EAL, "Size can't be zero\n");
+		RTE_LOG_LINE(DEBUG, EAL, "Size can't be zero");
 		rte_errno = EINVAL;
 		goto fail;
 	}
@@ -143,7 +143,7 @@ int rte_intr_event_list_update(struct rte_intr_handle *intr_handle, int size)
 		tmp_efds = realloc(intr_handle->efds, size * sizeof(int));
 	}
 	if (tmp_efds == NULL) {
-		RTE_LOG(ERR, EAL, "Failed to realloc the efds list\n");
+		RTE_LOG_LINE(ERR, EAL, "Failed to realloc the efds list");
 		rte_errno = ENOMEM;
 		goto fail;
 	}
@@ -157,7 +157,7 @@ int rte_intr_event_list_update(struct rte_intr_handle *intr_handle, int size)
 			size * sizeof(struct rte_epoll_event));
 	}
 	if (tmp_elist == NULL) {
-		RTE_LOG(ERR, EAL, "Failed to realloc the event list\n");
+		RTE_LOG_LINE(ERR, EAL, "Failed to realloc the event list");
 		rte_errno = ENOMEM;
 		goto fail;
 	}
@@ -253,8 +253,8 @@ int rte_intr_max_intr_set(struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (max_intr > intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Maximum interrupt vector ID (%d) exceeds "
-			"the number of available events (%d)\n", max_intr,
+		RTE_LOG_LINE(DEBUG, EAL, "Maximum interrupt vector ID (%d) exceeds "
+			"the number of available events (%d)", max_intr,
 			intr_handle->nb_intr);
 		rte_errno = ERANGE;
 		goto fail;
@@ -332,7 +332,7 @@ int rte_intr_efds_index_get(const struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Invalid index %d, max limit %d\n", index,
+		RTE_LOG_LINE(DEBUG, EAL, "Invalid index %d, max limit %d", index,
 			intr_handle->nb_intr);
 		rte_errno = EINVAL;
 		goto fail;
@@ -349,7 +349,7 @@ int rte_intr_efds_index_set(struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Invalid index %d, max limit %d\n", index,
+		RTE_LOG_LINE(DEBUG, EAL, "Invalid index %d, max limit %d", index,
 			intr_handle->nb_intr);
 		rte_errno = ERANGE;
 		goto fail;
@@ -368,7 +368,7 @@ struct rte_epoll_event *rte_intr_elist_index_get(
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Invalid index %d, max limit %d\n", index,
+		RTE_LOG_LINE(DEBUG, EAL, "Invalid index %d, max limit %d", index,
 			intr_handle->nb_intr);
 		rte_errno = ERANGE;
 		goto fail;
@@ -385,7 +385,7 @@ int rte_intr_elist_index_set(struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Invalid index %d, max limit %d\n", index,
+		RTE_LOG_LINE(DEBUG, EAL, "Invalid index %d, max limit %d", index,
 			intr_handle->nb_intr);
 		rte_errno = ERANGE;
 		goto fail;
@@ -408,7 +408,7 @@ int rte_intr_vec_list_alloc(struct rte_intr_handle *intr_handle,
 		return 0;
 
 	if (size > intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Invalid size %d, max limit %d\n", size,
+		RTE_LOG_LINE(DEBUG, EAL, "Invalid size %d, max limit %d", size,
 			intr_handle->nb_intr);
 		rte_errno = ERANGE;
 		goto fail;
@@ -419,7 +419,7 @@ int rte_intr_vec_list_alloc(struct rte_intr_handle *intr_handle,
 	else
 		intr_handle->intr_vec = calloc(size, sizeof(int));
 	if (intr_handle->intr_vec == NULL) {
-		RTE_LOG(ERR, EAL, "Failed to allocate %d intr_vec\n", size);
+		RTE_LOG_LINE(ERR, EAL, "Failed to allocate %d intr_vec", size);
 		rte_errno = ENOMEM;
 		goto fail;
 	}
@@ -437,7 +437,7 @@ int rte_intr_vec_list_index_get(const struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->vec_list_size) {
-		RTE_LOG(DEBUG, EAL, "Index %d greater than vec list size %d\n",
+		RTE_LOG_LINE(DEBUG, EAL, "Index %d greater than vec list size %d",
 			index, intr_handle->vec_list_size);
 		rte_errno = ERANGE;
 		goto fail;
@@ -454,7 +454,7 @@ int rte_intr_vec_list_index_set(struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->vec_list_size) {
-		RTE_LOG(DEBUG, EAL, "Index %d greater than vec list size %d\n",
+		RTE_LOG_LINE(DEBUG, EAL, "Index %d greater than vec list size %d",
 			index, intr_handle->vec_list_size);
 		rte_errno = ERANGE;
 		goto fail;
lib/eal/common/eal_common_lcore.c +13 -13
index 6807a38247..4ec1996d12 100644
@@ -174,8 +174,8 @@ rte_eal_cpu_init(void)
 		lcore_config[lcore_id].core_role = ROLE_RTE;
 		lcore_config[lcore_id].core_id = eal_cpu_core_id(lcore_id);
 		lcore_config[lcore_id].socket_id = socket_id;
-		RTE_LOG(DEBUG, EAL, "Detected lcore %u as "
-				"core %u on socket %u\n",
+		RTE_LOG_LINE(DEBUG, EAL, "Detected lcore %u as "
+				"core %u on socket %u",
 				lcore_id, lcore_config[lcore_id].core_id,
 				lcore_config[lcore_id].socket_id);
 		count++;
@@ -183,17 +183,17 @@ rte_eal_cpu_init(void)
 	for (; lcore_id < CPU_SETSIZE; lcore_id++) {
 		if (eal_cpu_detected(lcore_id) == 0)
 			continue;
-		RTE_LOG(DEBUG, EAL, "Skipped lcore %u as core %u on socket %u\n",
+		RTE_LOG_LINE(DEBUG, EAL, "Skipped lcore %u as core %u on socket %u",
 			lcore_id, eal_cpu_core_id(lcore_id),
 			eal_cpu_socket_id(lcore_id));
 	}
 
 	/* Set the count of enabled logical cores of the EAL configuration */
 	config->lcore_count = count;
-	RTE_LOG(DEBUG, EAL,
-			"Maximum logical cores by configuration: %u\n",
+	RTE_LOG_LINE(DEBUG, EAL,
+			"Maximum logical cores by configuration: %u",
 			RTE_MAX_LCORE);
-	RTE_LOG(INFO, EAL, "Detected CPU lcores: %u\n", config->lcore_count);
+	RTE_LOG_LINE(INFO, EAL, "Detected CPU lcores: %u", config->lcore_count);
 
 	/* sort all socket id's in ascending order */
 	qsort(lcore_to_socket_id, RTE_DIM(lcore_to_socket_id),
@@ -208,7 +208,7 @@ rte_eal_cpu_init(void)
 					socket_id;
 		prev_socket_id = socket_id;
 	}
-	RTE_LOG(INFO, EAL, "Detected NUMA nodes: %u\n", config->numa_node_count);
+	RTE_LOG_LINE(INFO, EAL, "Detected NUMA nodes: %u", config->numa_node_count);
 
 	return 0;
 }
@@ -247,7 +247,7 @@ callback_init(struct lcore_callback *callback, unsigned int lcore_id)
 {
 	if (callback->init == NULL)
 		return 0;
-	RTE_LOG(DEBUG, EAL, "Call init for lcore callback %s, lcore_id %u\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Call init for lcore callback %s, lcore_id %u",
 		callback->name, lcore_id);
 	return callback->init(lcore_id, callback->arg);
 }
@@ -257,7 +257,7 @@ callback_uninit(struct lcore_callback *callback, unsigned int lcore_id)
 {
 	if (callback->uninit == NULL)
 		return;
-	RTE_LOG(DEBUG, EAL, "Call uninit for lcore callback %s, lcore_id %u\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Call uninit for lcore callback %s, lcore_id %u",
 		callback->name, lcore_id);
 	callback->uninit(lcore_id, callback->arg);
 }
@@ -311,7 +311,7 @@ rte_lcore_callback_register(const char *name, rte_lcore_init_cb init,
 	}
 no_init:
 	TAILQ_INSERT_TAIL(&lcore_callbacks, callback, next);
-	RTE_LOG(DEBUG, EAL, "Registered new lcore callback %s (%sinit, %suninit).\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Registered new lcore callback %s (%sinit, %suninit).",
 		callback->name, callback->init == NULL ? "NO " : "",
 		callback->uninit == NULL ? "NO " : "");
 out:
@@ -339,7 +339,7 @@ rte_lcore_callback_unregister(void *handle)
 no_uninit:
 	TAILQ_REMOVE(&lcore_callbacks, callback, next);
 	rte_rwlock_write_unlock(&lcore_lock);
-	RTE_LOG(DEBUG, EAL, "Unregistered lcore callback %s-%p.\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Unregistered lcore callback %s-%p.",
 		callback->name, callback->arg);
 	free_callback(callback);
 }
@@ -361,7 +361,7 @@ eal_lcore_non_eal_allocate(void)
 		break;
 	}
 	if (lcore_id == RTE_MAX_LCORE) {
-		RTE_LOG(DEBUG, EAL, "No lcore available.\n");
+		RTE_LOG_LINE(DEBUG, EAL, "No lcore available.");
 		goto out;
 	}
 	TAILQ_FOREACH(callback, &lcore_callbacks, next) {
@@ -375,7 +375,7 @@ eal_lcore_non_eal_allocate(void)
 			callback_uninit(prev, lcore_id);
 			prev = TAILQ_PREV(prev, lcore_callbacks_head, next);
 		}
-		RTE_LOG(DEBUG, EAL, "Initialization refused for lcore %u.\n",
+		RTE_LOG_LINE(DEBUG, EAL, "Initialization refused for lcore %u.",
 			lcore_id);
 		cfg->lcore_role[lcore_id] = ROLE_OFF;
 		cfg->lcore_count--;
lib/eal/common/eal_common_memalloc.c +6 -6
index ab04479c1c..feb22c2b2f 100644
@@ -186,7 +186,7 @@ eal_memalloc_mem_event_callback_register(const char *name,
 
 	ret = 0;
 
-	RTE_LOG(DEBUG, EAL, "Mem event callback '%s:%p' registered\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Mem event callback '%s:%p' registered",
 			name, arg);
 
 unlock:
@@ -225,7 +225,7 @@ eal_memalloc_mem_event_callback_unregister(const char *name, void *arg)
 
 	ret = 0;
 
-	RTE_LOG(DEBUG, EAL, "Mem event callback '%s:%p' unregistered\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Mem event callback '%s:%p' unregistered",
 			name, arg);
 
 unlock:
@@ -242,7 +242,7 @@ eal_memalloc_mem_event_notify(enum rte_mem_event event, const void *start,
 	rte_rwlock_read_lock(&mem_event_rwlock);
 
 	TAILQ_FOREACH(entry, &mem_event_callback_list, next) {
-		RTE_LOG(DEBUG, EAL, "Calling mem event callback '%s:%p'\n",
+		RTE_LOG_LINE(DEBUG, EAL, "Calling mem event callback '%s:%p'",
 			entry->name, entry->arg);
 		entry->clb(event, start, len, entry->arg);
 	}
@@ -293,7 +293,7 @@ eal_memalloc_mem_alloc_validator_register(const char *name,
 
 	ret = 0;
 
-	RTE_LOG(DEBUG, EAL, "Mem alloc validator '%s' on socket %i with limit %zu registered\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Mem alloc validator '%s' on socket %i with limit %zu registered",
 		name, socket_id, limit);
 
 unlock:
@@ -332,7 +332,7 @@ eal_memalloc_mem_alloc_validator_unregister(const char *name, int socket_id)
 
 	ret = 0;
 
-	RTE_LOG(DEBUG, EAL, "Mem alloc validator '%s' on socket %i unregistered\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Mem alloc validator '%s' on socket %i unregistered",
 		name, socket_id);
 
 unlock:
@@ -351,7 +351,7 @@ eal_memalloc_mem_alloc_validate(int socket_id, size_t new_len)
 	TAILQ_FOREACH(entry, &mem_alloc_validator_list, next) {
 		if (entry->socket_id != socket_id || entry->limit > new_len)
 			continue;
-		RTE_LOG(DEBUG, EAL, "Calling mem alloc validator '%s' on socket %i\n",
+		RTE_LOG_LINE(DEBUG, EAL, "Calling mem alloc validator '%s' on socket %i",
 			entry->name, entry->socket_id);
 		if (entry->clb(socket_id, entry->limit, new_len) < 0)
 			ret = -1;
lib/eal/common/eal_common_memory.c +33 -33

227 lines not on this page · raw message

lib/eal/common/eal_common_memzone.c +12 -12
index 1f3e701499..fc478d0fac 100644
@@ -31,13 +31,13 @@ rte_memzone_max_set(size_t max)
 	struct rte_mem_config *mcfg;
 
 	if (eal_get_internal_configuration()->init_complete > 0) {
-		RTE_LOG(ERR, EAL, "Max memzone cannot be set after EAL init\n");
+		RTE_LOG_LINE(ERR, EAL, "Max memzone cannot be set after EAL init");
 		return -1;
 	}
 
 	mcfg = rte_eal_get_configuration()->mem_config;
 	if (mcfg == NULL) {
-		RTE_LOG(ERR, EAL, "Failed to set max memzone count\n");
+		RTE_LOG_LINE(ERR, EAL, "Failed to set max memzone count");
 		return -1;
 	}
 
@@ -116,16 +116,16 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
 
 	/* no more room in config */
 	if (arr->count >= arr->len) {
-		RTE_LOG(ERR, EAL,
+		RTE_LOG_LINE(ERR, EAL,
 		"%s(): Number of requested memzone segments exceeds maximum "
-		"%u\n", __func__, arr->len);
+		"%u", __func__, arr->len);
 
 		rte_errno = ENOSPC;
 		return NULL;
 	}
 
 	if (strlen(name) > sizeof(mz->name) - 1) {
-		RTE_LOG(DEBUG, EAL, "%s(): memzone <%s>: name too long\n",
+		RTE_LOG_LINE(DEBUG, EAL, "%s(): memzone <%s>: name too long",
 			__func__, name);
 		rte_errno = ENAMETOOLONG;
 		return NULL;
@@ -133,7 +133,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
 
 	/* zone already exist */
 	if ((memzone_lookup_thread_unsafe(name)) != NULL) {
-		RTE_LOG(DEBUG, EAL, "%s(): memzone <%s> already exists\n",
+		RTE_LOG_LINE(DEBUG, EAL, "%s(): memzone <%s> already exists",
 			__func__, name);
 		rte_errno = EEXIST;
 		return NULL;
@@ -141,7 +141,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
 
 	/* if alignment is not a power of two */
 	if (align && !rte_is_power_of_2(align)) {
-		RTE_LOG(ERR, EAL, "%s(): Invalid alignment: %u\n", __func__,
+		RTE_LOG_LINE(ERR, EAL, "%s(): Invalid alignment: %u", __func__,
 				align);
 		rte_errno = EINVAL;
 		return NULL;
@@ -218,7 +218,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
 	}
 
 	if (mz == NULL) {
-		RTE_LOG(ERR, EAL, "%s(): Cannot find free memzone\n", __func__);
+		RTE_LOG_LINE(ERR, EAL, "%s(): Cannot find free memzone", __func__);
 		malloc_heap_free(elem);
 		rte_errno = ENOSPC;
 		return NULL;
@@ -323,7 +323,7 @@ rte_memzone_free(const struct rte_memzone *mz)
 	if (found_mz == NULL) {
 		ret = -EINVAL;
 	} else if (found_mz->addr == NULL) {
-		RTE_LOG(ERR, EAL, "Memzone is not allocated\n");
+		RTE_LOG_LINE(ERR, EAL, "Memzone is not allocated");
 		ret = -EINVAL;
 	} else {
 		addr = found_mz->addr;
@@ -385,7 +385,7 @@ dump_memzone(const struct rte_memzone *mz, void *arg)
 	/* go through each page occupied by this memzone */
 	msl = rte_mem_virt2memseg_list(mz->addr);
 	if (!msl) {
-		RTE_LOG(DEBUG, EAL, "Skipping bad memzone\n");
+		RTE_LOG_LINE(DEBUG, EAL, "Skipping bad memzone");
 		return;
 	}
 	page_sz = (size_t)mz->hugepage_sz;
@@ -434,11 +434,11 @@ rte_eal_memzone_init(void)
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY &&
 			rte_fbarray_init(&mcfg->memzones, "memzone",
 			rte_memzone_max_get(), sizeof(struct rte_memzone))) {
-		RTE_LOG(ERR, EAL, "Cannot allocate memzone list\n");
+		RTE_LOG_LINE(ERR, EAL, "Cannot allocate memzone list");
 		ret = -1;
 	} else if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
 			rte_fbarray_attach(&mcfg->memzones)) {
-		RTE_LOG(ERR, EAL, "Cannot attach to memzone list\n");
+		RTE_LOG_LINE(ERR, EAL, "Cannot attach to memzone list");
 		ret = -1;
 	}
 
lib/eal/common/eal_common_options.c +118 -118

646 lines not on this page · raw message

lib/eal/common/eal_common_proc.c +56 -56

423 lines not on this page · raw message

lib/eal/common/eal_common_tailqs.c +6 -6
index 580fbf24bc..06a6cac4ff 100644
@@ -109,8 +109,8 @@ int
 rte_eal_tailq_register(struct rte_tailq_elem *t)
 {
 	if (rte_eal_tailq_local_register(t) < 0) {
-		RTE_LOG(ERR, EAL,
-			"%s tailq is already registered\n", t->name);
+		RTE_LOG_LINE(ERR, EAL,
+			"%s tailq is already registered", t->name);
 		goto error;
 	}
 
@@ -119,8 +119,8 @@ rte_eal_tailq_register(struct rte_tailq_elem *t)
 	if (rte_tailqs_count >= 0) {
 		rte_eal_tailq_update(t);
 		if (t->head == NULL) {
-			RTE_LOG(ERR, EAL,
-				"Cannot initialize tailq: %s\n", t->name);
+			RTE_LOG_LINE(ERR, EAL,
+				"Cannot initialize tailq: %s", t->name);
 			TAILQ_REMOVE(&rte_tailq_elem_head, t, next);
 			goto error;
 		}
@@ -145,8 +145,8 @@ rte_eal_tailqs_init(void)
 		 * rte_eal_tailq_register and EAL_REGISTER_TAILQ */
 		rte_eal_tailq_update(t);
 		if (t->head == NULL) {
-			RTE_LOG(ERR, EAL,
-				"Cannot initialize tailq: %s\n", t->name);
+			RTE_LOG_LINE(ERR, EAL,
+				"Cannot initialize tailq: %s", t->name);
 			/* TAILQ_REMOVE not needed, error is already fatal */
 			goto fail;
 		}
lib/eal/common/eal_common_thread.c +6 -6
index c422ea8b53..b0974a7aa5 100644
@@ -86,7 +86,7 @@ int
 rte_thread_set_affinity(rte_cpuset_t *cpusetp)
 {
 	if (rte_thread_set_affinity_by_id(rte_thread_self(), cpusetp) != 0) {
-		RTE_LOG(ERR, EAL, "rte_thread_set_affinity_by_id failed\n");
+		RTE_LOG_LINE(ERR, EAL, "rte_thread_set_affinity_by_id failed");
 		return -1;
 	}
 
@@ -175,7 +175,7 @@ eal_thread_loop(void *arg)
 	__rte_thread_init(lcore_id, &lcore_config[lcore_id].cpuset);
 
 	ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset));
-	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
+	RTE_LOG_LINE(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s%s])",
 		lcore_id, rte_thread_self().opaque_id, cpuset,
 		ret == 0 ? "" : "...");
 
@@ -368,12 +368,12 @@ rte_thread_register(void)
 
 	/* EAL init flushes all lcores, we can't register before. */
 	if (eal_get_internal_configuration()->init_complete != 1) {
-		RTE_LOG(DEBUG, EAL, "Called %s before EAL init.\n", __func__);
+		RTE_LOG_LINE(DEBUG, EAL, "Called %s before EAL init.", __func__);
 		rte_errno = EINVAL;
 		return -1;
 	}
 	if (!rte_mp_disable()) {
-		RTE_LOG(ERR, EAL, "Multiprocess in use, registering non-EAL threads is not supported.\n");
+		RTE_LOG_LINE(ERR, EAL, "Multiprocess in use, registering non-EAL threads is not supported.");
 		rte_errno = EINVAL;
 		return -1;
 	}
@@ -387,7 +387,7 @@ rte_thread_register(void)
 		rte_errno = ENOMEM;
 		return -1;
 	}
-	RTE_LOG(DEBUG, EAL, "Registered non-EAL thread as lcore %u.\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Registered non-EAL thread as lcore %u.",
 		lcore_id);
 	return 0;
 }
@@ -401,7 +401,7 @@ rte_thread_unregister(void)
 		eal_lcore_non_eal_release(lcore_id);
 	__rte_thread_uninit();
 	if (lcore_id != LCORE_ID_ANY)
-		RTE_LOG(DEBUG, EAL, "Unregistered non-EAL thread (was lcore %u).\n",
+		RTE_LOG_LINE(DEBUG, EAL, "Unregistered non-EAL thread (was lcore %u).",
 			lcore_id);
 }
 
lib/eal/common/eal_common_timer.c +3 -3
index 5686a5102b..bd2ca85c6c 100644
@@ -39,8 +39,8 @@ static uint64_t
 estimate_tsc_freq(void)
 {
 #define CYC_PER_10MHZ 1E7
-	RTE_LOG(WARNING, EAL, "WARNING: TSC frequency estimated roughly"
-		" - clock timings may be less accurate.\n");
+	RTE_LOG_LINE(WARNING, EAL, "WARNING: TSC frequency estimated roughly"
+		" - clock timings may be less accurate.");
 	/* assume that the rte_delay_us_sleep() will sleep for 1 second */
 	uint64_t start = rte_rdtsc();
 	rte_delay_us_sleep(US_PER_S);
@@ -71,7 +71,7 @@ set_tsc_freq(void)
 	if (!freq)
 		freq = estimate_tsc_freq();
 
-	RTE_LOG(DEBUG, EAL, "TSC frequency is ~%" PRIu64 " KHz\n", freq / 1000);
+	RTE_LOG_LINE(DEBUG, EAL, "TSC frequency is ~%" PRIu64 " KHz", freq / 1000);
 	eal_tsc_resolution_hz = freq;
 	mcfg->tsc_hz = freq;
 }
lib/eal/common/eal_common_trace_utils.c +1 -1
index 8561a0e198..f5e724f9cd 100644
@@ -348,7 +348,7 @@ trace_mkdir(void)
 		return -rte_errno;
 	}
 
-	RTE_LOG(INFO, EAL, "Trace dir: %s\n", trace->dir);
+	RTE_LOG_LINE(INFO, EAL, "Trace dir: %s", trace->dir);
 	already_done = true;
 	return 0;
 }
lib/eal/common/eal_trace.h +2 -2
index ace2ef3ee5..4dbd6ea457 100644
@@ -17,10 +17,10 @@
 #include "eal_thread.h"
 
 #define trace_err(fmt, args...) \
-	RTE_LOG(ERR, EAL, "%s():%u " fmt "\n", __func__, __LINE__, ## args)
+	RTE_LOG_LINE(ERR, EAL, "%s():%u " fmt, __func__, __LINE__, ## args)
 
 #define trace_crit(fmt, args...) \
-	RTE_LOG(CRIT, EAL, "%s():%u " fmt "\n", __func__, __LINE__, ## args)
+	RTE_LOG_LINE(CRIT, EAL, "%s():%u " fmt, __func__, __LINE__, ## args)
 
 #define TRACE_CTF_MAGIC 0xC1FC1FC1
 #define TRACE_MAX_ARGS	32
lib/eal/common/hotplug_mp.c +27 -27

205 lines not on this page · raw message

lib/eal/common/malloc_elem.c +3 -3
index f5d1c8c2e2..6e9d5b8660 100644
@@ -148,7 +148,7 @@ malloc_elem_insert(struct malloc_elem *elem)
 
 	/* first and last elements must be both NULL or both non-NULL */
 	if ((heap->first == NULL) != (heap->last == NULL)) {
-		RTE_LOG(ERR, EAL, "Heap is probably corrupt\n");
+		RTE_LOG_LINE(ERR, EAL, "Heap is probably corrupt");
 		return;
 	}
 
@@ -628,7 +628,7 @@ malloc_elem_hide_region(struct malloc_elem *elem, void *start, size_t len)
 
 			malloc_elem_free_list_insert(hide_end);
 		} else if (len_after > 0) {
-			RTE_LOG(ERR, EAL, "Unaligned element, heap is probably corrupt\n");
+			RTE_LOG_LINE(ERR, EAL, "Unaligned element, heap is probably corrupt");
 			return;
 		}
 	}
@@ -647,7 +647,7 @@ malloc_elem_hide_region(struct malloc_elem *elem, void *start, size_t len)
 
 			malloc_elem_free_list_insert(prev);
 		} else if (len_before > 0) {
-			RTE_LOG(ERR, EAL, "Unaligned element, heap is probably corrupt\n");
+			RTE_LOG_LINE(ERR, EAL, "Unaligned element, heap is probably corrupt");
 			return;
 		}
 	}
lib/eal/common/malloc_heap.c +20 -20
index 6b6cf9174c..010c84c36c 100644
@@ -117,7 +117,7 @@ malloc_add_seg(const struct rte_memseg_list *msl,
 
 	heap_idx = malloc_socket_to_heap_id(msl->socket_id);
 	if (heap_idx < 0) {
-		RTE_LOG(ERR, EAL, "Memseg list has invalid socket id\n");
+		RTE_LOG_LINE(ERR, EAL, "Memseg list has invalid socket id");
 		return -1;
 	}
 	heap = &mcfg->malloc_heaps[heap_idx];
@@ -135,7 +135,7 @@ malloc_add_seg(const struct rte_memseg_list *msl,
 
 	heap->total_size += len;
 
-	RTE_LOG(DEBUG, EAL, "Added %zuM to heap on socket %i\n", len >> 20,
+	RTE_LOG_LINE(DEBUG, EAL, "Added %zuM to heap on socket %i", len >> 20,
 			msl->socket_id);
 	return 0;
 }
@@ -308,7 +308,7 @@ alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,
 	/* first, check if we're allowed to allocate this memory */
 	if (eal_memalloc_mem_alloc_validate(socket,
 			heap->total_size + alloc_sz) < 0) {
-		RTE_LOG(DEBUG, EAL, "User has disallowed allocation\n");
+		RTE_LOG_LINE(DEBUG, EAL, "User has disallowed allocation");
 		return NULL;
 	}
 
@@ -324,7 +324,7 @@ alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,
 
 	/* check if we wanted contiguous memory but didn't get it */
 	if (contig && !eal_memalloc_is_contig(msl, map_addr, alloc_sz)) {
-		RTE_LOG(DEBUG, EAL, "%s(): couldn't allocate physically contiguous space\n",
+		RTE_LOG_LINE(DEBUG, EAL, "%s(): couldn't allocate physically contiguous space",
 				__func__);
 		goto fail;
 	}
@@ -352,8 +352,8 @@ alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,
 		 * which could solve some situations when IOVA VA is not
 		 * really needed.
 		 */
-		RTE_LOG(ERR, EAL,
-			"%s(): couldn't allocate memory due to IOVA exceeding limits of current DMA mask\n",
+		RTE_LOG_LINE(ERR, EAL,
+			"%s(): couldn't allocate memory due to IOVA exceeding limits of current DMA mask",
 			__func__);
 
 		/*
@@ -363,8 +363,8 @@ alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,
 		 */
 		if ((rte_eal_iova_mode() == RTE_IOVA_VA) &&
 		     rte_eal_using_phys_addrs())
-			RTE_LOG(ERR, EAL,
-				"%s(): Please try initializing EAL with --iova-mode=pa parameter\n",
+			RTE_LOG_LINE(ERR, EAL,
+				"%s(): Please try initializing EAL with --iova-mode=pa parameter",
 				__func__);
 		goto fail;
 	}
@@ -440,7 +440,7 @@ try_expand_heap_primary(struct malloc_heap *heap, uint64_t pg_sz,
 	}
 	heap->total_size += alloc_sz;
 
-	RTE_LOG(DEBUG, EAL, "Heap on socket %d was expanded by %zdMB\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Heap on socket %d was expanded by %zdMB",
 		socket, alloc_sz >> 20ULL);
 
 	free(ms);
@@ -693,7 +693,7 @@ malloc_heap_alloc_on_heap_id(const char *type, size_t size,
 
 		/* this should have succeeded */
 		if (ret == NULL)
-			RTE_LOG(ERR, EAL, "Error allocating from heap\n");
+			RTE_LOG_LINE(ERR, EAL, "Error allocating from heap");
 	}
 alloc_unlock:
 	rte_spinlock_unlock(&(heap->lock));
@@ -1040,7 +1040,7 @@ malloc_heap_free(struct malloc_elem *elem)
 	/* we didn't exit early, meaning we have unmapped some pages */
 	unmapped = true;
 
-	RTE_LOG(DEBUG, EAL, "Heap on socket %d was shrunk by %zdMB\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Heap on socket %d was shrunk by %zdMB",
 		msl->socket_id, aligned_len >> 20ULL);
 
 	rte_mcfg_mem_write_unlock();
@@ -1199,7 +1199,7 @@ malloc_heap_create_external_seg(void *va_addr, rte_iova_t iova_addrs[],
 		}
 	}
 	if (msl == NULL) {
-		RTE_LOG(ERR, EAL, "Couldn't find empty memseg list\n");
+		RTE_LOG_LINE(ERR, EAL, "Couldn't find empty memseg list");
 		rte_errno = ENOSPC;
 		return NULL;
 	}
@@ -1210,7 +1210,7 @@ malloc_heap_create_external_seg(void *va_addr, rte_iova_t iova_addrs[],
 	/* create the backing fbarray */
 	if (rte_fbarray_init(&msl->memseg_arr, fbarray_name, n_pages,
 			sizeof(struct rte_memseg)) < 0) {
-		RTE_LOG(ERR, EAL, "Couldn't create fbarray backing the memseg list\n");
+		RTE_LOG_LINE(ERR, EAL, "Couldn't create fbarray backing the memseg list");
 		return NULL;
 	}
 	arr = &msl->memseg_arr;
@@ -1310,7 +1310,7 @@ malloc_heap_add_external_memory(struct malloc_heap *heap,
 	heap->total_size += msl->len;
 
 	/* all done! */
-	RTE_LOG(DEBUG, EAL, "Added segment for heap %s starting at %p\n",
+	RTE_LOG_LINE(DEBUG, EAL, "Added segment for heap %s starting at %p",
 			heap->name, msl->base_va);
 
 	/* notify all subscribers that a new memory area has been added */
@@ -1356,7 +1356,7 @@ malloc_heap_create(struct malloc_heap *heap, const char *heap_name)
 
 	/* prevent overflow. did you really create 2 billion heaps??? */
 	if (next_socket_id > INT32_MAX) {
-		RTE_LOG(ERR, EAL, "Cannot assign new socket ID's\n");
+		RTE_LOG_LINE(ERR, EAL, "Cannot assign new socket ID's");
 		rte_errno = ENOSPC;
 		return -1;
 	}
@@ -1382,17 +1382,17 @@ int
 malloc_heap_destroy(struct malloc_heap *heap)
 {
 	if (heap->alloc_count != 0) {
-		RTE_LOG(ERR, EAL, "Heap is still in use\n");
+		RTE_LOG_LINE(ERR, EAL, "Heap is still in use");
 		rte_errno = EBUSY;
 		return -1;
 	}
 	if (heap->first != NULL || heap->last != NULL) {
-		RTE_LOG(ERR, EAL, "Heap still contains memory segments\n");
+		RTE_LOG_LINE(ERR, EAL, "Heap still contains memory segments");
 		rte_errno = EBUSY;
 		return -1;
 	}
 	if (heap->total_size != 0)
-		RTE_LOG(ERR, EAL, "Total size not zero, heap is likely corrupt\n");
+		RTE_LOG_LINE(ERR, EAL, "Total size not zero, heap is likely corrupt");
 
 	/* Reset all of the heap but the (hold) lock so caller can release it. */
 	RTE_BUILD_BUG_ON(offsetof(struct malloc_heap, lock) != 0);
@@ -1411,7 +1411,7 @@ rte_eal_malloc_heap_init(void)
 		eal_get_internal_configuration();
 
 	if (internal_conf->match_allocations)
-		RTE_LOG(DEBUG, EAL, "Hugepages will be freed exactly as allocated.\n");
+		RTE_LOG_LINE(DEBUG, EAL, "Hugepages will be freed exactly as allocated.");
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		/* assign min socket ID to external heaps */
@@ -1431,7 +1431,7 @@ rte_eal_malloc_heap_init(void)
 	}
 
 	if (register_mp_requests()) {
-		RTE_LOG(ERR, EAL, "Couldn't register malloc multiprocess actions\n");
+		RTE_LOG_LINE(ERR, EAL, "Couldn't register malloc multiprocess actions");
 		return -1;
 	}
 
lib/eal/common/malloc_mp.c +36 -36

159 lines not on this page · raw message

lib/eal/common/rte_keepalive.c +1 -1
index e0494b2010..699022ae1c 100644

Lines of this file are not shown. View the raw message.

lib/eal/common/rte_malloc.c +5 -5
index 9db0c399ae..9b3038805a 100644

Lines of this file are not shown. View the raw message.

lib/eal/common/rte_service.c +4 -4
index e183d2e631..3ed4186add 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal.c +38 -37

75 lines not on this page · raw message

lib/eal/freebsd/eal_alarm.c +1 -1
index e5b0909a45..2493adf8ae 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_dev.c +4 -4
index c3dfe9108f..8d35148ba3 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_hugepage_info.c +11 -11
index e58e618469..3c97daa444 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_interrupts.c +30 -30

60 lines not on this page · raw message

lib/eal/freebsd/eal_lcore.c +1 -1
index d9ef4bc9c5..cfd375076a 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_memalloc.c +5 -5
index 00ab02cb63..f96ed2ce21 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_memory.c +17 -17
index 5c6165c580..195f570da0 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_thread.c +1 -1
index 6f97a3c2c1..0f7284768a 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_timer.c +5 -5
index beff755a47..61488ff641 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal.c +61 -61

122 lines not on this page · raw message

lib/eal/linux/eal_alarm.c +1 -1
index 766ba2c251..3c0464ad10 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_dev.c +20 -20
index ac76f6174d..16e817121d 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_hugepage_info.c +19 -19
index 36a495fb1f..971c57989d 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_interrupts.c +58 -58

116 lines not on this page · raw message

lib/eal/linux/eal_lcore.c +2 -2
index 2e6a350603..42bf0ee7a1 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_memalloc.c +60 -60

120 lines not on this page · raw message

lib/eal/linux/eal_memory.c +104 -104

208 lines not on this page · raw message

lib/eal/linux/eal_thread.c +2 -2
index 880070c627..80b6f19a9e 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_timer.c +5 -5
index df9ad61ae9..3813b1a66e 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_vfio.c +135 -135

270 lines not on this page · raw message

lib/eal/linux/eal_vfio_mp_sync.c +2 -2
index 157f20e583..a78113844b 100644

Lines of this file are not shown. View the raw message.

lib/eal/riscv/rte_cycles.c +2 -2
index 358f271311..e27e02d9a9 100644

Lines of this file are not shown. View the raw message.

lib/eal/unix/eal_filesystem.c +7 -7
index afbab9368a..4d90c2707f 100644

Lines of this file are not shown. View the raw message.

lib/eal/unix/eal_firmware.c +1 -1
index 1a7cf8e7b7..b071bb1396 100644

Lines of this file are not shown. View the raw message.

lib/eal/unix/eal_unix_memory.c +4 -4
index 68ae93bd6e..16183fb395 100644

Lines of this file are not shown. View the raw message.

lib/eal/unix/rte_thread.c +17 -17
index 36a21ab2f9..bee77e9448 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal.c +18 -18
index 7ec2152211..b573fa7c74 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_alarm.c +6 -6
index 34b52380ce..c56aa0e687 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_debug.c +4 -4
index 56ed70df7d..be646080c3 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_dev.c +4 -4
index 35191056fd..264bc4a649 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_hugepages.c +5 -5
index 775c67e4c4..f2336fbe1e 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_interrupts.c +5 -5
index 49efdc098c..a9c62453b8 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_lcore.c +4 -3
index 286fe241eb..d65fa1e7a6 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_memalloc.c +25 -25

50 lines not on this page · raw message

lib/eal/windows/eal_memory.c +10 -10
index fd39155163..7e1e8d4c84 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_windows.h +2 -2
index 43b228d388..ee206f365d 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/include/rte_windows.h +3 -3
index 83730c3d2e..0b0d117865 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/rte_thread.c +14 -14
index 145ac4b5aa..7c62f57e0d 100644

Lines of this file are not shown. View the raw message.

lib/efd/rte_efd.c +29 -29

58 lines not on this page · raw message

lib/fib/rte_fib.c +7 -7
index f88e71a59d..3d9bf6fe9d 100644

Lines of this file are not shown. View the raw message.

lib/fib/rte_fib6.c +7 -7
index ab1d960479..2d23c09eea 100644

Lines of this file are not shown. View the raw message.

lib/hash/rte_cuckoo_hash.c +26 -26

52 lines not on this page · raw message

lib/hash/rte_fbk_hash.c +2 -2
index faeb50cd89..20433a92c8 100644

Lines of this file are not shown. View the raw message.

lib/hash/rte_hash_crc.c +6 -6
index 1439d8a71f..0d52840eaa 100644

Lines of this file are not shown. View the raw message.

lib/hash/rte_thash.c +10 -10
index d819dddd84..a5d84eee8e 100644

Lines of this file are not shown. View the raw message.

lib/hash/rte_thash_gfni.c +4 -4
index c863789b51..6b84180b62 100644

Lines of this file are not shown. View the raw message.

lib/ip_frag/rte_ip_frag_common.c +4 -4
index eed399da6b..02dcac3137 100644

Lines of this file are not shown. View the raw message.

lib/latencystats/rte_latencystats.c +20 -21

41 lines not on this page · raw message

lib/log/log.c +3 -3
index ab06132a98..fa22d128a7 100644

Lines of this file are not shown. View the raw message.

lib/lpm/rte_lpm.c +6 -6
index 0ca8214786..a332faf720 100644

Lines of this file are not shown. View the raw message.

lib/lpm/rte_lpm6.c +5 -5
index 24ce7dd022..251bfcc73d 100644

Lines of this file are not shown. View the raw message.

lib/mbuf/rte_mbuf.c +7 -7
index 3eccc61827..8472c6a977 100644

Lines of this file are not shown. View the raw message.

lib/mbuf/rte_mbuf_dyn.c +7 -7
index 4fb1863a10..a9f7bb2b81 100644

Lines of this file are not shown. View the raw message.

lib/mbuf/rte_mbuf_pool_ops.c +2 -2
index 5318430126..639aa557f8 100644

Lines of this file are not shown. View the raw message.

lib/mempool/rte_mempool.c +12 -12
index 2f8adad5ca..b66c8898a8 100644

Lines of this file are not shown. View the raw message.

lib/mempool/rte_mempool.h +1 -1
index 4f8511b8f5..30ce579737 100644

Lines of this file are not shown. View the raw message.

lib/mempool/rte_mempool_ops.c +5 -5
index e871de9ec9..d35e9b118b 100644

Lines of this file are not shown. View the raw message.

lib/pipeline/rte_pipeline.c +114 -114

228 lines not on this page · raw message

lib/port/rte_port_ethdev.c +9 -9
index e6bb7ee480..7f7eadda11 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_eventdev.c +9 -9
index 13350fd608..1d0571966c 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_fd.c +12 -12
index 7e140793b2..1b95d7b014 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_frag.c +7 -7
index e1f1892176..39ff31e447 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_ras.c +6 -6
index 15109661d1..1e697fd226 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_ring.c +9 -9
index 002efb7c3e..42b33763d1 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_sched.c +6 -6
index f6255c4346..e83112989f 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_source_sink.c +24 -24

48 lines not on this page · raw message

lib/port/rte_port_sym_crypto.c +9 -9
index 27b7e07cea..8e9abff9d6 100644

Lines of this file are not shown. View the raw message.

lib/power/guest_channel.c +19 -19
index a6f2097d5b..a9bbda8f48 100644

Lines of this file are not shown. View the raw message.

lib/power/power_acpi_cpufreq.c +53 -53

106 lines not on this page · raw message

lib/power/power_amd_pstate_cpufreq.c +60 -60

120 lines not on this page · raw message

lib/power/power_common.c +5 -5
index bf77eafa88..bc57642cd1 100644

Lines of this file are not shown. View the raw message.

lib/power/power_cppc_cpufreq.c +59 -59

118 lines not on this page · raw message

lib/power/power_intel_uncore.c +34 -34

68 lines not on this page · raw message

lib/power/power_kvm_vm.c +11 -11
index db031f4310..218799491e 100644

Lines of this file are not shown. View the raw message.

lib/power/power_pstate_cpufreq.c +72 -72

144 lines not on this page · raw message

lib/power/rte_power.c +11 -11
index 1502612b0a..7bee4f88f9 100644

Lines of this file are not shown. View the raw message.

lib/power/rte_power_pmd_mgmt.c +17 -17
index 6f18ed0adf..fb7d8fddb3 100644

Lines of this file are not shown. View the raw message.

lib/power/rte_power_uncore.c +7 -7
index 9c20fe150d..d57fc18faa 100644

Lines of this file are not shown. View the raw message.

lib/rcu/rte_rcu_qsbr.c +1 -1
index 5b6530788a..bd0b83be0c 100644

Lines of this file are not shown. View the raw message.

lib/reorder/rte_reorder.c +16 -16
index 640719c3ec..847e45b9f7 100644

Lines of this file are not shown. View the raw message.

lib/rib/rte_rib.c +5 -5
index 251d0d4ef1..baee4bff5a 100644

Lines of this file are not shown. View the raw message.

lib/rib/rte_rib6.c +5 -5
index ad3d48ab8e..ce54f51208 100644

Lines of this file are not shown. View the raw message.

lib/ring/rte_ring.c +12 -12
index 12046419f1..7fd6576c8c 100644

Lines of this file are not shown. View the raw message.

lib/sched/rte_pie.c +9 -9
index cce0ce762d..ac1f99e2bd 100644

Lines of this file are not shown. View the raw message.

lib/sched/rte_sched.c +137 -137

274 lines not on this page · raw message

lib/table/rte_table_acl.c +36 -36

72 lines not on this page · raw message

lib/table/rte_table_array.c +8 -8
index a45b29ed6a..0b3107104d 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_cuckoo.c +11 -11
index 86c960c103..228b49a893 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_ext.c +11 -11
index 9f0220ded2..38ea96c654 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_key16.c +19 -19
index 584c3f2c98..63b28f79c0 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_key32.c +19 -19
index 22b5ca9166..6293bf518b 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_key8.c +19 -19
index bd0ec4aac0..69e61c2ec8 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_lru.c +11 -11
index 758ec4fe7a..190062b33f 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_lpm.c +21 -21

42 lines not on this page · raw message

lib/table/rte_table_lpm_ipv6.c +22 -22

44 lines not on this page · raw message

lib/table/rte_table_stub.c +2 -2
index cc21516995..a54b502f79 100644

Lines of this file are not shown. View the raw message.

lib/vhost/fd_man.c +4 -4
index 83586c5b4f..ff91c3169a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.

#99 lore raw

Re: [PATCH v4 12/14] lib: convert to per line logging

18/12/2023 15:38, David Marchand:

Quoted 6 lines

Convert many libraries that call RTE_LOG(... "\n", ...) to RTE_LOG_LINE.

Note:
- for acl and sched libraries that still has some debug multilines messages, a direct call to RTE_LOG is used: this will make it easier to notice such special cases,

[...]

Quoted 1 line
 129 files changed, 2280 insertions(+), 2279 deletions(-)

It would be nice to keep RTE_LOG() only for multi-line as you do, and use RTE_LOG_LINE only in wrapper macros specific per library. This patch is using RTE_LOG_LINE directly in multiple places in libraries which do not have a dedicated wrapper macro. Would it be possible to introduce new wrappers for these libraries in this patch?

#100 lore raw

Re: [PATCH v4 12/14] lib: convert to per line logging

Quoted 10 lines · Thomas Monjalon

18/12/2023 15:38, David Marchand:

Quoted 6 lines

Convert many libraries that call RTE_LOG(... "\n", ...) to RTE_LOG_LINE.

Note:
- for acl and sched libraries that still has some debug multilines messages, a direct call to RTE_LOG is used: this will make it easier to notice such special cases,

[...]

Quoted 8 lines
Quoted 1 line
 129 files changed, 2280 insertions(+), 2279 deletions(-)

It would be nice to keep RTE_LOG() only for multi-line as you do, and use RTE_LOG_LINE only in wrapper macros specific per library. This patch is using RTE_LOG_LINE directly in multiple places in libraries which do not have a dedicated wrapper macro. Would it be possible to introduce new wrappers for these libraries in this patch?

It is doable and not too difficult to achieve with some scripting. I'll try in the v5 (since I need to send a new revision for build with -pedantic).

Signature · 1 line
David Marchand
#101 lore raw

PATCH v4 13/14 lib: replace logging helpers

In reply to David Marchand

This is a preparation step before the next change.

Many libraries have their own logging helpers that do not add a newline in their format string.
Some previous changes fixed places where some of those helpers are called without a trailing newline.
Using RTE_LOG_LINE in the existing helpers will ensure we don't introduce new issues in the future.

The problem is that if we simply convert to the RTE_LOG_LINE helper, a future fix may introduce a regression since the logging helper change won't be backported.

To address this concern, rename existing helpers: backporting a call to them will trigger some conflict or build issue in LTS branches.

Note:
- bpf and vhost that still has some debug multilines messages, a direct call to RTE_LOG/RTE_LOG_DP is used: this will make it easier to notice such special cases,
- about previously publicly exposed logging helpers, when such helper is not publicly used (iow in public inline API), it is removed from the public API (this is the case for the member library),

---
Changes since RFC v2:
- kept a RTE_ prefix for bpf log macro to avoid potential collision with external code,

---
 lib/bpf/bpf.c                        |   2 +-
 lib/bpf/bpf_convert.c                |  16 +-
 lib/bpf/bpf_exec.c                   |  12 +-
 lib/bpf/bpf_impl.h                   |   5 +-
 lib/bpf/bpf_jit_arm64.c              |   8 +-
 lib/bpf/bpf_jit_x86.c                |   4 +-
 lib/bpf/bpf_load.c                   |   2 +-
 lib/bpf/bpf_load_elf.c               |  24 +-
 lib/bpf/bpf_pkt.c                    |   4 +-
 lib/bpf/bpf_stub.c                   |   4 +-
 lib/bpf/bpf_validate.c               |  38 +-
 lib/ethdev/ethdev_driver.c           |  44 +-
 lib/ethdev/ethdev_pci.h              |   2 +-
 lib/ethdev/ethdev_private.c          |  10 +-
 lib/ethdev/rte_class_eth.c           |   2 +-
 lib/ethdev/rte_ethdev.c              | 878 +++++++++++++--------------
 lib/ethdev/rte_ethdev.h              |  52 +-
 lib/ethdev/rte_ethdev_cman.c         |  16 +-
 lib/ethdev/rte_ethdev_telemetry.c    |  44 +-
 lib/ethdev/rte_flow.c                |  64 +-
 lib/ethdev/rte_flow.h                |   3 -
 lib/ethdev/sff_telemetry.c           |  30 +-
 lib/member/member.h                  |  14 +
 lib/member/rte_member.c              |  15 +-
 lib/member/rte_member.h              |   9 -
 lib/member/rte_member_heap.h         |  39 +-
 lib/member/rte_member_ht.c           |  13 +-
 lib/member/rte_member_sketch.c       |  41 +-
 lib/member/rte_member_vbf.c          |   9 +-
 lib/pdump/rte_pdump.c                | 112 ++--
 lib/power/power_acpi_cpufreq.c       |  10 +-
 lib/power/power_amd_pstate_cpufreq.c |  12 +-
 lib/power/power_common.c             |   4 +-
 lib/power/power_common.h             |   6 +-
 lib/power/power_cppc_cpufreq.c       |  12 +-
 lib/power/power_intel_uncore.c       |   4 +-
 lib/power/power_pstate_cpufreq.c     |  12 +-
 lib/regexdev/rte_regexdev.c          |  86 +--
 lib/regexdev/rte_regexdev.h          |  14 +-
 lib/telemetry/telemetry.c            |  41 +-
 lib/vhost/iotlb.c                    |  18 +-
 lib/vhost/socket.c                   | 102 ++--
 lib/vhost/vdpa.c                     |   8 +-
 lib/vhost/vduse.c                    | 120 ++--
 lib/vhost/vduse.h                    |   4 +-
 lib/vhost/vhost.c                    | 118 ++--
 lib/vhost/vhost.h                    |  24 +-
 lib/vhost/vhost_user.c               | 508 ++++++++--------
 lib/vhost/virtio_net.c               | 188 +++---
 lib/vhost/virtio_net_ctrl.c          |  38 +-
 50 files changed, 1431 insertions(+), 1414 deletions(-)
 create mode 100644 lib/member/member.h
lib/bpf/bpf.c +1 -1
index 8a0254d8bb..bbe75c8bfe 100644
@@ -44,7 +44,7 @@ __rte_bpf_jit(struct rte_bpf *bpf)
 #endif
 
 	if (rc != 0)
-		RTE_BPF_LOG(WARNING, "%s(%p) failed, error code: %d;\n",
+		RTE_BPF_LOG_LINE(WARNING, "%s(%p) failed, error code: %d;",
 			__func__, bpf, rc);
 	return rc;
 }
lib/bpf/bpf_convert.c +8 -8
index d441be6663..d7ff2b4325 100644
@@ -226,8 +226,8 @@ static bool convert_bpf_load(const struct bpf_insn *fp,
 	case SKF_AD_OFF + SKF_AD_RANDOM:
 	case SKF_AD_OFF + SKF_AD_ALU_XOR_X:
 		/* Linux has special negative offsets to access meta-data. */
-		RTE_BPF_LOG(ERR,
-			    "rte_bpf_convert: socket offset %d not supported\n",
+		RTE_BPF_LOG_LINE(ERR,
+			    "rte_bpf_convert: socket offset %d not supported",
 			    fp->k - SKF_AD_OFF);
 		return true;
 	default:
@@ -246,7 +246,7 @@ static int bpf_convert_filter(const struct bpf_insn *prog, size_t len,
 	uint8_t bpf_src;
 
 	if (len > BPF_MAXINSNS) {
-		RTE_BPF_LOG(ERR, "%s: cBPF program too long (%zu insns)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s: cBPF program too long (%zu insns)",
 			    __func__, len);
 		return -EINVAL;
 	}
@@ -482,7 +482,7 @@ static int bpf_convert_filter(const struct bpf_insn *prog, size_t len,
 
 			/* Unknown instruction. */
 		default:
-			RTE_BPF_LOG(ERR, "%s: Unknown instruction!: %#x\n",
+			RTE_BPF_LOG_LINE(ERR, "%s: Unknown instruction!: %#x",
 				    __func__, fp->code);
 			goto err;
 		}
@@ -526,7 +526,7 @@ rte_bpf_convert(const struct bpf_program *prog)
 	int ret;
 
 	if (prog == NULL) {
-		RTE_BPF_LOG(ERR, "%s: NULL program\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: NULL program", __func__);
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -534,12 +534,12 @@ rte_bpf_convert(const struct bpf_program *prog)
 	/* 1st pass: calculate the eBPF program length */
 	ret = bpf_convert_filter(prog->bf_insns, prog->bf_len, NULL, &ebpf_len);
 	if (ret < 0) {
-		RTE_BPF_LOG(ERR, "%s: cannot get eBPF length\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: cannot get eBPF length", __func__);
 		rte_errno = -ret;
 		return NULL;
 	}
 
-	RTE_BPF_LOG(DEBUG, "%s: prog len cBPF=%u -> eBPF=%u\n",
+	RTE_BPF_LOG_LINE(DEBUG, "%s: prog len cBPF=%u -> eBPF=%u",
 		    __func__, prog->bf_len, ebpf_len);
 
 	prm = rte_zmalloc("bpf_filter",
@@ -555,7 +555,7 @@ rte_bpf_convert(const struct bpf_program *prog)
 	/* 2nd pass: remap cBPF to eBPF instructions  */
 	ret = bpf_convert_filter(prog->bf_insns, prog->bf_len, ebpf, &ebpf_len);
 	if (ret < 0) {
-		RTE_BPF_LOG(ERR, "%s: cannot convert cBPF to eBPF\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: cannot convert cBPF to eBPF", __func__);
 		free(prm);
 		rte_errno = -ret;
 		return NULL;
lib/bpf/bpf_exec.c +6 -6
index 09f4a9a571..5d597ec170 100644
@@ -43,8 +43,8 @@
 
 #define BPF_DIV_ZERO_CHECK(bpf, reg, ins, type) do { \
 	if ((type)(reg)[(ins)->src_reg] == 0) { \
-		RTE_BPF_LOG(ERR, \
-			"%s(%p): division by 0 at pc: %#zx;\n", \
+		RTE_BPF_LOG_LINE(ERR, \
+			"%s(%p): division by 0 at pc: %#zx;", \
 			__func__, bpf, \
 			(uintptr_t)(ins) - (uintptr_t)(bpf)->prm.ins); \
 		return 0; \
@@ -136,8 +136,8 @@ bpf_ld_mbuf(const struct rte_bpf *bpf, uint64_t reg[EBPF_REG_NUM],
 	mb = (const struct rte_mbuf *)(uintptr_t)reg[EBPF_REG_6];
 	p = rte_pktmbuf_read(mb, off, len, reg + EBPF_REG_0);
 	if (p == NULL)
-		RTE_BPF_LOG(DEBUG, "%s(bpf=%p, mbuf=%p, ofs=%u, len=%u): "
-			"load beyond packet boundary at pc: %#zx;\n",
+		RTE_BPF_LOG_LINE(DEBUG, "%s(bpf=%p, mbuf=%p, ofs=%u, len=%u): "
+			"load beyond packet boundary at pc: %#zx;",
 			__func__, bpf, mb, off, len,
 			(uintptr_t)(ins) - (uintptr_t)(bpf)->prm.ins);
 	return p;
@@ -462,8 +462,8 @@ bpf_exec(const struct rte_bpf *bpf, uint64_t reg[EBPF_REG_NUM])
 		case (BPF_JMP | EBPF_EXIT):
 			return reg[EBPF_REG_0];
 		default:
-			RTE_BPF_LOG(ERR,
-				"%s(%p): invalid opcode %#x at pc: %#zx;\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"%s(%p): invalid opcode %#x at pc: %#zx;",
 				__func__, bpf, ins->code,
 				(uintptr_t)ins - (uintptr_t)bpf->prm.ins);
 			return 0;
lib/bpf/bpf_impl.h +3 -2
index b483569071..6a82ae4ef2 100644
@@ -27,9 +27,10 @@ int __rte_bpf_jit_x86(struct rte_bpf *bpf);
 int __rte_bpf_jit_arm64(struct rte_bpf *bpf);
 
 extern int rte_bpf_logtype;
+#define RTE_LOGTYPE_BPF rte_bpf_logtype
 
-#define	RTE_BPF_LOG(lvl, fmt, args...) \
-	rte_log(RTE_LOG_## lvl, rte_bpf_logtype, fmt, ##args)
+#define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
+	RTE_LOG(lvl, BPF, fmt "\n", ##args)
 
 static inline size_t
 bpf_size(uint32_t bpf_op_sz)
lib/bpf/bpf_jit_arm64.c +4 -4
index f9ddafd7dc..96b8cd2e03 100644
@@ -98,8 +98,8 @@ check_invalid_args(struct a64_jit_ctx *ctx, uint32_t limit)
 
 	for (idx = 0; idx < limit; idx++) {
 		if (rte_le_to_cpu_32(ctx->ins[idx]) == A64_INVALID_OP_CODE) {
-			RTE_BPF_LOG(ERR,
-				"%s: invalid opcode at %u;\n", __func__, idx);
+			RTE_BPF_LOG_LINE(ERR,
+				"%s: invalid opcode at %u;", __func__, idx);
 			return -EINVAL;
 		}
 	}
@@ -1378,8 +1378,8 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf)
 			emit_epilogue(ctx);
 			break;
 		default:
-			RTE_BPF_LOG(ERR,
-				"%s(%p): invalid opcode %#x at pc: %u;\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"%s(%p): invalid opcode %#x at pc: %u;",
 				__func__, bpf, ins->code, i);
 			return -EINVAL;
 		}
lib/bpf/bpf_jit_x86.c +2 -2
index a73b2006db..4d74e418f8 100644
@@ -1476,8 +1476,8 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf)
 			emit_epilog(st);
 			break;
 		default:
-			RTE_BPF_LOG(ERR,
-				"%s(%p): invalid opcode %#x at pc: %u;\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"%s(%p): invalid opcode %#x at pc: %u;",
 				__func__, bpf, ins->code, i);
 			return -EINVAL;
 		}
lib/bpf/bpf_load.c +1 -1
index 45ce9210da..de43347405 100644
@@ -98,7 +98,7 @@ rte_bpf_load(const struct rte_bpf_prm *prm)
 
 	if (rc != 0) {
 		rte_errno = -rc;
-		RTE_BPF_LOG(ERR, "%s: %d-th xsym is invalid\n", __func__, i);
+		RTE_BPF_LOG_LINE(ERR, "%s: %d-th xsym is invalid", __func__, i);
 		return NULL;
 	}
 
lib/bpf/bpf_load_elf.c +12 -12
index 02a5d8ba0d..e0abd3c856 100644
@@ -84,8 +84,8 @@ resolve_xsym(const char *sn, size_t ofs, struct ebpf_insn *ins, size_t ins_sz,
 		 * as an ordinary EBPF_CALL.
 		 */
 		if (ins[idx].src_reg == EBPF_PSEUDO_CALL) {
-			RTE_BPF_LOG(INFO, "%s(%u): "
-				"EBPF_PSEUDO_CALL to external function: %s\n",
+			RTE_BPF_LOG_LINE(INFO, "%s(%u): "
+				"EBPF_PSEUDO_CALL to external function: %s",
 				__func__, idx, sn);
 			ins[idx].src_reg = EBPF_REG_0;
 		}
@@ -121,7 +121,7 @@ check_elf_header(const Elf64_Ehdr *eh)
 		err = "unexpected machine type";
 
 	if (err != NULL) {
-		RTE_BPF_LOG(ERR, "%s(): %s\n", __func__, err);
+		RTE_BPF_LOG_LINE(ERR, "%s(): %s", __func__, err);
 		return -EINVAL;
 	}
 
@@ -144,7 +144,7 @@ find_elf_code(Elf *elf, const char *section, Elf_Data **psd, size_t *pidx)
 	eh = elf64_getehdr(elf);
 	if (eh == NULL) {
 		rc = elf_errno();
-		RTE_BPF_LOG(ERR, "%s(%p, %s) error code: %d(%s)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p, %s) error code: %d(%s)",
 			__func__, elf, section, rc, elf_errmsg(rc));
 		return -EINVAL;
 	}
@@ -167,7 +167,7 @@ find_elf_code(Elf *elf, const char *section, Elf_Data **psd, size_t *pidx)
 	if (sd == NULL || sd->d_size == 0 ||
 			sd->d_size % sizeof(struct ebpf_insn) != 0) {
 		rc = elf_errno();
-		RTE_BPF_LOG(ERR, "%s(%p, %s) error code: %d(%s)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p, %s) error code: %d(%s)",
 			__func__, elf, section, rc, elf_errmsg(rc));
 		return -EINVAL;
 	}
@@ -216,8 +216,8 @@ process_reloc(Elf *elf, size_t sym_idx, Elf64_Rel *re, size_t re_sz,
 
 		rc = resolve_xsym(sn, ofs, ins, ins_sz, prm);
 		if (rc != 0) {
-			RTE_BPF_LOG(ERR,
-				"resolve_xsym(%s, %zu) error code: %d\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"resolve_xsym(%s, %zu) error code: %d",
 				sn, ofs, rc);
 			return rc;
 		}
@@ -309,7 +309,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 	fd = open(fname, O_RDONLY);
 	if (fd < 0) {
 		rc = errno;
-		RTE_BPF_LOG(ERR, "%s(%s) error code: %d(%s)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%s) error code: %d(%s)",
 			__func__, fname, rc, strerror(rc));
 		rte_errno = EINVAL;
 		return NULL;
@@ -319,15 +319,15 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 	close(fd);
 
 	if (bpf == NULL) {
-		RTE_BPF_LOG(ERR,
+		RTE_BPF_LOG_LINE(ERR,
 			"%s(fname=\"%s\", sname=\"%s\") failed, "
-			"error code: %d\n",
+			"error code: %d",
 			__func__, fname, sname, rte_errno);
 		return NULL;
 	}
 
-	RTE_BPF_LOG(INFO, "%s(fname=\"%s\", sname=\"%s\") "
-		"successfully creates %p(jit={.func=%p,.sz=%zu});\n",
+	RTE_BPF_LOG_LINE(INFO, "%s(fname=\"%s\", sname=\"%s\") "
+		"successfully creates %p(jit={.func=%p,.sz=%zu});",
 		__func__, fname, sname, bpf, bpf->jit.func, bpf->jit.sz);
 	return bpf;
 }
lib/bpf/bpf_pkt.c +2 -2
index 7a8e4a6ef4..793a75ded9 100644
@@ -512,7 +512,7 @@ bpf_eth_elf_load(struct bpf_eth_cbh *cbh, uint16_t port, uint16_t queue,
 		ftx = select_tx_callback(prm->prog_arg.type, flags);
 
 	if (frx == NULL && ftx == NULL) {
-		RTE_BPF_LOG(ERR, "%s(%u, %u): no callback selected;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%u, %u): no callback selected;",
 			__func__, port, queue);
 		return -EINVAL;
 	}
@@ -524,7 +524,7 @@ bpf_eth_elf_load(struct bpf_eth_cbh *cbh, uint16_t port, uint16_t queue,
 	rte_bpf_get_jit(bpf, &jit);
 
 	if ((flags & RTE_BPF_ETH_F_JIT) != 0 && jit.func == NULL) {
-		RTE_BPF_LOG(ERR, "%s(%u, %u): no JIT generated;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%u, %u): no JIT generated;",
 			__func__, port, queue);
 		rte_bpf_destroy(bpf);
 		return -ENOTSUP;
lib/bpf/bpf_stub.c +2 -2
index 83c2203622..1babb16bde 100644
@@ -19,7 +19,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 		return NULL;
 	}
 
-	RTE_BPF_LOG(ERR, "%s() is not supported, rebuild with libelf installed\n",
+	RTE_BPF_LOG_LINE(ERR, "%s() is not supported, rebuild with libelf installed",
 		__func__);
 	rte_errno = ENOTSUP;
 	return NULL;
@@ -35,7 +35,7 @@ rte_bpf_convert(const struct bpf_program *prog)
 		return NULL;
 	}
 
-	RTE_BPF_LOG(ERR, "%s() is not supported, rebuild with libpcap installed\n",
+	RTE_BPF_LOG_LINE(ERR, "%s() is not supported, rebuild with libpcap installed",
 		__func__);
 	rte_errno = ENOTSUP;
 	return NULL;
lib/bpf/bpf_validate.c +19 -19
index f246b3c5eb..79be5e917d 100644
@@ -1812,15 +1812,15 @@ add_edge(struct bpf_verifier *bvf, struct inst_node *node, uint32_t nidx)
 	uint32_t ne;
 
 	if (nidx > bvf->prm->nb_ins) {
-		RTE_BPF_LOG(ERR, "%s: program boundary violation at pc: %u, "
-			"next pc: %u\n",
+		RTE_BPF_LOG_LINE(ERR, "%s: program boundary violation at pc: %u, "
+			"next pc: %u",
 			__func__, get_node_idx(bvf, node), nidx);
 		return -EINVAL;
 	}
 
 	ne = node->nb_edge;
 	if (ne >= RTE_DIM(node->edge_dest)) {
-		RTE_BPF_LOG(ERR, "%s: internal error at pc: %u\n",
+		RTE_BPF_LOG_LINE(ERR, "%s: internal error at pc: %u",
 			__func__, get_node_idx(bvf, node));
 		return -EINVAL;
 	}
@@ -1927,7 +1927,7 @@ log_unreachable(const struct bpf_verifier *bvf)
 
 		if (node->colour == WHITE &&
 				ins->code != (BPF_LD | BPF_IMM | EBPF_DW))
-			RTE_BPF_LOG(ERR, "unreachable code at pc: %u;\n", i);
+			RTE_BPF_LOG_LINE(ERR, "unreachable code at pc: %u;", i);
 	}
 }
 
@@ -1948,8 +1948,8 @@ log_loop(const struct bpf_verifier *bvf)
 
 		for (j = 0; j != node->nb_edge; j++) {
 			if (node->edge_type[j] == BACK_EDGE)
-				RTE_BPF_LOG(ERR,
-					"loop at pc:%u --> pc:%u;\n",
+				RTE_BPF_LOG_LINE(ERR,
+					"loop at pc:%u --> pc:%u;",
 					i, node->edge_dest[j]);
 		}
 	}
@@ -1979,7 +1979,7 @@ validate(struct bpf_verifier *bvf)
 
 		err = check_syntax(ins);
 		if (err != 0) {
-			RTE_BPF_LOG(ERR, "%s: %s at pc: %u\n",
+			RTE_BPF_LOG_LINE(ERR, "%s: %s at pc: %u",
 				__func__, err, i);
 			rc |= -EINVAL;
 		}
@@ -2048,7 +2048,7 @@ validate(struct bpf_verifier *bvf)
 
 	dfs(bvf);
 
-	RTE_BPF_LOG(DEBUG, "%s(%p) stats:\n"
+	RTE_LOG(DEBUG, BPF, "%s(%p) stats:\n"
 		"nb_nodes=%u;\n"
 		"nb_jcc_nodes=%u;\n"
 		"node_color={[WHITE]=%u, [GREY]=%u,, [BLACK]=%u};\n"
@@ -2062,7 +2062,7 @@ validate(struct bpf_verifier *bvf)
 		bvf->edge_type[BACK_EDGE], bvf->edge_type[CROSS_EDGE]);
 
 	if (bvf->node_colour[BLACK] != bvf->nb_nodes) {
-		RTE_BPF_LOG(ERR, "%s(%p) unreachable instructions;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p) unreachable instructions;",
 			__func__, bvf);
 		log_unreachable(bvf);
 		return -EINVAL;
@@ -2070,13 +2070,13 @@ validate(struct bpf_verifier *bvf)
 
 	if (bvf->node_colour[GREY] != 0 || bvf->node_colour[WHITE] != 0 ||
 			bvf->edge_type[UNKNOWN_EDGE] != 0) {
-		RTE_BPF_LOG(ERR, "%s(%p) DFS internal error;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p) DFS internal error;",
 			__func__, bvf);
 		return -EINVAL;
 	}
 
 	if (bvf->edge_type[BACK_EDGE] != 0) {
-		RTE_BPF_LOG(ERR, "%s(%p) loops detected;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p) loops detected;",
 			__func__, bvf);
 		log_loop(bvf);
 		return -EINVAL;
@@ -2144,8 +2144,8 @@ save_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 	/* get new eval_state for this node */
 	st = pull_eval_state(bvf);
 	if (st == NULL) {
-		RTE_BPF_LOG(ERR,
-			"%s: internal error (out of space) at pc: %u\n",
+		RTE_BPF_LOG_LINE(ERR,
+			"%s: internal error (out of space) at pc: %u",
 			__func__, get_node_idx(bvf, node));
 		return -ENOMEM;
 	}
@@ -2157,7 +2157,7 @@ save_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 	node->evst = bvf->evst;
 	bvf->evst = st;
 
-	RTE_BPF_LOG(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;\n",
+	RTE_BPF_LOG_LINE(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;",
 		__func__, bvf, get_node_idx(bvf, node), node->evst, bvf->evst);
 
 	return 0;
@@ -2169,7 +2169,7 @@ save_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 static void
 restore_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 {
-	RTE_BPF_LOG(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;\n",
+	RTE_BPF_LOG_LINE(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;",
 		__func__, bvf, get_node_idx(bvf, node), bvf->evst, node->evst);
 
 	bvf->evst = node->evst;
@@ -2184,12 +2184,12 @@ log_dbg_eval_state(const struct bpf_verifier *bvf, const struct ebpf_insn *ins,
 	const struct bpf_eval_state *st;
 	const struct bpf_reg_val *rv;
 
-	RTE_BPF_LOG(DEBUG, "%s(pc=%u):\n", __func__, pc);
+	RTE_BPF_LOG_LINE(DEBUG, "%s(pc=%u):", __func__, pc);
 
 	st = bvf->evst;
 	rv = st->rv + ins->dst_reg;
 
-	RTE_BPF_LOG(DEBUG,
+	RTE_LOG(DEBUG, BPF,
 		"r%u={\n"
 		"\tv={type=%u, size=%zu},\n"
 		"\tmask=0x%" PRIx64 ",\n"
@@ -2263,7 +2263,7 @@ evaluate(struct bpf_verifier *bvf)
 			if (ins_chk[op].eval != NULL && rc == 0) {
 				err = ins_chk[op].eval(bvf, ins + idx);
 				if (err != NULL) {
-					RTE_BPF_LOG(ERR, "%s: %s at pc: %u\n",
+					RTE_BPF_LOG_LINE(ERR, "%s: %s at pc: %u",
 						__func__, err, idx);
 					rc = -EINVAL;
 				}
@@ -2312,7 +2312,7 @@ __rte_bpf_validate(struct rte_bpf *bpf)
 			bpf->prm.prog_arg.type != RTE_BPF_ARG_PTR &&
 			(sizeof(uint64_t) != sizeof(uintptr_t) ||
 			bpf->prm.prog_arg.type != RTE_BPF_ARG_PTR_MBUF)) {
-		RTE_BPF_LOG(ERR, "%s: unsupported argument type\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: unsupported argument type", __func__);
 		return -ENOTSUP;
 	}
 
lib/ethdev/ethdev_driver.c +22 -22

132 lines not on this page · raw message

lib/ethdev/ethdev_pci.h +1 -1
index ddb559aa95..737fff1833 100644
@@ -31,7 +31,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
 	struct rte_pci_device *pci_dev)
 {
 	if ((eth_dev == NULL) || (pci_dev == NULL)) {
-		RTE_ETHDEV_LOG(ERR, "NULL pointer eth_dev=%p pci_dev=%p\n",
+		RTE_ETHDEV_LOG_LINE(ERR, "NULL pointer eth_dev=%p pci_dev=%p",
 			(void *)eth_dev, (void *)pci_dev);
 		return;
 	}
lib/ethdev/ethdev_private.c +5 -5
index 0e1c7b23c1..a656df293c 100644
@@ -182,7 +182,7 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)
 		RTE_DIM(eth_da->representor_ports));
 done:
 	if (str == NULL)
-		RTE_ETHDEV_LOG(ERR, "wrong representor format: %s\n", str);
+		RTE_ETHDEV_LOG_LINE(ERR, "wrong representor format: %s", str);
 	return str == NULL ? -1 : 0;
 }
 
@@ -214,7 +214,7 @@ dummy_eth_rx_burst(void *rxq,
 
 	port_id = queue - per_port_queues;
 	if (port_id < RTE_DIM(per_port_queues) && !queue->rx_warn_once) {
-		RTE_ETHDEV_LOG(ERR, "lcore %u called rx_pkt_burst for not ready port %"PRIuPTR"\n",
+		RTE_ETHDEV_LOG_LINE(ERR, "lcore %u called rx_pkt_burst for not ready port %"PRIuPTR,
 			rte_lcore_id(), port_id);
 		rte_dump_stack();
 		queue->rx_warn_once = true;
@@ -233,7 +233,7 @@ dummy_eth_tx_burst(void *txq,
 
 	port_id = queue - per_port_queues;
 	if (port_id < RTE_DIM(per_port_queues) && !queue->tx_warn_once) {
-		RTE_ETHDEV_LOG(ERR, "lcore %u called tx_pkt_burst for not ready port %"PRIuPTR"\n",
+		RTE_ETHDEV_LOG_LINE(ERR, "lcore %u called tx_pkt_burst for not ready port %"PRIuPTR,
 			rte_lcore_id(), port_id);
 		rte_dump_stack();
 		queue->tx_warn_once = true;
@@ -337,7 +337,7 @@ eth_dev_shared_data_prepare(void)
 				sizeof(*eth_dev_shared_data),
 				rte_socket_id(), flags);
 		if (mz == NULL) {
-			RTE_ETHDEV_LOG(ERR, "Cannot allocate ethdev shared data\n");
+			RTE_ETHDEV_LOG_LINE(ERR, "Cannot allocate ethdev shared data");
 			goto out;
 		}
 
@@ -355,7 +355,7 @@ eth_dev_shared_data_prepare(void)
 			/* Clean remaining any traces of a previous shared mem */
 			eth_dev_shared_mz = NULL;
 			eth_dev_shared_data = NULL;
-			RTE_ETHDEV_LOG(ERR, "Cannot lookup ethdev shared data\n");
+			RTE_ETHDEV_LOG_LINE(ERR, "Cannot lookup ethdev shared data");
 			goto out;
 		}
 		if (mz == eth_dev_shared_mz && mz->addr == eth_dev_shared_data)
lib/ethdev/rte_class_eth.c +1 -1
index 311beb17cb..bc003db8af 100644
@@ -165,7 +165,7 @@ eth_dev_iterate(const void *start,
 			valid_keys = eth_params_keys;
 		kvargs = rte_kvargs_parse(str, valid_keys);
 		if (kvargs == NULL) {
-			RTE_ETHDEV_LOG(ERR, "cannot parse argument list\n");
+			RTE_ETHDEV_LOG_LINE(ERR, "cannot parse argument list");
 			rte_errno = EINVAL;
 			return NULL;
 		}
lib/ethdev/rte_ethdev.c +439 -439

2,395 lines not on this page · raw message

lib/ethdev/rte_ethdev.h +27 -25

39 lines not on this page · raw message

lib/ethdev/rte_ethdev_cman.c +8 -8
index a9c4637521..41e38bdc89 100644

Lines of this file are not shown. View the raw message.

lib/ethdev/rte_ethdev_telemetry.c +22 -22

44 lines not on this page · raw message

lib/ethdev/rte_flow.c +33 -31

64 lines not on this page · raw message

lib/ethdev/rte_flow.h +0 -3
index affdc8121b..78b6bbb159 100644

Lines of this file are not shown. View the raw message.

lib/ethdev/sff_telemetry.c +15 -15
index f29e7fa882..b3f239d967 100644

Lines of this file are not shown. View the raw message.

lib/member/member.h new file +14 -0
new file mode 100644
index 0000000000..a7b5b4a57c

Lines of this file are not shown. View the raw message.

lib/member/rte_member.c +8 -7
index 8f859f7fbd..57eb7affab 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member.h +0 -9
index b585904368..3278bbb5c1 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member_heap.h +20 -19
index 9c4a01aebe..e0a3d54eab 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member_ht.c +7 -6
index a85561b472..357097ff4b 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member_sketch.c +21 -20

41 lines not on this page · raw message

lib/member/rte_member_vbf.c +5 -4
index 5a0c51ecc0..5ad9487fad 100644

Lines of this file are not shown. View the raw message.

lib/pdump/rte_pdump.c +56 -56

112 lines not on this page · raw message

lib/power/power_acpi_cpufreq.c +5 -5
index dd143f2cc8..aecfdfa15d 100644

Lines of this file are not shown. View the raw message.

lib/power/power_amd_pstate_cpufreq.c +6 -6
index 44581fd48b..f8f43a49b2 100644

Lines of this file are not shown. View the raw message.

lib/power/power_common.c +2 -2
index bc57642cd1..b3d438c4de 100644

Lines of this file are not shown. View the raw message.

lib/power/power_common.h +3 -3
index c3fcbf4c10..ea2febbd86 100644

Lines of this file are not shown. View the raw message.

lib/power/power_cppc_cpufreq.c +6 -6
index 83e1e62830..31eb6942a2 100644

Lines of this file are not shown. View the raw message.

lib/power/power_intel_uncore.c +2 -2
index 0ee8e603d2..2cc3045056 100644

Lines of this file are not shown. View the raw message.

lib/power/power_pstate_cpufreq.c +6 -6
index 56aa302b5d..ca704e672c 100644

Lines of this file are not shown. View the raw message.

lib/regexdev/rte_regexdev.c +43 -43

86 lines not on this page · raw message

lib/regexdev/rte_regexdev.h +8 -6
index d50af775b5..a215d8768e 100644

Lines of this file are not shown. View the raw message.

lib/telemetry/telemetry.c +22 -19

41 lines not on this page · raw message

lib/vhost/iotlb.c +9 -9
index 10ab77262e..f2c275a7d7 100644

Lines of this file are not shown. View the raw message.

lib/vhost/socket.c +51 -51

102 lines not on this page · raw message

lib/vhost/vdpa.c +4 -4
index 219eef879c..9776fc07a9 100644

Lines of this file are not shown. View the raw message.

lib/vhost/vduse.c +60 -60

120 lines not on this page · raw message

lib/vhost/vduse.h +2 -2
index 4879b1f900..0d8f3f1205 100644

Lines of this file are not shown. View the raw message.

lib/vhost/vhost.c +59 -59

118 lines not on this page · raw message

lib/vhost/vhost.h +12 -12
index 5f24911190..5a74d0e628 100644

Lines of this file are not shown. View the raw message.

lib/vhost/vhost_user.c +254 -254

508 lines not on this page · raw message

lib/vhost/virtio_net.c +94 -94

188 lines not on this page · raw message

lib/vhost/virtio_net_ctrl.c +19 -19
index c4847f84ed..8f78122361 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.

#102 lore raw

PATCH v4 14/14 lib: use per line logging in helpers

In reply to David Marchand

Use RTE_LOG_LINE in existing macros that append a \n.

---
Changes since v3:
- fixed some checkpatch complaints,

Changes since RFC v1:
- converted all logging helpers in lib/,

---
 lib/bbdev/rte_bbdev.c                      |  5 +++--
 lib/bpf/bpf_impl.h                         |  2 +-
 lib/cfgfile/rte_cfgfile.c                  |  4 ++--
 lib/compressdev/rte_compressdev_internal.h |  5 +++--
 lib/cryptodev/rte_cryptodev.h              | 22 ++++++++++------------
 lib/dmadev/rte_dmadev.c                    |  6 ++++--
 lib/ethdev/rte_ethdev.h                    |  3 +--
 lib/eventdev/eventdev_pmd.h                | 12 ++++++------
 lib/eventdev/rte_event_timer_adapter.c     | 17 ++++++++++-------
 lib/gpudev/gpudev.c                        |  6 ++++--
 lib/graph/graph_private.h                  |  7 ++++---
 lib/member/member.h                        |  4 ++--
 lib/metrics/rte_metrics_telemetry.c        |  4 ++--
 lib/mldev/rte_mldev.h                      |  5 +++--
 lib/net/rte_net_crc.c                      |  8 ++++----
 lib/node/node_private.h                    |  8 +++++---
 lib/pdump/rte_pdump.c                      |  5 ++---
 lib/power/power_common.h                   |  2 +-
 lib/rawdev/rte_rawdev_pmd.h                |  4 ++--
 lib/rcu/rte_rcu_qsbr.h                     |  8 +++-----
 lib/regexdev/rte_regexdev.h                |  3 +--
 lib/stack/stack_pvt.h                      |  4 ++--
 lib/telemetry/telemetry.c                  |  4 +---
 lib/vhost/vhost.h                          |  8 ++++----
 lib/vhost/vhost_crypto.c                   |  6 +++---
 25 files changed, 83 insertions(+), 79 deletions(-)
lib/bbdev/rte_bbdev.c +3 -2
index e09bb97abb..13bde3c25b 100644
@@ -28,10 +28,11 @@
 
 /* BBDev library logging ID */
 RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE);
+#define RTE_LOGTYPE_BBDEV bbdev_logtype
 
 /* Helper macro for logging */
-#define rte_bbdev_log(level, fmt, ...) \
-	rte_log(RTE_LOG_ ## level, bbdev_logtype, fmt "\n", ##__VA_ARGS__)
+#define rte_bbdev_log(level, ...) \
+	RTE_LOG_LINE(level, BBDEV, "" __VA_ARGS__)
 
 #define rte_bbdev_log_debug(fmt, ...) \
 	rte_bbdev_log(DEBUG, RTE_STR(__LINE__) ":%s() " fmt, __func__, \
lib/bpf/bpf_impl.h +1 -1
index 6a82ae4ef2..1a3d97d0c7 100644
@@ -30,7 +30,7 @@ extern int rte_bpf_logtype;
 #define RTE_LOGTYPE_BPF rte_bpf_logtype
 
 #define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
-	RTE_LOG(lvl, BPF, fmt "\n", ##args)
+	RTE_LOG_LINE(lvl, BPF, fmt, ##args)
 
 static inline size_t
 bpf_size(uint32_t bpf_op_sz)
lib/cfgfile/rte_cfgfile.c +2 -2
index 2f9cc0722a..6a5e4fd942 100644
@@ -29,10 +29,10 @@ struct rte_cfgfile {
 
 /* Setting up dynamic logging 8< */
 RTE_LOG_REGISTER_DEFAULT(cfgfile_logtype, INFO);
+#define RTE_LOGTYPE_CFGFILE cfgfile_logtype
 
 #define CFG_LOG(level, fmt, args...)					\
-	rte_log(RTE_LOG_ ## level, cfgfile_logtype, "%s(): " fmt "\n",	\
-		__func__, ## args)
+	RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## args)
 /* >8 End of setting up dynamic logging */
 
 /** when we resize a file structure, how many extra entries
lib/compressdev/rte_compressdev_internal.h +3 -2
index b3b193e3ee..01b7764282 100644
@@ -21,9 +21,10 @@ extern "C" {
 
 /* Logging Macros */
 extern int compressdev_logtype;
+#define RTE_LOGTYPE_COMPRESSDEV compressdev_logtype
+
 #define COMPRESSDEV_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, compressdev_logtype, "%s(): " fmt "\n", \
-			__func__, ##args)
+	RTE_LOG_LINE(level, COMPRESSDEV, "%s(): " fmt, __func__, ## args)
 
 /**
  * Dequeue processed packets from queue pair of a device.
lib/cryptodev/rte_cryptodev.h +10 -12
index 30ad2d9a95..359b6c2b29 100644
@@ -36,24 +36,22 @@ extern int rte_cryptodev_logtype;
 
 /* Logging Macros */
 #define CDEV_LOG_ERR(...) \
-	RTE_LOG(ERR, CRYPTODEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(ERR, CRYPTODEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 #define CDEV_LOG_INFO(...) \
-	RTE_LOG(INFO, CRYPTODEV, \
-		RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(INFO, CRYPTODEV, "" __VA_ARGS__)
 
 #define CDEV_LOG_DEBUG(...) \
-	RTE_LOG(DEBUG, CRYPTODEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(DEBUG, CRYPTODEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 #define CDEV_PMD_TRACE(...) \
-	RTE_LOG(DEBUG, CRYPTODEV, \
-		RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			dev, __func__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(DEBUG, CRYPTODEV, \
+		RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			dev, __func__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 /**
  * A macro that points to an offset from the start
lib/dmadev/rte_dmadev.c +4 -2
index 009a21849a..5953a77bd6 100644
@@ -32,9 +32,11 @@ static struct {
 } *dma_devices_shared_data;
 
 RTE_LOG_REGISTER_DEFAULT(rte_dma_logtype, INFO);
+#define RTE_LOGTYPE_DMA rte_dma_logtype
+
 #define RTE_DMA_LOG(level, ...) \
-	rte_log(RTE_LOG_ ## level, rte_dma_logtype, RTE_FMT("dma: " \
-		RTE_FMT_HEAD(__VA_ARGS__,) "\n", RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(level, DMA, RTE_FMT("dma: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+		RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 int
 rte_dma_dev_max(size_t dev_max)
lib/ethdev/rte_ethdev.h +1 -2
index e89e474c39..21e3a21903 100644
@@ -179,8 +179,7 @@ extern int rte_eth_dev_logtype;
 #define RTE_LOGTYPE_ETHDEV rte_eth_dev_logtype
 
 #define RTE_ETHDEV_LOG_LINE(level, ...) \
-	RTE_LOG(level, ETHDEV, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
-		RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE(level, ETHDEV, "" __VA_ARGS__)
 
 struct rte_mbuf;
 
lib/eventdev/eventdev_pmd.h +6 -6
index 2ec5aec0a8..1790587808 100644
@@ -33,15 +33,15 @@ extern "C" {
 
 /* Logging Macros */
 #define RTE_EDEV_LOG_ERR(...) \
-	RTE_LOG(ERR, EVENTDEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(ERR, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
 #define RTE_EDEV_LOG_DEBUG(...) \
-	RTE_LOG(DEBUG, EVENTDEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(DEBUG, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 #else
 #define RTE_EDEV_LOG_DEBUG(...) (void)0
 #endif
lib/eventdev/rte_event_timer_adapter.c +10 -7
index 3f22e85173..e6d3492056 100644
@@ -30,27 +30,30 @@
 #define DATA_MZ_NAME_FORMAT "rte_event_timer_adapter_data_%d"
 
 RTE_LOG_REGISTER_SUFFIX(evtim_logtype, adapter.timer, NOTICE);
+#define RTE_LOGTYPE_EVTIM evtim_logtype
 RTE_LOG_REGISTER_SUFFIX(evtim_buffer_logtype, adapter.timer, NOTICE);
+#define RTE_LOGTYPE_EVTIM_BUF evtim_buffer_logtype
 RTE_LOG_REGISTER_SUFFIX(evtim_svc_logtype, adapter.timer.svc, NOTICE);
+#define RTE_LOGTYPE_EVTIM_SVC evtim_svc_logtype
 
 static struct rte_event_timer_adapter *adapters;
 
 static const struct event_timer_adapter_ops swtim_ops;
 
 #define EVTIM_LOG(level, logtype, ...) \
-	rte_log(RTE_LOG_ ## level, logtype, \
-		RTE_FMT("EVTIMER: %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) \
-			"\n", __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(level, logtype, \
+		RTE_FMT("EVTIMER: %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
-#define EVTIM_LOG_ERR(...) EVTIM_LOG(ERR, evtim_logtype, __VA_ARGS__)
+#define EVTIM_LOG_ERR(...) EVTIM_LOG(ERR, EVTIM, __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
 #define EVTIM_LOG_DBG(...) \
-	EVTIM_LOG(DEBUG, evtim_logtype, __VA_ARGS__)
+	EVTIM_LOG(DEBUG, EVTIM, __VA_ARGS__)
 #define EVTIM_BUF_LOG_DBG(...) \
-	EVTIM_LOG(DEBUG, evtim_buffer_logtype, __VA_ARGS__)
+	EVTIM_LOG(DEBUG, EVTIM_BUF, __VA_ARGS__)
 #define EVTIM_SVC_LOG_DBG(...) \
-	EVTIM_LOG(DEBUG, evtim_svc_logtype, __VA_ARGS__)
+	EVTIM_LOG(DEBUG, EVTIM_SVC, __VA_ARGS__)
 #else
 #define EVTIM_LOG_DBG(...) (void)0
 #define EVTIM_BUF_LOG_DBG(...) (void)0
lib/gpudev/gpudev.c +4 -2
index 6845d18b4d..de8291151f 100644
@@ -17,9 +17,11 @@
 
 /* Logging */
 RTE_LOG_REGISTER_DEFAULT(gpu_logtype, NOTICE);
+#define RTE_LOGTYPE_GPUDEV gpu_logtype
+
 #define GPU_LOG(level, ...) \
-	rte_log(RTE_LOG_ ## level, gpu_logtype, RTE_FMT("gpu: " \
-		RTE_FMT_HEAD(__VA_ARGS__, ) "\n", RTE_FMT_TAIL(__VA_ARGS__, )))
+	RTE_LOG_LINE(level, GPUDEV, RTE_FMT("gpu: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+		RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 /* Set any driver error as EPERM */
 #define GPU_DRV_RET(function) \
lib/graph/graph_private.h +4 -3
index d0ef13b205..f9274ce96c 100644
@@ -18,11 +18,12 @@
 #include "rte_graph_worker.h"
 
 extern int rte_graph_logtype;
+#define RTE_LOGTYPE_GRAPH rte_graph_logtype
 
 #define GRAPH_LOG(level, ...)                                                  \
-	rte_log(RTE_LOG_##level, rte_graph_logtype,                            \
-		RTE_FMT("GRAPH: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ) "\n",    \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__, )))
+	RTE_LOG_LINE(level, GRAPH,                                             \
+		RTE_FMT("GRAPH: %s():%u " RTE_FMT_HEAD(__VA_ARGS__ ,),         \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 #define graph_err(...) GRAPH_LOG(ERR, __VA_ARGS__)
 #define graph_warn(...) GRAPH_LOG(WARNING, __VA_ARGS__)
lib/member/member.h +2 -2
index a7b5b4a57c..cf600c4838 100644
@@ -8,7 +8,7 @@ extern int librte_member_logtype;
 #define RTE_LOGTYPE_MEMBER librte_member_logtype
 
 #define MEMBER_LOG(level, ...) \
-	RTE_LOG(level,  MEMBER, \
-		RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+	RTE_LOG_LINE(level,  MEMBER, \
+		RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__ ,), \
 			__func__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
lib/metrics/rte_metrics_telemetry.c +2 -2
index 1d133e1f8c..b8c9d75a7d 100644
@@ -16,11 +16,11 @@
 struct telemetry_metrics_data tel_met_data;
 
 int metrics_log_level;
+#define RTE_LOGTYPE_METRICS metrics_log_level
 
 /* Logging Macros */
 #define METRICS_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ##level, metrics_log_level, "%s(): "fmt "\n", \
-		__func__, ##args)
+	RTE_LOG_LINE(level, METRICS, "%s(): "fmt, __func__, ## args)
 
 #define METRICS_LOG_ERR(fmt, args...) \
 	METRICS_LOG(ERR, fmt, ## args)
lib/mldev/rte_mldev.h +3 -2
index 63b2670bb0..5cf6f0566f 100644
@@ -144,9 +144,10 @@ extern "C" {
 
 /* Logging Macro */
 extern int rte_ml_dev_logtype;
+#define RTE_LOGTYPE_MLDEV rte_ml_dev_logtype
 
-#define RTE_MLDEV_LOG(level, fmt, args...)                                                         \
-	rte_log(RTE_LOG_##level, rte_ml_dev_logtype, "%s(): " fmt "\n", __func__, ##args)
+#define RTE_MLDEV_LOG(level, fmt, args...) \
+	RTE_LOG_LINE(level, MLDEV, "%s(): " fmt, __func__, ##args)
 
 #define RTE_ML_STR_MAX 128
 /**< Maximum length of name string */
lib/net/rte_net_crc.c +4 -4
index 900d6de7f4..b401ea3dd8 100644
@@ -70,11 +70,11 @@ static const rte_net_crc_handler handlers_neon[] = {
 
 static uint16_t max_simd_bitwidth;
 
-#define NET_LOG(level, fmt, args...)					\
-	rte_log(RTE_LOG_ ## level, libnet_logtype, "%s(): " fmt "\n",	\
-		__func__, ## args)
-
 RTE_LOG_REGISTER_DEFAULT(libnet_logtype, INFO);
+#define RTE_LOGTYPE_NET libnet_logtype
+
+#define NET_LOG(level, fmt, args...) \
+	RTE_LOG_LINE(level, NET, "%s(): " fmt, __func__, ## args)
 
 /* Scalar handling */
 
lib/node/node_private.h +5 -3
index 26135aaa5b..845fdaa12e 100644
@@ -11,11 +11,13 @@
 #include <rte_mbuf_dyn.h>
 
 extern int rte_node_logtype;
+#define RTE_LOGTYPE_NODE rte_node_logtype
+
 #define NODE_LOG(level, node_name, ...)                                        \
-	rte_log(RTE_LOG_##level, rte_node_logtype,                             \
-		RTE_FMT("NODE %s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ) "\n",  \
+	RTE_LOG_LINE(level, NODE,                                              \
+		RTE_FMT("NODE %s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__ ,),       \
 			node_name, __func__, __LINE__,                         \
-			RTE_FMT_TAIL(__VA_ARGS__, )))
+			RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 #define node_err(node_name, ...) NODE_LOG(ERR, node_name, __VA_ARGS__)
 #define node_info(node_name, ...) NODE_LOG(INFO, node_name, __VA_ARGS__)
lib/pdump/rte_pdump.c +2 -3
index 70963e7ee7..f6160f9911 100644
@@ -18,9 +18,8 @@
 RTE_LOG_REGISTER_DEFAULT(pdump_logtype, NOTICE);
 #define RTE_LOGTYPE_PDUMP pdump_logtype
 
-#define PDUMP_LOG_LINE(level, fmt, args...)		\
-	RTE_LOG(level, PDUMP, "%s(): " fmt "\n",	\
-		__func__, ## args)
+#define PDUMP_LOG_LINE(level, fmt, args...) \
+	RTE_LOG_LINE(level, PDUMP, "%s(): " fmt, __func__, ## args)
 
 /* Used for the multi-process communication */
 #define PDUMP_MP	"mp_pdump"
lib/power/power_common.h +1 -1
index ea2febbd86..4e32548169 100644
@@ -15,7 +15,7 @@ extern int power_logtype;
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
 #define POWER_DEBUG_LOG(fmt, args...) \
-	RTE_LOG(ERR, POWER, "%s: " fmt "\n", __func__, ## args)
+	RTE_LOG_LINE(ERR, POWER, "%s: " fmt, __func__, ## args)
 #else
 #define POWER_DEBUG_LOG(fmt, args...)
 #endif
lib/rawdev/rte_rawdev_pmd.h +2 -2
index 7b9ef1d09f..7173282c66 100644
@@ -27,11 +27,11 @@ extern "C" {
 #include "rte_rawdev.h"
 
 extern int librawdev_logtype;
+#define RTE_LOGTYPE_RAWDEV librawdev_logtype
 
 /* Logging Macros */
 #define RTE_RDEV_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, librawdev_logtype, "%s(): " fmt "\n", \
-		__func__, ##args)
+	RTE_LOG_LINE(level, RAWDEV, "%s(): " fmt, __func__, ##args)
 
 #define RTE_RDEV_ERR(fmt, args...) \
 	RTE_RDEV_LOG(ERR, fmt, ## args)
lib/rcu/rte_rcu_qsbr.h +3 -5
index 0dca8310c0..23c9f89805 100644
@@ -40,17 +40,15 @@ extern int rte_rcu_log_type;
 
 #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
 #define __RTE_RCU_DP_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, rte_rcu_log_type, \
-		"%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args)
 #else
 #define __RTE_RCU_DP_LOG(level, fmt, args...)
 #endif
 
 #if defined(RTE_LIBRTE_RCU_DEBUG)
-#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...) do {\
+#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...) do { \
 	if (v->qsbr_cnt[thread_id].lock_cnt) \
-		rte_log(RTE_LOG_ ## level, rte_rcu_log_type, \
-			"%s(): " fmt "\n", __func__, ## args); \
+		RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args); \
 } while (0)
 #else
 #define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...)
lib/regexdev/rte_regexdev.h +1 -2
index a215d8768e..a50b841b1e 100644
@@ -209,8 +209,7 @@ extern int rte_regexdev_logtype;
 #define RTE_LOGTYPE_REGEXDEV rte_regexdev_logtype
 
 #define RTE_REGEXDEV_LOG_LINE(level, ...) \
-	RTE_LOG(level, REGEXDEV, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
-		RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE(level, REGEXDEV, "" __VA_ARGS__)
 
 /* Macros to check for valid port */
 #define RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, retval) do { \
lib/stack/stack_pvt.h +2 -2
index c7eab4027d..2dce42a9da 100644
@@ -8,10 +8,10 @@
 #include <rte_log.h>
 
 extern int stack_logtype;
+#define RTE_LOGTYPE_STACK stack_logtype
 
 #define STACK_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ##level, stack_logtype, "%s(): "fmt "\n", \
-		__func__, ##args)
+	RTE_LOG_LINE(level, STACK, "%s(): "fmt, __func__, ##args)
 
 #define STACK_LOG_ERR(fmt, args...) \
 	STACK_LOG(ERR, fmt, ## args)
lib/telemetry/telemetry.c +1 -3
index 747eba2656..31e2391867 100644
@@ -57,9 +57,7 @@ static rte_cpuset_t *thread_cpuset;
 
 RTE_LOG_REGISTER_DEFAULT(logtype, WARNING);
 #define RTE_LOGTYPE_TMTY logtype
-#define TMTY_LOG_LINE(l, ...) \
-	RTE_LOG(l, TMTY,  RTE_FMT("TELEMETRY: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
-		RTE_FMT_TAIL(__VA_ARGS__ ,)))
+#define TMTY_LOG_LINE(l, ...) RTE_LOG_LINE(l, TMTY, "TELEMETRY: " __VA_ARGS__)
 
 /* list of command callbacks, with one command registered by default */
 static struct cmd_callback *callbacks;
lib/vhost/vhost.h +4 -4
index 5a74d0e628..25c0f86e55 100644
@@ -678,12 +678,12 @@ extern int vhost_data_log_level;
 #define RTE_LOGTYPE_VHOST_DATA vhost_data_log_level
 
 #define VHOST_CONFIG_LOG(prefix, level, fmt, args...)		\
-	RTE_LOG(level, VHOST_CONFIG,				\
-		"VHOST_CONFIG: (%s) " fmt "\n", prefix, ##args)
+	RTE_LOG_LINE(level, VHOST_CONFIG,			\
+		"VHOST_CONFIG: (%s) " fmt, prefix, ##args)
 
 #define VHOST_DATA_LOG(prefix, level, fmt, args...)		\
-	RTE_LOG_DP(level, VHOST_DATA,				\
-		"VHOST_DATA: (%s) " fmt "\n", prefix, ##args)
+	RTE_LOG_DP_LINE(level, VHOST_DATA,			\
+		"VHOST_DATA: (%s) " fmt, prefix, ##args)
 
 #ifdef RTE_LIBRTE_VHOST_DEBUG
 #define VHOST_MAX_PRINT_BUFF 6072
lib/vhost/vhost_crypto.c +3 -3
index 6e5443e5f8..3704fbbb3d 100644
@@ -21,15 +21,15 @@ RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
 #define RTE_LOGTYPE_VHOST_CRYPTO	vhost_crypto_logtype
 
 #define VC_LOG_ERR(fmt, args...)				\
-	RTE_LOG(ERR, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+	RTE_LOG_LINE(ERR, VHOST_CRYPTO, "%s() line %u: " fmt,	\
 		__func__, __LINE__, ## args)
 #define VC_LOG_INFO(fmt, args...)				\
-	RTE_LOG(INFO, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+	RTE_LOG_LINE(INFO, VHOST_CRYPTO, "%s() line %u: " fmt,	\
 		__func__, __LINE__, ## args)
 
 #ifdef RTE_LIBRTE_VHOST_DEBUG
 #define VC_LOG_DBG(fmt, args...)				\
-	RTE_LOG(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+	RTE_LOG_LINE(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt,	\
 		__func__, __LINE__, ## args)
 #else
 #define VC_LOG_DBG(fmt, args...)
Signature · 1 line
2.43.0
#103 lore raw

v5 cover Detect superfluous newline in logs

In reply to David Marchand

Getting readable and consistent logs is important when running a DPDK application, especially when troubleshooting.
A common issue with logs is when a DPDK change do not add (or on the contrary add too many \n) in the format string.

This issue would only get noticed when actually hitting this log (which may be a situation hard to reach).

This series proposes to introduce a new RTE_LOG_LINE helper that is responsible for logging a one line message and spews a build error (with gcc) if any \n is part of the format string.

Since the v1 discussion on the cover letter, I changed my mind, and made the choice to break existing logging helpers exported in the public API. The reasoning is that those should not be used in the first place:
logs should be produced only by the library that registers the logtype.

Some multiline logging for debugging and the test assert macros are still present, but in this case an explicit call to RTE_LOG() is done. This can be checked with a simple:

$ git grep -E 'RTE_LOG(_DP)?\(' -- lib/ :^lib/log/
lib/acl/acl_bld.c:      RTE_LOG(DEBUG, ACL, "Build phase for ACL \"%s\":\n"
lib/acl/acl_gen.c:      RTE_LOG(DEBUG, ACL, "Gen phase for ACL \"%s\":\n"
lib/bpf/bpf_validate.c: RTE_LOG(DEBUG, BPF, "%s(%p) stats:\n"
lib/bpf/bpf_validate.c: RTE_LOG(DEBUG, BPF,
lib/eal/common/eal_common_debug.c:              RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
lib/eal/include/rte_test.h:             RTE_LOG(ERR, EAL, "Test assert %s line %d failed: "           \
lib/ip_frag/ip_frag_common.h:#define    IP_FRAG_LOG(lvl, fmt, args...)  RTE_LOG(lvl, IPFRAG, fmt, ##args)
lib/sched/rte_sched.c:  RTE_LOG(DEBUG, SCHED, "Low level config for pipe profile %u:\n"
lib/sched/rte_sched.c:  RTE_LOG(DEBUG, SCHED, "Low level config for subport profile %u:\n"
lib/vhost/vhost.h:      RTE_LOG_DP(DEBUG, VHOST_DATA, "VHOST_DATA: (%s) %s", dev->ifname, packet); \

Changes since v4:
- fixed build with -pedantic,
- reworked patch 12 so it introduce new logging helpers (like for rcu),
- moved the transition to RTE_LOG_LINE previously in patch 12 to the last patch of this v5 series,

Changes since v3:
- fixed some checkpatch complaints,

Changes since RFC v2:
- sent as non RFC,
- fixed format string crossing line boundaries,
- avoided potential collision with BPF_ namespace,

Changes since RFC v1:
- rebased after Stephen log changes,
- added more fixes as I was making progress on the topic,
- added a check so dpdk developers stop using RTE_LOG(),
- added preparation patches, like "lib: replace logging helpers",
- converted all libraries, keeping some special cases with explicit calls to RTE_LOG,

Signature · 242 lines
David Marchand

David Marchand (13):
  hash: remove some dead code
  regexdev: fix logtype register
  lib: use dedicated logtypes and macros
  lib: add newline in logs
  lib: remove redundant newline from logs
  eal/linux: remove log paraphrasing the doc
  bpf: remove log level in internal helper
  lib: simplify multilines log messages
  lib: add more logging helpers
  vhost: improve log for memory dumping configuration
  log: add a per line log helper
  lib: replace logging helpers
  lib: use per line logging in helpers

 devtools/checkpatches.sh                   |   8 +
 drivers/crypto/ipsec_mb/ipsec_mb_ops.c     |   2 +-
 lib/acl/acl_bld.c                          |  28 +-
 lib/acl/acl_gen.c                          |   8 +-
 lib/acl/acl_log.h                          |   2 +
 lib/acl/rte_acl.c                          |   8 +-
 lib/acl/tb_mem.c                           |   4 +-
 lib/bbdev/rte_bbdev.c                      |  11 +-
 lib/bpf/bpf.c                              |   2 +-
 lib/bpf/bpf_convert.c                      |  16 +-
 lib/bpf/bpf_exec.c                         |  12 +-
 lib/bpf/bpf_impl.h                         |   5 +-
 lib/bpf/bpf_jit_arm64.c                    |   8 +-
 lib/bpf/bpf_jit_x86.c                      |   4 +-
 lib/bpf/bpf_load.c                         |   2 +-
 lib/bpf/bpf_load_elf.c                     |  24 +-
 lib/bpf/bpf_pkt.c                          |   4 +-
 lib/bpf/bpf_stub.c                         |   6 +-
 lib/bpf/bpf_validate.c                     |  44 +-
 lib/cfgfile/rte_cfgfile.c                  |  18 +-
 lib/compressdev/rte_compressdev_internal.h |   5 +-
 lib/compressdev/rte_compressdev_pmd.c      |   4 +-
 lib/cryptodev/rte_cryptodev.c              |   4 +-
 lib/cryptodev/rte_cryptodev.h              |  22 +-
 lib/dispatcher/rte_dispatcher.c            |  12 +-
 lib/dmadev/rte_dmadev.c                    |   8 +-
 lib/eal/common/eal_common_bus.c            |  22 +-
 lib/eal/common/eal_common_class.c          |   6 +-
 lib/eal/common/eal_common_config.c         |   2 +-
 lib/eal/common/eal_common_debug.c          |   8 +-
 lib/eal/common/eal_common_dev.c            |  80 +-
 lib/eal/common/eal_common_devargs.c        |  18 +-
 lib/eal/common/eal_common_dynmem.c         |  34 +-
 lib/eal/common/eal_common_fbarray.c        |  12 +-
 lib/eal/common/eal_common_interrupts.c     |  39 +-
 lib/eal/common/eal_common_lcore.c          |  26 +-
 lib/eal/common/eal_common_memalloc.c       |  12 +-
 lib/eal/common/eal_common_memory.c         |  66 +-
 lib/eal/common/eal_common_memzone.c        |  24 +-
 lib/eal/common/eal_common_options.c        | 236 +++---
 lib/eal/common/eal_common_proc.c           | 112 +--
 lib/eal/common/eal_common_tailqs.c         |  12 +-
 lib/eal/common/eal_common_thread.c         |  12 +-
 lib/eal/common/eal_common_timer.c          |   6 +-
 lib/eal/common/eal_common_trace_utils.c    |   3 +-
 lib/eal/common/eal_private.h               |   4 +
 lib/eal/common/eal_trace.h                 |   4 +-
 lib/eal/common/hotplug_mp.c                |  54 +-
 lib/eal/common/malloc_elem.c               |   6 +-
 lib/eal/common/malloc_heap.c               |  40 +-
 lib/eal/common/malloc_mp.c                 |  72 +-
 lib/eal/common/rte_keepalive.c             |   4 +-
 lib/eal/common/rte_malloc.c                |  10 +-
 lib/eal/common/rte_service.c               |   8 +-
 lib/eal/freebsd/eal.c                      |  75 +-
 lib/eal/freebsd/eal_alarm.c                |   2 +-
 lib/eal/freebsd/eal_dev.c                  |  10 +-
 lib/eal/freebsd/eal_hugepage_info.c        |  22 +-
 lib/eal/freebsd/eal_interrupts.c           |  60 +-
 lib/eal/freebsd/eal_lcore.c                |   2 +-
 lib/eal/freebsd/eal_memalloc.c             |  11 +-
 lib/eal/freebsd/eal_memory.c               |  34 +-
 lib/eal/freebsd/eal_thread.c               |   2 +-
 lib/eal/freebsd/eal_timer.c                |  10 +-
 lib/eal/linux/eal.c                        | 122 +--
 lib/eal/linux/eal_alarm.c                  |   2 +-
 lib/eal/linux/eal_dev.c                    |  40 +-
 lib/eal/linux/eal_hugepage_info.c          |  38 +-
 lib/eal/linux/eal_interrupts.c             | 116 +--
 lib/eal/linux/eal_lcore.c                  |   4 +-
 lib/eal/linux/eal_memalloc.c               | 120 +--
 lib/eal/linux/eal_memory.c                 | 208 ++---
 lib/eal/linux/eal_thread.c                 |   6 +-
 lib/eal/linux/eal_timer.c                  |  14 +-
 lib/eal/linux/eal_vfio.c                   | 270 +++----
 lib/eal/linux/eal_vfio_mp_sync.c           |   5 +-
 lib/eal/riscv/rte_cycles.c                 |   4 +-
 lib/eal/unix/eal_filesystem.c              |  14 +-
 lib/eal/unix/eal_firmware.c                |   3 +-
 lib/eal/unix/eal_unix_memory.c             |   8 +-
 lib/eal/unix/rte_thread.c                  |  36 +-
 lib/eal/windows/eal.c                      |  36 +-
 lib/eal/windows/eal_alarm.c                |  13 +-
 lib/eal/windows/eal_debug.c                |  10 +-
 lib/eal/windows/eal_dev.c                  |  10 +-
 lib/eal/windows/eal_hugepages.c            |  10 +-
 lib/eal/windows/eal_interrupts.c           |  10 +-
 lib/eal/windows/eal_lcore.c                |   7 +-
 lib/eal/windows/eal_memalloc.c             |  50 +-
 lib/eal/windows/eal_memory.c               |  22 +-
 lib/eal/windows/eal_windows.h              |   6 +-
 lib/eal/windows/include/rte_windows.h      |   6 +-
 lib/eal/windows/rte_thread.c               |  29 +-
 lib/efd/rte_efd.c                          |  60 +-
 lib/ethdev/ethdev_driver.c                 |  44 +-
 lib/ethdev/ethdev_pci.h                    |   2 +-
 lib/ethdev/ethdev_private.c                |  10 +-
 lib/ethdev/rte_class_eth.c                 |   2 +-
 lib/ethdev/rte_ethdev.c                    | 854 ++++++++++-----------
 lib/ethdev/rte_ethdev.h                    |  51 +-
 lib/ethdev/rte_ethdev_cman.c               |  16 +-
 lib/ethdev/rte_ethdev_telemetry.c          |  44 +-
 lib/ethdev/rte_flow.c                      |  64 +-
 lib/ethdev/rte_flow.h                      |   3 -
 lib/ethdev/sff_telemetry.c                 |  30 +-
 lib/eventdev/eventdev_pmd.h                |  18 +-
 lib/eventdev/rte_event_crypto_adapter.c    |  12 +-
 lib/eventdev/rte_event_dma_adapter.c       |  18 +-
 lib/eventdev/rte_event_eth_rx_adapter.c    |  40 +-
 lib/eventdev/rte_event_eth_tx_adapter.c    |   2 +-
 lib/eventdev/rte_event_timer_adapter.c     |  21 +-
 lib/eventdev/rte_eventdev.c                |  10 +-
 lib/fib/fib_log.h                          |   4 +-
 lib/fib/rte_fib.c                          |  14 +-
 lib/fib/rte_fib6.c                         |  14 +-
 lib/gpudev/gpudev.c                        |   6 +-
 lib/graph/graph_private.h                  |   7 +-
 lib/hash/rte_cuckoo_hash.c                 |  54 +-
 lib/hash/rte_cuckoo_hash.h                 |  11 -
 lib/hash/rte_fbk_hash.c                    |   6 +-
 lib/hash/rte_hash_crc.c                    |  14 +-
 lib/hash/rte_thash.c                       |  22 +-
 lib/hash/rte_thash_gfni.c                  |  10 +-
 lib/ip_frag/ip_frag_common.h               |   3 +
 lib/ip_frag/rte_ip_frag_common.c           |   8 +-
 lib/latencystats/rte_latencystats.c        |  43 +-
 lib/log/rte_log.h                          |  21 +
 lib/lpm/lpm_log.h                          |   2 +
 lib/lpm/rte_lpm.c                          |  12 +-
 lib/lpm/rte_lpm6.c                         |  10 +-
 lib/mbuf/mbuf_log.h                        |   2 +
 lib/mbuf/rte_mbuf.c                        |  14 +-
 lib/mbuf/rte_mbuf_dyn.c                    |  14 +-
 lib/mbuf/rte_mbuf_pool_ops.c               |   4 +-
 lib/member/member.h                        |  14 +
 lib/member/rte_member.c                    |  15 +-
 lib/member/rte_member.h                    |   9 -
 lib/member/rte_member_heap.h               |  39 +-
 lib/member/rte_member_ht.c                 |  13 +-
 lib/member/rte_member_sketch.c             |  41 +-
 lib/member/rte_member_vbf.c                |   9 +-
 lib/mempool/rte_mempool.c                  |  24 +-
 lib/mempool/rte_mempool.h                  |   4 +-
 lib/mempool/rte_mempool_ops.c              |  10 +-
 lib/metrics/rte_metrics_telemetry.c        |   6 +-
 lib/mldev/rte_mldev.c                      | 102 +--
 lib/mldev/rte_mldev.h                      |   5 +-
 lib/net/rte_net_crc.c                      |  14 +-
 lib/node/ethdev_rx.c                       |   4 +-
 lib/node/ip4_lookup.c                      |   2 +-
 lib/node/ip6_lookup.c                      |   2 +-
 lib/node/kernel_rx.c                       |   8 +-
 lib/node/kernel_tx.c                       |   4 +-
 lib/node/node_private.h                    |   8 +-
 lib/pdump/rte_pdump.c                      | 113 ++-
 lib/pipeline/rte_pipeline.c                | 231 +++---
 lib/port/port_log.h                        |   9 +
 lib/port/rte_port_ethdev.c                 |  20 +-
 lib/port/rte_port_eventdev.c               |  20 +-
 lib/port/rte_port_fd.c                     |  26 +-
 lib/port/rte_port_frag.c                   |  16 +-
 lib/port/rte_port_ras.c                    |  14 +-
 lib/port/rte_port_ring.c                   |  20 +-
 lib/port/rte_port_sched.c                  |  14 +-
 lib/port/rte_port_source_sink.c            |  50 +-
 lib/port/rte_port_sym_crypto.c             |  20 +-
 lib/power/guest_channel.c                  |  38 +-
 lib/power/power_acpi_cpufreq.c             | 116 +--
 lib/power/power_amd_pstate_cpufreq.c       | 132 ++--
 lib/power/power_common.c                   |  14 +-
 lib/power/power_common.h                   |  10 +-
 lib/power/power_cppc_cpufreq.c             | 130 ++--
 lib/power/power_intel_uncore.c             |  72 +-
 lib/power/power_kvm_vm.c                   |  22 +-
 lib/power/power_pstate_cpufreq.c           | 156 ++--
 lib/power/rte_power.c                      |  22 +-
 lib/power/rte_power_pmd_mgmt.c             |  34 +-
 lib/power/rte_power_uncore.c               |  14 +-
 lib/rawdev/rte_rawdev_pmd.h                |   4 +-
 lib/rcu/rte_rcu_qsbr.c                     |  66 +-
 lib/rcu/rte_rcu_qsbr.h                     |  17 +-
 lib/regexdev/rte_regexdev.c                |  88 +--
 lib/regexdev/rte_regexdev.h                |  13 +-
 lib/reorder/rte_reorder.c                  |  34 +-
 lib/rib/rib_log.h                          |   6 +-
 lib/rib/rte_rib.c                          |  13 +-
 lib/rib/rte_rib6.c                         |  10 +-
 lib/ring/rte_ring.c                        |  26 +-
 lib/sched/rte_pie.c                        |  18 +-
 lib/sched/rte_sched.c                      | 274 +++----
 lib/sched/rte_sched_log.h                  |   2 +
 lib/stack/rte_stack.c                      |   8 +-
 lib/stack/stack_pvt.h                      |   4 +-
 lib/table/rte_table_acl.c                  |  74 +-
 lib/table/rte_table_array.c                |  18 +-
 lib/table/rte_table_hash_cuckoo.c          |  24 +-
 lib/table/rte_table_hash_ext.c             |  24 +-
 lib/table/rte_table_hash_key16.c           |  40 +-
 lib/table/rte_table_hash_key32.c           |  40 +-
 lib/table/rte_table_hash_key8.c            |  40 +-
 lib/table/rte_table_hash_lru.c             |  24 +-
 lib/table/rte_table_lpm.c                  |  44 +-
 lib/table/rte_table_lpm_ipv6.c             |  46 +-
 lib/table/rte_table_stub.c                 |   6 +-
 lib/table/table_log.h                      |   9 +
 lib/telemetry/telemetry.c                  |  39 +-
 lib/vhost/fd_man.c                         |  10 +-
 lib/vhost/iotlb.c                          |  36 +-
 lib/vhost/socket.c                         | 102 +--
 lib/vhost/vdpa.c                           |   8 +-
 lib/vhost/vduse.c                          | 120 +--
 lib/vhost/vduse.h                          |   4 +-
 lib/vhost/vhost.c                          | 118 +--
 lib/vhost/vhost.h                          |  24 +-
 lib/vhost/vhost_crypto.c                   |  12 +-
 lib/vhost/vhost_user.c                     | 530 ++++++-------
 lib/vhost/virtio_net.c                     | 188 ++---
 lib/vhost/virtio_net_ctrl.c                |  38 +-
 218 files changed, 4120 insertions(+), 3973 deletions(-)
 create mode 100644 lib/member/member.h
 create mode 100644 lib/port/port_log.h
 create mode 100644 lib/table/table_log.h

-- 
2.43.0
#104 lore raw

PATCH v5 1/13 hash: remove some dead code

This macro is not used.

Fixes 769b2de7fb52 ("hash: implement RCU resources reclamation")
---
 lib/hash/rte_cuckoo_hash.h | 11 -----------
 1 file changed, 11 deletions(-)
lib/hash/rte_cuckoo_hash.h +0 -11
index f7afc4dd79..8ea793c66e 100644
@@ -29,17 +29,6 @@
 #define RETURN_IF_TRUE(cond, retval)
 #endif
 
-#if defined(RTE_LIBRTE_HASH_DEBUG)
-#define ERR_IF_TRUE(cond, fmt, args...) do { \
-	if (cond) { \
-		RTE_LOG(ERR, HASH, fmt, ##args); \
-		return; \
-	} \
-} while (0)
-#else
-#define ERR_IF_TRUE(cond, fmt, args...)
-#endif
-
 #include <rte_hash_crc.h>
 #include <rte_jhash.h>
 
Signature · 1 line
2.43.0
Reviewed-by on v5 1/13
#105 lore raw

Re: [PATCH v5 01/13] hash: remove some dead code

Quoted 24 lines · David Marchand

This macro is not used.

Fixes 769b2de7fb52 ("hash: implement RCU resources reclamation")
---
  lib/hash/rte_cuckoo_hash.h | 11 -----------
  1 file changed, 11 deletions(-)
lib/hash/rte_cuckoo_hash.h +0 -4
index f7afc4dd79..8ea793c66e 100644
@@ -29,17 +29,6 @@
  #define RETURN_IF_TRUE(cond, retval)
  #endif
 
-#if defined(RTE_LIBRTE_HASH_DEBUG)
-#define ERR_IF_TRUE(cond, fmt, args...) do { \
-     if (cond) { \
-             RTE_LOG(ERR, HASH, fmt, ##args); \

lib/hash/rte_cuckoo_hash.h line 34

Quoted 10 lines
lib/hash/rte_cuckoo_hash.h +0 -7
-             return; \
-     } \
-} while (0)
-#else
-#define ERR_IF_TRUE(cond, fmt, args...)
-#endif
-
  #include <rte_hash_crc.h>
  #include <rte_jhash.h>
 

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

Reviewed-by on v5 1/13
#106 lore raw

Re: [PATCH v5 01/13] hash: remove some dead code

In reply to David Marchand
Quoted 24 lines · David Marchand

This macro is not used.

Fixes 769b2de7fb52 ("hash: implement RCU resources reclamation")
---
  lib/hash/rte_cuckoo_hash.h | 11 -----------
  1 file changed, 11 deletions(-)
lib/hash/rte_cuckoo_hash.h +0 -4
index f7afc4dd79..8ea793c66e 100644
@@ -29,17 +29,6 @@
  #define RETURN_IF_TRUE(cond, retval)
  #endif
 
-#if defined(RTE_LIBRTE_HASH_DEBUG)
-#define ERR_IF_TRUE(cond, fmt, args...) do { \
-	if (cond) { \
-		RTE_LOG(ERR, HASH, fmt, ##args); \

lib/hash/rte_cuckoo_hash.h line 34

Quoted 10 lines
lib/hash/rte_cuckoo_hash.h +0 -7
-		return; \
-	} \
-} while (0)
-#else
-#define ERR_IF_TRUE(cond, fmt, args...)
-#endif
-
  #include <rte_hash_crc.h>
  #include <rte_jhash.h>
 

To correct the disclaimer issue.

#107 lore raw

PATCH v5 2/13 regexdev: fix logtype register

In reply to David Marchand

This library logtype was not initialized so its logs would end up under the 0 logtype, iow, RTE_LOGTYPE_EAL.

Fixes b25246beaefc ("regexdev: add core functions")
---
 lib/regexdev/rte_regexdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/regexdev/rte_regexdev.c +1 -1
index caec069182..d38a85eb0b 100644
@@ -19,7 +19,7 @@ static struct {
 	struct rte_regexdev_data data[RTE_MAX_REGEXDEV_DEVS];
 } *rte_regexdev_shared_data;
 
-int rte_regexdev_logtype;
+RTE_LOG_REGISTER_DEFAULT(rte_regexdev_logtype, INFO);
 
 static uint16_t
 regexdev_find_free_dev(void)
Signature · 1 line
2.43.0
#108 lore raw

PATCH v5 3/13 lib: use dedicated logtypes and macros

In reply to David Marchand

No printf!
When a dedicated log helper exists, use it.
And no usurpation please: a library should log under its logtype (see the eventdev rx adapter update for example).

Note: the RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET macro is renamed for consistency with the rest of eventdev (private) macros.

---
 lib/cryptodev/rte_cryptodev.c           |  2 +-
 lib/ethdev/ethdev_driver.c              |  4 ++--
 lib/ethdev/ethdev_private.c             |  2 +-
 lib/ethdev/rte_class_eth.c              |  2 +-
 lib/eventdev/rte_event_dma_adapter.c    |  4 ++--
 lib/eventdev/rte_event_eth_rx_adapter.c | 12 ++++++------
 lib/eventdev/rte_eventdev.c             |  6 +++---
 lib/mempool/rte_mempool_ops.c           |  2 +-
 8 files changed, 17 insertions(+), 17 deletions(-)
lib/cryptodev/rte_cryptodev.c +1 -1
index 25e3ec12d1..ead8c9a623 100644
@@ -2684,7 +2684,7 @@ rte_cryptodev_driver_id_get(const char *name)
 	int driver_id = -1;
 
 	if (name == NULL) {
-		RTE_LOG(DEBUG, CRYPTODEV, "name pointer NULL");
+		CDEV_LOG_DEBUG("name pointer NULL");
 		return -1;
 	}
 
lib/ethdev/ethdev_driver.c +2 -2
index fff4b7b4cd..55a9dcc565 100644
@@ -487,7 +487,7 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)
 		pair = &args.pairs[i];
 		if (strcmp("representor", pair->key) == 0) {
 			if (eth_da->type != RTE_ETH_REPRESENTOR_NONE) {
-				RTE_LOG(ERR, EAL, "duplicated representor key: %s\n",
+				RTE_ETHDEV_LOG(ERR, "duplicated representor key: %s\n",
 					dargs);
 				result = -1;
 				goto parse_cleanup;
@@ -713,7 +713,7 @@ rte_eth_representor_id_get(uint16_t port_id,
 		if (info->ranges[i].controller != controller)
 			continue;
 		if (info->ranges[i].id_end < info->ranges[i].id_base) {
-			RTE_LOG(WARNING, EAL, "Port %hu invalid representor ID Range %u - %u, entry %d\n",
+			RTE_ETHDEV_LOG(WARNING, "Port %hu invalid representor ID Range %u - %u, entry %d\n",
 				port_id, info->ranges[i].id_base,
 				info->ranges[i].id_end, i);
 			continue;
lib/ethdev/ethdev_private.c +1 -1
index e98b7188b0..0e1c7b23c1 100644
@@ -182,7 +182,7 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)
 		RTE_DIM(eth_da->representor_ports));
 done:
 	if (str == NULL)
-		RTE_LOG(ERR, EAL, "wrong representor format: %s\n", str);
+		RTE_ETHDEV_LOG(ERR, "wrong representor format: %s\n", str);
 	return str == NULL ? -1 : 0;
 }
 
lib/ethdev/rte_class_eth.c +1 -1
index b61dae849d..311beb17cb 100644
@@ -165,7 +165,7 @@ eth_dev_iterate(const void *start,
 			valid_keys = eth_params_keys;
 		kvargs = rte_kvargs_parse(str, valid_keys);
 		if (kvargs == NULL) {
-			RTE_LOG(ERR, EAL, "cannot parse argument list\n");
+			RTE_ETHDEV_LOG(ERR, "cannot parse argument list\n");
 			rte_errno = EINVAL;
 			return NULL;
 		}
lib/eventdev/rte_event_dma_adapter.c +2 -2
index af4b5ad388..cbf9405438 100644
@@ -1046,7 +1046,7 @@ rte_event_dma_adapter_vchan_add(uint8_t id, int16_t dma_dev_id, uint16_t vchan,
 							sizeof(struct dma_vchan_info),
 							0, adapter->socket_id);
 			if (dev_info->vchanq == NULL) {
-				printf("Queue pair add not supported\n");
+				RTE_EDEV_LOG_ERR("Queue pair add not supported");
 				return -ENOMEM;
 			}
 		}
@@ -1057,7 +1057,7 @@ rte_event_dma_adapter_vchan_add(uint8_t id, int16_t dma_dev_id, uint16_t vchan,
 						sizeof(struct dma_vchan_info),
 						0, adapter->socket_id);
 			if (dev_info->tqmap == NULL) {
-				printf("tq pair add not supported\n");
+				RTE_EDEV_LOG_ERR("tq pair add not supported");
 				return -ENOMEM;
 			}
 		}
lib/eventdev/rte_event_eth_rx_adapter.c +6 -6
index 6db03adf04..82ae31712d 100644
@@ -314,9 +314,9 @@ rxa_event_buf_get(struct event_eth_rx_adapter *rx_adapter, uint16_t eth_dev_id,
 	} \
 } while (0)
 
-#define RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(port_id, retval) do { \
+#define RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(port_id, retval) do { \
 	if (!rte_eth_dev_is_valid_port(port_id)) { \
-		RTE_ETHDEV_LOG(ERR, "Invalid port_id=%u\n", port_id); \
+		RTE_EDEV_LOG_ERR("Invalid port_id=%u", port_id); \
 		ret = retval; \
 		goto error; \
 	} \
@@ -3671,7 +3671,7 @@ handle_rxa_get_queue_conf(const char *cmd __rte_unused,
 
 	/* Get device ID from parameter string */
 	eth_dev_id = strtoul(token, NULL, 10);
-	RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
+	RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
 
 	token = strtok(NULL, ",");
 	RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1);
@@ -3743,7 +3743,7 @@ handle_rxa_get_queue_stats(const char *cmd __rte_unused,
 
 	/* Get device ID from parameter string */
 	eth_dev_id = strtoul(token, NULL, 10);
-	RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
+	RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
 
 	token = strtok(NULL, ",");
 	RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1);
@@ -3813,7 +3813,7 @@ handle_rxa_queue_stats_reset(const char *cmd __rte_unused,
 
 	/* Get device ID from parameter string */
 	eth_dev_id = strtoul(token, NULL, 10);
-	RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
+	RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
 
 	token = strtok(NULL, ",");
 	RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1);
@@ -3868,7 +3868,7 @@ handle_rxa_instance_get(const char *cmd __rte_unused,
 
 	/* Get device ID from parameter string */
 	eth_dev_id = strtoul(token, NULL, 10);
-	RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
+	RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL);
 
 	token = strtok(NULL, ",");
 	RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1);
lib/eventdev/rte_eventdev.c +3 -3
index 0ca32d6721..ae50821a3f 100644
@@ -1428,8 +1428,8 @@ rte_event_vector_pool_create(const char *name, unsigned int n,
 	int ret;
 
 	if (!nb_elem) {
-		RTE_LOG(ERR, EVENTDEV,
-			"Invalid number of elements=%d requested\n", nb_elem);
+		RTE_EDEV_LOG_ERR("Invalid number of elements=%d requested",
+			nb_elem);
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -1444,7 +1444,7 @@ rte_event_vector_pool_create(const char *name, unsigned int n,
 	mp_ops_name = rte_mbuf_best_mempool_ops();
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
-		RTE_LOG(ERR, EVENTDEV, "error setting mempool handler\n");
+		RTE_EDEV_LOG_ERR("error setting mempool handler");
 		goto err;
 	}
 
lib/mempool/rte_mempool_ops.c +1 -1
index ae1d288f27..e871de9ec9 100644
@@ -46,7 +46,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h)
 
 	if (strlen(h->name) >= sizeof(ops->name) - 1) {
 		rte_spinlock_unlock(&rte_mempool_ops_table.sl);
-		RTE_LOG(DEBUG, EAL, "%s(): mempool_ops <%s>: name too long\n",
+		RTE_LOG(DEBUG, MEMPOOL, "%s(): mempool_ops <%s>: name too long\n",
 				__func__, h->name);
 		rte_errno = EEXIST;
 		return -EEXIST;
Signature · 1 line
2.43.0
#109 lore raw

PATCH v5 4/13 lib: add newline in logs

In reply to David Marchand

Fix places leading to a log message not terminated with a newline.

---
 lib/eal/common/eal_common_options.c |  2 +-
 lib/eal/linux/eal_hugepage_info.c   |  2 +-
 lib/eal/linux/eal_interrupts.c      |  2 +-
 lib/ethdev/ethdev_pci.h             |  2 +-
 lib/ethdev/rte_ethdev.c             | 40 ++++++++++++++---------------
 lib/lpm/rte_lpm6.c                  |  6 ++---
 lib/power/guest_channel.c           |  2 +-
 lib/power/rte_power_pmd_mgmt.c      |  6 ++---
 8 files changed, 31 insertions(+), 31 deletions(-)
lib/eal/common/eal_common_options.c +1 -1
index a6d21f1cba..e9ba01fb89 100644
@@ -2141,7 +2141,7 @@ rte_vect_set_max_simd_bitwidth(uint16_t bitwidth)
 	struct internal_config *internal_conf =
 		eal_get_internal_configuration();
 	if (internal_conf->max_simd_bitwidth.forced) {
-		RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - user runtime override enabled");
+		RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - user runtime override enabled\n");
 		return -EPERM;
 	}
 
lib/eal/linux/eal_hugepage_info.c +1 -1
index 581d9dfc91..36a495fb1f 100644
@@ -403,7 +403,7 @@ inspect_hugedir_cb(const struct walk_hugedir_data *whd)
 	struct stat st;
 
 	if (fstat(whd->file_fd, &st) < 0)
-		RTE_LOG(DEBUG, EAL, "%s(): stat(\"%s\") failed: %s",
+		RTE_LOG(DEBUG, EAL, "%s(): stat(\"%s\") failed: %s\n",
 				__func__, whd->file_name, strerror(errno));
 	else
 		(*total_size) += st.st_size;
lib/eal/linux/eal_interrupts.c +1 -1
index d4919dff45..eabac24992 100644
@@ -1542,7 +1542,7 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
 		/* only check, initialization would be done in vdev driver.*/
 		if ((uint64_t)rte_intr_efd_counter_size_get(intr_handle) >
 		    sizeof(union rte_intr_read_buffer)) {
-			RTE_LOG(ERR, EAL, "the efd_counter_size is oversized");
+			RTE_LOG(ERR, EAL, "the efd_counter_size is oversized\n");
 			return -EINVAL;
 		}
 	} else {
lib/ethdev/ethdev_pci.h +1 -1
index 320e3e0093..ddb559aa95 100644
@@ -31,7 +31,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
 	struct rte_pci_device *pci_dev)
 {
 	if ((eth_dev == NULL) || (pci_dev == NULL)) {
-		RTE_ETHDEV_LOG(ERR, "NULL pointer eth_dev=%p pci_dev=%p",
+		RTE_ETHDEV_LOG(ERR, "NULL pointer eth_dev=%p pci_dev=%p\n",
 			(void *)eth_dev, (void *)pci_dev);
 		return;
 	}
lib/ethdev/rte_ethdev.c +20 -20
index 3858983fcc..b9d99ece15 100644
@@ -724,7 +724,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
 	uint16_t pid;
 
 	if (name == NULL) {
-		RTE_ETHDEV_LOG(ERR, "Cannot get port ID from NULL name");
+		RTE_ETHDEV_LOG(ERR, "Cannot get port ID from NULL name\n");
 		return -EINVAL;
 	}
 
@@ -2394,41 +2394,41 @@ rte_eth_rx_hairpin_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 		nb_rx_desc = cap.max_nb_desc;
 	if (nb_rx_desc > cap.max_nb_desc) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for nb_rx_desc(=%hu), should be: <= %hu",
+			"Invalid value for nb_rx_desc(=%hu), should be: <= %hu\n",
 			nb_rx_desc, cap.max_nb_desc);
 		return -EINVAL;
 	}
 	if (conf->peer_count > cap.max_rx_2_tx) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for number of peers for Rx queue(=%u), should be: <= %hu",
+			"Invalid value for number of peers for Rx queue(=%u), should be: <= %hu\n",
 			conf->peer_count, cap.max_rx_2_tx);
 		return -EINVAL;
 	}
 	if (conf->use_locked_device_memory && !cap.rx_cap.locked_device_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use locked device memory for Rx queue, which is not supported");
+			"Attempt to use locked device memory for Rx queue, which is not supported\n");
 		return -EINVAL;
 	}
 	if (conf->use_rte_memory && !cap.rx_cap.rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use DPDK memory for Rx queue, which is not supported");
+			"Attempt to use DPDK memory for Rx queue, which is not supported\n");
 		return -EINVAL;
 	}
 	if (conf->use_locked_device_memory && conf->use_rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use mutually exclusive memory settings for Rx queue");
+			"Attempt to use mutually exclusive memory settings for Rx queue\n");
 		return -EINVAL;
 	}
 	if (conf->force_memory &&
 	    !conf->use_locked_device_memory &&
 	    !conf->use_rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to force Rx queue memory settings, but none is set");
+			"Attempt to force Rx queue memory settings, but none is set\n");
 		return -EINVAL;
 	}
 	if (conf->peer_count == 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for number of peers for Rx queue(=%u), should be: > 0",
+			"Invalid value for number of peers for Rx queue(=%u), should be: > 0\n",
 			conf->peer_count);
 		return -EINVAL;
 	}
@@ -2438,7 +2438,7 @@ rte_eth_rx_hairpin_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 			count++;
 	}
 	if (count > cap.max_nb_queues) {
-		RTE_ETHDEV_LOG(ERR, "To many Rx hairpin queues max is %d",
+		RTE_ETHDEV_LOG(ERR, "To many Rx hairpin queues max is %d\n",
 		cap.max_nb_queues);
 		return -EINVAL;
 	}
@@ -2597,41 +2597,41 @@ rte_eth_tx_hairpin_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 		nb_tx_desc = cap.max_nb_desc;
 	if (nb_tx_desc > cap.max_nb_desc) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for nb_tx_desc(=%hu), should be: <= %hu",
+			"Invalid value for nb_tx_desc(=%hu), should be: <= %hu\n",
 			nb_tx_desc, cap.max_nb_desc);
 		return -EINVAL;
 	}
 	if (conf->peer_count > cap.max_tx_2_rx) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for number of peers for Tx queue(=%u), should be: <= %hu",
+			"Invalid value for number of peers for Tx queue(=%u), should be: <= %hu\n",
 			conf->peer_count, cap.max_tx_2_rx);
 		return -EINVAL;
 	}
 	if (conf->use_locked_device_memory && !cap.tx_cap.locked_device_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use locked device memory for Tx queue, which is not supported");
+			"Attempt to use locked device memory for Tx queue, which is not supported\n");
 		return -EINVAL;
 	}
 	if (conf->use_rte_memory && !cap.tx_cap.rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use DPDK memory for Tx queue, which is not supported");
+			"Attempt to use DPDK memory for Tx queue, which is not supported\n");
 		return -EINVAL;
 	}
 	if (conf->use_locked_device_memory && conf->use_rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to use mutually exclusive memory settings for Tx queue");
+			"Attempt to use mutually exclusive memory settings for Tx queue\n");
 		return -EINVAL;
 	}
 	if (conf->force_memory &&
 	    !conf->use_locked_device_memory &&
 	    !conf->use_rte_memory) {
 		RTE_ETHDEV_LOG(ERR,
-			"Attempt to force Tx queue memory settings, but none is set");
+			"Attempt to force Tx queue memory settings, but none is set\n");
 		return -EINVAL;
 	}
 	if (conf->peer_count == 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Invalid value for number of peers for Tx queue(=%u), should be: > 0",
+			"Invalid value for number of peers for Tx queue(=%u), should be: > 0\n",
 			conf->peer_count);
 		return -EINVAL;
 	}
@@ -2641,7 +2641,7 @@ rte_eth_tx_hairpin_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 			count++;
 	}
 	if (count > cap.max_nb_queues) {
-		RTE_ETHDEV_LOG(ERR, "To many Tx hairpin queues max is %d",
+		RTE_ETHDEV_LOG(ERR, "To many Tx hairpin queues max is %d\n",
 		cap.max_nb_queues);
 		return -EINVAL;
 	}
@@ -6716,7 +6716,7 @@ rte_eth_ip_reassembly_capability_get(uint16_t port_id,
 	}
 
 	if (reassembly_capa == NULL) {
-		RTE_ETHDEV_LOG(ERR, "Cannot get reassembly capability to NULL");
+		RTE_ETHDEV_LOG(ERR, "Cannot get reassembly capability to NULL\n");
 		return -EINVAL;
 	}
 
@@ -6752,7 +6752,7 @@ rte_eth_ip_reassembly_conf_get(uint16_t port_id,
 	}
 
 	if (conf == NULL) {
-		RTE_ETHDEV_LOG(ERR, "Cannot get reassembly info to NULL");
+		RTE_ETHDEV_LOG(ERR, "Cannot get reassembly info to NULL\n");
 		return -EINVAL;
 	}
 
@@ -6780,7 +6780,7 @@ rte_eth_ip_reassembly_conf_set(uint16_t port_id,
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(ERR,
 			"Device with port_id=%u is not configured.\n"
-			"Cannot set IP reassembly configuration",
+			"Cannot set IP reassembly configuration\n",
 			port_id);
 		return -EINVAL;
 	}
lib/lpm/rte_lpm6.c +3 -3
index 873cc8bc26..24ce7dd022 100644
@@ -280,7 +280,7 @@ rte_lpm6_create(const char *name, int socket_id,
 
 	rules_tbl = rte_hash_create(&rule_hash_tbl_params);
 	if (rules_tbl == NULL) {
-		RTE_LOG(ERR, LPM, "LPM rules hash table allocation failed: %s (%d)",
+		RTE_LOG(ERR, LPM, "LPM rules hash table allocation failed: %s (%d)\n",
 				  rte_strerror(rte_errno), rte_errno);
 		goto fail_wo_unlock;
 	}
@@ -290,7 +290,7 @@ rte_lpm6_create(const char *name, int socket_id,
 			sizeof(uint32_t) * config->number_tbl8s,
 			RTE_CACHE_LINE_SIZE);
 	if (tbl8_pool == NULL) {
-		RTE_LOG(ERR, LPM, "LPM tbl8 pool allocation failed: %s (%d)",
+		RTE_LOG(ERR, LPM, "LPM tbl8 pool allocation failed: %s (%d)\n",
 				  rte_strerror(rte_errno), rte_errno);
 		rte_errno = ENOMEM;
 		goto fail_wo_unlock;
@@ -301,7 +301,7 @@ rte_lpm6_create(const char *name, int socket_id,
 			sizeof(struct rte_lpm_tbl8_hdr) * config->number_tbl8s,
 			RTE_CACHE_LINE_SIZE);
 	if (tbl8_hdrs == NULL) {
-		RTE_LOG(ERR, LPM, "LPM tbl8 headers allocation failed: %s (%d)",
+		RTE_LOG(ERR, LPM, "LPM tbl8 headers allocation failed: %s (%d)\n",
 				  rte_strerror(rte_errno), rte_errno);
 		rte_errno = ENOMEM;
 		goto fail_wo_unlock;
lib/power/guest_channel.c +1 -1
index cc05347425..a6f2097d5b 100644
@@ -90,7 +90,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	flags |= O_NONBLOCK;
 	if (fcntl(fd, F_SETFL, flags) < 0) {
 		RTE_LOG(ERR, GUEST_CHANNEL, "Failed on setting non-blocking mode for "
-				"file %s", fd_path);
+				"file %s\n", fd_path);
 		goto error;
 	}
 	/* QEMU needs a delay after connection */
lib/power/rte_power_pmd_mgmt.c +3 -3
index 38f8384085..6f18ed0adf 100644
@@ -686,7 +686,7 @@ int
 rte_power_pmd_mgmt_set_pause_duration(unsigned int duration)
 {
 	if (duration == 0) {
-		RTE_LOG(ERR, POWER, "Pause duration must be greater than 0, value unchanged");
+		RTE_LOG(ERR, POWER, "Pause duration must be greater than 0, value unchanged\n");
 		return -EINVAL;
 	}
 	pause_duration = duration;
@@ -709,7 +709,7 @@ rte_power_pmd_mgmt_set_scaling_freq_min(unsigned int lcore, unsigned int min)
 	}
 
 	if (min > scale_freq_max[lcore]) {
-		RTE_LOG(ERR, POWER, "Invalid min frequency: Cannot be greater than max frequency");
+		RTE_LOG(ERR, POWER, "Invalid min frequency: Cannot be greater than max frequency\n");
 		return -EINVAL;
 	}
 	scale_freq_min[lcore] = min;
@@ -729,7 +729,7 @@ rte_power_pmd_mgmt_set_scaling_freq_max(unsigned int lcore, unsigned int max)
 	if (max == 0)
 		max = UINT32_MAX;
 	if (max < scale_freq_min[lcore]) {
-		RTE_LOG(ERR, POWER, "Invalid max frequency: Cannot be less than min frequency");
+		RTE_LOG(ERR, POWER, "Invalid max frequency: Cannot be less than min frequency\n");
 		return -EINVAL;
 	}
 
Signature · 1 line
2.43.0
#110 lore raw

PATCH v5 5/13 lib: remove redundant newline from logs

In reply to David Marchand

Fix places where two newline characters may be logged.

---
Changes since RFC v1:
- split fixes on direct calls to printf or RTE_LOG in a previous patch,

---
 drivers/crypto/ipsec_mb/ipsec_mb_ops.c  |   2 +-
 lib/bbdev/rte_bbdev.c                   |   6 +-
 lib/cfgfile/rte_cfgfile.c               |  14 ++--
 lib/compressdev/rte_compressdev_pmd.c   |   4 +-
 lib/cryptodev/rte_cryptodev.c           |   2 +-
 lib/dispatcher/rte_dispatcher.c         |  12 +--
 lib/dmadev/rte_dmadev.c                 |   2 +-
 lib/eal/windows/eal_memory.c            |   2 +-
 lib/eventdev/eventdev_pmd.h             |   6 +-
 lib/eventdev/rte_event_crypto_adapter.c |  12 +--
 lib/eventdev/rte_event_dma_adapter.c    |  14 ++--
 lib/eventdev/rte_event_eth_rx_adapter.c |  28 +++----
 lib/eventdev/rte_event_eth_tx_adapter.c |   2 +-
 lib/eventdev/rte_event_timer_adapter.c  |   4 +-
 lib/eventdev/rte_eventdev.c             |   4 +-
 lib/metrics/rte_metrics_telemetry.c     |   2 +-
 lib/mldev/rte_mldev.c                   | 102 ++++++++++++------------
 lib/net/rte_net_crc.c                   |   6 +-
 lib/node/ethdev_rx.c                    |   4 +-
 lib/node/ip4_lookup.c                   |   2 +-
 lib/node/ip6_lookup.c                   |   2 +-
 lib/node/kernel_rx.c                    |   8 +-
 lib/node/kernel_tx.c                    |   4 +-
 lib/rcu/rte_rcu_qsbr.c                  |   4 +-
 lib/rcu/rte_rcu_qsbr.h                  |   8 +-
 lib/stack/rte_stack.c                   |   8 +-
 lib/vhost/vhost_crypto.c                |   6 +-
 27 files changed, 135 insertions(+), 135 deletions(-)
drivers/crypto/ipsec_mb/ipsec_mb_ops.c +1 -1
index 52d6d010c7..f21f9cc5a0 100644
@@ -407,7 +407,7 @@ ipsec_mb_ipc_request(const struct rte_mp_msg *mp_msg, const void *peer)
 		resp_param->result = ipsec_mb_qp_release(dev, qp_id);
 		break;
 	default:
-		CDEV_LOG_ERR("invalid mp request type\n");
+		CDEV_LOG_ERR("invalid mp request type");
 	}
 
 out:
lib/bbdev/rte_bbdev.c +3 -3
index cfebea09c7..e09bb97abb 100644
@@ -1106,12 +1106,12 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
 
 	intr_handle = dev->intr_handle;
 	if (intr_handle == NULL) {
-		rte_bbdev_log(ERR, "Device %u intr handle unset\n", dev_id);
+		rte_bbdev_log(ERR, "Device %u intr handle unset", dev_id);
 		return -ENOTSUP;
 	}
 
 	if (queue_id >= RTE_MAX_RXTX_INTR_VEC_ID) {
-		rte_bbdev_log(ERR, "Device %u queue_id %u is too big\n",
+		rte_bbdev_log(ERR, "Device %u queue_id %u is too big",
 				dev_id, queue_id);
 		return -ENOTSUP;
 	}
@@ -1120,7 +1120,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
 	ret = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
 	if (ret && (ret != -EEXIST)) {
 		rte_bbdev_log(ERR,
-				"dev %u q %u int ctl error op %d epfd %d vec %u\n",
+				"dev %u q %u int ctl error op %d epfd %d vec %u",
 				dev_id, queue_id, op, epfd, vec);
 		return ret;
 	}
lib/cfgfile/rte_cfgfile.c +7 -7
index eefba6e408..2f9cc0722a 100644
@@ -137,7 +137,7 @@ rte_cfgfile_check_params(const struct rte_cfgfile_parameters *params)
 	unsigned int i;
 
 	if (!params) {
-		CFG_LOG(ERR, "missing cfgfile parameters\n");
+		CFG_LOG(ERR, "missing cfgfile parameters");
 		return -EINVAL;
 	}
 
@@ -150,7 +150,7 @@ rte_cfgfile_check_params(const struct rte_cfgfile_parameters *params)
 	}
 
 	if (valid_comment == 0)	{
-		CFG_LOG(ERR, "invalid comment characters %c\n",
+		CFG_LOG(ERR, "invalid comment characters %c",
 		       params->comment_character);
 		return -ENOTSUP;
 	}
@@ -188,7 +188,7 @@ rte_cfgfile_load_with_params(const char *filename, int flags,
 		lineno++;
 		if ((len >= sizeof(buffer) - 1) && (buffer[len-1] != '\n')) {
 			CFG_LOG(ERR, " line %d - no \\n found on string. "
-					"Check if line too long\n", lineno);
+					"Check if line too long", lineno);
 			goto error1;
 		}
 		/* skip parsing if comment character found */
@@ -209,7 +209,7 @@ rte_cfgfile_load_with_params(const char *filename, int flags,
 			char *end = memchr(buffer, ']', len);
 			if (end == NULL) {
 				CFG_LOG(ERR,
-					"line %d - no terminating ']' character found\n",
+					"line %d - no terminating ']' character found",
 					lineno);
 				goto error1;
 			}
@@ -225,7 +225,7 @@ rte_cfgfile_load_with_params(const char *filename, int flags,
 			split[1] = memchr(buffer, '=', len);
 			if (split[1] == NULL) {
 				CFG_LOG(ERR,
-					"line %d - no '=' character found\n",
+					"line %d - no '=' character found",
 					lineno);
 				goto error1;
 			}
@@ -249,7 +249,7 @@ rte_cfgfile_load_with_params(const char *filename, int flags,
 			if (!(flags & CFG_FLAG_EMPTY_VALUES) &&
 					(*split[1] == '\0')) {
 				CFG_LOG(ERR,
-					"line %d - cannot use empty values\n",
+					"line %d - cannot use empty values",
 					lineno);
 				goto error1;
 			}
@@ -414,7 +414,7 @@ int rte_cfgfile_set_entry(struct rte_cfgfile *cfg, const char *sectionname,
 			return 0;
 		}
 
-	CFG_LOG(ERR, "entry name doesn't exist\n");
+	CFG_LOG(ERR, "entry name doesn't exist");
 	return -EINVAL;
 }
 
lib/compressdev/rte_compressdev_pmd.c +2 -2
index 156bccd972..762b44f03e 100644
@@ -100,12 +100,12 @@ rte_compressdev_pmd_create(const char *name,
 	struct rte_compressdev *compressdev;
 
 	if (params->name[0] != '\0') {
-		COMPRESSDEV_LOG(INFO, "User specified device name = %s\n",
+		COMPRESSDEV_LOG(INFO, "User specified device name = %s",
 				params->name);
 		name = params->name;
 	}
 
-	COMPRESSDEV_LOG(INFO, "Creating compressdev %s\n", name);
+	COMPRESSDEV_LOG(INFO, "Creating compressdev %s", name);
 
 	COMPRESSDEV_LOG(INFO, "Init parameters - name: %s, socket id: %d",
 			name, params->socket_id);
lib/cryptodev/rte_cryptodev.c +1 -1
index ead8c9a623..b233c0ecd7 100644
@@ -2074,7 +2074,7 @@ rte_cryptodev_sym_session_create(uint8_t dev_id,
 	}
 
 	if (xforms == NULL) {
-		CDEV_LOG_ERR("Invalid xform\n");
+		CDEV_LOG_ERR("Invalid xform");
 		rte_errno = EINVAL;
 		return NULL;
 	}
lib/dispatcher/rte_dispatcher.c +6 -6
index 10d02edde9..95dd41b818 100644
@@ -246,7 +246,7 @@ evd_service_register(struct rte_dispatcher *dispatcher)
 	rc = rte_service_component_register(&service, &dispatcher->service_id);
 	if (rc != 0)
 		RTE_EDEV_LOG_ERR("Registration of dispatcher service "
-				 "%s failed with error code %d\n",
+				 "%s failed with error code %d",
 				 service.name, rc);
 
 	return rc;
@@ -260,7 +260,7 @@ evd_service_unregister(struct rte_dispatcher *dispatcher)
 	rc = rte_service_component_unregister(dispatcher->service_id);
 	if (rc != 0)
 		RTE_EDEV_LOG_ERR("Unregistration of dispatcher service "
-				 "failed with error code %d\n", rc);
+				 "failed with error code %d", rc);
 
 	return rc;
 }
@@ -279,7 +279,7 @@ rte_dispatcher_create(uint8_t event_dev_id)
 				  RTE_CACHE_LINE_SIZE, socket_id);
 
 	if (dispatcher == NULL) {
-		RTE_EDEV_LOG_ERR("Unable to allocate memory for dispatcher\n");
+		RTE_EDEV_LOG_ERR("Unable to allocate memory for dispatcher");
 		rte_errno = ENOMEM;
 		return NULL;
 	}
@@ -483,7 +483,7 @@ evd_lcore_uninstall_handler(struct rte_dispatcher_lcore *lcore,
 	unreg_handler = evd_lcore_get_handler_by_id(lcore, handler_id);
 
 	if (unreg_handler == NULL) {
-		RTE_EDEV_LOG_ERR("Invalid handler id %d\n", handler_id);
+		RTE_EDEV_LOG_ERR("Invalid handler id %d", handler_id);
 		return -EINVAL;
 	}
 
@@ -602,7 +602,7 @@ rte_dispatcher_finalize_unregister(struct rte_dispatcher *dispatcher,
 	unreg_finalizer = evd_get_finalizer_by_id(dispatcher, finalizer_id);
 
 	if (unreg_finalizer == NULL) {
-		RTE_EDEV_LOG_ERR("Invalid finalizer id %d\n", finalizer_id);
+		RTE_EDEV_LOG_ERR("Invalid finalizer id %d", finalizer_id);
 		return -EINVAL;
 	}
 
@@ -636,7 +636,7 @@ evd_set_service_runstate(struct rte_dispatcher *dispatcher, int state)
 	 */
 	if (rc != 0)
 		RTE_EDEV_LOG_ERR("Unexpected error %d occurred while setting "
-				 "service component run state to %d\n", rc,
+				 "service component run state to %d", rc,
 				 state);
 
 	RTE_VERIFY(rc == 0);
lib/dmadev/rte_dmadev.c +1 -1
index 4e5e420c82..009a21849a 100644
@@ -726,7 +726,7 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
 		return -EINVAL;
 
 	if (vchan >= dev->data->dev_conf.nb_vchans) {
-		RTE_DMA_LOG(ERR, "Device %u vchan %u out of range\n", dev_id, vchan);
+		RTE_DMA_LOG(ERR, "Device %u vchan %u out of range", dev_id, vchan);
 		return -EINVAL;
 	}
 
lib/eal/windows/eal_memory.c +1 -1
index 31410a41fd..fd39155163 100644
@@ -110,7 +110,7 @@ eal_mem_win32api_init(void)
 	VirtualAlloc2_ptr = (VirtualAlloc2_type)(
 		(void *)GetProcAddress(library, function));
 	if (VirtualAlloc2_ptr == NULL) {
-		RTE_LOG_WIN32_ERR("GetProcAddress(\"%s\", \"%s\")\n",
+		RTE_LOG_WIN32_ERR("GetProcAddress(\"%s\", \"%s\")",
 			library_name, function);
 
 		/* Contrary to the docs, Server 2016 is not supported. */
lib/eventdev/eventdev_pmd.h +3 -3
index 30bd90085c..2ec5aec0a8 100644
@@ -49,14 +49,14 @@ extern "C" {
 /* Macros to check for valid device */
 #define RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, retval) do { \
 	if (!rte_event_pmd_is_valid_dev((dev_id))) { \
-		RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
+		RTE_EDEV_LOG_ERR("Invalid dev_id=%d", dev_id); \
 		return retval; \
 	} \
 } while (0)
 
 #define RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, errno, retval) do { \
 	if (!rte_event_pmd_is_valid_dev((dev_id))) { \
-		RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
+		RTE_EDEV_LOG_ERR("Invalid dev_id=%d", dev_id); \
 		rte_errno = errno; \
 		return retval; \
 	} \
@@ -64,7 +64,7 @@ extern "C" {
 
 #define RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id) do { \
 	if (!rte_event_pmd_is_valid_dev((dev_id))) { \
-		RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \
+		RTE_EDEV_LOG_ERR("Invalid dev_id=%d", dev_id); \
 		return; \
 	} \
 } while (0)
lib/eventdev/rte_event_crypto_adapter.c +6 -6
index 1b435c9f0e..d46595d190 100644
@@ -133,7 +133,7 @@ static struct event_crypto_adapter **event_crypto_adapter;
 /* Macros to check for valid adapter */
 #define EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) do { \
 	if (!eca_valid_id(id)) { \
-		RTE_EDEV_LOG_ERR("Invalid crypto adapter id = %d\n", id); \
+		RTE_EDEV_LOG_ERR("Invalid crypto adapter id = %d", id); \
 		return retval; \
 	} \
 } while (0)
@@ -309,7 +309,7 @@ eca_default_config_cb(uint8_t id, uint8_t dev_id,
 
 	ret = rte_event_dev_configure(dev_id, &dev_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("failed to configure event dev %u\n", dev_id);
+		RTE_EDEV_LOG_ERR("failed to configure event dev %u", dev_id);
 		if (started) {
 			if (rte_event_dev_start(dev_id))
 				return -EIO;
@@ -319,7 +319,7 @@ eca_default_config_cb(uint8_t id, uint8_t dev_id,
 
 	ret = rte_event_port_setup(dev_id, port_id, port_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("failed to setup event port %u\n", port_id);
+		RTE_EDEV_LOG_ERR("failed to setup event port %u", port_id);
 		return ret;
 	}
 
@@ -391,7 +391,7 @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id,
 					sizeof(struct crypto_device_info), 0,
 					socket_id);
 	if (adapter->cdevs == NULL) {
-		RTE_EDEV_LOG_ERR("Failed to get mem for crypto devices\n");
+		RTE_EDEV_LOG_ERR("Failed to get mem for crypto devices");
 		eca_circular_buffer_free(&adapter->ebuf);
 		rte_free(adapter);
 		return -ENOMEM;
@@ -1403,7 +1403,7 @@ rte_event_crypto_adapter_runtime_params_set(uint8_t id,
 	EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
 
 	if (params == NULL) {
-		RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+		RTE_EDEV_LOG_ERR("params pointer is NULL");
 		return -EINVAL;
 	}
 
@@ -1436,7 +1436,7 @@ rte_event_crypto_adapter_runtime_params_get(uint8_t id,
 	EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
 
 	if (params == NULL) {
-		RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+		RTE_EDEV_LOG_ERR("params pointer is NULL");
 		return -EINVAL;
 	}
 
lib/eventdev/rte_event_dma_adapter.c +7 -7
index cbf9405438..4196164305 100644
@@ -20,7 +20,7 @@
 #define EVENT_DMA_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) \
 	do { \
 		if (!edma_adapter_valid_id(id)) { \
-			RTE_EDEV_LOG_ERR("Invalid DMA adapter id = %d\n", id); \
+			RTE_EDEV_LOG_ERR("Invalid DMA adapter id = %d", id); \
 			return retval; \
 		} \
 	} while (0)
@@ -313,7 +313,7 @@ edma_default_config_cb(uint8_t id, uint8_t evdev_id, struct rte_event_dma_adapte
 
 	ret = rte_event_dev_configure(evdev_id, &dev_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("Failed to configure event dev %u\n", evdev_id);
+		RTE_EDEV_LOG_ERR("Failed to configure event dev %u", evdev_id);
 		if (started) {
 			if (rte_event_dev_start(evdev_id))
 				return -EIO;
@@ -323,7 +323,7 @@ edma_default_config_cb(uint8_t id, uint8_t evdev_id, struct rte_event_dma_adapte
 
 	ret = rte_event_port_setup(evdev_id, port_id, port_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("Failed to setup event port %u\n", port_id);
+		RTE_EDEV_LOG_ERR("Failed to setup event port %u", port_id);
 		return ret;
 	}
 
@@ -407,7 +407,7 @@ rte_event_dma_adapter_create_ext(uint8_t id, uint8_t evdev_id,
 					       num_dma_dev * sizeof(struct dma_device_info), 0,
 					       socket_id);
 	if (adapter->dma_devs == NULL) {
-		RTE_EDEV_LOG_ERR("Failed to get memory for DMA devices\n");
+		RTE_EDEV_LOG_ERR("Failed to get memory for DMA devices");
 		edma_circular_buffer_free(&adapter->ebuf);
 		rte_free(adapter);
 		return -ENOMEM;
@@ -417,7 +417,7 @@ rte_event_dma_adapter_create_ext(uint8_t id, uint8_t evdev_id,
 	for (i = 0; i < num_dma_dev; i++) {
 		ret = rte_dma_info_get(i, &info);
 		if (ret) {
-			RTE_EDEV_LOG_ERR("Failed to get dma device info\n");
+			RTE_EDEV_LOG_ERR("Failed to get dma device info");
 			edma_circular_buffer_free(&adapter->ebuf);
 			rte_free(adapter);
 			return ret;
@@ -1297,7 +1297,7 @@ rte_event_dma_adapter_runtime_params_set(uint8_t id,
 	EVENT_DMA_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
 
 	if (params == NULL) {
-		RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+		RTE_EDEV_LOG_ERR("params pointer is NULL");
 		return -EINVAL;
 	}
 
@@ -1326,7 +1326,7 @@ rte_event_dma_adapter_runtime_params_get(uint8_t id,
 	EVENT_DMA_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
 
 	if (params == NULL) {
-		RTE_EDEV_LOG_ERR("params pointer is NULL\n");
+		RTE_EDEV_LOG_ERR("params pointer is NULL");
 		return -EINVAL;
 	}
 
lib/eventdev/rte_event_eth_rx_adapter.c +14 -14
index 82ae31712d..1b83a55b5c 100644
@@ -293,14 +293,14 @@ rxa_event_buf_get(struct event_eth_rx_adapter *rx_adapter, uint16_t eth_dev_id,
 
 #define RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) do { \
 	if (!rxa_validate_id(id)) { \
-		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d\n", id); \
+		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \
 		return retval; \
 	} \
 } while (0)
 
 #define RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_GOTO_ERR_RET(id, retval) do { \
 	if (!rxa_validate_id(id)) { \
-		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d\n", id); \
+		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \
 		ret = retval; \
 		goto error; \
 	} \
@@ -308,7 +308,7 @@ rxa_event_buf_get(struct event_eth_rx_adapter *rx_adapter, uint16_t eth_dev_id,
 
 #define RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, retval) do { \
 	if ((token) == NULL || strlen(token) == 0 || !isdigit(*token)) { \
-		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter token\n"); \
+		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter token"); \
 		ret = retval; \
 		goto error; \
 	} \
@@ -1540,7 +1540,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
 
 	ret = rte_event_dev_configure(dev_id, &dev_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("failed to configure event dev %u\n",
+		RTE_EDEV_LOG_ERR("failed to configure event dev %u",
 						dev_id);
 		if (started) {
 			if (rte_event_dev_start(dev_id))
@@ -1551,7 +1551,7 @@ rxa_default_conf_cb(uint8_t id, uint8_t dev_id,
 
 	ret = rte_event_port_setup(dev_id, port_id, port_conf);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("failed to setup event port %u\n",
+		RTE_EDEV_LOG_ERR("failed to setup event port %u",
 					port_id);
 		return ret;
 	}
@@ -1628,7 +1628,7 @@ rxa_create_intr_thread(struct event_eth_rx_adapter *rx_adapter)
 	if (!err)
 		return 0;
 
-	RTE_EDEV_LOG_ERR("Failed to create interrupt thread err = %d\n", err);
+	RTE_EDEV_LOG_ERR("Failed to create interrupt thread err = %d", err);
 	rte_free(rx_adapter->epoll_events);
 error:
 	rte_ring_free(rx_adapter->intr_ring);
@@ -1644,12 +1644,12 @@ rxa_destroy_intr_thread(struct event_eth_rx_adapter *rx_adapter)
 
 	err = pthread_cancel((pthread_t)rx_adapter->rx_intr_thread.opaque_id);
 	if (err)
-		RTE_EDEV_LOG_ERR("Can't cancel interrupt thread err = %d\n",
+		RTE_EDEV_LOG_ERR("Can't cancel interrupt thread err = %d",
 				err);
 
 	err = rte_thread_join(rx_adapter->rx_intr_thread, NULL);
 	if (err)
-		RTE_EDEV_LOG_ERR("Can't join interrupt thread err = %d\n", err);
+		RTE_EDEV_LOG_ERR("Can't join interrupt thread err = %d", err);
 
 	rte_free(rx_adapter->epoll_events);
 	rte_ring_free(rx_adapter->intr_ring);
@@ -1915,7 +1915,7 @@ rxa_init_service(struct event_eth_rx_adapter *rx_adapter, uint8_t id)
 	if (rte_mbuf_dyn_rx_timestamp_register(
 			&event_eth_rx_timestamp_dynfield_offset,
 			&event_eth_rx_timestamp_dynflag) != 0) {
-		RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf\n");
+		RTE_EDEV_LOG_ERR("Error registering timestamp field in mbuf");
 		return -rte_errno;
 	}
 
@@ -2445,7 +2445,7 @@ rxa_create(uint8_t id, uint8_t dev_id,
 			    RTE_DIM(default_rss_key));
 
 	if (rx_adapter->eth_devices == NULL) {
-		RTE_EDEV_LOG_ERR("failed to get mem for eth devices\n");
+		RTE_EDEV_LOG_ERR("failed to get mem for eth devices");
 		rte_free(rx_adapter);
 		return -ENOMEM;
 	}
@@ -2497,12 +2497,12 @@ rxa_config_params_validate(struct rte_event_eth_rx_adapter_params *rxa_params,
 		return 0;
 	} else if (!rxa_params->use_queue_event_buf &&
 		    rxa_params->event_buf_size == 0) {
-		RTE_EDEV_LOG_ERR("event buffer size can't be zero\n");
+		RTE_EDEV_LOG_ERR("event buffer size can't be zero");
 		return -EINVAL;
 	} else if (rxa_params->use_queue_event_buf &&
 		   rxa_params->event_buf_size != 0) {
 		RTE_EDEV_LOG_ERR("event buffer size needs to be configured "
-				 "as part of queue add\n");
+				 "as part of queue add");
 		return -EINVAL;
 	}
 
@@ -3597,7 +3597,7 @@ handle_rxa_stats(const char *cmd __rte_unused,
 	/* Get Rx adapter stats */
 	if (rte_event_eth_rx_adapter_stats_get(rx_adapter_id,
 					       &rx_adptr_stats)) {
-		RTE_EDEV_LOG_ERR("Failed to get Rx adapter stats\n");
+		RTE_EDEV_LOG_ERR("Failed to get Rx adapter stats");
 		return -1;
 	}
 
@@ -3636,7 +3636,7 @@ handle_rxa_stats_reset(const char *cmd __rte_unused,
 
 	/* Reset Rx adapter stats */
 	if (rte_event_eth_rx_adapter_stats_reset(rx_adapter_id)) {
-		RTE_EDEV_LOG_ERR("Failed to reset Rx adapter stats\n");
+		RTE_EDEV_LOG_ERR("Failed to reset Rx adapter stats");
 		return -1;
 	}
 
lib/eventdev/rte_event_eth_tx_adapter.c +1 -1
index 360d5caf6a..56435be991 100644
@@ -334,7 +334,7 @@ txa_service_conf_cb(uint8_t __rte_unused id, uint8_t dev_id,
 
 	ret = rte_event_port_setup(dev_id, port_id, pc);
 	if (ret) {
-		RTE_EDEV_LOG_ERR("failed to setup event port %u\n",
+		RTE_EDEV_LOG_ERR("failed to setup event port %u",
 					port_id);
 		if (started) {
 			if (rte_event_dev_start(dev_id))
lib/eventdev/rte_event_timer_adapter.c +2 -2
index 27466707bc..3f22e85173 100644
@@ -106,7 +106,7 @@ default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id,
 
 	ret = rte_event_dev_configure(dev_id, &dev_conf);
 	if (ret < 0) {
-		EVTIM_LOG_ERR("failed to configure event dev %u\n", dev_id);
+		EVTIM_LOG_ERR("failed to configure event dev %u", dev_id);
 		if (started)
 			if (rte_event_dev_start(dev_id))
 				return -EIO;
@@ -116,7 +116,7 @@ default_port_conf_cb(uint16_t id, uint8_t event_dev_id, uint8_t *event_port_id,
 
 	ret = rte_event_port_setup(dev_id, port_id, port_conf);
 	if (ret < 0) {
-		EVTIM_LOG_ERR("failed to setup event port %u on event dev %u\n",
+		EVTIM_LOG_ERR("failed to setup event port %u on event dev %u",
 			      port_id, dev_id);
 		return ret;
 	}
lib/eventdev/rte_eventdev.c +2 -2
index ae50821a3f..157752868d 100644
@@ -1007,13 +1007,13 @@ rte_event_port_profile_links_set(uint8_t dev_id, uint8_t port_id, const uint8_t
 	}
 
 	if (*dev->dev_ops->port_link == NULL) {
-		RTE_EDEV_LOG_ERR("Function not supported\n");
+		RTE_EDEV_LOG_ERR("Function not supported");
 		rte_errno = ENOTSUP;
 		return 0;
 	}
 
 	if (profile_id && *dev->dev_ops->port_link_profile == NULL) {
-		RTE_EDEV_LOG_ERR("Function not supported\n");
+		RTE_EDEV_LOG_ERR("Function not supported");
 		rte_errno = ENOTSUP;
 		return 0;
 	}
lib/metrics/rte_metrics_telemetry.c +1 -1
index 5be21b2e86..1d133e1f8c 100644
@@ -363,7 +363,7 @@ rte_metrics_tel_stat_names_to_ids(const char * const *stat_names,
 			}
 		}
 		if (j == num_metrics) {
-			METRICS_LOG_WARN("Invalid stat name %s\n",
+			METRICS_LOG_WARN("Invalid stat name %s",
 					stat_names[i]);
 			free(names);
 			return -EINVAL;
lib/mldev/rte_mldev.c +51 -51

394 lines not on this page · raw message

lib/net/rte_net_crc.c +3 -3
index a685f9e7bb..900d6de7f4 100644
@@ -179,7 +179,7 @@ avx512_vpclmulqdq_get_handlers(void)
 			max_simd_bitwidth >= RTE_VECT_SIMD_512)
 		return handlers_avx512;
 #endif
-	NET_LOG(INFO, "Requirements not met, can't use AVX512\n");
+	NET_LOG(INFO, "Requirements not met, can't use AVX512");
 	return NULL;
 }
 
@@ -205,7 +205,7 @@ sse42_pclmulqdq_get_handlers(void)
 			max_simd_bitwidth >= RTE_VECT_SIMD_128)
 		return handlers_sse42;
 #endif
-	NET_LOG(INFO, "Requirements not met, can't use SSE\n");
+	NET_LOG(INFO, "Requirements not met, can't use SSE");
 	return NULL;
 }
 
@@ -231,7 +231,7 @@ neon_pmull_get_handlers(void)
 			max_simd_bitwidth >= RTE_VECT_SIMD_128)
 		return handlers_neon;
 #endif
-	NET_LOG(INFO, "Requirements not met, can't use NEON\n");
+	NET_LOG(INFO, "Requirements not met, can't use NEON");
 	return NULL;
 }
 
lib/node/ethdev_rx.c +2 -2
index 3e8fac1df4..475eff6abe 100644
@@ -160,13 +160,13 @@ ethdev_ptype_setup(uint16_t port, uint16_t queue)
 
 	if (!l3_ipv4 || !l3_ipv6) {
 		node_info("ethdev_rx",
-			  "Enabling ptype callback for required ptypes on port %u\n",
+			  "Enabling ptype callback for required ptypes on port %u",
 			  port);
 
 		if (!rte_eth_add_rx_callback(port, queue, eth_pkt_parse_cb,
 					     NULL)) {
 			node_err("ethdev_rx",
-				 "Failed to add rx ptype cb: port=%d, queue=%d\n",
+				 "Failed to add rx ptype cb: port=%d, queue=%d",
 				 port, queue);
 			return -EINVAL;
 		}
lib/node/ip4_lookup.c +1 -1
index 0dbfde64fe..18955971f6 100644
@@ -143,7 +143,7 @@ rte_node_ip4_route_add(uint32_t ip, uint8_t depth, uint16_t next_hop,
 				  ip, depth, val);
 		if (ret < 0) {
 			node_err("ip4_lookup",
-				 "Unable to add entry %s / %d nh (%x) to LPM table on sock %d, rc=%d\n",
+				 "Unable to add entry %s / %d nh (%x) to LPM table on sock %d, rc=%d",
 				 abuf, depth, val, socket, ret);
 			return ret;
 		}
lib/node/ip6_lookup.c +1 -1
index 6f56eb5ec5..309964f60f 100644
@@ -283,7 +283,7 @@ rte_node_ip6_route_add(const uint8_t *ip, uint8_t depth, uint16_t next_hop,
 		if (ret < 0) {
 			node_err("ip6_lookup",
 				 "Unable to add entry %s / %d nh (%x) to LPM "
-				 "table on sock %d, rc=%d\n",
+				 "table on sock %d, rc=%d",
 				 abuf, depth, val, socket, ret);
 			return ret;
 		}
lib/node/kernel_rx.c +4 -4
index 2dba7c8cc7..6c20cdbb1e 100644
@@ -134,7 +134,7 @@ kernel_rx_node_do(struct rte_graph *graph, struct rte_node *node, kernel_rx_node
 			if (len == 0 || len == 0xFFFF) {
 				rte_pktmbuf_free(m);
 				if (rx->idx <= 0)
-					node_dbg("kernel_rx", "rx_mbuf array is empty\n");
+					node_dbg("kernel_rx", "rx_mbuf array is empty");
 				rx->idx--;
 				break;
 			}
@@ -207,20 +207,20 @@ kernel_rx_node_init(const struct rte_graph *graph, struct rte_node *node)
 	RTE_VERIFY(elem != NULL);
 
 	if (ctx->pktmbuf_pool == NULL) {
-		node_err("kernel_rx", "Invalid mbuf pool on graph %s\n", graph->name);
+		node_err("kernel_rx", "Invalid mbuf pool on graph %s", graph->name);
 		return -EINVAL;
 	}
 
 	recv_info = rte_zmalloc_socket("kernel_rx_info", sizeof(kernel_rx_info_t),
 				       RTE_CACHE_LINE_SIZE, graph->socket);
 	if (!recv_info) {
-		node_err("kernel_rx", "Kernel recv_info is NULL\n");
+		node_err("kernel_rx", "Kernel recv_info is NULL");
 		return -ENOMEM;
 	}
 
 	sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
 	if (sock < 0) {
-		node_err("kernel_rx", "Unable to open RAW socket\n");
+		node_err("kernel_rx", "Unable to open RAW socket");
 		return sock;
 	}
 
lib/node/kernel_tx.c +2 -2
index 27d1808c71..3a96741622 100644
@@ -36,7 +36,7 @@ kernel_tx_process_mbuf(struct rte_node *node, struct rte_mbuf **mbufs, uint16_t
 		sin.sin_addr.s_addr = ip4->dst_addr;
 
 		if (sendto(ctx->sock, buf, len, 0, (struct sockaddr *)&sin, sizeof(sin)) < 0)
-			node_err("kernel_tx", "Unable to send packets: %s\n", strerror(errno));
+			node_err("kernel_tx", "Unable to send packets: %s", strerror(errno));
 	}
 }
 
@@ -87,7 +87,7 @@ kernel_tx_node_init(const struct rte_graph *graph __rte_unused, struct rte_node
 
 	ctx->sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
 	if (ctx->sock < 0)
-		node_err("kernel_tx", "Unable to open RAW socket\n");
+		node_err("kernel_tx", "Unable to open RAW socket");
 
 	return 0;
 }
lib/rcu/rte_rcu_qsbr.c +2 -2
index a9f3d6cc98..41a44be4b9 100644
@@ -92,7 +92,7 @@ rte_rcu_qsbr_thread_register(struct rte_rcu_qsbr *v, unsigned int thread_id)
 		return 1;
 	}
 
-	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u\n",
+	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u",
 				v->qsbr_cnt[thread_id].lock_cnt);
 
 	id = thread_id & __RTE_QSBR_THRID_MASK;
@@ -144,7 +144,7 @@ rte_rcu_qsbr_thread_unregister(struct rte_rcu_qsbr *v, unsigned int thread_id)
 		return 1;
 	}
 
-	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u\n",
+	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u",
 				v->qsbr_cnt[thread_id].lock_cnt);
 
 	id = thread_id & __RTE_QSBR_THRID_MASK;
lib/rcu/rte_rcu_qsbr.h +4 -4
index 5979fb0efb..6b908e7ee0 100644
@@ -299,7 +299,7 @@ rte_rcu_qsbr_thread_online(struct rte_rcu_qsbr *v, unsigned int thread_id)
 
 	RTE_ASSERT(v != NULL && thread_id < v->max_threads);
 
-	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u\n",
+	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u",
 				v->qsbr_cnt[thread_id].lock_cnt);
 
 	/* Copy the current value of token.
@@ -350,7 +350,7 @@ rte_rcu_qsbr_thread_offline(struct rte_rcu_qsbr *v, unsigned int thread_id)
 {
 	RTE_ASSERT(v != NULL && thread_id < v->max_threads);
 
-	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u\n",
+	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u",
 				v->qsbr_cnt[thread_id].lock_cnt);
 
 	/* The reader can go offline only after the load of the
@@ -427,7 +427,7 @@ rte_rcu_qsbr_unlock(__rte_unused struct rte_rcu_qsbr *v,
 				1, rte_memory_order_release);
 
 	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, WARNING,
-				"Lock counter %u. Nested locks?\n",
+				"Lock counter %u. Nested locks?",
 				v->qsbr_cnt[thread_id].lock_cnt);
 #endif
 }
@@ -481,7 +481,7 @@ rte_rcu_qsbr_quiescent(struct rte_rcu_qsbr *v, unsigned int thread_id)
 
 	RTE_ASSERT(v != NULL && thread_id < v->max_threads);
 
-	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u\n",
+	__RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, ERR, "Lock counter %u",
 				v->qsbr_cnt[thread_id].lock_cnt);
 
 	/* Acquire the changes to the shared data structure released
lib/stack/rte_stack.c +4 -4
index 1fabec2bfe..1dab6d6645 100644
@@ -56,7 +56,7 @@ rte_stack_create(const char *name, unsigned int count, int socket_id,
 	int ret;
 
 	if (flags & ~(RTE_STACK_F_LF)) {
-		STACK_LOG_ERR("Unsupported stack flags %#x\n", flags);
+		STACK_LOG_ERR("Unsupported stack flags %#x", flags);
 		return NULL;
 	}
 
@@ -65,7 +65,7 @@ rte_stack_create(const char *name, unsigned int count, int socket_id,
 #endif
 #if !defined(RTE_STACK_LF_SUPPORTED)
 	if (flags & RTE_STACK_F_LF) {
-		STACK_LOG_ERR("Lock-free stack is not supported on your platform\n");
+		STACK_LOG_ERR("Lock-free stack is not supported on your platform");
 		rte_errno = ENOTSUP;
 		return NULL;
 	}
@@ -82,7 +82,7 @@ rte_stack_create(const char *name, unsigned int count, int socket_id,
 
 	te = rte_zmalloc("STACK_TAILQ_ENTRY", sizeof(*te), 0);
 	if (te == NULL) {
-		STACK_LOG_ERR("Cannot reserve memory for tailq\n");
+		STACK_LOG_ERR("Cannot reserve memory for tailq");
 		rte_errno = ENOMEM;
 		return NULL;
 	}
@@ -92,7 +92,7 @@ rte_stack_create(const char *name, unsigned int count, int socket_id,
 	mz = rte_memzone_reserve_aligned(mz_name, sz, socket_id,
 					 0, __alignof__(*s));
 	if (mz == NULL) {
-		STACK_LOG_ERR("Cannot reserve stack memzone!\n");
+		STACK_LOG_ERR("Cannot reserve stack memzone!");
 		rte_mcfg_tailq_write_unlock();
 		rte_free(te);
 		return NULL;
lib/vhost/vhost_crypto.c +3 -3
index 3e1ef1ac25..6e5443e5f8 100644
@@ -245,7 +245,7 @@ transform_cipher_param(struct rte_crypto_sym_xform *xform,
 		return ret;
 
 	if (param->cipher_key_len > VHOST_USER_CRYPTO_MAX_CIPHER_KEY_LENGTH) {
-		VC_LOG_DBG("Invalid cipher key length\n");
+		VC_LOG_DBG("Invalid cipher key length");
 		return -VIRTIO_CRYPTO_BADMSG;
 	}
 
@@ -301,7 +301,7 @@ transform_chain_param(struct rte_crypto_sym_xform *xforms,
 		return ret;
 
 	if (param->cipher_key_len > VHOST_USER_CRYPTO_MAX_CIPHER_KEY_LENGTH) {
-		VC_LOG_DBG("Invalid cipher key length\n");
+		VC_LOG_DBG("Invalid cipher key length");
 		return -VIRTIO_CRYPTO_BADMSG;
 	}
 
@@ -321,7 +321,7 @@ transform_chain_param(struct rte_crypto_sym_xform *xforms,
 		return ret;
 
 	if (param->auth_key_len > VHOST_USER_CRYPTO_MAX_HMAC_KEY_LENGTH) {
-		VC_LOG_DBG("Invalid auth key length\n");
+		VC_LOG_DBG("Invalid auth key length");
 		return -VIRTIO_CRYPTO_BADMSG;
 	}
 
Signature · 1 line
2.43.0
#111 lore raw

PATCH v5 6/13 eal/linux: remove log paraphrasing the doc

In reply to David Marchand

An error log message does not need to paraphrase the DPDK documentation.

---
 lib/eal/linux/eal_timer.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
lib/eal/linux/eal_timer.c +1 -5
index 3a30284e3a..df9ad61ae9 100644
@@ -152,11 +152,7 @@ rte_eal_hpet_init(int make_default)
 	}
 	eal_hpet = mmap(NULL, 1024, PROT_READ, MAP_SHARED, fd, 0);
 	if (eal_hpet == MAP_FAILED) {
-		RTE_LOG(ERR, EAL, "ERROR: Cannot mmap "DEV_HPET"!\n"
-				"Please enable CONFIG_HPET_MMAP in your kernel configuration "
-				"to allow HPET support.\n"
-				"To run without using HPET, unset RTE_LIBEAL_USE_HPET "
-				"in your build configuration or use '--no-hpet' EAL flag.\n");
+		RTE_LOG(ERR, EAL, "ERROR: Cannot mmap "DEV_HPET"!\n");
 		close(fd);
 		internal_conf->no_hpet = 1;
 		return -1;
Signature · 1 line
2.43.0
#112 lore raw

PATCH v5 7/13 bpf: remove log level in internal helper

In reply to David Marchand

There is no other log level than debug, simplify this helper.

---
 lib/bpf/bpf_validate.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
lib/bpf/bpf_validate.c +5 -5
index 95b9ef99ef..f246b3c5eb 100644
@@ -2178,18 +2178,18 @@ restore_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 }
 
 static void
-log_eval_state(const struct bpf_verifier *bvf, const struct ebpf_insn *ins,
-	uint32_t pc, int32_t loglvl)
+log_dbg_eval_state(const struct bpf_verifier *bvf, const struct ebpf_insn *ins,
+	uint32_t pc)
 {
 	const struct bpf_eval_state *st;
 	const struct bpf_reg_val *rv;
 
-	rte_log(loglvl, rte_bpf_logtype, "%s(pc=%u):\n", __func__, pc);
+	RTE_BPF_LOG(DEBUG, "%s(pc=%u):\n", __func__, pc);
 
 	st = bvf->evst;
 	rv = st->rv + ins->dst_reg;
 
-	rte_log(loglvl, rte_bpf_logtype,
+	RTE_BPF_LOG(DEBUG,
 		"r%u={\n"
 		"\tv={type=%u, size=%zu},\n"
 		"\tmask=0x%" PRIx64 ",\n"
@@ -2269,7 +2269,7 @@ evaluate(struct bpf_verifier *bvf)
 				}
 			}
 
-			log_eval_state(bvf, ins + idx, idx, RTE_LOG_DEBUG);
+			log_dbg_eval_state(bvf, ins + idx, idx);
 			bvf->evin = NULL;
 		}
 
Signature · 1 line
2.43.0
#113 lore raw

PATCH v5 8/13 lib: simplify multilines log messages

In reply to David Marchand

Those error log messages don't need to span on multiple lines.

---
Changes since RFC v2:
- fixed format string crossing line boundaries,

---
 lib/acl/tb_mem.c                |  4 ++--
 lib/bpf/bpf_stub.c              |  6 ++----
 lib/eal/windows/eal_hugepages.c |  4 ++--
 lib/ethdev/rte_ethdev.c         | 12 ++++--------
 4 files changed, 10 insertions(+), 16 deletions(-)
lib/acl/tb_mem.c +2 -2
index 6a9d96aaed..4ee65b23da 100644
@@ -26,8 +26,8 @@ tb_pool(struct tb_mem_pool *pool, size_t sz)
 	size = sz + pool->alignment - 1;
 	block = calloc(1, size + sizeof(*pool->block));
 	if (block == NULL) {
-		RTE_LOG(ERR, ACL, "%s(%zu)\n failed, currently allocated "
-			"by pool: %zu bytes\n", __func__, sz, pool->alloc);
+		RTE_LOG(ERR, ACL, "%s(%zu) failed, currently allocated by pool: %zu bytes\n",
+			__func__, sz, pool->alloc);
 		siglongjmp(pool->fail, -ENOMEM);
 		return NULL;
 	}
lib/bpf/bpf_stub.c +2 -4
index ebc5343896..83c2203622 100644
@@ -19,8 +19,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 		return NULL;
 	}
 
-	RTE_BPF_LOG(ERR, "%s() is not supported with current config\n"
-		"rebuild with libelf installed\n",
+	RTE_BPF_LOG(ERR, "%s() is not supported, rebuild with libelf installed\n",
 		__func__);
 	rte_errno = ENOTSUP;
 	return NULL;
@@ -36,8 +35,7 @@ rte_bpf_convert(const struct bpf_program *prog)
 		return NULL;
 	}
 
-	RTE_BPF_LOG(ERR, "%s() is not supported with current config\n"
-		"rebuild with libpcap installed\n",
+	RTE_BPF_LOG(ERR, "%s() is not supported, rebuild with libpcap installed\n",
 		__func__);
 	rte_errno = ENOTSUP;
 	return NULL;
lib/eal/windows/eal_hugepages.c +2 -2
index b007dceb39..775c67e4c4 100644
@@ -105,8 +105,8 @@ int
 eal_hugepage_info_init(void)
 {
 	if (hugepage_claim_privilege() < 0) {
-		RTE_LOG(ERR, EAL, "Cannot claim hugepage privilege\n"
-		"Verify that large-page support privilege is assigned to the current user\n");
+		RTE_LOG(ERR, EAL,
+			"Cannot claim hugepage privilege, check large-page support privilege\n");
 		return -1;
 	}
 
lib/ethdev/rte_ethdev.c +4 -8
index b9d99ece15..9dd0efa9d8 100644
@@ -6709,8 +6709,7 @@ rte_eth_ip_reassembly_capability_get(uint16_t port_id,
 
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Device with port_id=%u is not configured.\n"
-			"Cannot get IP reassembly capability\n",
+			"port_id=%u is not configured, cannot get IP reassembly capability\n",
 			port_id);
 		return -EINVAL;
 	}
@@ -6745,8 +6744,7 @@ rte_eth_ip_reassembly_conf_get(uint16_t port_id,
 
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Device with port_id=%u is not configured.\n"
-			"Cannot get IP reassembly configuration\n",
+			"port_id=%u is not configured, cannot get IP reassembly configuration\n",
 			port_id);
 		return -EINVAL;
 	}
@@ -6779,16 +6777,14 @@ rte_eth_ip_reassembly_conf_set(uint16_t port_id,
 
 	if (dev->data->dev_configured == 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Device with port_id=%u is not configured.\n"
-			"Cannot set IP reassembly configuration\n",
+			"port_id=%u is not configured, cannot set IP reassembly configuration\n",
 			port_id);
 		return -EINVAL;
 	}
 
 	if (dev->data->dev_started != 0) {
 		RTE_ETHDEV_LOG(ERR,
-			"Device with port_id=%u started,\n"
-			"cannot configure IP reassembly params.\n",
+			"port_id=%u is started, cannot configure IP reassembly params.\n",
 			port_id);
 		return -EINVAL;
 	}
Signature · 1 line
2.43.0
#114 lore raw

PATCH v5 9/13 lib: add more logging helpers

In reply to David Marchand

Add helpers for logging messages in libraries instead of calling RTE_LOG() directly.
Those helpers take care of adding a \n: this will make the transition to RTE_LOG_LINE trivial.

Note:
- for acl and sched libraries that still has some debug multilines messages, a direct call to RTE_LOG is used: this will make it easier to notice such special cases,

---
Changes since v4:
- switched gears and only introduced new logging helpers in this patch, the conversion to RTE_LOG_LINE is moved to the last patch of the series,

Changes since v3:
- fixed some checkpatch complaints,

---
 lib/acl/acl_bld.c                       |  28 +--
 lib/acl/acl_gen.c                       |   8 +-
 lib/acl/acl_log.h                       |   2 +
 lib/acl/rte_acl.c                       |   8 +-
 lib/acl/tb_mem.c                        |   2 +-
 lib/eal/common/eal_common_bus.c         |  22 +-
 lib/eal/common/eal_common_class.c       |   6 +-
 lib/eal/common/eal_common_config.c      |   2 +-
 lib/eal/common/eal_common_debug.c       |   8 +-
 lib/eal/common/eal_common_dev.c         |  80 +++----
 lib/eal/common/eal_common_devargs.c     |  18 +-
 lib/eal/common/eal_common_dynmem.c      |  34 +--
 lib/eal/common/eal_common_fbarray.c     |  12 +-
 lib/eal/common/eal_common_interrupts.c  |  39 ++--
 lib/eal/common/eal_common_lcore.c       |  26 +--
 lib/eal/common/eal_common_memalloc.c    |  12 +-
 lib/eal/common/eal_common_memory.c      |  66 +++---
 lib/eal/common/eal_common_memzone.c     |  24 +--
 lib/eal/common/eal_common_options.c     | 236 ++++++++++----------
 lib/eal/common/eal_common_proc.c        | 112 +++++-----
 lib/eal/common/eal_common_tailqs.c      |  12 +-
 lib/eal/common/eal_common_thread.c      |  12 +-
 lib/eal/common/eal_common_timer.c       |   6 +-
 lib/eal/common/eal_common_trace_utils.c |   3 +-
 lib/eal/common/eal_private.h            |   4 +
 lib/eal/common/eal_trace.h              |   4 +-
 lib/eal/common/hotplug_mp.c             |  54 ++---
 lib/eal/common/malloc_elem.c            |   6 +-
 lib/eal/common/malloc_heap.c            |  40 ++--
 lib/eal/common/malloc_mp.c              |  72 +++----
 lib/eal/common/rte_keepalive.c          |   4 +-
 lib/eal/common/rte_malloc.c             |  10 +-
 lib/eal/common/rte_service.c            |   8 +-
 lib/eal/freebsd/eal.c                   |  75 +++----
 lib/eal/freebsd/eal_alarm.c             |   2 +-
 lib/eal/freebsd/eal_dev.c               |  10 +-
 lib/eal/freebsd/eal_hugepage_info.c     |  22 +-
 lib/eal/freebsd/eal_interrupts.c        |  60 +++---
 lib/eal/freebsd/eal_lcore.c             |   2 +-
 lib/eal/freebsd/eal_memalloc.c          |  11 +-
 lib/eal/freebsd/eal_memory.c            |  34 +--
 lib/eal/freebsd/eal_thread.c            |   2 +-
 lib/eal/freebsd/eal_timer.c             |  10 +-
 lib/eal/linux/eal.c                     | 122 +++++------
 lib/eal/linux/eal_alarm.c               |   2 +-
 lib/eal/linux/eal_dev.c                 |  40 ++--
 lib/eal/linux/eal_hugepage_info.c       |  38 ++--
 lib/eal/linux/eal_interrupts.c          | 116 +++++-----
 lib/eal/linux/eal_lcore.c               |   4 +-
 lib/eal/linux/eal_memalloc.c            | 120 +++++------
 lib/eal/linux/eal_memory.c              | 208 +++++++++---------
 lib/eal/linux/eal_thread.c              |   6 +-
 lib/eal/linux/eal_timer.c               |  10 +-
 lib/eal/linux/eal_vfio.c                | 270 +++++++++++------------
 lib/eal/linux/eal_vfio_mp_sync.c        |   5 +-
 lib/eal/riscv/rte_cycles.c              |   4 +-
 lib/eal/unix/eal_filesystem.c           |  14 +-
 lib/eal/unix/eal_firmware.c             |   3 +-
 lib/eal/unix/eal_unix_memory.c          |   8 +-
 lib/eal/unix/rte_thread.c               |  36 ++--
 lib/eal/windows/eal.c                   |  36 ++--
 lib/eal/windows/eal_alarm.c             |  13 +-
 lib/eal/windows/eal_debug.c             |  10 +-
 lib/eal/windows/eal_dev.c               |  10 +-
 lib/eal/windows/eal_hugepages.c         |  10 +-
 lib/eal/windows/eal_interrupts.c        |  10 +-
 lib/eal/windows/eal_lcore.c             |   7 +-
 lib/eal/windows/eal_memalloc.c          |  50 ++---
 lib/eal/windows/eal_memory.c            |  20 +-
 lib/eal/windows/eal_windows.h           |   6 +-
 lib/eal/windows/rte_thread.c            |  29 +--
 lib/efd/rte_efd.c                       |  60 +++---
 lib/fib/fib_log.h                       |   4 +-
 lib/fib/rte_fib.c                       |  14 +-
 lib/fib/rte_fib6.c                      |  14 +-
 lib/hash/rte_cuckoo_hash.c              |  54 ++---
 lib/hash/rte_fbk_hash.c                 |   6 +-
 lib/hash/rte_hash_crc.c                 |  14 +-
 lib/hash/rte_thash.c                    |  22 +-
 lib/hash/rte_thash_gfni.c               |  10 +-
 lib/ip_frag/ip_frag_common.h            |   3 +
 lib/ip_frag/rte_ip_frag_common.c        |   8 +-
 lib/latencystats/rte_latencystats.c     |  43 ++--
 lib/lpm/lpm_log.h                       |   2 +
 lib/lpm/rte_lpm.c                       |  12 +-
 lib/lpm/rte_lpm6.c                      |  10 +-
 lib/mbuf/mbuf_log.h                     |   2 +
 lib/mbuf/rte_mbuf.c                     |  14 +-
 lib/mbuf/rte_mbuf_dyn.c                 |  14 +-
 lib/mbuf/rte_mbuf_pool_ops.c            |   4 +-
 lib/mempool/rte_mempool.c               |  24 +--
 lib/mempool/rte_mempool.h               |   4 +-
 lib/mempool/rte_mempool_ops.c           |  10 +-
 lib/pipeline/rte_pipeline.c             | 231 ++++++++++----------
 lib/port/port_log.h                     |   9 +
 lib/port/rte_port_ethdev.c              |  20 +-
 lib/port/rte_port_eventdev.c            |  20 +-
 lib/port/rte_port_fd.c                  |  26 +--
 lib/port/rte_port_frag.c                |  16 +-
 lib/port/rte_port_ras.c                 |  14 +-
 lib/port/rte_port_ring.c                |  20 +-
 lib/port/rte_port_sched.c               |  14 +-
 lib/port/rte_port_source_sink.c         |  50 ++---
 lib/port/rte_port_sym_crypto.c          |  20 +-
 lib/power/guest_channel.c               |  40 ++--
 lib/power/power_acpi_cpufreq.c          | 106 ++++-----
 lib/power/power_amd_pstate_cpufreq.c    | 120 +++++------
 lib/power/power_common.c                |  10 +-
 lib/power/power_common.h                |   4 +-
 lib/power/power_cppc_cpufreq.c          | 118 +++++-----
 lib/power/power_intel_uncore.c          |  68 +++---
 lib/power/power_kvm_vm.c                |  22 +-
 lib/power/power_pstate_cpufreq.c        | 144 ++++++-------
 lib/power/rte_power.c                   |  22 +-
 lib/power/rte_power_pmd_mgmt.c          |  34 +--
 lib/power/rte_power_uncore.c            |  14 +-
 lib/rcu/rte_rcu_qsbr.c                  |  62 ++----
 lib/rcu/rte_rcu_qsbr.h                  |   1 +
 lib/reorder/rte_reorder.c               |  34 +--
 lib/rib/rib_log.h                       |   6 +-
 lib/rib/rte_rib.c                       |  13 +-
 lib/rib/rte_rib6.c                      |  10 +-
 lib/ring/rte_ring.c                     |  26 +--
 lib/sched/rte_pie.c                     |  18 +-
 lib/sched/rte_sched.c                   | 274 ++++++++++++------------
 lib/sched/rte_sched_log.h               |   2 +
 lib/table/rte_table_acl.c               |  74 +++----
 lib/table/rte_table_array.c             |  18 +-
 lib/table/rte_table_hash_cuckoo.c       |  24 ++-
 lib/table/rte_table_hash_ext.c          |  24 ++-
 lib/table/rte_table_hash_key16.c        |  40 ++--
 lib/table/rte_table_hash_key32.c        |  40 ++--
 lib/table/rte_table_hash_key8.c         |  40 ++--
 lib/table/rte_table_hash_lru.c          |  24 ++-
 lib/table/rte_table_lpm.c               |  44 ++--
 lib/table/rte_table_lpm_ipv6.c          |  46 ++--
 lib/table/rte_table_stub.c              |   6 +-
 lib/table/table_log.h                   |   9 +
 lib/vhost/fd_man.c                      |  10 +-
 139 files changed, 2435 insertions(+), 2315 deletions(-)
 create mode 100644 lib/port/port_log.h
 create mode 100644 lib/table/table_log.h
lib/acl/acl_bld.c +14 -14
index eaf8770415..56e3b31ed6 100644
@@ -1017,8 +1017,8 @@ build_trie(struct acl_build_context *context, struct rte_acl_build_rule *head,
 				break;
 
 			default:
-				RTE_LOG(ERR, ACL,
-					"Error in rule[%u] type - %hhu\n",
+				ACL_LOG(ERR,
+					"Error in rule[%u] type - %hhu",
 					rule->f->data.userdata,
 					rule->config->defs[n].type);
 				return NULL;
@@ -1374,7 +1374,7 @@ acl_build_tries(struct acl_build_context *context,
 
 		last = build_one_trie(context, rule_sets, n, context->node_max);
 		if (context->bld_tries[n].trie == NULL) {
-			RTE_LOG(ERR, ACL, "Build of %u-th trie failed\n", n);
+			ACL_LOG(ERR, "Build of %u-th trie failed", n);
 			return -ENOMEM;
 		}
 
@@ -1383,8 +1383,8 @@ acl_build_tries(struct acl_build_context *context,
 			break;
 
 		if (num_tries == RTE_DIM(context->tries)) {
-			RTE_LOG(ERR, ACL,
-				"Exceeded max number of tries: %u\n",
+			ACL_LOG(ERR,
+				"Exceeded max number of tries: %u",
 				num_tries);
 			return -ENOMEM;
 		}
@@ -1409,7 +1409,7 @@ acl_build_tries(struct acl_build_context *context,
 		 */
 		last = build_one_trie(context, rule_sets, n, INT32_MAX);
 		if (context->bld_tries[n].trie == NULL || last != NULL) {
-			RTE_LOG(ERR, ACL, "Build of %u-th trie failed\n", n);
+			ACL_LOG(ERR, "Build of %u-th trie failed", n);
 			return -ENOMEM;
 		}
 
@@ -1435,8 +1435,8 @@ acl_build_log(const struct acl_build_context *ctx)
 
 	for (n = 0; n < RTE_DIM(ctx->tries); n++) {
 		if (ctx->tries[n].count != 0)
-			RTE_LOG(DEBUG, ACL,
-				"trie %u: number of rules: %u, indexes: %u\n",
+			ACL_LOG(DEBUG,
+				"trie %u: number of rules: %u, indexes: %u",
 				n, ctx->tries[n].count,
 				ctx->tries[n].num_data_indexes);
 	}
@@ -1526,8 +1526,8 @@ acl_bld(struct acl_build_context *bcx, struct rte_acl_ctx *ctx,
 
 	/* build phase runs out of memory. */
 	if (rc != 0) {
-		RTE_LOG(ERR, ACL,
-			"ACL context: %s, %s() failed with error code: %d\n",
+		ACL_LOG(ERR,
+			"ACL context: %s, %s() failed with error code: %d",
 			bcx->acx->name, __func__, rc);
 		return rc;
 	}
@@ -1568,8 +1568,8 @@ acl_check_bld_param(struct rte_acl_ctx *ctx, const struct rte_acl_config *cfg)
 
 	for (i = 0; i != cfg->num_fields; i++) {
 		if (cfg->defs[i].type > RTE_ACL_FIELD_TYPE_BITMASK) {
-			RTE_LOG(ERR, ACL,
-			"ACL context: %s, invalid type: %hhu for %u-th field\n",
+			ACL_LOG(ERR,
+			"ACL context: %s, invalid type: %hhu for %u-th field",
 			ctx->name, cfg->defs[i].type, i);
 			return -EINVAL;
 		}
@@ -1580,8 +1580,8 @@ acl_check_bld_param(struct rte_acl_ctx *ctx, const struct rte_acl_config *cfg)
 			;
 
 		if (j == RTE_DIM(field_sizes)) {
-			RTE_LOG(ERR, ACL,
-			"ACL context: %s, invalid size: %hhu for %u-th field\n",
+			ACL_LOG(ERR,
+			"ACL context: %s, invalid size: %hhu for %u-th field",
 			ctx->name, cfg->defs[i].size, i);
 			return -EINVAL;
 		}
lib/acl/acl_gen.c +4 -4
index 03a47ea231..3c53d24056 100644
@@ -471,9 +471,9 @@ rte_acl_gen(struct rte_acl_ctx *ctx, struct rte_acl_trie *trie,
 		XMM_SIZE;
 
 	if (total_size > max_size) {
-		RTE_LOG(DEBUG, ACL,
+		ACL_LOG(DEBUG,
 			"Gen phase for ACL ctx \"%s\" exceeds max_size limit, "
-			"bytes required: %zu, allowed: %zu\n",
+			"bytes required: %zu, allowed: %zu",
 			ctx->name, total_size, max_size);
 		return -ERANGE;
 	}
@@ -481,8 +481,8 @@ rte_acl_gen(struct rte_acl_ctx *ctx, struct rte_acl_trie *trie,
 	mem = rte_zmalloc_socket(ctx->name, total_size, RTE_CACHE_LINE_SIZE,
 			ctx->socket_id);
 	if (mem == NULL) {
-		RTE_LOG(ERR, ACL,
-			"allocation of %zu bytes on socket %d for %s failed\n",
+		ACL_LOG(ERR,
+			"allocation of %zu bytes on socket %d for %s failed",
 			total_size, ctx->socket_id, ctx->name);
 		return -ENOMEM;
 	}
lib/acl/acl_log.h +2 -0
index 6147116d8d..2d7c376058 100644
@@ -4,3 +4,5 @@
 
 extern int acl_logtype;
 #define RTE_LOGTYPE_ACL	acl_logtype
+#define ACL_LOG(level, fmt, ...) \
+	RTE_LOG(level, ACL, fmt "\n", ## __VA_ARGS__)
lib/acl/rte_acl.c +4 -4
index 760c3587d4..245b9b6d7a 100644
@@ -399,15 +399,15 @@ rte_acl_create(const struct rte_acl_param *param)
 		te = rte_zmalloc("ACL_TAILQ_ENTRY", sizeof(*te), 0);
 
 		if (te == NULL) {
-			RTE_LOG(ERR, ACL, "Cannot allocate tailq entry!\n");
+			ACL_LOG(ERR, "Cannot allocate tailq entry!");
 			goto exit;
 		}
 
 		ctx = rte_zmalloc_socket(name, sz, RTE_CACHE_LINE_SIZE, param->socket_id);
 
 		if (ctx == NULL) {
-			RTE_LOG(ERR, ACL,
-				"allocation of %zu bytes on socket %d for %s failed\n",
+			ACL_LOG(ERR,
+				"allocation of %zu bytes on socket %d for %s failed",
 				sz, param->socket_id, name);
 			rte_free(te);
 			goto exit;
@@ -473,7 +473,7 @@ rte_acl_add_rules(struct rte_acl_ctx *ctx, const struct rte_acl_rule *rules,
 			((uintptr_t)rules + i * ctx->rule_sz);
 		rc = acl_check_rule(&rv->data);
 		if (rc != 0) {
-			RTE_LOG(ERR, ACL, "%s(%s): rule #%u is invalid\n",
+			ACL_LOG(ERR, "%s(%s): rule #%u is invalid",
 				__func__, ctx->name, i + 1);
 			return rc;
 		}
lib/acl/tb_mem.c +1 -1
index 4ee65b23da..9264433422 100644
@@ -26,7 +26,7 @@ tb_pool(struct tb_mem_pool *pool, size_t sz)
 	size = sz + pool->alignment - 1;
 	block = calloc(1, size + sizeof(*pool->block));
 	if (block == NULL) {
-		RTE_LOG(ERR, ACL, "%s(%zu) failed, currently allocated by pool: %zu bytes\n",
+		ACL_LOG(ERR, "%s(%zu) failed, currently allocated by pool: %zu bytes",
 			__func__, sz, pool->alloc);
 		siglongjmp(pool->fail, -ENOMEM);
 		return NULL;
lib/eal/common/eal_common_bus.c +11 -11
index acac14131a..7cbd09c421 100644
@@ -35,14 +35,14 @@ rte_bus_register(struct rte_bus *bus)
 	RTE_VERIFY(!bus->plug || bus->unplug);
 
 	TAILQ_INSERT_TAIL(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", rte_bus_name(bus));
+	EAL_LOG(DEBUG, "Registered [%s] bus.", rte_bus_name(bus));
 }
 
 void
 rte_bus_unregister(struct rte_bus *bus)
 {
 	TAILQ_REMOVE(&rte_bus_list, bus, next);
-	RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", rte_bus_name(bus));
+	EAL_LOG(DEBUG, "Unregistered [%s] bus.", rte_bus_name(bus));
 }
 
 /* Scan all the buses for registered devices */
@@ -55,7 +55,7 @@ rte_bus_scan(void)
 	TAILQ_FOREACH(bus, &rte_bus_list, next) {
 		ret = bus->scan();
 		if (ret)
-			RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n",
+			EAL_LOG(ERR, "Scan for (%s) bus failed.",
 				rte_bus_name(bus));
 	}
 
@@ -77,14 +77,14 @@ rte_bus_probe(void)
 
 		ret = bus->probe();
 		if (ret)
-			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
+			EAL_LOG(ERR, "Bus (%s) probe failed.",
 				rte_bus_name(bus));
 	}
 
 	if (vbus) {
 		ret = vbus->probe();
 		if (ret)
-			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
+			EAL_LOG(ERR, "Bus (%s) probe failed.",
 				rte_bus_name(vbus));
 	}
 
@@ -133,7 +133,7 @@ rte_bus_dump(FILE *f)
 	TAILQ_FOREACH(bus, &rte_bus_list, next) {
 		ret = bus_dump_one(f, bus);
 		if (ret) {
-			RTE_LOG(ERR, EAL, "Unable to write to stream (%d)\n",
+			EAL_LOG(ERR, "Unable to write to stream (%d)",
 				ret);
 			break;
 		}
@@ -235,15 +235,15 @@ rte_bus_get_iommu_class(void)
 			continue;
 
 		bus_iova_mode = bus->get_iommu_class();
-		RTE_LOG(DEBUG, EAL, "Bus %s wants IOVA as '%s'\n",
+		EAL_LOG(DEBUG, "Bus %s wants IOVA as '%s'",
 			rte_bus_name(bus),
 			bus_iova_mode == RTE_IOVA_DC ? "DC" :
 			(bus_iova_mode == RTE_IOVA_PA ? "PA" : "VA"));
 		if (bus_iova_mode == RTE_IOVA_PA) {
 			buses_want_pa = true;
 			if (!RTE_IOVA_IN_MBUF)
-				RTE_LOG(WARNING, EAL,
-					"Bus %s wants IOVA as PA not compatible with 'enable_iova_as_pa=false' build option.\n",
+				EAL_LOG(WARNING,
+					"Bus %s wants IOVA as PA not compatible with 'enable_iova_as_pa=false' build option.",
 					rte_bus_name(bus));
 		} else if (bus_iova_mode == RTE_IOVA_VA)
 			buses_want_va = true;
@@ -255,8 +255,8 @@ rte_bus_get_iommu_class(void)
 	} else {
 		mode = RTE_IOVA_DC;
 		if (buses_want_va) {
-			RTE_LOG(WARNING, EAL, "Some buses want 'VA' but forcing 'DC' because other buses want 'PA'.\n");
-			RTE_LOG(WARNING, EAL, "Depending on the final decision by the EAL, not all buses may be able to initialize.\n");
+			EAL_LOG(WARNING, "Some buses want 'VA' but forcing 'DC' because other buses want 'PA'.");
+			EAL_LOG(WARNING, "Depending on the final decision by the EAL, not all buses may be able to initialize.");
 		}
 	}
 
lib/eal/common/eal_common_class.c +4 -2
index 0187076af1..4938ec6707 100644
@@ -9,6 +9,8 @@
 #include <rte_class.h>
 #include <rte_debug.h>
 
+#include "eal_private.h"
+
 static struct rte_class_list rte_class_list =
 	TAILQ_HEAD_INITIALIZER(rte_class_list);
 
@@ -19,14 +21,14 @@ rte_class_register(struct rte_class *class)
 	RTE_VERIFY(class->name && strlen(class->name));
 
 	TAILQ_INSERT_TAIL(&rte_class_list, class, next);
-	RTE_LOG(DEBUG, EAL, "Registered [%s] device class.\n", class->name);
+	EAL_LOG(DEBUG, "Registered [%s] device class.", class->name);
 }
 
 void
 rte_class_unregister(struct rte_class *class)
 {
 	TAILQ_REMOVE(&rte_class_list, class, next);
-	RTE_LOG(DEBUG, EAL, "Unregistered [%s] device class.\n", class->name);
+	EAL_LOG(DEBUG, "Unregistered [%s] device class.", class->name);
 }
 
 struct rte_class *
lib/eal/common/eal_common_config.c +1 -1
index 0daf0f3188..a72d46f602 100644
@@ -31,7 +31,7 @@ int
 eal_set_runtime_dir(const char *run_dir)
 {
 	if (strlcpy(runtime_dir, run_dir, PATH_MAX) >= PATH_MAX) {
-		RTE_LOG(ERR, EAL, "Runtime directory string too long\n");
+		EAL_LOG(ERR, "Runtime directory string too long");
 		return -1;
 	}
 
lib/eal/common/eal_common_debug.c +5 -3
index 9cac9c6390..3e77995896 100644
@@ -11,12 +11,14 @@
 #include <rte_debug.h>
 #include <rte_errno.h>
 
+#include "eal_private.h"
+
 void
 __rte_panic(const char *funcname, const char *format, ...)
 {
 	va_list ap;
 
-	rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n", funcname);
+	EAL_LOG(CRIT, "PANIC in %s():", funcname);
 	va_start(ap, format);
 	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
 	va_end(ap);
@@ -42,7 +44,7 @@ rte_exit(int exit_code, const char *format, ...)
 	va_end(ap);
 
 	if (rte_eal_cleanup() != 0 && rte_errno != EALREADY)
-		RTE_LOG(CRIT, EAL,
-			"EAL could not release all resources\n");
+		EAL_LOG(CRIT,
+			"EAL could not release all resources");
 	exit(exit_code);
 }
lib/eal/common/eal_common_dev.c +40 -40

226 lines not on this page · raw message

lib/eal/common/eal_common_devargs.c +9 -9
index fb5d0a293b..a64805b268 100644
@@ -39,12 +39,12 @@ devargs_bus_parse_default(struct rte_devargs *devargs,
 	/* Parse devargs name from bus key-value list. */
 	name = rte_kvargs_get(bus_args, "name");
 	if (name == NULL) {
-		RTE_LOG(DEBUG, EAL, "devargs name not found: %s\n",
+		EAL_LOG(DEBUG, "devargs name not found: %s",
 			devargs->data);
 		return 0;
 	}
 	if (rte_strscpy(devargs->name, name, sizeof(devargs->name)) < 0) {
-		RTE_LOG(ERR, EAL, "devargs name too long: %s\n",
+		EAL_LOG(ERR, "devargs name too long: %s",
 			devargs->data);
 		return -E2BIG;
 	}
@@ -79,7 +79,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
 	if (devargs->data != devstr) {
 		devargs->data = strdup(devstr);
 		if (devargs->data == NULL) {
-			RTE_LOG(ERR, EAL, "OOM\n");
+			EAL_LOG(ERR, "OOM");
 			ret = -ENOMEM;
 			goto get_out;
 		}
@@ -133,7 +133,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
 			devargs->bus_str = layers[i].str;
 			devargs->bus = rte_bus_find_by_name(kv->value);
 			if (devargs->bus == NULL) {
-				RTE_LOG(ERR, EAL, "Could not find bus \"%s\"\n",
+				EAL_LOG(ERR, "Could not find bus \"%s\"",
 					kv->value);
 				ret = -EFAULT;
 				goto get_out;
@@ -142,7 +142,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
 			devargs->cls_str = layers[i].str;
 			devargs->cls = rte_class_find_by_name(kv->value);
 			if (devargs->cls == NULL) {
-				RTE_LOG(ERR, EAL, "Could not find class \"%s\"\n",
+				EAL_LOG(ERR, "Could not find class \"%s\"",
 					kv->value);
 				ret = -EFAULT;
 				goto get_out;
@@ -217,7 +217,7 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev)
 		da->name[i] = devname[i];
 		i++;
 		if (i == maxlen) {
-			RTE_LOG(WARNING, EAL, "Parsing \"%s\": device name should be shorter than %zu\n",
+			EAL_LOG(WARNING, "Parsing \"%s\": device name should be shorter than %zu",
 				dev, maxlen);
 			da->name[i - 1] = '\0';
 			return -EINVAL;
@@ -227,7 +227,7 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev)
 	if (bus == NULL) {
 		bus = rte_bus_find_by_device_name(da->name);
 		if (bus == NULL) {
-			RTE_LOG(ERR, EAL, "failed to parse device \"%s\"\n",
+			EAL_LOG(ERR, "failed to parse device \"%s\"",
 				da->name);
 			return -EFAULT;
 		}
@@ -239,7 +239,7 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev)
 	else
 		da->data = strdup("");
 	if (da->data == NULL) {
-		RTE_LOG(ERR, EAL, "not enough memory to parse arguments\n");
+		EAL_LOG(ERR, "not enough memory to parse arguments");
 		return -ENOMEM;
 	}
 	da->drv_str = da->data;
@@ -266,7 +266,7 @@ rte_devargs_parsef(struct rte_devargs *da, const char *format, ...)
 	len += 1;
 	dev = calloc(1, (size_t)len);
 	if (dev == NULL) {
-		RTE_LOG(ERR, EAL, "not enough memory to parse device\n");
+		EAL_LOG(ERR, "not enough memory to parse device");
 		return -ENOMEM;
 	}
 
lib/eal/common/eal_common_dynmem.c +17 -17
index 95da55d9b0..b4dc231940 100644
@@ -76,7 +76,7 @@ eal_dynmem_memseg_lists_init(void)
 	n_memtypes = internal_conf->num_hugepage_sizes * rte_socket_count();
 	memtypes = calloc(n_memtypes, sizeof(*memtypes));
 	if (memtypes == NULL) {
-		RTE_LOG(ERR, EAL, "Cannot allocate space for memory types\n");
+		EAL_LOG(ERR, "Cannot allocate space for memory types");
 		return -1;
 	}
 
@@ -101,8 +101,8 @@ eal_dynmem_memseg_lists_init(void)
 			memtypes[cur_type].page_sz = hugepage_sz;
 			memtypes[cur_type].socket_id = socket_id;
 
-			RTE_LOG(DEBUG, EAL, "Detected memory type: "
-				"socket_id:%u hugepage_sz:%" PRIu64 "\n",
+			EAL_LOG(DEBUG, "Detected memory type: "
+				"socket_id:%u hugepage_sz:%" PRIu64,
 				socket_id, hugepage_sz);
 		}
 	}
@@ -120,7 +120,7 @@ eal_dynmem_memseg_lists_init(void)
 	max_seglists_per_type = RTE_MAX_MEMSEG_LISTS / n_memtypes;
 
 	if (max_seglists_per_type == 0) {
-		RTE_LOG(ERR, EAL, "Cannot accommodate all memory types, please increase RTE_MAX_MEMSEG_LISTS\n");
+		EAL_LOG(ERR, "Cannot accommodate all memory types, please increase RTE_MAX_MEMSEG_LISTS");
 		goto out;
 	}
 
@@ -171,15 +171,15 @@ eal_dynmem_memseg_lists_init(void)
 		/* limit number of segment lists according to our maximum */
 		n_seglists = RTE_MIN(n_seglists, max_seglists_per_type);
 
-		RTE_LOG(DEBUG, EAL, "Creating %i segment lists: "
-				"n_segs:%i socket_id:%i hugepage_sz:%" PRIu64 "\n",
+		EAL_LOG(DEBUG, "Creating %i segment lists: "
+				"n_segs:%i socket_id:%i hugepage_sz:%" PRIu64,
 			n_seglists, n_segs, socket_id, pagesz);
 
 		/* create all segment lists */
 		for (cur_seglist = 0; cur_seglist < n_seglists; cur_seglist++) {
 			if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
-				RTE_LOG(ERR, EAL,
-					"No more space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS\n");
+				EAL_LOG(ERR,
+					"No more space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS");
 				goto out;
 			}
 			msl = &mcfg->memsegs[msl_idx++];
@@ -189,7 +189,7 @@ eal_dynmem_memseg_lists_init(void)
 				goto out;
 
 			if (eal_memseg_list_alloc(msl, 0)) {
-				RTE_LOG(ERR, EAL, "Cannot allocate VA space for memseg list\n");
+				EAL_LOG(ERR, "Cannot allocate VA space for memseg list");
 				goto out;
 			}
 		}
@@ -287,9 +287,9 @@ eal_dynmem_hugepage_init(void)
 			if (num_pages == 0)
 				continue;
 
-			RTE_LOG(DEBUG, EAL,
+			EAL_LOG(DEBUG,
 				"Allocating %u pages of size %" PRIu64 "M "
-				"on socket %i\n",
+				"on socket %i",
 				num_pages, hpi->hugepage_sz >> 20, socket_id);
 
 			/* we may not be able to allocate all pages in one go,
@@ -307,7 +307,7 @@ eal_dynmem_hugepage_init(void)
 
 				pages = malloc(sizeof(*pages) * needed);
 				if (pages == NULL) {
-					RTE_LOG(ERR, EAL, "Failed to malloc pages\n");
+					EAL_LOG(ERR, "Failed to malloc pages");
 					return -1;
 				}
 
@@ -342,7 +342,7 @@ eal_dynmem_hugepage_init(void)
 				continue;
 			if (rte_mem_alloc_validator_register("socket-limit",
 					limits_callback, i, limit))
-				RTE_LOG(ERR, EAL, "Failed to register socket limits validator callback\n");
+				EAL_LOG(ERR, "Failed to register socket limits validator callback");
 		}
 	}
 	return 0;
@@ -515,8 +515,8 @@ eal_dynmem_calc_num_pages_per_socket(
 				internal_conf->socket_mem[socket] / 0x100000);
 			available = requested -
 				((unsigned int)(memory[socket] / 0x100000));
-			RTE_LOG(ERR, EAL, "Not enough memory available on "
-				"socket %u! Requested: %uMB, available: %uMB\n",
+			EAL_LOG(ERR, "Not enough memory available on "
+				"socket %u! Requested: %uMB, available: %uMB",
 				socket, requested, available);
 			return -1;
 		}
@@ -526,8 +526,8 @@ eal_dynmem_calc_num_pages_per_socket(
 	if (total_mem > 0) {
 		requested = (unsigned int)(internal_conf->memory / 0x100000);
 		available = requested - (unsigned int)(total_mem / 0x100000);
-		RTE_LOG(ERR, EAL, "Not enough memory available! "
-			"Requested: %uMB, available: %uMB\n",
+		EAL_LOG(ERR, "Not enough memory available! "
+			"Requested: %uMB, available: %uMB",
 			requested, available);
 		return -1;
 	}
lib/eal/common/eal_common_fbarray.c +6 -6
index 2055bfa57d..0fe5bcfe06 100644
@@ -83,7 +83,7 @@ resize_and_map(int fd, const char *path, void *addr, size_t len)
 	void *map_addr;
 
 	if (eal_file_truncate(fd, len)) {
-		RTE_LOG(ERR, EAL, "Cannot truncate %s\n", path);
+		EAL_LOG(ERR, "Cannot truncate %s", path);
 		return -1;
 	}
 
@@ -755,7 +755,7 @@ rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,
 		void *new_data = rte_mem_map(data, mmap_len,
 			RTE_PROT_READ | RTE_PROT_WRITE, flags, fd, 0);
 		if (new_data == NULL) {
-			RTE_LOG(DEBUG, EAL, "%s(): couldn't remap anonymous memory: %s\n",
+			EAL_LOG(DEBUG, "%s(): couldn't remap anonymous memory: %s",
 					__func__, rte_strerror(rte_errno));
 			goto fail;
 		}
@@ -770,12 +770,12 @@ rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,
 		 */
 		fd = eal_file_open(path, EAL_OPEN_CREATE | EAL_OPEN_READWRITE);
 		if (fd < 0) {
-			RTE_LOG(DEBUG, EAL, "%s(): couldn't open %s: %s\n",
+			EAL_LOG(DEBUG, "%s(): couldn't open %s: %s",
 				__func__, path, rte_strerror(rte_errno));
 			goto fail;
 		} else if (eal_file_lock(
 				fd, EAL_FLOCK_EXCLUSIVE, EAL_FLOCK_RETURN)) {
-			RTE_LOG(DEBUG, EAL, "%s(): couldn't lock %s: %s\n",
+			EAL_LOG(DEBUG, "%s(): couldn't lock %s: %s",
 				__func__, path, rte_strerror(rte_errno));
 			rte_errno = EBUSY;
 			goto fail;
@@ -1017,7 +1017,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)
 		 */
 		fd = tmp->fd;
 		if (eal_file_lock(fd, EAL_FLOCK_EXCLUSIVE, EAL_FLOCK_RETURN)) {
-			RTE_LOG(DEBUG, EAL, "Cannot destroy fbarray - another process is using it\n");
+			EAL_LOG(DEBUG, "Cannot destroy fbarray - another process is using it");
 			rte_errno = EBUSY;
 			ret = -1;
 			goto out;
@@ -1026,7 +1026,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)
 		/* we're OK to destroy the file */
 		eal_get_fbarray_path(path, sizeof(path), arr->name);
 		if (unlink(path)) {
-			RTE_LOG(DEBUG, EAL, "Cannot unlink fbarray: %s\n",
+			EAL_LOG(DEBUG, "Cannot unlink fbarray: %s",
 				strerror(errno));
 			rte_errno = errno;
 			/*
lib/eal/common/eal_common_interrupts.c +20 -19
index 97b64fed58..b4d7b18fae 100644
@@ -11,11 +11,12 @@
 #include <rte_malloc.h>
 
 #include "eal_interrupts.h"
+#include "eal_private.h"
 
 /* Macros to check for valid interrupt handle */
 #define CHECK_VALID_INTR_HANDLE(intr_handle) do { \
 	if (intr_handle == NULL) { \
-		RTE_LOG(DEBUG, EAL, "Interrupt instance unallocated\n"); \
+		EAL_LOG(DEBUG, "Interrupt instance unallocated"); \
 		rte_errno = EINVAL; \
 		goto fail; \
 	} \
@@ -37,7 +38,7 @@ struct rte_intr_handle *rte_intr_instance_alloc(uint32_t flags)
 	 * defined flags.
 	 */
 	if ((flags & ~RTE_INTR_INSTANCE_KNOWN_FLAGS) != 0) {
-		RTE_LOG(DEBUG, EAL, "Invalid alloc flag passed 0x%x\n", flags);
+		EAL_LOG(DEBUG, "Invalid alloc flag passed 0x%x", flags);
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -48,7 +49,7 @@ struct rte_intr_handle *rte_intr_instance_alloc(uint32_t flags)
 	else
 		intr_handle = calloc(1, sizeof(*intr_handle));
 	if (intr_handle == NULL) {
-		RTE_LOG(ERR, EAL, "Failed to allocate intr_handle\n");
+		EAL_LOG(ERR, "Failed to allocate intr_handle");
 		rte_errno = ENOMEM;
 		return NULL;
 	}
@@ -61,7 +62,7 @@ struct rte_intr_handle *rte_intr_instance_alloc(uint32_t flags)
 			sizeof(int));
 	}
 	if (intr_handle->efds == NULL) {
-		RTE_LOG(ERR, EAL, "Fail to allocate event fd list\n");
+		EAL_LOG(ERR, "Fail to allocate event fd list");
 		rte_errno = ENOMEM;
 		goto fail;
 	}
@@ -75,7 +76,7 @@ struct rte_intr_handle *rte_intr_instance_alloc(uint32_t flags)
 			sizeof(struct rte_epoll_event));
 	}
 	if (intr_handle->elist == NULL) {
-		RTE_LOG(ERR, EAL, "fail to allocate event fd list\n");
+		EAL_LOG(ERR, "fail to allocate event fd list");
 		rte_errno = ENOMEM;
 		goto fail;
 	}
@@ -100,7 +101,7 @@ struct rte_intr_handle *rte_intr_instance_dup(const struct rte_intr_handle *src)
 	struct rte_intr_handle *intr_handle;
 
 	if (src == NULL) {
-		RTE_LOG(DEBUG, EAL, "Source interrupt instance unallocated\n");
+		EAL_LOG(DEBUG, "Source interrupt instance unallocated");
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -129,7 +130,7 @@ int rte_intr_event_list_update(struct rte_intr_handle *intr_handle, int size)
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (size == 0) {
-		RTE_LOG(DEBUG, EAL, "Size can't be zero\n");
+		EAL_LOG(DEBUG, "Size can't be zero");
 		rte_errno = EINVAL;
 		goto fail;
 	}
@@ -143,7 +144,7 @@ int rte_intr_event_list_update(struct rte_intr_handle *intr_handle, int size)
 		tmp_efds = realloc(intr_handle->efds, size * sizeof(int));
 	}
 	if (tmp_efds == NULL) {
-		RTE_LOG(ERR, EAL, "Failed to realloc the efds list\n");
+		EAL_LOG(ERR, "Failed to realloc the efds list");
 		rte_errno = ENOMEM;
 		goto fail;
 	}
@@ -157,7 +158,7 @@ int rte_intr_event_list_update(struct rte_intr_handle *intr_handle, int size)
 			size * sizeof(struct rte_epoll_event));
 	}
 	if (tmp_elist == NULL) {
-		RTE_LOG(ERR, EAL, "Failed to realloc the event list\n");
+		EAL_LOG(ERR, "Failed to realloc the event list");
 		rte_errno = ENOMEM;
 		goto fail;
 	}
@@ -253,8 +254,8 @@ int rte_intr_max_intr_set(struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (max_intr > intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Maximum interrupt vector ID (%d) exceeds "
-			"the number of available events (%d)\n", max_intr,
+		EAL_LOG(DEBUG, "Maximum interrupt vector ID (%d) exceeds "
+			"the number of available events (%d)", max_intr,
 			intr_handle->nb_intr);
 		rte_errno = ERANGE;
 		goto fail;
@@ -332,7 +333,7 @@ int rte_intr_efds_index_get(const struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Invalid index %d, max limit %d\n", index,
+		EAL_LOG(DEBUG, "Invalid index %d, max limit %d", index,
 			intr_handle->nb_intr);
 		rte_errno = EINVAL;
 		goto fail;
@@ -349,7 +350,7 @@ int rte_intr_efds_index_set(struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Invalid index %d, max limit %d\n", index,
+		EAL_LOG(DEBUG, "Invalid index %d, max limit %d", index,
 			intr_handle->nb_intr);
 		rte_errno = ERANGE;
 		goto fail;
@@ -368,7 +369,7 @@ struct rte_epoll_event *rte_intr_elist_index_get(
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Invalid index %d, max limit %d\n", index,
+		EAL_LOG(DEBUG, "Invalid index %d, max limit %d", index,
 			intr_handle->nb_intr);
 		rte_errno = ERANGE;
 		goto fail;
@@ -385,7 +386,7 @@ int rte_intr_elist_index_set(struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Invalid index %d, max limit %d\n", index,
+		EAL_LOG(DEBUG, "Invalid index %d, max limit %d", index,
 			intr_handle->nb_intr);
 		rte_errno = ERANGE;
 		goto fail;
@@ -408,7 +409,7 @@ int rte_intr_vec_list_alloc(struct rte_intr_handle *intr_handle,
 		return 0;
 
 	if (size > intr_handle->nb_intr) {
-		RTE_LOG(DEBUG, EAL, "Invalid size %d, max limit %d\n", size,
+		EAL_LOG(DEBUG, "Invalid size %d, max limit %d", size,
 			intr_handle->nb_intr);
 		rte_errno = ERANGE;
 		goto fail;
@@ -419,7 +420,7 @@ int rte_intr_vec_list_alloc(struct rte_intr_handle *intr_handle,
 	else
 		intr_handle->intr_vec = calloc(size, sizeof(int));
 	if (intr_handle->intr_vec == NULL) {
-		RTE_LOG(ERR, EAL, "Failed to allocate %d intr_vec\n", size);
+		EAL_LOG(ERR, "Failed to allocate %d intr_vec", size);
 		rte_errno = ENOMEM;
 		goto fail;
 	}
@@ -437,7 +438,7 @@ int rte_intr_vec_list_index_get(const struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->vec_list_size) {
-		RTE_LOG(DEBUG, EAL, "Index %d greater than vec list size %d\n",
+		EAL_LOG(DEBUG, "Index %d greater than vec list size %d",
 			index, intr_handle->vec_list_size);
 		rte_errno = ERANGE;
 		goto fail;
@@ -454,7 +455,7 @@ int rte_intr_vec_list_index_set(struct rte_intr_handle *intr_handle,
 	CHECK_VALID_INTR_HANDLE(intr_handle);
 
 	if (index >= intr_handle->vec_list_size) {
-		RTE_LOG(DEBUG, EAL, "Index %d greater than vec list size %d\n",
+		EAL_LOG(DEBUG, "Index %d greater than vec list size %d",
 			index, intr_handle->vec_list_size);
 		rte_errno = ERANGE;
 		goto fail;
lib/eal/common/eal_common_lcore.c +13 -13
index 6807a38247..2ff9252c52 100644
@@ -174,8 +174,8 @@ rte_eal_cpu_init(void)
 		lcore_config[lcore_id].core_role = ROLE_RTE;
 		lcore_config[lcore_id].core_id = eal_cpu_core_id(lcore_id);
 		lcore_config[lcore_id].socket_id = socket_id;
-		RTE_LOG(DEBUG, EAL, "Detected lcore %u as "
-				"core %u on socket %u\n",
+		EAL_LOG(DEBUG, "Detected lcore %u as "
+				"core %u on socket %u",
 				lcore_id, lcore_config[lcore_id].core_id,
 				lcore_config[lcore_id].socket_id);
 		count++;
@@ -183,17 +183,17 @@ rte_eal_cpu_init(void)
 	for (; lcore_id < CPU_SETSIZE; lcore_id++) {
 		if (eal_cpu_detected(lcore_id) == 0)
 			continue;
-		RTE_LOG(DEBUG, EAL, "Skipped lcore %u as core %u on socket %u\n",
+		EAL_LOG(DEBUG, "Skipped lcore %u as core %u on socket %u",
 			lcore_id, eal_cpu_core_id(lcore_id),
 			eal_cpu_socket_id(lcore_id));
 	}
 
 	/* Set the count of enabled logical cores of the EAL configuration */
 	config->lcore_count = count;
-	RTE_LOG(DEBUG, EAL,
-			"Maximum logical cores by configuration: %u\n",
+	EAL_LOG(DEBUG,
+			"Maximum logical cores by configuration: %u",
 			RTE_MAX_LCORE);
-	RTE_LOG(INFO, EAL, "Detected CPU lcores: %u\n", config->lcore_count);
+	EAL_LOG(INFO, "Detected CPU lcores: %u", config->lcore_count);
 
 	/* sort all socket id's in ascending order */
 	qsort(lcore_to_socket_id, RTE_DIM(lcore_to_socket_id),
@@ -208,7 +208,7 @@ rte_eal_cpu_init(void)
 					socket_id;
 		prev_socket_id = socket_id;
 	}
-	RTE_LOG(INFO, EAL, "Detected NUMA nodes: %u\n", config->numa_node_count);
+	EAL_LOG(INFO, "Detected NUMA nodes: %u", config->numa_node_count);
 
 	return 0;
 }
@@ -247,7 +247,7 @@ callback_init(struct lcore_callback *callback, unsigned int lcore_id)
 {
 	if (callback->init == NULL)
 		return 0;
-	RTE_LOG(DEBUG, EAL, "Call init for lcore callback %s, lcore_id %u\n",
+	EAL_LOG(DEBUG, "Call init for lcore callback %s, lcore_id %u",
 		callback->name, lcore_id);
 	return callback->init(lcore_id, callback->arg);
 }
@@ -257,7 +257,7 @@ callback_uninit(struct lcore_callback *callback, unsigned int lcore_id)
 {
 	if (callback->uninit == NULL)
 		return;
-	RTE_LOG(DEBUG, EAL, "Call uninit for lcore callback %s, lcore_id %u\n",
+	EAL_LOG(DEBUG, "Call uninit for lcore callback %s, lcore_id %u",
 		callback->name, lcore_id);
 	callback->uninit(lcore_id, callback->arg);
 }
@@ -311,7 +311,7 @@ rte_lcore_callback_register(const char *name, rte_lcore_init_cb init,
 	}
 no_init:
 	TAILQ_INSERT_TAIL(&lcore_callbacks, callback, next);
-	RTE_LOG(DEBUG, EAL, "Registered new lcore callback %s (%sinit, %suninit).\n",
+	EAL_LOG(DEBUG, "Registered new lcore callback %s (%sinit, %suninit).",
 		callback->name, callback->init == NULL ? "NO " : "",
 		callback->uninit == NULL ? "NO " : "");
 out:
@@ -339,7 +339,7 @@ rte_lcore_callback_unregister(void *handle)
 no_uninit:
 	TAILQ_REMOVE(&lcore_callbacks, callback, next);
 	rte_rwlock_write_unlock(&lcore_lock);
-	RTE_LOG(DEBUG, EAL, "Unregistered lcore callback %s-%p.\n",
+	EAL_LOG(DEBUG, "Unregistered lcore callback %s-%p.",
 		callback->name, callback->arg);
 	free_callback(callback);
 }
@@ -361,7 +361,7 @@ eal_lcore_non_eal_allocate(void)
 		break;
 	}
 	if (lcore_id == RTE_MAX_LCORE) {
-		RTE_LOG(DEBUG, EAL, "No lcore available.\n");
+		EAL_LOG(DEBUG, "No lcore available.");
 		goto out;
 	}
 	TAILQ_FOREACH(callback, &lcore_callbacks, next) {
@@ -375,7 +375,7 @@ eal_lcore_non_eal_allocate(void)
 			callback_uninit(prev, lcore_id);
 			prev = TAILQ_PREV(prev, lcore_callbacks_head, next);
 		}
-		RTE_LOG(DEBUG, EAL, "Initialization refused for lcore %u.\n",
+		EAL_LOG(DEBUG, "Initialization refused for lcore %u.",
 			lcore_id);
 		cfg->lcore_role[lcore_id] = ROLE_OFF;
 		cfg->lcore_count--;
lib/eal/common/eal_common_memalloc.c +6 -6
index ab04479c1c..47e782f395 100644
@@ -186,7 +186,7 @@ eal_memalloc_mem_event_callback_register(const char *name,
 
 	ret = 0;
 
-	RTE_LOG(DEBUG, EAL, "Mem event callback '%s:%p' registered\n",
+	EAL_LOG(DEBUG, "Mem event callback '%s:%p' registered",
 			name, arg);
 
 unlock:
@@ -225,7 +225,7 @@ eal_memalloc_mem_event_callback_unregister(const char *name, void *arg)
 
 	ret = 0;
 
-	RTE_LOG(DEBUG, EAL, "Mem event callback '%s:%p' unregistered\n",
+	EAL_LOG(DEBUG, "Mem event callback '%s:%p' unregistered",
 			name, arg);
 
 unlock:
@@ -242,7 +242,7 @@ eal_memalloc_mem_event_notify(enum rte_mem_event event, const void *start,
 	rte_rwlock_read_lock(&mem_event_rwlock);
 
 	TAILQ_FOREACH(entry, &mem_event_callback_list, next) {
-		RTE_LOG(DEBUG, EAL, "Calling mem event callback '%s:%p'\n",
+		EAL_LOG(DEBUG, "Calling mem event callback '%s:%p'",
 			entry->name, entry->arg);
 		entry->clb(event, start, len, entry->arg);
 	}
@@ -293,7 +293,7 @@ eal_memalloc_mem_alloc_validator_register(const char *name,
 
 	ret = 0;
 
-	RTE_LOG(DEBUG, EAL, "Mem alloc validator '%s' on socket %i with limit %zu registered\n",
+	EAL_LOG(DEBUG, "Mem alloc validator '%s' on socket %i with limit %zu registered",
 		name, socket_id, limit);
 
 unlock:
@@ -332,7 +332,7 @@ eal_memalloc_mem_alloc_validator_unregister(const char *name, int socket_id)
 
 	ret = 0;
 
-	RTE_LOG(DEBUG, EAL, "Mem alloc validator '%s' on socket %i unregistered\n",
+	EAL_LOG(DEBUG, "Mem alloc validator '%s' on socket %i unregistered",
 		name, socket_id);
 
 unlock:
@@ -351,7 +351,7 @@ eal_memalloc_mem_alloc_validate(int socket_id, size_t new_len)
 	TAILQ_FOREACH(entry, &mem_alloc_validator_list, next) {
 		if (entry->socket_id != socket_id || entry->limit > new_len)
 			continue;
-		RTE_LOG(DEBUG, EAL, "Calling mem alloc validator '%s' on socket %i\n",
+		EAL_LOG(DEBUG, "Calling mem alloc validator '%s' on socket %i",
 			entry->name, entry->socket_id);
 		if (entry->clb(socket_id, entry->limit, new_len) < 0)
 			ret = -1;
lib/eal/common/eal_common_memory.c +33 -33

227 lines not on this page · raw message

lib/eal/common/eal_common_memzone.c +12 -12
index 1f3e701499..32e6b78f87 100644
@@ -31,13 +31,13 @@ rte_memzone_max_set(size_t max)
 	struct rte_mem_config *mcfg;
 
 	if (eal_get_internal_configuration()->init_complete > 0) {
-		RTE_LOG(ERR, EAL, "Max memzone cannot be set after EAL init\n");
+		EAL_LOG(ERR, "Max memzone cannot be set after EAL init");
 		return -1;
 	}
 
 	mcfg = rte_eal_get_configuration()->mem_config;
 	if (mcfg == NULL) {
-		RTE_LOG(ERR, EAL, "Failed to set max memzone count\n");
+		EAL_LOG(ERR, "Failed to set max memzone count");
 		return -1;
 	}
 
@@ -116,16 +116,16 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
 
 	/* no more room in config */
 	if (arr->count >= arr->len) {
-		RTE_LOG(ERR, EAL,
+		EAL_LOG(ERR,
 		"%s(): Number of requested memzone segments exceeds maximum "
-		"%u\n", __func__, arr->len);
+		"%u", __func__, arr->len);
 
 		rte_errno = ENOSPC;
 		return NULL;
 	}
 
 	if (strlen(name) > sizeof(mz->name) - 1) {
-		RTE_LOG(DEBUG, EAL, "%s(): memzone <%s>: name too long\n",
+		EAL_LOG(DEBUG, "%s(): memzone <%s>: name too long",
 			__func__, name);
 		rte_errno = ENAMETOOLONG;
 		return NULL;
@@ -133,7 +133,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
 
 	/* zone already exist */
 	if ((memzone_lookup_thread_unsafe(name)) != NULL) {
-		RTE_LOG(DEBUG, EAL, "%s(): memzone <%s> already exists\n",
+		EAL_LOG(DEBUG, "%s(): memzone <%s> already exists",
 			__func__, name);
 		rte_errno = EEXIST;
 		return NULL;
@@ -141,7 +141,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
 
 	/* if alignment is not a power of two */
 	if (align && !rte_is_power_of_2(align)) {
-		RTE_LOG(ERR, EAL, "%s(): Invalid alignment: %u\n", __func__,
+		EAL_LOG(ERR, "%s(): Invalid alignment: %u", __func__,
 				align);
 		rte_errno = EINVAL;
 		return NULL;
@@ -218,7 +218,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
 	}
 
 	if (mz == NULL) {
-		RTE_LOG(ERR, EAL, "%s(): Cannot find free memzone\n", __func__);
+		EAL_LOG(ERR, "%s(): Cannot find free memzone", __func__);
 		malloc_heap_free(elem);
 		rte_errno = ENOSPC;
 		return NULL;
@@ -323,7 +323,7 @@ rte_memzone_free(const struct rte_memzone *mz)
 	if (found_mz == NULL) {
 		ret = -EINVAL;
 	} else if (found_mz->addr == NULL) {
-		RTE_LOG(ERR, EAL, "Memzone is not allocated\n");
+		EAL_LOG(ERR, "Memzone is not allocated");
 		ret = -EINVAL;
 	} else {
 		addr = found_mz->addr;
@@ -385,7 +385,7 @@ dump_memzone(const struct rte_memzone *mz, void *arg)
 	/* go through each page occupied by this memzone */
 	msl = rte_mem_virt2memseg_list(mz->addr);
 	if (!msl) {
-		RTE_LOG(DEBUG, EAL, "Skipping bad memzone\n");
+		EAL_LOG(DEBUG, "Skipping bad memzone");
 		return;
 	}
 	page_sz = (size_t)mz->hugepage_sz;
@@ -434,11 +434,11 @@ rte_eal_memzone_init(void)
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY &&
 			rte_fbarray_init(&mcfg->memzones, "memzone",
 			rte_memzone_max_get(), sizeof(struct rte_memzone))) {
-		RTE_LOG(ERR, EAL, "Cannot allocate memzone list\n");
+		EAL_LOG(ERR, "Cannot allocate memzone list");
 		ret = -1;
 	} else if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
 			rte_fbarray_attach(&mcfg->memzones)) {
-		RTE_LOG(ERR, EAL, "Cannot attach to memzone list\n");
+		EAL_LOG(ERR, "Cannot attach to memzone list");
 		ret = -1;
 	}
 
lib/eal/common/eal_common_options.c +118 -118

646 lines not on this page · raw message

lib/eal/common/eal_common_proc.c +56 -56

423 lines not on this page · raw message

lib/eal/common/eal_common_tailqs.c +6 -6
index 580fbf24bc..56bb2bd91c 100644
@@ -109,8 +109,8 @@ int
 rte_eal_tailq_register(struct rte_tailq_elem *t)
 {
 	if (rte_eal_tailq_local_register(t) < 0) {
-		RTE_LOG(ERR, EAL,
-			"%s tailq is already registered\n", t->name);
+		EAL_LOG(ERR,
+			"%s tailq is already registered", t->name);
 		goto error;
 	}
 
@@ -119,8 +119,8 @@ rte_eal_tailq_register(struct rte_tailq_elem *t)
 	if (rte_tailqs_count >= 0) {
 		rte_eal_tailq_update(t);
 		if (t->head == NULL) {
-			RTE_LOG(ERR, EAL,
-				"Cannot initialize tailq: %s\n", t->name);
+			EAL_LOG(ERR,
+				"Cannot initialize tailq: %s", t->name);
 			TAILQ_REMOVE(&rte_tailq_elem_head, t, next);
 			goto error;
 		}
@@ -145,8 +145,8 @@ rte_eal_tailqs_init(void)
 		 * rte_eal_tailq_register and EAL_REGISTER_TAILQ */
 		rte_eal_tailq_update(t);
 		if (t->head == NULL) {
-			RTE_LOG(ERR, EAL,
-				"Cannot initialize tailq: %s\n", t->name);
+			EAL_LOG(ERR,
+				"Cannot initialize tailq: %s", t->name);
 			/* TAILQ_REMOVE not needed, error is already fatal */
 			goto fail;
 		}
lib/eal/common/eal_common_thread.c +6 -6
index c422ea8b53..a53bc639ae 100644
@@ -86,7 +86,7 @@ int
 rte_thread_set_affinity(rte_cpuset_t *cpusetp)
 {
 	if (rte_thread_set_affinity_by_id(rte_thread_self(), cpusetp) != 0) {
-		RTE_LOG(ERR, EAL, "rte_thread_set_affinity_by_id failed\n");
+		EAL_LOG(ERR, "rte_thread_set_affinity_by_id failed");
 		return -1;
 	}
 
@@ -175,7 +175,7 @@ eal_thread_loop(void *arg)
 	__rte_thread_init(lcore_id, &lcore_config[lcore_id].cpuset);
 
 	ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset));
-	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
+	EAL_LOG(DEBUG, "lcore %u is ready (tid=%zx;cpuset=[%s%s])",
 		lcore_id, rte_thread_self().opaque_id, cpuset,
 		ret == 0 ? "" : "...");
 
@@ -368,12 +368,12 @@ rte_thread_register(void)
 
 	/* EAL init flushes all lcores, we can't register before. */
 	if (eal_get_internal_configuration()->init_complete != 1) {
-		RTE_LOG(DEBUG, EAL, "Called %s before EAL init.\n", __func__);
+		EAL_LOG(DEBUG, "Called %s before EAL init.", __func__);
 		rte_errno = EINVAL;
 		return -1;
 	}
 	if (!rte_mp_disable()) {
-		RTE_LOG(ERR, EAL, "Multiprocess in use, registering non-EAL threads is not supported.\n");
+		EAL_LOG(ERR, "Multiprocess in use, registering non-EAL threads is not supported.");
 		rte_errno = EINVAL;
 		return -1;
 	}
@@ -387,7 +387,7 @@ rte_thread_register(void)
 		rte_errno = ENOMEM;
 		return -1;
 	}
-	RTE_LOG(DEBUG, EAL, "Registered non-EAL thread as lcore %u.\n",
+	EAL_LOG(DEBUG, "Registered non-EAL thread as lcore %u.",
 		lcore_id);
 	return 0;
 }
@@ -401,7 +401,7 @@ rte_thread_unregister(void)
 		eal_lcore_non_eal_release(lcore_id);
 	__rte_thread_uninit();
 	if (lcore_id != LCORE_ID_ANY)
-		RTE_LOG(DEBUG, EAL, "Unregistered non-EAL thread (was lcore %u).\n",
+		EAL_LOG(DEBUG, "Unregistered non-EAL thread (was lcore %u).",
 			lcore_id);
 }
 
lib/eal/common/eal_common_timer.c +3 -3
index 5686a5102b..c5c4703f15 100644
@@ -39,8 +39,8 @@ static uint64_t
 estimate_tsc_freq(void)
 {
 #define CYC_PER_10MHZ 1E7
-	RTE_LOG(WARNING, EAL, "WARNING: TSC frequency estimated roughly"
-		" - clock timings may be less accurate.\n");
+	EAL_LOG(WARNING, "WARNING: TSC frequency estimated roughly"
+		" - clock timings may be less accurate.");
 	/* assume that the rte_delay_us_sleep() will sleep for 1 second */
 	uint64_t start = rte_rdtsc();
 	rte_delay_us_sleep(US_PER_S);
@@ -71,7 +71,7 @@ set_tsc_freq(void)
 	if (!freq)
 		freq = estimate_tsc_freq();
 
-	RTE_LOG(DEBUG, EAL, "TSC frequency is ~%" PRIu64 " KHz\n", freq / 1000);
+	EAL_LOG(DEBUG, "TSC frequency is ~%" PRIu64 " KHz", freq / 1000);
 	eal_tsc_resolution_hz = freq;
 	mcfg->tsc_hz = freq;
 }
lib/eal/common/eal_common_trace_utils.c +2 -1
index 8561a0e198..7282715b11 100644
@@ -12,6 +12,7 @@
 #include <rte_string_fns.h>
 
 #include "eal_filesystem.h"
+#include "eal_private.h"
 #include "eal_trace.h"
 
 const char *
@@ -348,7 +349,7 @@ trace_mkdir(void)
 		return -rte_errno;
 	}
 
-	RTE_LOG(INFO, EAL, "Trace dir: %s\n", trace->dir);
+	EAL_LOG(INFO, "Trace dir: %s", trace->dir);
 	already_done = true;
 	return 0;
 }
lib/eal/common/eal_private.h +4 -0
index 4d2e806610..afd87000e7 100644
@@ -12,6 +12,7 @@
 
 #include <dev_driver.h>
 #include <rte_lcore.h>
+#include <rte_log.h>
 #include <rte_memory.h>
 
 #include "eal_internal_cfg.h"
@@ -747,4 +748,7 @@ int eal_asprintf(char **buffer, const char *format, ...);
 		eal_asprintf(buffer, format, ##__VA_ARGS__)
 #endif
 
+#define EAL_LOG(level, fmt, ...) \
+	RTE_LOG(level, EAL, fmt "\n", ## __VA_ARGS__)
+
 #endif /* _EAL_PRIVATE_H_ */
lib/eal/common/eal_trace.h +2 -2
index ace2ef3ee5..bd082a0337 100644
@@ -17,10 +17,10 @@
 #include "eal_thread.h"
 
 #define trace_err(fmt, args...) \
-	RTE_LOG(ERR, EAL, "%s():%u " fmt "\n", __func__, __LINE__, ## args)
+	EAL_LOG(ERR, "%s():%u " fmt, __func__, __LINE__, ## args)
 
 #define trace_crit(fmt, args...) \
-	RTE_LOG(CRIT, EAL, "%s():%u " fmt "\n", __func__, __LINE__, ## args)
+	EAL_LOG(CRIT, "%s():%u " fmt, __func__, __LINE__, ## args)
 
 #define TRACE_CTF_MAGIC 0xC1FC1FC1
 #define TRACE_MAX_ARGS	32
lib/eal/common/hotplug_mp.c +27 -27

205 lines not on this page · raw message

lib/eal/common/malloc_elem.c +3 -3
index f5d1c8c2e2..452b119c20 100644
@@ -148,7 +148,7 @@ malloc_elem_insert(struct malloc_elem *elem)
 
 	/* first and last elements must be both NULL or both non-NULL */
 	if ((heap->first == NULL) != (heap->last == NULL)) {
-		RTE_LOG(ERR, EAL, "Heap is probably corrupt\n");
+		EAL_LOG(ERR, "Heap is probably corrupt");
 		return;
 	}
 
@@ -628,7 +628,7 @@ malloc_elem_hide_region(struct malloc_elem *elem, void *start, size_t len)
 
 			malloc_elem_free_list_insert(hide_end);
 		} else if (len_after > 0) {
-			RTE_LOG(ERR, EAL, "Unaligned element, heap is probably corrupt\n");
+			EAL_LOG(ERR, "Unaligned element, heap is probably corrupt");
 			return;
 		}
 	}
@@ -647,7 +647,7 @@ malloc_elem_hide_region(struct malloc_elem *elem, void *start, size_t len)
 
 			malloc_elem_free_list_insert(prev);
 		} else if (len_before > 0) {
-			RTE_LOG(ERR, EAL, "Unaligned element, heap is probably corrupt\n");
+			EAL_LOG(ERR, "Unaligned element, heap is probably corrupt");
 			return;
 		}
 	}
lib/eal/common/malloc_heap.c +20 -20
index 6b6cf9174c..5ff27548ff 100644
@@ -117,7 +117,7 @@ malloc_add_seg(const struct rte_memseg_list *msl,
 
 	heap_idx = malloc_socket_to_heap_id(msl->socket_id);
 	if (heap_idx < 0) {
-		RTE_LOG(ERR, EAL, "Memseg list has invalid socket id\n");
+		EAL_LOG(ERR, "Memseg list has invalid socket id");
 		return -1;
 	}
 	heap = &mcfg->malloc_heaps[heap_idx];
@@ -135,7 +135,7 @@ malloc_add_seg(const struct rte_memseg_list *msl,
 
 	heap->total_size += len;
 
-	RTE_LOG(DEBUG, EAL, "Added %zuM to heap on socket %i\n", len >> 20,
+	EAL_LOG(DEBUG, "Added %zuM to heap on socket %i", len >> 20,
 			msl->socket_id);
 	return 0;
 }
@@ -308,7 +308,7 @@ alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,
 	/* first, check if we're allowed to allocate this memory */
 	if (eal_memalloc_mem_alloc_validate(socket,
 			heap->total_size + alloc_sz) < 0) {
-		RTE_LOG(DEBUG, EAL, "User has disallowed allocation\n");
+		EAL_LOG(DEBUG, "User has disallowed allocation");
 		return NULL;
 	}
 
@@ -324,7 +324,7 @@ alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,
 
 	/* check if we wanted contiguous memory but didn't get it */
 	if (contig && !eal_memalloc_is_contig(msl, map_addr, alloc_sz)) {
-		RTE_LOG(DEBUG, EAL, "%s(): couldn't allocate physically contiguous space\n",
+		EAL_LOG(DEBUG, "%s(): couldn't allocate physically contiguous space",
 				__func__);
 		goto fail;
 	}
@@ -352,8 +352,8 @@ alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,
 		 * which could solve some situations when IOVA VA is not
 		 * really needed.
 		 */
-		RTE_LOG(ERR, EAL,
-			"%s(): couldn't allocate memory due to IOVA exceeding limits of current DMA mask\n",
+		EAL_LOG(ERR,
+			"%s(): couldn't allocate memory due to IOVA exceeding limits of current DMA mask",
 			__func__);
 
 		/*
@@ -363,8 +363,8 @@ alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,
 		 */
 		if ((rte_eal_iova_mode() == RTE_IOVA_VA) &&
 		     rte_eal_using_phys_addrs())
-			RTE_LOG(ERR, EAL,
-				"%s(): Please try initializing EAL with --iova-mode=pa parameter\n",
+			EAL_LOG(ERR,
+				"%s(): Please try initializing EAL with --iova-mode=pa parameter",
 				__func__);
 		goto fail;
 	}
@@ -440,7 +440,7 @@ try_expand_heap_primary(struct malloc_heap *heap, uint64_t pg_sz,
 	}
 	heap->total_size += alloc_sz;
 
-	RTE_LOG(DEBUG, EAL, "Heap on socket %d was expanded by %zdMB\n",
+	EAL_LOG(DEBUG, "Heap on socket %d was expanded by %zdMB",
 		socket, alloc_sz >> 20ULL);
 
 	free(ms);
@@ -693,7 +693,7 @@ malloc_heap_alloc_on_heap_id(const char *type, size_t size,
 
 		/* this should have succeeded */
 		if (ret == NULL)
-			RTE_LOG(ERR, EAL, "Error allocating from heap\n");
+			EAL_LOG(ERR, "Error allocating from heap");
 	}
 alloc_unlock:
 	rte_spinlock_unlock(&(heap->lock));
@@ -1040,7 +1040,7 @@ malloc_heap_free(struct malloc_elem *elem)
 	/* we didn't exit early, meaning we have unmapped some pages */
 	unmapped = true;
 
-	RTE_LOG(DEBUG, EAL, "Heap on socket %d was shrunk by %zdMB\n",
+	EAL_LOG(DEBUG, "Heap on socket %d was shrunk by %zdMB",
 		msl->socket_id, aligned_len >> 20ULL);
 
 	rte_mcfg_mem_write_unlock();
@@ -1199,7 +1199,7 @@ malloc_heap_create_external_seg(void *va_addr, rte_iova_t iova_addrs[],
 		}
 	}
 	if (msl == NULL) {
-		RTE_LOG(ERR, EAL, "Couldn't find empty memseg list\n");
+		EAL_LOG(ERR, "Couldn't find empty memseg list");
 		rte_errno = ENOSPC;
 		return NULL;
 	}
@@ -1210,7 +1210,7 @@ malloc_heap_create_external_seg(void *va_addr, rte_iova_t iova_addrs[],
 	/* create the backing fbarray */
 	if (rte_fbarray_init(&msl->memseg_arr, fbarray_name, n_pages,
 			sizeof(struct rte_memseg)) < 0) {
-		RTE_LOG(ERR, EAL, "Couldn't create fbarray backing the memseg list\n");
+		EAL_LOG(ERR, "Couldn't create fbarray backing the memseg list");
 		return NULL;
 	}
 	arr = &msl->memseg_arr;
@@ -1310,7 +1310,7 @@ malloc_heap_add_external_memory(struct malloc_heap *heap,
 	heap->total_size += msl->len;
 
 	/* all done! */
-	RTE_LOG(DEBUG, EAL, "Added segment for heap %s starting at %p\n",
+	EAL_LOG(DEBUG, "Added segment for heap %s starting at %p",
 			heap->name, msl->base_va);
 
 	/* notify all subscribers that a new memory area has been added */
@@ -1356,7 +1356,7 @@ malloc_heap_create(struct malloc_heap *heap, const char *heap_name)
 
 	/* prevent overflow. did you really create 2 billion heaps??? */
 	if (next_socket_id > INT32_MAX) {
-		RTE_LOG(ERR, EAL, "Cannot assign new socket ID's\n");
+		EAL_LOG(ERR, "Cannot assign new socket ID's");
 		rte_errno = ENOSPC;
 		return -1;
 	}
@@ -1382,17 +1382,17 @@ int
 malloc_heap_destroy(struct malloc_heap *heap)
 {
 	if (heap->alloc_count != 0) {
-		RTE_LOG(ERR, EAL, "Heap is still in use\n");
+		EAL_LOG(ERR, "Heap is still in use");
 		rte_errno = EBUSY;
 		return -1;
 	}
 	if (heap->first != NULL || heap->last != NULL) {
-		RTE_LOG(ERR, EAL, "Heap still contains memory segments\n");
+		EAL_LOG(ERR, "Heap still contains memory segments");
 		rte_errno = EBUSY;
 		return -1;
 	}
 	if (heap->total_size != 0)
-		RTE_LOG(ERR, EAL, "Total size not zero, heap is likely corrupt\n");
+		EAL_LOG(ERR, "Total size not zero, heap is likely corrupt");
 
 	/* Reset all of the heap but the (hold) lock so caller can release it. */
 	RTE_BUILD_BUG_ON(offsetof(struct malloc_heap, lock) != 0);
@@ -1411,7 +1411,7 @@ rte_eal_malloc_heap_init(void)
 		eal_get_internal_configuration();
 
 	if (internal_conf->match_allocations)
-		RTE_LOG(DEBUG, EAL, "Hugepages will be freed exactly as allocated.\n");
+		EAL_LOG(DEBUG, "Hugepages will be freed exactly as allocated.");
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		/* assign min socket ID to external heaps */
@@ -1431,7 +1431,7 @@ rte_eal_malloc_heap_init(void)
 	}
 
 	if (register_mp_requests()) {
-		RTE_LOG(ERR, EAL, "Couldn't register malloc multiprocess actions\n");
+		EAL_LOG(ERR, "Couldn't register malloc multiprocess actions");
 		return -1;
 	}
 
lib/eal/common/malloc_mp.c +36 -36

113 lines not on this page · raw message

lib/eal/common/rte_keepalive.c +3 -1
index e0494b2010..f6db97317c 100644

Lines of this file are not shown. View the raw message.

lib/eal/common/rte_malloc.c +5 -5
index 9db0c399ae..6d3c301a23 100644

Lines of this file are not shown. View the raw message.

lib/eal/common/rte_service.c +4 -4
index e183d2e631..d959c91459 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal.c +38 -37

75 lines not on this page · raw message

lib/eal/freebsd/eal_alarm.c +1 -1
index e5b0909a45..94cae5f4b6 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_dev.c +6 -4
index c3dfe9108f..d8659cc7fc 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_hugepage_info.c +11 -11
index e58e618469..b6772e0701 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_interrupts.c +30 -30

60 lines not on this page · raw message

lib/eal/freebsd/eal_lcore.c +1 -1
index d9ef4bc9c5..1d3d1b67b9 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_memalloc.c +6 -5
index 00ab02cb63..49faf0c6aa 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_memory.c +17 -17
index 5c6165c580..a6f3ba226e 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_thread.c +1 -1
index 6f97a3c2c1..77b7621908 100644

Lines of this file are not shown. View the raw message.

lib/eal/freebsd/eal_timer.c +5 -5
index beff755a47..3dd70e24ba 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal.c +61 -61

122 lines not on this page · raw message

lib/eal/linux/eal_alarm.c +1 -1
index 766ba2c251..eeb096213b 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_dev.c +20 -20
index ac76f6174d..e678dce6c7 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_hugepage_info.c +19 -19
index 36a495fb1f..d47a19c56a 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_interrupts.c +58 -58

116 lines not on this page · raw message

lib/eal/linux/eal_lcore.c +2 -2
index 2e6a350603..29b36dd610 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_memalloc.c +60 -60

120 lines not on this page · raw message

lib/eal/linux/eal_memory.c +104 -104

208 lines not on this page · raw message

lib/eal/linux/eal_thread.c +4 -2
index 880070c627..7051840cdf 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_timer.c +5 -5
index df9ad61ae9..1cb1e92193 100644

Lines of this file are not shown. View the raw message.

lib/eal/linux/eal_vfio.c +135 -135

270 lines not on this page · raw message

lib/eal/linux/eal_vfio_mp_sync.c +3 -2
index 157f20e583..ce14e260fe 100644

Lines of this file are not shown. View the raw message.

lib/eal/riscv/rte_cycles.c +2 -2
index 358f271311..5691ec3a93 100644

Lines of this file are not shown. View the raw message.

lib/eal/unix/eal_filesystem.c +7 -7
index afbab9368a..6cd5f1492c 100644

Lines of this file are not shown. View the raw message.

lib/eal/unix/eal_firmware.c +2 -1
index 1a7cf8e7b7..1d47e879c8 100644

Lines of this file are not shown. View the raw message.

lib/eal/unix/eal_unix_memory.c +4 -4
index 68ae93bd6e..97969a401b 100644

Lines of this file are not shown. View the raw message.

lib/eal/unix/rte_thread.c +19 -17
index 36a21ab2f9..1b4c73f58e 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal.c +18 -18
index 7ec2152211..52f0e7462d 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_alarm.c +7 -6
index 34b52380ce..052af4b21b 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_debug.c +6 -4
index 56ed70df7d..4a6303a2a9 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_dev.c +6 -4
index 35191056fd..e0b8c54dc5 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_hugepages.c +5 -5
index 775c67e4c4..ff72b8ee38 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_interrupts.c +5 -5
index 49efdc098c..c97118d231 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_lcore.c +4 -3
index 286fe241eb..a498044620 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_memalloc.c +25 -25

50 lines not on this page · raw message

lib/eal/windows/eal_memory.c +10 -10
index fd39155163..8de92d4089 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/eal_windows.h +4 -2
index 43b228d388..91cf15eaaa 100644

Lines of this file are not shown. View the raw message.

lib/eal/windows/rte_thread.c +15 -14
index 145ac4b5aa..6f991dfa5d 100644

Lines of this file are not shown. View the raw message.

lib/efd/rte_efd.c +31 -29

60 lines not on this page · raw message

lib/fib/fib_log.h +3 -1
index c731c820f6..aa901cb344 100644

Lines of this file are not shown. View the raw message.

lib/fib/rte_fib.c +7 -7
index f88e71a59d..4f9fba5a4f 100644

Lines of this file are not shown. View the raw message.

lib/fib/rte_fib6.c +7 -7
index ab1d960479..9ad990724a 100644

Lines of this file are not shown. View the raw message.

lib/hash/rte_cuckoo_hash.c +28 -26

54 lines not on this page · raw message

lib/hash/rte_fbk_hash.c +4 -2
index faeb50cd89..681286b946 100644

Lines of this file are not shown. View the raw message.

lib/hash/rte_hash_crc.c +8 -6
index 1439d8a71f..997ac3c5fa 100644

Lines of this file are not shown. View the raw message.

lib/hash/rte_thash.c +12 -10
index d819dddd84..3dcae495e9 100644

Lines of this file are not shown. View the raw message.

lib/hash/rte_thash_gfni.c +6 -4
index c863789b51..cd22a649f7 100644

Lines of this file are not shown. View the raw message.

lib/ip_frag/ip_frag_common.h +3 -0
index 537bce7c3b..4e9637d12f 100644

Lines of this file are not shown. View the raw message.

lib/ip_frag/rte_ip_frag_common.c +4 -4
index eed399da6b..05f9e479c2 100644

Lines of this file are not shown. View the raw message.

lib/latencystats/rte_latencystats.c +22 -21

43 lines not on this page · raw message

lib/lpm/lpm_log.h +2 -0
index a0621b70a5..1385b9b02a 100644

Lines of this file are not shown. View the raw message.

lib/lpm/rte_lpm.c +6 -6
index 0ca8214786..363058e118 100644

Lines of this file are not shown. View the raw message.

lib/lpm/rte_lpm6.c +5 -5
index 24ce7dd022..271bc480dc 100644

Lines of this file are not shown. View the raw message.

lib/mbuf/mbuf_log.h +2 -0
index d759a9a255..a8a674f6be 100644

Lines of this file are not shown. View the raw message.

lib/mbuf/rte_mbuf.c +7 -7
index 3eccc61827..559d5ad8a7 100644

Lines of this file are not shown. View the raw message.

lib/mbuf/rte_mbuf_dyn.c +7 -7
index 4fb1863a10..446018ffdc 100644

Lines of this file are not shown. View the raw message.

lib/mbuf/rte_mbuf_pool_ops.c +2 -2
index 5318430126..8e93c6acbd 100644

Lines of this file are not shown. View the raw message.

lib/mempool/rte_mempool.c +12 -12
index 2f8adad5ca..b7a19bea71 100644

Lines of this file are not shown. View the raw message.

lib/mempool/rte_mempool.h +3 -1
index 4f8511b8f5..e44039dffb 100644

Lines of this file are not shown. View the raw message.

lib/mempool/rte_mempool_ops.c +5 -5
index e871de9ec9..1b33380259 100644

Lines of this file are not shown. View the raw message.

lib/pipeline/rte_pipeline.c +117 -114

231 lines not on this page · raw message

lib/port/port_log.h new file +9 -0
new file mode 100644
index 0000000000..bc1744bd97

Lines of this file are not shown. View the raw message.

lib/port/rte_port_ethdev.c +11 -9
index e6bb7ee480..d57f680e98 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_eventdev.c +11 -9
index 13350fd608..6acf22998d 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_fd.c +14 -12
index 7e140793b2..281cba20c2 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_frag.c +9 -7
index e1f1892176..883601a9ae 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_ras.c +8 -6
index 15109661d1..42cf1ddf45 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_ring.c +11 -9
index 002efb7c3e..680d208f45 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_sched.c +8 -6
index f6255c4346..da7a6240d7 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_source_sink.c +26 -24

50 lines not on this page · raw message

lib/port/rte_port_sym_crypto.c +11 -9
index 27b7e07cea..a68a2396a5 100644

Lines of this file are not shown. View the raw message.

lib/power/guest_channel.c +21 -19
index a6f2097d5b..6949f26d33 100644

Lines of this file are not shown. View the raw message.

lib/power/power_acpi_cpufreq.c +53 -53

106 lines not on this page · raw message

lib/power/power_amd_pstate_cpufreq.c +60 -60

120 lines not on this page · raw message

lib/power/power_common.c +5 -5
index bf77eafa88..5d6c4291de 100644

Lines of this file are not shown. View the raw message.

lib/power/power_common.h +3 -1
index c3fcbf4c10..4302370b5e 100644

Lines of this file are not shown. View the raw message.

lib/power/power_cppc_cpufreq.c +59 -59

118 lines not on this page · raw message

lib/power/power_intel_uncore.c +34 -34

68 lines not on this page · raw message

lib/power/power_kvm_vm.c +11 -11
index db031f4310..f15be8fac5 100644

Lines of this file are not shown. View the raw message.

lib/power/power_pstate_cpufreq.c +72 -72

144 lines not on this page · raw message

lib/power/rte_power.c +11 -11
index 1502612b0a..36c3f3da98 100644

Lines of this file are not shown. View the raw message.

lib/power/rte_power_pmd_mgmt.c +17 -17
index 6f18ed0adf..591fc69f36 100644

Lines of this file are not shown. View the raw message.

lib/power/rte_power_uncore.c +7 -7
index 9c20fe150d..48c75a5da0 100644

Lines of this file are not shown. View the raw message.

lib/rcu/rte_rcu_qsbr.c +23 -39

62 lines not on this page · raw message

lib/rcu/rte_rcu_qsbr.h +1 -0
index 6b908e7ee0..0dca8310c0 100644

Lines of this file are not shown. View the raw message.

lib/reorder/rte_reorder.c +18 -16
index 640719c3ec..fd550b03af 100644

Lines of this file are not shown. View the raw message.

lib/rib/rib_log.h +5 -1
index f3ee513ca8..ce74a4ce3e 100644

Lines of this file are not shown. View the raw message.

lib/rib/rte_rib.c +7 -6
index 251d0d4ef1..aa3296de19 100644

Lines of this file are not shown. View the raw message.

lib/rib/rte_rib6.c +5 -5
index ad3d48ab8e..b7df3926f8 100644

Lines of this file are not shown. View the raw message.

lib/ring/rte_ring.c +14 -12
index 12046419f1..118ffab4b9 100644

Lines of this file are not shown. View the raw message.

lib/sched/rte_pie.c +9 -9
index cce0ce762d..2eb0b0f74e 100644

Lines of this file are not shown. View the raw message.

lib/sched/rte_sched.c +137 -137

274 lines not on this page · raw message

lib/sched/rte_sched_log.h +2 -0
index fde051f49d..d050b8fda1 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_acl.c +38 -36

74 lines not on this page · raw message

lib/table/rte_table_array.c +10 -8
index a45b29ed6a..80bc2a74f5 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_cuckoo.c +13 -11
index 86c960c103..0f4900c4df 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_ext.c +13 -11
index 9f0220ded2..2148d83509 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_key16.c +21 -19
index 584c3f2c98..7734aef0cf 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_key32.c +21 -19
index 22b5ca9166..fcb4348e8b 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_key8.c +21 -19
index bd0ec4aac0..bbe65625c9 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_hash_lru.c +13 -11
index 758ec4fe7a..cb4f32991e 100644

Lines of this file are not shown. View the raw message.

lib/table/rte_table_lpm.c +23 -21

44 lines not on this page · raw message

lib/table/rte_table_lpm_ipv6.c +24 -22

46 lines not on this page · raw message

lib/table/rte_table_stub.c +4 -2
index cc21516995..7147f7146e 100644

Lines of this file are not shown. View the raw message.

lib/table/table_log.h new file +9 -0
new file mode 100644
index 0000000000..b50b20e595

Lines of this file are not shown. View the raw message.

lib/vhost/fd_man.c +6 -4
index 83586c5b4f..01cb77257e 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.

#115 lore raw

PATCH v5 10/13 vhost: improve log for memory dumping configuration

In reply to David Marchand

Add the device name as a prefix of logs associated to madvise() calls.

---
 lib/vhost/iotlb.c      | 18 +++++++++---------
 lib/vhost/vhost.h      |  2 +-
 lib/vhost/vhost_user.c | 26 +++++++++++++-------------
 3 files changed, 23 insertions(+), 23 deletions(-)
lib/vhost/iotlb.c +9 -9
index 87ac0e5126..10ab77262e 100644
@@ -54,16 +54,16 @@ vhost_user_iotlb_share_page(struct vhost_iotlb_entry *a, struct vhost_iotlb_entr
 }
 
 static void
-vhost_user_iotlb_set_dump(struct vhost_iotlb_entry *node)
+vhost_user_iotlb_set_dump(struct virtio_net *dev, struct vhost_iotlb_entry *node)
 {
 	uint64_t start;
 
 	start = node->uaddr + node->uoffset;
-	mem_set_dump((void *)(uintptr_t)start, node->size, true, RTE_BIT64(node->page_shift));
+	mem_set_dump(dev, (void *)(uintptr_t)start, node->size, true, RTE_BIT64(node->page_shift));
 }
 
 static void
-vhost_user_iotlb_clear_dump(struct vhost_iotlb_entry *node,
+vhost_user_iotlb_clear_dump(struct virtio_net *dev, struct vhost_iotlb_entry *node,
 		struct vhost_iotlb_entry *prev, struct vhost_iotlb_entry *next)
 {
 	uint64_t start, end;
@@ -80,7 +80,7 @@ vhost_user_iotlb_clear_dump(struct vhost_iotlb_entry *node,
 		end = RTE_ALIGN_FLOOR(end, RTE_BIT64(node->page_shift));
 
 	if (end > start)
-		mem_set_dump((void *)(uintptr_t)start, end - start, false,
+		mem_set_dump(dev, (void *)(uintptr_t)start, end - start, false,
 			RTE_BIT64(node->page_shift));
 }
 
@@ -204,7 +204,7 @@ vhost_user_iotlb_cache_remove_all(struct virtio_net *dev)
 	vhost_user_iotlb_wr_lock_all(dev);
 
 	RTE_TAILQ_FOREACH_SAFE(node, &dev->iotlb_list, next, temp_node) {
-		vhost_user_iotlb_clear_dump(node, NULL, NULL);
+		vhost_user_iotlb_clear_dump(dev, node, NULL, NULL);
 
 		TAILQ_REMOVE(&dev->iotlb_list, node, next);
 		vhost_user_iotlb_remove_notify(dev, node);
@@ -230,7 +230,7 @@ vhost_user_iotlb_cache_random_evict(struct virtio_net *dev)
 		if (!entry_idx) {
 			struct vhost_iotlb_entry *next_node = RTE_TAILQ_NEXT(node, next);
 
-			vhost_user_iotlb_clear_dump(node, prev_node, next_node);
+			vhost_user_iotlb_clear_dump(dev, node, prev_node, next_node);
 
 			TAILQ_REMOVE(&dev->iotlb_list, node, next);
 			vhost_user_iotlb_remove_notify(dev, node);
@@ -285,7 +285,7 @@ vhost_user_iotlb_cache_insert(struct virtio_net *dev, uint64_t iova, uint64_t ua
 			vhost_user_iotlb_pool_put(dev, new_node);
 			goto unlock;
 		} else if (node->iova > new_node->iova) {
-			vhost_user_iotlb_set_dump(new_node);
+			vhost_user_iotlb_set_dump(dev, new_node);
 
 			TAILQ_INSERT_BEFORE(node, new_node, next);
 			dev->iotlb_cache_nr++;
@@ -293,7 +293,7 @@ vhost_user_iotlb_cache_insert(struct virtio_net *dev, uint64_t iova, uint64_t ua
 		}
 	}
 
-	vhost_user_iotlb_set_dump(new_node);
+	vhost_user_iotlb_set_dump(dev, new_node);
 
 	TAILQ_INSERT_TAIL(&dev->iotlb_list, new_node, next);
 	dev->iotlb_cache_nr++;
@@ -322,7 +322,7 @@ vhost_user_iotlb_cache_remove(struct virtio_net *dev, uint64_t iova, uint64_t si
 		if (iova < node->iova + node->size) {
 			struct vhost_iotlb_entry *next_node = RTE_TAILQ_NEXT(node, next);
 
-			vhost_user_iotlb_clear_dump(node, prev_node, next_node);
+			vhost_user_iotlb_clear_dump(dev, node, prev_node, next_node);
 
 			TAILQ_REMOVE(&dev->iotlb_list, node, next);
 			vhost_user_iotlb_remove_notify(dev, node);
lib/vhost/vhost.h +1 -1
index f8624fba3d..5f24911190 100644
@@ -1062,6 +1062,6 @@ mbuf_is_consumed(struct rte_mbuf *m)
 	return true;
 }
 
-void mem_set_dump(void *ptr, size_t size, bool enable, uint64_t alignment);
+void mem_set_dump(struct virtio_net *dev, void *ptr, size_t size, bool enable, uint64_t alignment);
 
 #endif /* _VHOST_NET_CDEV_H_ */
lib/vhost/vhost_user.c +13 -13
index e36312181a..413f068bcd 100644
@@ -763,7 +763,7 @@ hua_to_alignment(struct rte_vhost_memory *mem, void *ptr)
 }
 
 void
-mem_set_dump(void *ptr, size_t size, bool enable, uint64_t pagesz)
+mem_set_dump(struct virtio_net *dev, void *ptr, size_t size, bool enable, uint64_t pagesz)
 {
 #ifdef MADV_DONTDUMP
 	void *start = RTE_PTR_ALIGN_FLOOR(ptr, pagesz);
@@ -771,8 +771,8 @@ mem_set_dump(void *ptr, size_t size, bool enable, uint64_t pagesz)
 	size_t len = end - (uintptr_t)start;
 
 	if (madvise(start, len, enable ? MADV_DODUMP : MADV_DONTDUMP) == -1) {
-		rte_log(RTE_LOG_INFO, vhost_config_log_level,
-			"VHOST_CONFIG: could not set coredump preference (%s).\n", strerror(errno));
+		VHOST_LOG_CONFIG(dev->ifname, INFO,
+			"could not set coredump preference (%s).\n", strerror(errno));
 	}
 #endif
 }
@@ -807,7 +807,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 			return;
 		}
 
-		mem_set_dump(vq->desc_packed, len, true,
+		mem_set_dump(dev, vq->desc_packed, len, true,
 			hua_to_alignment(dev->mem, vq->desc_packed));
 		numa_realloc(&dev, &vq);
 		*pdev = dev;
@@ -824,7 +824,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 			return;
 		}
 
-		mem_set_dump(vq->driver_event, len, true,
+		mem_set_dump(dev, vq->driver_event, len, true,
 			hua_to_alignment(dev->mem, vq->driver_event));
 		len = sizeof(struct vring_packed_desc_event);
 		vq->device_event = (struct vring_packed_desc_event *)
@@ -837,7 +837,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 			return;
 		}
 
-		mem_set_dump(vq->device_event, len, true,
+		mem_set_dump(dev, vq->device_event, len, true,
 			hua_to_alignment(dev->mem, vq->device_event));
 		vq->access_ok = true;
 		return;
@@ -855,7 +855,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 		return;
 	}
 
-	mem_set_dump(vq->desc, len, true, hua_to_alignment(dev->mem, vq->desc));
+	mem_set_dump(dev, vq->desc, len, true, hua_to_alignment(dev->mem, vq->desc));
 	numa_realloc(&dev, &vq);
 	*pdev = dev;
 	*pvq = vq;
@@ -871,7 +871,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 		return;
 	}
 
-	mem_set_dump(vq->avail, len, true, hua_to_alignment(dev->mem, vq->avail));
+	mem_set_dump(dev, vq->avail, len, true, hua_to_alignment(dev->mem, vq->avail));
 	len = sizeof(struct vring_used) +
 		sizeof(struct vring_used_elem) * vq->size;
 	if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX))
@@ -884,7 +884,7 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)
 		return;
 	}
 
-	mem_set_dump(vq->used, len, true, hua_to_alignment(dev->mem, vq->used));
+	mem_set_dump(dev, vq->used, len, true, hua_to_alignment(dev->mem, vq->used));
 
 	if (vq->last_used_idx != vq->used->idx) {
 		VHOST_LOG_CONFIG(dev->ifname, WARNING,
@@ -1274,7 +1274,7 @@ vhost_user_mmap_region(struct virtio_net *dev,
 	region->mmap_addr = mmap_addr;
 	region->mmap_size = mmap_size;
 	region->host_user_addr = (uint64_t)(uintptr_t)mmap_addr + mmap_offset;
-	mem_set_dump(mmap_addr, mmap_size, false, alignment);
+	mem_set_dump(dev, mmap_addr, mmap_size, false, alignment);
 
 	if (dev->async_copy) {
 		if (add_guest_pages(dev, region, alignment) < 0) {
@@ -1580,7 +1580,7 @@ inflight_mem_alloc(struct virtio_net *dev, const char *name, size_t size, int *f
 	}
 
 	alignment = get_blk_size(mfd);
-	mem_set_dump(ptr, size, false, alignment);
+	mem_set_dump(dev, ptr, size, false, alignment);
 	*fd = mfd;
 	return ptr;
 }
@@ -1789,7 +1789,7 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev,
 		dev->inflight_info->fd = -1;
 	}
 
-	mem_set_dump(addr, mmap_size, false, get_blk_size(fd));
+	mem_set_dump(dev, addr, mmap_size, false, get_blk_size(fd));
 	dev->inflight_info->fd = fd;
 	dev->inflight_info->addr = addr;
 	dev->inflight_info->size = mmap_size;
@@ -2343,7 +2343,7 @@ vhost_user_set_log_base(struct virtio_net **pdev,
 	dev->log_addr = (uint64_t)(uintptr_t)addr;
 	dev->log_base = dev->log_addr + off;
 	dev->log_size = size;
-	mem_set_dump(addr, size + off, false, alignment);
+	mem_set_dump(dev, addr, size + off, false, alignment);
 
 	for (i = 0; i < dev->nr_vring; i++) {
 		struct vhost_virtqueue *vq = dev->virtqueue[i];
Signature · 1 line
2.43.0
#116 lore raw

PATCH v5 11/13 log: add a per line log helper

In reply to David Marchand

gcc builtin __builtin_strchr can be used as a static assertion to check whether passed format strings contain a \n.
This can be useful to detect double \n in log messages.

---
Changes since v4:
- fixed build with -pedantic,

Changes since v3:
- fixed some checkpatch complaints,

Changes since RFC v1:
- added a check in checkpatches.sh,

---
 devtools/checkpatches.sh |  8 ++++++++
 lib/log/rte_log.h        | 21 +++++++++++++++++++++
 2 files changed, 29 insertions(+)
devtools/checkpatches.sh +8 -0
index 10b79ca2bc..10d1bf490b 100755
@@ -53,6 +53,14 @@ print_usage () {
 check_forbidden_additions() { # <patch>
 	res=0
 
+	# refrain from new calls to RTE_LOG
+	awk -v FOLDERS="lib" \
+		-v EXPRESSIONS="RTE_LOG\\\(" \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Prefer RTE_LOG_LINE' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# refrain from new additions of rte_panic() and rte_exit()
 	# multiple folders and expressions are separated by spaces
 	awk -v FOLDERS="lib drivers" \
lib/log/rte_log.h +21 -0
index 3394746103..5ba198ba24 100644
@@ -17,6 +17,7 @@
 extern "C" {
 #endif
 
+#include <assert.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdarg.h>
@@ -358,6 +359,26 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
 		 RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) :	\
 	 0)
 
+#if defined(RTE_TOOLCHAIN_GCC) && !defined(PEDANTIC)
+#define RTE_LOG_CHECK_NO_NEWLINE(fmt) \
+	static_assert(!__builtin_strchr(fmt, '\n'), \
+		"This log format string contains a \\n")
+#else
+#define RTE_LOG_CHECK_NO_NEWLINE(...)
+#endif
+
+#define RTE_LOG_LINE(l, t, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
+	RTE_LOG(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
+#define RTE_LOG_DP_LINE(l, t, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
+	RTE_LOG_DP(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
 #define RTE_LOG_REGISTER_IMPL(type, name, level)			    \
 int type;								    \
 RTE_INIT(__##type)							    \
Signature · 1 line
2.43.0
#117 lore raw

Re: [PATCH v5 11/13] log: add a per line log helper

Quoted 11 lines · David Marchand

gcc builtin __builtin_strchr can be used as a static assertion to check whether passed format strings contain a \n.
This can be useful to detect double \n in log messages.

---
Changes since v4:
- fixed build with -pedantic,

Unfortunately, upon testing, clang does not support constant expression folding in (Ubuntu 20.04 and Fedora 37 at least) older versions.
So we may manage to make this check work with clang, but that's for the future.

Signature · 1 line
David Marchand
#118 lore raw

PATCH v5 12/13 lib: replace logging helpers

In reply to David Marchand

This is a preparation step before the next change.

Many libraries have their own logging helpers that do not add a newline in their format string.
Some previous changes fixed places where some of those helpers are called without a trailing newline.
Using RTE_LOG_LINE in the existing helpers will ensure we don't introduce new issues in the future.

The problem is that if we simply convert to the RTE_LOG_LINE helper, a future fix may introduce a regression since the logging helper change won't be backported.

To address this concern, rename existing helpers: backporting a call to them will trigger some conflict or build issue in LTS branches.

Note:
- bpf and vhost that still has some debug multilines messages, a direct call to RTE_LOG/RTE_LOG_DP is used: this will make it easier to notice such special cases,
- about previously publicly exposed logging helpers, when such helper is not publicly used (iow in public inline API), it is removed from the public API (this is the case for the member library),

---
Changes since RFC v2:
- kept a RTE_ prefix for bpf log macro to avoid potential collision with external code,

---
 lib/bpf/bpf.c                        |   2 +-
 lib/bpf/bpf_convert.c                |  16 +-
 lib/bpf/bpf_exec.c                   |  12 +-
 lib/bpf/bpf_impl.h                   |   5 +-
 lib/bpf/bpf_jit_arm64.c              |   8 +-
 lib/bpf/bpf_jit_x86.c                |   4 +-
 lib/bpf/bpf_load.c                   |   2 +-
 lib/bpf/bpf_load_elf.c               |  24 +-
 lib/bpf/bpf_pkt.c                    |   4 +-
 lib/bpf/bpf_stub.c                   |   4 +-
 lib/bpf/bpf_validate.c               |  38 +-
 lib/ethdev/ethdev_driver.c           |  44 +-
 lib/ethdev/ethdev_pci.h              |   2 +-
 lib/ethdev/ethdev_private.c          |  10 +-
 lib/ethdev/rte_class_eth.c           |   2 +-
 lib/ethdev/rte_ethdev.c              | 878 +++++++++++++--------------
 lib/ethdev/rte_ethdev.h              |  52 +-
 lib/ethdev/rte_ethdev_cman.c         |  16 +-
 lib/ethdev/rte_ethdev_telemetry.c    |  44 +-
 lib/ethdev/rte_flow.c                |  64 +-
 lib/ethdev/rte_flow.h                |   3 -
 lib/ethdev/sff_telemetry.c           |  30 +-
 lib/member/member.h                  |  14 +
 lib/member/rte_member.c              |  15 +-
 lib/member/rte_member.h              |   9 -
 lib/member/rte_member_heap.h         |  39 +-
 lib/member/rte_member_ht.c           |  13 +-
 lib/member/rte_member_sketch.c       |  41 +-
 lib/member/rte_member_vbf.c          |   9 +-
 lib/pdump/rte_pdump.c                | 112 ++--
 lib/power/power_acpi_cpufreq.c       |  10 +-
 lib/power/power_amd_pstate_cpufreq.c |  12 +-
 lib/power/power_common.c             |   4 +-
 lib/power/power_common.h             |   6 +-
 lib/power/power_cppc_cpufreq.c       |  12 +-
 lib/power/power_intel_uncore.c       |   4 +-
 lib/power/power_pstate_cpufreq.c     |  12 +-
 lib/regexdev/rte_regexdev.c          |  86 +--
 lib/regexdev/rte_regexdev.h          |  14 +-
 lib/telemetry/telemetry.c            |  41 +-
 lib/vhost/iotlb.c                    |  18 +-
 lib/vhost/socket.c                   | 102 ++--
 lib/vhost/vdpa.c                     |   8 +-
 lib/vhost/vduse.c                    | 120 ++--
 lib/vhost/vduse.h                    |   4 +-
 lib/vhost/vhost.c                    | 118 ++--
 lib/vhost/vhost.h                    |  22 +-
 lib/vhost/vhost_user.c               | 508 ++++++++--------
 lib/vhost/virtio_net.c               | 188 +++---
 lib/vhost/virtio_net_ctrl.c          |  38 +-
 50 files changed, 1429 insertions(+), 1414 deletions(-)
 create mode 100644 lib/member/member.h
lib/bpf/bpf.c +1 -1
index 8a0254d8bb..bbe75c8bfe 100644
@@ -44,7 +44,7 @@ __rte_bpf_jit(struct rte_bpf *bpf)
 #endif
 
 	if (rc != 0)
-		RTE_BPF_LOG(WARNING, "%s(%p) failed, error code: %d;\n",
+		RTE_BPF_LOG_LINE(WARNING, "%s(%p) failed, error code: %d;",
 			__func__, bpf, rc);
 	return rc;
 }
lib/bpf/bpf_convert.c +8 -8
index d441be6663..d7ff2b4325 100644
@@ -226,8 +226,8 @@ static bool convert_bpf_load(const struct bpf_insn *fp,
 	case SKF_AD_OFF + SKF_AD_RANDOM:
 	case SKF_AD_OFF + SKF_AD_ALU_XOR_X:
 		/* Linux has special negative offsets to access meta-data. */
-		RTE_BPF_LOG(ERR,
-			    "rte_bpf_convert: socket offset %d not supported\n",
+		RTE_BPF_LOG_LINE(ERR,
+			    "rte_bpf_convert: socket offset %d not supported",
 			    fp->k - SKF_AD_OFF);
 		return true;
 	default:
@@ -246,7 +246,7 @@ static int bpf_convert_filter(const struct bpf_insn *prog, size_t len,
 	uint8_t bpf_src;
 
 	if (len > BPF_MAXINSNS) {
-		RTE_BPF_LOG(ERR, "%s: cBPF program too long (%zu insns)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s: cBPF program too long (%zu insns)",
 			    __func__, len);
 		return -EINVAL;
 	}
@@ -482,7 +482,7 @@ static int bpf_convert_filter(const struct bpf_insn *prog, size_t len,
 
 			/* Unknown instruction. */
 		default:
-			RTE_BPF_LOG(ERR, "%s: Unknown instruction!: %#x\n",
+			RTE_BPF_LOG_LINE(ERR, "%s: Unknown instruction!: %#x",
 				    __func__, fp->code);
 			goto err;
 		}
@@ -526,7 +526,7 @@ rte_bpf_convert(const struct bpf_program *prog)
 	int ret;
 
 	if (prog == NULL) {
-		RTE_BPF_LOG(ERR, "%s: NULL program\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: NULL program", __func__);
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -534,12 +534,12 @@ rte_bpf_convert(const struct bpf_program *prog)
 	/* 1st pass: calculate the eBPF program length */
 	ret = bpf_convert_filter(prog->bf_insns, prog->bf_len, NULL, &ebpf_len);
 	if (ret < 0) {
-		RTE_BPF_LOG(ERR, "%s: cannot get eBPF length\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: cannot get eBPF length", __func__);
 		rte_errno = -ret;
 		return NULL;
 	}
 
-	RTE_BPF_LOG(DEBUG, "%s: prog len cBPF=%u -> eBPF=%u\n",
+	RTE_BPF_LOG_LINE(DEBUG, "%s: prog len cBPF=%u -> eBPF=%u",
 		    __func__, prog->bf_len, ebpf_len);
 
 	prm = rte_zmalloc("bpf_filter",
@@ -555,7 +555,7 @@ rte_bpf_convert(const struct bpf_program *prog)
 	/* 2nd pass: remap cBPF to eBPF instructions  */
 	ret = bpf_convert_filter(prog->bf_insns, prog->bf_len, ebpf, &ebpf_len);
 	if (ret < 0) {
-		RTE_BPF_LOG(ERR, "%s: cannot convert cBPF to eBPF\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: cannot convert cBPF to eBPF", __func__);
 		free(prm);
 		rte_errno = -ret;
 		return NULL;
lib/bpf/bpf_exec.c +6 -6
index 09f4a9a571..5d597ec170 100644
@@ -43,8 +43,8 @@
 
 #define BPF_DIV_ZERO_CHECK(bpf, reg, ins, type) do { \
 	if ((type)(reg)[(ins)->src_reg] == 0) { \
-		RTE_BPF_LOG(ERR, \
-			"%s(%p): division by 0 at pc: %#zx;\n", \
+		RTE_BPF_LOG_LINE(ERR, \
+			"%s(%p): division by 0 at pc: %#zx;", \
 			__func__, bpf, \
 			(uintptr_t)(ins) - (uintptr_t)(bpf)->prm.ins); \
 		return 0; \
@@ -136,8 +136,8 @@ bpf_ld_mbuf(const struct rte_bpf *bpf, uint64_t reg[EBPF_REG_NUM],
 	mb = (const struct rte_mbuf *)(uintptr_t)reg[EBPF_REG_6];
 	p = rte_pktmbuf_read(mb, off, len, reg + EBPF_REG_0);
 	if (p == NULL)
-		RTE_BPF_LOG(DEBUG, "%s(bpf=%p, mbuf=%p, ofs=%u, len=%u): "
-			"load beyond packet boundary at pc: %#zx;\n",
+		RTE_BPF_LOG_LINE(DEBUG, "%s(bpf=%p, mbuf=%p, ofs=%u, len=%u): "
+			"load beyond packet boundary at pc: %#zx;",
 			__func__, bpf, mb, off, len,
 			(uintptr_t)(ins) - (uintptr_t)(bpf)->prm.ins);
 	return p;
@@ -462,8 +462,8 @@ bpf_exec(const struct rte_bpf *bpf, uint64_t reg[EBPF_REG_NUM])
 		case (BPF_JMP | EBPF_EXIT):
 			return reg[EBPF_REG_0];
 		default:
-			RTE_BPF_LOG(ERR,
-				"%s(%p): invalid opcode %#x at pc: %#zx;\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"%s(%p): invalid opcode %#x at pc: %#zx;",
 				__func__, bpf, ins->code,
 				(uintptr_t)ins - (uintptr_t)bpf->prm.ins);
 			return 0;
lib/bpf/bpf_impl.h +3 -2
index b483569071..6a82ae4ef2 100644
@@ -27,9 +27,10 @@ int __rte_bpf_jit_x86(struct rte_bpf *bpf);
 int __rte_bpf_jit_arm64(struct rte_bpf *bpf);
 
 extern int rte_bpf_logtype;
+#define RTE_LOGTYPE_BPF rte_bpf_logtype
 
-#define	RTE_BPF_LOG(lvl, fmt, args...) \
-	rte_log(RTE_LOG_## lvl, rte_bpf_logtype, fmt, ##args)
+#define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
+	RTE_LOG(lvl, BPF, fmt "\n", ##args)
 
 static inline size_t
 bpf_size(uint32_t bpf_op_sz)
lib/bpf/bpf_jit_arm64.c +4 -4
index f9ddafd7dc..96b8cd2e03 100644
@@ -98,8 +98,8 @@ check_invalid_args(struct a64_jit_ctx *ctx, uint32_t limit)
 
 	for (idx = 0; idx < limit; idx++) {
 		if (rte_le_to_cpu_32(ctx->ins[idx]) == A64_INVALID_OP_CODE) {
-			RTE_BPF_LOG(ERR,
-				"%s: invalid opcode at %u;\n", __func__, idx);
+			RTE_BPF_LOG_LINE(ERR,
+				"%s: invalid opcode at %u;", __func__, idx);
 			return -EINVAL;
 		}
 	}
@@ -1378,8 +1378,8 @@ emit(struct a64_jit_ctx *ctx, struct rte_bpf *bpf)
 			emit_epilogue(ctx);
 			break;
 		default:
-			RTE_BPF_LOG(ERR,
-				"%s(%p): invalid opcode %#x at pc: %u;\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"%s(%p): invalid opcode %#x at pc: %u;",
 				__func__, bpf, ins->code, i);
 			return -EINVAL;
 		}
lib/bpf/bpf_jit_x86.c +2 -2
index a73b2006db..4d74e418f8 100644
@@ -1476,8 +1476,8 @@ emit(struct bpf_jit_state *st, const struct rte_bpf *bpf)
 			emit_epilog(st);
 			break;
 		default:
-			RTE_BPF_LOG(ERR,
-				"%s(%p): invalid opcode %#x at pc: %u;\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"%s(%p): invalid opcode %#x at pc: %u;",
 				__func__, bpf, ins->code, i);
 			return -EINVAL;
 		}
lib/bpf/bpf_load.c +1 -1
index 45ce9210da..de43347405 100644
@@ -98,7 +98,7 @@ rte_bpf_load(const struct rte_bpf_prm *prm)
 
 	if (rc != 0) {
 		rte_errno = -rc;
-		RTE_BPF_LOG(ERR, "%s: %d-th xsym is invalid\n", __func__, i);
+		RTE_BPF_LOG_LINE(ERR, "%s: %d-th xsym is invalid", __func__, i);
 		return NULL;
 	}
 
lib/bpf/bpf_load_elf.c +12 -12
index 02a5d8ba0d..e0abd3c856 100644
@@ -84,8 +84,8 @@ resolve_xsym(const char *sn, size_t ofs, struct ebpf_insn *ins, size_t ins_sz,
 		 * as an ordinary EBPF_CALL.
 		 */
 		if (ins[idx].src_reg == EBPF_PSEUDO_CALL) {
-			RTE_BPF_LOG(INFO, "%s(%u): "
-				"EBPF_PSEUDO_CALL to external function: %s\n",
+			RTE_BPF_LOG_LINE(INFO, "%s(%u): "
+				"EBPF_PSEUDO_CALL to external function: %s",
 				__func__, idx, sn);
 			ins[idx].src_reg = EBPF_REG_0;
 		}
@@ -121,7 +121,7 @@ check_elf_header(const Elf64_Ehdr *eh)
 		err = "unexpected machine type";
 
 	if (err != NULL) {
-		RTE_BPF_LOG(ERR, "%s(): %s\n", __func__, err);
+		RTE_BPF_LOG_LINE(ERR, "%s(): %s", __func__, err);
 		return -EINVAL;
 	}
 
@@ -144,7 +144,7 @@ find_elf_code(Elf *elf, const char *section, Elf_Data **psd, size_t *pidx)
 	eh = elf64_getehdr(elf);
 	if (eh == NULL) {
 		rc = elf_errno();
-		RTE_BPF_LOG(ERR, "%s(%p, %s) error code: %d(%s)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p, %s) error code: %d(%s)",
 			__func__, elf, section, rc, elf_errmsg(rc));
 		return -EINVAL;
 	}
@@ -167,7 +167,7 @@ find_elf_code(Elf *elf, const char *section, Elf_Data **psd, size_t *pidx)
 	if (sd == NULL || sd->d_size == 0 ||
 			sd->d_size % sizeof(struct ebpf_insn) != 0) {
 		rc = elf_errno();
-		RTE_BPF_LOG(ERR, "%s(%p, %s) error code: %d(%s)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p, %s) error code: %d(%s)",
 			__func__, elf, section, rc, elf_errmsg(rc));
 		return -EINVAL;
 	}
@@ -216,8 +216,8 @@ process_reloc(Elf *elf, size_t sym_idx, Elf64_Rel *re, size_t re_sz,
 
 		rc = resolve_xsym(sn, ofs, ins, ins_sz, prm);
 		if (rc != 0) {
-			RTE_BPF_LOG(ERR,
-				"resolve_xsym(%s, %zu) error code: %d\n",
+			RTE_BPF_LOG_LINE(ERR,
+				"resolve_xsym(%s, %zu) error code: %d",
 				sn, ofs, rc);
 			return rc;
 		}
@@ -309,7 +309,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 	fd = open(fname, O_RDONLY);
 	if (fd < 0) {
 		rc = errno;
-		RTE_BPF_LOG(ERR, "%s(%s) error code: %d(%s)\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%s) error code: %d(%s)",
 			__func__, fname, rc, strerror(rc));
 		rte_errno = EINVAL;
 		return NULL;
@@ -319,15 +319,15 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 	close(fd);
 
 	if (bpf == NULL) {
-		RTE_BPF_LOG(ERR,
+		RTE_BPF_LOG_LINE(ERR,
 			"%s(fname=\"%s\", sname=\"%s\") failed, "
-			"error code: %d\n",
+			"error code: %d",
 			__func__, fname, sname, rte_errno);
 		return NULL;
 	}
 
-	RTE_BPF_LOG(INFO, "%s(fname=\"%s\", sname=\"%s\") "
-		"successfully creates %p(jit={.func=%p,.sz=%zu});\n",
+	RTE_BPF_LOG_LINE(INFO, "%s(fname=\"%s\", sname=\"%s\") "
+		"successfully creates %p(jit={.func=%p,.sz=%zu});",
 		__func__, fname, sname, bpf, bpf->jit.func, bpf->jit.sz);
 	return bpf;
 }
lib/bpf/bpf_pkt.c +2 -2
index 7a8e4a6ef4..793a75ded9 100644
@@ -512,7 +512,7 @@ bpf_eth_elf_load(struct bpf_eth_cbh *cbh, uint16_t port, uint16_t queue,
 		ftx = select_tx_callback(prm->prog_arg.type, flags);
 
 	if (frx == NULL && ftx == NULL) {
-		RTE_BPF_LOG(ERR, "%s(%u, %u): no callback selected;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%u, %u): no callback selected;",
 			__func__, port, queue);
 		return -EINVAL;
 	}
@@ -524,7 +524,7 @@ bpf_eth_elf_load(struct bpf_eth_cbh *cbh, uint16_t port, uint16_t queue,
 	rte_bpf_get_jit(bpf, &jit);
 
 	if ((flags & RTE_BPF_ETH_F_JIT) != 0 && jit.func == NULL) {
-		RTE_BPF_LOG(ERR, "%s(%u, %u): no JIT generated;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%u, %u): no JIT generated;",
 			__func__, port, queue);
 		rte_bpf_destroy(bpf);
 		return -ENOTSUP;
lib/bpf/bpf_stub.c +2 -2
index 83c2203622..1babb16bde 100644
@@ -19,7 +19,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 		return NULL;
 	}
 
-	RTE_BPF_LOG(ERR, "%s() is not supported, rebuild with libelf installed\n",
+	RTE_BPF_LOG_LINE(ERR, "%s() is not supported, rebuild with libelf installed",
 		__func__);
 	rte_errno = ENOTSUP;
 	return NULL;
@@ -35,7 +35,7 @@ rte_bpf_convert(const struct bpf_program *prog)
 		return NULL;
 	}
 
-	RTE_BPF_LOG(ERR, "%s() is not supported, rebuild with libpcap installed\n",
+	RTE_BPF_LOG_LINE(ERR, "%s() is not supported, rebuild with libpcap installed",
 		__func__);
 	rte_errno = ENOTSUP;
 	return NULL;
lib/bpf/bpf_validate.c +19 -19
index f246b3c5eb..79be5e917d 100644
@@ -1812,15 +1812,15 @@ add_edge(struct bpf_verifier *bvf, struct inst_node *node, uint32_t nidx)
 	uint32_t ne;
 
 	if (nidx > bvf->prm->nb_ins) {
-		RTE_BPF_LOG(ERR, "%s: program boundary violation at pc: %u, "
-			"next pc: %u\n",
+		RTE_BPF_LOG_LINE(ERR, "%s: program boundary violation at pc: %u, "
+			"next pc: %u",
 			__func__, get_node_idx(bvf, node), nidx);
 		return -EINVAL;
 	}
 
 	ne = node->nb_edge;
 	if (ne >= RTE_DIM(node->edge_dest)) {
-		RTE_BPF_LOG(ERR, "%s: internal error at pc: %u\n",
+		RTE_BPF_LOG_LINE(ERR, "%s: internal error at pc: %u",
 			__func__, get_node_idx(bvf, node));
 		return -EINVAL;
 	}
@@ -1927,7 +1927,7 @@ log_unreachable(const struct bpf_verifier *bvf)
 
 		if (node->colour == WHITE &&
 				ins->code != (BPF_LD | BPF_IMM | EBPF_DW))
-			RTE_BPF_LOG(ERR, "unreachable code at pc: %u;\n", i);
+			RTE_BPF_LOG_LINE(ERR, "unreachable code at pc: %u;", i);
 	}
 }
 
@@ -1948,8 +1948,8 @@ log_loop(const struct bpf_verifier *bvf)
 
 		for (j = 0; j != node->nb_edge; j++) {
 			if (node->edge_type[j] == BACK_EDGE)
-				RTE_BPF_LOG(ERR,
-					"loop at pc:%u --> pc:%u;\n",
+				RTE_BPF_LOG_LINE(ERR,
+					"loop at pc:%u --> pc:%u;",
 					i, node->edge_dest[j]);
 		}
 	}
@@ -1979,7 +1979,7 @@ validate(struct bpf_verifier *bvf)
 
 		err = check_syntax(ins);
 		if (err != 0) {
-			RTE_BPF_LOG(ERR, "%s: %s at pc: %u\n",
+			RTE_BPF_LOG_LINE(ERR, "%s: %s at pc: %u",
 				__func__, err, i);
 			rc |= -EINVAL;
 		}
@@ -2048,7 +2048,7 @@ validate(struct bpf_verifier *bvf)
 
 	dfs(bvf);
 
-	RTE_BPF_LOG(DEBUG, "%s(%p) stats:\n"
+	RTE_LOG(DEBUG, BPF, "%s(%p) stats:\n"
 		"nb_nodes=%u;\n"
 		"nb_jcc_nodes=%u;\n"
 		"node_color={[WHITE]=%u, [GREY]=%u,, [BLACK]=%u};\n"
@@ -2062,7 +2062,7 @@ validate(struct bpf_verifier *bvf)
 		bvf->edge_type[BACK_EDGE], bvf->edge_type[CROSS_EDGE]);
 
 	if (bvf->node_colour[BLACK] != bvf->nb_nodes) {
-		RTE_BPF_LOG(ERR, "%s(%p) unreachable instructions;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p) unreachable instructions;",
 			__func__, bvf);
 		log_unreachable(bvf);
 		return -EINVAL;
@@ -2070,13 +2070,13 @@ validate(struct bpf_verifier *bvf)
 
 	if (bvf->node_colour[GREY] != 0 || bvf->node_colour[WHITE] != 0 ||
 			bvf->edge_type[UNKNOWN_EDGE] != 0) {
-		RTE_BPF_LOG(ERR, "%s(%p) DFS internal error;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p) DFS internal error;",
 			__func__, bvf);
 		return -EINVAL;
 	}
 
 	if (bvf->edge_type[BACK_EDGE] != 0) {
-		RTE_BPF_LOG(ERR, "%s(%p) loops detected;\n",
+		RTE_BPF_LOG_LINE(ERR, "%s(%p) loops detected;",
 			__func__, bvf);
 		log_loop(bvf);
 		return -EINVAL;
@@ -2144,8 +2144,8 @@ save_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 	/* get new eval_state for this node */
 	st = pull_eval_state(bvf);
 	if (st == NULL) {
-		RTE_BPF_LOG(ERR,
-			"%s: internal error (out of space) at pc: %u\n",
+		RTE_BPF_LOG_LINE(ERR,
+			"%s: internal error (out of space) at pc: %u",
 			__func__, get_node_idx(bvf, node));
 		return -ENOMEM;
 	}
@@ -2157,7 +2157,7 @@ save_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 	node->evst = bvf->evst;
 	bvf->evst = st;
 
-	RTE_BPF_LOG(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;\n",
+	RTE_BPF_LOG_LINE(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;",
 		__func__, bvf, get_node_idx(bvf, node), node->evst, bvf->evst);
 
 	return 0;
@@ -2169,7 +2169,7 @@ save_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 static void
 restore_eval_state(struct bpf_verifier *bvf, struct inst_node *node)
 {
-	RTE_BPF_LOG(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;\n",
+	RTE_BPF_LOG_LINE(DEBUG, "%s(bvf=%p,node=%u) old/new states: %p/%p;",
 		__func__, bvf, get_node_idx(bvf, node), bvf->evst, node->evst);
 
 	bvf->evst = node->evst;
@@ -2184,12 +2184,12 @@ log_dbg_eval_state(const struct bpf_verifier *bvf, const struct ebpf_insn *ins,
 	const struct bpf_eval_state *st;
 	const struct bpf_reg_val *rv;
 
-	RTE_BPF_LOG(DEBUG, "%s(pc=%u):\n", __func__, pc);
+	RTE_BPF_LOG_LINE(DEBUG, "%s(pc=%u):", __func__, pc);
 
 	st = bvf->evst;
 	rv = st->rv + ins->dst_reg;
 
-	RTE_BPF_LOG(DEBUG,
+	RTE_LOG(DEBUG, BPF,
 		"r%u={\n"
 		"\tv={type=%u, size=%zu},\n"
 		"\tmask=0x%" PRIx64 ",\n"
@@ -2263,7 +2263,7 @@ evaluate(struct bpf_verifier *bvf)
 			if (ins_chk[op].eval != NULL && rc == 0) {
 				err = ins_chk[op].eval(bvf, ins + idx);
 				if (err != NULL) {
-					RTE_BPF_LOG(ERR, "%s: %s at pc: %u\n",
+					RTE_BPF_LOG_LINE(ERR, "%s: %s at pc: %u",
 						__func__, err, idx);
 					rc = -EINVAL;
 				}
@@ -2312,7 +2312,7 @@ __rte_bpf_validate(struct rte_bpf *bpf)
 			bpf->prm.prog_arg.type != RTE_BPF_ARG_PTR &&
 			(sizeof(uint64_t) != sizeof(uintptr_t) ||
 			bpf->prm.prog_arg.type != RTE_BPF_ARG_PTR_MBUF)) {
-		RTE_BPF_LOG(ERR, "%s: unsupported argument type\n", __func__);
+		RTE_BPF_LOG_LINE(ERR, "%s: unsupported argument type", __func__);
 		return -ENOTSUP;
 	}
 
lib/ethdev/ethdev_driver.c +22 -22

132 lines not on this page · raw message

lib/ethdev/ethdev_pci.h +1 -1
index ddb559aa95..737fff1833 100644
@@ -31,7 +31,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
 	struct rte_pci_device *pci_dev)
 {
 	if ((eth_dev == NULL) || (pci_dev == NULL)) {
-		RTE_ETHDEV_LOG(ERR, "NULL pointer eth_dev=%p pci_dev=%p\n",
+		RTE_ETHDEV_LOG_LINE(ERR, "NULL pointer eth_dev=%p pci_dev=%p",
 			(void *)eth_dev, (void *)pci_dev);
 		return;
 	}
lib/ethdev/ethdev_private.c +5 -5
index 0e1c7b23c1..a656df293c 100644
@@ -182,7 +182,7 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)
 		RTE_DIM(eth_da->representor_ports));
 done:
 	if (str == NULL)
-		RTE_ETHDEV_LOG(ERR, "wrong representor format: %s\n", str);
+		RTE_ETHDEV_LOG_LINE(ERR, "wrong representor format: %s", str);
 	return str == NULL ? -1 : 0;
 }
 
@@ -214,7 +214,7 @@ dummy_eth_rx_burst(void *rxq,
 
 	port_id = queue - per_port_queues;
 	if (port_id < RTE_DIM(per_port_queues) && !queue->rx_warn_once) {
-		RTE_ETHDEV_LOG(ERR, "lcore %u called rx_pkt_burst for not ready port %"PRIuPTR"\n",
+		RTE_ETHDEV_LOG_LINE(ERR, "lcore %u called rx_pkt_burst for not ready port %"PRIuPTR,
 			rte_lcore_id(), port_id);
 		rte_dump_stack();
 		queue->rx_warn_once = true;
@@ -233,7 +233,7 @@ dummy_eth_tx_burst(void *txq,
 
 	port_id = queue - per_port_queues;
 	if (port_id < RTE_DIM(per_port_queues) && !queue->tx_warn_once) {
-		RTE_ETHDEV_LOG(ERR, "lcore %u called tx_pkt_burst for not ready port %"PRIuPTR"\n",
+		RTE_ETHDEV_LOG_LINE(ERR, "lcore %u called tx_pkt_burst for not ready port %"PRIuPTR,
 			rte_lcore_id(), port_id);
 		rte_dump_stack();
 		queue->tx_warn_once = true;
@@ -337,7 +337,7 @@ eth_dev_shared_data_prepare(void)
 				sizeof(*eth_dev_shared_data),
 				rte_socket_id(), flags);
 		if (mz == NULL) {
-			RTE_ETHDEV_LOG(ERR, "Cannot allocate ethdev shared data\n");
+			RTE_ETHDEV_LOG_LINE(ERR, "Cannot allocate ethdev shared data");
 			goto out;
 		}
 
@@ -355,7 +355,7 @@ eth_dev_shared_data_prepare(void)
 			/* Clean remaining any traces of a previous shared mem */
 			eth_dev_shared_mz = NULL;
 			eth_dev_shared_data = NULL;
-			RTE_ETHDEV_LOG(ERR, "Cannot lookup ethdev shared data\n");
+			RTE_ETHDEV_LOG_LINE(ERR, "Cannot lookup ethdev shared data");
 			goto out;
 		}
 		if (mz == eth_dev_shared_mz && mz->addr == eth_dev_shared_data)
lib/ethdev/rte_class_eth.c +1 -1
index 311beb17cb..bc003db8af 100644
@@ -165,7 +165,7 @@ eth_dev_iterate(const void *start,
 			valid_keys = eth_params_keys;
 		kvargs = rte_kvargs_parse(str, valid_keys);
 		if (kvargs == NULL) {
-			RTE_ETHDEV_LOG(ERR, "cannot parse argument list\n");
+			RTE_ETHDEV_LOG_LINE(ERR, "cannot parse argument list");
 			rte_errno = EINVAL;
 			return NULL;
 		}
lib/ethdev/rte_ethdev.c +439 -439

2,395 lines not on this page · raw message

lib/ethdev/rte_ethdev.h +27 -25

39 lines not on this page · raw message

lib/ethdev/rte_ethdev_cman.c +8 -8
index a9c4637521..41e38bdc89 100644

Lines of this file are not shown. View the raw message.

lib/ethdev/rte_ethdev_telemetry.c +22 -22

44 lines not on this page · raw message

lib/ethdev/rte_flow.c +33 -31

64 lines not on this page · raw message

lib/ethdev/rte_flow.h +0 -3
index affdc8121b..78b6bbb159 100644

Lines of this file are not shown. View the raw message.

lib/ethdev/sff_telemetry.c +15 -15
index f29e7fa882..b3f239d967 100644

Lines of this file are not shown. View the raw message.

lib/member/member.h new file +14 -0
new file mode 100644
index 0000000000..a7b5b4a57c

Lines of this file are not shown. View the raw message.

lib/member/rte_member.c +8 -7
index 8f859f7fbd..57eb7affab 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member.h +0 -9
index b585904368..3278bbb5c1 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member_heap.h +20 -19
index 9c4a01aebe..e0a3d54eab 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member_ht.c +7 -6
index a85561b472..357097ff4b 100644

Lines of this file are not shown. View the raw message.

lib/member/rte_member_sketch.c +21 -20

41 lines not on this page · raw message

lib/member/rte_member_vbf.c +5 -4
index 5a0c51ecc0..5ad9487fad 100644

Lines of this file are not shown. View the raw message.

lib/pdump/rte_pdump.c +56 -56

112 lines not on this page · raw message

lib/power/power_acpi_cpufreq.c +5 -5
index 416d1fb6da..f8d978d03d 100644

Lines of this file are not shown. View the raw message.

lib/power/power_amd_pstate_cpufreq.c +6 -6
index 67e3aa735a..028f84416b 100644

Lines of this file are not shown. View the raw message.

lib/power/power_common.c +2 -2
index 5d6c4291de..590986d5ef 100644

Lines of this file are not shown. View the raw message.

lib/power/power_common.h +3 -3
index 4302370b5e..877ff2ca4c 100644

Lines of this file are not shown. View the raw message.

lib/power/power_cppc_cpufreq.c +6 -6
index dbbd166372..3ddf39bd76 100644

Lines of this file are not shown. View the raw message.

lib/power/power_intel_uncore.c +2 -2
index c5c204c670..3ce8fccec2 100644

Lines of this file are not shown. View the raw message.

lib/power/power_pstate_cpufreq.c +6 -6
index c287ac54f8..73138dc4e4 100644

Lines of this file are not shown. View the raw message.

lib/regexdev/rte_regexdev.c +43 -43

86 lines not on this page · raw message

lib/regexdev/rte_regexdev.h +8 -6
index d50af775b5..a215d8768e 100644

Lines of this file are not shown. View the raw message.

lib/telemetry/telemetry.c +22 -19

41 lines not on this page · raw message

lib/vhost/iotlb.c +9 -9
index 10ab77262e..f2c275a7d7 100644

Lines of this file are not shown. View the raw message.

lib/vhost/socket.c +51 -51

102 lines not on this page · raw message

lib/vhost/vdpa.c +4 -4
index 219eef879c..9776fc07a9 100644

Lines of this file are not shown. View the raw message.

lib/vhost/vduse.c +60 -60

120 lines not on this page · raw message

lib/vhost/vduse.h +2 -2
index 4879b1f900..0d8f3f1205 100644

Lines of this file are not shown. View the raw message.

lib/vhost/vhost.c +59 -59

118 lines not on this page · raw message

lib/vhost/vhost.h +10 -12
index 5f24911190..e0f6dd4081 100644

Lines of this file are not shown. View the raw message.

lib/vhost/vhost_user.c +254 -254

508 lines not on this page · raw message

lib/vhost/virtio_net.c +94 -94

188 lines not on this page · raw message

lib/vhost/virtio_net_ctrl.c +19 -19
index c4847f84ed..8f78122361 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.

#119 lore raw

PATCH v5 13/13 lib: use per line logging in helpers

In reply to David Marchand

Use RTE_LOG_LINE in existing macros that append a \n. This will help catching unwanted newline character or multilines in log messages.

---
Changes since v4:
- converted more helpers,

Changes since v3:
- fixed some checkpatch complaints,

Changes since RFC v1:
- converted all logging helpers in lib/,

---
 lib/acl/acl_log.h                          |  4 ++--
 lib/bbdev/rte_bbdev.c                      |  5 +++--
 lib/bpf/bpf_impl.h                         |  2 +-
 lib/cfgfile/rte_cfgfile.c                  |  4 ++--
 lib/compressdev/rte_compressdev_internal.h |  5 +++--
 lib/cryptodev/rte_cryptodev.h              | 22 ++++++++++------------
 lib/dmadev/rte_dmadev.c                    |  6 ++++--
 lib/eal/common/eal_private.h               |  4 ++--
 lib/eal/windows/include/rte_windows.h      |  6 +++---
 lib/efd/rte_efd.c                          |  4 ++--
 lib/ethdev/rte_ethdev.h                    |  3 +--
 lib/eventdev/eventdev_pmd.h                | 12 ++++++------
 lib/eventdev/rte_event_timer_adapter.c     | 17 ++++++++++-------
 lib/fib/fib_log.h                          |  4 ++--
 lib/gpudev/gpudev.c                        |  6 ++++--
 lib/graph/graph_private.h                  |  7 ++++---
 lib/hash/rte_cuckoo_hash.c                 |  4 ++--
 lib/hash/rte_fbk_hash.c                    |  4 ++--
 lib/hash/rte_hash_crc.c                    |  4 ++--
 lib/hash/rte_thash.c                       |  4 ++--
 lib/hash/rte_thash_gfni.c                  |  4 ++--
 lib/ip_frag/ip_frag_common.h               |  4 ++--
 lib/latencystats/rte_latencystats.c        |  4 ++--
 lib/lpm/lpm_log.h                          |  4 ++--
 lib/mbuf/mbuf_log.h                        |  4 ++--
 lib/member/member.h                        |  4 ++--
 lib/mempool/rte_mempool.h                  |  4 ++--
 lib/metrics/rte_metrics_telemetry.c        |  4 ++--
 lib/mldev/rte_mldev.h                      |  5 +++--
 lib/net/rte_net_crc.c                      |  8 ++++----
 lib/node/node_private.h                    |  8 +++++---
 lib/pdump/rte_pdump.c                      |  5 ++---
 lib/pipeline/rte_pipeline.c                |  4 ++--
 lib/port/port_log.h                        |  4 ++--
 lib/power/guest_channel.c                  |  4 ++--
 lib/power/power_common.h                   |  6 +++---
 lib/rawdev/rte_rawdev_pmd.h                |  4 ++--
 lib/rcu/rte_rcu_qsbr.c                     |  2 +-
 lib/rcu/rte_rcu_qsbr.h                     |  8 +++-----
 lib/regexdev/rte_regexdev.h                |  3 +--
 lib/reorder/rte_reorder.c                  |  4 ++--
 lib/rib/rib_log.h                          |  4 ++--
 lib/ring/rte_ring.c                        |  4 ++--
 lib/sched/rte_sched_log.h                  |  4 ++--
 lib/stack/stack_pvt.h                      |  4 ++--
 lib/table/table_log.h                      |  4 ++--
 lib/telemetry/telemetry.c                  |  4 +---
 lib/vhost/fd_man.c                         |  4 ++--
 lib/vhost/vhost.h                          |  4 ++--
 lib/vhost/vhost_crypto.c                   |  6 +++---
 50 files changed, 133 insertions(+), 129 deletions(-)
lib/acl/acl_log.h +2 -2
index 2d7c376058..d2310401a8 100644
@@ -4,5 +4,5 @@
 
 extern int acl_logtype;
 #define RTE_LOGTYPE_ACL	acl_logtype
-#define ACL_LOG(level, fmt, ...) \
-	RTE_LOG(level, ACL, fmt "\n", ## __VA_ARGS__)
+#define ACL_LOG(level, ...) \
+	RTE_LOG_LINE(level, ACL, "" __VA_ARGS__)
lib/bbdev/rte_bbdev.c +3 -2
index e09bb97abb..13bde3c25b 100644
@@ -28,10 +28,11 @@
 
 /* BBDev library logging ID */
 RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE);
+#define RTE_LOGTYPE_BBDEV bbdev_logtype
 
 /* Helper macro for logging */
-#define rte_bbdev_log(level, fmt, ...) \
-	rte_log(RTE_LOG_ ## level, bbdev_logtype, fmt "\n", ##__VA_ARGS__)
+#define rte_bbdev_log(level, ...) \
+	RTE_LOG_LINE(level, BBDEV, "" __VA_ARGS__)
 
 #define rte_bbdev_log_debug(fmt, ...) \
 	rte_bbdev_log(DEBUG, RTE_STR(__LINE__) ":%s() " fmt, __func__, \
lib/bpf/bpf_impl.h +1 -1
index 6a82ae4ef2..1a3d97d0c7 100644
@@ -30,7 +30,7 @@ extern int rte_bpf_logtype;
 #define RTE_LOGTYPE_BPF rte_bpf_logtype
 
 #define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
-	RTE_LOG(lvl, BPF, fmt "\n", ##args)
+	RTE_LOG_LINE(lvl, BPF, fmt, ##args)
 
 static inline size_t
 bpf_size(uint32_t bpf_op_sz)
lib/cfgfile/rte_cfgfile.c +2 -2
index 2f9cc0722a..6a5e4fd942 100644
@@ -29,10 +29,10 @@ struct rte_cfgfile {
 
 /* Setting up dynamic logging 8< */
 RTE_LOG_REGISTER_DEFAULT(cfgfile_logtype, INFO);
+#define RTE_LOGTYPE_CFGFILE cfgfile_logtype
 
 #define CFG_LOG(level, fmt, args...)					\
-	rte_log(RTE_LOG_ ## level, cfgfile_logtype, "%s(): " fmt "\n",	\
-		__func__, ## args)
+	RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## args)
 /* >8 End of setting up dynamic logging */
 
 /** when we resize a file structure, how many extra entries
lib/compressdev/rte_compressdev_internal.h +3 -2
index b3b193e3ee..01b7764282 100644
@@ -21,9 +21,10 @@ extern "C" {
 
 /* Logging Macros */
 extern int compressdev_logtype;
+#define RTE_LOGTYPE_COMPRESSDEV compressdev_logtype
+
 #define COMPRESSDEV_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, compressdev_logtype, "%s(): " fmt "\n", \
-			__func__, ##args)
+	RTE_LOG_LINE(level, COMPRESSDEV, "%s(): " fmt, __func__, ## args)
 
 /**
  * Dequeue processed packets from queue pair of a device.
lib/cryptodev/rte_cryptodev.h +10 -12
index 30ad2d9a95..359b6c2b29 100644
@@ -36,24 +36,22 @@ extern int rte_cryptodev_logtype;
 
 /* Logging Macros */
 #define CDEV_LOG_ERR(...) \
-	RTE_LOG(ERR, CRYPTODEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(ERR, CRYPTODEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 #define CDEV_LOG_INFO(...) \
-	RTE_LOG(INFO, CRYPTODEV, \
-		RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(INFO, CRYPTODEV, "" __VA_ARGS__)
 
 #define CDEV_LOG_DEBUG(...) \
-	RTE_LOG(DEBUG, CRYPTODEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(DEBUG, CRYPTODEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 #define CDEV_PMD_TRACE(...) \
-	RTE_LOG(DEBUG, CRYPTODEV, \
-		RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			dev, __func__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(DEBUG, CRYPTODEV, \
+		RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			dev, __func__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 /**
  * A macro that points to an offset from the start
lib/dmadev/rte_dmadev.c +4 -2
index 009a21849a..5953a77bd6 100644
@@ -32,9 +32,11 @@ static struct {
 } *dma_devices_shared_data;
 
 RTE_LOG_REGISTER_DEFAULT(rte_dma_logtype, INFO);
+#define RTE_LOGTYPE_DMA rte_dma_logtype
+
 #define RTE_DMA_LOG(level, ...) \
-	rte_log(RTE_LOG_ ## level, rte_dma_logtype, RTE_FMT("dma: " \
-		RTE_FMT_HEAD(__VA_ARGS__,) "\n", RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(level, DMA, RTE_FMT("dma: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+		RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 int
 rte_dma_dev_max(size_t dev_max)
lib/eal/common/eal_private.h +2 -2
index afd87000e7..71523cfdb8 100644
@@ -748,7 +748,7 @@ int eal_asprintf(char **buffer, const char *format, ...);
 		eal_asprintf(buffer, format, ##__VA_ARGS__)
 #endif
 
-#define EAL_LOG(level, fmt, ...) \
-	RTE_LOG(level, EAL, fmt "\n", ## __VA_ARGS__)
+#define EAL_LOG(level, ...) \
+	RTE_LOG_LINE(level, EAL, "" __VA_ARGS__)
 
 #endif /* _EAL_PRIVATE_H_ */
lib/eal/windows/include/rte_windows.h +3 -3
index 83730c3d2e..0b0d117865 100644
@@ -48,9 +48,9 @@ extern "C" {
  * Log GetLastError() with context, usually a Win32 API function and arguments.
  */
 #define RTE_LOG_WIN32_ERR(...) \
-	RTE_LOG(DEBUG, EAL, RTE_FMT("GetLastError()=%lu: " \
-		RTE_FMT_HEAD(__VA_ARGS__,) "\n", GetLastError(), \
-		RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(DEBUG, EAL, RTE_FMT("GetLastError()=%lu: " \
+		RTE_FMT_HEAD(__VA_ARGS__ ,), GetLastError(), \
+		RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 #ifdef __cplusplus
 }
lib/efd/rte_efd.c +2 -2
index cd0d90f328..d3b732f2e8 100644
@@ -31,8 +31,8 @@
 
 RTE_LOG_REGISTER_DEFAULT(efd_logtype, INFO);
 #define RTE_LOGTYPE_EFD	efd_logtype
-#define EFD_LOG(level, fmt, ...) \
-	RTE_LOG(level, EFD, fmt "\n", ## __VA_ARGS__)
+#define EFD_LOG(level, ...) \
+	RTE_LOG_LINE(level, EFD, "" __VA_ARGS__)
 
 #define EFD_KEY(key_idx, table) (table->keys + ((key_idx) * table->key_len))
 /** Hash function used to determine chunk_id and bin_id for a group */
lib/ethdev/rte_ethdev.h +1 -2
index e89e474c39..21e3a21903 100644
@@ -179,8 +179,7 @@ extern int rte_eth_dev_logtype;
 #define RTE_LOGTYPE_ETHDEV rte_eth_dev_logtype
 
 #define RTE_ETHDEV_LOG_LINE(level, ...) \
-	RTE_LOG(level, ETHDEV, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
-		RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE(level, ETHDEV, "" __VA_ARGS__)
 
 struct rte_mbuf;
 
lib/eventdev/eventdev_pmd.h +6 -6
index 2ec5aec0a8..1790587808 100644
@@ -33,15 +33,15 @@ extern "C" {
 
 /* Logging Macros */
 #define RTE_EDEV_LOG_ERR(...) \
-	RTE_LOG(ERR, EVENTDEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(ERR, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
 #define RTE_EDEV_LOG_DEBUG(...) \
-	RTE_LOG(DEBUG, EVENTDEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(DEBUG, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 #else
 #define RTE_EDEV_LOG_DEBUG(...) (void)0
 #endif
lib/eventdev/rte_event_timer_adapter.c +10 -7
index 3f22e85173..e6d3492056 100644
@@ -30,27 +30,30 @@
 #define DATA_MZ_NAME_FORMAT "rte_event_timer_adapter_data_%d"
 
 RTE_LOG_REGISTER_SUFFIX(evtim_logtype, adapter.timer, NOTICE);
+#define RTE_LOGTYPE_EVTIM evtim_logtype
 RTE_LOG_REGISTER_SUFFIX(evtim_buffer_logtype, adapter.timer, NOTICE);
+#define RTE_LOGTYPE_EVTIM_BUF evtim_buffer_logtype
 RTE_LOG_REGISTER_SUFFIX(evtim_svc_logtype, adapter.timer.svc, NOTICE);
+#define RTE_LOGTYPE_EVTIM_SVC evtim_svc_logtype
 
 static struct rte_event_timer_adapter *adapters;
 
 static const struct event_timer_adapter_ops swtim_ops;
 
 #define EVTIM_LOG(level, logtype, ...) \
-	rte_log(RTE_LOG_ ## level, logtype, \
-		RTE_FMT("EVTIMER: %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) \
-			"\n", __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+	RTE_LOG_LINE(level, logtype, \
+		RTE_FMT("EVTIMER: %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
-#define EVTIM_LOG_ERR(...) EVTIM_LOG(ERR, evtim_logtype, __VA_ARGS__)
+#define EVTIM_LOG_ERR(...) EVTIM_LOG(ERR, EVTIM, __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
 #define EVTIM_LOG_DBG(...) \
-	EVTIM_LOG(DEBUG, evtim_logtype, __VA_ARGS__)
+	EVTIM_LOG(DEBUG, EVTIM, __VA_ARGS__)
 #define EVTIM_BUF_LOG_DBG(...) \
-	EVTIM_LOG(DEBUG, evtim_buffer_logtype, __VA_ARGS__)
+	EVTIM_LOG(DEBUG, EVTIM_BUF, __VA_ARGS__)
 #define EVTIM_SVC_LOG_DBG(...) \
-	EVTIM_LOG(DEBUG, evtim_svc_logtype, __VA_ARGS__)
+	EVTIM_LOG(DEBUG, EVTIM_SVC, __VA_ARGS__)
 #else
 #define EVTIM_LOG_DBG(...) (void)0
 #define EVTIM_BUF_LOG_DBG(...) (void)0
lib/fib/fib_log.h +2 -2
index aa901cb344..29ee356c4e 100644
@@ -2,5 +2,5 @@
 
 extern int fib_logtype;
 #define RTE_LOGTYPE_FIB fib_logtype
-#define FIB_LOG(level, fmt, ...) \
-	RTE_LOG(level, FIB, fmt "\n", ## __VA_ARGS__)
+#define FIB_LOG(level, ...) \
+	RTE_LOG_LINE(level, FIB, "" __VA_ARGS__)
lib/gpudev/gpudev.c +4 -2
index 6845d18b4d..de8291151f 100644
@@ -17,9 +17,11 @@
 
 /* Logging */
 RTE_LOG_REGISTER_DEFAULT(gpu_logtype, NOTICE);
+#define RTE_LOGTYPE_GPUDEV gpu_logtype
+
 #define GPU_LOG(level, ...) \
-	rte_log(RTE_LOG_ ## level, gpu_logtype, RTE_FMT("gpu: " \
-		RTE_FMT_HEAD(__VA_ARGS__, ) "\n", RTE_FMT_TAIL(__VA_ARGS__, )))
+	RTE_LOG_LINE(level, GPUDEV, RTE_FMT("gpu: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
+		RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 /* Set any driver error as EPERM */
 #define GPU_DRV_RET(function) \
lib/graph/graph_private.h +4 -3
index d0ef13b205..f9274ce96c 100644
@@ -18,11 +18,12 @@
 #include "rte_graph_worker.h"
 
 extern int rte_graph_logtype;
+#define RTE_LOGTYPE_GRAPH rte_graph_logtype
 
 #define GRAPH_LOG(level, ...)                                                  \
-	rte_log(RTE_LOG_##level, rte_graph_logtype,                            \
-		RTE_FMT("GRAPH: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ) "\n",    \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__, )))
+	RTE_LOG_LINE(level, GRAPH,                                             \
+		RTE_FMT("GRAPH: %s():%u " RTE_FMT_HEAD(__VA_ARGS__ ,),         \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 #define graph_err(...) GRAPH_LOG(ERR, __VA_ARGS__)
 #define graph_warn(...) GRAPH_LOG(WARNING, __VA_ARGS__)
lib/hash/rte_cuckoo_hash.c +2 -2
index a1b5137bfb..70456754c4 100644
@@ -28,8 +28,8 @@
 /* needs to be before rte_cuckoo_hash.h */
 RTE_LOG_REGISTER_DEFAULT(hash_logtype, INFO);
 #define RTE_LOGTYPE_HASH hash_logtype
-#define HASH_LOG(level, fmt, ...) \
-	RTE_LOG(level, HASH, fmt "\n", ## __VA_ARGS__)
+#define HASH_LOG(level, ...) \
+	RTE_LOG_LINE(level, HASH, "" __VA_ARGS__)
 
 #include "rte_cuckoo_hash.h"
 
lib/hash/rte_fbk_hash.c +2 -2
index 681286b946..dacb7e8b09 100644
@@ -21,8 +21,8 @@
 
 RTE_LOG_REGISTER_SUFFIX(fbk_hash_logtype, fbk, INFO);
 #define RTE_LOGTYPE_HASH fbk_hash_logtype
-#define HASH_LOG(level, fmt, ...) \
-	RTE_LOG(level, HASH, fmt "\n", ## __VA_ARGS__)
+#define HASH_LOG(level, ...) \
+	RTE_LOG_LINE(level, HASH, "" __VA_ARGS__)
 
 TAILQ_HEAD(rte_fbk_hash_list, rte_tailq_entry);
 
lib/hash/rte_hash_crc.c +2 -2
index 997ac3c5fa..c037cdb0f0 100644
@@ -9,8 +9,8 @@
 
 RTE_LOG_REGISTER_SUFFIX(hash_crc_logtype, crc, INFO);
 #define RTE_LOGTYPE_HASH_CRC hash_crc_logtype
-#define HASH_CRC_LOG(level, fmt, ...) \
-	RTE_LOG(level, HASH_CRC, fmt "\n", ## __VA_ARGS__)
+#define HASH_CRC_LOG(level, ...) \
+	RTE_LOG_LINE(level, HASH_CRC, "" __VA_ARGS__)
 
 uint8_t rte_hash_crc32_alg = CRC32_SW;
 
lib/hash/rte_thash.c +2 -2
index 3dcae495e9..e8de071ede 100644
@@ -15,8 +15,8 @@
 
 RTE_LOG_REGISTER_SUFFIX(thash_logtype, thash, INFO);
 #define RTE_LOGTYPE_HASH thash_logtype
-#define HASH_LOG(level, fmt, ...) \
-	RTE_LOG(level, HASH, fmt "\n", ## __VA_ARGS__)
+#define HASH_LOG(level, ...) \
+	RTE_LOG_LINE(level, HASH, "" __VA_ARGS__)
 
 #define THASH_NAME_LEN		64
 #define TOEPLITZ_HASH_LEN	32
lib/hash/rte_thash_gfni.c +2 -2
index cd22a649f7..f1525f9838 100644
@@ -11,8 +11,8 @@
 
 RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO);
 #define RTE_LOGTYPE_HASH hash_gfni_logtype
-#define HASH_LOG(level, fmt, ...) \
-	RTE_LOG(level, HASH, fmt "\n", ## __VA_ARGS__)
+#define HASH_LOG(level, ...) \
+	RTE_LOG_LINE(level, HASH, "" __VA_ARGS__)
 
 uint32_t
 rte_thash_gfni(const uint64_t *mtrx __rte_unused,
lib/ip_frag/ip_frag_common.h +2 -2
index 4e9637d12f..c766154dbe 100644
@@ -22,8 +22,8 @@ extern int ipfrag_logtype;
 #define RTE_LOGTYPE_IPFRAG	ipfrag_logtype
 
 /* logging macros. */
-#define IP_FRAG_LOG_LINE(level, fmt, ...) \
-	RTE_LOG(level, IPFRAG, fmt "\n", ## __VA_ARGS__)
+#define IP_FRAG_LOG_LINE(level, ...) \
+	RTE_LOG_LINE(level, IPFRAG, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
 #define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, IPFRAG, fmt, ##args)
lib/latencystats/rte_latencystats.c +2 -2
index 6d7c4a3316..4ea9b0d75b 100644
@@ -27,8 +27,8 @@ latencystat_cycles_per_ns(void)
 
 RTE_LOG_REGISTER_DEFAULT(latencystat_logtype, INFO);
 #define RTE_LOGTYPE_LATENCY_STATS latencystat_logtype
-#define LATENCY_STATS_LOG(level, fmt, ...) \
-	RTE_LOG(level, LATENCY_STATS, fmt "\n", ## __VA_ARGS__)
+#define LATENCY_STATS_LOG(level, ...) \
+	RTE_LOG_LINE(level, LATENCY_STATS, "" __VA_ARGS__)
 
 static uint64_t timestamp_dynflag;
 static int timestamp_dynfield_offset = -1;
lib/lpm/lpm_log.h +2 -2
index 1385b9b02a..1a22b573e2 100644
@@ -2,5 +2,5 @@
 
 extern int lpm_logtype;
 #define RTE_LOGTYPE_LPM lpm_logtype
-#define LPM_LOG(level, fmt, ...) \
-	RTE_LOG(level, LPM, fmt "\n", ## __VA_ARGS__)
+#define LPM_LOG(level, ...) \
+	RTE_LOG_LINE(level, LPM, "" __VA_ARGS__)
lib/mbuf/mbuf_log.h +2 -2
index a8a674f6be..8feaf20747 100644
@@ -2,5 +2,5 @@
 
 extern int mbuf_logtype;
 #define RTE_LOGTYPE_MBUF	mbuf_logtype
-#define MBUF_LOG(level, fmt, ...) \
-	RTE_LOG(level, MBUF, fmt "\n", ## __VA_ARGS__)
+#define MBUF_LOG(level, ...) \
+	RTE_LOG_LINE(level, MBUF, "" __VA_ARGS__)
lib/member/member.h +2 -2
index a7b5b4a57c..cf600c4838 100644
@@ -8,7 +8,7 @@ extern int librte_member_logtype;
 #define RTE_LOGTYPE_MEMBER librte_member_logtype
 
 #define MEMBER_LOG(level, ...) \
-	RTE_LOG(level,  MEMBER, \
-		RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+	RTE_LOG_LINE(level,  MEMBER, \
+		RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__ ,), \
 			__func__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
lib/mempool/rte_mempool.h +2 -2
index e44039dffb..6fa4d482c5 100644
@@ -182,8 +182,8 @@ struct rte_mempool_objtlr {
  */
 extern int rte_mempool_logtype;
 #define RTE_LOGTYPE_MEMPOOL	rte_mempool_logtype
-#define RTE_MEMPOOL_LOG(level, fmt, ...) \
-	RTE_LOG(level, MEMPOOL, fmt "\n", ## __VA_ARGS__)
+#define RTE_MEMPOOL_LOG(level, ...) \
+	RTE_LOG_LINE(level, MEMPOOL, "" __VA_ARGS__)
 
 /**
  * A list of memory where objects are stored
lib/metrics/rte_metrics_telemetry.c +2 -2
index 1d133e1f8c..b8c9d75a7d 100644
@@ -16,11 +16,11 @@
 struct telemetry_metrics_data tel_met_data;
 
 int metrics_log_level;
+#define RTE_LOGTYPE_METRICS metrics_log_level
 
 /* Logging Macros */
 #define METRICS_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ##level, metrics_log_level, "%s(): "fmt "\n", \
-		__func__, ##args)
+	RTE_LOG_LINE(level, METRICS, "%s(): "fmt, __func__, ## args)
 
 #define METRICS_LOG_ERR(fmt, args...) \
 	METRICS_LOG(ERR, fmt, ## args)
lib/mldev/rte_mldev.h +3 -2
index 63b2670bb0..5cf6f0566f 100644
@@ -144,9 +144,10 @@ extern "C" {
 
 /* Logging Macro */
 extern int rte_ml_dev_logtype;
+#define RTE_LOGTYPE_MLDEV rte_ml_dev_logtype
 
-#define RTE_MLDEV_LOG(level, fmt, args...)                                                         \
-	rte_log(RTE_LOG_##level, rte_ml_dev_logtype, "%s(): " fmt "\n", __func__, ##args)
+#define RTE_MLDEV_LOG(level, fmt, args...) \
+	RTE_LOG_LINE(level, MLDEV, "%s(): " fmt, __func__, ##args)
 
 #define RTE_ML_STR_MAX 128
 /**< Maximum length of name string */
lib/net/rte_net_crc.c +4 -4
index 900d6de7f4..b401ea3dd8 100644
@@ -70,11 +70,11 @@ static const rte_net_crc_handler handlers_neon[] = {
 
 static uint16_t max_simd_bitwidth;
 
-#define NET_LOG(level, fmt, args...)					\
-	rte_log(RTE_LOG_ ## level, libnet_logtype, "%s(): " fmt "\n",	\
-		__func__, ## args)
-
 RTE_LOG_REGISTER_DEFAULT(libnet_logtype, INFO);
+#define RTE_LOGTYPE_NET libnet_logtype
+
+#define NET_LOG(level, fmt, args...) \
+	RTE_LOG_LINE(level, NET, "%s(): " fmt, __func__, ## args)
 
 /* Scalar handling */
 
lib/node/node_private.h +5 -3
index 26135aaa5b..845fdaa12e 100644
@@ -11,11 +11,13 @@
 #include <rte_mbuf_dyn.h>
 
 extern int rte_node_logtype;
+#define RTE_LOGTYPE_NODE rte_node_logtype
+
 #define NODE_LOG(level, node_name, ...)                                        \
-	rte_log(RTE_LOG_##level, rte_node_logtype,                             \
-		RTE_FMT("NODE %s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ) "\n",  \
+	RTE_LOG_LINE(level, NODE,                                              \
+		RTE_FMT("NODE %s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__ ,),       \
 			node_name, __func__, __LINE__,                         \
-			RTE_FMT_TAIL(__VA_ARGS__, )))
+			RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
 #define node_err(node_name, ...) NODE_LOG(ERR, node_name, __VA_ARGS__)
 #define node_info(node_name, ...) NODE_LOG(INFO, node_name, __VA_ARGS__)
lib/pdump/rte_pdump.c +2 -3
index 70963e7ee7..f6160f9911 100644
@@ -18,9 +18,8 @@
 RTE_LOG_REGISTER_DEFAULT(pdump_logtype, NOTICE);
 #define RTE_LOGTYPE_PDUMP pdump_logtype
 
-#define PDUMP_LOG_LINE(level, fmt, args...)		\
-	RTE_LOG(level, PDUMP, "%s(): " fmt "\n",	\
-		__func__, ## args)
+#define PDUMP_LOG_LINE(level, fmt, args...) \
+	RTE_LOG_LINE(level, PDUMP, "%s(): " fmt, __func__, ## args)
 
 /* Used for the multi-process communication */
 #define PDUMP_MP	"mp_pdump"
lib/pipeline/rte_pipeline.c +2 -2
index d52b63506e..b0aea4596d 100644
@@ -12,8 +12,8 @@
 
 #include "rte_pipeline.h"
 
-#define PIPELINE_LOG(level, fmt, ...) \
-	RTE_LOG(level, PIPELINE, fmt "\n", ## __VA_ARGS__)
+#define PIPELINE_LOG(level, ...) \
+	RTE_LOG_LINE(level, PIPELINE, "" __VA_ARGS__)
 
 #define RTE_TABLE_INVALID                                 UINT32_MAX
 
lib/port/port_log.h +2 -2
index bc1744bd97..99332a3803 100644
@@ -4,6 +4,6 @@
 
 #include <rte_log.h>
 
-#define PORT_LOG(level, fmt, ...) \
-	RTE_LOG(level, PORT, fmt "\n", ## __VA_ARGS__)
+#define PORT_LOG(level, ...) \
+	RTE_LOG_LINE(level, PORT, "" __VA_ARGS__)
 
lib/power/guest_channel.c +2 -2
index 6949f26d33..bc3f55b6bf 100644
@@ -19,8 +19,8 @@
 
 RTE_LOG_REGISTER_SUFFIX(guest_channel_logtype, guest_channel, INFO);
 #define RTE_LOGTYPE_GUEST_CHANNEL guest_channel_logtype
-#define GUEST_CHANNEL_LOG(level, fmt, ...) \
-	RTE_LOG(level, GUEST_CHANNEL, fmt "\n", ## __VA_ARGS__)
+#define GUEST_CHANNEL_LOG(level, ...) \
+	RTE_LOG_LINE(level, GUEST_CHANNEL, "" __VA_ARGS__)
 
 /* Timeout for incoming message in milliseconds. */
 #define TIMEOUT 10
lib/power/power_common.h +3 -3
index 877ff2ca4c..30966400ba 100644
@@ -12,12 +12,12 @@
 
 extern int power_logtype;
 #define RTE_LOGTYPE_POWER power_logtype
-#define POWER_LOG(level, fmt, ...) \
-	RTE_LOG(level, POWER, fmt "\n", ## __VA_ARGS__)
+#define POWER_LOG(level, ...) \
+	RTE_LOG_LINE(level, POWER, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
 #define POWER_DEBUG_LOG(fmt, args...) \
-	RTE_LOG(ERR, POWER, "%s: " fmt "\n", __func__, ## args)
+	RTE_LOG_LINE(ERR, POWER, "%s: " fmt, __func__, ## args)
 #else
 #define POWER_DEBUG_LOG(fmt, args...)
 #endif
lib/rawdev/rte_rawdev_pmd.h +2 -2
index 7b9ef1d09f..7173282c66 100644
@@ -27,11 +27,11 @@ extern "C" {
 #include "rte_rawdev.h"
 
 extern int librawdev_logtype;
+#define RTE_LOGTYPE_RAWDEV librawdev_logtype
 
 /* Logging Macros */
 #define RTE_RDEV_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, librawdev_logtype, "%s(): " fmt "\n", \
-		__func__, ##args)
+	RTE_LOG_LINE(level, RAWDEV, "%s(): " fmt, __func__, ##args)
 
 #define RTE_RDEV_ERR(fmt, args...) \
 	RTE_RDEV_LOG(ERR, fmt, ## args)
lib/rcu/rte_rcu_qsbr.c +1 -1
index 5b6530788a..bd0b83be0c 100644
@@ -20,7 +20,7 @@
 #include "rcu_qsbr_pvt.h"
 
 #define RCU_LOG(level, fmt, args...) \
-	RTE_LOG(level, RCU, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args)
 
 /* Get the memory size of QSBR variable */
 size_t
lib/rcu/rte_rcu_qsbr.h +3 -5
index 0dca8310c0..23c9f89805 100644
@@ -40,17 +40,15 @@ extern int rte_rcu_log_type;
 
 #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
 #define __RTE_RCU_DP_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, rte_rcu_log_type, \
-		"%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args)
 #else
 #define __RTE_RCU_DP_LOG(level, fmt, args...)
 #endif
 
 #if defined(RTE_LIBRTE_RCU_DEBUG)
-#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...) do {\
+#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...) do { \
 	if (v->qsbr_cnt[thread_id].lock_cnt) \
-		rte_log(RTE_LOG_ ## level, rte_rcu_log_type, \
-			"%s(): " fmt "\n", __func__, ## args); \
+		RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args); \
 } while (0)
 #else
 #define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...)
lib/regexdev/rte_regexdev.h +1 -2
index a215d8768e..a50b841b1e 100644
@@ -209,8 +209,7 @@ extern int rte_regexdev_logtype;
 #define RTE_LOGTYPE_REGEXDEV rte_regexdev_logtype
 
 #define RTE_REGEXDEV_LOG_LINE(level, ...) \
-	RTE_LOG(level, REGEXDEV, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
-		RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE(level, REGEXDEV, "" __VA_ARGS__)
 
 /* Macros to check for valid port */
 #define RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, retval) do { \
lib/reorder/rte_reorder.c +2 -2
index fd550b03af..ff815445a8 100644
@@ -18,8 +18,8 @@
 
 RTE_LOG_REGISTER_DEFAULT(reorder_logtype, INFO);
 #define RTE_LOGTYPE_REORDER reorder_logtype
-#define REORDER_LOG(level, fmt, ...) \
-	RTE_LOG(level, REORDER, fmt "\n", ## __VA_ARGS__)
+#define REORDER_LOG(level, ...) \
+	RTE_LOG_LINE(level, REORDER, "" __VA_ARGS__)
 
 TAILQ_HEAD(rte_reorder_list, rte_tailq_entry);
 
lib/rib/rib_log.h +2 -2
index ce74a4ce3e..db549d28a7 100644
@@ -4,5 +4,5 @@
 
 extern int rib_logtype;
 #define RTE_LOGTYPE_RIB rib_logtype
-#define RIB_LOG(level, fmt, ...) \
-	RTE_LOG(level, RIB, fmt "\n", ## __VA_ARGS__)
+#define RIB_LOG(level, ...) \
+	RTE_LOG_LINE(level, RIB, "" __VA_ARGS__)
lib/ring/rte_ring.c +2 -2
index 118ffab4b9..c59f626263 100644
@@ -28,8 +28,8 @@
 
 RTE_LOG_REGISTER_DEFAULT(ring_logtype, INFO);
 #define RTE_LOGTYPE_RING ring_logtype
-#define RING_LOG(level, fmt, ...) \
-	RTE_LOG(level, RING, fmt "\n", ## __VA_ARGS__)
+#define RING_LOG(level, ...) \
+	RTE_LOG_LINE(level, RING, "" __VA_ARGS__)
 
 TAILQ_HEAD(rte_ring_list, rte_tailq_entry);
 
lib/sched/rte_sched_log.h +2 -2
index d050b8fda1..19ddb655f8 100644
@@ -2,5 +2,5 @@
 
 extern int sched_logtype;
 #define RTE_LOGTYPE_SCHED sched_logtype
-#define SCHED_LOG(level, fmt, ...) \
-	RTE_LOG(level, SCHED, fmt "\n", ## __VA_ARGS__)
+#define SCHED_LOG(level, ...) \
+	RTE_LOG_LINE(level, SCHED, "" __VA_ARGS__)
lib/stack/stack_pvt.h +2 -2
index c7eab4027d..2dce42a9da 100644
@@ -8,10 +8,10 @@
 #include <rte_log.h>
 
 extern int stack_logtype;
+#define RTE_LOGTYPE_STACK stack_logtype
 
 #define STACK_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ##level, stack_logtype, "%s(): "fmt "\n", \
-		__func__, ##args)
+	RTE_LOG_LINE(level, STACK, "%s(): "fmt, __func__, ##args)
 
 #define STACK_LOG_ERR(fmt, args...) \
 	STACK_LOG(ERR, fmt, ## args)
lib/table/table_log.h +2 -2
index b50b20e595..0330f89d41 100644
@@ -4,6 +4,6 @@
 
 #include <rte_log.h>
 
-#define TABLE_LOG(level, fmt, ...) \
-	RTE_LOG(level, TABLE, fmt "\n", ## __VA_ARGS__)
+#define TABLE_LOG(level, ...) \
+	RTE_LOG_LINE(level, TABLE, "" __VA_ARGS__)
 
lib/telemetry/telemetry.c +1 -3
index 747eba2656..31e2391867 100644
@@ -57,9 +57,7 @@ static rte_cpuset_t *thread_cpuset;
 
 RTE_LOG_REGISTER_DEFAULT(logtype, WARNING);
 #define RTE_LOGTYPE_TMTY logtype
-#define TMTY_LOG_LINE(l, ...) \
-	RTE_LOG(l, TMTY,  RTE_FMT("TELEMETRY: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
-		RTE_FMT_TAIL(__VA_ARGS__ ,)))
+#define TMTY_LOG_LINE(l, ...) RTE_LOG_LINE(l, TMTY, "TELEMETRY: " __VA_ARGS__)
 
 /* list of command callbacks, with one command registered by default */
 static struct cmd_callback *callbacks;
lib/vhost/fd_man.c +2 -2
index 01cb77257e..79a8d2c006 100644
@@ -12,8 +12,8 @@
 
 RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO);
 #define RTE_LOGTYPE_VHOST_FDMAN vhost_fdset_logtype
-#define VHOST_FDMAN_LOG(level, fmt, ...) \
-	RTE_LOG(level, VHOST_FDMAN, fmt "\n", ## __VA_ARGS__)
+#define VHOST_FDMAN_LOG(level, ...) \
+	RTE_LOG_LINE(level, VHOST_FDMAN, "" __VA_ARGS__)
 
 #define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
 
lib/vhost/vhost.h +2 -2
index e0f6dd4081..470dadbba6 100644
@@ -678,10 +678,10 @@ extern int vhost_data_log_level;
 #define RTE_LOGTYPE_VHOST_DATA vhost_data_log_level
 
 #define VHOST_CONFIG_LOG(prefix, level, fmt, args...)		\
-	RTE_LOG(level, VHOST_CONFIG, "VHOST_CONFIG: (%s) " fmt "\n", prefix, ##args)
+	RTE_LOG_LINE(level, VHOST_CONFIG, "VHOST_CONFIG: (%s) " fmt, prefix, ##args)
 
 #define VHOST_DATA_LOG(prefix, level, fmt, args...)		\
-	RTE_LOG_DP(level, VHOST_DATA, "VHOST_DATA: (%s) " fmt "\n", prefix, ##args)
+	RTE_LOG_DP_LINE(level, VHOST_DATA, "VHOST_DATA: (%s) " fmt, prefix, ##args)
 
 #ifdef RTE_LIBRTE_VHOST_DEBUG
 #define VHOST_MAX_PRINT_BUFF 6072
lib/vhost/vhost_crypto.c +3 -3
index 6e5443e5f8..3704fbbb3d 100644
@@ -21,15 +21,15 @@ RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
 #define RTE_LOGTYPE_VHOST_CRYPTO	vhost_crypto_logtype
 
 #define VC_LOG_ERR(fmt, args...)				\
-	RTE_LOG(ERR, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+	RTE_LOG_LINE(ERR, VHOST_CRYPTO, "%s() line %u: " fmt,	\
 		__func__, __LINE__, ## args)
 #define VC_LOG_INFO(fmt, args...)				\
-	RTE_LOG(INFO, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+	RTE_LOG_LINE(INFO, VHOST_CRYPTO, "%s() line %u: " fmt,	\
 		__func__, __LINE__, ## args)
 
 #ifdef RTE_LIBRTE_VHOST_DEBUG
 #define VC_LOG_DBG(fmt, args...)				\
-	RTE_LOG(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+	RTE_LOG_LINE(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt,	\
 		__func__, __LINE__, ## args)
 #else
 #define VC_LOG_DBG(fmt, args...)
Signature · 1 line
2.43.0
#120 lore raw
In reply to David Marchand
Quoted 22 lines · David Marchand

Getting readable and consistent logs is important when running a DPDK application, especially when troubleshooting.
A common issue with logs is when a DPDK change do not add (or on the contrary add too many \n) in the format string.

This issue would only get noticed when actually hitting this log (which may be a situation hard to reach).

This series proposes to introduce a new RTE_LOG_LINE helper that is responsible for logging a one line message and spews a build error (with gcc) if any \n is part of the format string.

Since the v1 discussion on the cover letter, I changed my mind, and made the choice to break existing logging helpers exported in the public API. The reasoning is that those should not be used in the first place:
logs should be produced only by the library that registers the logtype.

Some multiline logging for debugging and the test assert macros are still present, but in this case an explicit call to RTE_LOG() is done. This can be checked with a simple:

Quoted 11 lines
$ git grep -E 'RTE_LOG(_DP)?\(' -- lib/ :^lib/log/
lib/acl/acl_bld.c:      RTE_LOG(DEBUG, ACL, "Build phase for ACL \"%s\":\n"
lib/acl/acl_gen.c:      RTE_LOG(DEBUG, ACL, "Gen phase for ACL \"%s\":\n"
lib/bpf/bpf_validate.c: RTE_LOG(DEBUG, BPF, "%s(%p) stats:\n"
lib/bpf/bpf_validate.c: RTE_LOG(DEBUG, BPF,
lib/eal/common/eal_common_debug.c:              RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
lib/eal/include/rte_test.h:             RTE_LOG(ERR, EAL, "Test assert %s line %d failed: "           \
lib/ip_frag/ip_frag_common.h:#define    IP_FRAG_LOG(lvl, fmt, args...)  RTE_LOG(lvl, IPFRAG, fmt, ##args)
lib/sched/rte_sched.c:  RTE_LOG(DEBUG, SCHED, "Low level config for pipe profile %u:\n"
lib/sched/rte_sched.c:  RTE_LOG(DEBUG, SCHED, "Low level config for subport profile %u:\n"
lib/vhost/vhost.h:      RTE_LOG_DP(DEBUG, VHOST_DATA, "VHOST_DATA: (%s) %s", dev->ifname, packet); \

Series applied, thanks for the reviews.

Signature · 1 line
David Marchand
#121 lore raw
In reply to David Marchand
Quoted 21 lines · On Wed, 20 Dec 2023 16:35:53 +0100 David Marchand <[email protected]>…

Getting readable and consistent logs is important when running a DPDK application, especially when troubleshooting.
A common issue with logs is when a DPDK change do not add (or on the contrary add too many \n) in the format string.

This issue would only get noticed when actually hitting this log (which may be a situation hard to reach).

This series proposes to introduce a new RTE_LOG_LINE helper that is responsible for logging a one line message and spews a build error (with gcc) if any \n is part of the format string.

Since the v1 discussion on the cover letter, I changed my mind, and made the choice to break existing logging helpers exported in the public API. The reasoning is that those should not be used in the first place:
logs should be produced only by the library that registers the logtype.

Some multiline logging for debugging and the test assert macros are still present, but in this case an explicit call to RTE_LOG() is done. This can be checked with a simple:

Quoted 11 lines
$ git grep -E 'RTE_LOG(_DP)?\(' -- lib/ :^lib/log/
lib/acl/acl_bld.c:      RTE_LOG(DEBUG, ACL, "Build phase for ACL \"%s\":\n"
lib/acl/acl_gen.c:      RTE_LOG(DEBUG, ACL, "Gen phase for ACL \"%s\":\n"
lib/bpf/bpf_validate.c: RTE_LOG(DEBUG, BPF, "%s(%p) stats:\n"
lib/bpf/bpf_validate.c: RTE_LOG(DEBUG, BPF,
lib/eal/common/eal_common_debug.c:              RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
lib/eal/include/rte_test.h:             RTE_LOG(ERR, EAL, "Test assert %s line %d failed: "           \
lib/ip_frag/ip_frag_common.h:#define    IP_FRAG_LOG(lvl, fmt, args...)  RTE_LOG(lvl, IPFRAG, fmt, ##args)
lib/sched/rte_sched.c:  RTE_LOG(DEBUG, SCHED, "Low level config for pipe profile %u:\n"
lib/sched/rte_sched.c:  RTE_LOG(DEBUG, SCHED, "Low level config for subport profile %u:\n"
lib/vhost/vhost.h:      RTE_LOG_DP(DEBUG, VHOST_DATA, "VHOST_DATA: (%s) %s", dev->ifname, packet); \

Tabs are also problematic for syslog.

With simple mod to testpmd:

app/test-pmd/testpmd.c +2 -0
index 9e4e99e53b9a..811fe0c4aeb8 100644
@@ -4555,6 +4555,9 @@ main(int argc, char** argv)
                rte_exit(EXIT_FAILURE, "Cannot init EAL: %s\n",
                         rte_strerror(rte_errno));
 
+       RTE_LOG(INFO, USER1, "Sample log message with extra\nnewline\n");
+       RTE_LOG(INFO, USER1, "Sample log message with tab\tinserted\n");
 

And the result in syslog is:

2023-12-21T08:27:47.172156-08:00 sut dpdk-testpmd[69471]: USER1: Sample log message with extra#012newline
2023-12-21T08:27:47.173418-08:00 sut dpdk-testpmd[69471]: USER1: Sample log message with tab#011inserted