All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch net-next-2.6] bridge: allow hub-like behaviour
@ 2010-08-11 14:40 ` Jiri Pirko
  0 siblings, 0 replies; 18+ messages in thread
From: Jiri Pirko @ 2010-08-11 14:40 UTC (permalink / raw)
  To: netdev; +Cc: shemminger, bridge, davem

This patch allows bridge to behave much like ordinary hub. That means that
every frame received is forwarded to all ports. This functionality is of course
disabled by default, can be enabled via sysfs. This could be handy mainly for
testing purposes.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 net/bridge/br_device.c   |   14 +++++++++-----
 net/bridge/br_input.c    |   12 +++++++++---
 net/bridge/br_private.h  |    1 +
 net/bridge/br_sysfs_br.c |   25 +++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index cf09fe5..1bfc1c5 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -60,14 +60,18 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
 		}
 
 		mdst = br_mdb_get(br, skb);
-		if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb))
+		if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) &&
+		     likely(!br->hub_mode))
 			br_multicast_deliver(mdst, skb);
 		else
 			br_flood_deliver(br, skb);
-	} else if ((dst = __br_fdb_get(br, dest)) != NULL)
-		br_deliver(dst->dst, skb);
-	else
-		br_flood_deliver(br, skb);
+	} else {
+		dst = __br_fdb_get(br, dest);
+		if (dst && likely(!br->hub_mode))
+			br_deliver(dst->dst, skb);
+		else
+			br_flood_deliver(br, skb);
+	}
 
 out:
 	rcu_read_unlock();
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 826cd52..24ee87e 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -75,7 +75,8 @@ int br_handle_frame_finish(struct sk_buff *skb)
 
 	if (is_multicast_ether_addr(dest)) {
 		mdst = br_mdb_get(br, skb);
-		if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) {
+		if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) &&
+		    likely(!br->hub_mode)) {
 			if ((mdst && !hlist_unhashed(&mdst->mglist)) ||
 			    br_multicast_is_router(br))
 				skb2 = skb;
@@ -89,8 +90,13 @@ int br_handle_frame_finish(struct sk_buff *skb)
 		br->dev->stats.multicast++;
 	} else if ((dst = __br_fdb_get(br, dest)) && dst->is_local) {
 		skb2 = skb;
-		/* Do not forward the packet since it's local. */
-		skb = NULL;
+		if (likely(!br->hub_mode)) {
+			/* Do not forward the packet since it's local. */
+			skb = NULL;
+		} else {
+			/* In hub mode we want to forward the packet to all. */
+			dst = NULL;
+		}
 	}
 
 	if (skb) {
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 75c90ed..b6a9a7e 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -194,6 +194,7 @@ struct net_bridge
 	unsigned long			ageing_time;
 	unsigned long			bridge_hello_time;
 	unsigned long			bridge_forward_delay;
+	bool				hub_mode;
 
 	u8				group_addr[ETH_ALEN];
 	u16				root_port;
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 5c1e555..ac98aa4 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -345,6 +345,30 @@ static ssize_t store_flush(struct device *d,
 }
 static DEVICE_ATTR(flush, S_IWUSR, NULL, store_flush);
 
+static ssize_t show_hub_mode(struct device *d,
+			     struct device_attribute *attr, char *buf)
+{
+	struct net_bridge *br = to_bridge(d);
+
+	return sprintf(buf, "%d\n", br->hub_mode ? 1 : 0);
+}
+
+static int set_hub_mode(struct net_bridge *br, unsigned long val)
+{
+	br->hub_mode = val ? true : false;
+	return 0;
+}
+
+static ssize_t store_hub_mode(struct device *d,
+			      struct device_attribute *attr,
+			      const char *buf, size_t len)
+{
+	return store_bridge_parm(d, buf, len, set_hub_mode);
+}
+
+static DEVICE_ATTR(hub_mode, S_IRUGO | S_IWUSR,
+		   show_hub_mode, store_hub_mode);
+
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
 static ssize_t show_multicast_router(struct device *d,
 				     struct device_attribute *attr, char *buf)
@@ -698,6 +722,7 @@ static struct attribute *bridge_attrs[] = {
 	&dev_attr_gc_timer.attr,
 	&dev_attr_group_addr.attr,
 	&dev_attr_flush.attr,
+	&dev_attr_hub_mode.attr,
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
 	&dev_attr_multicast_router.attr,
 	&dev_attr_multicast_snooping.attr,
-- 
1.7.2.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Bridge] [patch net-next-2.6] bridge: allow hub-like behaviour
@ 2010-08-11 14:40 ` Jiri Pirko
  0 siblings, 0 replies; 18+ messages in thread
