Skip to contentSkip to conversation

ANI for ath5k

PATCH In review Bruno Randolf 6 participants 26 messages Mar 25, 2010 – Mar 29, 2010 Atheros ATH5K wireless driver

lore
Share & tools
lore
#0 lore raw

cover ANI for ath5k

This is ANI for ath5k. I have looked ath both the HAL and ath9k sources, while implementing this, so the basic algorithm is the same. A notable difference is that i do everything in a tasklet, while ath9k and HAL do larger parts in the interrupt handler. Also i have only one routine for raising immunity, while ath9k/HAL have separate triggers for CCK and OFDM errors.

Notes/Questions:

- HAL and ath9k use ANI status per channel. This might be useful if we often change channel, but this is not the case, as far as i can see. Any other reason for that?

- HAL and ath9k use only different 2 values in a 5 value array of noise immunity levels (making it essentially an on/off setting) while there are 5 levels mentioned in the ANI documents. I guess there must be a reason for this - No?

- Why is CCK weak signal detection never used (neither turned on or off)?

- There is some confusion which initial values to use. The HAL uses all 0 and ofdm weak signal detection enabled. ath9k has all 0 for AP mode (including ofdm weak sig off), while using ofdm weak sig on and a spur level of 7 for STA mode.

- Also there is some inconsistency about which parameters to control in AP
mode: ath9k only use spur and firstep in 2GHz bands and no ANI control at all in 5GHz!? the HAL uses noise and spur in both bands, but no fir control. for now, i use noise, spur and fir in AP mode.

- In some situations it is good to be able to manually control sesitivity (e.g. tuning long-distance links; not trusting the ANI algo in general ;)), so i would like to export ANI controls to userspace. Right now this is possible thru debugfs, but this is just for testing. How should the ANI settings be controlled properly? iw? configs? sysfs? What's the interface of choice nowadays?

TODO / Ideas:

- Improve beacon averaging algorithm for IBSS: Maybe we should keep track of the average RSSI on a per-node basis and use the minimum of those in order not to loose far away nodes? The other option would be to limit the parameters we control similar to AP mode.

- Older HW (srev < 0x59) use rx filter and reports phy errors as they appear in the rx descriptors. All is in place for this to work, but i never saw the "right" errors (OFDM and CCK timing), even though i'm pretty sure i should get them. This needs to be tested and debugged more, but i have to focus on newer hardware now.

- Maybe we could compare the "busy time" to the "listen time" and this way recognize if we have many false detects (- this is how i originally found out that i need to work on ANI).

I hope that this will solve thruput problems! For me it nearly doubled thruput in a noisy 2Ghz band. :)

bruno

---

Bruno Randolf (10):
ath5k: remove static calibration interval variable
ath5k: remove the use of SWI interrupt
ath5k: optimize ath5k_hw_calibration_poll
ath5k: move ath5k_hw_calibration_poll to base.c
ath5k: keep beacon RSSI average
ath5k: initialize default noise floor
ath5k: simplify MIB counters
ath5k: update phy errors codes
ath5k: add capability flag for phyerror counters
ath5k: Adaptive Noise Immunity (ANI) Implementation

 drivers/net/wireless/ath/ath5k/Makefile |    1 
 drivers/net/wireless/ath/ath5k/ani.c    |  741 +++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath5k/ani.h    |  104 ++++
 drivers/net/wireless/ath/ath5k/ath5k.h  |   68 ++-
 drivers/net/wireless/ath/ath5k/attach.c |    2 
 drivers/net/wireless/ath/ath5k/base.c   |   97 +++-
 drivers/net/wireless/ath/ath5k/base.h   |   20 +
 drivers/net/wireless/ath/ath5k/caps.c   |    6 
 drivers/net/wireless/ath/ath5k/debug.c  |  170 +++++++
 drivers/net/wireless/ath/ath5k/debug.h  |    2 
 drivers/net/wireless/ath/ath5k/desc.c   |    1 
 drivers/net/wireless/ath/ath5k/desc.h   |   35 +
 drivers/net/wireless/ath/ath5k/pcu.c    |   40 +-
 drivers/net/wireless/ath/ath5k/phy.c    |   22 -
 drivers/net/wireless/ath/ath5k/reg.h    |   36 +-
 15 files changed, 1237 insertions(+), 108 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath5k/ani.c
 create mode 100644 drivers/net/wireless/ath/ath5k/ani.h
Signature · 1 line
Signature
#1 lore raw

PATCH 1/10 ath5k: remove static calibration interval variable

Remove static variable ath5k_calinterval which was used as a constant. Use a #define instead. Also we don't need ah_cal_intval.

---
 drivers/net/wireless/ath/ath5k/ath5k.h |    4 +---
 drivers/net/wireless/ath/ath5k/base.c  |    4 ----
 drivers/net/wireless/ath/ath5k/phy.c   |    2 +-
 3 files changed, 2 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +1 -3
index 1d7491c..a3019ee 100644
@@ -202,6 +202,7 @@
 #define AR5K_TUNE_MAX_TXPOWER			63
 #define AR5K_TUNE_DEFAULT_TXPOWER		25
 #define AR5K_TUNE_TPC_TXPOWER			false
+#define ATH5K_TUNE_CALIBRATION_INTERVAL_FULL    10000   /* 10 sec */
 
 #define AR5K_INIT_CARR_SENSE_EN			1
 
@@ -1101,9 +1102,6 @@ struct ath5k_hw {
 	/* Calibration timestamp */
 	unsigned long		ah_cal_tstamp;
 
-	/* Calibration interval (secs) */
-	u8			ah_cal_intval;
-
 	/* Software interrupt mask */
 	u8			ah_swi_mask;
 
drivers/net/wireless/ath/ath5k/base.c +0 -4
index b142a78..39d5800 100644
@@ -59,7 +59,6 @@
 #include "reg.h"
 #include "debug.h"
 
-static u8 ath5k_calinterval = 10; /* Calibrate PHY every 10 secs (TODO: Fixme) */
 static int modparam_nohwcrypt;
 module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
 MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
@@ -2497,9 +2496,6 @@ ath5k_init(struct ath5k_softc *sc)
 	 */
 	ath5k_stop_locked(sc);
 
-	/* Set PHY calibration interval */
-	ah->ah_cal_intval = ath5k_calinterval;
-
 	/*
 	 * The basic interface to setting the hardware in a good
 	 * state is ``reset''.  On return the hardware is known to
drivers/net/wireless/ath/ath5k/phy.c +1 -1
index 47f3679..07f59b1 100644
@@ -1108,7 +1108,7 @@ ath5k_hw_calibration_poll(struct ath5k_hw *ah)
 	/* Calibration interval in jiffies */
 	unsigned long cal_intval;
 
-	cal_intval = msecs_to_jiffies(ah->ah_cal_intval * 1000);
+	cal_intval = msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_FULL);
 
 	/* Initialize timestamp if needed */
 	if (!ah->ah_cal_tstamp)
#2 lore raw

PATCH 2/10 ath5k: remove the use of SWI interrupt

In reply to Bruno Randolf

We don't need to generate a software interrupt (SWI) just to schedule a tasklet
- we can just schedule the tasklet directly.

Rename constants, names, etc to reflect the fact that we don't use SWI any more.

Also move the flag handling into the tasklet and prepare it to behave correctly when there are multiple flags present.

---
 drivers/net/wireless/ath/ath5k/ath5k.h |   12 ++++++------
 drivers/net/wireless/ath/ath5k/base.c  |   11 +++--------
 drivers/net/wireless/ath/ath5k/phy.c   |    3 +--
 3 files changed, 10 insertions(+), 16 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +6 -6
index a3019ee..d84ccde 100644
@@ -890,10 +890,10 @@ enum ath5k_int {
 	AR5K_INT_NOCARD	= 0xffffffff
 };
 
-/* Software interrupts used for calibration */
-enum ath5k_software_interrupt {
-	AR5K_SWI_FULL_CALIBRATION = 0x01,
-	AR5K_SWI_SHORT_CALIBRATION = 0x02,
+/* mask which calibration is active at the moment */
+enum ath5k_calibration_mask {
+	AR5K_CALIBRATION_FULL = 0x01,
+	AR5K_CALIBRATION_SHORT = 0x02,
 };
 
 /*
@@ -1102,8 +1102,8 @@ struct ath5k_hw {
 	/* Calibration timestamp */
 	unsigned long		ah_cal_tstamp;
 
-	/* Software interrupt mask */
-	u8			ah_swi_mask;
+	/* Calibration mask */
+	u8			ah_cal_mask;
 
 	/*
 	 * Function pointers
drivers/net/wireless/ath/ath5k/base.c +3 -8
index 39d5800..539a6d5 100644
@@ -2507,7 +2507,7 @@ ath5k_init(struct ath5k_softc *sc)
 	sc->curband = &sc->sbands[sc->curchan->band];
 	sc->imask = AR5K_INT_RXOK | AR5K_INT_RXERR | AR5K_INT_RXEOL |
 		AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL |
-		AR5K_INT_FATAL | AR5K_INT_GLOBAL | AR5K_INT_SWI;
+		AR5K_INT_FATAL | AR5K_INT_GLOBAL;
 	ret = ath5k_reset(sc, NULL);
 	if (ret)
 		goto done;
@@ -2673,9 +2673,6 @@ ath5k_intr(int irq, void *dev_id)
 			if (status & AR5K_INT_BMISS) {
 				/* TODO */
 			}
