mac80211: fix key flush handling in AP+STA
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 331-ath9k_hw-do-not-run-NF-and-periodic-calibration-at-t.patch
index 1d841a763775fd96c65bc54935ca5c1c8467fc19..cd3c1d780049153714bb9cb2aae62fe712cfccb6 100644 (file)
@@ -11,18 +11,23 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
 
 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
 +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
-@@ -660,7 +660,6 @@ static void ar9002_hw_olc_temp_compensat
+@@ -660,27 +660,26 @@ static void ar9002_hw_olc_temp_compensat
  static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
                               u8 rxchainmask, bool longcal)
  {
 -      bool iscaldone = true;
        struct ath9k_cal_list *currCal = ah->cal_list_curr;
-       bool nfcal, nfcal_pending = false;
+-      bool nfcal, nfcal_pending = false;
++      bool nfcal, nfcal_pending = false, percal_pending;
        int ret;
-@@ -672,15 +671,13 @@ static int ar9002_hw_calibrate(struct at
-       if (currCal && !nfcal &&
-           (currCal->calState == CAL_RUNNING ||
-            currCal->calState == CAL_WAITING)) {
+       nfcal = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF);
+       if (ah->caldata)
+               nfcal_pending = test_bit(NFCAL_PENDING, &ah->caldata->cal_flags);
+-      if (currCal && !nfcal &&
+-          (currCal->calState == CAL_RUNNING ||
+-           currCal->calState == CAL_WAITING)) {
 -              iscaldone = ar9002_hw_per_calibration(ah, chan,
 -                                                    rxchainmask, currCal);
 -              if (iscaldone) {
@@ -32,6 +37,11 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
 -                              iscaldone = false;
 -                              ath9k_hw_reset_calibration(ah, currCal);
 -                      }
++      percal_pending = (currCal &&
++                        (currCal->calState == CAL_RUNNING ||
++                         currCal->calState == CAL_WAITING));
++
++      if (percal_pending && !nfcal) {
 +              if (!ar9002_hw_per_calibration(ah, chan, rxchainmask, currCal))
 +                      return 0;
 +
@@ -42,12 +52,12 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
                }
        }
  
-@@ -710,7 +707,7 @@ static int ar9002_hw_calibrate(struct at
+@@ -710,7 +709,7 @@ static int ar9002_hw_calibrate(struct at
                }
        }
  
 -      return iscaldone;
-+      return 1;
++      return !percal_pending;
  }
  
  /* Carrier leakage Calibration fix */