linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4] ath5k: Use SWI to trigger calibration
@ 2009-07-31 18:10 Nick Kossifidis
  2009-07-31 18:15 ` Luis R. Rodriguez
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Nick Kossifidis @ 2009-07-31 18:10 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless; +Cc: linville, jirislaby, me, mcgrof, nbd

 * Get rid of calibration timer, instead use a software interrupt
   to schedule the calibration tasklet.

---
 drivers/net/wireless/ath/ath5k/ath5k.h |   16 ++++++++++++++++
 drivers/net/wireless/ath/ath5k/base.c  |   28 ++++++++++++++++++----------
 drivers/net/wireless/ath/ath5k/base.h  |    3 ++-
 drivers/net/wireless/ath/ath5k/phy.c   |   20 ++++++++++++++++++++
 4 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 1047a6c..76cf5b2 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -919,6 +919,12 @@ 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,
+};
+
 /*
  * Power management
  */
@@ -1123,6 +1129,15 @@ struct ath5k_hw {
 	/* noise floor from last periodic calibration */
 	s32			ah_noise_floor;
 
+	/* Calibration timestamp */
+	u32			ah_cal_tstamp;
+
+	/* Calibration interval (secs) */
+	u8			ah_cal_intval;
+
+	/* Software interrupt mask */
+	u8			ah_swi_mask;
+
 	/*
 	 * Function pointers
 	 */
@@ -1276,6 +1291,7 @@ extern int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *chann
 /* PHY calibration */
 extern int ath5k_hw_phy_calibrate(struct ath5k_hw *ah, struct ieee80211_channel *channel);
 extern int ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq);
+extern 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);
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index b64731b..02fa71a 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -59,7 +59,7 @@
 #include "reg.h"
 #include "debug.h"
 
-static int ath5k_calinterval = 10; /* Calibrate PHY every 10 secs (TODO: Fixme) */
+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.");
@@ -376,7 +376,7 @@ static int 	ath5k_stop_hw(struct ath5k_softc *sc);
 static irqreturn_t ath5k_intr(int irq, void *dev_id);
 static void 	ath5k_tasklet_reset(unsigned long data);
 
-static void 	ath5k_calibrate(unsigned long data);
+static void 	ath5k_tasklet_calibrate(unsigned long data);
 
 /*
  * Module init/exit functions
@@ -799,8 +799,8 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
 	tasklet_init(&sc->rxtq, ath5k_tasklet_rx, (unsigned long)sc);
 	tasklet_init(&sc->txtq, ath5k_tasklet_tx, (unsigned long)sc);
 	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);
-	setup_timer(&sc->calib_tim, ath5k_calibrate, (unsigned long)sc);
 
 	ret = ath5k_eeprom_read_mac(ah, mac);
 	if (ret) {
@@ -2366,7 +2366,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_FATAL | AR5K_INT_GLOBAL | AR5K_INT_SWI;
 	ret = ath5k_reset(sc, NULL);
 	if (ret)
 		goto done;
@@ -2383,8 +2383,8 @@ ath5k_init(struct ath5k_softc *sc)
 	/* Set ack to be sent at low bit-rates */
 	ath5k_hw_set_ack_bitrate_high(ah, false);
 
-	mod_timer(&sc->calib_tim, round_jiffies(jiffies +
-			msecs_to_jiffies(ath5k_calinterval * 1000)));
+	/* Set PHY calibration timestamp and inteval */
+	ah->ah_cal_intval = ath5k_calinterval;
 
 	ret = 0;
 done:
@@ -2477,7 +2477,6 @@ ath5k_stop_hw(struct ath5k_softc *sc)
 	mmiowb();
 	mutex_unlock(&sc->lock);
 
-	del_timer_sync(&sc->calib_tim);
 	tasklet_kill(&sc->rxtq);
 	tasklet_kill(&sc->txtq);
 	tasklet_kill(&sc->restq);
@@ -2536,6 +2535,9 @@ 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
@@ -2552,6 +2554,8 @@ 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);
+
 	return IRQ_HANDLED;
 }
 
@@ -2568,11 +2572,15 @@ ath5k_tasklet_reset(unsigned long data)
  * for temperature/environment changes.
  */
 static void
-ath5k_calibrate(unsigned long data)
+ath5k_tasklet_calibrate(unsigned long data)
 {
 	struct ath5k_softc *sc = (void *)data;
 	struct ath5k_hw *ah = sc->ah;
 
+	/* Only full calibration for now */
+	if (ah->ah_swi_mask != AR5K_SWI_FULL_CALIBRATION)
+		return;
+
 	ATH5K_DBG(sc, ATH5K_DEBUG_CALIBRATE, "channel %u/%x\n",
 		ieee80211_frequency_to_channel(sc->curchan->center_freq),
 		sc->curchan->hw_value);
@@ -2590,8 +2598,8 @@ ath5k_calibrate(unsigned long data)
 			ieee80211_frequency_to_channel(
 				sc->curchan->center_freq));
 
-	mod_timer(&sc->calib_tim, round_jiffies(jiffies +
-			msecs_to_jiffies(ath5k_calinterval * 1000)));
+	ah->ah_swi_mask = 0;
+
 }
 
 
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
index 778e422..667bd9d 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -177,6 +177,8 @@ struct ath5k_softc {
 
 	struct ath5k_rfkill	rf_kill;
 
+	struct tasklet_struct	calib;		/* calibration tasklet */
+
 	spinlock_t		block;		/* protects beacon */
 	struct tasklet_struct	beacontq;	/* beacon intr tasklet */
 	struct ath5k_buf	*bbuf;		/* beacon buffer */
@@ -187,7 +189,6 @@ struct ath5k_softc {
 	unsigned int		nexttbtt;	/* next beacon time in TU */
 	struct ath5k_txq	*cabq;		/* content after beacon */
 
-	struct timer_list	calib_tim;	/* calibration timer */
 	int 			power_level;	/* Requested tx power in dbm */
 	bool			assoc;		/* assocate state */
 	bool			enable_beacon;	/* true if beacons are on */
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 6afba98..d30bc3b 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1104,6 +1104,26 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
   PHY calibration
 \*****************/
 
+void
+ath5k_hw_calibration_poll(struct ath5k_hw *ah)
+{
+	u32 current_time = (jiffies / HZ);
+	u32 cal_intval = ah->ah_cal_intval;
+
+	if (!ah->ah_cal_tstamp)
+		ah->ah_cal_tstamp = current_time;
+
+	/* For now we always do full calibration
+	 * Mark software interrupt mask and fire software
+	 * interrupt (bit gets auto-cleared) */
+	if ((current_time - ah->ah_cal_tstamp) >= cal_intval) {
+		ah->ah_cal_tstamp = current_time;
+		ah->ah_swi_mask = AR5K_SWI_FULL_CALIBRATION;
+		AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI);
+	}
+
+}
+
 /**
  * ath5k_hw_noise_floor_calibration - perform PHY noise floor calibration
  *


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-07-31 18:10 [PATCH 4/4] ath5k: Use SWI to trigger calibration Nick Kossifidis
@ 2009-07-31 18:15 ` Luis R. Rodriguez
  2009-07-31 18:25   ` [ath5k-devel] " Nick Kossifidis
  2009-07-31 18:34 ` Nick Kossifidis
  2009-08-01  5:46 ` Nick Kossifidis
  2 siblings, 1 reply; 23+ messages in thread
From: Luis R. Rodriguez @ 2009-07-31 18:15 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless, linville, jirislaby, me, mcgrof, nbd

On Fri, Jul 31, 2009 at 11:10 AM, Nick
Kossifidis<mick@madwifi-project.org> wrote:
>  * Get rid of calibration timer, instead use a software interrupt
>   to schedule the calibration tasklet.

An example of itemizing one change. Explain the why, not the how.

  Luis

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-07-31 18:15 ` Luis R. Rodriguez
@ 2009-07-31 18:25   ` Nick Kossifidis
  2009-07-31 18:48     ` Luis R. Rodriguez
                       ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Nick Kossifidis @ 2009-07-31 18:25 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: ath5k-devel, linux-wireless, linville, jirislaby, me, nbd

