Skip to contentSkip to conversation

switchdev: bridge: Pass ageing time as clock_t instead of jiffies

PATCH In review Jiri Pirko 4 participants 4 messages Dec 21, 2015 – Dec 22, 2015

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

PATCH 1/1 switchdev: bridge: Pass ageing time as clock_t instead of jiffies

From: Ido Schimmel <[email protected]>

The bridge's ageing time is offloaded to hardware when:
1) A port joins a bridge
2) The ageing time of the bridge is changed

In the first case the ageing time is offloaded as jiffies, but in the second case it's offloaded as clock_t, which is what existing switchdev drivers expect to receive.

Fixes 6ac311ae8bfb ("Adding switchdev ageing notification on port bridged")
---
 net/bridge/br_stp_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_stp_if.c +1 -1
index 5396ff08..12045de 100644
@@ -39,7 +39,7 @@ void br_init_port(struct net_bridge_port *p)
 	struct switchdev_attr attr = {
 		.id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
 		.flags = SWITCHDEV_F_SKIP_EOPNOTSUPP | SWITCHDEV_F_DEFER,
-		.u.ageing_time = p->br->ageing_time,
+		.u.ageing_time = jiffies_to_clock_t(p->br->ageing_time),
 	};
 	int err;
 
Signature · 1 line
2.4.3
#1 lore raw

net/bridge/br_stp_if.c void br_init_port(struct net_bridge_port *p) · line 44

Quoted 12 lines · Jiri Pirko
net/bridge/br_stp_if.c +1 -1
index 5396ff08..12045de 100644
@@ -39,7 +39,7 @@ void br_init_port(struct net_bridge_port *p)
  	struct switchdev_attr attr = {
  		.id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
  		.flags = SWITCHDEV_F_SKIP_EOPNOTSUPP | SWITCHDEV_F_DEFER,
-		.u.ageing_time = p->br->ageing_time,
+		.u.ageing_time = jiffies_to_clock_t(p->br->ageing_time),
  	};
  	int err;

ageing_time is a u32; clock_t is a long.

#2 lore raw
Quoted 16 lines · Mon, Dec 21, 2015 at 05:53:19PM IST, [email protected] wrote:

net/bridge/br_stp_if.c void br_init_port(struct net_bridge_port *p) · line 44

Quoted 12 lines · Jiri Pirko
net/bridge/br_stp_if.c +1 -1
index 5396ff08..12045de 100644
@@ -39,7 +39,7 @@ void br_init_port(struct net_bridge_port *p)
  	struct switchdev_attr attr = {
  		.id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
  		.flags = SWITCHDEV_F_SKIP_EOPNOTSUPP | SWITCHDEV_F_DEFER,
-		.u.ageing_time = p->br->ageing_time,
+		.u.ageing_time = jiffies_to_clock_t(p->br->ageing_time),
  	};
  	int err;

ageing_time is a u32; clock_t is a long.

Hi,

p->br->ageing_time is set in br_set_ageing_time, where it's converted to jiffies from clock_t, that is treated as u32.

maintainer
#3 lore raw
In reply to Jiri Pirko

From: Jiri Pirko <[email protected]>
Date: Mon, 21 Dec 2015 09:56:01 +0100

Quoted 6 lines

From: Ido Schimmel <[email protected]>

The bridge's ageing time is offloaded to hardware when:
1) A port joins a bridge
2) The ageing time of the bridge is changed

Quoted 7 lines

In the first case the ageing time is offloaded as jiffies, but in the second case it's offloaded as clock_t, which is what existing switchdev drivers expect to receive.

Fixes 6ac311ae8bfb ("Adding switchdev ageing notification on port bridged")

Applied and queued up for -stable, thanks!