-			if (status & AR5K_INT_SWI) {
-				tasklet_schedule(&sc->calib);
-			}
 			if (status & AR5K_INT_MIB) {
 				/*
 				 * These stats are also used for ANI i think
@@ -2716,8 +2713,7 @@ ath5k_tasklet_calibrate(unsigned long data)
 	struct ath5k_hw *ah = sc->ah;
 
 	/* Only full calibration for now */
-	if (ah->ah_swi_mask != AR5K_SWI_FULL_CALIBRATION)
-		return;
+	ah->ah_cal_mask |= AR5K_CALIBRATION_FULL;
 
 	/* Stop queues so that calibration
 	 * doesn't interfere with tx */
@@ -2740,11 +2736,10 @@ ath5k_tasklet_calibrate(unsigned long data)
 			ieee80211_frequency_to_channel(
 				sc->curchan->center_freq));
 
-	ah->ah_swi_mask = 0;
-
 	/* Wake queues */
 	ieee80211_wake_queues(sc->hw);
 
+	ah->ah_cal_mask &= ~AR5K_CALIBRATION_FULL;
 }
 
 
drivers/net/wireless/ath/ath5k/phy.c +1 -2
index 07f59b1..cbdc511 100644
@@ -1119,8 +1119,7 @@ ath5k_hw_calibration_poll(struct ath5k_hw *ah)
 	 * interrupt (bit gets auto-cleared) */
 	if (time_is_before_eq_jiffies(ah->ah_cal_tstamp + cal_intval)) {
 		ah->ah_cal_tstamp = jiffies;
-		ah->ah_swi_mask = AR5K_SWI_FULL_CALIBRATION;
-		AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI);
+		tasklet_schedule(&ah->ah_sc->calib);
 	}
 }
 
#3 lore raw

PATCH 3/10 ath5k: optimize ath5k_hw_calibration_poll

In reply to Bruno Randolf

Optimize ath5k_hw_calibration_poll() since it is called on every singe interrupt.

---
 drivers/net/wireless/ath/ath5k/ath5k.h |    2 +-
 drivers/net/wireless/ath/ath5k/phy.c   |   20 ++++++--------------
 2 files changed, 7 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +1 -1
index d84ccde..3f56d9e 100644
@@ -1100,7 +1100,7 @@ struct ath5k_hw {
 	s32			ah_noise_floor;
 
 	/* Calibration timestamp */
-	unsigned long		ah_cal_tstamp;
+	unsigned long		ah_cal_next_full;
 
 	/* Calibration mask */
 	u8			ah_cal_mask;
drivers/net/wireless/ath/ath5k/phy.c +6 -14
index cbdc511..60241ad 100644
@@ -1105,22 +1105,14 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
 void
 ath5k_hw_calibration_poll(struct ath5k_hw *ah)
 {
-	/* Calibration interval in jiffies */
-	unsigned long cal_intval;
-
-	cal_intval = msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_FULL);
-
-	/* Initialize timestamp if needed */
-	if (!ah->ah_cal_tstamp)
-		ah->ah_cal_tstamp = jiffies;
-
-	/* For now we always do full calibration
-	 * Mark software interrupt mask and fire software
-	 * interrupt (bit gets auto-cleared) */
-	if (time_is_before_eq_jiffies(ah->ah_cal_tstamp + cal_intval)) {
-		ah->ah_cal_tstamp = jiffies;
+	if (time_is_before_eq_jiffies(ah->ah_cal_next_full)) {
+		ah->ah_cal_next_full = jiffies +
+			msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_FULL);
 		tasklet_schedule(&ah->ah_sc->calib);
 	}
+	/* we could use SWI to generate enough interrupts to meet our
+	 * calibration interval requirements, if necessary:
+	 * AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI); */
 }
 
 static int sign_extend(int val, const int nbits)
#4 lore raw

PATCH 4/10 ath5k: move ath5k_hw_calibration_poll to base.c

In reply to Bruno Randolf

From: Bruno Randolf <[email protected]>

It's not a phy related funtion; It has more to do with the interrupt handler and tasklet scheduling, so it belongs to base.c.

---
 drivers/net/wireless/ath/ath5k/ath5k.h |    1 -
 drivers/net/wireless/ath/ath5k/base.c  |   15 ++++++++++++++-
 drivers/net/wireless/ath/ath5k/phy.c   |   13 -------------
 3 files changed, 14 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +0 -1
index 3f56d9e..6334294 100644
@@ -1254,7 +1254,6 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel);
 void ath5k_hw_init_nfcal_hist(struct ath5k_hw *ah);
 int ath5k_hw_phy_calibrate(struct ath5k_hw *ah,
 			   struct ieee80211_channel *channel);
-void ath5k_hw_calibration_poll(struct ath5k_hw *ah);
 /* Spur mitigation */
 bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah,
 				  struct ieee80211_channel *channel);
drivers/net/wireless/ath/ath5k/base.c +14 -1
index 539a6d5..f60d84f 100644
@@ -2625,6 +2625,19 @@ ath5k_stop_hw(struct ath5k_softc *sc)
 	return ret;
 }
 
+static void
+ath5k_intr_calibration_poll(struct ath5k_hw *ah)
+{
+	if (time_is_before_eq_jiffies(ah->ah_cal_next_full)) {
+		ah->ah_cal_next_full = jiffies +
+			msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_FULL);
+		tasklet_schedule(&ah->ah_sc->calib);
+	}
+	/* we could use SWI to generate enough interrupts to meet our
+	 * calibration interval requirements, if necessary:
+	 * AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI); */
+}
+
 static irqreturn_t
 ath5k_intr(int irq, void *dev_id)
 {
@@ -2689,7 +2702,7 @@ ath5k_intr(int irq, void *dev_id)
 	if (unlikely(!counter))
 		ATH5K_WARN(sc, "too many interrupts, giving up for now\n");
 
-	ath5k_hw_calibration_poll(ah);
+	ath5k_intr_calibration_poll(ah);
 
 	return IRQ_HANDLED;
 }
drivers/net/wireless/ath/ath5k/phy.c +0 -13
index 60241ad..7f09c59 100644
@@ -1102,19 +1102,6 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
   PHY calibration
 \*****************/
 
-void
-ath5k_hw_calibration_poll(struct ath5k_hw *ah)
-{
-	if (time_is_before_eq_jiffies(ah->ah_cal_next_full)) {
-		ah->ah_cal_next_full = jiffies +
-			msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_FULL);
-		tasklet_schedule(&ah->ah_sc->calib);
-	}
-	/* we could use SWI to generate enough interrupts to meet our
-	 * calibration interval requirements, if necessary:
-	 * AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI); */
-}
-
 static int sign_extend(int val, const int nbits)
 {
 	int order = BIT(nbits-1);
#5 lore raw

PATCH 5/10 ath5k: keep beacon RSSI average

In reply to Bruno Randolf

Keep an exponentially weighted moving average of the beacon RSSI in our BSS. It will be used by the ANI implementation.

The averaging algorithm is copied from rt2x00, Thanks :)

---
 drivers/net/wireless/ath/ath5k/ath5k.h |   35 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath5k/base.c  |   21 +++++++++++++++++++
 2 files changed, 56 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +35 -0
index 6334294..cefd28d 100644
@@ -992,6 +992,15 @@ struct ath5k_nfcal_hist
 	s16 nfval[ATH5K_NF_CAL_HIST_MAX];	/* last few noise floors */
 };
 
+/**
+ * struct avg_val - Helper structure for average calculation
+ * @avg: contains the actual average value
+ * @avg_weight: is used internally during calculation to prevent rounding errors
+ */
+struct ath5k_avg_val {
+	int avg;
+	int avg_weight;
+};
 
 /***************************************\
   HARDWARE ABSTRACTION LAYER STRUCTURE
@@ -1096,6 +1105,9 @@ struct ath5k_hw {
 
 	struct ath5k_nfcal_hist ah_nfcal_hist;
 
+	/* average beacon RSSI in our BSS (used by ANI) */
+	struct ath5k_avg_val	ah_beacon_rssi_avg;
+
 	/* noise floor from last periodic calibration */
 	s32			ah_noise_floor;
 
@@ -1305,4 +1317,27 @@ static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits)
 	return retval;
 }
 
+#define AVG_SAMPLES	8
+#define AVG_FACTOR	1000
+
+/**
+ * ath5k_moving_average -  Exponentially weighted moving average
+ * @avg: average structure
+ * @val: current value
+ *
+ * This implementation make use of a struct ath5k_avg_val to prevent rounding
+ * errors.
+ */
+static inline struct ath5k_avg_val
+ath5k_moving_average(const struct ath5k_avg_val avg, const int val)
+{
+	struct ath5k_avg_val new;
+	new.avg_weight = avg.avg_weight  ?
+		(((avg.avg_weight * ((AVG_SAMPLES) - 1)) +
+			(val * (AVG_FACTOR))) / (AVG_SAMPLES)) :
+		(val * (AVG_FACTOR));
+	new.avg = new.avg_weight / (AVG_FACTOR);
+	return new;
+}
+
 #endif
drivers/net/wireless/ath/ath5k/base.c +21 -0
index f60d84f..ba2fad2 100644
@@ -1803,6 +1803,25 @@ ath5k_check_ibss_tsf(struct ath5k_softc *sc, struct sk_buff *skb,
 	}
 }
 
