Re: [PATCH iproute2-next 2/5] netshaper: Add bw-min and weight parameter support

David Ahern
2026-05-01T17:50:53Z

On 4/30/26 7:16 PM, Mohsin Bashir wrote:
> diff --git a/netshaper/netshaper.c b/netshaper/netshaper.c
> index 1603e6e5..4ee30525 100644
> --- a/netshaper/netshaper.c
> +++ b/netshaper/netshaper.c
> @@ -33,11 +33,12 @@ static void usage(void)
> "OPTIONS := { -V[ersion] | -c[olor] | -help }\n"
> "COMMAND := { set | get | delete } dev DEVNAME\n"
> " handle scope HANDLE_SCOPE [id HANDLE_ID]\n"
> - " [bw-max BW_MAX]\n"
> + " [bw-max BW_MAX] [bw-min BW_MIN] [weight WEIGHT]\n"

natural order is min then max

> "Where: DEVNAME := STRING\n"
> " HANDLE_SCOPE := { netdev | queue | node }\n"
> " HANDLE_ID := UINT (required for queue/node, optional for netdev)\n"
> - " BW_MAX := UINT{ kbit | mbit | gbit }\n");
> + " BW_MAX/BW_MIN := UINT{ kbit | mbit | gbit }\n"
> + " WEIGHT := UINT\n");
> }
>
> static const char *net_shaper_scope_names[NET_SHAPER_SCOPE_MAX + 1] = {
> @@ -125,13 +126,13 @@ static int do_cmd(int argc, char **argv, int cmd)
> GENL_REQUEST(req, 1024, genl_family, 0, NET_SHAPER_FAMILY_VERSION, cmd,
> NLM_F_REQUEST | NLM_F_ACK);
>
> - struct nlmsghdr *answer;
> - __u64 bw_max_bps = 0;
> - int ifindex = -1;
> + bool has_bw_max = false, has_bw_min = false, has_weight = false;

can `bw_{max,min}_bps != 0` be used instead of a separate bool?
similarly for weight