From: Jiri Pirko @ 2010-08-11 14:40 UTC (permalink / raw)
  To: netdev; +Cc: bridge, davem

This patch allows bridge to behave much like ordinary hub. That means that
every frame received is forwarded to all ports. This functionality is of course
disabled by default, can be enabled via sysfs. This could be handy mainly for
testing purposes.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 net/bridge/br_device.c   |   14 +++++++++-----
 net/bridge/br_input.c    |   12 +++++++++---
 net/bridge/br_private.h  |    1 +
 net/bridge/br_sysfs_br.c |   25 +++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index cf09fe5..1bfc1c5 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -60,14 +60,18 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
 		}
 
 		mdst = br_mdb_get(br, skb);
-		if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb))
+		if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) &&
+		     likely(!br->hub_mode))
 			br_multicast_deliver(mdst, skb);
 		else
 			br_flood_deliver(br, skb);
-	} else if ((dst = __br_fdb_get(br, dest)) != NULL)
-		br_deliver(dst->dst, skb);
-	else
-		br_flood_deliver(br, skb);
+	} else {
+		dst = __br_fdb_get(br, dest);
+		if (dst && likely(!br->hub_mode))
+			br_deliver(dst->dst, skb);
+		else
+			br_flood_deliver(br, skb);
+	}
 
 out:
 	rcu_read_unlock();
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 826cd52..24ee87e 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -75,7 +75,8 @@ int br_handle_frame_finish(struct sk_buff *skb)
 
 	if (is_multicast_ether_addr(dest)) {
 		mdst = br_mdb_get(br, skb);
-		if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) {
+		if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) &&
+		    likely(!br->hub_mode)) {
 			if ((mdst && !hlist_unhashed(&mdst->mglist)) ||
 			    br_multicast_is_router(br))
 				skb2 = skb;
@@ -89,8 +90,13 @@ int br_handle_frame_finish(struct sk_buff *skb)
 		br->dev->stats.multicast++;
 	} else if ((dst = __br_fdb_get(br, dest)) && dst->is_local) {
 		skb2 = skb;
-		/* Do not forward the packet since it's local. */
-		skb = NULL;
+		if (likely(!br->hub_mode)) {
+			/* Do not forward the packet since it's local. */
+			skb = NULL;
+		} else {
+			/* In hub mode we want to forward the packet to all. */
+			dst = NULL;
+		}
 	}
 
 	if (skb) {
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 75c90ed..b6a9a7e 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -194,6 +194,7 @@ struct net_bridge
 	unsigned long			ageing_time;
 	unsigned long			bridge_hello_time;
 	unsigned long			bridge_forward_delay;
+	bool				hub_mode;
 
 	u8				group_addr[ETH_ALEN];
 	u16				root_port;
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 5c1e555..ac98aa4 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -345,6 +345,30 @@ static ssize_t store_flush(struct device *d,
 }
 static DEVICE_ATTR(flush, S_IWUSR, NULL, store_flush);
 
+static ssize_t show_hub_mode(struct device *d,
+			     struct device_attribute *attr, char *buf)
+{
+	struct net_bridge *br = to_bridge(d);
+
+	return sprintf(buf, "%d\n", br->hub_mode ? 1 : 0);
+}
+
+static int set_hub_mode(struct net_bridge *br, unsigned long val)
+{
+	br->hub_mode = val ? true : false;
+	return 0;
+}
+
+static ssize_t store_hub_mode(struct device *d,
+			      struct device_attribute *attr,
+			      const char *buf, size_t len)
+{
+	return store_bridge_parm(d, buf, len, set_hub_mode);
+}
+
+static DEVICE_ATTR(hub_mode, S_IRUGO | S_IWUSR,
+		   show_hub_mode, store_hub_mode);
+
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
 static ssize_t show_multicast_router(struct device *d,
 				     struct device_attribute *attr, char *buf)
@@ -698,6 +722,7 @@ static struct attribute *bridge_attrs[] = {
 	&dev_attr_gc_timer.attr,
 	&dev_attr_group_addr.attr,
 	&dev_attr_flush.attr,
+	&dev_attr_hub_mode.attr,
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
 	&dev_attr_multicast_router.attr,
 	&dev_attr_multicast_snooping.attr,
-- 
1.7.2.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [patch net-next-2.6] bridge: allow hub-like behaviour
  2010-08-11 14:40 ` [Bridge] " Jiri Pirko
@ 2010-08-11 16:07   ` Stephen Hemminger
  -1 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2010-08-11 16:07 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, shemminger, bridge, davem

NO. unnecessary

Already possible, without patch. Just set the hold time
on the bridge to 0!

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Bridge] [patch net-next-2.6] bridge: allow hub-like behaviour
@ 2010-08-11 16:07   ` Stephen Hemminger
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2010-08-11 16:07 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, bridge, davem

NO. unnecessary

Already possible, without patch. Just set the hold time
on the bridge to 0!

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [patch net-next-2.6] bridge: allow hub-like behaviour
  2010-08-11 16:07   ` [Bridge] " Stephen Hemminger
@ 2010-08-12 11:15     ` Jiri Pirko
  -1 siblings, 0 replies; 18+ messages in thread
From: Jiri Pirko @ 2010-08-12 11:15 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, shemminger, bridge, davem

Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
>NO. unnecessary
>
>Already possible, without patch. Just set the hold time
>on the bridge to 0!

Sorry, but could you please point me a sysfs node where should I do this
setting? Unable to find this.

Thanks.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Bridge] [patch net-next-2.6] bridge: allow hub-like behaviour
@ 2010-08-12 11:15     ` Jiri Pirko
  0 siblings, 0 replies; 18+ messages in thread
From: Jiri Pirko @ 2010-08-12 11:15 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, bridge, davem

Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
>NO. unnecessary
>
>Already possible, without patch. Just set the hold time
>on the bridge to 0!

Sorry, but could you please point me a sysfs node where should I do this
setting? Unable to find this.

Thanks.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [patch net-next-2.6] bridge: allow hub-like behaviour
  2010-08-12 11:15     ` [Bridge] " Jiri Pirko
@ 2010-08-12 12:35       ` Stephen Hemminger
  -1 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2010-08-12 12:35 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, shemminger, bridge, davem

On Thu, 12 Aug 2010 13:15:24 +0200
Jiri Pirko <jpirko@redhat.com> wrote:

> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
> >NO. unnecessary
> >
> >Already possible, without patch. Just set the hold time
> >on the bridge to 0!
> 
> Sorry, but could you please point me a sysfs node where should I do this
> setting? Unable to find this.
> 
> Thanks.
> 

/sys/class/net/ethX/brport/hold_timer

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Bridge] [patch net-next-2.6] bridge: allow hub-like behaviour
@ 2010-08-12 12:35       ` Stephen Hemminger
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2010-08-12 12:35 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, bridge, davem

On Thu, 12 Aug 2010 13:15:24 +0200
Jiri Pirko <jpirko@redhat.com> wrote:

> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
> >NO. unnecessary
> >
> >Already possible, without patch. Just set the hold time
> >on the bridge to 0!
> 
> Sorry, but could you please point me a sysfs node where should I do this
> setting? Unable to find this.
> 
> Thanks.
> 

/sys/class/net/ethX/brport/hold_timer

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [patch net-next-2.6] bridge: allow hub-like behaviour
  2010-08-12 12:35       ` [Bridge] " Stephen Hemminger