+static void
+ath5k_update_beacon_rssi(struct ath5k_softc *sc, struct sk_buff *skb, int rssi)
+{
+	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
+	struct ath5k_hw *ah = sc->ah;
+	struct ath_common *common = ath5k_hw_common(ah);
+
+	/* only beacons from our BSSID */
+	if (!ieee80211_is_beacon(mgmt->frame_control) ||
+	    memcmp(mgmt->bssid, common->curbssid, ETH_ALEN) != 0)
+		return;
+
+	ah->ah_beacon_rssi_avg = ath5k_moving_average(ah->ah_beacon_rssi_avg,
+						      rssi);
+
+	/* in IBSS mode we should keep RSSI statistics per neighbour */
+	/* le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS */
+}
+
 /*
  * Compute padding position. skb must contains an IEEE 802.11 frame
  */
@@ -2022,6 +2041,8 @@ accept:
 
 		ath5k_debug_dump_skb(sc, skb, "RX  ", 0);
 
+		ath5k_update_beacon_rssi(sc, skb, rs.rs_rssi);
+
 		/* check beacons in IBSS mode */
 		if (sc->opmode == NL80211_IFTYPE_ADHOC)
 			ath5k_check_ibss_tsf(sc, skb, rxs);
#6 lore raw

PATCH 6/10 ath5k: initialize default noise floor

In reply to Bruno Randolf

Initialize noise floor variable with a default of -95. This was used uninitialized in the signal strength (RSSI -> dBm) conversion until the first noise floor calibration was completed.

---
 drivers/net/wireless/ath/ath5k/attach.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath5k/attach.c +1 -0
index dd4099a..f80d3d5 100644
@@ -123,6 +123,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
 	ah->ah_limit_tx_retries = AR5K_INIT_TX_RETRY;
 	ah->ah_software_retry = false;
 	ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT;
+	ah->ah_noise_floor = -95;	/* until first NF calibration is run */
 
 	/*
 	 * Find the mac version
#7 lore raw

PATCH 7/10 ath5k: simplify MIB counters

In reply to Bruno Randolf

Let's keep MIB counter statistics in our own statistics structure and only convert it to ieee80211_low_level_stats when needed by mac80211. Also we don't need to read profile count registers in the MIB interrupt (they don't trigger MIB interrupts).

---
 drivers/net/wireless/ath/ath5k/ath5k.h |    3 +-
 drivers/net/wireless/ath/ath5k/base.c  |   16 ++++++-------
 drivers/net/wireless/ath/ath5k/base.h  |   13 +++++++++--
 drivers/net/wireless/ath/ath5k/pcu.c   |   39 +++++++++++---------------------
 4 files changed, 32 insertions(+), 39 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +1 -2
index cefd28d..ec62690 100644
@@ -1173,8 +1173,7 @@ int ath5k_hw_update_tx_triglevel(struct ath5k_hw *ah, bool increase);
 bool ath5k_hw_is_intr_pending(struct ath5k_hw *ah);
 int ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask);
 enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask);
-void ath5k_hw_update_mib_counters(struct ath5k_hw *ah,
-				  struct ieee80211_low_level_stats *stats);
+void ath5k_hw_update_mib_counters(struct ath5k_hw *ah);
 
 /* EEPROM access functions */
 int ath5k_eeprom_init(struct ath5k_hw *ah);
drivers/net/wireless/ath/ath5k/base.c +7 -9
index ba2fad2..ea33b99 100644
@@ -2114,7 +2114,7 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
 		info->status.rates[ts.ts_final_idx].count++;
 
 		if (unlikely(ts.ts_status)) {
-			sc->ll_stats.dot11ACKFailureCount++;
+			sc->stats.ack_fail++;
 			if (ts.ts_status & AR5K_TXERR_FILT) {
 				info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
 				sc->stats.txerr_filt++;
@@ -2708,11 +2708,7 @@ ath5k_intr(int irq, void *dev_id)
 				/* TODO */
 			}
 			if (status & AR5K_INT_MIB) {
-				/*
-				 * These stats are also used for ANI i think
-				 * so how about updating them more often ?
-				 */
-				ath5k_hw_update_mib_counters(ah, &sc->ll_stats);
+				ath5k_hw_update_mib_counters(ah);
 			}
 			if (status & AR5K_INT_GPIO)
 				tasklet_schedule(&sc->rf_kill.toggleq);
@@ -3234,12 +3230,14 @@ ath5k_get_stats(struct ieee80211_hw *hw,
 		struct ieee80211_low_level_stats *stats)
 {
 	struct ath5k_softc *sc = hw->priv;
-	struct ath5k_hw *ah = sc->ah;
 
 	/* Force update */
-	ath5k_hw_update_mib_counters(ah, &sc->ll_stats);
+	ath5k_hw_update_mib_counters(sc->ah);
 
-	memcpy(stats, &sc->ll_stats, sizeof(sc->ll_stats));
+	stats->dot11ACKFailureCount = sc->stats.ack_fail;
+	stats->dot11RTSFailureCount = sc->stats.rts_fail;
+	stats->dot11RTSSuccessCount = sc->stats.rts_ok;
+	stats->dot11FCSErrorCount = sc->stats.fcs_error;
 
 	return 0;
 }
drivers/net/wireless/ath/ath5k/base.h +11 -2
index 33f1d8b..fe5dae5 100644
@@ -105,10 +105,13 @@ struct ath5k_rfkill {
 	struct tasklet_struct toggleq;
 };
 
-/* statistics (only used for debugging now) */
+/* statistics */
 struct ath5k_statistics {
+	/* antenna use */
 	unsigned int antenna_rx[5];	/* frames count per antenna RX */
 	unsigned int antenna_tx[5];	/* frames count per antenna TX */
+
+	/* frame errors */
 	unsigned int rx_all_count;	/* all RX frames, including errors */
 	unsigned int tx_all_count;	/* all TX frames, including errors */
 	unsigned int rxerr_crc;
@@ -121,6 +124,13 @@ struct ath5k_statistics {
 	unsigned int txerr_retry;
 	unsigned int txerr_fifo;
 	unsigned int txerr_filt;
+
+	/* MIB counters */
+	unsigned int ack_fail;
+	unsigned int rts_fail;
+	unsigned int rts_ok;
+	unsigned int fcs_error;
+	unsigned int beacons;
 };
 
 #if CHAN_DEBUG
@@ -135,7 +145,6 @@ struct ath5k_softc {
 	struct pci_dev		*pdev;		/* for dma mapping */
 	void __iomem		*iobase;	/* address of the device */
 	struct mutex		lock;		/* dev-level lock */
-	struct ieee80211_low_level_stats ll_stats;
 	struct ieee80211_hw	*hw;		/* IEEE 802.11 common */
 	struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
 	struct ieee80211_channel channels[ATH_CHAN_MAX];
drivers/net/wireless/ath/ath5k/pcu.c +13 -26
index 1b9fcb8..c7c1fe0 100644
@@ -113,39 +113,26 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype op_mode)
 }
 
 /**
- * ath5k_hw_update - Update mib counters (mac layer statistics)
+ * ath5k_hw_update - Update MIB counters (mac layer statistics)
  *
  * @ah: The &struct ath5k_hw
- * @stats: The &struct ieee80211_low_level_stats we use to track
- * statistics on the driver
  *
- * Reads MIB counters from PCU and updates sw statistics. Must be
- * called after a MIB interrupt.
+ * Reads MIB counters from PCU and updates sw statistics. Is called after a
+ * MIB interrupt, because one of these counters might have reached their maximum
+ * and triggered the MIB interrupt, to let us read and clear the counter.
+ *
+ * Is called in interrupt context!
  */
-void ath5k_hw_update_mib_counters(struct ath5k_hw *ah,
-		struct ieee80211_low_level_stats  *stats)
+void ath5k_hw_update_mib_counters(struct ath5k_hw *ah)
 {
-	ATH5K_TRACE(ah->ah_sc);
+	struct ath5k_statistics *stats = &ah->ah_sc->stats;
 
 	/* Read-And-Clear */
-	stats->dot11ACKFailureCount += ath5k_hw_reg_read(ah, AR5K_ACK_FAIL);
-	stats->dot11RTSFailureCount += ath5k_hw_reg_read(ah, AR5K_RTS_FAIL);
-	stats->dot11RTSSuccessCount += ath5k_hw_reg_read(ah, AR5K_RTS_OK);
-	stats->dot11FCSErrorCount += ath5k_hw_reg_read(ah, AR5K_FCS_FAIL);
-
-	/* XXX: Should we use this to track beacon count ?
-	 * -we read it anyway to clear the register */
-	ath5k_hw_reg_read(ah, AR5K_BEACON_CNT);
-
-	/* Reset profile count registers on 5212*/
-	if (ah->ah_version == AR5K_AR5212) {
-		ath5k_hw_reg_write(ah, 0, AR5K_PROFCNT_TX);
-		ath5k_hw_reg_write(ah, 0, AR5K_PROFCNT_RX);
-		ath5k_hw_reg_write(ah, 0, AR5K_PROFCNT_RXCLR);
-		ath5k_hw_reg_write(ah, 0, AR5K_PROFCNT_CYCLE);
-	}
-
-	/* TODO: Handle ANI stats */
+	stats->ack_fail += ath5k_hw_reg_read(ah, AR5K_ACK_FAIL);
+	stats->rts_fail += ath5k_hw_reg_read(ah, AR5K_RTS_FAIL);
+	stats->rts_ok += ath5k_hw_reg_read(ah, AR5K_RTS_OK);
+	stats->fcs_error += ath5k_hw_reg_read(ah, AR5K_FCS_FAIL);
+	stats->beacons += ath5k_hw_reg_read(ah, AR5K_BEACON_CNT);
 }
 
 /**
#8 lore raw

PATCH 8/10 ath5k: update phy errors codes

In reply to Bruno Randolf

Update PHY error codes from the HAL, and keep them in statistics for debugging via the 'frameerrors' file. This will also be used by ANI.

---
 drivers/net/wireless/ath/ath5k/base.c  |    2 ++
 drivers/net/wireless/ath/ath5k/base.h  |    1 +
 drivers/net/wireless/ath/ath5k/debug.c |    8 +++++++
 drivers/net/wireless/ath/ath5k/desc.h  |   35 ++++++++++++++++++++++++--------
 4 files changed, 37 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +2 -0
index ea33b99..a1c0dcb 100644
@@ -1940,6 +1940,8 @@ ath5k_tasklet_rx(unsigned long data)
 				sc->stats.rxerr_fifo++;
 			if (rs.rs_status & AR5K_RXERR_PHY) {
 				sc->stats.rxerr_phy++;
+				if (rs.rs_phyerr > 0 && rs.rs_phyerr < 32)
+					sc->stats.rxerr_phy_code[rs.rs_phyerr]++;
 				goto next;
 			}
 			if (rs.rs_status & AR5K_RXERR_DECRYPT) {
drivers/net/wireless/ath/ath5k/base.h +1 -0
index fe5dae5..a572a48 100644
@@ -116,6 +116,7 @@ struct ath5k_statistics {
 	unsigned int tx_all_count;	/* all TX frames, including errors */
 	unsigned int rxerr_crc;
 	unsigned int rxerr_phy;
+	unsigned int rxerr_phy_code[32];
 	unsigned int rxerr_fifo;
 	unsigned int rxerr_decrypt;
 	unsigned int rxerr_mic;
drivers/net/wireless/ath/ath5k/debug.c +8 -0
index bccd4a7..90247dc 100644
@@ -474,6 +474,7 @@ static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf,
 	struct ath5k_statistics *st = &sc->stats;
 	char buf[700];
 	unsigned int len = 0;
+	int i;
 
 	len += snprintf(buf+len, sizeof(buf)-len,
 			"RX\n---------------------\n");
@@ -485,6 +486,13 @@ static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf,
 			st->rxerr_phy,
 			st->rx_all_count > 0 ?
 				st->rxerr_phy*100/st->rx_all_count : 0);
