]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: spectrum_router: Populate adjacency entries according to weights
authorIdo Schimmel <idosch@mellanox.com>
Sun, 22 Oct 2017 21:11:48 +0000 (23:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 23 Oct 2017 04:23:06 +0000 (05:23 +0100)
commitbdc1b16bfbbfe32c5e4c0cb0caf4af3961ad1704
treefc17c43ea34592456640300fbd070029b8810506
parent3ccec6f50773dbd3a4ae4218bdfd4322d580ec2c
mlxsw: spectrum_router: Populate adjacency entries according to weights

Up until now the driver assumed all the nexthops have an equal weight
and wrote each to a single adjacency entry.

This patch takes the `weight` parameter into account and populates the
adjacency group according to the relative weight of each nexthop.

Specifically, the weights of all the nexthops that should be offloaded
are first normalized and then used to calculate the upper adjacency
index of each nexthop. This is done according to the hash-threshold
algorithm used by the kernel for IPv4 multi-path routing.

Adjacency groups are currently limited to 32 entries which limits the
weights that can be used, but follow-up patches will introduce groups of
512 entries.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c