[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250807191006.GA15844@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
Date: Thu, 7 Aug 2025 12:10:06 -0700
From: Erni Sri Satya Vennela <ernis@...ux.microsoft.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: dsahern@...il.com, netdev@...r.kernel.org, haiyangz@...rosoft.com,
shradhagupta@...ux.microsoft.com, ssengar@...rosoft.com,
dipayanroy@...rosoft.com, ernis@...rosoft.com
Subject: Re: [PATCH iproute2-next v2] iproute2: Add 'netshaper' command to
'ip link' for netdev shaping
On Thu, Aug 07, 2025 at 11:07:40AM -0700, Erni Sri Satya Vennela wrote:
>
> > > + NEXT_ARG();
> > > + if (get_unsigned(&speed_mbps, *argv, 10)) {
> > > + fprintf(stderr, "Invalid speed value\n");
> > > + return -1;
> > > + }
> >
> > Could you change this code to use the get_rate() in lib/utils_math.c
> > That routine handles wide variety of suffixes.
> >
> > > + /*Convert Mbps to Bps*/
> >
There is a typo in this above comment. It should be "Convert Mbps to bps"
> > Won't need this if you use get_rate() or get_rate64
>
> Okay I'll make the changes accordingly.
Looks like get_rate64 or get_rate returns the rate in Bytes per second.
But netshaper supports rate in bits per second.
I will use get_rate64 and multiply the result by 8 to get bps which
also avoids using an extra speed_mbps variable.
> >
> > > + speed_bps = (((__u64)speed_mbps) * 1000000);
> > > + } else if (matches(*argv, "handle") == 0) {
> > > + handle_present = true;
Powered by blists - more mailing lists