[PATCH 59/62] net/ice: use kvargs hex helper for debug mask

Stephen Hemminger stephen at networkplumber.org
Mon Sep 14 07:47:30 CEST 2026


parse_u64() checks errno but not the end pointer, so "hw_debug_mask=junk"
is silently accepted as zero, and a trailing-garbage value such as
"0x80zz" is taken as 0x80.

The value is documented as a hexadecimal mask, so use
rte_kvargs_handle_hex64(), which reads it as hexadecimal with or without
a 0x prefix and validates the whole string. The documented form
"hw_debug_mask=0x80" is unchanged, and so is a bare "80".

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/intel/ice/ice_ethdev.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/drivers/net/intel/ice/ice_ethdev.c b/drivers/net/intel/ice/ice_ethdev.c
index af859f2174..77112bd499 100644
--- a/drivers/net/intel/ice/ice_ethdev.c
+++ b/drivers/net/intel/ice/ice_ethdev.c
@@ -2140,25 +2140,6 @@ ice_base_queue_get(struct ice_pf *pf)
 	}
 }
 
-static int
-parse_u64(const char *key, const char *value, void *args)
-{
-	u64 *num = (u64 *)args;
-	u64 tmp;
-
-	errno = 0;
-	tmp = strtoull(value, NULL, 16);
-	if (errno) {
-		PMD_DRV_LOG(WARNING, "%s: \"%s\" is not a valid u64",
-			    key, value);
-		return -1;
-	}
-
-	*num = tmp;
-
-	return 0;
-}
-
 static int
 parse_tx_sched_levels(const char *key, const char *value, void *args)
 {
@@ -2423,7 +2404,7 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
 		goto bail;
 
 	ret = rte_kvargs_process(kvlist, ICE_HW_DEBUG_MASK_ARG,
-				 &parse_u64, &ad->hw.debug_mask);
+				 rte_kvargs_handle_hex64, &ad->hw.debug_mask);
 	if (ret)
 		goto bail;
 
-- 
2.53.0



More information about the dev mailing list