> -----Original Message----- > From: David Ahern <dsah...@kernel.org> > Sent: Wednesday, July 30, 2025 1:45 AM > To: Chia-Yu Chang (Nokia) <chia-yu.ch...@nokia-bell-labs.com>; > alok.a.tiw...@oracle.com; donald.hun...@gmail.com; xandf...@gmail.com; > net...@vger.kernel.org; dave.t...@gmail.com; pab...@redhat.com; > j...@mojatatu.com; k...@kernel.org; step...@networkplumber.org; > xiyou.wangc...@gmail.com; j...@resnulli.us; da...@davemloft.net; > eduma...@google.com; ho...@kernel.org; andrew+net...@lunn.ch; > a...@fiberby.net; liuhang...@gmail.com; sh...@kernel.org; > linux-kselftest@vger.kernel.org; i...@kernel.org; ncardw...@google.com; Koen > De Schepper (Nokia) <koen.de_schep...@nokia-bell-labs.com>; > g.wh...@cablelabs.com; ingemar.s.johans...@ericsson.com; > mirja.kuehlew...@ericsson.com; chesh...@apple.com; rs.i...@gmx.at; > jason_living...@comcast.com; vidhi_g...@apple.com > Cc: Olga Albisser <o...@albisser.org>; Olivier Tilmans (Nokia) > <olivier.tilm...@nokia.com>; Bob Briscoe <resea...@bobbriscoe.net>; Henrik > Steen <henr...@henrist.net> > Subject: Re: [PATCH v11 iproute2-next 1/1] tc: add dualpi2 scheduler module > > > CAUTION: This is an external email. Please be very careful when clicking > links or opening attachments. See the URL nok.it/ext for additional > information. > > > > On 7/17/25 5:23 PM, chia-yu.ch...@nokia-bell-labs.com wrote: > > diff --git a/include/uapi/linux/pkt_sched.h > > b/include/uapi/linux/pkt_sched.h index 958d9407..15d1a37a 100644 > > --- a/include/uapi/linux/pkt_sched.h > > +++ b/include/uapi/linux/pkt_sched.h > > you can drop the uapi changes.
Hi, Sorry for the late reply, this will be done along with the following two requests. > [...] > > --git a/lib/utils.c b/lib/utils.c index 706e93c3..dd242d4d 100644 > > --- a/lib/utils.c > > +++ b/lib/utils.c > > @@ -220,6 +220,36 @@ int get_unsigned(unsigned int *val, const char *arg, > > int base) > > return 0; > > } > > > > +int get_float(float *val, const char *arg) { > > + float res; > > + char *ptr; > > + > > + if (!arg || !*arg) > > + return -1; > > + res = strtof(arg, &ptr); > > + if (!ptr || ptr == arg || *ptr) > > + return -1; > > + *val = res; > > + return 0; > > +} > > Put the move of get_float in a standlone patch indicating it is a code move. > > > > + > > +int get_float_min_max(float *val, const char *arg, float min, float > > +max) { > > + float res; > > + char *ptr; > > + > > + if (!arg || !*arg) > > + return -1; > > + res = strtof(arg, &ptr); > > + if (!ptr || ptr == arg || *ptr) > > + return -1; > > + if (res < min || res > max) > > + return -1; > > + *val = res; > > + return 0; > > +} > > + > > /* > > * get_time_rtt is "translated" from a similar routine "get_time" in > > * tc_util.c. We don't use the exact same routine because tc passes > > Add get_float_min_max in a standalone patch. > > > > > diff --git a/tc/q_dualpi2.c b/tc/q_dualpi2.c new file mode 100644 > > index 00000000..50d52aad > > --- /dev/null > > +++ b/tc/q_dualpi2.c > > @@ -0,0 +1,528 @@ [...] > > + > > +static int get_packets(uint32_t *val, const char *arg) { > > + unsigned long res; > > + char *ptr; > > + > > + if (!arg || !*arg) > > + return -1; > > + res = strtoul(arg, &ptr, 10); > > + if (!ptr || ptr == arg || > > + !(matches(ptr, "pkts") == 0 || matches(ptr, "packets") == > > + 0)) > > we are not allowing any more uses of "matches". Then, is it allowed to use strncmp iteratively? Or any other suggested function could be used? > > > > + return -1; > > + if (res == ULONG_MAX && errno == ERANGE) > > + return -1; > > + if (res > 0xFFFFFFFFUL) > > + return -1; > > + *val = res; > > + > > + return 0; > > +} [...] > > +static int dualpi2_parse_opt(const struct qdisc_util *qu, int argc, > > + char **argv, struct nlmsghdr *n, const char > > +*dev) { > > + uint32_t limit = 0; > > + uint32_t memory_limit = 0; > > + uint32_t target = 0; > > + uint32_t tupdate = 0; > > + uint32_t alpha = DEFAULT_ALPHA_BETA; > > + uint32_t beta = DEFAULT_ALPHA_BETA; > > + int32_t coupling_factor = -1; > > + uint8_t ecn_mask = 0; > > + int step_unit = __TCA_DUALPI2_MAX; > > + uint32_t step_thresh = 0; > > + uint32_t min_qlen_step = 0; > > + bool set_min_qlen_step = false; > > + int c_protection = -1; > > + uint8_t drop_early = __TCA_DUALPI2_DROP_EARLY_MAX; > > + uint8_t drop_overload = __TCA_DUALPI2_DROP_OVERLOAD_MAX; > > + uint8_t split_gso = __TCA_DUALPI2_SPLIT_GSO_MAX; > > + uint32_t rtt_max = 0; > > + uint32_t rtt_typ = 0; > > + struct rtattr *tail; > > iproute2 follows kernel coding standards and netdev's preference for reverse > xmas tree listing of variables. Sure, I will take correspondence course of actions. Chia-Yu