Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a293ee990d0a3ba945eda5d0861969d0ca7ce62c
Commit:     a293ee990d0a3ba945eda5d0861969d0ca7ce62c
Parent:     5be3bda8987b12a87863c89b74b136fdb1f072db
Author:     Stefano Brivio <[EMAIL PROTECTED]>
AuthorDate: Sat Nov 24 23:35:25 2007 +0100
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 15:05:04 2008 -0800

    b43legacy: reinit on too many PHY TX errors
    
    Restart the hardware on too many PHY TX errors. A thousand PHY TX errors
    per 15 seconds means we won't be able to recover for sure.
    
    Signed-off-by: Stefano Brivio <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 drivers/net/wireless/b43legacy/b43legacy.h |    5 +++++
 drivers/net/wireless/b43legacy/main.c      |   15 ++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43legacy/b43legacy.h 
b/drivers/net/wireless/b43legacy/b43legacy.h
index d906f6e..e4de437 100644
--- a/drivers/net/wireless/b43legacy/b43legacy.h
+++ b/drivers/net/wireless/b43legacy/b43legacy.h
@@ -276,6 +276,8 @@
 #define B43legacy_DEFAULT_SHORT_RETRY_LIMIT    7
 #define B43legacy_DEFAULT_LONG_RETRY_LIMIT     4
 
+#define B43legacy_PHY_TX_BADNESS_LIMIT         1000
+
 /* Max size of a security key */
 #define B43legacy_SEC_KEYSIZE          16
 /* Security algorithms. */
@@ -511,6 +513,9 @@ struct b43legacy_phy {
        u16 lofcal;
 
        u16 initval;
+
+       /* PHY TX errors counter. */
+       atomic_t txerr_cnt;
 };
 
 /* Data structures for DMA transmission, per 80211 core. */
diff --git a/drivers/net/wireless/b43legacy/main.c 
b/drivers/net/wireless/b43legacy/main.c
index 92c03b0..aa723ef 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -1221,8 +1221,15 @@ static void b43legacy_interrupt_tasklet(struct 
b43legacy_wldev *dev)
        if (unlikely(reason & B43legacy_IRQ_MAC_TXERR))
                b43legacyerr(dev->wl, "MAC transmission error\n");
 
-       if (unlikely(reason & B43legacy_IRQ_PHY_TXERR))
+       if (unlikely(reason & B43legacy_IRQ_PHY_TXERR)) {
                b43legacyerr(dev->wl, "PHY transmission error\n");
+               rmb();
+               if (unlikely(atomic_dec_and_test(&dev->phy.txerr_cnt))) {
+                       b43legacyerr(dev->wl, "Too many PHY TX errors, "
+                                             "restarting the controller\n");
+                       b43legacy_controller_restart(dev, "PHY TX errors");
+               }
+       }
 
        if (unlikely(merged_dma_reason & (B43legacy_DMAIRQ_FATALMASK |
                                          B43legacy_DMAIRQ_NONFATALMASK))) {
@@ -2094,6 +2101,9 @@ static int b43legacy_chip_init(struct b43legacy_wldev 
*dev)
        b43legacy_write16(dev, B43legacy_MMIO_POWERUP_DELAY,
                          dev->dev->bus->chipco.fast_pwrup_delay);
 
+       /* PHY TX errors counter. */
+       atomic_set(&phy->txerr_cnt, B43legacy_PHY_TX_BADNESS_LIMIT);
+
        B43legacy_WARN_ON(err != 0);
        b43legacydbg(dev->wl, "Chip initialized\n");
 out:
@@ -2138,6 +2148,9 @@ static void b43legacy_periodic_every30sec(struct 
b43legacy_wldev *dev)
 static void b43legacy_periodic_every15sec(struct b43legacy_wldev *dev)
 {
        b43legacy_phy_xmitpower(dev); /* FIXME: unless scanning? */
+
+       atomic_set(&dev->phy.txerr_cnt, B43legacy_PHY_TX_BADNESS_LIMIT);
+       wmb();
 }
 
 static void do_periodic_work(struct b43legacy_wldev *dev)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to