Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 4/5] ath5k: no need to save/restore the default antenna
From: Bruno Randolf @ 2010-06-07  4:11 UTC (permalink / raw)
  To: linville; +Cc: ath5k-devel, linux-wireless
In-Reply-To: <20100607041012.18667.6859.stgit@tt-desk>

Since ath5k_hw_set_antenna_mode() always writes the default antenna register
and is called at the end of reset, there is no need to separately save and
restore the default antenna.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/reset.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index d561f7c..498aa28 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -877,12 +877,11 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
 	struct ieee80211_channel *channel, bool change_channel)
 {
 	struct ath_common *common = ath5k_hw_common(ah);
-	u32 s_seq[10], s_ant, s_led[3], staid1_flags, tsf_up, tsf_lo;
+	u32 s_seq[10], s_led[3], staid1_flags, tsf_up, tsf_lo;
 	u32 phy_tst1;
 	u8 mode, freq, ee_mode;
 	int i, ret;
 
-	s_ant = 0;
 	ee_mode = 0;
 	staid1_flags = 0;
 	tsf_up = 0;
@@ -979,9 +978,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
 			}
 		}
 
-		/* Save default antenna */
-		s_ant = ath5k_hw_reg_read(ah, AR5K_DEFAULT_ANTENNA);
-
 		if (ah->ah_version == AR5K_AR5212) {
 			/* Restore normal 32/40MHz clock operation
 			 * to avoid register access delay on certain
@@ -1141,8 +1137,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
 				ath5k_hw_reg_write(ah, tsf_lo, AR5K_TSF_L32);
 			}
 		}
-
-		ath5k_hw_reg_write(ah, s_ant, AR5K_DEFAULT_ANTENNA);
 	}
 
 	/* Ledstate */


^ permalink raw reply related

* [PATCH 3/5] ath5k: new function for setting the antenna switch table
From: Bruno Randolf @ 2010-06-07  4:11 UTC (permalink / raw)
  To: linville; +Cc: ath5k-devel, linux-wireless
In-Reply-To: <20100607041012.18667.6859.stgit@tt-desk>

Collect all pieces concering the antenna switch table into one function.
Previously it was split up between ath5k_hw_reset() and
ath5k_hw_commit_eeprom_settings().

Also we need to set the antenna switch table when ath5k_hw_set_antenna_mode()
is called manually (by "iw phy0 antenna set", for example).

I'm not sure if we need to set the switchtable at the same place in
ath5k_hw_reset() as it was before - it is set later thru
ath5k_hw_set_antenna_mode() anyways - but i leave it there to avoid
problems(?).

Plus print switchtable registers in the debugfs file.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/ath5k.h |    1 +
 drivers/net/wireless/ath/ath5k/debug.c |    7 +++++++
 drivers/net/wireless/ath/ath5k/phy.c   |   32 +++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath5k/reset.c |   33 ++++++--------------------------
 4 files changed, 46 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index eace74d..cf16318 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1286,6 +1286,7 @@ u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan);
 int ath5k_hw_phy_disable(struct ath5k_hw *ah);
 /* Antenna control */
 void ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode);
+void ath5k_hw_set_antenna_switch(struct ath5k_hw *ah, u8 ee_mode);
 /* TX power setup */
 int ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
 		     u8 ee_mode, u8 txpower);
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index c58503c..41817a2 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -425,6 +425,13 @@ static ssize_t read_file_antenna(struct file *file, char __user *user_buf,
 		"AR5K_PHY_FAST_ANT_DIV_EN\t%d\n",
 		(v & AR5K_PHY_FAST_ANT_DIV_EN) != 0);
 
+	v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_ANT_SWITCH_TABLE_0);
+	len += snprintf(buf+len, sizeof(buf)-len,
+			"\nAR5K_PHY_ANT_SWITCH_TABLE_0\t0x%08x\n", v);
+	v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_ANT_SWITCH_TABLE_1);
+	len += snprintf(buf+len, sizeof(buf)-len,
+			"AR5K_PHY_ANT_SWITCH_TABLE_1\t0x%08x\n", v);
+
 	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
 
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 0f3b9be..73c4fcd 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1781,6 +1781,37 @@ ath5k_hw_set_fast_div(struct ath5k_hw *ah, u8 ee_mode, bool enable)
 	}
 }
 
+void
+ath5k_hw_set_antenna_switch(struct ath5k_hw *ah, u8 ee_mode)
+{
+	u8 ant0, ant1;
+
+	/*
+	 * In case a fixed antenna was set as default
+	 * use the same switch table twice.
+	 */
+	if (ah->ah_ant_mode == AR5K_ANTMODE_FIXED_A)
+		ant0 = ant1 = AR5K_ANT_SWTABLE_A;
+	else if (ah->ah_ant_mode == AR5K_ANTMODE_FIXED_B)
+		ant0 = ant1 = AR5K_ANT_SWTABLE_B;
+	else {
+		ant0 = AR5K_ANT_SWTABLE_A;
+		ant1 = AR5K_ANT_SWTABLE_B;
+	}
+
+	/* Set antenna idle switch table */
+	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_ANT_CTL,
+			AR5K_PHY_ANT_CTL_SWTABLE_IDLE,
+			(ah->ah_ant_ctl[ee_mode][AR5K_ANT_CTL] |
+			AR5K_PHY_ANT_CTL_TXRX_EN));
+
+	/* Set antenna switch tables */
+	ath5k_hw_reg_write(ah, ah->ah_ant_ctl[ee_mode][ant0],
+		AR5K_PHY_ANT_SWITCH_TABLE_0);
+	ath5k_hw_reg_write(ah, ah->ah_ant_ctl[ee_mode][ant1],
+		AR5K_PHY_ANT_SWITCH_TABLE_1);
+}
+
 /*
  * Set antenna operating mode
  */
@@ -1900,6 +1931,7 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
 	if (sta_id1)
 		AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1, sta_id1);
 
+	ath5k_hw_set_antenna_switch(ah, ee_mode);
 	/* Note: set diversity before default antenna
 	 * because it won't work correctly */
 	ath5k_hw_set_fast_div(ah, ee_mode, fast_div);
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index c17c84e..d561f7c 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -729,7 +729,7 @@ static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah,
 }
 
 static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
-		struct ieee80211_channel *channel, u8 *ant, u8 ee_mode)
+		struct ieee80211_channel *channel, u8 ee_mode)
 {
 	struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
 	s16 cck_ofdm_pwr_delta;
@@ -763,17 +763,9 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
 						ee->ee_cck_ofdm_gain_delta;
 	}
 
-	/* Set antenna idle switch table */
-	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_ANT_CTL,
-			AR5K_PHY_ANT_CTL_SWTABLE_IDLE,
-			(ah->ah_ant_ctl[ee_mode][0] |
-			AR5K_PHY_ANT_CTL_TXRX_EN));
-
-	/* Set antenna switch tables */
-	ath5k_hw_reg_write(ah, ah->ah_ant_ctl[ee_mode][ant[0]],
-		AR5K_PHY_ANT_SWITCH_TABLE_0);
-	ath5k_hw_reg_write(ah, ah->ah_ant_ctl[ee_mode][ant[1]],
-		AR5K_PHY_ANT_SWITCH_TABLE_1);
+	/* XXX: necessary here? is called from ath5k_hw_set_antenna_mode()
+	 * too */
+	ath5k_hw_set_antenna_switch(ah, ee_mode);
 
 	/* Noise floor threshold */
 	ath5k_hw_reg_write(ah,
@@ -887,7 +879,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
 	struct ath_common *common = ath5k_hw_common(ah);
 	u32 s_seq[10], s_ant, s_led[3], staid1_flags, tsf_up, tsf_lo;
 	u32 phy_tst1;
-	u8 mode, freq, ee_mode, ant[2];
+	u8 mode, freq, ee_mode;
 	int i, ret;
 
 	s_ant = 0;
@@ -1110,21 +1102,8 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
 				    AR5K_TXCFG_B_MODE);
 		}
 
