aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/dsa.h
diff options
context:
space:
mode:
authorDavid S. Miller <[email protected]>2017-01-29 23:42:47 +0000
committerDavid S. Miller <[email protected]>2017-01-29 23:42:47 +0000
commit6d45408db1ad87c2080cffeb7868553eec6e053b (patch)
tree28d1ab92fd28edc6d9a2232e2e17b64660b87046 /include/net/dsa.h
parentMerge branch 'ravb-gigabit-R-Car-H3-ES1.1-and-R-Car-M3-W' (diff)
parentnet: dsa: b53: use dsa_port's bridge pointer (diff)
downloadkernel-6d45408db1ad87c2080cffeb7868553eec6e053b.tar.gz
kernel-6d45408db1ad87c2080cffeb7868553eec6e053b.zip
Merge branch 'dsa-multi-chip-prep'
Vivien Didelot says: ==================== net: dsa: preparatory patches for multi-chip In order to introduce support for multi-chip configuration, we need to do a few enhancements. This patchset makes the number of ports in a switch dynamic (instead of capping to DSA_MAX_PORTS), stores the switch and index of a port in the dsa_port structure, uses it in the slave private structure, and exposes the bridge device a port belongs to. ==================== Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'include/net/dsa.h')
-rw-r--r--include/net/dsa.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 92fd795e9573..b951e2ebda75 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -140,10 +140,13 @@ struct dsa_switch_tree {
};
struct dsa_port {
+ struct dsa_switch *ds;
+ unsigned int index;
struct net_device *netdev;
struct device_node *dn;
unsigned int ageing_time;
u8 stp_state;
+ struct net_device *bridge_dev;
};
struct dsa_switch {
@@ -190,8 +193,11 @@ struct dsa_switch {
u32 cpu_port_mask;
u32 enabled_port_mask;
u32 phys_mii_mask;
- struct dsa_port ports[DSA_MAX_PORTS];
struct mii_bus *slave_mii_bus;
+
+ /* Dynamically allocated ports, keep last */
+ size_t num_ports;
+ struct dsa_port ports[];
};
static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
@@ -319,7 +325,8 @@ struct dsa_switch_ops {
int (*set_ageing_time)(struct dsa_switch *ds, unsigned int msecs);
int (*port_bridge_join)(struct dsa_switch *ds, int port,
struct net_device *bridge);
- void (*port_bridge_leave)(struct dsa_switch *ds, int port);
+ void (*port_bridge_leave)(struct dsa_switch *ds, int port,
+ struct net_device *bridge);
void (*port_stp_state_set)(struct dsa_switch *ds, int port,
u8 state);
void (*port_fast_age)(struct dsa_switch *ds, int port);
@@ -386,6 +393,7 @@ static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)
return dst->rcv != NULL;
}
+struct dsa_switch *dsa_switch_alloc(struct device *dev, size_t n);
void dsa_unregister_switch(struct dsa_switch *ds);
int dsa_register_switch(struct dsa_switch *ds, struct device *dev);
#ifdef CONFIG_PM_SLEEP