2009/7/31 Luis R. Rodriguez <mcgrof@gmail.com>:
> On Fri, Jul 31, 2009 at 11:10 AM, Nick
> Kossifidis<mick@madwifi-project.org> wrote:
>>  * Get rid of calibration timer, instead use a software interrupt
>>   to schedule the calibration tasklet.
>
> An example of itemizing one change. Explain the why, not the how.
>

We 've discussed this with various people on wireless summit.

a) We don't need a timer for this, there is no need for accuracy
    even with round_jiffies i think this is a waste of resources.
    Also we don't need to run calibration if we are idle (no interrupts).

b) When we add ANI support we 'll just extend the poll function
    and calibration tasklet and handle all periodic phy calibration
    on one place (much cleaner).

c) Having calibration on a tasklet is better since during calibration
    we can't transmit or receive (antennas are detached to measure
    noise floor), previously calibration could run in parallel with tx/rx
    and interfere (packet loss).

-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-07-31 18:10 [PATCH 4/4] ath5k: Use SWI to trigger calibration Nick Kossifidis
  2009-07-31 18:15 ` Luis R. Rodriguez
@ 2009-07-31 18:34 ` Nick Kossifidis
  2009-08-01  5:46 ` Nick Kossifidis
  2 siblings, 0 replies; 23+ messages in thread
From: Nick Kossifidis @ 2009-07-31 18:34 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless; +Cc: linville, jirislaby, me, mcgrof, nbd

 * Get rid of calibration timer, instead use a software interrupt
   to schedule the calibration tasklet.

 Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

---
 drivers/net/wireless/ath/ath5k/ath5k.h |   16 ++++++++++++++++
 drivers/net/wireless/ath/ath5k/base.c  |   28 ++++++++++++++++++----------
 drivers/net/wireless/ath/ath5k/base.h  |    3 ++-
 drivers/net/wireless/ath/ath5k/phy.c   |   20 ++++++++++++++++++++
 4 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 1047a6c..76cf5b2 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -919,6 +919,12 @@ 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,
+};
+
 /*
  * Power management
  */
@@ -1123,6 +1129,15 @@ struct ath5k_hw {
 	/* noise floor from last periodic calibration */
 	s32			ah_noise_floor;
 
+	/* Calibration timestamp */
+	u32			ah_cal_tstamp;
+
+	/* Calibration interval (secs) */
+	u8			ah_cal_intval;
+
+	/* Software interrupt mask */
+	u8			ah_swi_mask;
+
 	/*
 	 * Function pointers
 	 */
@@ -1276,6 +1291,7 @@ extern int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *chann
 /* PHY calibration */
 extern int ath5k_hw_phy_calibrate(struct ath5k_hw *ah, struct ieee80211_channel *channel);
 extern int ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq);
+extern 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);
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index b64731b..02fa71a 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -59,7 +59,7 @@
 #include "reg.h"
 #include "debug.h"
 
-static int ath5k_calinterval = 10; /* Calibrate PHY every 10 secs (TODO: Fixme) */
+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.");
@@ -376,7 +376,7 @@ static int 	ath5k_stop_hw(struct ath5k_softc *sc);
 static irqreturn_t ath5k_intr(int irq, void *dev_id);
 static void 	ath5k_tasklet_reset(unsigned long data);
 
-static void 	ath5k_calibrate(unsigned long data);
+static void 	ath5k_tasklet_calibrate(unsigned long data);
 
 /*
  * Module init/exit functions
@@ -799,8 +799,8 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
 	tasklet_init(&sc->rxtq, ath5k_tasklet_rx, (unsigned long)sc);
 	tasklet_init(&sc->txtq, ath5k_tasklet_tx, (unsigned long)sc);
 	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);
-	setup_timer(&sc->calib_tim, ath5k_calibrate, (unsigned long)sc);
 
 	ret = ath5k_eeprom_read_mac(ah, mac);
 	if (ret) {
@@ -2366,7 +2366,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_FATAL | AR5K_INT_GLOBAL | AR5K_INT_SWI;
 	ret = ath5k_reset(sc, NULL);
 	if (ret)
 		goto done;
@@ -2383,8 +2383,8 @@ ath5k_init(struct ath5k_softc *sc)
 	/* Set ack to be sent at low bit-rates */
 	ath5k_hw_set_ack_bitrate_high(ah, false);
 
-	mod_timer(&sc->calib_tim, round_jiffies(jiffies +
-			msecs_to_jiffies(ath5k_calinterval * 1000)));
+	/* Set PHY calibration timestamp and inteval */
+	ah->ah_cal_intval = ath5k_calinterval;
 
 	ret = 0;
 done:
@@ -2477,7 +2477,6 @@ ath5k_stop_hw(struct ath5k_softc *sc)
 	mmiowb();
 	mutex_unlock(&sc->lock);
 
-	del_timer_sync(&sc->calib_tim);
 	tasklet_kill(&sc->rxtq);
 	tasklet_kill(&sc->txtq);
 	tasklet_kill(&sc->restq);
@@ -2536,6 +2535,9 @@ 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
@@ -2552,6 +2554,8 @@ 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);
+
 	return IRQ_HANDLED;
 }
 
@@ -2568,11 +2572,15 @@ ath5k_tasklet_reset(unsigned long data)
  * for temperature/environment changes.
  */
 static void
-ath5k_calibrate(unsigned long data)
+ath5k_tasklet_calibrate(unsigned long data)
 {
 	struct ath5k_softc *sc = (void *)data;
 	struct ath5k_hw *ah = sc->ah;
 
+	/* Only full calibration for now */
+	if (ah->ah_swi_mask != AR5K_SWI_FULL_CALIBRATION)
+		return;
+
 	ATH5K_DBG(sc, ATH5K_DEBUG_CALIBRATE, "channel %u/%x\n",
 		ieee80211_frequency_to_channel(sc->curchan->center_freq),
 		sc->curchan->hw_value);
@@ -2590,8 +2598,8 @@ ath5k_calibrate(unsigned long data)
 			ieee80211_frequency_to_channel(
 				sc->curchan->center_freq));
 
-	mod_timer(&sc->calib_tim, round_jiffies(jiffies +
-			msecs_to_jiffies(ath5k_calinterval * 1000)));
+	ah->ah_swi_mask = 0;
+
 }
 
 
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
index 778e422..667bd9d 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -177,6 +177,8 @@ struct ath5k_softc {
 
 	struct ath5k_rfkill	rf_kill;
 
+	struct tasklet_struct	calib;		/* calibration tasklet */
+
 	spinlock_t		block;		/* protects beacon */
 	struct tasklet_struct	beacontq;	/* beacon intr tasklet */
 	struct ath5k_buf	*bbuf;		/* beacon buffer */
@@ -187,7 +189,6 @@ struct ath5k_softc {
 	unsigned int		nexttbtt;	/* next beacon time in TU */
 	struct ath5k_txq	*cabq;		/* content after beacon */
 
-	struct timer_list	calib_tim;	/* calibration timer */
 	int 			power_level;	/* Requested tx power in dbm */
 	bool			assoc;		/* assocate state */
 	bool			enable_beacon;	/* true if beacons are on */
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 6afba98..d30bc3b 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1104,6 +1104,26 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
   PHY calibration
 \*****************/
 
+void
+ath5k_hw_calibration_poll(struct ath5k_hw *ah)
+{
+	u32 current_time = (jiffies / HZ);
+	u32 cal_intval = ah->ah_cal_intval;
+
+	if (!ah->ah_cal_tstamp)
+		ah->ah_cal_tstamp = current_time;
+
+	/* For now we always do full calibration
+	 * Mark software interrupt mask and fire software
+	 * interrupt (bit gets auto-cleared) */
+	if ((current_time - ah->ah_cal_tstamp) >= cal_intval) {
+		ah->ah_cal_tstamp = current_time;
+		ah->ah_swi_mask = AR5K_SWI_FULL_CALIBRATION;
+		AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI);
+	}
+
+}
+
 /**
  * ath5k_hw_noise_floor_calibration - perform PHY noise floor calibration
  *


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-07-31 18:25   ` [ath5k-devel] " Nick Kossifidis
@ 2009-07-31 18:48     ` Luis R. Rodriguez
  2009-07-31 19:09     ` Pavel Roskin
  2009-07-31 19:11     ` Bob Copeland
  2 siblings, 0 replies; 23+ messages in thread
From: Luis R. Rodriguez @ 2009-07-31 18:48 UTC (permalink / raw)
  To: Nick Kossifidis; +Cc: ath5k-devel, linux-wireless, linville, jirislaby, me, nbd

On Fri, Jul 31, 2009 at 11:25 AM, Nick Kossifidis<mickflemm@gmail.com> wrote:
> 2009/7/31 Luis R. Rodriguez <mcgrof@gmail.com>:
>> On Fri, Jul 31, 2009 at 11:10 AM, Nick
>> Kossifidis<mick@madwifi-project.org> wrote:
>>>  * Get rid of calibration timer, instead use a software interrupt
>>>   to schedule the calibration tasklet.
>>
>> An example of itemizing one change. Explain the why, not the how.
>>
>
> We 've discussed this with various people on wireless summit.

Not everyone attended.

> a) We don't need a timer for this, there is no need for accuracy
>    even with round_jiffies i think this is a waste of resources.
>    Also we don't need to run calibration if we are idle (no interrupts).
>
> b) When we add ANI support we 'll just extend the poll function
>    and calibration tasklet and handle all periodic phy calibration
>    on one place (much cleaner).
>
> c) Having calibration on a tasklet is better since during calibration
>    we can't transmit or receive (antennas are detached to measure
>    noise floor), previously calibration could run in parallel with tx/rx
>    and interfere (packet loss).

It seems this good explanation can be mangled into the commit log entry.

  Luis

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-07-31 18:25   ` [ath5k-devel] " Nick Kossifidis
  2009-07-31 18:48     ` Luis R. Rodriguez
@ 2009-07-31 19:09     ` Pavel Roskin
  2009-07-31 19:35       ` Nick Kossifidis
  2009-07-31 19:11     ` Bob Copeland
  2 siblings, 1 reply; 23+ messages in thread