-		/*
-		 * In case a fixed antenna was set as default
-		 * use the same switch table twice.
-		 */
-		if (ah->ah_ant_mode == AR5K_ANTMODE_FIXED_A)
-				ant[0] = ant[1] = AR5K_ANT_SWTABLE_A;
-		else if (ah->ah_ant_mode == AR5K_ANTMODE_FIXED_B)
-				ant[0] = ant[1] = AR5K_ANT_SWTABLE_B;
-		else {
-			ant[0] = AR5K_ANT_SWTABLE_A;
-			ant[1] = AR5K_ANT_SWTABLE_B;
-		}
-
 		/* Commit values from EEPROM */
-		ath5k_hw_commit_eeprom_settings(ah, channel, ant, ee_mode);
+		ath5k_hw_commit_eeprom_settings(ah, channel, ee_mode);
 
 	} else {
 		/*


^ permalink raw reply related

* [PATCH 2/5] ath5k: update AR5K_PHY_RESTART_DIV_GC values to match masks
From: Bruno Randolf @ 2010-06-07  4:11 UTC (permalink / raw)
  To: linville; +Cc: ath5k-devel, linux-wireless
In-Reply-To: <20100607041012.18667.6859.stgit@tt-desk>

#define AR5K_PHY_RESTART_DIV_GC               0x001c0000
is 3 bit wide.

The previous values of 0xc and 0x8 are 4bit wide and bigger than the mask.

Writing 0 and 1 to AR5K_PHY_RESTART_DIV_GC is consistent with the comments and
initvals we have in the HAL.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/phy.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 34ba576..0f3b9be 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1768,13 +1768,13 @@ ath5k_hw_set_fast_div(struct ath5k_hw *ah, u8 ee_mode, bool enable)
 
 	if (enable) {
 		AR5K_REG_WRITE_BITS(ah, AR5K_PHY_RESTART,
-				AR5K_PHY_RESTART_DIV_GC, 0xc);
+				AR5K_PHY_RESTART_DIV_GC, 1);
 
 		AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_FAST_ANT_DIV,
 					AR5K_PHY_FAST_ANT_DIV_EN);
 	} else {
 		AR5K_REG_WRITE_BITS(ah, AR5K_PHY_RESTART,
-				AR5K_PHY_RESTART_DIV_GC, 0x8);
+				AR5K_PHY_RESTART_DIV_GC, 0);
 
 		AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_FAST_ANT_DIV,
 					AR5K_PHY_FAST_ANT_DIV_EN);


^ permalink raw reply related

* [PATCH 1/5] ath5k: fix NULL pointer in antenna configuration
From: Bruno Randolf @ 2010-06-07  4:11 UTC (permalink / raw)
  To: linville; +Cc: ath5k-devel, linux-wireless
In-Reply-To: <20100607041012.18667.6859.stgit@tt-desk>

If the channel is not set yet and we configure the antennas just store the
setting. It will be activated during the next reset, when the channel is set.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/phy.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 2b3f7a7..34ba576 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1793,6 +1793,13 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
 	u8 def_ant, tx_ant, ee_mode;
 	u32 sta_id1 = 0;
 
+	/* if channel is not initialized yet we can't set the antennas
+	 * so just store the mode. it will be set on the next reset */
+	if (channel == NULL) {
+		ah->ah_ant_mode = ant_mode;
+		return;
+	}
+
 	def_ant = ah->ah_def_ant;
 
 	switch (channel->hw_value & CHANNEL_MODES) {


^ permalink raw reply related

* [PATCH 0/5] Series short description
From: Bruno Randolf @ 2010-06-07  4:11 UTC (permalink / raw)
  To: linville; +Cc: ath5k-devel, linux-wireless

here i resend the missing ath5k patches rebased against current
wireless-testing.

bruno

---

Bruno Randolf (5):
      ath5k: fix NULL pointer in antenna configuration
      ath5k: update AR5K_PHY_RESTART_DIV_GC values to match masks
      ath5k: new function for setting the antenna switch table
      ath5k: no need to save/restore the default antenna
      ath5k: add debugfs file for queue debugging


 drivers/net/wireless/ath/ath5k/ath5k.h |    1 
 drivers/net/wireless/ath/ath5k/debug.c |   73 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath5k/debug.h |    1 
 drivers/net/wireless/ath/ath5k/phy.c   |   43 ++++++++++++++++++-
 drivers/net/wireless/ath/ath5k/reset.c |   41 +++---------------
 5 files changed, 123 insertions(+), 36 deletions(-)

-- 
Signature

^ permalink raw reply

* Re: [ath5k-devel] [PATCH v2 13/20] cfg80211: Add nl80211 antenna configuration
From: Bruno Randolf @ 2010-06-07  3:45 UTC (permalink / raw)
  To: Luis R. Rodriguez, John W. Linville
  Cc: ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org
In-Reply-To: <20100604212145.GB4069@tux>

On Saturday 05 June 2010 06:21:45 you wrote:
> I don't think the API is defined clean enough yet and can yield
> inconsistant interpretations. I'd like to see this clarified on
> the documentation for both legacy and 802.11n. If the plan is
> to support only legacy right now then I think the API can be
> simpler and clearer with only three options passed, Fixed_A
> Fixed_B and diversity.

luis, i thought we had this resolved during the last thread... i gave you  
examples why fixed_a, fixed_b and diversity is not enough. 

anyhow, there are a few places where i have to make the definition clearer in 
order to avoid inconsistent interpretations, that's right. i will resend this 
so we can continue any discussions based on that. 

john, i will resend the rest of the series, the ath5k part and the antenna 
configuration as separate series. sorry for mixing that up before...

bruno

^ permalink raw reply

* Re: compat-wireless 2.6.35_rc2 build errors
From: Richard Farina @ 2010-06-06 18:41 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless, Ivo van Doorn, gwingerde
In-Reply-To: <4C0BDF2F.2020001@gmail.com>

Richard Farina wrote:
> I realize we are still pretty early in the rc process but there are 
> some seemingly significant problems building compat-wireless 
> 2.6.35_rc2 (which should be very close if not identical to the linus 
> tree). I have copied the rt2x00 team because of the first error and 
> Luiz for the second.
>
> First and foremost this won't build at all:
>
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/rt2x00/rt2800pci.c: 
> In function 'rt2800pci_read_eeprom_soc':
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/rt2x00/rt2800pci.c:91: 
> error: implicit declaration of function 'KSEG1ADDR'
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/rt2x00/rt2800pci.c:91: 
> warning: cast to pointer from integer of different size
> make[4]: *** 
> [/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/rt2x00/rt2800pci.o] 
> Error 1
>
>
After talking to Hauke2 on irc it seems that this outcome is very 
expected when you try to build a mips driver for x86_64.  I shouldn't be 
trying to build this at all.  Compat-wireless has a bunch of ifneq 
statements which seem to be how this type of stupidity is prevented, 
however, I can't exactly grok how to make this work.  I know this driver 
should dep RALINK_RT288X || RALINK_RT305X but I can't figure out how to 
modify the section of config.mk to do that properly:

ifneq ($(CONFIG_CRC_CCITT),)
CONFIG_RT2800PCI=m
CONFIG_RT2800PCI_PCI=y
CONFIG_RT2800PCI_RT30XX=y
CONFIG_RT2800PCI_RT35XX=y
# CONFIG_RT2800PCI_SOC=y
endif
NEED_RT2X00=y

Currently it is just commented out which allows me to build but really 
it should be uncommented and have a proper check to see if it should be 
built or not. Luiz can you do this? Or someone hint me on how in the 
world I would do it? I'd spend more time trying to figure this out but 
the grass isn't going to cut itself.

Thanks,
Rick Farina

> Additionally but likely less important this driver seems to be 
> defining variables overriding kernel headers, I can't imagine that is 
> good.  Not sure if this is something that the driver needs to fix or 
> needs to be fixed in compat-wireless but here it is:
>
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/libertas_tf/main.c:10:1: 
> warning: "pr_fmt" redefined
> In file included from include/linux/skbuff.h:17,
>                 from include/linux/if_ether.h:124,
>                 from include/linux/netdevice.h:29,
>                 from 
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.29.h:5, 
>
>                 from 
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.h:24, 
>
>                 from <command-line>:0:
> include/linux/kernel.h:376:1: warning: this is the location of the 
> previous definition
>  CC [M]  
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/orinoco/main.o 
>
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/libertas_tf/main.c:10:1: 
> warning: "pr_fmt" redefined
> In file included from include/linux/skbuff.h:17,
>                 from include/linux/if_ether.h:124,
>                 from include/linux/netdevice.h:29,
>                 from 
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.29.h:5, 
>
>                 from 
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.h:24, 
>
>                 from <command-line>:0:
> include/linux/kernel.h:376:1: warning: this is the location of the 
> previous definition
>  CC [M]  
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/libertas_tf/cmd.o 
>
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/libertas_tf/cmd.c:10:1: 
> warning: "pr_fmt" redefined
> In file included from include/linux/skbuff.h:17,
>                 from include/linux/if_ether.h:124,
>                 from include/linux/netdevice.h:29,
>                 from 
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.29.h:5, 
>
>                 from 
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.h:24, 
>
>                 from <command-line>:0:
> include/linux/kernel.h:376:1: warning: this is the location of the 
> previous definition
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/libertas_tf/cmd.c:10:1: 
> warning: "pr_fmt" redefined
> In file included from include/linux/skbuff.h:17,
>                 from include/linux/if_ether.h:124,
>                 from include/linux/netdevice.h:29,
>                 from 
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.29.h:5, 
>
>                 from 
> /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.h:24, 
>
>                 from <command-line>:0:
>
> I'll try to build the rc2 kernel and see if these errors are the same.
>
> Thanks,
> Rick Farina
>


^ permalink raw reply

* compat-wireless: Enabled rt2800pci support for new rt30xx and rt35xx chips
From: Richard Farina @ 2010-06-06 18:05 UTC (permalink / raw)
  To: linux-wireless, Luis R. Rodriguez

commit d9d9c3caaa370cca3594f7ebe530cdca9e35abc5
Author: Rick Farina <sidhayn@gmail.com>
Date:   Sun Jun 6 14:00:18 2010 -0400

    compat-wireless: Enabled rt2800pci support for new rt30xx and rt35xx 
chips
    
    The rt2800pci driver now supports the rt30xx and rt35xx series of 
chips from ralink, this change
    cause that support to be built into the driver.  This change has 
been compile tested but I do not
    own any of these devices.
    
    Note: I am purposely leaving the SoC support disabled as it doesn't 
build right now. Hopefully
    this will be fixed in a later rc and I'll submit the change then.
    
    Signed-off-by: Rick Farina

diff --git a/config.mk b/config.mk
index 0001a7d..169a99c 100644
--- a/config.mk
+++ b/config.mk
@@ -270,8 +270,8 @@ CONFIG_RT2500PCI=m
 ifneq ($(CONFIG_CRC_CCITT),)
 CONFIG_RT2800PCI=m
 CONFIG_RT2800PCI_PCI=y
-# CONFIG_RT2800PCI_RT30XX=y
-# CONFIG_RT2800PCI_RT35XX=y
+CONFIG_RT2800PCI_RT30XX=y
+CONFIG_RT2800PCI_RT35XX=y
 # CONFIG_RT2800PCI_SOC=y
 endif
 NEED_RT2X00=y


^ permalink raw reply related

* compat-wireless 2.6.35_rc2 build errors
From: Richard Farina @ 2010-06-06 17:47 UTC (permalink / raw)
  To: linux-wireless, Ivo van Doorn, gwingerde, Luis R. Rodriguez

I realize we are still pretty early in the rc process but there are some 
seemingly significant problems building compat-wireless 2.6.35_rc2 
(which should be very close if not identical to the linus tree). I have 
copied the rt2x00 team because of the first error and Luiz for the second.

First and foremost this won't build at all:

/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/rt2x00/rt2800pci.c: 
In function 'rt2800pci_read_eeprom_soc':
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/rt2x00/rt2800pci.c:91: 
error: implicit declaration of function 'KSEG1ADDR'
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/rt2x00/rt2800pci.c:91: 
warning: cast to pointer from integer of different size
make[4]: *** 
[/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/rt2x00/rt2800pci.o] 
Error 1


Additionally but likely less important this driver seems to be defining 
variables overriding kernel headers, I can't imagine that is good.  Not 
sure if this is something that the driver needs to fix or needs to be 
fixed in compat-wireless but here it is:

/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/libertas_tf/main.c:10:1: 
warning: "pr_fmt" redefined
In file included from include/linux/skbuff.h:17,
                 from include/linux/if_ether.h:124,
                 from include/linux/netdevice.h:29,
                 from 
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.29.h:5,
                 from 
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.h:24,
                 from <command-line>:0:
include/linux/kernel.h:376:1: warning: this is the location of the 
previous definition
  CC [M]  
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/orinoco/main.o
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/libertas_tf/main.c:10:1: 
warning: "pr_fmt" redefined
In file included from include/linux/skbuff.h:17,
                 from include/linux/if_ether.h:124,
                 from include/linux/netdevice.h:29,
                 from 
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.29.h:5,
                 from 
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.h:24,
                 from <command-line>:0:
include/linux/kernel.h:376:1: warning: this is the location of the 
previous definition
  CC [M]  
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/libertas_tf/cmd.o
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/libertas_tf/cmd.c:10:1: 
warning: "pr_fmt" redefined
In file included from include/linux/skbuff.h:17,
                 from include/linux/if_ether.h:124,
                 from include/linux/netdevice.h:29,
                 from 
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.29.h:5,
                 from 
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.h:24,
                 from <command-line>:0:
include/linux/kernel.h:376:1: warning: this is the location of the 
previous definition
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/libertas_tf/cmd.c:10:1: 
warning: "pr_fmt" redefined
In file included from include/linux/skbuff.h:17,
                 from include/linux/if_ether.h:124,
                 from include/linux/netdevice.h:29,
                 from 
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.29.h:5,
                 from 
/var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2/work/compat-wireless-2.6.35-rc2/include/linux/compat-2.6.h:24,
                 from <command-line>:0:

I'll try to build the rc2 kernel and see if these errors are the same.

Thanks,
Rick Farina

^ permalink raw reply

* Re: WARNING: at drivers/base/core.c:130 device_release+0x82/0x90()
From: Luis R. Rodriguez @ 2010-06-06  9:45 UTC (permalink / raw)
  To: Fabio Rossi; +Cc: linux-wireless
In-Reply-To: <201006061143.56259.rossi.f@inwind.it>

On Sun, Jun 6, 2010 at 2:43 AM, Fabio Rossi <rossi.f@inwind.it> wrote:
> On Sunday 06 June 2010 11:29:54 Luis R. Rodriguez wrote:
>
>> On Sun, Jun 6, 2010 at 2:28 AM, Luis R. Rodriguez <mcgrof@gmail.com> wrote:
>> > On Fri, Jun 4, 2010 at 1:25 AM, Fabio Rossi <rossi.f@inwind.it> wrote:
>> >> On Wednesday 02 June 2010 23:42:14 Luis R. Rodriguez wrote:
>> >>> On Wed, Jun 2, 2010 at 2:29 AM, Fabio Rossi <rossi.f@inwind.it> wrote:
>> >>> > Compiling the kernel without ACPI (CONFIG_ACPI=n) gives the following
>> >>> > warning:
>> >>> >
>> >>> > cfg80211: Calling CRDA to update world regulatory domain
>> >>> > cfg80211: World regulatory domain updated:
>> >>> >    (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
>> >>> >    (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
>> >>> > ath5k 0000:08:01.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
>> >>> > ath5k 0000:08:01.0: registered as 'phy0'
>> >>> > ath5k phy0: request_irq failed
>> >>> > ------------[ cut here ]------------
>> >>>
>> >>> Since traces are printed reversed you will have to read my logic from
>> >>> bottom to top:
>> >>>
>> >>> Seems we need to implement the dev_release() op for the class of our
>> >>> devices.
>> >>
>> >> Shall I open a bug in kernel bugzilla to keep trace of this?
>> >
>> > Nah something else is up...
>> >
>> > struct class ieee80211_class = {
>> >        .name = "ieee80211",
>> >        .owner = THIS_MODULE,
>> >        .dev_release = wiphy_dev_release,
>> >        .dev_attrs = ieee80211_dev_attrs,
>> > #ifdef CONFIG_HOTPLUG
>> >        .dev_uevent = wiphy_uevent,
>> > #endif
>> >        .suspend = wiphy_suspend,
>> >        .resume = wiphy_resume,
>> > };
>>
>> This is wireless-testing, not compat-wireless right?
>
> Yes, I'm using the latest wireless-testing.git

Then I don't know WTF is going on, some sort of class corruption...
anyone else have another idea?

  Luis

^ permalink raw reply

* Re: WARNING: at drivers/base/core.c:130 device_release+0x82/0x90()
From: Fabio Rossi @ 2010-06-06  9:43 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless
In-Reply-To: <AANLkTimTGPFL_1qAn4YEtYPogOkbZIr_C1YHOtKoHzxw@mail.gmail.com>

On Sunday 06 June 2010 11:29:54 Luis R. Rodriguez wrote:

> On Sun, Jun 6, 2010 at 2:28 AM, Luis R. Rodriguez <mcgrof@gmail.com> wrote:
> > On Fri, Jun 4, 2010 at 1:25 AM, Fabio Rossi <rossi.f@inwind.it> wrote:
> >> On Wednesday 02 June 2010 23:42:14 Luis R. Rodriguez wrote:
> >>> On Wed, Jun 2, 2010 at 2:29 AM, Fabio Rossi <rossi.f@inwind.it> wrote:
> >>> > Compiling the kernel without ACPI (CONFIG_ACPI=n) gives the following
> >>> > warning:
> >>> > 
> >>> > cfg80211: Calling CRDA to update world regulatory domain
> >>> > cfg80211: World regulatory domain updated:
> >>> >    (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
> >>> >    (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
> >>> > ath5k 0000:08:01.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
> >>> > ath5k 0000:08:01.0: registered as 'phy0'
> >>> > ath5k phy0: request_irq failed
> >>> > ------------[ cut here ]------------
> >>> 
> >>> Since traces are printed reversed you will have to read my logic from
> >>> bottom to top:
> >>> 
> >>> Seems we need to implement the dev_release() op for the class of our
> >>> devices.
> >> 
> >> Shall I open a bug in kernel bugzilla to keep trace of this?
> > 
> > Nah something else is up...
> > 
> > struct class ieee80211_class = {
> >        .name = "ieee80211",
> >        .owner = THIS_MODULE,
> >        .dev_release = wiphy_dev_release,
> >        .dev_attrs = ieee80211_dev_attrs,
> > #ifdef CONFIG_HOTPLUG
> >        .dev_uevent = wiphy_uevent,
> > #endif
> >        .suspend = wiphy_suspend,
> >        .resume = wiphy_resume,
> > };
> 
> This is wireless-testing, not compat-wireless right?

Yes, I'm using the latest wireless-testing.git

Fabio


^ permalink raw reply

* Re: [PATCH] mac80211: Add interface for driver to temporarily disable dynamic ps
From: Johannes Berg @ 2010-06-06  9:44 UTC (permalink / raw)
  To: Juuso Oikarinen; +Cc: linville, linux-wireless
In-Reply-To: <1275561873-21500-1-git-send-email-juuso.oikarinen@nokia.com>

Hi,

Apologies for the delay in reviewing this.

On Thu, 2010-06-03 at 13:44 +0300, Juuso Oikarinen wrote:

> @@ -699,6 +704,8 @@ enum ieee80211_smps_mode {
>  struct ieee80211_conf {
>  	u32 flags;
>  	int power_level, dynamic_ps_timeout, dynamic_ps_forced_timeout;
> +	int dynamic_ps_user_timeout;
> +	bool disable_dynamic_ps;
>  	int max_sleep_period;

Please don't keep these variables in driver-visible structures, they
don't belong there as they are implementation details, they should be in
the ieee80211_local structure somewhere and the driver should see _only_
dynamic_ps_timeout.

The same actually applies to dynamic_ps_forced_timeout as well, so
please also make a separate patch moving that.

johannes


^ permalink raw reply

* Re: WARNING: at drivers/base/core.c:130 device_release+0x82/0x90()
From: Luis R. Rodriguez @ 2010-06-06  9:29 UTC (permalink / raw)
  To: Fabio Rossi; +Cc: linux-wireless
In-Reply-To: <AANLkTim6tx9plm0tqqms64iUboSRxo9KnTGbHmwKrhQK@mail.gmail.com>

On Sun, Jun 6, 2010 at 2:28 AM, Luis R. Rodriguez <mcgrof@gmail.com> wrote:
> On Fri, Jun 4, 2010 at 1:25 AM, Fabio Rossi <rossi.f@inwind.it> wrote:
>> On Wednesday 02 June 2010 23:42:14 Luis R. Rodriguez wrote:
>>
>>> On Wed, Jun 2, 2010 at 2:29 AM, Fabio Rossi <rossi.f@inwind.it> wrote:
>>> > Compiling the kernel without ACPI (CONFIG_ACPI=n) gives the following
>>> > warning:
>>> >
>>> > cfg80211: Calling CRDA to update world regulatory domain
>>> > cfg80211: World regulatory domain updated:
>>> >    (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
>>> >    (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
>>> > ath5k 0000:08:01.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
>>> > ath5k 0000:08:01.0: registered as 'phy0'
>>> > ath5k phy0: request_irq failed
>>> > ------------[ cut here ]------------
>>>
>>> Since traces are printed reversed you will have to read my logic from
>>> bottom to top:
>>>
>>> Seems we need to implement the dev_release() op for the class of our
>>> devices.
>>
>> Shall I open a bug in kernel bugzilla to keep trace of this?
>
> Nah something else is up...
>
> struct class ieee80211_class = {
>        .name = "ieee80211",
>        .owner = THIS_MODULE,
>        .dev_release = wiphy_dev_release,
>        .dev_attrs = ieee80211_dev_attrs,
> #ifdef CONFIG_HOTPLUG
>        .dev_uevent = wiphy_uevent,
> #endif
>        .suspend = wiphy_suspend,
>        .resume = wiphy_resume,
> };
>

This is wireless-testing, not compat-wireless right?

  Luis

^ permalink raw reply

* Re: WARNING: at drivers/base/core.c:130 device_release+0x82/0x90()
From: Luis R. Rodriguez @ 2010-06-06  9:28 UTC (permalink / raw)
  To: Fabio Rossi; +Cc: linux-wireless
In-Reply-To: <201006041025.08348.rossi.f@inwind.it>

On Fri, Jun 4, 2010 at 1:25 AM, Fabio Rossi <rossi.f@inwind.it> wrote:
> On Wednesday 02 June 2010 23:42:14 Luis R. Rodriguez wrote:
>
>> On Wed, Jun 2, 2010 at 2:29 AM, Fabio Rossi <rossi.f@inwind.it> wrote:
>> > Compiling the kernel without ACPI (CONFIG_ACPI=n) gives the following
>> > warning:
>> >
>> > cfg80211: Calling CRDA to update world regulatory domain
>> > cfg80211: World regulatory domain updated:
>> >    (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
>> >    (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
>> > ath5k 0000:08:01.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
>> > ath5k 0000:08:01.0: registered as 'phy0'
>> > ath5k phy0: request_irq failed
>> > ------------[ cut here ]------------
>>
>> Since traces are printed reversed you will have to read my logic from
>> bottom to top:
>>
>> Seems we need to implement the dev_release() op for the class of our
>> devices.
>
> Shall I open a bug in kernel bugzilla to keep trace of this?

Nah something else is up...

struct class ieee80211_class = {
        .name = "ieee80211",
        .owner = THIS_MODULE,
        .dev_release = wiphy_dev_release,
        .dev_attrs = ieee80211_dev_attrs,
#ifdef CONFIG_HOTPLUG
        .dev_uevent = wiphy_uevent,
#endif
        .suspend = wiphy_suspend,
        .resume = wiphy_resume,
};

^ permalink raw reply

* Re: [PATCH 4/4] compat: use kernel pm_qos_params.h
From: Luis R. Rodriguez @ 2010-06-06  9:20 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-wireless, mcgrof
In-Reply-To: <1275815547-30313-4-git-send-email-hauke@hauke-m.de>

On Sun, Jun 6, 2010 at 2:12 AM, Hauke Mehrtens <hauke@hauke-m.de> wrote:
> Do not use pm_qos_params.h from compat-wireless if the kernel also
> ships this file. In kernel 2.6.35 pm_qos_params.h changed and the in
> kernel header file is needed.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

Dude you rock, thanks a lot for this, applied all compat-wireless and
compat patches and pushed them out. Also propagated the compat ones to
the 2.6.35.y branch FWIW.

  Luis

^ permalink raw reply

* Re: Locking in new ARP query filtering patch
From: Johannes Berg @ 2010-06-06  9:17 UTC (permalink / raw)
  To: reinette chatre; +Cc: juuso.oikarinen, linux-wireless
In-Reply-To: <1275802426.1835.4408.camel@rchatre-DESK>

On Sat, 2010-06-05 at 22:33 -0700, reinette chatre wrote:

> [   92.026800] =======================================================
> [   92.030507] [ INFO: possible circular locking dependency detected ]
> [   92.030507] 2.6.34-04781-g2b2c009 #85
> [   92.030507] -------------------------------------------------------
> [   92.030507] modprobe/5225 is trying to acquire lock:
> [   92.030507]  ((wiphy_name(local->hw.wiphy))){+.+.+.}, at: [<ffffffff8105b5c0>] flush_workq
> ueue+0x0/0xb0
> [   92.030507]
> [   92.030507] but task is already holding lock:
> [   92.030507]  (rtnl_mutex){+.+.+.}, at: [<ffffffff812b9ce2>] rtnl_lock+0x12/0x20
> [   92.030507]
> [   92.030507] which lock already depends on the new lock.

> [   92.030507] 1 lock held by modprobe/5225:
> [   92.030507]  #0:  (rtnl_mutex){+.+.+.}, at: [<ffffffff812b9ce2>] rtnl_lock+0x12/0x20

Suck, I should've caught that. Yes, because we need to flush the
mac80211 workqueue under RTNL we cannot acquire the RTNL while working
from it, so the ARP filter upload after associating needs to be further
deferred to a schedule_work(), which then needs to do a bunch of sanity
checking and I think might even need to iterate the iface list because
it might not be possible to make it depend on it.

> Here is the BUG:
> 
> [  132.460013] kernel BUG at /home/wifi/iwlwifi-2.6/net/mac80211/main.c:380!
> [  132.460013] invalid opcode: 0000 [#1] SMP

> [  132.460013] RIP: 0010:[<ffffffffa022fac2>]  [<ffffffffa022fac2>] ieee80211_alloc_hw+0x502/
> 0x520 [mac80211]

> [  132.460013]  [<ffffffffa02af53e>] iwl_alloc_all+0x1e/0x50 [iwlcore]

> The code in which the above appears is:
> (gdb) l *(ieee80211_alloc_hw+0x502)
> 0xaf2 is in ieee80211_alloc_hw (/home/wifi/iwlwifi-2.6/net/mac80211/main.c:380).
> 375	
> 376		ifmgd = &sdata->u.mgd;
> 377		mutex_lock(&ifmgd->mtx);
> 378		if (ifmgd->associated)
> 379			ieee80211_set_arp_filter(sdata);
> 380		mutex_unlock(&ifmgd->mtx);
> 381	
> 382		return NOTIFY_DONE;
> 383	}
> 384	#endif

Not sure why this appears as part of init? But anyway, the reason for
this is obvious -- we're not checking netif_running() in
ieee80211_ifa_changed, which we must since we only init the mutex as
part of open(). The fix would be to abort ieee80211_ifa_changed() if not
netif_running() -- before locking the mutex.

johannes


^ permalink raw reply

* [PATCH 4/4] compat: use kernel pm_qos_params.h
From: Hauke Mehrtens @ 2010-06-06  9:12 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens
In-Reply-To: <1275815547-30313-1-git-send-email-hauke@hauke-m.de>

Do not use pm_qos_params.h from compat-wireless if the kernel also
ships this file. In kernel 2.6.35 pm_qos_params.h changed and the in
kernel header file is needed.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 include/linux/pm_qos_params.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
index 091c13c..e1f083c 100644
--- a/include/linux/pm_qos_params.h
+++ b/include/linux/pm_qos_params.h
@@ -1,3 +1,8 @@
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
+#include_next <linux/pm_qos_params.h>
+#else
 /* interface for the pm_qos_power infrastructure of the linux kernel.
  *
  * Mark Gross <mgross@linux.intel.com>
@@ -23,4 +28,5 @@ int pm_qos_requirement(int qos);
 
 int pm_qos_add_notifier(int qos, struct notifier_block *notifier);
 int pm_qos_remove_notifier(int qos, struct notifier_block *notifier);
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) */
 
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 3/4] compat: backport small functions and defines
From: Hauke Mehrtens @ 2010-06-06  9:12 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens
In-Reply-To: <1275815547-30313-1-git-send-email-hauke@hauke-m.de>

Backport of some functions and defines needed by compat-wireless.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 include/linux/compat-2.6.29.h |   25 +++++++++++++++++++++++++
 include/linux/compat-2.6.32.h |    2 ++
 include/linux/compat-2.6.34.h |   16 ++++++++++++++++
 3 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/include/linux/compat-2.6.29.h b/include/linux/compat-2.6.29.h
index f063e24..a1a989c 100644
--- a/include/linux/compat-2.6.29.h
+++ b/include/linux/compat-2.6.29.h
@@ -249,6 +249,31 @@ extern int eth_mac_addr(struct net_device *dev, void *p);
 extern int eth_change_mtu(struct net_device *dev, int new_mtu);
 extern int eth_validate_addr(struct net_device *dev);
 
+#ifdef CONFIG_NET_NS
+
+static inline void write_pnet(struct net **pnet, struct net *net)
+{
+	*pnet = net;
+}
+
+static inline struct net *read_pnet(struct net * const *pnet)
+{
+	return *pnet;
+}
+
+#else
+
+#define write_pnet(pnet, net)	do { (void)(net);} while (0)
+#define read_pnet(pnet)		(&init_net)
+
+/*
+ * swap - swap value of @a and @b
+ */
+#define swap(a, b) \
+	do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
+
+#endif
+
 #else
 
 static inline void netdev_attach_ops(struct net_device *dev,
diff --git a/include/linux/compat-2.6.32.h b/include/linux/compat-2.6.32.h
index 2f5013f..3a41bd6 100644
--- a/include/linux/compat-2.6.32.h
+++ b/include/linux/compat-2.6.32.h
@@ -92,6 +92,8 @@ struct dev_pm_ops name = { \
 /* The export symbol in changed in compat/patches/15-symbol-export-conflicts.patch */
 #define ieee80211_rx(hw, skb) mac80211_ieee80211_rx(hw, skb)
 
+#define dev_to_sdio_func(d)	container_of(d, struct sdio_func, dev)
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) */
 
 #endif /* LINUX_26_32_COMPAT_H */
diff --git a/include/linux/compat-2.6.34.h b/include/linux/compat-2.6.34.h
index 2870a3b..b1c15a7 100644
--- a/include/linux/compat-2.6.34.h
+++ b/include/linux/compat-2.6.34.h
@@ -200,6 +200,22 @@ do {							\
 #define usb_alloc_coherent(dev, size, mem_flags, dma) usb_buffer_alloc(dev, size, mem_flags, dma)
 #define usb_free_coherent(dev, size, addr, dma) usb_buffer_free(dev, size, addr, dma)
 
+#ifdef CONFIG_NEED_DMA_MAP_STATE
+#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME)        dma_addr_t ADDR_NAME
+#define DEFINE_DMA_UNMAP_LEN(LEN_NAME)          __u32 LEN_NAME
+#define dma_unmap_addr(PTR, ADDR_NAME)           ((PTR)->ADDR_NAME)
+#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL)  (((PTR)->ADDR_NAME) = (VAL))
+#define dma_unmap_len(PTR, LEN_NAME)             ((PTR)->LEN_NAME)
+#define dma_unmap_len_set(PTR, LEN_NAME, VAL)    (((PTR)->LEN_NAME) = (VAL))
+#else
+#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME)
+#define DEFINE_DMA_UNMAP_LEN(LEN_NAME)
+#define dma_unmap_addr(PTR, ADDR_NAME)           (0)
+#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL)  do { } while (0)
+#define dma_unmap_len(PTR, LEN_NAME)             (0)
+#define dma_unmap_len_set(PTR, LEN_NAME, VAL)    do { } while (0)
+#endif
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) */
 
 #endif /* LINUX_26_34_COMPAT_H */
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 2/4] compat: move kparam_{block,unblock}_sysfs_write
From: Hauke Mehrtens @ 2010-06-06  9:12 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens
In-Reply-To: <1275815547-30313-1-git-send-email-hauke@hauke-m.de>

kparam_block_sysfs_write and kparam_unblock_sysfs_write are not in
kernel 2.6.35, move them to backport from kernel 2.6.36.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 include/linux/compat-2.6.35.h |    3 ---
 include/linux/compat-2.6.36.h |   13 +++++++++++++
 include/linux/compat-2.6.h    |    1 +
 3 files changed, 14 insertions(+), 3 deletions(-)
 create mode 100644 include/linux/compat-2.6.36.h

diff --git a/include/linux/compat-2.6.35.h b/include/linux/compat-2.6.35.h
index b38d6de..886815d 100644
--- a/include/linux/compat-2.6.35.h
+++ b/include/linux/compat-2.6.35.h
@@ -23,9 +23,6 @@ static inline wait_queue_head_t *sk_sleep(struct sock *sk)
 	return sk->sk_sleep;
 }
 
-#define kparam_block_sysfs_write(a)
-#define kparam_unblock_sysfs_write(a)
-
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) */
 
 #endif /* LINUX_26_35_COMPAT_H */
diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
new file mode 100644
index 0000000..0307108
--- /dev/null
+++ b/include/linux/compat-2.6.36.h
@@ -0,0 +1,13 @@
+#ifndef LINUX_26_36_COMPAT_H
+#define LINUX_26_36_COMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
+
+#define kparam_block_sysfs_write(a)
+#define kparam_unblock_sysfs_write(a)
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */
+
+#endif /* LINUX_26_36_COMPAT_H */
diff --git a/include/linux/compat-2.6.h b/include/linux/compat-2.6.h
index 6171cd9..ef51195 100644
--- a/include/linux/compat-2.6.h
+++ b/include/linux/compat-2.6.h
@@ -28,5 +28,6 @@
 #include <linux/compat-2.6.33.h>
 #include <linux/compat-2.6.34.h>
 #include <linux/compat-2.6.35.h>
+#include <linux/compat-2.6.36.h>
 
 #endif /* LINUX_26_COMPAT_H */
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 1/4] compat: update bitops.h and wireless.h
From: Hauke Mehrtens @ 2010-06-06  9:12 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens

copy files from linux-next next-20100604

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 include/linux/bitops.h        |   33 +++++----------------------------
 include/linux/compat-2.6.35.h |    3 ---
 include/linux/wireless.h      |    4 +++-
 3 files changed, 8 insertions(+), 32 deletions(-)

diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index b62de8c..679369b 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -12,6 +12,11 @@
 #endif
 #endif
 
+extern unsigned int __sw_hweight8(unsigned int w);
+extern unsigned int __sw_hweight16(unsigned int w);
+extern unsigned int __sw_hweight32(unsigned int w);
+extern unsigned long __sw_hweight64(__u64 w);
+
 /*
  * Include this here because some architectures need generic_ffs/fls in
  * scope
@@ -23,9 +28,6 @@
 	     (bit) < (size); \
 	     (bit) = find_next_bit((addr), (size), (bit) + 1))
 
-/* Temporary */
-#define for_each_bit(bit, addr, size) for_each_set_bit(bit, addr, size)
-
 static __inline__ int get_bitmask_order(unsigned int count)
 {
 	int order;
@@ -49,31 +51,6 @@ static inline unsigned long hweight_long(unsigned long w)
 	return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
 }
 
-/*
- * Clearly slow versions of the hweightN() functions, their benefit is
- * of course compile time evaluation of constant arguments.
- */
-#define HWEIGHT8(w)					\
-      (	BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) +	\
-	(!!((w) & (1ULL << 0))) +			\
-	(!!((w) & (1ULL << 1))) +			\
-	(!!((w) & (1ULL << 2))) +			\
-	(!!((w) & (1ULL << 3))) +			\
-	(!!((w) & (1ULL << 4))) +			\
-	(!!((w) & (1ULL << 5))) +			\
-	(!!((w) & (1ULL << 6))) +			\
-	(!!((w) & (1ULL << 7)))	)
-
-#define HWEIGHT16(w) (HWEIGHT8(w)  + HWEIGHT8((w) >> 8))
-#define HWEIGHT32(w) (HWEIGHT16(w) + HWEIGHT16((w) >> 16))
-#define HWEIGHT64(w) (HWEIGHT32(w) + HWEIGHT32((w) >> 32))
-
-/*
- * Type invariant version that simply casts things to the
- * largest type.
- */
-#define HWEIGHT(w)   HWEIGHT64((u64)(w))
-
 /**
  * rol32 - rotate a 32-bit value left
  * @word: value to rotate
diff --git a/include/linux/compat-2.6.35.h b/include/linux/compat-2.6.35.h
index 7091f7c..b38d6de 100644
--- a/include/linux/compat-2.6.35.h
+++ b/include/linux/compat-2.6.35.h
@@ -13,9 +13,6 @@
 #define SHRT_MAX       ((s16)(USHRT_MAX>>1))
 #define SHRT_MIN       ((s16)(-SHRT_MAX - 1))
 
-#define IW_HANDLER(id, func)			\
-	[IW_IOCTL_IDX(id)] = func
-
 #define  SDIO_BUS_ECSI		0x20	/* Enable continuous SPI interrupt */
 #define  SDIO_BUS_SCSI		0x40	/* Support continuous SPI interrupt */
 
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 5b4c6c7..e6827ee 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -346,6 +346,8 @@
 #define SIOCIWFIRST	0x8B00
 #define SIOCIWLAST	SIOCIWLASTPRIV		/* 0x8BFF */
 #define IW_IOCTL_IDX(cmd)	((cmd) - SIOCIWFIRST)
+#define IW_HANDLER(id, func)			\
+	[IW_IOCTL_IDX(id)] = func
 
 /* Odd : get (world access), even : set (root access) */
 #define IW_IS_SET(cmd)	(!((cmd) & 0x1))
@@ -648,7 +650,7 @@
  * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
 #define IW_EVENT_CAPA_BASE(cmd)		((cmd >= SIOCIWFIRSTPRIV) ? \
 					 (cmd - SIOCIWFIRSTPRIV + 0x60) : \
-					 (cmd - SIOCSIWCOMMIT))
+					 (cmd - SIOCIWFIRST))
 #define IW_EVENT_CAPA_INDEX(cmd)	(IW_EVENT_CAPA_BASE(cmd) >> 5)
 #define IW_EVENT_CAPA_MASK(cmd)		(1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
 /* Event capability constants - event autogenerated by the kernel
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 1/3] compat-wireless: deactivate libertas sdio suspend for < 2.6.34
From: Hauke Mehrtens @ 2010-06-06  9:11 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens

libertas sdio suspend and resume depends on some new features of the
sdio framework in kernel 2.6.34.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 patches/29-libertas_sdio_no_suspend.patch |   34 +++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 patches/29-libertas_sdio_no_suspend.patch

diff --git a/patches/29-libertas_sdio_no_suspend.patch b/patches/29-libertas_sdio_no_suspend.patch
new file mode 100644
index 0000000..f5dc993
--- /dev/null
+++ b/patches/29-libertas_sdio_no_suspend.patch
@@ -0,0 +1,34 @@
+Starting with commit 66fceb69b72ff7e9cd8da2ca70033982d5376e0e
+"libertas: Added callback functions to support SDIO suspend/resume."
+libertas uses new functions from the in kernel sdio framework for
+suspend and resume that are not backported.
+
+--- a/drivers/net/wireless/libertas/if_sdio.c
++++ b/drivers/net/wireless/libertas/if_sdio.c
+@@ -1212,6 +1212,7 @@ static void if_sdio_remove(struct sdio_f
+ 	lbs_deb_leave(LBS_DEB_SDIO);
+ }
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ static int if_sdio_suspend(struct device *dev)
+ {
+ 	struct sdio_func *func = dev_to_sdio_func(dev);
+@@ -1266,15 +1267,18 @@ static const struct dev_pm_ops if_sdio_p
+ 	.suspend	= if_sdio_suspend,
+ 	.resume		= if_sdio_resume,
+ };
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
+ 
+ static struct sdio_driver if_sdio_driver = {
+ 	.name		= "libertas_sdio",
+ 	.id_table	= if_sdio_ids,
+ 	.probe		= if_sdio_probe,
+ 	.remove		= if_sdio_remove,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ 	.drv = {
+ 		.pm = &if_sdio_pm_ops,
+ 	},
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
+ };
+ 
+ /*******************************************************************/
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 3/3] compat-wireless: activate CONFIG_MAC80211_RC_MINSTREL_HT
From: Hauke Mehrtens @ 2010-06-06  9:11 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens
In-Reply-To: <1275815518-30281-1-git-send-email-hauke@hauke-m.de>


Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 config.mk |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/config.mk b/config.mk
index b0bb35b..0001a7d 100644
--- a/config.mk
+++ b/config.mk
@@ -130,6 +130,7 @@ CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
 CONFIG_COMPAT_MAC80211_RC_DEFAULT=minstrel
 CONFIG_MAC80211_RC_PID=y
 CONFIG_MAC80211_RC_MINSTREL=y
+CONFIG_MAC80211_RC_MINSTREL_HT=y
 CONFIG_MAC80211_LEDS=y
 
 # enable mesh networking too
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 2/3] compat-wireless: deactivate atl1c for kernel < 2.6.27
From: Hauke Mehrtens @ 2010-06-06  9:11 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens
In-Reply-To: <1275815518-30281-1-git-send-email-hauke@hauke-m.de>

atl1c uses pci_prepare_to_sleep that is not backported.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 config.mk |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/config.mk b/config.mk
index ae56849..b0bb35b 100644
--- a/config.mk
+++ b/config.mk
@@ -289,7 +289,11 @@ CONFIG_MWL8K=m
 CONFIG_ATL1=m
 CONFIG_ATL2=m
 CONFIG_ATL1E=m
+ifdef CONFIG_COMPAT_KERNEL_27
+CONFIG_ATL1C=n
+else
 CONFIG_ATL1C=m
+endif
 
 CONFIG_HERMES=m
 CONFIG_HERMES_CACHE_FW_ON_INIT=y
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 23/23] iwlwifi: fix wrapping when handling aggregated batches
From: Reinette Chatre @ 2010-06-06  6:56 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Daniel Halperin, Reinette Chatre
In-Reply-To: <1275807398-18184-1-git-send-email-reinette.chatre@intel.com>

From: Daniel Halperin <dhalperi@cs.washington.edu>

Fairly complex code in iwlagn_tx_status_reply_tx handle the status reports for
aggregated packet batches sent by the NIC. This code aims to handle the case
where the NIC retransmits failed packets from a previous batch; the status
information for these packets can sometimes be inserted in the middle of a
batch and are actually not in order by sequence number! (I verified this can
happen with printk's in the function.)

The code in question adaptively identifies the "first" frame of the batch,
taking into account that it may not be the one corresponding to the first agg
status report, and also handles the case when the set of sent packets wraps the
256-character entry buffer. It generates the agg->bitmap field of sent packets
which is later compared to the BlockAck response from the receiver to see which
frames of those sent in this batch were ACKed. A small logic error (wrapping by
0xff==255 instead of 0x100==256) was causing the agg->bitmap to be set
incorrectly.

Fix this wrapping code, and add extensive comments to clarify what is going on.

Signed-off-by: Daniel Halperin <dhalperi@cs.washington.edu>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn-lib.c |   51 ++++++++++++++++++++++++---
 1 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index d339881..3577c1e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -93,6 +93,12 @@ static int iwlagn_tx_status_reply_tx(struct iwl_priv *priv,
 	} else {
 		/* Two or more frames were attempted; expect block-ack */
 		u64 bitmap = 0;
+
+		/*
+		 * Start is the lowest frame sent. It may not be the first
+		 * frame in the batch; we figure this out dynamically during
+		 * the following loop.
+		 */
 		int start = agg->start_idx;
 
 		/* Construct bit-map of pending frames within Tx window */
@@ -131,25 +137,58 @@ static int iwlagn_tx_status_reply_tx(struct iwl_priv *priv,
 			IWL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n",
 					   i, idx, SEQ_TO_SN(sc));
 
+			/*
+			 * sh -> how many frames ahead of the starting frame is
+			 * the current one?
+			 *
+			 * Note that all frames sent in the batch must be in a
+			 * 64-frame window, so this number should be in [0,63].
+			 * If outside of this window, then we've found a new
+			 * "first" frame in the batch and need to change start.
+			 */
 			sh = idx - start;
-			if (sh > 64) {
-				sh = (start - idx) + 0xff;
+
+			/*
+			 * If >= 64, out of window. start must be at the front
+			 * of the circular buffer, idx must be near the end of
+			 * the buffer, and idx is the new "first" frame. Shift
+			 * the indices around.
+			 */
+			if (sh >= 64) {
+				/* Shift bitmap by start - idx, wrapped */
+				sh = 0x100 - idx + start;
 				bitmap = bitmap << sh;
+				/* Now idx is the new start so sh = 0 */
 				sh = 0;
 				start = idx;
-			} else if (sh < -64)
-				sh  = 0xff - (start - idx);
-			else if (sh < 0) {
+			/*
+			 * If <= -64 then wraps the 256-pkt circular buffer
+			 * (e.g., start = 255 and idx = 0, sh should be 1)
+			 */
+			} else if (sh <= -64) {
+				sh  = 0x100 - start + idx;
+			/*
+			 * If < 0 but > -64, out of window. idx is before start
+			 * but not wrapped. Shift the indices around.
+			 */
+			} else if (sh < 0) {
+				/* Shift by how far start is ahead of idx */
 				sh = start - idx;
-				start = idx;
 				bitmap = bitmap << sh;
+				/* Now idx is the new start so sh = 0 */
+				start = idx;
 				sh = 0;
 			}
+			/* Sequence number start + sh was sent in this batch */
 			bitmap |= 1ULL << sh;
 			IWL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n",
 					   start, (unsigned long long)bitmap);
 		}
 
+		/*
+		 * Store the bitmap and possibly the new start, if we wrapped
+		 * the buffer above
+		 */
 		agg->bitmap = bitmap;
 		agg->start_idx = start;
 		IWL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n",
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 22/23] iwlwifi: parse block ack responses correctly
From: Reinette Chatre @ 2010-06-06  6:56 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Daniel Halperin, Reinette Chatre
In-Reply-To: <1275807398-18184-1-git-send-email-reinette.chatre@intel.com>

From: Daniel Halperin <dhalperi@cs.washington.edu>

Compressed BlockAck frames store the ACKs/NACKs in a 64-bit bitmap that starts
at the sequence number of the first frame sent in the aggregated batch. Note
that this is a selective ACKnowledgement following selective retransmission;
e.g., if frames 1,4-5 in a batch are ACKed then the next transmission will
include frames 2-3,6-10 (7 frames). In this latter case, the Compressed
BlockAck will not have all meaningful information in the low order bits -- the
semantically meaningful bits of the BA will be 0x1f3 (where the low-order frame
is seq 2).

The driver code originally just looked at the lower (in this case, 7) bits of
the BlockAck. In this case, the lower 7 bits of 0x1f3 => only 5 packets,
maximum, could ever be ACKed. In reality it should be looking at all of the
bits, filtered by those corresponding to packets that were actually sent. This
flaw meant that the number of correctly ACked packets could be significantly
underreported and might result in asynchronous state between TX and RX sides as
well as driver and uCode.

Fix this and also add a shortcut that doesn't require the code to loop through
all 64 bits of the bitmap but rather stops when no higher packets are ACKed.

In my experiments this fix greatly reduces throughput swing, making throughput
stable and high. It is also likely related to some of the stalls observed in
aggregation mode and maybe some of the buffer underruns observed, e.g.,

http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=1968
http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2098
http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2018

Signed-off-by: Daniel Halperin <dhalperi@cs.washington.edu>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn-tx.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 0d3e13b..10a0acd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -1208,7 +1208,7 @@ static int iwlagn_tx_status_reply_compressed_ba(struct iwl_priv *priv,
 	int i, sh, ack;
 	u16 seq_ctl = le16_to_cpu(ba_resp->seq_ctl);
 	u16 scd_flow = le16_to_cpu(ba_resp->scd_flow);
-	u64 bitmap;
+	u64 bitmap, sent_bitmap;
 	int successes = 0;
 	struct ieee80211_tx_info *info;
 
@@ -1236,16 +1236,19 @@ static int iwlagn_tx_status_reply_compressed_ba(struct iwl_priv *priv,
 
 	/* check for success or failure according to the
 	 * transmitted bitmap and block-ack bitmap */
-	bitmap &= agg->bitmap;
+	sent_bitmap = bitmap & agg->bitmap;
 
 	/* For each frame attempted in aggregation,
 	 * update driver's record of tx frame's status. */
-	for (i = 0; i < agg->frame_count ; i++) {
-		ack = bitmap & (1ULL << i);
-		successes += !!ack;
+	i = 0;
+	while (sent_bitmap) {
+		ack = sent_bitmap & 1ULL;
+		successes += ack;
 		IWL_DEBUG_TX_REPLY(priv, "%s ON i=%d idx=%d raw=%d\n",
 			ack ? "ACK" : "NACK", i, (agg->start_idx + i) & 0xff,
 			agg->start_idx + i);
+		sent_bitmap >>= 1;
+		++i;
 	}
 
 	info = IEEE80211_SKB_CB(priv->txq[scd_flow].txb[agg->start_idx].skb);
-- 
1.7.0.4


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox