]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: spectrum_router: Remove unnecessary prefix lengths from LPM tree
authorIdo Schimmel <idosch@mellanox.com>
Mon, 22 Jan 2018 08:17:42 +0000 (09:17 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Jan 2018 14:22:11 +0000 (09:22 -0500)
commite2ae53694a64e5a040b59d28694b0b6a910949da
tree5f8907de0f205a4f96fd8c4dd5772592006816af
parent5577b0af3aaf30b100b26df4ace6b39aca950745
mlxsw: spectrum_router: Remove unnecessary prefix lengths from LPM tree

In commit 8cbd61b03cca ("mlxsw: spectrum_router: Use one LPM tree for
all virtual routers") I tried to make sure only used prefix lengths are
present in the LPM tree shared between all virtual routers.

However, this optimization had to be removed in commit cae6f47548fc
("mlxsw: spectrum_router: Avoid expensive lookup during route removal"),
since determining the used prefix lengths required us to traverse all
the active virtual routers, which could result in a hung task depending
on the number of VRFs and whether routes were removed due to abort or
not.

Re-introduce the optimization by moving the prefix usage accounting from
the virtual routers to the LPM tree, as this accounting is only used in
order to determine the tree's structure.

To make the sharing of the trees more explicit, the two trees (for IPv4
and IPv6) are stored in the shared router struct and upon the creation
of a virtual router it is immediately bound to both.

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