Commit 123dd0e7 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[BRIDGE}: More user hz conversions.

parent bc261db7
...@@ -41,15 +41,15 @@ static __inline__ int has_expired(struct net_bridge *br, ...@@ -41,15 +41,15 @@ static __inline__ int has_expired(struct net_bridge *br,
return 0; return 0;
} }
static __inline__ void copy_fdb(struct __fdb_entry *ent, struct net_bridge_fdb_entry *f) static __inline__ void copy_fdb(struct __fdb_entry *ent,
const struct net_bridge_fdb_entry *f)
{ {
memset(ent, 0, sizeof(struct __fdb_entry)); memset(ent, 0, sizeof(struct __fdb_entry));
memcpy(ent->mac_addr, f->addr.addr, ETH_ALEN); memcpy(ent->mac_addr, f->addr.addr, ETH_ALEN);
ent->port_no = f->dst?f->dst->port_no:0; ent->port_no = f->dst?f->dst->port_no:0;
ent->is_local = f->is_local; ent->is_local = f->is_local;
ent->ageing_timer_value = 0; ent->ageing_timer_value = f->is_static ? 0
if (!f->is_static) : ((jiffies - f->ageing_timer) * USER_HZ) / HZ;
ent->ageing_timer_value = jiffies - f->ageing_timer;
} }
static __inline__ int br_mac_hash(unsigned char *mac) static __inline__ int br_mac_hash(unsigned char *mac)
......
...@@ -19,19 +19,22 @@ ...@@ -19,19 +19,22 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "br_private.h" #include "br_private.h"
/* import values in USER_HZ */
static inline unsigned long user_to_ticks(unsigned long utick)
{
return (utick * HZ) / USER_HZ;
}
/* Report time remaining in user HZ for compatibility. */ /* export values in USER_HZ */
static inline unsigned long timer_residue(const struct br_timer *timer) static inline unsigned long ticks_to_user(unsigned long tick)
{ {
return timer->running return (tick * USER_HZ) / HZ;
? ((jiffies - timer->expires) * USER_HZ)/HZ
: 0;
} }
/* Convert API times in USER_HZ to kernel */ /* Report time remaining in user HZ */
static inline unsigned long user_to_ticks(unsigned long utick) static unsigned long timer_residue(const struct br_timer *timer)
{ {
return (utick * HZ) / USER_HZ; return ticks_to_user(timer->running ? (jiffies - timer->expires) : 0);
} }
static int br_ioctl_device(struct net_bridge *br, static int br_ioctl_device(struct net_bridge *br,
...@@ -73,18 +76,18 @@ static int br_ioctl_device(struct net_bridge *br, ...@@ -73,18 +76,18 @@ static int br_ioctl_device(struct net_bridge *br,
memcpy(&b.designated_root, &br->designated_root, 8); memcpy(&b.designated_root, &br->designated_root, 8);
memcpy(&b.bridge_id, &br->bridge_id, 8); memcpy(&b.bridge_id, &br->bridge_id, 8);
b.root_path_cost = br->root_path_cost; b.root_path_cost = br->root_path_cost;
b.max_age = br->max_age; b.max_age = ticks_to_user(br->max_age);
b.hello_time = br->hello_time; b.hello_time = ticks_to_user(br->hello_time);
b.forward_delay = br->forward_delay; b.forward_delay = br->forward_delay;
b.bridge_max_age = br->bridge_max_age; b.bridge_max_age = br->bridge_max_age;
b.bridge_hello_time = br->bridge_hello_time; b.bridge_hello_time = br->bridge_hello_time;
b.bridge_forward_delay = br->bridge_forward_delay; b.bridge_forward_delay = ticks_to_user(br->bridge_forward_delay);
b.topology_change = br->topology_change; b.topology_change = br->topology_change;
b.topology_change_detected = br->topology_change_detected; b.topology_change_detected = br->topology_change_detected;
b.root_port = br->root_port; b.root_port = br->root_port;
b.stp_enabled = br->stp_enabled; b.stp_enabled = br->stp_enabled;
b.ageing_time = br->ageing_time; b.ageing_time = ticks_to_user(br->ageing_time);
b.gc_interval = br->gc_interval; b.gc_interval = ticks_to_user(br->gc_interval);
b.hello_timer_value = timer_residue(&br->hello_timer); b.hello_timer_value = timer_residue(&br->hello_timer);
b.tcn_timer_value = timer_residue(&br->tcn_timer); b.tcn_timer_value = timer_residue(&br->tcn_timer);
b.topology_change_timer_value = timer_residue(&br->topology_change_timer); b.topology_change_timer_value = timer_residue(&br->topology_change_timer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment