diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2021-06-21 19:42:15 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-21 22:50:20 +0300 |
commit | a8986681ccada614a30df7248390780e7708a763 (patch) | |
tree | 8034667b4db5e55e09e1d935da7deb4856045c0d /net/dsa/switch.c | |
parent | 8674f8d310215d2bb7469b80e6cfccc044f717b3 (diff) | |
download | linux-a8986681ccada614a30df7248390780e7708a763.tar.xz |
net: dsa: export the dsa_port_is_{user,cpu,dsa} helpers
The difference between dsa_is_user_port and dsa_port_is_user is that the
former needs to look up the list of ports of the DSA switch tree in
order to find the struct dsa_port, while the latter directly receives it
as an argument.
dsa_is_user_port is already in widespread use and has its place, so
there isn't any chance of converting all callers to a single form.
But being able to do:
dsa_port_is_user(dp)
instead of
dsa_is_user_port(dp->ds, dp->index)
is much more efficient too, especially when the "dp" comes from an
iterator over the DSA switch tree - this reduces the complexity from
quadratic to linear.
Move these helpers from dsa2.c to include/net/dsa.h so that others can
use them too.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/switch.c')
0 files changed, 0 insertions, 0 deletions