提交 465c3de4 编写于 作者: V Vladimir Oltean 提交者: Jakub Kicinski

net: dsa: introduce the dsa_cpu_ports() helper

Similar to dsa_user_ports() which retrieves a port mask of all user
ports, introduce dsa_cpu_ports() which retrieves the mask of all CPU
ports of a switch.
Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 910ee6cc
...@@ -590,6 +590,17 @@ static inline u32 dsa_user_ports(struct dsa_switch *ds) ...@@ -590,6 +590,17 @@ static inline u32 dsa_user_ports(struct dsa_switch *ds)
return mask; return mask;
} }
static inline u32 dsa_cpu_ports(struct dsa_switch *ds)
{
struct dsa_port *cpu_dp;
u32 mask = 0;
dsa_switch_for_each_cpu_port(cpu_dp, ds)
mask |= BIT(cpu_dp->index);
return mask;
}
/* Return the local port used to reach an arbitrary switch device */ /* Return the local port used to reach an arbitrary switch device */
static inline unsigned int dsa_routing_port(struct dsa_switch *ds, int device) static inline unsigned int dsa_routing_port(struct dsa_switch *ds, int device)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册