From: Pavel Roskin @ 2009-07-31 19:09 UTC (permalink / raw)
  To: Nick Kossifidis
  Cc: Luis R. Rodriguez, jirislaby, linux-wireless, ath5k-devel, linville

On Fri, 2009-07-31 at 21:25 +0300, Nick Kossifidis wrote:

> a) We don't need a timer for this, there is no need for accuracy
>     even with round_jiffies i think this is a waste of resources.
>     Also we don't need to run calibration if we are idle (no interrupts).

It doesn't sound right to me.

Can it be that the device gets so miscalibrated during the silence that
it won't be able to receive signal once it's there?  Say, the device is
set to channel 1 but it actually listens to channel 3, and there are
some weak beacons on channel 1.

And then there is an issue of the frequency straying outside the
permitted spectrum.  Perhaps the transmission will trigger interrupts
and thus recalibration, but in case of scanning, the first probe
requests could be on wrong frequencies.

I would probably leave the timer and allow the interrupts make the
delays shorter.

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-07-31 18:25   ` [ath5k-devel] " Nick Kossifidis
  2009-07-31 18:48     ` Luis R. Rodriguez
  2009-07-31 19:09     ` Pavel Roskin
@ 2009-07-31 19:11     ` Bob Copeland
  2009-07-31 19:52       ` Nick Kossifidis
  2 siblings, 1 reply; 23+ messages in thread
From: Bob Copeland @ 2009-07-31 19:11 UTC (permalink / raw)
  To: Nick Kossifidis
  Cc: Luis R. Rodriguez, ath5k-devel, linux-wireless, linville, jirislaby, nbd

On Fri, Jul 31, 2009 at 2:25 PM, Nick Kossifidis<mickflemm@gmail.com> wrote:
>    Also we don't need to run calibration if we are idle (no interrupts).

I think this is the big win right now...

> c) Having calibration on a tasklet is better since during calibration
>    we can't transmit or receive (antennas are detached to measure
>    noise floor), previously calibration could run in parallel with tx/rx
>    and interfere (packet loss).

This can still happen, no?  Two tasklets can run in parallel on
different processors, as long as they are different tasklets.

In practice, this won't happen much because tasklets run on the
cpu that scheduled them, and irq affinity is such (at least on my
hardware) that it's almost always the same CPU.  But I think to
make the above true it needs to stop the queues etc when doing
calibration.

Also we are missing tasklet_kill()?

-- 
Bob Copeland %% www.bobcopeland.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-07-31 19:09     ` Pavel Roskin
@ 2009-07-31 19:35       ` Nick Kossifidis
  2009-07-31 19:43         ` Pavel Roskin
  0 siblings, 1 reply; 23+ messages in thread
