ath9k: fix spurious decryption crc error regression (backport of r24976)
[openwrt-10.03/.git] / package / mac80211 / patches / 550-ath9k_decrypt_error_fix.patch
1 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
2 +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
3 @@ -615,7 +615,7 @@ int ath9k_hw_process_rxdesc_edma(struct 
4                  */
5                 if (rxsp->status11 & AR_CRCErr)
6                         rxs->rs_status |= ATH9K_RXERR_CRC;
7 -               if (rxsp->status11 & AR_PHYErr) {
8 +               else if (rxsp->status11 & AR_PHYErr) {
9                         phyerr = MS(rxsp->status11, AR_PHYErrCode);
10                         /*
11                          * If we reach a point here where AR_PostDelimCRCErr is
12 @@ -638,11 +638,11 @@ int ath9k_hw_process_rxdesc_edma(struct 
13                                 rxs->rs_phyerr = phyerr;
14                         }
15  
16 -               }
17 -               if (rxsp->status11 & AR_DecryptCRCErr)
18 +               } else if (rxsp->status11 & AR_DecryptCRCErr)
19                         rxs->rs_status |= ATH9K_RXERR_DECRYPT;
20 -               if (rxsp->status11 & AR_MichaelErr)
21 +               else if (rxsp->status11 & AR_MichaelErr)
22                         rxs->rs_status |= ATH9K_RXERR_MIC;
23 +
24                 if (rxsp->status11 & AR_KeyMiss)
25                         rxs->rs_status |= ATH9K_RXERR_DECRYPT;
26         }
27 --- a/drivers/net/wireless/ath/ath9k/mac.c
28 +++ b/drivers/net/wireless/ath/ath9k/mac.c
29 @@ -690,17 +690,23 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a
30                 rs->rs_flags |= ATH9K_RX_DECRYPT_BUSY;
31  
32         if ((ads.ds_rxstatus8 & AR_RxFrameOK) == 0) {
33 +               /*
34 +                * Treat these errors as mutually exclusive to avoid spurious
35 +                * extra error reports from the hardware. If a CRC error is
36 +                * reported, then decryption and MIC errors are irrelevant,
37 +                * the frame is going to be dropped either way
38 +                */
39                 if (ads.ds_rxstatus8 & AR_CRCErr)
40                         rs->rs_status |= ATH9K_RXERR_CRC;
41 -               if (ads.ds_rxstatus8 & AR_PHYErr) {
42 +               else if (ads.ds_rxstatus8 & AR_PHYErr) {
43                         rs->rs_status |= ATH9K_RXERR_PHY;
44                         phyerr = MS(ads.ds_rxstatus8, AR_PHYErrCode);
45                         rs->rs_phyerr = phyerr;
46 -               }
47 -               if (ads.ds_rxstatus8 & AR_DecryptCRCErr)
48 +               } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr)
49                         rs->rs_status |= ATH9K_RXERR_DECRYPT;
50 -               if (ads.ds_rxstatus8 & AR_MichaelErr)
51 +               else if (ads.ds_rxstatus8 & AR_MichaelErr)
52                         rs->rs_status |= ATH9K_RXERR_MIC;
53 +
54                 if (ads.ds_rxstatus8 & AR_KeyMiss)
55                         rs->rs_status |= ATH9K_RXERR_DECRYPT;
56         }