+	for (i = 0; i < 32; i++) {
+		if (st->rxerr_phy_code[i])
+			len += snprintf(buf+len, sizeof(buf)-len,
+				" phy_err[%d]\t%d\n",
+				i, st->rxerr_phy_code[i]);
+	}
+
 	len += snprintf(buf+len, sizeof(buf)-len, "FIFO\t%d\t(%d%%)\n",
 			st->rxerr_fifo,
 			st->rx_all_count > 0 ?
drivers/net/wireless/ath/ath5k/desc.h +26 -9
index 56158c8..64538fb 100644
@@ -112,15 +112,32 @@ struct ath5k_hw_rx_error {
 #define AR5K_RX_DESC_ERROR1_PHY_ERROR_CODE	0x0000ff00
 #define AR5K_RX_DESC_ERROR1_PHY_ERROR_CODE_S	8
 
-/* PHY Error codes */
-#define AR5K_DESC_RX_PHY_ERROR_NONE		0x00
-#define AR5K_DESC_RX_PHY_ERROR_TIMING		0x20
-#define AR5K_DESC_RX_PHY_ERROR_PARITY		0x40
-#define AR5K_DESC_RX_PHY_ERROR_RATE		0x60
-#define AR5K_DESC_RX_PHY_ERROR_LENGTH		0x80
-#define AR5K_DESC_RX_PHY_ERROR_64QAM		0xa0
-#define AR5K_DESC_RX_PHY_ERROR_SERVICE		0xc0
-#define AR5K_DESC_RX_PHY_ERROR_TRANSMITOVR	0xe0
+/**
+ * enum ath5k_phy_error_code - PHY Error codes
+ */
+enum ath5k_phy_error_code {
+	AR5K_RX_PHY_ERROR_UNDERRUN		= 0,	/* Transmit underrun */
+	AR5K_RX_PHY_ERROR_TIMING		= 1,	/* Timing error */
+	AR5K_RX_PHY_ERROR_PARITY		= 2,	/* Illegal parity */
+	AR5K_RX_PHY_ERROR_RATE			= 3,	/* Illegal rate */
+	AR5K_RX_PHY_ERROR_LENGTH		= 4,	/* Illegal length */
+	AR5K_RX_PHY_ERROR_RADAR			= 5,	/* Radar detect */
+	AR5K_RX_PHY_ERROR_SERVICE		= 6,	/* Illegal service */
+	AR5K_RX_PHY_ERROR_TOR			= 7,	/* Transmit override receive */
+	/* these are specific to the 5212 */
+	AR5K_RX_PHY_ERROR_OFDM_TIMING		= 17,
+	AR5K_RX_PHY_ERROR_OFDM_SIGNAL_PARITY	= 18,
+	AR5K_RX_PHY_ERROR_OFDM_RATE_ILLEGAL	= 19,
+	AR5K_RX_PHY_ERROR_OFDM_LENGTH_ILLEGAL	= 20,
+	AR5K_RX_PHY_ERROR_OFDM_POWER_DROP	= 21,
+	AR5K_RX_PHY_ERROR_OFDM_SERVICE		= 22,
+	AR5K_RX_PHY_ERROR_OFDM_RESTART		= 23,
+	AR5K_RX_PHY_ERROR_CCK_TIMING		= 25,
+	AR5K_RX_PHY_ERROR_CCK_HEADER_CRC	= 26,
+	AR5K_RX_PHY_ERROR_CCK_RATE_ILLEGAL	= 27,
+	AR5K_RX_PHY_ERROR_CCK_SERVICE		= 30,
+	AR5K_RX_PHY_ERROR_CCK_RESTART		= 31,
+};
 
 /*
  * 5210/5211 hardware 2-word TX control descriptor
#9 lore raw

PATCH 9/10 ath5k: add capability flag for phyerror counters

In reply to Bruno Randolf

Chipsets since revision AR5213A (0x59) have hardware counters for PHY errors which we can read directly from the registers. Older hardware has to use the RX descriptor status to get a count of PHY errors. This will be used in several places in the ANI implementation, so a flag is useful.

---
 drivers/net/wireless/ath/ath5k/ath5k.h |    2 ++
 drivers/net/wireless/ath/ath5k/caps.c  |    6 ++++++
 2 files changed, 8 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +2 -0
index ec62690..f578c1e 100644
@@ -982,6 +982,8 @@ struct ath5k_capabilities {
 	struct {
 		u8	q_tx_num;
 	} cap_queues;
+
+	bool cap_has_phyerr_counters;
 };
 
 /* size of noise floor history (keep it a power of two) */
drivers/net/wireless/ath/ath5k/caps.c +6 -0
index e618e71..74f0071 100644
@@ -109,6 +109,12 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
 	else
 		ah->ah_capabilities.cap_queues.q_tx_num = AR5K_NUM_TX_QUEUES;
 
+	/* newer hardware has PHY error counters */
+	if (ah->ah_mac_srev >= AR5K_SREV_AR5213A)
+		ah->ah_capabilities.cap_has_phyerr_counters = true;
+	else
+		ah->ah_capabilities.cap_has_phyerr_counters = false;
+
 	return 0;
 }
 
#10 lore raw

PATCH 10/10 ath5k: Adaptive Noise Immunity (ANI) Implementation

In reply to Bruno Randolf

This is an Adaptive Noise Imunity (ANI) implementation for ath5k. I have looked at both ath9k and HAL sources (they are nearly the same), and even though i have implemented some things differently, the basic algorithm is practically the same, for now. I hope that this can serve as a clean start to improve the algorithm later.

This also adds a possibility to manually control ANI settings, right now only thru a debugfs file:
* set lowest sensitivity (=highest noise immunity):
echo sens-low > /sys/kernel/debug/ath5k/phy0/ani
* set highest sensitivity (=lowest noise immunity):
echo sens-high > /sys/kernel/debug/ath5k/phy0/ani
* automatically control immunity (default):
echo ani-on > /sys/kernel/debug/ath5k/phy0/ani
* to see the parameters in use and watch them change:
cat /sys/kernel/debug/ath5k/phy0/ani

Manually setting sensitivity will turn the automatic control off. You can also control each of the five immunity parameters (noise immunity, spur immunity, firstep, ofdm weak signal detection, cck weak signal detection) manually thru the debugfs file.

This is tested on AR5414 and nearly doubles the thruput in a noisy 2GHz band.

---
 drivers/net/wireless/ath/ath5k/Makefile |    1 
 drivers/net/wireless/ath/ath5k/ani.c    |  741 +++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath5k/ani.h    |  104 ++++
 drivers/net/wireless/ath/ath5k/ath5k.h  |    9 
 drivers/net/wireless/ath/ath5k/attach.c |    1 
 drivers/net/wireless/ath/ath5k/base.c   |   32 +
 drivers/net/wireless/ath/ath5k/base.h   |    6 
 drivers/net/wireless/ath/ath5k/debug.c  |  162 +++++++
 drivers/net/wireless/ath/ath5k/debug.h  |    2 
 drivers/net/wireless/ath/ath5k/desc.c   |    1 
 drivers/net/wireless/ath/ath5k/pcu.c    |    1 
 drivers/net/wireless/ath/ath5k/reg.h    |   36 +-
 12 files changed, 1080 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath5k/ani.c
 create mode 100644 drivers/net/wireless/ath/ath5k/ani.h
drivers/net/wireless/ath/ath5k/Makefile +1 -0
index 090dc6d..cc09595 100644
@@ -12,5 +12,6 @@ ath5k-y				+= attach.o
 ath5k-y				+= base.o
 ath5k-y				+= led.o
 ath5k-y				+= rfkill.o
+ath5k-y				+= ani.o
 ath5k-$(CONFIG_ATH5K_DEBUG)	+= debug.o
 obj-$(CONFIG_ATH5K)		+= ath5k.o
drivers/net/wireless/ath/ath5k/ani.c new file +741 -0

741 lines not on this page · raw message

drivers/net/wireless/ath/ath5k/ani.h new file +104 -0

104 lines not on this page · raw message

drivers/net/wireless/ath/ath5k/ath5k.h +6 -3
index f578c1e..2785946 100644
@@ -203,6 +203,7 @@
 #define AR5K_TUNE_DEFAULT_TXPOWER		25
 #define AR5K_TUNE_TPC_TXPOWER			false
 #define ATH5K_TUNE_CALIBRATION_INTERVAL_FULL    10000   /* 10 sec */
+#define ATH5K_TUNE_CALIBRATION_INTERVAL_ANI	1000	/* 1 sec */
 
 #define AR5K_INIT_CARR_SENSE_EN			1
 
@@ -800,9 +801,9 @@ struct ath5k_athchan_2ghz {
  * @AR5K_INT_TXURN: received when we should increase the TX trigger threshold
  * 	We currently do increments on interrupt by
  * 	(AR5K_TUNE_MAX_TX_FIFO_THRES - current_trigger_level) / 2
- * @AR5K_INT_MIB: Indicates the Management Information Base counters should be
- * 	checked. We should do this with ath5k_hw_update_mib_counters() but
- * 	it seems we should also then do some noise immunity work.
+ * @AR5K_INT_MIB: Indicates the either Management Information Base counters or
+ *	one of the PHY error counters reached the maximum value and should be
+ *	read and cleared.
  * @AR5K_INT_RXPHY: RX PHY Error
  * @AR5K_INT_RXKCM: RX Key cache miss
  * @AR5K_INT_SWBA: SoftWare Beacon Alert - indicates its time to send a
@@ -894,6 +895,7 @@ enum ath5k_int {
 enum ath5k_calibration_mask {
 	AR5K_CALIBRATION_FULL = 0x01,
 	AR5K_CALIBRATION_SHORT = 0x02,
+	AR5K_CALIBRATION_ANI = 0x04,
 };
 
 /*
@@ -1115,6 +1117,7 @@ struct ath5k_hw {
 
 	/* Calibration timestamp */
 	unsigned long		ah_cal_next_full;
+	unsigned long		ah_cal_next_ani;
 
 	/* Calibration mask */
 	u8			ah_cal_mask;
drivers/net/wireless/ath/ath5k/attach.c +1 -0
index f80d3d5..dcf7c30 100644
@@ -124,6 +124,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
 	ah->ah_software_retry = false;
 	ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT;
 	ah->ah_noise_floor = -95;	/* until first NF calibration is run */
+	sc->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO;
 
 	/*
 	 * Find the mac version
drivers/net/wireless/ath/ath5k/base.c +30 -2
index a1c0dcb..c085a06 100644
@@ -58,6 +58,7 @@
 #include "base.h"
 #include "reg.h"
 #include "debug.h"
+#include "ani.h"
 
 static int modparam_nohwcrypt;
 module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
@@ -363,6 +364,7 @@ static void 	ath5k_beacon_send(struct ath5k_softc *sc);
 static void 	ath5k_beacon_config(struct ath5k_softc *sc);
 static void	ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf);
 static void	ath5k_tasklet_beacon(unsigned long data);
+static void	ath5k_tasklet_ani(unsigned long data);
 
 static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp)
 {
@@ -828,6 +830,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
 	tasklet_init(&sc->restq, ath5k_tasklet_reset, (unsigned long)sc);
 	tasklet_init(&sc->calib, ath5k_tasklet_calibrate, (unsigned long)sc);
 	tasklet_init(&sc->beacontq, ath5k_tasklet_beacon, (unsigned long)sc);
+	tasklet_init(&sc->ani_tasklet, ath5k_tasklet_ani, (unsigned long)sc);
 
 	ret = ath5k_eeprom_read_mac(ah, mac);
 	if (ret) {
@@ -2530,7 +2533,8 @@ ath5k_init(struct ath5k_softc *sc)
 	sc->curband = &sc->sbands[sc->curchan->band];
 	sc->imask = AR5K_INT_RXOK | AR5K_INT_RXERR | AR5K_INT_RXEOL |
 		AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL |
-		AR5K_INT_FATAL | AR5K_INT_GLOBAL;
+		AR5K_INT_FATAL | AR5K_INT_GLOBAL | AR5K_INT_MIB;
+
 	ret = ath5k_reset(sc, NULL);
 	if (ret)
 		goto done;
@@ -2642,6 +2646,7 @@ ath5k_stop_hw(struct ath5k_softc *sc)
 	tasklet_kill(&sc->restq);
 	tasklet_kill(&sc->calib);
 	tasklet_kill(&sc->beacontq);
+	tasklet_kill(&sc->ani_tasklet);
 
 	ath5k_rfkill_hw_stop(sc->ah);
 
@@ -2651,7 +2656,14 @@ ath5k_stop_hw(struct ath5k_softc *sc)
 static void
 ath5k_intr_calibration_poll(struct ath5k_hw *ah)
 {
-	if (time_is_before_eq_jiffies(ah->ah_cal_next_full)) {
+	if (time_is_before_eq_jiffies(ah->ah_cal_next_ani) &&
+	    !(ah->ah_cal_mask & AR5K_CALIBRATION_FULL)) {
+		/* run ANI only when full calibration is not active */
+		ah->ah_cal_next_ani = jiffies +
+			msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_ANI);
+		tasklet_schedule(&ah->ah_sc->ani_tasklet);
+
+	} else if (time_is_before_eq_jiffies(ah->ah_cal_next_full)) {
 		ah->ah_cal_next_full = jiffies +
 			msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_FULL);
 		tasklet_schedule(&ah->ah_sc->calib);
@@ -2710,7 +2722,9 @@ ath5k_intr(int irq, void *dev_id)
 				/* TODO */
 			}
 			if (status & AR5K_INT_MIB) {
+				sc->stats.mib_intr++;
 				ath5k_hw_update_mib_counters(ah);
+				ath5k_ani_mib_intr(ah);
 			}
 			if (status & AR5K_INT_GPIO)
 				tasklet_schedule(&sc->rf_kill.toggleq);
