|WARNING| pw169400 [PATCH v2 35/47] net/dpaa2: enhance xstat implementation

checkpatch at dpdk.org checkpatch at dpdk.org
Thu Sep 10 15:59:41 CEST 2026


Test-Label: checkpatch
Test-Status: WARNING
http://dpdk.org/patch/169400

_coding style issues_


CHECK:MACRO_ARG_REUSE: Macro argument reuse 'field' - possible side-effects?
#301: FILE: drivers/net/dpaa2/dpaa2_ethdev.c:218:
+#define DPAA2_XSTAT_STR_SET(pg, field) \
+	[DPAA2_XSTAT_ID(pg.field)] = RTE_STR(field)

CHECK:MACRO_ARG_REUSE: Macro argument reuse 'tc' - possible side-effects?
#304: FILE: drivers/net/dpaa2/dpaa2_ethdev.c:221:
+#define DPAA2_XSTAT_TC_STR_SET(pg, tc, field) \
+	[DPAA2_XSTAT_ID(pg[tc].field)] = "TC" RTE_STR(tc)"_" RTE_STR(field)

CHECK:MACRO_ARG_REUSE: Macro argument reuse 'field' - possible side-effects?
#304: FILE: drivers/net/dpaa2/dpaa2_ethdev.c:221:
+#define DPAA2_XSTAT_TC_STR_SET(pg, tc, field) \
+	[DPAA2_XSTAT_ID(pg[tc].field)] = "TC" RTE_STR(tc)"_" RTE_STR(field)

ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#307: FILE: drivers/net/dpaa2/dpaa2_ethdev.c:224:
+#define DPAA2_XSTAT_TC_COLOR_STR_SET(pg, tc) \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_red), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_yellow), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_green), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_re_red), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_re_yellow)

BUT SEE:

   do {} while (0) advice is over-stated in a few situations:

   The more obvious case is macros, like MODULE_PARM_DESC, invoked at
   file-scope, where C disallows code (it must be in functions).  See
   $exceptions if you have one to add by name.

   More troublesome is declarative macros used at top of new scope,
   like DECLARE_PER_CPU.  These might just compile with a do-while-0
   wrapper, but would be incorrect.  Most of these are handled by
   detecting struct,union,etc declaration primitives in $exceptions.

   Theres also macros called inside an if (block), which "return" an
   expression.  These cannot do-while, and need a ({}) wrapper.

   Enjoy this qualification while we work to improve our heuristics.

CHECK:MACRO_ARG_REUSE: Macro argument reuse 'pg' - possible side-effects?
#307: FILE: drivers/net/dpaa2/dpaa2_ethdev.c:224:
+#define DPAA2_XSTAT_TC_COLOR_STR_SET(pg, tc) \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_red), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_yellow), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_green), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_re_red), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_re_yellow)

CHECK:MACRO_ARG_REUSE: Macro argument reuse 'tc' - possible side-effects?
#307: FILE: drivers/net/dpaa2/dpaa2_ethdev.c:224:
+#define DPAA2_XSTAT_TC_COLOR_STR_SET(pg, tc) \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_red), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_yellow), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_green), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_re_red), \
+	DPAA2_XSTAT_TC_STR_SET(pg, tc, policer_cnt_re_yellow)

CHECK:MACRO_ARG_REUSE: Macro argument reuse 'name' - possible side-effects?
#314: FILE: drivers/net/dpaa2/dpaa2_ethdev.c:231:
+#define DPAA2_MAC_XSTAT_STR_SET(name) \
+	[DPAA2_XSTAT_ID(mac_cnt.name)] = "mac_" RTE_STR(name)

CHECK:MACRO_ARG_REUSE: Macro argument reuse 'tc' - possible side-effects?
#317: FILE: drivers/net/dpaa2/dpaa2_ethdev.c:234:
+#define DPAA2_MAC_XSTAT_PFC_STR_SET(dir, tc) \
+	[DPAA2_XSTAT_ID(mac_cnt.dir##_pfc_class[tc])] = \
+		"mac_" RTE_STR(dir) "_pfc_class_" RTE_STR(tc)

CHECK:CAMELCASE: Avoid CamelCase: <PRIu64>
#950: FILE: drivers/net/dpaa2/dpaa2_ethdev.c:2276:
+			DPAA2_PMD_ERR("xstats id[%d] value(%" PRIu64 ") >= max count(%d)",

total: 1 errors, 0 warnings, 8 checks, 1321 lines checked
Warning in drivers/net/dpaa2/dpaa2_ethdev.c:
Using %l format, prefer %PRI*64 if type is [u]int64_t


More information about the test-report mailing list