Commit 60045cbf authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

net: dsa: Add dsa_is_dsa_port() helper

Add an inline helper for determining is a port is a DSA port.
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1e72e6f8
...@@ -1926,8 +1926,7 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port) ...@@ -1926,8 +1926,7 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
* full duplex. * full duplex.
*/ */
reg = _mv88e6xxx_reg_read(ds, REG_PORT(port), PORT_PCS_CTRL); reg = _mv88e6xxx_reg_read(ds, REG_PORT(port), PORT_PCS_CTRL);
if (dsa_is_cpu_port(ds, port) || if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) {
ds->dsa_port_mask & (1 << port)) {
reg |= PORT_PCS_CTRL_FORCE_LINK | reg |= PORT_PCS_CTRL_FORCE_LINK |
PORT_PCS_CTRL_LINK_UP | PORT_PCS_CTRL_LINK_UP |
PORT_PCS_CTRL_DUPLEX_FULL | PORT_PCS_CTRL_DUPLEX_FULL |
...@@ -1992,7 +1991,7 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port) ...@@ -1992,7 +1991,7 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
mv88e6xxx_6165_family(ds) || mv88e6xxx_6097_family(ds) || mv88e6xxx_6165_family(ds) || mv88e6xxx_6097_family(ds) ||
mv88e6xxx_6095_family(ds) || mv88e6xxx_6065_family(ds) || mv88e6xxx_6095_family(ds) || mv88e6xxx_6065_family(ds) ||
mv88e6xxx_6320_family(ds)) { mv88e6xxx_6320_family(ds)) {
if (ds->dsa_port_mask & (1 << port)) if (dsa_is_dsa_port(ds, port))
reg |= PORT_CONTROL_FRAME_MODE_DSA; reg |= PORT_CONTROL_FRAME_MODE_DSA;
if (port == dsa_upstream_port(ds)) if (port == dsa_upstream_port(ds))
reg |= PORT_CONTROL_FORWARD_UNKNOWN | reg |= PORT_CONTROL_FORWARD_UNKNOWN |
......
...@@ -171,6 +171,11 @@ static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p) ...@@ -171,6 +171,11 @@ static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port); return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port);
} }
static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p)
{
return !!((ds->dsa_port_mask) & (1 << p));
}
static inline bool dsa_is_port_initialized(struct dsa_switch *ds, int p) static inline bool dsa_is_port_initialized(struct dsa_switch *ds, int p)
{ {
return ds->phys_port_mask & (1 << p) && ds->ports[p]; return ds->phys_port_mask & (1 << p) && ds->ports[p];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment