net: dsa: add dsa_is_normal_port helper

Introduce a dsa_is_normal_port helper to check if a given port is a
normal user port as opposed to a CPU port or DSA link.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Vivien Didelot 2017-03-11 16:12:58 -05:00 committed by David S. Miller
parent 01bd96c883
commit 6cd456f382

View file

@ -248,6 +248,11 @@ static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p)
return !!((ds->dsa_port_mask) & (1 << p)); return !!((ds->dsa_port_mask) & (1 << 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);
}
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->enabled_port_mask & (1 << p) && ds->ports[p].netdev; return ds->enabled_port_mask & (1 << p) && ds->ports[p].netdev;