@@ -2775,6 +2789,18 @@ ath5k_tasklet_calibrate(unsigned long data)
 }
 
 
+static void
+ath5k_tasklet_ani(unsigned long data)
+{
+	struct ath5k_softc *sc = (void *)data;
+	struct ath5k_hw *ah = sc->ah;
+
+	ah->ah_cal_mask |= AR5K_CALIBRATION_ANI;
+	ath5k_ani_calibration(ah);
+	ah->ah_cal_mask &= ~AR5K_CALIBRATION_ANI;
+}
+
+
 /********************\
 * Mac80211 functions *
 \********************/
@@ -2874,6 +2900,8 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan)
 		goto err;
 	}
 
+	ath5k_ani_init(ah, ah->ah_sc->ani_state.ani_mode);
+
 	/*
 	 * Change channels and update the h/w rate map if we're switching;
 	 * e.g. 11a to 11b/g.
drivers/net/wireless/ath/ath5k/base.h +6 -0
index a572a48..53a5651 100644
@@ -50,6 +50,7 @@
 
 #include "ath5k.h"
 #include "debug.h"
+#include "ani.h"
 
 #include "../regd.h"
 #include "../ath.h"
@@ -132,6 +133,8 @@ struct ath5k_statistics {
 	unsigned int rts_ok;
 	unsigned int fcs_error;
 	unsigned int beacons;
+
+	unsigned int mib_intr;
 };
 
 #if CHAN_DEBUG
@@ -221,6 +224,9 @@ struct ath5k_softc {
 	bool			enable_beacon;	/* true if beacons are on */
 
 	struct ath5k_statistics	stats;
+
+	struct ath5k_ani_state	ani_state;
+	struct tasklet_struct	ani_tasklet;	/* ANI calibration */
 };
 
 #define ath5k_hw_hasbssidmask(_ah) \
drivers/net/wireless/ath/ath5k/debug.c +162 -0

192 lines not on this page · raw message

