Re: [PATCH v3 net-next 2/4] net: dsa: Link aggregation support
From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2020-12-04 04:05:47
On 12/2/2020 1:13 AM, Tobias Waldekranz wrote:
Monitor the following events and notify the driver when: - A DSA port joins/leaves a LAG. - A LAG, made up of DSA ports, joins/leaves a bridge. - A DSA port in a LAG is enabled/disabled (enabled meaning "distributing" in 802.3ad LACP terms). Each LAG interface to which a DSA port is attached is represented by a `struct dsa_lag` which is globally reachable from the switch tree and from each associated port. When a LAG joins a bridge, the DSA subsystem will treat that as each individual port joining the bridge. The driver may look at the port's LAG pointer to see if it is associated with any LAG, if that is required. This is analogue to how switchdev events are replicated out to all lower devices when reaching e.g. a LAG. Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Vladimir and Andrew have already spotted what I was going to comment on, just a few suggestions below: [snip]
+struct dsa_lag {
+ struct net_device *dev;
+ int id;unsigned int?
+ + struct list_head ports; + + /* For multichip systems, we must ensure that each hash bucket + * is only enabled on a single egress port throughout the + * whole tree, lest we send duplicates. Therefore we must + * maintain a global list of active tx ports, so that each + * switch can figure out which buckets to enable on which + * ports. + */ + struct list_head tx_ports; + int num_tx;
unsigned int? Which if you change the type would require you to also change the types of some iterators you used. -- Florian