aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/dsa.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-04-30 23:05:30 -0400
committerDavid S. Miller <davem@davemloft.net>2019-04-30 23:05:30 -0400
commit492593010de4a323a7b98dffb0ba6567456b5ba0 (patch)
tree69566e08f1d74a449e6df3d1444ef89925084780 /include/net/dsa.h
parenta658a3f2ecbabba60dafa9ba94f12fc25c18474f (diff)
parent314f76d7a68bab0516aa52877944e6aacfa0fc3f (diff)
downloadkernel_replicant_linux-492593010de4a323a7b98dffb0ba6567456b5ba0.tar.gz
kernel_replicant_linux-492593010de4a323a7b98dffb0ba6567456b5ba0.tar.bz2
kernel_replicant_linux-492593010de4a323a7b98dffb0ba6567456b5ba0.zip
Merge branch 'dsa-core-vlan'
Vladimir Oltean says: ==================== Improvements to DSA core VLAN manipulation In preparation of submitting the NXP SJA1105 driver, the Broadcom b53 and Mediatek mt7530 drivers have been found to apply some VLAN workarounds that are needed in the new driver as well. Therefore this patchset is mostly simply promoting the DSA driver workarounds for VLAN to the generic code. The b53 driver was applying a few workarounds in order to convince DSA that its vlan_filtering setting is not really per-port. This is now simply set by the driver via a DSA variable at probe time. The sja1105 driver will be a second user of this. The mt7530 was also keeping track of when the .port_vlan_filtering callback was being called. Remove the kept state from this driver and simplify dealing with vlan_filtering in the generic case. TODO: Find the best way to deal generically with the situation described below (discussion at https://lkml.org/lkml/2019/4/16/1355): > > +Segregating the switch ports in multiple bridges is supported (e.g. 2 + 2), but > > +all bridges should have the same level of VLAN awareness (either both have > > +``vlan_filtering`` 0, or both 1). Also an inevitable limitation of the fact > > +that VLAN awareness is global at the switch level is that once a bridge with > > +``vlan_filtering`` enslaves at least one switch port, the other un-bridged > > +ports are no longer available for standalone traffic termination. > > That is quite a limitation that I don't think I had fully grasped until > reading your different patches. Since enslaving ports into a bridge > comes after the network device was already made available for use, maybe > you should force the carrier down or something along those lines as soon > as a port is enslaved into a bridge with vlan_filtering=1 to make this > more predictable for the user? ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dsa.h')
-rw-r--r--include/net/dsa.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index b550f7bb5314..1e6b4efc80b9 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -161,6 +161,7 @@ struct dsa_port {
const char *mac;
struct device_node *dn;
unsigned int ageing_time;
+ bool vlan_filtering;
u8 stp_state;
struct net_device *bridge_dev;
struct devlink_port devlink_port;
@@ -227,6 +228,16 @@ struct dsa_switch {
/* Number of switch port queues */
unsigned int num_tx_queues;
+ /* Disallow bridge core from requesting different VLAN awareness
+ * settings on ports if not hardware-supported
+ */
+ bool vlan_filtering_is_global;
+
+ /* In case vlan_filtering_is_global is set, the VLAN awareness state
+ * should be retrieved from here and not from the per-port settings.
+ */
+ bool vlan_filtering;
+
unsigned long *bitmap;
unsigned long _bitmap;
@@ -294,6 +305,16 @@ static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port)
return dsa_towards_port(ds, cpu_dp->ds->index, cpu_dp->index);
}
+static inline bool dsa_port_is_vlan_filtering(const struct dsa_port *dp)
+{
+ const struct dsa_switch *ds = dp->ds;
+
+ if (ds->vlan_filtering_is_global)
+ return ds->vlan_filtering;
+ else
+ return dp->vlan_filtering;
+}
+
typedef int dsa_fdb_dump_cb_t(const unsigned char *addr, u16 vid,
bool is_static, void *data);
struct dsa_switch_ops {