@ 2010-08-12 12:48         ` Jiri Pirko
  -1 siblings, 0 replies; 18+ messages in thread
From: Jiri Pirko @ 2010-08-12 12:48 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, shemminger, bridge, davem

Thu, Aug 12, 2010 at 02:35:41PM CEST, shemminger@vyatta.com wrote:
>On Thu, 12 Aug 2010 13:15:24 +0200
>Jiri Pirko <jpirko@redhat.com> wrote:
>
>> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
>> >NO. unnecessary
>> >
>> >Already possible, without patch. Just set the hold time
>> >on the bridge to 0!
>> 
>> Sorry, but could you please point me a sysfs node where should I do this
>> setting? Unable to find this.
>> 
>> Thanks.
>> 
>
>/sys/class/net/ethX/brport/hold_timer

That's read-only:

static BRPORT_ATTR(hold_timer, S_IRUGO, show_hold_timer, NULL);


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Bridge] [patch net-next-2.6] bridge: allow hub-like behaviour
@ 2010-08-12 12:48         ` Jiri Pirko
  0 siblings, 0 replies; 18+ messages in thread
From: Jiri Pirko @ 2010-08-12 12:48 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, bridge, davem

Thu, Aug 12, 2010 at 02:35:41PM CEST, shemminger@vyatta.com wrote:
>On Thu, 12 Aug 2010 13:15:24 +0200
>Jiri Pirko <jpirko@redhat.com> wrote:
>
>> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
>> >NO. unnecessary
>> >
>> >Already possible, without patch. Just set the hold time
>> >on the bridge to 0!
>> 
>> Sorry, but could you please point me a sysfs node where should I do this
>> setting? Unable to find this.
>> 
>> Thanks.
>> 
>
>/sys/class/net/ethX/brport/hold_timer