drivers/net/wireless/ath/ath5k/debug.h +2 -0
index da24ff5..ddd5b3a 100644
@@ -76,6 +76,7 @@ struct ath5k_dbg_info {
 	struct dentry		*debugfs_reset;
 	struct dentry		*debugfs_antenna;
 	struct dentry		*debugfs_frameerrors;
+	struct dentry		*debugfs_ani;
 };
 
 /**
@@ -115,6 +116,7 @@ enum ath5k_debug_level {
 	ATH5K_DEBUG_DUMP_TX	= 0x00000200,
 	ATH5K_DEBUG_DUMPBANDS	= 0x00000400,
 	ATH5K_DEBUG_TRACE	= 0x00001000,
+	ATH5K_DEBUG_ANI		= 0x00002000,
 	ATH5K_DEBUG_ANY		= 0xffffffff
 };
 
drivers/net/wireless/ath/ath5k/desc.c +1 -0
index 9d920fb..7d7b646 100644
@@ -645,6 +645,7 @@ static int ath5k_hw_proc_5212_rx_status(struct ath5k_hw *ah,
 			rs->rs_status |= AR5K_RXERR_PHY;
 			rs->rs_phyerr |= AR5K_REG_MS(rx_err->rx_error_1,
 					   AR5K_RX_DESC_ERROR1_PHY_ERROR_CODE);
+			ath5k_ani_phy_error_report(ah, rs->rs_phyerr);
 		}
 
 		if (rx_status->rx_status_1 &
drivers/net/wireless/ath/ath5k/pcu.c +0 -1
index c7c1fe0..710870e 100644
@@ -379,7 +379,6 @@ void ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask)
  * (ACK etc).
  *
  * NOTE: RX DMA should be already enabled using ath5k_hw_start_rx_dma
- * TODO: Init ANI here
  */
 void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah)
 {
drivers/net/wireless/ath/ath5k/reg.h +26 -10
index 47f0493..45d62e9 100644
@@ -212,10 +212,10 @@
  * MIB control register
  */
 #define AR5K_MIBC		0x0040			/* Register Address */
-#define AR5K_MIBC_COW		0x00000001	/* Warn test indicator */
+#define AR5K_MIBC_COW		0x00000001	/* Counter Overflow Warning */
 #define AR5K_MIBC_FMC		0x00000002	/* Freeze MIB Counters  */
-#define AR5K_MIBC_CMC		0x00000004	/* Clean MIB Counters  */
-#define AR5K_MIBC_MCS		0x00000008	/* MIB counter strobe */
+#define AR5K_MIBC_CMC		0x00000004	/* Clear MIB Counters  */
+#define AR5K_MIBC_MCS		0x00000008	/* MIB counter strobe, increment all */
 
 /*
  * Timeout prescale register
@@ -1516,7 +1516,14 @@
 				AR5K_NAV_5210 : AR5K_NAV_5211)
 
 /*
- * RTS success register
+ * MIB counters:
+ *
+ * max value is 0xc000, if this is reached we get a MIB interrupt.
+ * they can be controlled via AR5K_MIBC and are cleared on read.
+ */
+
+/*
+ * RTS success (MIB counter)
  */
 #define AR5K_RTS_OK_5210	0x8090
 #define AR5K_RTS_OK_5211	0x8088
@@ -1524,7 +1531,7 @@
 				AR5K_RTS_OK_5210 : AR5K_RTS_OK_5211)
 
 /*
- * RTS failure register
+ * RTS failure (MIB counter)
  */
 #define AR5K_RTS_FAIL_5210	0x8094
 #define AR5K_RTS_FAIL_5211	0x808c
@@ -1532,7 +1539,7 @@
 				AR5K_RTS_FAIL_5210 : AR5K_RTS_FAIL_5211)
 
 /*
- * ACK failure register
+ * ACK failure (MIB counter)
  */
 #define AR5K_ACK_FAIL_5210	0x8098
 #define AR5K_ACK_FAIL_5211	0x8090
@@ -1540,7 +1547,7 @@
 				AR5K_ACK_FAIL_5210 : AR5K_ACK_FAIL_5211)
 
 /*
- * FCS failure register
+ * FCS failure (MIB counter)
  */
 #define AR5K_FCS_FAIL_5210	0x809c
 #define AR5K_FCS_FAIL_5211	0x8094
@@ -1667,11 +1674,17 @@
 
 /*
  * Profile count registers
+ *
+ * These registers can be cleared and freezed with ATH5K_MIBC, but they do not
+ * generate a MIB interrupt.
+ * Instead of overflowing, they shift by one bit to the right. All registers
+ * shift together, i.e. when one reaches the max, all shift at the same time by
+ * one bit to the right. This way we should always get consistent values.
  */
 #define AR5K_PROFCNT_TX			0x80ec	/* Tx count */
 #define AR5K_PROFCNT_RX			0x80f0	/* Rx count */
-#define AR5K_PROFCNT_RXCLR		0x80f4	/* Clear Rx count */
-#define AR5K_PROFCNT_CYCLE		0x80f8	/* Cycle count (?) */
+#define AR5K_PROFCNT_RXCLR		0x80f4	/* Busy count */
+#define AR5K_PROFCNT_CYCLE		0x80f8	/* Cycle counter */
 
 /*
  * Quiet period control registers
@@ -1758,7 +1771,7 @@
 #define	AR5K_CCK_FIL_CNT		0x8128
 
 /*
- * PHY Error Counters (?)
+ * PHY Error Counters (same masks as AR5K_PHY_ERR_FIL)
  */
 #define	AR5K_PHYERR_CNT1		0x812c
 #define	AR5K_PHYERR_CNT1_MASK		0x8130
@@ -1766,6 +1779,9 @@
 #define	AR5K_PHYERR_CNT2		0x8134
 #define	AR5K_PHYERR_CNT2_MASK		0x8138
 
+/* if the PHY Error Counters reach this maximum, we get MIB interrupts */
+#define ATH5K_PHYERR_CNT_MAX		0x00c00000
+
 /*
  * TSF Threshold register (?)
  */
#11 lore raw

Re: [PATCH 10/10] ath5k: Adaptive Noise Immunity (ANI) Implementation

Quoted 7 lines · Bruno Randolf
drivers/net/wireless/ath/ath5k/debug.c +6 -0
+/* debugfs: ani */
+
+static ssize_t read_file_ani(struct file *file, char __user *user_buf,
+				   size_t count, loff_t *ppos)
+{
+	return simple_read_from_buffer(user_buf, count, ppos, buf, len);

...

Quoted 1 line

+}

I would prefer a machine readable solution, e.g. individual files in an ANI directory with one value each.

