Skip to contentSkip to conversation

Avoid loading single/bad NF sample into CCA registers

RFC New Björn Smedman 1 participant 1 message Jan 13, 2010 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

RFC 1/1 Avoid loading single/bad NF sample into CCA registers

Normally new noise floor values loaded into CCA registers in calib.c is the median of a number of reasonable calibration samples taken over time. However, looking at the code in ath9k_hw_update_nfcal_hist_buffer() it seems possible to also load a new noise floor based on a single calibration sample, an old median value, a median of unreasonable values or the initial default value under certain circumstances.

The patch below attempt to avoid this by checking that the noise floor estimate is the median of a number of samples (which may or may not be reasonable).

An alternative perhaps better approach would be to store only reasonable values in nfCalBuffer and always compute the median in ath9k_hw_update_nfcal_hist_buffer().

Any thoughts?

/Bj?rn
---

(quoted diff) +0 -0

b/drivers/net/wireless/ath/ath9k/calib.c
index 238a574..970314d 100644

drivers/net/wireless/ath/ath9k/calib.c +0 -0
@@ -640,7 +640,7 @@ void ath9k_hw_loadnf(struct ath_hw *ah, struct

ath9k_channel *chan)

        h = ah->nfCalHist;

        for (i = 0; i < NUM_NF_READINGS; i++) {
-               if (chainmask & (1 << i)) {
+               if (!h[i].invalidNFcount && chainmask & (1 << i)) {
                        val = REG_READ(ah, ar5416_cca_regs[i]);
                        val &= 0xFFFFFE00;
                        val |= (((u32) (h[i].privNF) << 1) & 0x1ff);