Skip to content

Commit 6ac311a

Browse files
Elad Razdavem330
authored andcommitted
Adding switchdev ageing notification on port bridged
Configure ageing time to the HW for newly bridged device CC: Scott Feldman <[email protected]> CC: Jiri Pirko <[email protected]> Signed-off-by: Elad Raz <[email protected]> Acked-by: Jiri Pirko <[email protected]> Acked-by: Scott Feldman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent eb9fae3 commit 6ac311a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

net/bridge/br_stp_if.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/kmod.h>
1616
#include <linux/etherdevice.h>
1717
#include <linux/rtnetlink.h>
18+
#include <net/switchdev.h>
1819

1920
#include "br_private.h"
2021
#include "br_private_stp.h"
@@ -35,11 +36,22 @@ static inline port_id br_make_port_id(__u8 priority, __u16 port_no)
3536
/* called under bridge lock */
3637
void br_init_port(struct net_bridge_port *p)
3738
{
39+
struct switchdev_attr attr = {
40+
.id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
41+
.flags = SWITCHDEV_F_SKIP_EOPNOTSUPP | SWITCHDEV_F_DEFER,
42+
.u.ageing_time = p->br->ageing_time,
43+
};
44+
int err;
45+
3846
p->port_id = br_make_port_id(p->priority, p->port_no);
3947
br_become_designated_port(p);
4048
br_set_state(p, BR_STATE_BLOCKING);
4149
p->topology_change_ack = 0;
4250
p->config_pending = 0;
51+
52+
err = switchdev_port_attr_set(p->dev, &attr);
53+
if (err)
54+
netdev_err(p->dev, "failed to set HW ageing time\n");
4355
}
4456

4557
/* called under bridge lock */

0 commit comments

Comments
 (0)