From: Nick Kossifidis @ 2009-07-31 19:35 UTC (permalink / raw)
  To: Pavel Roskin
  Cc: Luis R. Rodriguez, jirislaby, linux-wireless, ath5k-devel, linville

2009/7/31 Pavel Roskin <proski@gnu.org>:
> On Fri, 2009-07-31 at 21:25 +0300, Nick Kossifidis wrote:
>
>> a) We don't need a timer for this, there is no need for accuracy
>>     even with round_jiffies i think this is a waste of resources.
>>     Also we don't need to run calibration if we are idle (no interrupts).
>
> It doesn't sound right to me.
>
> Can it be that the device gets so miscalibrated during the silence that
> it won't be able to receive signal once it's there?  Say, the device is
> set to channel 1 but it actually listens to channel 3, and there are
> some weak beacons on channel 1.
>

Nope calibration deals mostly with noise immunity, it calculates the
noise floor and fixes QAM constellation. It's not related to the synthesizer
so it's not related to the channel frequency.

> And then there is an issue of the frequency straying outside the
> permitted spectrum.  Perhaps the transmission will trigger interrupts
> and thus recalibration, but in case of scanning, the first probe
> requests could be on wrong frequencies.
>

On each reset we trigger calibration so no worries there.




-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-07-31 19:35       ` Nick Kossifidis
@ 2009-07-31 19:43         ` Pavel Roskin
  0 siblings, 0 replies; 23+ messages in thread
From: Pavel Roskin @ 2009-07-31 19:43 UTC (permalink / raw)
  To: Nick Kossifidis
  Cc: Luis R. Rodriguez, jirislaby, linux-wireless, ath5k-devel, linville

On Fri, 2009-07-31 at 22:35 +0300, Nick Kossifidis wrote:

> Nope calibration deals mostly with noise immunity, it calculates the
> noise floor and fixes QAM constellation. It's not related to the synthesizer
> so it's not related to the channel frequency.

