linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: Stefano Brivio <stefano.brivio@polimi.it>
Cc: John Linville <linville@tuxdriver.com>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 4/5] b43: reinit on too many PHY TX errors
Date: Sat, 24 Nov 2007 21:31:27 +0100	[thread overview]
Message-ID: <200711242131.27870.mb@bu3sch.de> (raw)
In-Reply-To: <20071124201301.178475691@polimi.it>

On Saturday 24 November 2007 21:11:11 Stefano Brivio wrote:
> 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 <stefano.brivio@polimi.it>
> To: Michael Buesch <mb@bu3sch.de>
> 
> ---
> 
> Index: wireless-2.6/drivers/net/wireless/b43/b43.h
> ===================================================================
> --- wireless-2.6.orig/drivers/net/wireless/b43/b43.h
> +++ wireless-2.6/drivers/net/wireless/b43/b43.h
> @@ -391,6 +391,8 @@ enum {
>  #define B43_DEFAULT_SHORT_RETRY_LIMIT	7
>  #define B43_DEFAULT_LONG_RETRY_LIMIT	4
>  
> +#define B43_PHY_TX_BADNESS_LIMIT	1000
> +
>  /* Max size of a security key */
>  #define B43_SEC_KEYSIZE			16
>  /* Security algorithms. */
> @@ -546,6 +548,9 @@ struct b43_phy {
>  	/* OFDM address read/write caching for hardware auto-increment. */
>  	u16 ofdm_addr;
>  	u8 ofdm_valid; /* 0: invalid, 1: read, 2: write */
> +
> +	/* PHY TX errors counter. */
> +	u16 txerr_cnt;
>  };
>  
>  /* Data structures for DMA transmission, per 80211 core. */
> Index: wireless-2.6/drivers/net/wireless/b43/main.c
> ===================================================================
> --- wireless-2.6.orig/drivers/net/wireless/b43/main.c
> +++ wireless-2.6/drivers/net/wireless/b43/main.c
> @@ -1394,8 +1394,17 @@ static void b43_interrupt_tasklet(struct
>  	if (unlikely(reason & B43_IRQ_MAC_TXERR))
>  		b43err(dev->wl, "MAC transmission error\n");
>  
> -	if (unlikely(reason & B43_IRQ_PHY_TXERR))
> +	if (unlikely(reason & B43_IRQ_PHY_TXERR)) {
>  		b43err(dev->wl, "PHY transmission error\n");
> +		if (dev->phy.txerr_cnt < B43_PHY_TX_BADNESS_LIMIT)
> +			dev->phy.txerr_cnt++;
> +		else {
> +			dev->phy.txerr_cnt = 0;
> +			b43err(dev->wl, "Too many PHY TX errors, "
> +					"restarting the controller\n");
> +			b43_controller_restart(dev, "PHY TX errors");
> +		}
> +	}
>  
>  	if (unlikely(merged_dma_reason & (B43_DMAIRQ_FATALMASK |
>  					  B43_DMAIRQ_NONFATALMASK))) {
> @@ -2259,6 +2268,9 @@ static int b43_chip_init(struct b43_wlde
>  	/* OFDM address caching. */
>  	phy->ofdm_valid = 0;
>  
> +	/* PHY TX errors counter. */
> +	phy->txerr_cnt = 0;
> +
>  	err = 0;
>  	b43dbg(dev->wl, "Chip initialized\n");
>  out:


> @@ -2344,6 +2356,8 @@ static void b43_periodic_every15sec(stru
>  	}
>  	b43_phy_xmitpower(dev);	//FIXME: unless scanning?
>  	//TODO for APHY (temperature?)
> +
> +	phy->txerr_cnt = 0;

Needs either atomic_t plus memory barriers or spin_lock(&wl->irq_lock).
I'd suggest atomic_t with mb()s as it's a bad idea to completely sync with
IRQs on every 15sec pwork for this error counter.

-- 
Greetings Michael.

       reply	other threads:[~2007-11-24 20:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20071124201107.785472828@polimi.it>
     [not found] ` <20071124201301.178475691@polimi.it>
2007-11-24 20:31   ` Michael Buesch [this message]
2007-11-24 22:35     ` [PATCH 4/5 V2] b43: reinit on too many PHY TX errors Stefano Brivio
     [not found] ` <20071124201301.797261738@polimi.it>
2007-11-24 22:35   ` [PATCH 5/5 V2] b43legacy: " Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200711242131.27870.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=stefano.brivio@polimi.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).