That's read-only:

static BRPORT_ATTR(hold_timer, S_IRUGO, show_hold_timer, NULL);


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [patch net-next-2.6] bridge: allow hub-like behaviour
  2010-08-12 12:48         ` [Bridge] " Jiri Pirko
@ 2010-08-12 12:55           ` Stephen Hemminger
  -1 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2010-08-12 12:55 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, shemminger, bridge, davem

On Thu, 12 Aug 2010 14:48:48 +0200
Jiri Pirko <jpirko@redhat.com> wrote:

> Thu, Aug 12, 2010 at 02:35:41PM CEST, shemminger@vyatta.com wrote:
> >On Thu, 12 Aug 2010 13:15:24 +0200
> >Jiri Pirko <jpirko@redhat.com> wrote:
> >
> >> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
> >> >NO. unnecessary
> >> >
> >> >Already possible, without patch. Just set the hold time
> >> >on the bridge to 0!
> >> 
> >> Sorry, but could you please point me a sysfs node where should I do this
> >> setting? Unable to find this.
> >> 
> >> Thanks.
> >> 
> >
> >/sys/class/net/ethX/brport/hold_timer
> 
> That's read-only:
> 
> static BRPORT_ATTR(hold_timer, S_IRUGO, show_hold_timer, NULL);
> 