OK then, good to know.

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-07-31 19:11     ` Bob Copeland
@ 2009-07-31 19:52       ` Nick Kossifidis
  2009-08-01 13:22         ` Bob Copeland
  0 siblings, 1 reply; 23+ messages in thread
From: Nick Kossifidis @ 2009-07-31 19:52 UTC (permalink / raw)
  To: Bob Copeland
  Cc: Luis R. Rodriguez, ath5k-devel, linux-wireless, linville, jirislaby, nbd

2009/7/31 Bob Copeland <me@bobcopeland.com>:
> On Fri, Jul 31, 2009 at 2:25 PM, Nick Kossifidis<mickflemm@gmail.com> wrote:
>>    Also we don't need to run calibration if we are idle (no interrupts).
>
> I think this is the big win right now...
>
>> c) Having calibration on a tasklet is better since during calibration
>>    we can't transmit or receive (antennas are detached to measure
>>    noise floor), previously calibration could run in parallel with tx/rx
>>    and interfere (packet loss).
>
> This can still happen, no?  Two tasklets can run in parallel on
> different processors, as long as they are different tasklets.
>
> In practice, this won't happen much because tasklets run on the
> cpu that scheduled them, and irq affinity is such (at least on my
> hardware) that it's almost always the same CPU.  But I think to
> make the above true it needs to stop the queues etc when doing
> calibration.
>

ACK, how do we do that ?
ieee80211_stop_queues / ieee80211_wake_queues

> Also we are missing tasklet_kill()?
>

Yup, resending...



-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-07-31 18:10 [PATCH 4/4] ath5k: Use SWI to trigger calibration Nick Kossifidis
  2009-07-31 18:15 ` Luis R. Rodriguez
  2009-07-31 18:34 ` Nick Kossifidis
@ 2009-08-01  5:46 ` Nick Kossifidis
  2009-08-01  8:19   ` Jiri Slaby
  2 siblings, 1 reply; 23+ messages in thread
From: Nick Kossifidis @ 2009-08-01  5:46 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless; +Cc: linville, jirislaby, me, mcgrof, nbd, proski

 * Get rid of calibration timer, instead use a software interrupt
   to schedule the calibration tasklet.
    
 a) We don't need a timer for this, there is no need for accuracy
    even with round_jiffies i think this is a waste of resources.
    Also we don't need to run calibration if we are idle (no
    interrupts).
    
 b) When we add ANI support we 'll just extend the poll function
    and calibration tasklet and handle all periodic phy calibration
    on one place (much cleaner).
    
 c) Having calibration on a tasklet is better since during calibration
    we can't transmit or receive (antennas are detached to measure
    noise floor), previously calibration could run in parallel with
    tx/rx and interfere (packet loss).
    
 v2: kill tasklet on stop_hw, stop/wake queues

 Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

---
 drivers/net/wireless/ath/ath5k/ath5k.h |   16 ++++++++++++++
 drivers/net/wireless/ath/ath5k/base.c  |   36 +++++++++++++++++++++++--------
 drivers/net/wireless/ath/ath5k/base.h  |    3 +-
 drivers/net/wireless/ath/ath5k/phy.c   |   20 +++++++++++++++++
 4 files changed, 64 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 1047a6c..76cf5b2 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -919,6 +919,12 @@ 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,
+};
+
 /*
  * Power management
  */
@@ -1123,6 +1129,15 @@ struct ath5k_hw {
 	/* noise floor from last periodic calibration */
 	s32			ah_noise_floor;
 
+	/* Calibration timestamp */
+	u32			ah_cal_tstamp;
+
+	/* Calibration interval (secs) */
+	u8			ah_cal_intval;
+
+	/* Software interrupt mask */
+	u8			ah_swi_mask;
+
 	/*
 	 * Function pointers
 	 */
@@ -1276,6 +1291,7 @@ extern int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *chann
 /* PHY calibration */
 extern int ath5k_hw_phy_calibrate(struct ath5k_hw *ah, struct ieee80211_channel *channel);
 extern int ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq);
+extern 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);
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index b64731b..d84ccad 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -59,7 +59,7 @@
 #include "reg.h"
 #include "debug.h"
 
-static int ath5k_calinterval = 10; /* Calibrate PHY every 10 secs (TODO: Fixme) */
+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.");
@@ -376,7 +376,7 @@ static int 	ath5k_stop_hw(struct ath5k_softc *sc);
 static irqreturn_t ath5k_intr(int irq, void *dev_id);
 static void 	ath5k_tasklet_reset(unsigned long data);
 
-static void 	ath5k_calibrate(unsigned long data);
+static void 	ath5k_tasklet_calibrate(unsigned long data);
 
 /*
  * Module init/exit functions
@@ -799,8 +799,8 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
 	tasklet_init(&sc->rxtq, ath5k_tasklet_rx, (unsigned long)sc);
 	tasklet_init(&sc->txtq, ath5k_tasklet_tx, (unsigned long)sc);
 	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);
-	setup_timer(&sc->calib_tim, ath5k_calibrate, (unsigned long)sc);
 
 	ret = ath5k_eeprom_read_mac(ah, mac);
 	if (ret) {
@@ -2366,7 +2366,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_FATAL | AR5K_INT_GLOBAL | AR5K_INT_SWI;
 	ret = ath5k_reset(sc, NULL);
 	if (ret)
 		goto done;
@@ -2383,8 +2383,8 @@ ath5k_init(struct ath5k_softc *sc)
 	/* Set ack to be sent at low bit-rates */
 	ath5k_hw_set_ack_bitrate_high(ah, false);
 
-	mod_timer(&sc->calib_tim, round_jiffies(jiffies +
-			msecs_to_jiffies(ath5k_calinterval * 1000)));
+	/* Set PHY calibration inteval */
+	ah->ah_cal_intval = ath5k_calinterval;
 
 	ret = 0;
 done:
@@ -2477,10 +2477,10 @@ ath5k_stop_hw(struct ath5k_softc *sc)
 	mmiowb();
 	mutex_unlock(&sc->lock);
 
-	del_timer_sync(&sc->calib_tim);
 	tasklet_kill(&sc->rxtq);
 	tasklet_kill(&sc->txtq);
 	tasklet_kill(&sc->restq);
+	tasklet_kill(&sc->calib);
 	tasklet_kill(&sc->beacontq);
 
 	ath5k_rfkill_hw_stop(sc->ah);
@@ -2536,6 +2536,9 @@ 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
@@ -2552,6 +2555,8 @@ 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);
+
 	return IRQ_HANDLED;
 }
 
@@ -2568,11 +2573,19 @@ ath5k_tasklet_reset(unsigned long data)
  * for temperature/environment changes.
  */
 static void
-ath5k_calibrate(unsigned long data)
+ath5k_tasklet_calibrate(unsigned long data)
 {
 	struct ath5k_softc *sc = (void *)data;
 	struct ath5k_hw *ah = sc->ah;
 
+	/* Only full calibration for now */
+	if (ah->ah_swi_mask != AR5K_SWI_FULL_CALIBRATION)
+		return;
+
+	/* Stop queues so that calibration
+	 * doesn't interfere with tx */
+	ieee80211_stop_queues(sc->hw);
+
 	ATH5K_DBG(sc, ATH5K_DEBUG_CALIBRATE, "channel %u/%x\n",
 		ieee80211_frequency_to_channel(sc->curchan->center_freq),
 		sc->curchan->hw_value);
@@ -2590,8 +2603,11 @@ ath5k_calibrate(unsigned long data)
 			ieee80211_frequency_to_channel(
 				sc->curchan->center_freq));
 
-	mod_timer(&sc->calib_tim, round_jiffies(jiffies +
-			msecs_to_jiffies(ath5k_calinterval * 1000)));
+	ah->ah_swi_mask = 0;
+
+	/* Wake queues */
+	ieee80211_wake_queues(sc->hw);
+
 }
 
 
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
index 778e422..667bd9d 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -177,6 +177,8 @@ struct ath5k_softc {
 
 	struct ath5k_rfkill	rf_kill;
 
+	struct tasklet_struct	calib;		/* calibration tasklet */
+
 	spinlock_t		block;		/* protects beacon */
 	struct tasklet_struct	beacontq;	/* beacon intr tasklet */
 	struct ath5k_buf	*bbuf;		/* beacon buffer */
@@ -187,7 +189,6 @@ struct ath5k_softc {
 	unsigned int		nexttbtt;	/* next beacon time in TU */
 	struct ath5k_txq	*cabq;		/* content after beacon */
 
-	struct timer_list	calib_tim;	/* calibration timer */
 	int 			power_level;	/* Requested tx power in dbm */
 	bool			assoc;		/* assocate state */
 	bool			enable_beacon;	/* true if beacons are on */
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 6afba98..d30bc3b 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1104,6 +1104,26 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
   PHY calibration
 \*****************/
 
+void
+ath5k_hw_calibration_poll(struct ath5k_hw *ah)
+{
+	u32 current_time = (jiffies / HZ);
+	u32 cal_intval = ah->ah_cal_intval;
+
+	if (!ah->ah_cal_tstamp)
+		ah->ah_cal_tstamp = current_time;
+
+	/* For now we always do full calibration
+	 * Mark software interrupt mask and fire software
+	 * interrupt (bit gets auto-cleared) */
+	if ((current_time - ah->ah_cal_tstamp) >= cal_intval) {
+		ah->ah_cal_tstamp = current_time;
+		ah->ah_swi_mask = AR5K_SWI_FULL_CALIBRATION;
+		AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI);
+	}
+
+}
+
 /**
  * ath5k_hw_noise_floor_calibration - perform PHY noise floor calibration
  *


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-08-01  5:46 ` Nick Kossifidis
@ 2009-08-01  8:19   ` Jiri Slaby
  2009-08-01  8:21     ` Johannes Berg
  0 siblings, 1 reply; 23+ messages in thread
