net: dsa: support switchdev ageing time attr

Add a new function for DSA drivers to handle the switchdev
SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME attribute.

The ageing time is passed as milliseconds.

Also because we can have multiple logical bridges on top of a physical
switch and ageing time are switch-wide, call the driver function with
the fastest ageing time in use on the chip instead of the requested one.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Vivien Didelot
2016-07-18 20:45:38 -04:00
committed by David S. Miller
parent 8ec61c7f7c
commit 34a79f63bb
2 changed files with 43 additions and 0 deletions

View File

@@ -141,6 +141,7 @@ struct dsa_switch_tree {
struct dsa_port {
struct net_device *netdev;
struct device_node *dn;
unsigned int ageing_time;
};
struct dsa_switch {
@@ -329,6 +330,7 @@ struct dsa_switch_driver {
/*
* Bridge integration
*/
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);