Guess you have to use ioctl() interface to change it for now.
Looks like a missed opportunity when sysfs support was added.
There are some other values like forward_delay that have same problem.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Bridge] [patch net-next-2.6] bridge: allow hub-like behaviour
@ 2010-08-12 12:55           ` Stephen Hemminger
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2010-08-12 12:55 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, bridge, davem

On Thu, 12 Aug 2010 14:48:48 +0200
Jiri Pirko <jpirko@redhat.com> wrote:

> Thu, Aug 12, 2010 at 02:35:41PM CEST, shemminger@vyatta.com wrote:
> >On Thu, 12 Aug 2010 13:15:24 +0200
> >Jiri Pirko <jpirko@redhat.com> wrote:
> >
> >> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
> >> >NO. unnecessary
> >> >
> >> >Already possible, without patch. Just set the hold time
> >> >on the bridge to 0!
> >> 
> >> Sorry, but could you please point me a sysfs node where should I do this
> >> setting? Unable to find this.
> >> 
> >> Thanks.
> >> 
> >
> >/sys/class/net/ethX/brport/hold_timer
> 
> That's read-only:
> 
> static BRPORT_ATTR(hold_timer, S_IRUGO, show_hold_timer, NULL);
> 

Guess you have to use ioctl() interface to change it for now.
Looks like a missed opportunity when sysfs support was added.
There are some other values like forward_delay that have same problem.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [patch net-next-2.6] bridge: allow hub-like behaviour
  2010-08-12 12:48         ` [Bridge] " Jiri Pirko
@ 2010-08-12 13:02           ` Stephen Hemminger
  -1 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2010-08-12 13:02 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, shemminger, bridge, davem

On Thu, 12 Aug 2010 14:48:48 +0200
Jiri Pirko <jpirko@redhat.com> wrote:

> Thu, Aug 12, 2010 at 02:35:41PM CEST, shemminger@vyatta.com wrote:
> >On Thu, 12 Aug 2010 13:15:24 +0200
> >Jiri Pirko <jpirko@redhat.com> wrote:
> >
> >> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
> >> >NO. unnecessary
> >> >
> >> >Already possible, without patch. Just set the hold time
> >> >on the bridge to 0!
> >> 
> >> Sorry, but could you please point me a sysfs node where should I do this
> >> setting? Unable to find this.
> >> 
> >> Thanks.
> >> 
> >
> >/sys/class/net/ethX/brport/hold_timer

Too early...

hold_time is computed from ageing time, so that is the value
you need to set:

$ ls -l /sys/class/net/br0/bridge/ageing_time 
-rw-r--r-- 1 root root 4096 2010-08-12 08:34 /sys/class/net/br0/bridge/ageing_time

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Bridge] [patch net-next-2.6] bridge: allow hub-like behaviour
@ 2010-08-12 13:02           ` Stephen Hemminger
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2010-08-12 13:02 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, bridge, davem

On Thu, 12 Aug 2010 14:48:48 +0200
Jiri Pirko <jpirko@redhat.com> wrote:

> Thu, Aug 12, 2010 at 02:35:41PM CEST, shemminger@vyatta.com wrote:
> >On Thu, 12 Aug 2010 13:15:24 +0200
> >Jiri Pirko <jpirko@redhat.com> wrote:
> >
> >> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
> >> >NO. unnecessary
> >> >
> >> >Already possible, without patch. Just set the hold time
> >> >on the bridge to 0!
> >> 
> >> Sorry, but could you please point me a sysfs node where should I do this
> >> setting? Unable to find this.
> >> 
> >> Thanks.
> >> 
> >
> >/sys/class/net/ethX/brport/hold_timer

Too early...

hold_time is computed from ageing time, so that is the value
you need to set:

$ ls -l /sys/class/net/br0/bridge/ageing_time 
-rw-r--r-- 1 root root 4096 2010-08-12 08:34 /sys/class/net/br0/bridge/ageing_time

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [patch net-next-2.6] bridge: allow hub-like behaviour
  2010-08-12 12:55           ` [Bridge] " Stephen Hemminger
@ 2010-08-12 13:20             ` Jiri Pirko
  -1 siblings, 0 replies; 18+ messages in thread
From: Jiri Pirko @ 2010-08-12 13:20 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, shemminger, bridge, davem