From: Jiri Slaby @ 2009-08-01  8:19 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless, linville, me, mcgrof, nbd, proski

On 08/01/2009 07:46 AM, Nick Kossifidis wrote:
> --- a/drivers/net/wireless/ath/ath5k/phy.c
> +++ b/drivers/net/wireless/ath/ath5k/phy.c
> @@ -1104,6 +1104,26 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
>    PHY calibration
>  \*****************/
>  
> +void
> +ath5k_hw_calibration_poll(struct ath5k_hw *ah)
> +{
> +	u32 current_time = (jiffies / HZ);

jiffies are long. And they start from negative to catch such issues. You
were lucky and/or tested after 5 minutes of uptime ;).

> +	u32 cal_intval = ah->ah_cal_intval;
> +
> +	if (!ah->ah_cal_tstamp)
> +		ah->ah_cal_tstamp = current_time;
> +
> +	/* For now we always do full calibration
> +	 * Mark software interrupt mask and fire software
> +	 * interrupt (bit gets auto-cleared) */
> +	if ((current_time - ah->ah_cal_tstamp) >= cal_intval) {

Aiee, this should be converted to time_after(). You don't count with a
wrap here. (The same as above.)

> +		ah->ah_cal_tstamp = current_time;
> +		ah->ah_swi_mask = AR5K_SWI_FULL_CALIBRATION;
> +		AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI);
> +	}
> +
> +}


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-08-01  8:19   ` Jiri Slaby
@ 2009-08-01  8:21     ` Johannes Berg
  2009-08-01  8:24       ` Jiri Slaby
  0 siblings, 1 reply; 23+ messages in thread
From: Johannes Berg @ 2009-08-01  8:21 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: ath5k-devel, linux-wireless, linville, me, mcgrof, nbd, proski

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

On Sat, 2009-08-01 at 10:19 +0200, Jiri Slaby wrote:

> > +	u32 current_time = (jiffies / HZ);
> 
> jiffies are long. And they start from negative to catch such issues. You
> were lucky and/or tested after 5 minutes of uptime ;).

Actually, jiffies are unsigned long, but wrap after 5 minutes of
uptime :)

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-08-01  8:21     ` Johannes Berg
@ 2009-08-01  8:24       ` Jiri Slaby
  2009-08-01  8:28         ` Johannes Berg
  0 siblings, 1 reply; 23+ messages in thread
