include: net: add dsa_cpu_ports function
Subsystems (3)
PATCH 1/1 include: net: add dsa_cpu_ports function
In preparation for the future when dsa will support multi cpu port, dsa_cpu_ports can be useful for switch that has multiple cpu port to retrieve the cpu mask for ACL and bridge table.
Signed-off-by Ansuel Smith <[email protected]>
--- include/net/dsa.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
include/net/dsa.h +12 -0
@@ -446,6 +446,18 @@ static inline u32 dsa_user_ports(struct dsa_switch *ds)return mask; } +static inline u32 dsa_cpu_ports (struct dsa_switch *ds) +{ +u32 mask =0 ; +int p; + +for (p =0 ; p < ds->num_ports; p++) +if (dsa_is_cpu_port (ds, p)) + mask |=BIT (p); + +return mask; +} +/* Return the local port used to reach an arbitrary switch device */ static inline unsigned int dsa_routing_port (struct dsa_switch *ds,int device) {
Signature · 1 line
2.30.2
Andrew Lunn
maintainerQuoted 18 lines · Ansuel Smith
In preparation for the future when dsa will support multi cpu port,
dsa_cpu_portscan be useful for switch that has multiple cpu port to retrieve the cpu mask for ACL and bridge table.Signed-off-by Ansuel Smith <[email protected]>--- include/net/dsa.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)include/net/dsa.h +1
-0@@ -446,6 +446,18 @@ static inline u32 dsa_user_ports(struct dsa_switch *ds)return mask; } +static inline u32 dsa_cpu_ports (struct dsa_switch *ds)
include/net/dsa.h static inline u32 dsa_user_ports(struct dsa_switch *ds) · line 459
Quoted 10 lines
include/net/dsa.h +10
-0+{ +u32 mask =0 ; +int p; + +for (p =0 ; p < ds->num_ports; p++) +if (dsa_is_cpu_port (ds, p)) + mask |=BIT (p); + +return mask; +}
Hi Ansuel
We don't add a function unless it has a user. Please call it from somewhere.
Andrew