[PATCH] Fix for bcm43xx_mac_suspend timeouts - please test

2006-07-02 Thread Larry Finger

Michael,

In trying various things in mac_suspend, I accidentally messed up the test for IRQ ready so that the 
code returned immediately. The bottom line was that nothing went wrong. There were no crashes and no 
hangs. On that basis, I changed the code as shown in the following patch. This code has been running 
for two days on my system. Numerous MAC suspend failed messages have been logged, but the 
interface has not failed. I will continue testing.


Larry



index 1cd47c5..a7ae1a9 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -2307,24 +2147,22 @@ void bcm43xx_mac_enable(struct bcm43xx_p
bcm43xx_power_saving_ctl_bits(bcm, -1, -1);
 }

-/* http://bcm-specs.sipsolutions.net/SuspendMAC */
+/* http://bcm-specs.sipsolutions.net/SuspendMAC calls for the code to delay as 
long as 10 ms for
+   the interface to set the BCM43xx_IRQ_READY bit in 
BCM43xx_MMIO_GEN_IRQ_REASON. To date, only
+   Rev 2 of the BCM4306 has needed any delay before setting the ready bit, and 
this revision
+   seems to work OK without a delay, even when the ready bit is not set. 
Therefore, the delay loop
+   has been removed. */
+
 void bcm43xx_mac_suspend(struct bcm43xx_private *bcm)
 {
-   int i;
-   u32 tmp;
-
bcm43xx_power_saving_ctl_bits(bcm, -1, 1);
bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD,
bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD)
 ~BCM43xx_SBF_MAC_ENABLED);
bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy read */
-   for (i = 10; i; i--) {
-   tmp = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
-   if (tmp  BCM43xx_IRQ_READY)
-   return;
-   udelay(10);
-   }
-   printkl(KERN_ERR PFX MAC suspend failed\n);
+   if (!(bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON)  
BCM43xx_IRQ_READY))
+   printkl(KERN_ERR PFX MAC suspend failed\n);
+   return;
 }

 void bcm43xx_set_iwmode(struct bcm43xx_private *bcm,


=
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
http://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH] Fix for bcm43xx_mac_suspend timeouts - please test

2006-07-02 Thread Michael Buesch
On Sunday 02 July 2006 17:45, you wrote:
 Michael,
 
 In trying various things in mac_suspend, I accidentally messed up the test 
 for IRQ ready so that the 
 code returned immediately. The bottom line was that nothing went wrong. There 
 were no crashes and no 
 hangs. On that basis, I changed the code as shown in the following patch. 
 This code has been running 
 for two days on my system. Numerous MAC suspend failed messages have been 
 logged, but the 
 interface has not failed. I will continue testing.

This patch is not going upstream, as it is broken.
What are you trying to do here?
If the READY bit will be there the first time IT WON'T LOOP ANYWAY.

PLEASE stop messing with the mac_suspend, and apply my original patch.
Damnit!

We _must_ synchronize with the device here. Fullstop.

 
 
 index 1cd47c5..a7ae1a9 100644
 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
 +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
 @@ -2307,24 +2147,22 @@ void bcm43xx_mac_enable(struct bcm43xx_p
   bcm43xx_power_saving_ctl_bits(bcm, -1, -1);
   }
 
 -/* http://bcm-specs.sipsolutions.net/SuspendMAC */
 +/* http://bcm-specs.sipsolutions.net/SuspendMAC calls for the code to delay 
 as long as 10 ms for
 +   the interface to set the BCM43xx_IRQ_READY bit in 
 BCM43xx_MMIO_GEN_IRQ_REASON. To date, only
 +   Rev 2 of the BCM4306 has needed any delay before setting the ready bit, 
 and this revision
 +   seems to work OK without a delay, even when the ready bit is not set. 
 Therefore, the delay loop
 +   has been removed. */
 +
   void bcm43xx_mac_suspend(struct bcm43xx_private *bcm)
   {
 - int i;
 - u32 tmp;
 -
   bcm43xx_power_saving_ctl_bits(bcm, -1, 1);
   bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD,
   bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD)
~BCM43xx_SBF_MAC_ENABLED);
   bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy read */
 - for (i = 10; i; i--) {
 - tmp = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
 - if (tmp  BCM43xx_IRQ_READY)
 - return;
 - udelay(10);
 - }
 - printkl(KERN_ERR PFX MAC suspend failed\n);
 + if (!(bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON)  
 BCM43xx_IRQ_READY))
 + printkl(KERN_ERR PFX MAC suspend failed\n);
 + return;
   }
 
   void bcm43xx_set_iwmode(struct bcm43xx_private *bcm,
 
 
 =
 

-- 
Greetings Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
http://lists.berlios.de/mailman/listinfo/bcm43xx-dev