From: Jiri Slaby @ 2009-08-01  8:24 UTC (permalink / raw)
  To: Johannes Berg
  Cc: ath5k-devel, linux-wireless, linville, me, mcgrof, nbd, proski

On 08/01/2009 10:21 AM, Johannes Berg wrote:
> Actually, jiffies are unsigned long

Yeah, this is what I meant. I agree I messed it up when I didn't write
the unsigned explicitly. It might have been confusing, thanks for
pointing out.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-08-01  8:24       ` Jiri Slaby
@ 2009-08-01  8:28         ` Johannes Berg
  2009-08-01  8:31           ` [ath5k-devel] " Nick Kossifidis
  2009-08-03 17:54           ` Nick Kossifidis
  0 siblings, 2 replies; 23+ messages in thread
From: Johannes Berg @ 2009-08-01  8:28 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: ath5k-devel, linux-wireless, linville, me, mcgrof, nbd, proski

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

On Sat, 2009-08-01 at 10:24 +0200, Jiri Slaby wrote:
> On 08/01/2009 10:21 AM, Johannes Berg wrote:
> > Actually, jiffies are unsigned long
> 
> Yeah, this is what I meant. I agree I messed it up when I didn't write
> the unsigned explicitly. It might have been confusing, thanks for
> pointing out.

And, in addition to what you said, the code shouldn't divide jiffies, it
should multiply the timeout, add it to the start time, and then use
time_is_after_jiffies() or so.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-08-01  8:28         ` Johannes Berg
@ 2009-08-01  8:31           ` Nick Kossifidis
  2009-08-01  8:35             ` Jiri Slaby
  2009-08-03 17:54           ` Nick Kossifidis
  1 sibling, 1 reply; 23+ messages in thread
From: Nick Kossifidis @ 2009-08-01  8:31 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Jiri Slaby, linux-wireless, ath5k-devel, linville

2009/8/1 Johannes Berg <johannes@sipsolutions.net>:
> On Sat, 2009-08-01 at 10:24 +0200, Jiri Slaby wrote:
>> On 08/01/2009 10:21 AM, Johannes Berg wrote:
>> > Actually, jiffies are unsigned long
>>
>> Yeah, this is what I meant. I agree I messed it up when I didn't write
>> the unsigned explicitly. It might have been confusing, thanks for
>> pointing out.
>
> And, in addition to what you said, the code shouldn't divide jiffies, it
> should multiply the timeout, add it to the start time, and then use
> time_is_after_jiffies() or so.
>
> johannes
>

Where can i find documentation on this ?



-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-08-01  8:31           ` [ath5k-devel] " Nick Kossifidis
@ 2009-08-01  8:35             ` Jiri Slaby
  0 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2009-08-01  8:35 UTC (permalink / raw)
  To: Nick Kossifidis; +Cc: Johannes Berg, linux-wireless, ath5k-devel, linville

On 08/01/2009 10:31 AM, Nick Kossifidis wrote:
> 2009/8/1 Johannes Berg <johannes@sipsolutions.net>:
>> time_is_after_jiffies() or so.
...
> Where can i find documentation on this ?

I wouldn't say there is anything else than include/linux/jiffies.h.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-07-31 19:52       ` Nick Kossifidis
@ 2009-08-01 13:22         ` Bob Copeland
  2009-08-01 13:31           ` Nick Kossifidis
  0 siblings, 1 reply; 23+ messages in thread
From: Bob Copeland @ 2009-08-01 13:22 UTC (permalink / raw)
  To: Nick Kossifidis
  Cc: Luis R. Rodriguez, ath5k-devel, linux-wireless, linville, jirislaby, nbd

On Fri, Jul 31, 2009 at 10:52:42PM +0300, Nick Kossifidis wrote:
> > make the above true it needs to stop the queues etc when doing
> > calibration.
> 
> ACK, how do we do that ?
> ieee80211_stop_queues / ieee80211_wake_queues

Yup.  And disabling (at least rx and swba) interrupts on the device
is also probably a good idea.