Thu, Aug 12, 2010 at 02:55:20PM CEST, shemminger@vyatta.com wrote:
>On Thu, 12 Aug 2010 14:48:48 +0200
>Jiri Pirko <jpirko@redhat.com> wrote:
>
>> Thu, Aug 12, 2010 at 02:35:41PM CEST, shemminger@vyatta.com wrote:
>> >On Thu, 12 Aug 2010 13:15:24 +0200
>> >Jiri Pirko <jpirko@redhat.com> wrote:
>> >
>> >> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
>> >> >NO. unnecessary
>> >> >
>> >> >Already possible, without patch. Just set the hold time
>> >> >on the bridge to 0!
>> >> 
>> >> Sorry, but could you please point me a sysfs node where should I do this
>> >> setting? Unable to find this.
>> >> 
>> >> Thanks.
>> >> 
>> >
>> >/sys/class/net/ethX/brport/hold_timer
>> 
>> That's read-only:
>> 
>> static BRPORT_ATTR(hold_timer, S_IRUGO, show_hold_timer, NULL);
>> 
>
>Guess you have to use ioctl() interface to change it for now.
>Looks like a missed opportunity when sysfs support was added.
>There are some other values like forward_delay that have same problem.


Oh you mislead me. It's not hold_timer but hold_time function:

static inline unsigned long hold_time(const struct net_bridge *br)
{
        return br->topology_change ? br->forward_delay : br->ageing_time;
}

called from br_fdb_update().

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Bridge] [patch net-next-2.6] bridge: allow hub-like behaviour
@ 2010-08-12 13:20             ` Jiri Pirko
  0 siblings, 0 replies; 18+ messages in thread
From: Jiri Pirko @ 2010-08-12 13:20 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, bridge, davem

Thu, Aug 12, 2010 at 02:55:20PM CEST, shemminger@vyatta.com wrote:
>On Thu, 12 Aug 2010 14:48:48 +0200
>Jiri Pirko <jpirko@redhat.com> wrote:
>
>> Thu, Aug 12, 2010 at 02:35:41PM CEST, shemminger@vyatta.com wrote:
>> >On Thu, 12 Aug 2010 13:15:24 +0200
>> >Jiri Pirko <jpirko@redhat.com> wrote:
>> >
>> >> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
>> >> >NO. unnecessary
>> >> >
>> >> >Already possible, without patch. Just set the hold time
>> >> >on the bridge to 0!
>> >> 
>> >> Sorry, but could you please point me a sysfs node where should I do this
>> >> setting? Unable to find this.
>> >> 
>> >> Thanks.
>> >> 
>> >
>> >/sys/class/net/ethX/brport/hold_timer
>> 
>> That's read-only:
>> 
>> static BRPORT_ATTR(hold_timer, S_IRUGO, show_hold_timer, NULL);
>> 
>
>Guess you have to use ioctl() interface to change it for now.
>Looks like a missed opportunity when sysfs support was added.
>There are some other values like forward_delay that have same problem.


Oh you mislead me. It's not hold_timer but hold_time function:

static inline unsigned long hold_time(const struct net_bridge *br)
{
        return br->topology_change ? br->forward_delay : br->ageing_time;
}

called from br_fdb_update().

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [patch net-next-2.6] bridge: allow hub-like behaviour
  2010-08-12 13:02           ` [Bridge] " Stephen Hemminger
