]> git.ipfire.org Git - thirdparty/iproute2.git/commit
ip: nexthop: Support 16-bit nexthop weights
authorPetr Machata <petrm@nvidia.com>
Fri, 16 Aug 2024 17:38:12 +0000 (19:38 +0200)
committerDavid Ahern <dsahern@kernel.org>
Mon, 19 Aug 2024 01:06:46 +0000 (01:06 +0000)
commit1fa8811c5048daaf32782b5a5e47194bee1f70fb
tree8a0ef020389496b2aae11d6ad03ade13e3a09b70
parenta61a44b608910e98a553863e72ea8ab42f416448
ip: nexthop: Support 16-bit nexthop weights

Two interlinked changes related to the nexthop group management have been
recently merged in kernel commit e96f6fd30eec ("Merge branch
'net-nexthop-increase-weight-to-u16'").

- One of the reserved bytes in struct nexthop_grp was redefined to carry
  high-order bits of the nexthop weight, thus allowing 16-bit nexthop
  weights.

- NHA_OP_FLAGS started getting dumped on nexthop group dump to carry a
  flag, NHA_OP_FLAG_RESP_GRP_RESVD_0, that indicates that reserved fields
  in struct nexthop_grp are zeroed before dumping.

If NHA_OP_FLAG_RESP_GRP_RESVD_0 is given, it is safe to interpret the newly
named nexthop_grp.weight_high as high-order bits of nexthop weight.

Extend ipnexthop to support configuring nexthop weights of up to 65536, and
when dumping, to interpret nexthop_grp.weight_high if safe.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
ip/ipnexthop.c
ip/nh_common.h