bonding with 3c59x driver
Subsystems (3)
Hi Steffen, all,
I am trying to do network bonding on top of 3com 3C905C ethernet adapters. I am facing the problem that network cable removal isn't detected. It is detected when using Realtek hardware with driver 8139too or VIA hardware with driver via-rhine, but no luck with driver 3c59x. I'm using bonding option miimon=100 for link detection.
Does anyone know if this is a hardware limitation, or a missing feature of the 3c59x driver, or a bug in that driver?
Thanks,
Signature · 2 lines
Jean Delvare Suse L3
Quoted 8 lines · Jean Delvare
I am trying to do network bonding on top of 3com 3C905C ethernet adapters. I am facing the problem that network cable removal isn't detected. It is detected when using Realtek hardware with driver 8139too or VIA hardware with driver via-rhine, but no luck with driver 3c59x. I'm using bonding option miimon=100 for link detection.
Does anyone know if this is a hardware limitation, or a missing feature of the 3c59x driver, or a bug in that driver?
It just so happens that I was looking at 3c59x earlier today for
something else. It appears to run its internal link state detection on a 5 second timer, after which (in theory) bonding's miimon would notice (provided that the driver notices and calls netif_carrier_off).
If that's not working, did you try use_carrier=0 to probe the
mii register state directly?
I have used 3c59x with bonding in the distant past, but I don't
recall exactly what tweaks were necessary; it may have required use_carrier=0 to work at all.
-J
---
-Jay Vosburgh, IBM Linux Technology Center, [email protected]
Hi Jay,
Thanks for the fast answer.
Quoted 8 lines · Jay Vosburgh
Quoted 7 lines · Jean Delvare
I am trying to do network bonding on top of 3com 3C905C ethernet adapters. I am facing the problem that network cable removal isn't detected. It is detected when using Realtek hardware with driver 8139too or VIA hardware with driver via-rhine, but no luck with driver 3c59x. I'm using bonding option miimon=100 for link detection.
Quoted 8 lines
Quoted 2 lines
Does anyone know if this is a hardware limitation, or a missing feature of the 3c59x driver, or a bug in that driver?
It just so happens that I was looking at 3c59x earlier today for
something else. It appears to run its internal link state detection
on a 5 second timer, after which (in theory) bonding's miimon would notice (provided that the driver notices and callsnetif_carrier_off).
Thanks for the pointer. There is indeed a 5 second timer to detect transitions from link down to link up. However the timer period to detect transitions from link up to link down is 1 minute. Knowing that, I tested again and indeed the bonding module end up detecting the link going down, after up to 1 minute. That's not exactly convenient for bonding.
I admit I don't quite get the rationale for having different timer periods for detecting the link going up or down. Steffen, this was done by you in:
commit b4ff6450f5336c492d1e2f184d3b8186e0716b7a
Author: Steffen Klassert <[email protected]> Date: Sun Mar 26 01:37:40 2006 -0800
[PATCH] 3c59x: decrease polling interval
No rationale explained in the commit message. Can you explain? I find the asymmetry confusing, I'd rather use 5 seconds (if not less) for both cases.
Quoted 2 lines
If that's not working, did you try use_carrier=0 to probe the
mii register state directly?
I tried use_carrier=0 but it makes no difference.
Quoted 3 lines
I have used 3c59x with bonding in the distant past, but I don't
recall exactly what tweaks were necessary; it may have required use_carrier=0 to work at all.
Well I am still curious why the 3c59x driver has such slow polling when other drivers I have been testing are able to report almost instantly when I remove a network cable. Could it be that other network chips generate an interrupt on cable removal and the 3com chips do not?
Signature · 2 lines
Jean Delvare Suse L3
Quoted 34 lines · Jean Delvare
Hi Jay,
Thanks for the fast answer.
Quoted 8 lines · Jay Vosburgh
Quoted 7 lines · Jean Delvare
I am trying to do network bonding on top of 3com 3C905C ethernet adapters. I am facing the problem that network cable removal isn't detected. It is detected when using Realtek hardware with driver 8139too or VIA hardware with driver via-rhine, but no luck with driver 3c59x. I'm using bonding option miimon=100 for link detection.
Quoted 8 lines
Quoted 2 lines
Does anyone know if this is a hardware limitation, or a missing feature of the 3c59x driver, or a bug in that driver?
It just so happens that I was looking at 3c59x earlier today for
something else. It appears to run its internal link state detection
on a 5 second timer, after which (in theory) bonding's miimon would notice (provided that the driver notices and callsnetif_carrier_off).Thanks for the pointer. There is indeed a 5 second timer to detect transitions from link down to link up. However the timer period to detect transitions from link up to link down is 1 minute. Knowing that, I tested again and indeed the bonding module end up detecting the link going down, after up to 1 minute. That's not exactly convenient for bonding.
I admit I don't quite get the rationale for having different timer periods for detecting the link going up or down. Steffen, this was done by you in:
commit
b4ff6450f5336c492d1e2f184d3b8186e0716b7a
Quoted 8 lines
Author: Steffen Klassert <[email protected]> Date: Sun Mar 26 01:37:40 2006 -0800[PATCH] 3c59x: decrease polling interval
No rationale explained in the commit message. Can you explain? I find the asymmetry confusing, I'd rather use 5 seconds (if not less) for both cases.
This patch is based on a discussion with Andrew Morton some years ago. The 3c59x does polling for external environment changes which is quite expensive. Firing a timer that disables the interrupts on a running interface every 5 seconds is just not reasonable for checking for external environment changes. So we decided to let it depend on the link status, 5 seconds if the link is down and 60 seconds if the link is up.
Quoted 6 lines
Well I am still curious why the 3c59x driver has such slow polling when
other drivers I have been testing are able to report almost instantly when I remove a network cable. Could it be that other network chips generate an interrupt on cable removal and the 3com chips do not?
Not sure about those specific cards, but detecting the link state might require software bit-banging of an MII (or similar) interface.
Since this needs delays between all the edges it can end up spinning the cpu for a noticable time, especially if the resolution (and minimim delay) of the delay() function used is significantly longer than the delays actually required - which might only be a few 100ns.
Using a cpu spin for the delays is also slightly problematical because the writes might get 'posted' and delayed further - so the writes have to be forced out to the device itself (eg by a readback) prior to the delay() being requested.
If the driver is polling the link status it might be valid to do one bit-bang transition on each timer interrupt. This would separate the edges without spinning the cpu - provided there is a fast method for being called on every timer tick.
Another scheme I have used is to write each value to the bit-bang register multiple times - using the maximum speed of the IO writes to generate the required delays.
David
Quoted 6 lines · Jean Delvare
Well I am still curious why the 3c59x driver has such slow polling when other drivers I have been testing are able to report almost instantly when I remove a network cable. Could it be that other network chips generate an interrupt on cable removal and the 3com chips do not?
Yes, at least some of the supported chips do not generate an interrupt on cable removal, so we have to check for this with a timer.
Quoted 11 lines · Steffen Klassert
Quoted 6 lines · Jean Delvare
Well I am still curious why the 3c59x driver has such slow polling when other drivers I have been testing are able to report almost instantly when I remove a network cable. Could it be that other network chips generate an interrupt on cable removal and the 3com chips do not?
Yes, at least some of the supported chips do not generate an interrupt on cable removal, so we have to check for this with a timer. --
We could have a 5 sec timer in case device is a slave.
drivers/net/ethernet/3com/3c59x.c +1 -1
@@ -1841,7 +1841,7 @@ vortex_timer(unsigned long data) ok =1 ; } -if (!netif_carrier_ok (dev)) +if (dev->flags &IFF_SLAVE || !netif_carrier_ok (dev)) next_tick =5 *HZ ;if (vp->medialock)
Jean Delvare
Acked-byHi Eric, Steffen,
Quoted 11 lines · Eric Dumazet
Quoted 10 lines · Steffen Klassert
Quoted 5 lines · Jean Delvare
Well I am still curious why the 3c59x driver has such slow polling when other drivers I have been testing are able to report almost instantly when I remove a network cable. Could it be that other network chips generate an interrupt on cable removal and the 3com chips do not?
Yes, at least some of the supported chips do not generate an interrupt on cable removal, so we have to check for this with a timer.
Too bad. I confirm I can't see the interrupt count increase when I remove the network cable from my 3C905C (nor when I plug it back in), but I was hopping this was a matter of enabling this event as an interrupt source in the driver. If the hardware just can't do it then this is hopeless. Back in the days I used to consider the 3C905 as the best fast Ethernet cards around, apparently I was horribly wrong.
Thanks for explaining anyway.
Quoted 7 lines
We could have a 5 sec timer in case device is a slave.
(quoted diff) +0
-0b/drivers/net/ethernet/3com/3c59x.c index 1282f04..e463d10 100644
drivers/net/ethernet/3com/3c59x.c vortex_timer(unsigned long data) · line 1847
Quoted 8 lines
drivers/net/ethernet/3com/3c59x.c +1
-1@@ -1841,7 +1841,7 @@ vortex_timer(unsigned long data) ok =1 ; } -if (!netif_carrier_ok (dev)) +if (dev->flags &IFF_SLAVE || !netif_carrier_ok (dev)) next_tick =5 *HZ ;if (vp->medialock)
Yes I think this makes a lot of sense. If you send this upstream you can add:
Signature · 2 lines
Jean Delvare Suse L3
Quoted 15 lines · Jean Delvare
Quoted 15 lines
We could have a 5 sec timer in case device is a slave.
(quoted diff) +0
-0b/drivers/net/ethernet/3com/3c59x.c index 1282f04..e463d10 100644drivers/net/ethernet/3com/3c59x.c +1
-1@@ -1841,7 +1841,7 @@ vortex_timer(unsigned long data) ok =1 ; } -if (!netif_carrier_ok (dev)) +if (dev->flags &IFF_SLAVE || !netif_carrier_ok (dev)) next_tick =5 *HZ ;
Quoted 7 lines
drivers/net/ethernet/3com/3c59x.c vortex_timer(unsigned long data) · line 1847
Quoted 1 line
drivers/net/ethernet/3com/3c59x.c +0
-0if (vp->medialock)Yes I think this makes a lot of sense. If you send this upstream you can add:
Acked-by Jean Delvare <[email protected]>
I'm fine with this too.
David Miller
maintainerFrom: Steffen Klassert <[email protected]>
Date: Tue, 14 Feb 2012 14:34:18 +0100
Quoted 21 lines · Jean Delvare
Quoted 20 lines
Quoted 8 lines
We could have a 5 sec timer in case device is a slave.
(quoted diff) +0
-0b/drivers/net/ethernet/3com/3c59x.c index 1282f04..e463d10 100644drivers/net/ethernet/3com/3c59x.c vortex_timer(unsigned long data) · line 1847
Quoted 8 lines
drivers/net/ethernet/3com/3c59x.c +1
-1@@ -1841,7 +1841,7 @@ vortex_timer(unsigned long data) ok =1 ; } -if (!netif_carrier_ok (dev)) +if (dev->flags &IFF_SLAVE || !netif_carrier_ok (dev)) next_tick =5 *HZ ;if (vp->medialock)Yes I think this makes a lot of sense. If you send this upstream you can add:
Quoted 4 lines
Quoted 2 lines
Acked-by Jean Delvare <[email protected]>I'm fine with this too.
Eric, please submit this formally.
PATCH 1/1 3c59x: shorten timer period for slave devices
Jean Delvare reported bonding on top of 3c59x adapters was not detecting network cable removal fast enough.
3c59x indeed uses a 60 seconds timer to check link status if carrier is on, and 5 seconds if carrier is off.
This patch reduces timer period to 5 seconds if device is a bonding slave.
--- drivers/net/ethernet/3com/3c59x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/3com/3c59x.c +1 -1
@@ -1841,7 +1841,7 @@ vortex_timer(unsigned long data) ok =1 ; } -if (!netif_carrier_ok (dev)) +if (dev->flags &IFF_SLAVE || !netif_carrier_ok (dev)) next_tick =5 *HZ ;if (vp->medialock)
Re: [PATCH] 3c59x: shorten timer period for slave devices
Quoted 8 lines · Eric Dumazet
Jean Delvare reported bonding on top of 3c59x adapters was not detecting network cable removal fast enough.
3c59x indeed uses a 60 seconds timer to check link status if carrier is on, and 5 seconds if carrier is off.
This patch reduces timer period to 5 seconds if device is a bonding slave.
Maybe for posterity give some rationale as to why we feel we can reduce it to 5 seconds for slaves instead of reducing the timer period in general? If you weren't party to this discussion that won't be apparent from the commit log.
Dan
Quoted 27 lines
Reported-by Jean Delvare <[email protected]>Acked-by Jean Delvare <[email protected]>Acked-by Steffen Klassert <[email protected]>Signed-off-by Eric Dumazet <[email protected]>--- drivers/net/ethernet/3com/3c59x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/3com/3c59x.c +1
-2@@ -1841,7 +1841,7 @@ vortex_timer(unsigned long data) ok =1 ; } -if (!netif_carrier_ok (dev)) +if (dev->flags &IFF_SLAVE || !netif_carrier_ok (dev)) next_tick =5 *HZ ;if (vp->medialock) --To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] 3c59x: shorten timer period for slave devices
Quoted 7 lines · Dan Williams
Quoted 6 lines · Eric Dumazet
Jean Delvare reported bonding on top of 3c59x adapters was not detecting network cable removal fast enough.
3c59x indeed uses a 60 seconds timer to check link status if carrier is on, and 5 seconds if carrier is off.
Quoted 7 lines
Quoted 2 lines
This patch reduces timer period to 5 seconds if device is a bonding slave.
Maybe for posterity give some rationale as to why we feel we can reduce it to 5 seconds for slaves instead of reducing the timer period in general? If you weren't party to this discussion that won't be apparent from the commit log.
Apparently, Andrew Morton considered firing a timer every 5 seconds was too expensive. I am not sure we want to state this (probably old fact) in the changelog. Anyway are these slow NICS still used in 2011 ? ;)
David Miller
maintainerRe: [PATCH] 3c59x: shorten timer period for slave devices
From: Eric Dumazet <[email protected]>
Date: Tue, 14 Feb 2012 22:02:56 +0100
Quoted 11 lines · Dan Williams
Quoted 10 lines · Eric Dumazet
Quoted 8 lines
Jean Delvare reported bonding on top of 3c59x adapters was not detecting network cable removal fast enough.
3c59x indeed uses a 60 seconds timer to check link status if carrier is on, and 5 seconds if carrier is off.
This patch reduces timer period to 5 seconds if device is a bonding slave.
Quoted 8 lines
Quoted 4 lines
Maybe for posterity give some rationale as to why we feel we can reduce it to 5 seconds for slaves instead of reducing the timer period in general? If you weren't party to this discussion that won't be apparent from the commit log.
Apparently, Andrew Morton considered firing a timer every 5 seconds was too expensive. I am not sure we want to state this (probably old fact) in the changelog. Anyway are these slow NICS still used in 2011 ? ;)
At least Jean Delvare is :-)
I'm going to apply this as-is, if you configure bonding on one of these chips you expect it to work. And working is more important than optimal.
Quoted 20 lines · Eric Dumazet
Quoted 11 lines · Steffen Klassert
Quoted 6 lines · Jean Delvare
Well I am still curious why the 3c59x driver has such slow polling when other drivers I have been testing are able to report almost instantly when I remove a network cable. Could it be that other network chips generate an interrupt on cable removal and the 3com chips do not?
Yes, at least some of the supported chips do not generate an interrupt on cable removal, so we have to check for this with a timer. --
We could have a 5 sec timer in case device is a slave.
drivers/net/ethernet/3com/3c59x.c +0
-0
drivers/net/ethernet/3com/3c59x.c vortex_timer(unsigned long data) · line 1847
Quoted 8 lines
drivers/net/ethernet/3com/3c59x.c +1
-1@@ -1841,7 +1841,7 @@ vortex_timer(unsigned long data) ok =1 ; } -if (!netif_carrier_ok (dev)) +if (dev->flags&IFF_SLAVE || !netif_carrier_ok (dev)) next_tick =5 *HZ ;if (vp->medialock)
Does the device being a slave in a bond change the overheads of the check being performed?
rick jones
Quoted 23 lines · Rick Jones
Quoted 22 lines · Eric Dumazet
Quoted 10 lines · Steffen Klassert
Quoted 5 lines · Jean Delvare
Well I am still curious why the 3c59x driver has such slow polling when other drivers I have been testing are able to report almost instantly when I remove a network cable. Could it be that other network chips generate an interrupt on cable removal and the 3com chips do not?
Yes, at least some of the supported chips do not generate an interrupt on cable removal, so we have to check for this with a timer. --
We could have a 5 sec timer in case device is a slave.
(quoted diff) +0
-0
b/drivers/net/ethernet/3com/3c59x.cindex 1282f04..e463d10 100644drivers/net/ethernet/3com/3c59x.c +0
-0@@ -1841,7 +1841,7 @@ vortex_timer(unsigned long data) ok =1 ; }
Quoted 8 lines
drivers/net/ethernet/3com/3c59x.c vortex_timer(unsigned long data) · line 1847
Quoted 5 lines
drivers/net/ethernet/3com/3c59x.c +1
-1-if (!netif_carrier_ok (dev)) +if (dev->flags&IFF_SLAVE || !netif_carrier_ok (dev)) next_tick =5 *HZ ;if (vp->medialock)Does the device being a slave in a bond change the overheads of the check being performed?
No, but it changes the interest in having faster polling. The overhead is the same but the interest/overhead trade-off is much higher.
Without the patch above, doing bonding on top of 3c59x is simply not possible, at least not in active-backup mode. For other modes it depends if you are only interested in load balancing or also on redundancy.
Signature · 2 lines
Jean Delvare Suse L3
Quoted 3 lines · Jean Delvare
Without the patch above, doing bonding on top of 3c59x is simply not possible, at least not in active-backup mode. For other modes it depends if you are only interested in load balancing or also on redundancy.
Could you just use arp monitoring instead of mii?
Chris
Signature · 5 lines
Chris Friesen Software Developer GENBAND [email protected] www.genband.com
Quoted 7 lines · Chris Friesen
Quoted 4 lines · Jean Delvare
Without the patch above, doing bonding on top of 3c59x is simply not possible, at least not in active-backup mode. For other modes it depends if you are only interested in load balancing or also on redundancy.
Could you just use arp monitoring instead of mii?
If it was just for me, I could, and probably would. But when I am trying to reproduce a customer bug, I have to use exactly the same options the customer is using.
Signature · 2 lines
Jean Delvare Suse L3