Quoted 4 lines
drivers/net/wireless/ath/ath5k/debug.c +4 -0
+static ssize_t write_file_ani(struct file *file,
+				 const char __user *userbuf,
+				 size_t count, loff_t *ppos)
+{

...

drivers/net/wireless/ath/ath5k/debug.c static const struct file_operations fops_frameerrors = { · line 722

Quoted 2 lines
drivers/net/wireless/ath/ath5k/debug.c +2 -0
+	return count;
+}

Same as above: instead of a catch all with magic configuration words, use individual files with at least guessable values (e.g. 0/1 for enable/disable of individual features).

Otherwise I'm excited to see ath5k become feature complete compared with Madwifi.

Regards
Joerg

#12 lore raw

Re: [PATCH 10/10] ath5k: Adaptive Noise Immunity (ANI) Implementation

Quoted 22 lines · On Thursday 25 March 2010 19:59:11 Joerg Pommnitz wrote:
Quoted 6 lines · Bruno Randolf
drivers/net/wireless/ath/ath5k/debug.c +6 -0
+/* debugfs: ani */
+
+static ssize_t read_file_ani(struct file *file, char __user *user_buf,
+				   size_t count, loff_t *ppos)
+{
+	return simple_read_from_buffer(user_buf, count, ppos, buf, len);

...

Quoted 1 line

+}

I would prefer a machine readable solution, e.g. individual files in an ANI directory with one value each.

Quoted 4 lines
drivers/net/wireless/ath/ath5k/debug.c +4 -0
+static ssize_t write_file_ani(struct file *file,
+				 const char __user *userbuf,
+				 size_t count, loff_t *ppos)
+{

...

Quoted 6 lines

drivers/net/wireless/ath/ath5k/debug.c static const struct file_operations fops_frameerrors = { · line 722

Quoted 2 lines
drivers/net/wireless/ath/ath5k/debug.c +2 -0
+	return count;
+}

Same as above: instead of a catch all with magic configuration words, use individual files with at least guessable values (e.g. 0/1 for enable/disable of individual features).

yes i agree with you and i mentioned this in my introdution message [PATCH 0/0]. these are just debug files...

my question is which interface to use?

iw? - probably not generic enough, allthough something like "sensitivity"
could be useful to other drivers too?

sysfs? configfs? - what is the interface of choice nowadays? ;)

bruno

#13 lore raw

Re: [ath5k-devel] [PATCH 10/10] ath5k: Adaptive Noise Immunity (ANI) Implementation

In reply to Bruno Randolf

drivers/net/wireless/ath/ath5k/debug.c static const struct file_operations fops_frameerrors = { · line 700

Quoted 3 lines · Bruno Randolf
drivers/net/wireless/ath/ath5k/debug.c +3 -0
+	} else if (strncmp(buf, "noise-low", 8) == 0) {
+		ath5k_ani_set_noise_immunity_level(sc->ah, 0);
+	} else if (strncmp(buf, "noise-high", 9) == 0) {

The number of characters here is off-by-one.

I also tried setting noise-high while in auto mode, but then the ani debug file still showed the values at 0, is that to be expected?

On my hardware in my location, I don't really notice much of a difference with/without ANI, but I definitely don't get any MIB storms, so it gets my thumbs up. I can post my ani file if you're interested.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#14 lore raw

Re: [ath5k-devel] [PATCH 10/10] ath5k: Adaptive Noise Immunity (ANI) Implementation

Quoted 6 lines · On Monday 29 March 2010 11:02:12 Bob Copeland wrote:

drivers/net/wireless/ath/ath5k/debug.c static const struct file_operations fops_frameerrors = { · line 700

Quoted 3 lines · Bruno Randolf
drivers/net/wireless/ath/ath5k/debug.c +3 -0
+	} else if (strncmp(buf, "noise-low", 8) == 0) {
+		ath5k_ani_set_noise_immunity_level(sc->ah, 0);
+	} else if (strncmp(buf, "noise-high", 9) == 0) {

The number of characters here is off-by-one

ah, thanks!

Quoted 2 lines

I also tried setting noise-high while in auto mode, but then the ani debug file still showed the values at 0, is that to be expected?

in auto mode, the manual settings may be changed at any time, according to the algorithm. if you don't want this to happen, you can echo ani-off, which will just stop the automatic mode and keep the last values it used, or echo sens- high or sens-low which will also stop the auto mode, plus set the min/max values.

Quoted 3 lines

On my hardware in my location, I don't really notice much of a difference with/without ANI, but I definitely don't get any MIB storms, so it gets my thumbs up. I can post my ani file if you're interested.

so you have decent truput with and without ani? that probably means not much interference (OFDM and CCK error counters should be low).

bruno

#15 lore raw
In reply to Bruno Randolf

Hi,

Quoted 1 line · Bruno Randolf

This is ANI for ath5k.

Fantastic!!
I have used your initial ani patch set here, and it did help througput
etc.

Quoted 5 lines

- Improve beacon averaging algorithm for IBSS: Maybe we should keep track of the average RSSI on a per-node basis and use the minimum of those in order not to loose far away nodes? The other option would be to limit the parameters we control similar to AP mode.

We have talked about this before. I thought that we agreed that adhoc nodes may
a)be activated at any time
b)be positioned at an unknown distance apart

it therefore makes no sense to average the RSSI over the current nodes.
If all the current nodes in the network are close by, the ani algorithm will wind the sensitivity down. Consequently, if a remote node is started, it will not be able to connect. Yet, the remote node should have been able to connect as the slot times etc were long enough, and the link budget is fine...

So yes, the only way to

Quoted 1 line

- Improve beacon averaging algorithm for IBSS:

is to turn ani off. which means the issue you raised else where of providing reasonable userland controls (not via debugfs) becomes important.

Derek.

---
Derek Smithies Ph.D. IndraNet Technologies Ltd. ph +64 3 365 6485 Web: http://www.indranet-technologies.com/

"How did you make it work??"
"Oh, the usual, get everything right".

#16 lore raw
Quoted 24 lines · Derek Smithies

Hi,

Quoted 1 line · Bruno Randolf

This is ANI for ath5k.

Fantastic!!
I have used your initial ani patch set here, and it did help througput
etc.

Quoted 5 lines

- Improve beacon averaging algorithm for IBSS: Maybe we should keep track of the average RSSI on a per-node basis and use the minimum of those in order not to loose far away nodes? The other option would be to limit the parameters we control similar to AP mode.

We have talked about this before. I thought that we agreed that adhoc nodes may
a)be activated at any time
b)be positioned at an unknown distance apart

it therefore makes no sense to average the RSSI over the current nodes. If all the current nodes in the network are close by, the ani algorithm will wind the sensitivity down. Consequently, if a remote node is started, it will not be able to connect. Yet, the remote node should have been able to connect as the slot times etc were long enough, and the link budget is fine...

Quoted 5 lines

So yes, the only way to

Quoted 1 line

- Improve beacon averaging algorithm for IBSS:

is to turn ani off. which means the issue you raised else where of providing reasonable userland controls (not via debugfs) becomes important.

If ANI helps IBSS so much then why not just default to turning it off within the driver?

Luis

#17 lore raw
Quoted 13 lines · On Friday 26 March 2010 06:13:11 Luis R. Rodriguez wrote:
Quoted 13 lines
Quoted 6 lines

- Improve beacon averaging algorithm for IBSS: Maybe we should keep track of

the average RSSI on a per-node basis and use the minimum of those in order not to loose far away nodes? The other option would be to limit the parameters we control similar to AP mode.

We have talked about this before. I thought that we agreed that adhoc nodes may

a)be activated at any time
b)be positioned at an unknown distance apart

Quoted 6 lines
Quoted 6 lines

it therefore makes no sense to average the RSSI over the current nodes. If all the current nodes in the network are close by, the ani algorithm will wind the sensitivity down. Consequently, if a remote node is started, it will not be able to connect. Yet, the remote node should have been able to connect as the slot times etc were long enough, and the link budget is fine...

i'm not sure how big the effect of ANI is - would it really shut the remote node out completely? or would just performance degrade? also beacons are sent at the lowest rate, so they will travel far. this needs to be tested! it doesnt make sense to discuss this based on hypothetical assumptions.

Quoted 9 lines
Quoted 6 lines

So yes, the only way to

Quoted 1 line

- Improve beacon averaging algorithm for IBSS:

is to turn ani off. which means the issue you raised else where of providing reasonable userland controls (not via debugfs) becomes important.

If ANI helps IBSS so much then why not just default to turning it off within the driver?

i would say in most standard cases, IBSS nodes are close together or at a similar distance, so it does make sense to use ANI by default.

as well, we all agree that there should be userland controls. the questions is just about the interface to use.

bruno

#18 lore raw
Quoted 33 lines · Bruno Randolf
Quoted 13 lines · On Friday 26 March 2010 06:13:11 Luis R. Rodriguez wrote:
Quoted 13 lines
Quoted 6 lines

- Improve beacon averaging algorithm for IBSS: Maybe we should keep track of

the average RSSI on a per-node basis and use the minimum of those in order not to loose far away nodes? The other option would be to limit the parameters we control similar to AP mode.

We have talked about this before. I thought that we agreed that adhoc nodes may

a)be activated at any time
b)be positioned at an unknown distance apart

Quoted 6 lines
Quoted 6 lines

it therefore makes no sense to average the RSSI over the current nodes. If all the current nodes in the network are close by, the ani algorithm will wind the sensitivity down. Consequently, if a remote node is started, it will not be able to connect. Yet, the remote node should have been able to connect as the slot times etc were long enough, and the link budget is fine...

i'm not sure how big the effect of ANI is - would it really shut the remote node out completely? or would just performance degrade? also beacons are sent at the lowest rate, so they will travel far. this needs to be tested! it doesnt make sense to discuss this based on hypothetical assumptions.

Quoted 7 lines
Quoted 6 lines

So yes, the only way to

Quoted 1 line

- Improve beacon averaging algorithm for IBSS:

is to turn ani off. which means the issue you raised else where of providing reasonable userland controls (not via debugfs) becomes important.

Quoted 8 lines
Quoted 2 lines

If ANI helps IBSS so much then why not just default to turning it off within the driver?

i would say in most standard cases, IBSS nodes are close together or at a similar distance, so it does make sense to use ANI by default.

as well, we all agree that there should be userland controls. the questions is just about the interface to use.

ANI is specific to Atheros cards so debugfs would do it. If we want to have a more rigit API we could use a configfs entry for ath9k.

Luis

#19 lore raw
Quoted 5 lines · On Friday 26 March 2010 09:44:31 Luis R. Rodriguez wrote:
Quoted 2 lines

as well, we all agree that there should be userland controls. the questions is just about the interface to use.

ANI is specific to Atheros cards so debugfs would do it. If we want to have a more rigit API we could use a configfs entry for ath9k.

debugfs definetly is the wrong place! users might compile the module with debugging disabled (for performance reasons, e.g.).

are you sure about configfs? as far as i read about it it's for the dynamic creation of kernel objects, which is not what we are doing here. or did the rules change in the mean time?

bruno

#20 lore raw

Adding a few more people for wider review on this.

Quoted 7 lines · Bruno Randolf
Quoted 5 lines · On Friday 26 March 2010 09:44:31 Luis R. Rodriguez wrote:
Quoted 2 lines

as well, we all agree that there should be userland controls. the questions is just about the interface to use.

ANI is specific to Atheros cards so debugfs would do it. If we want to have a more rigit API we could use a configfs entry for ath9k.

Quoted 6 lines

debugfs definetly is the wrong place! users might compile the module with debugging disabled (for performance reasons, e.g.).

are you sure about configfs? as far as i read about it it's for the dynamic creation of kernel objects, which is not what we are doing here. or did the rules change in the mean time?

I intended on writing a file system API for 802.11 management a while ago through configfs, the only reason why I put it aside is our focus was to get a netlink based API done. I think its reasonable to use it for configuration of specific devices parameters though given that we don't have a private API through nl80211.

Luis

#21 lore raw
In reply to Bruno Randolf
Quoted 10 lines · Bruno Randolf
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

- Improve beacon averaging algorithm for IBSS:

is to turn ani off. which means the issue you raised else where of providing reasonable userland controls (not via debugfs) becomes important.

If ANI helps IBSS so much then why not just default to turning it off within the driver?

i would say in most standard cases, IBSS nodes are close together or at a similar distance, so it does make sense to use ANI by default.

Nope - I disagree. You have made a dangerous assumption, to asume that
IBSS node are close together or at a similar distance

