提交 deb8ee0b 编写于 作者: V Vivien Didelot 提交者: David S. Miller

net: dsa: fix dsa_is_normal_port helper

In order to know if a port is of type user, dsa_is_normal_port checks
that the given port is not of type DSA nor CPU. This is not enough
because a port can be unused.

Without the previous fix, this caused the unused mv88e6xxx ports to be
configured in normal mode.

The ds->enabled_port_mask reports the user ports, so check this instead.
Signed-off-by: NVivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 91dee144
...@@ -273,7 +273,7 @@ static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p) ...@@ -273,7 +273,7 @@ static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p)
static inline bool dsa_is_normal_port(struct dsa_switch *ds, int p) static inline bool dsa_is_normal_port(struct dsa_switch *ds, int p)
{ {
return !dsa_is_cpu_port(ds, p) && !dsa_is_dsa_port(ds, p); return !!(ds->enabled_port_mask & BIT(p));
} }
static inline const struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p) static inline const struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册