@ 2010-08-12 13:40             ` Jiri Pirko
  -1 siblings, 0 replies; 18+ messages in thread
From: Jiri Pirko @ 2010-08-12 13:40 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, shemminger, bridge, davem

Thu, Aug 12, 2010 at 03:02:51PM CEST, shemminger@vyatta.com wrote:
>On Thu, 12 Aug 2010 14:48:48 +0200
>Jiri Pirko <jpirko@redhat.com> wrote:
>
>> Thu, Aug 12, 2010 at 02:35:41PM CEST, shemminger@vyatta.com wrote:
>> >On Thu, 12 Aug 2010 13:15:24 +0200
>> >Jiri Pirko <jpirko@redhat.com> wrote:
>> >
>> >> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
>> >> >NO. unnecessary
>> >> >
>> >> >Already possible, without patch. Just set the hold time
>> >> >on the bridge to 0!
>> >> 
>> >> Sorry, but could you please point me a sysfs node where should I do this
>> >> setting? Unable to find this.
>> >> 
>> >> Thanks.
>> >> 
>> >
>> >/sys/class/net/ethX/brport/hold_timer
>
>Too early...
>
>hold_time is computed from ageing time, so that is the value
>you need to set:
>
>$ ls -l /sys/class/net/br0/bridge/ageing_time 
>-rw-r--r-- 1 root root 4096 2010-08-12 08:34 /sys/class/net/br0/bridge/ageing_time

Yep, figured that out. Works as expected. Thanks Stephen.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Bridge] [patch net-next-2.6] bridge: allow hub-like behaviour
@ 2010-08-12 13:40             ` Jiri Pirko
  0 siblings, 0 replies; 18+ messages in thread
From: Jiri Pirko @ 2010-08-12 13:40 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, bridge, davem

Thu, Aug 12, 2010 at 03:02:51PM CEST, shemminger@vyatta.com wrote:
>On Thu, 12 Aug 2010 14:48:48 +0200
>Jiri Pirko <jpirko@redhat.com> wrote:
>
>> Thu, Aug 12, 2010 at 02:35:41PM CEST, shemminger@vyatta.com wrote:
>> >On Thu, 12 Aug 2010 13:15:24 +0200
>> >Jiri Pirko <jpirko@redhat.com> wrote:
>> >
>> >> Wed, Aug 11, 2010 at 06:07:41PM CEST, shemminger@vyatta.com wrote:
>> >> >NO. unnecessary
>> >> >
>> >> >Already possible, without patch. Just set the hold time
>> >> >on the bridge to 0!
>> >> 
>> >> Sorry, but could you please point me a sysfs node where should I do this
>> >> setting? Unable to find this.
>> >> 
>> >> Thanks.
>> >> 
>> >
>> >/sys/class/net/ethX/brport/hold_timer
>
>Too early...
>
>hold_time is computed from ageing time, so that is the value
>you need to set:
>
>$ ls -l /sys/class/net/br0/bridge/ageing_time 
>-rw-r--r-- 1 root root 4096 2010-08-12 08:34 /sys/class/net/br0/bridge/ageing_time

Yep, figured that out. Works as expected. Thanks Stephen.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2010-08-12 13:40 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-11 14:40 [patch net-next-2.6] bridge: allow hub-like behaviour Jiri Pirko
2010-08-11 14:40 ` [Bridge] " Jiri Pirko
2010-08-11 16:07 ` Stephen Hemminger
2010-08-11 16:07   ` [Bridge] " Stephen Hemminger
2010-08-12 11:15   ` Jiri Pirko
2010-08-12 11:15     ` [Bridge] " Jiri Pirko
2010-08-12 12:35     ` Stephen Hemminger
2010-08-12 12:35       ` [Bridge] " Stephen Hemminger
2010-08-12 12:48       ` Jiri Pirko
2010-08-12 12:48         ` [Bridge] " Jiri Pirko
2010-08-12 12:55         ` Stephen Hemminger
2010-08-12 12:55           ` [Bridge] " Stephen Hemminger
2010-08-12 13:20           ` Jiri Pirko
2010-08-12 13:20             ` [Bridge] " Jiri Pirko
2010-08-12 13:02         ` Stephen Hemminger
2010-08-12 13:02           ` [Bridge] " Stephen Hemminger
2010-08-12 13:40           ` Jiri Pirko
2010-08-12 13:40             ` [Bridge] " Jiri Pirko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.