-- 
Bob Copeland %% www.bobcopeland.com


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-08-01 13:22         ` Bob Copeland
@ 2009-08-01 13:31           ` Nick Kossifidis
  2009-08-02 16:14             ` Bob Copeland
  0 siblings, 1 reply; 23+ messages in thread
From: Nick Kossifidis @ 2009-08-01 13:31 UTC (permalink / raw)
  To: Bob Copeland
  Cc: Luis R. Rodriguez, ath5k-devel, linux-wireless, linville, jirislaby, nbd

2009/8/1 Bob Copeland <me@bobcopeland.com>:
> On Fri, Jul 31, 2009 at 10:52:42PM +0300, Nick Kossifidis wrote:
>> > make the above true it needs to stop the queues etc when doing
>> > calibration.
>>
>> ACK, how do we do that ?
>> ieee80211_stop_queues / ieee80211_wake_queues
>
> Yup.  And disabling (at least rx and swba) interrupts on the device
> is also probably a good idea.
>

I thought about calling ath5k_hw_stop_rx_pcu but i don't think it's
necessary i mean it won't receive anyway, why mess with pcu ?



-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-08-01 13:31           ` Nick Kossifidis
@ 2009-08-02 16:14             ` Bob Copeland
  0 siblings, 0 replies; 23+ messages in thread
From: Bob Copeland @ 2009-08-02 16:14 UTC (permalink / raw)
  To: Nick Kossifidis
  Cc: Luis R. Rodriguez, ath5k-devel, linux-wireless, linville, jirislaby, nbd

On Sat, Aug 01, 2009 at 04:31:27PM +0300, Nick Kossifidis wrote:
> I thought about calling ath5k_hw_stop_rx_pcu but i don't think it's
> necessary i mean it won't receive anyway, why mess with pcu ?

Yeah, agreed, we can just ignore rx.

-- 
Bob Copeland %% www.bobcopeland.com


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-08-01  8:28         ` Johannes Berg
  2009-08-01  8:31           ` [ath5k-devel] " Nick Kossifidis
@ 2009-08-03 17:54           ` Nick Kossifidis
  2009-08-07 14:55             ` John W. Linville
  1 sibling, 1 reply; 23+ messages in thread
From: Nick Kossifidis @ 2009-08-03 17:54 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Jiri Slaby, linux-wireless, ath5k-devel, linville

2009/8/1 Johannes Berg <johannes@sipsolutions.net>:
> On Sat, 2009-08-01 at 10:24 +0200, Jiri Slaby wrote:
>> On 08/01/2009 10:21 AM, Johannes Berg wrote:
>> > Actually, jiffies are unsigned long
>>
>> Yeah, this is what I meant. I agree I messed it up when I didn't write
>> the unsigned explicitly. It might have been confusing, thanks for
>> pointing out.
>
> And, in addition to what you said, the code shouldn't divide jiffies, it
> should multiply the timeout, add it to the start time, and then use
> time_is_after_jiffies() or so.
>
> johannes

ACK will resend asap ;-)



-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-08-03 17:54           ` Nick Kossifidis
@ 2009-08-07 14:55             ` John W. Linville
  2009-08-07 19:50               ` Nick Kossifidis
  0 siblings, 1 reply; 23+ messages in thread
From: John W. Linville @ 2009-08-07 14:55 UTC (permalink / raw)
  To: Nick Kossifidis; +Cc: Johannes Berg, Jiri Slaby, linux-wireless, ath5k-devel

On Mon, Aug 03, 2009 at 08:54:47PM +0300, Nick Kossifidis wrote:
> 2009/8/1 Johannes Berg <johannes@sipsolutions.net>:
> > On Sat, 2009-08-01 at 10:24 +0200, Jiri Slaby wrote:
> >> On 08/01/2009 10:21 AM, Johannes Berg wrote:
> >> > Actually, jiffies are unsigned long
> >>
> >> Yeah, this is what I meant. I agree I messed it up when I didn't write
> >> the unsigned explicitly. It might have been confusing, thanks for
> >> pointing out.
> >
> > And, in addition to what you said, the code shouldn't divide jiffies, it
> > should multiply the timeout, add it to the start time, and then use
> > time_is_after_jiffies() or so.
> >
> > johannes
> 
> ACK will resend asap ;-)

Last I saw in this thread...

Can we have a clean repost of the whole series (including proper
Signed-off-by and any Acked-by, Tested-by, etc)?  Also, in the future
I think it would be good for you to take some of the comments from
Luis to heart -- explain the 'why' not the 'what' in the changelogs,
do one thing per patch, etc.

I'm going to drop the original 1-4 now and wait for a clean repost.

Thanks,

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [ath5k-devel] [PATCH 4/4] ath5k: Use SWI to trigger calibration
  2009-08-07 14:55             ` John W. Linville
@ 2009-08-07 19:50               ` Nick Kossifidis
  0 siblings, 0 replies; 23+ messages in thread
From: Nick Kossifidis @ 2009-08-07 19:50 UTC (permalink / raw)
  To: John W. Linville; +Cc: Johannes Berg, Jiri Slaby, linux-wireless, ath5k-devel

2009/8/7 John W. Linville <linville@tuxdriver.com>:
>
> Last I saw in this thread...
>

Yup, sorry for the delay ;-(

> Can we have a clean repost of the whole series (including proper
> Signed-off-by and any Acked-by, Tested-by, etc)?

sure

> Also, in the future
> I think it would be good for you to take some of the comments from
> Luis to heart -- explain the 'why' not the 'what' in the changelogs,
> do one thing per patch, etc.

I'll try and make them more complete from now on ;-)

> I'm going to drop the original 1-4 now and wait for a clean repost.
>

ack ;-)

-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2009-08-07 19:50 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-31 18:10 [PATCH 4/4] ath5k: Use SWI to trigger calibration Nick Kossifidis
2009-07-31 18:15 ` Luis R. Rodriguez
2009-07-31 18:25   ` [ath5k-devel] " Nick Kossifidis
2009-07-31 18:48     ` Luis R. Rodriguez
2009-07-31 19:09     ` Pavel Roskin
2009-07-31 19:35       ` Nick Kossifidis
2009-07-31 19:43         ` Pavel Roskin
2009-07-31 19:11     ` Bob Copeland
2009-07-31 19:52       ` Nick Kossifidis
2009-08-01 13:22         ` Bob Copeland
2009-08-01 13:31           ` Nick Kossifidis
2009-08-02 16:14             ` Bob Copeland
2009-07-31 18:34 ` Nick Kossifidis
2009-08-01  5:46 ` Nick Kossifidis
2009-08-01  8:19   ` Jiri Slaby
2009-08-01  8:21     ` Johannes Berg
2009-08-01  8:24       ` Jiri Slaby
2009-08-01  8:28         ` Johannes Berg
2009-08-01  8:31           ` [ath5k-devel] " Nick Kossifidis
2009-08-01  8:35             ` Jiri Slaby
2009-08-03 17:54           ` Nick Kossifidis
2009-08-07 14:55             ` John W. Linville
2009-08-07 19:50               ` Nick Kossifidis

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).