]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: make LAG IDs one-based
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 23 Feb 2022 14:00:47 +0000 (16:00 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 25 Feb 2022 05:31:42 +0000 (21:31 -0800)
commitbbc98c49a2686857a218a41bc9952e703e34d4dc
tree51c6dcc08ff233c5ceec4f7b391925f99a5f6957
parent99dfab2f850399a7429f8db8968b65e1028c810f
net: dsa: make LAG IDs one-based

The DSA LAG API will be changed to become more similar with the bridge
data structures, where struct dsa_bridge holds an unsigned int num,
which is generated by DSA and is one-based. We have a similar thing
going with the DSA LAG, except that isn't stored anywhere, it is
calculated dynamically by dsa_lag_id() by iterating through dst->lags.

The idea of encoding an invalid (or not requested) LAG ID as zero for
the purpose of simplifying checks in drivers means that the LAG IDs
passed by DSA to drivers need to be one-based too. So back-and-forth
conversion is needed when indexing the dst->lags array, as well as in
drivers which assume a zero-based index.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/qca8k.c
include/net/dsa.h
net/dsa/dsa2.c
net/dsa/tag_dsa.c