fix XXX_DEBUG warnings
Subsystems (3)
cover fix XXX_DEBUG warnings
I recently modified my build test to automatically enable all DEBUG flags. This is because developers often add debug code, forget about it, and it bit rots.
This patch series fixes all the places where #ifdef XXX_DEBUG code was present but would not build without warnings.
Stephen Hemminger (7):
bus/fslmc: fix build of qbman debug code bus/fslmc: fix signed comparison in buffer acquire crypto/caam_jr: fix descriptor dump build crypto/ipsec_mb: fix missing header for debug build power/amd_uncore: fix debug log build net/rnp: fix register debug log format net/vmxnet3: remove unused queue dump functions
drivers/bus/fslmc/qbman/qbman_debug.c | 3 ++ drivers/bus/fslmc/qbman/qbman_portal.c | 4 +- drivers/crypto/caam_jr/caam_jr.c | 2 +- drivers/crypto/caam_jr/caam_jr_desc.h | 6 +-- drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 2 + drivers/net/rnp/base/rnp_osdep.h | 4 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 58 ------------------------- drivers/power/amd_uncore/amd_uncore.c | 2 +- 8 files changed, 14 insertions(+), 67 deletions(-)
Signature · 1 line
2.53.0
PATCH 1/7 bus/fslmc: fix build of qbman debug code
QBMAN_RESPONSE_VERB_MASK is a private define in qbman_portal.c, not in the qbman_portal.h header included by qbman_debug.c. The debug file has therefore never compiled since it was added; it fails with seven "undeclared identifier" errors when RTE_LIBRTE_DPAA2_DEBUG_BUS is defined.
Define the mask locally, next to the other management command codes that qbman_debug.c already defines for itself.
--- drivers/bus/fslmc/qbman/qbman_debug.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bus/fslmc/qbman/qbman_debug.c +3 -0
@@ -9,6 +9,9 @@#include <eal_export.h> +/* Mask used to extract the response verb from a management command result */ +#define QBMAN_RESPONSE_VERB_MASK 0x7f +/* QBMan portal management command code */ #define QBMAN_BP_QUERY 0x32#define QBMAN_FQ_QUERY 0x44
Signature · 1 line
2.53.0
Re: [PATCH 1/7] bus/fslmc: fix build of qbman debug code
Quoted 6 lines · Stephen Hemminger
QBMAN_RESPONSE_VERB_MASKis a private define inqbman_portal.c, not in theqbman_portal.hheader included byqbman_debug.c. The debug file has therefore never compiled since it was added; it fails with seven "undeclared identifier" errors whenRTE_LIBRTE_DPAA2_DEBUG_BUSis defined.
Quoted 7 lines
Define the mask locally, next to the other management command codes that
qbman_debug.calready defines for itself.Fixes 64f131a82fbe ("bus/fslmc: add qbman debug")Signed-off-by Stephen Hemminger <[email protected]>
Quoted 18 lines
--- drivers/bus/fslmc/qbman/qbman_debug.c | 3 +++ 1 file changed, 3 insertions(+)drivers/bus/fslmc/qbman/qbman_debug.c +3
-0@@ -9,6 +9,9 @@#include <eal_export.h> +/* Mask used to extract the response verb from a management command result */ +#define QBMAN_RESPONSE_VERB_MASK 0x7f +/* QBMan portal management command code */ #define QBMAN_BP_QUERY 0x32#define QBMAN_FQ_QUERY 0x44
PATCH 2/7 bus/fslmc: fix signed comparison in buffer acquire
In reply to Stephen HemmingerThe acquired buffer count is masked with BMAN_VALID_RSLT_NUM_MASK so it is always in the range 0..7, but it was held in an int and then compared against the unsigned num_buffers parameter, giving a -Wsign-compare warning in both acquire paths.
Make the count unsigned to match num_buffers. The error paths return negative errno values directly and are unaffected.
--- drivers/bus/fslmc/qbman/qbman_portal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/fslmc/qbman/qbman_portal.c +2 -2
@@ -2680,7 +2680,7 @@ static int qbman_swp_acquire_direct(struct qbman_swp *s, uint16_t bpid, {struct qbman_acquire_desc *p;struct qbman_acquire_rslt *r; -int num; +unsigned int num;if (!num_buffers || (num_buffers >BMAN_VALID_RSLT_NUM_MASK ))return -EINVAL ;
@@ -2727,7 +2727,7 @@ static int qbman_swp_acquire_cinh_direct(struct qbman_swp *s, uint16_t bpid, {struct qbman_acquire_desc *p;struct qbman_acquire_rslt *r; -int num; +unsigned int num;if (!num_buffers || (num_buffers >BMAN_VALID_RSLT_NUM_MASK ))return -EINVAL ;
Signature · 1 line
2.53.0
Re: [PATCH 2/7] bus/fslmc: fix signed comparison in buffer acquire
PATCH 3/7 crypto/caam_jr: fix descriptor dump build
In reply to Stephen HemmingerSEC_DUMP_DESC() grew a FILE * argument when the NXP drivers were converted to fprintf(), but the only caller was never updated, so building with RTE_LIBRTE_PMD_CAAM_JR_DEBUG failed with a macro arity error.
Compiling the macro body for the first time then exposed two further problems in it: the log format string ended in a newline, which RTE_LOG_LINE() rejects, and descriptor pointers were cast to uint32_t, truncating them on 64-bit builds.
--- drivers/crypto/caam_jr/caam_jr.c | 2 +- drivers/crypto/caam_jr/caam_jr_desc.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/caam_jr/caam_jr.c +1 -1
@@ -462,7 +462,7 @@ caam_jr_prep_cdb(struct caam_jr_session *ses) }#if CAAM_JR_DBG -SEC_DUMP_DESC (cdb->sh_desc); +SEC_DUMP_DESC (cdb->sh_desc, stdout);#endif cdb->sh_hdr.hi.field.idlen = shared_desc_len;
drivers/crypto/caam_jr/caam_jr_desc.h +3 -3
@@ -112,12 +112,12 @@/* Helper macro for dumping the hex representation of a descriptor */ #define SEC_DUMP_DESC (descriptor, f) { \ int __i; \ - CAAM_JR_INFO("Des@ 0x%08x\n", (uint32_t)((uint32_t *)(descriptor)));\ + CAAM_JR_INFO("Des@ %p", (const void *)(descriptor)); \ for (__i = 0; \ __i < SEC_GET_DESC_LEN(descriptor); \ __i++) { \ - fprintf(f, "0x%08x: 0x%08x\n", \ - (uint32_t)(((uint32_t *)(descriptor)) + __i), \ + fprintf(f, "%p: 0x%08x\n", \ + (const void *)(((uint32_t *)(descriptor)) + __i), \ *(((uint32_t *)(descriptor)) + __i)); \ } \ }
Signature · 1 line
2.53.0
Re: [PATCH 3/7] crypto/caam_jr: fix descriptor dump build
PATCH 4/7 crypto/ipsec_mb: fix missing header for debug build
In reply to Stephen HemmingerBuilding with RTE_LIBRTE_PMD_AESNI_GCM_DEBUG fails with an implicit declaration of rte_hexdump()
--- drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2016-2021 Intel Corporation */ +#include <rte_hexdump.h> +#include "pmd_aesni_gcm_priv.h" static void
Signature · 1 line
2.53.0
PATCH 5/7 power/amd_uncore: fix debug log build
In reply to Stephen HemmingerThe debug log referenced ui->num_uncore_freqs, which is the field name used by the intel_uncore driver. The AMD uncore_power_info struct calls it nb_freqs, so building with RTE_LIBRTE_POWER_DEBUG failed.
--- drivers/power/amd_uncore/amd_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/amd_uncore/amd_uncore.c +1 -1
@@ -100,7 +100,7 @@ power_get_available_uncore_freqs(struct uncore_power_info *ui) }POWER_DEBUG_LOG ("%d frequency(s) of pkg %02u die %02u are available" , - ui->num_uncore_freqs, ui->pkg, ui->die); + ui->nb_freqs, ui->pkg, ui->die);return 0 ; }
Signature · 1 line
2.53.0
PATCH 6/7 net/rnp: fix register debug log format
In reply to Stephen HemmingerThe register offset is a size_t but was printed with %p, producing a -Wformat warning at every call site (22 in a full build) when RTE_LIBRTE_RNP_REG_DEBUG is enabled. Print it with %zx instead.
--- drivers/net/rnp/base/rnp_osdep.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/rnp/base/rnp_osdep.h +2 -2
@@ -90,14 +90,14 @@ rnp_reg_read32(const void *base, size_t offset) {u32 v =rte_read32 (((const u8 *)base + offset)); -RNP_PMD_REG_LOG (DEBUG ,"offset=%p val=%#" PRIx32"" , offset, v); +RNP_PMD_REG_LOG (DEBUG ,"offset=%#zx val=%#" PRIx32"" , offset, v);return v; }static inline void rnp_reg_write32 (volatile void *base,size_t offset,u32 val) { -RNP_PMD_REG_LOG (DEBUG ,"offset=%p val=%#" PRIx32"" , offset, val); +RNP_PMD_REG_LOG (DEBUG ,"offset=%#zx val=%#" PRIx32"" , offset, val);rte_write32 (val, ((volatile u8 *)base + offset)); }
Signature · 1 line
2.53.0
PATCH 7/7 net/vmxnet3: remove unused queue dump functions
In reply to Stephen Hemmingervmxnet3_rxq_dump() and vmxnet3_txq_dump() are guarded by RTE_LIBRTE_VMXNET3_DEBUG_DRIVER_NOT_USED, a macro that is defined nowhere and whose name records that the callers were removed long ago. Building with the macro forced on only produces -Wunused-function warnings.
Remove the dead code.
--- drivers/net/vmxnet3/vmxnet3_rxtx.c | 58 ------------------------------ 1 file changed, 58 deletions(-)
drivers/net/vmxnet3/vmxnet3_rxtx.c +0 -58
@@ -59,64 +59,6 @@static int vmxnet3_post_rx_bufs (vmxnet3_rx_queue_t *,uint8_t );static void vmxnet3_tq_tx_complete (vmxnet3_tx_queue_t *); -#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER_NOT_USED -static void vmxnet3_rxq_dump (struct vmxnet3_rx_queue *); -static void vmxnet3_txq_dump (struct vmxnet3_tx_queue *); -#endif - -#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER_NOT_USED -static void -vmxnet3_rxq_dump (struct vmxnet3_rx_queue *rxq) -{ -uint32_t avail =0 ; - -if (rxq ==NULL ) -return ; - -PMD_RX_LOG (DEBUG , -"RXQ: cmd0 base : %p cmd1 base : %p comp ring base : %p." , - rxq->cmd_ring[0 ].base, rxq->cmd_ring[1 ].base, rxq->comp_ring.base); -PMD_RX_LOG (DEBUG , -"RXQ: cmd0 basePA : 0x%lx cmd1 basePA : 0x%lx comp ring basePA : 0x%lx." , - (unsigned long )rxq->cmd_ring[0 ].basePA, - (unsigned long )rxq->cmd_ring[1 ].basePA, - (unsigned long )rxq->comp_ring.basePA); - - avail =vmxnet3_cmd_ring_desc_avail (&rxq->cmd_ring[0 ]); -PMD_RX_LOG (DEBUG , -"RXQ:cmd0: size=%u; free=%u; next2proc=%u; queued=%u" , - (uint32_t )rxq->cmd_ring[0 ].size, avail, - rxq->comp_ring.next2proc, - rxq->cmd_ring[0 ].size - avail); - - avail =vmxnet3_cmd_ring_desc_avail (&rxq->cmd_ring[1 ]); -PMD_RX_LOG (DEBUG ,"RXQ:cmd1 size=%u; free=%u; next2proc=%u; queued=%u" , - (uint32_t )rxq->cmd_ring[1 ].size, avail, rxq->comp_ring.next2proc, - rxq->cmd_ring[1 ].size - avail); - -} - -static void -vmxnet3_txq_dump (struct vmxnet3_tx_queue *txq) -{ -uint32_t avail =0 ; - -if (txq ==NULL ) -return ; - -PMD_TX_LOG (DEBUG ,"TXQ: cmd base : %p comp ring base : %p data ring base : %p." , - txq->cmd_ring.base, txq->comp_ring.base, txq->data_ring.base); -PMD_TX_LOG (DEBUG ,"TXQ: cmd basePA : 0x%lx comp ring basePA : 0x%lx data ring basePA : 0x%lx." , - (unsigned long )txq->cmd_ring.basePA, - (unsigned long )txq->comp_ring.basePA, - (unsigned long )txq->data_ring.basePA); - - avail =vmxnet3_cmd_ring_desc_avail (&txq->cmd_ring); -PMD_TX_LOG (DEBUG ,"TXQ: size=%u; free=%u; next2proc=%u; queued=%u" , - (uint32_t )txq->cmd_ring.size, avail, - txq->comp_ring.next2proc, txq->cmd_ring.size - avail); -} -#endif static void vmxnet3_tx_cmd_ring_release_mbufs (vmxnet3_cmd_ring_t *ring)
Signature · 1 line
2.53.0
Stephen Hemminger
AppliedQuoted 6 lines · On Fri, 4 Sep 2026 12:12:35 -0700 Stephen Hemminger…
I recently modified my build test to automatically enable all DEBUG flags. This is because developers often add debug code, forget about it, and it bit rots.
This patch series fixes all the places where #ifdef
XXX_DEBUGcode was present but would not build without warnings.
Applied to next-net.
Now all of next-net builds clean with this series.
Stephen Hemminger
AppliedQuoted 6 lines · On Fri, 4 Sep 2026 12:12:35 -0700 Stephen Hemminger…
I recently modified my build test to automatically enable all DEBUG flags. This is because developers often add debug code, forget about it, and it bit rots.
This patch series fixes all the places where #ifdef
XXX_DEBUGcode was present but would not build without warnings.
Applied to next-net.
Now all of next-net builds clean with this series.
Stephen Hemminger
AppliedQuoted 6 lines · On Fri, 4 Sep 2026 12:12:35 -0700 Stephen Hemminger…
I recently modified my build test to automatically enable all DEBUG flags. This is because developers often add debug code, forget about it, and it bit rots.
This patch series fixes all the places where #ifdef
XXX_DEBUGcode was present but would not build without warnings.
Applied to next-net.
Now all of next-net builds clean with this series.