if you have a network of ibss nodes, and then look at the rate tables of the different nodes (minstrel is great here - it gives a fair and accurte represetation of the best rate possible to other nodes) you see there is some variation in the optimal rates between nodes.Which suggests that using some automatic ani algorithm in an ibss network will foreever lower performance for those nodes at the edge of the network.

Quoted 3 lines

as well, we all agree that there should be userland controls. the questions is just about the interface to use.

Definately - need userland controls. The default for IBSS should have ANI off. If the user wants to "futz" with it, they can. With ANI off for IBSS, you ensure that on startup, the network has the greatest chance of working.

Derek.

Signature · 7 lines
Derek Smithies Ph.D.
IndraNet Technologies Ltd.
ph +64 3 365 6485
Web: http://www.indranet-technologies.com/

"How did you make it work??"
      "Oh, the usual, get everything right".
#22 lore raw
Quoted 17 lines · Derek Smithies
Quoted 10 lines · Bruno Randolf
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

- Improve beacon averaging algorithm for IBSS:

is to turn ani off. which means the issue you raised else where of providing reasonable userland controls (not via debugfs) becomes important.

If ANI helps IBSS so much then why not just default to turning it off within the driver?

i would say in most standard cases, IBSS nodes are close together or at a similar distance, so it does make sense to use ANI by default.

Nope - I disagree. You have made a dangerous assumption, to asume that
IBSS node are close together or at a similar distance

Quoted 6 lines

if you have a network of ibss nodes, and then look at the rate tables of the different nodes (minstrel is great here - it gives a fair and accurte represetation of the best rate possible to other nodes) you see there is some variation in the optimal rates between nodes.Which suggests that using some automatic ani algorithm in an ibss network will foreever lower performance for those nodes at the edge of the network.

Can't we use the coverage class for this stuff? Only thing is it would need to be set. Do we even send the coverage class IE ? I don't think we do, that part of the country IE and last time I reviewed the country IE building on hostapd it didn't have it. IBSS is handled on mac80211 though so... we'd have to add it there. I guess its a lot of work, but would help with this no?

Quoted 7 lines
Quoted 2 lines

as well, we all agree that there should be userland controls. the questions is just about the interface to use.

Definately - need userland controls. The default for IBSS should have ANI off. If the user wants to "futz" with it, they can. With ANI off for IBSS, you ensure that on startup, the network has the greatest chance of working.

Luis

#23 lore raw
In reply to Derek Smithies
Quoted 12 lines · On Friday 26 March 2010 10:21:50 Derek Smithies wrote:
Quoted 10 lines · Bruno Randolf
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

- Improve beacon averaging algorithm for IBSS:

is to turn ani off. which means the issue you raised else where of providing reasonable userland controls (not via debugfs) becomes important.

If ANI helps IBSS so much then why not just default to turning it off within the driver?

i would say in most standard cases, IBSS nodes are close together or at a similar distance, so it does make sense to use ANI by default.

Quoted 7 lines

Nope - I disagree. You have made a dangerous assumption, to asume that
IBSS node are close together or at a similar distance

if you have a network of ibss nodes, and then look at the rate tables of the different nodes (minstrel is great here - it gives a fair and accurte represetation of the best rate possible to other nodes)

yeah, we all know how great minstrel is... really.

Quoted 5 lines

you see there is
some variation in the optimal rates between nodes.Which suggests that using some automatic ani algorithm in an ibss network will foreever lower performance for those nodes at the edge of the network.

Quoted 7 lines
Quoted 2 lines

as well, we all agree that there should be userland controls. the questions is just about the interface to use.

Definately - need userland controls. The default for IBSS should have ANI off. If the user wants to "futz" with it, they can. With ANI off for IBSS, you ensure that on startup, the network has the greatest chance of working.

i said in most *standard* cases - the standard case for IBSS is still 3 or 5 guys sitting in a room, or close by, wanting to exchange some data. we should have good performance for that, therefore ANI on by default.

in larger IBSS mesh networks or outdoor deployments you will want to tune ANI manually anyhow, then you can turn it off.

again - i'm not willing to discuss this based on guesses and assumptions. looking at the rate tables will not tell you if using ANI will shut a node out or not. if you have test results showing that a specific ANI setting actually prevented a node from joining an IBSS, i'm happy to resume this discussion.

bruno

#24 lore raw
Quoted 2 lines · Bruno Randolf

yeah, we all know how great minstrel is... really.

Thanks for the praise on Minstrel.
Felix has done, and is doing, some good work on getting it into the kernel. And of course, his current work with minstrel in 802.11 N

Quoted 4 lines

i said in most *standard* cases - the standard case for IBSS is still 3 or 5 guys sitting in a room, or close by, wanting to exchange some data. we should have good performance for that, therefore ANI on by default.

It is, essentially, wishful thinking to assume one can have automatic ANI in IBSS mode.

Given that we are designing a code base to have general use, we have to design code that will work for the most number of people "out of the box", and they tune it for their situation.
To get IBSS to work best "out of the box" (i.e. with no tuning) for the
most number of people you have to have ANI off

I had a siution with a IBSS network I am running here, with nodes all indoors. OK, they are all madwifi based, but that simply means they have an ANI algorithm.
At one end of the building, there were four nodes. At the far end of
the building, there was one node.
When the remote node talked to the any of the other four, rates were always asymmetrical. TCP throughput in one direction was half of TCP throughput in the other direction.
Why the assymmetry? Cause the four nodes had wound their ANI levels down.
By copying sensitivity setting code from the open sourced HAL, and with
ANI off, the measured TCP throughput rates became much more symmetrical (same in both directions).

I have used madwifi for a number of years now. In networks installed outdoors, everything worked fine (initially). As the days went by, measured throughputs dropped.
The drop in throughput was sometimes caused by ramping,
(ticket 1154, also known as transmission delay)
sometimes by the rate algorithm failing (sample etc is quite poor)
but also by the nodes lowering sensitivy levels.
There was sometimes a considerable delay before nodes would join and
communicate on a network (this could have net80211 code, or ani, or ??)

Quoted 1 line

again - i'm not willing to discuss this based on guesses and assumptions.

Me too. asumptions are bad - code based on assumptions is bad.

So the question is then:
What is the evidence for ANI helping in IBSS mode?
- only when all nodes are an equal distance away from each other - you have a very small network (probably 2 nodes, ANI will be great here)

Quoted 2 lines

if you have test results showing that a specific ANI setting actually prevented a node from joining an IBSS, i'm happy to resume this discussion.

Ok, I don't (definatively) have proof of this.
I do have proof that automatic ANI in an IBSS network will lead to assymetric TCP throughputs.

Derek.

Signature · 5 lines
Derek Smithies Ph.D.
IndraNet Technologies Ltd.
Email: [email protected]
ph +64 3 365 6485
Web: http://www.indranet-technologies.com/
#25 lore raw
Quoted 41 lines · On Saturday 27 March 2010 05:34:21 Derek Smithies wrote:

It is, essentially, wishful thinking to assume one can have automatic ANI in IBSS mode.

Given that we are designing a code base to have general use, we have to design code that will work for the most number of people "out of the box", and they tune it for their situation.
To get IBSS to work best "out of the box" (i.e. with no tuning) for the
most number of people you have to have ANI off

I had a siution with a IBSS network I am running here, with nodes all indoors. OK, they are all madwifi based, but that simply means they have an ANI algorithm.
At one end of the building, there were four nodes. At the far end of
the building, there was one node.
When the remote node talked to the any of the other four, rates were always asymmetrical. TCP throughput in one direction was half of TCP throughput in the other direction.
Why the assymmetry? Cause the four nodes had wound their ANI levels down.
By copying sensitivity setting code from the open sourced HAL, and with ANI off, the measured TCP throughput rates became much more symmetrical (same in both directions).

I have used madwifi for a number of years now. In networks installed outdoors, everything worked fine (initially). As the days went by, measured throughputs dropped.
The drop in throughput was sometimes caused by ramping,
(ticket 1154, also known as transmission delay)
sometimes by the rate algorithm failing (sample etc is quite poor) but also by the nodes lowering sensitivy levels.
There was sometimes a considerable delay before nodes would join and communicate on a network (this could have net80211 code, or ani, or ??)

Quoted 1 line

again - i'm not willing to discuss this based on guesses and assumptions.

Me too. asumptions are bad - code based on assumptions is bad.

So the question is then:
What is the evidence for ANI helping in IBSS mode?
- only when all nodes are an equal distance away from each other - you have a very small network (probably 2 nodes, ANI will be great here)

Quoted 7 lines
Quoted 3 lines

if you have test results showing that a specific ANI setting actually prevented a node from joining an IBSS, i'm happy to resume this discussion.

Ok, I don't (definatively) have proof of this.
I do have proof that automatic ANI in an IBSS network will lead to assymetric TCP throughputs.

still i think that you are too fast in your conclusion that ANI needs to be completely disabled for IBSS mode in ath5k - based on some strange experience you had with madwifi. madwifi and the HAL do a lot of crazy things, and we don't even know how ANI was implemented exactly in the HAL you used for testing (was it the same like the open source version? was there a bug?).

* maybe thruput would be good enough if we considered the minimum beacon
RSSI?

* maybe we should avoid to tune one specific parameter in IBSS? (like AP for
example, only changes noise immunity level, firstep level and spur level)

* maybe there would be another way to improve or fix the algorithm?

would it be possible that you could reproduce this situation with ath5k? if yes, could you find out which ANI parameter you had to change to improve thruput?

bruno