[PATCH v12 15/15] net/enetc4: add WRR Tx scheduler devarg for VF rings
Gagandeep Singh
G.Singh at nxp.com
Mon Sep 7 11:36:11 CEST 2026
Hi,
NXP Public
> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Thursday, September 3, 2026 11:50 PM
> To: Gagandeep Singh <G.Singh at nxp.com>
> Cc: dev at dpdk.org; Hemant Agrawal <hemant.agrawal at nxp.com>
> Subject: Re: [PATCH v12 15/15] net/enetc4: add WRR Tx scheduler devarg for VF
> rings
>
> On Fri, 21 Aug 2026 11:26:43 +0530
> Gagandeep Singh <g.singh at nxp.com> wrote:
>
> > Add enetc4_txq_wrr devarg to configure per-ring WRR weights in the
> > NETC LEAF-level Tx scheduler (TBaMR register, bits [6:4]).
> >
> > The NETC Tx scheduler has three levels:
> > - ROOT (port/TC): strict priority + CBS (PF/port space)
> > - MID (SI/VSI): WBFS shaping (PF space)
> > - LEAF (Tx BDR): strict priority + frame-based WRR (VF/SI space)
> >
> > TBaMR is in the VF own SI space, so no Linux PF involvement is needed
> > for PRIO or WRR configuration.
> >
> > Changes:
> > - enetc_hw.h: add ENETC_TBMR_WRR_MASK, ENETC_TBMR_WRR(n) macros
> for
> > TBaMR bits [6:4], and ENETC_TBMR_PRIO_MASK for bits [2:0]
> > - enetc.h: add txq_wrr pointer to enetc_eth_hw struct
> > - enetc4_ethdev.c: add parse_txq_wrr() and wire ENETC4_TXQ_WRR devarg
> > through enetc4_get_devargs() and enetc4_dev_configure(); apply WRR
> > bits in enetc4_tx_queue_setup() and enetc4_tx_queue_start()
> >
> > Usage:
> > # strict priority: ring 0 highest
> > -a 0002:00:12.0,enetc4_txq_prior="3|2|1"
> >
> > # WRR 2:4:1 on same-priority rings
> > -a 0002:00:12.0,enetc4_txq_prior="1|1|1",enetc4_txq_wrr="2|4|1"
> >
> > Signed-off-by: Gagandeep Singh <g.singh at nxp.com>
> > Acked-by: Hemant Agrawal <hemant.agrawal at nxp.com>
> > ---
>
> This is in next-net now as is, but you should fix the arg parsing code not to use
> unsafe string handling functions.
>
> strtok() is not thread safe, use strtok_r() or other non-destructive parsing.
> atoi() and atof() except garbage and don't do out of range testing and take
> negative values; use strtoul() here instead. Probably should have a DPDK string
> function for this like rte_str_to_u32() etc; might get to doing that.
>
> Newer version of checkpatch (in python) flags this as:
>
> ### [PATCH] net/enetc4: add WRR Tx scheduler devarg for VF rings
>
> ERROR: [FORBIDDEN_TOKEN] Using strtok(), prefer strtok_r() (non-reentrant
> static state) # drivers/net/enetc/enetc4_ethdev.c:76:
> + str = strtok(NULL, "|");
>
> ERROR: [FORBIDDEN_TOKEN] Using strtok(), prefer strtok_r() (non-reentrant
> static state) # drivers/net/enetc/enetc4_ethdev.c:107:
> + str = strtok(input_str, "|");
>
> WARNING: [FORBIDDEN_TOKEN] Using atoi()/atol()/atof(), prefer strtol()/strtoul()
> with errno and endptr checks # drivers/net/enetc/enetc4_ethdev.c:75:
> + hw->txq_prior[i++] = atoi(str) & ENETC_TBMR_PRIO_MASK;
>
> WARNING: [FORBIDDEN_TOKEN] Using atoi()/atol()/atof(), prefer strtol()/strtoul()
> with errno and endptr checks # drivers/net/enetc/enetc4_ethdev.c:109:
> + w = atoi(str);
>
> total: 2 errors, 2 warnings, 0 checks, 102 lines checked
Could you please share the latest checkpatch.pl script? I tried the one from kernel v7.3-rc2, but I'm not able to reproduce or see these errors. Is there any specific command or setup required to reproduce these issues?
Also, would you like me to send v13 after fixing this, or would it be sufficient to send only the updated patch:
"net/enetc4: add WRR Tx scheduler devarg for VF rings"?
More information about the dev
mailing list