net: dsa: tag_8021q: add helpers to deduce whether a VLAN ID is RX or TX VLAN
The sja1105 implementation can be blind about this, but the felix driver doesn't do exactly what it's being told, so it needs to know whether it is a TX or an RX VLAN, so it can install the appropriate type of TCAM rule. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
de1da8bcf4
commit
9c7caf2806
|
@ -64,6 +64,10 @@ int dsa_8021q_rx_source_port(u16 vid);
|
|||
|
||||
u16 dsa_8021q_rx_subvlan(u16 vid);
|
||||
|
||||
bool vid_is_dsa_8021q_rxvlan(u16 vid);
|
||||
|
||||
bool vid_is_dsa_8021q_txvlan(u16 vid);
|
||||
|
||||
bool vid_is_dsa_8021q(u16 vid);
|
||||
|
||||
#else
|
||||
|
@ -123,6 +127,16 @@ u16 dsa_8021q_rx_subvlan(u16 vid)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool vid_is_dsa_8021q_rxvlan(u16 vid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool vid_is_dsa_8021q_txvlan(u16 vid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool vid_is_dsa_8021q(u16 vid)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -133,10 +133,21 @@ u16 dsa_8021q_rx_subvlan(u16 vid)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(dsa_8021q_rx_subvlan);
|
||||
|
||||
bool vid_is_dsa_8021q_rxvlan(u16 vid)
|
||||
{
|
||||
return (vid & DSA_8021Q_DIR_MASK) == DSA_8021Q_DIR_RX;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vid_is_dsa_8021q_rxvlan);
|
||||
|
||||
bool vid_is_dsa_8021q_txvlan(u16 vid)
|
||||
{
|
||||
return (vid & DSA_8021Q_DIR_MASK) == DSA_8021Q_DIR_TX;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vid_is_dsa_8021q_txvlan);
|
||||
|
||||
bool vid_is_dsa_8021q(u16 vid)
|
||||
{
|
||||
return ((vid & DSA_8021Q_DIR_MASK) == DSA_8021Q_DIR_RX ||
|
||||
(vid & DSA_8021Q_DIR_MASK) == DSA_8021Q_DIR_TX);
|
||||
return vid_is_dsa_8021q_rxvlan(vid) || vid_is_dsa_8021q_txvlan(vid);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vid_is_dsa_8021q);
|
||||
|
||||
|
|
Loading…
Reference in New Issue