@@ -178,6 +178,11 @@ struct sja1105_flow_block {
int num_virtual_links;
};
+enum sja1105_vlan_state {
+ SJA1105_VLAN_UNAWARE,
+ SJA1105_VLAN_FILTERING_FULL,
+};
+
struct sja1105_private {
struct sja1105_static_config static_config;
bool rgmii_rx_delay[SJA1105_NUM_PORTS];
@@ -193,6 +198,7 @@ struct sja1105_private {
* the switch doesn't confuse them with one another.
*/
struct mutex mgmt_lock;
+ enum sja1105_vlan_state vlan_state;
struct sja1105_tagger_data tagger_data;
struct sja1105_ptp_data ptp_data;
struct sja1105_tas_data tas_data;
@@ -1917,6 +1917,7 @@ static int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled)
struct sja1105_l2_lookup_params_entry *l2_lookup_params;
struct sja1105_general_params_entry *general_params;
struct sja1105_private *priv = ds->priv;
+ enum sja1105_vlan_state state;
struct sja1105_table *table;
struct sja1105_rule *rule;
u16 tpid, tpid2;
@@ -1940,6 +1941,13 @@ static int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled)
tpid2 = ETH_P_SJA1105;
}
+ if (!enabled)
+ state = SJA1105_VLAN_UNAWARE;
+ else
+ state = SJA1105_VLAN_FILTERING_FULL;
+
+ priv->vlan_state = state;
+
table = &priv->static_config.tables[BLK_IDX_GENERAL_PARAMS];
general_params = table->entries;
/* EtherType used to identify inner tagged (C-tag) VLAN traffic */
@@ -1985,6 +1993,14 @@ static int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled)
return sja1105_setup_8021q_tagging(ds, !enabled);
}
+bool sja1105_can_use_vlan_as_tags(struct dsa_switch *ds)
+{
+ struct sja1105_private *priv = ds->priv;
+
+ return priv->vlan_state != SJA1105_VLAN_FILTERING_FULL;
+}
+EXPORT_SYMBOL_GPL(sja1105_can_use_vlan_as_tags);
+
static void sja1105_vlan_add(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_vlan *vlan)
{
@@ -61,4 +61,6 @@ struct sja1105_port {
bool hwts_tx_en;
};
+bool sja1105_can_use_vlan_as_tags(struct dsa_switch *ds);
+
#endif /* _NET_DSA_SJA1105_H */
@@ -74,7 +74,7 @@ static inline bool sja1105_is_meta_frame(const struct sk_buff *skb)
*/
static bool sja1105_filter(const struct sk_buff *skb, struct net_device *dev)
{
- if (!dsa_port_is_vlan_filtering(dev->dsa_ptr))
+ if (sja1105_can_use_vlan_as_tags(dev->dsa_ptr->ds))
return true;
if (sja1105_is_link_local(skb))
return true;