* Re: Mesh fixes and improvements
From: Javier Cardona @ 2009-08-09 4:55 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, andrey, linville, devel
In-Reply-To: <1249722543.31670.19.camel@johannes.local>
Johannes,
Thanks for the review.
On Sat, Aug 8, 2009 at 2:09 AM, Johannes Berg<johannes@sipsolutions.net> wrote:
>> This series includes some fixes, testing aids and improvements to the mesh
>> stack. It is important to note that the patch
>> "Use-3-address-format-for-mesh-broadcast-frames" breaks compatibility with
>> previous versions. This is unavoidable and will keep happening as new versions
>> of the 802.11s drafts are produced.
>
> That's ok, can you update the Kconfig though to indicate which draft
> it's compatible with? It says 1.08 right now.
Unfortunately I don't think it is fully compatible to one particular
version. Furthermore, compliance with a Draft is not really
achievable: a vast number of identifiers (reason codes, element ids,
status codes, ...) are not defined until the standard is ratified.
This particular change to the broadcast frame format was introduced
between D2.03 and D2.08. Without it mesh networks will badly interact
with widely deployed lazy WDS APs. It is not purely an
interoperability issue with other mesh implementations but a
requirement to achieve harmonious coexistence with deployed systems.
I don't think we should hold this change back until closer compliance
to a given draft version is implemented.
I'll still be happy to change the Kconfig, but bumping the version
number to, say D2.08, might be misleading. I guess we should be more
verbose in the Kconfig description.
>> Also, I'm not sure if "Simulate-transmission-losses-on-plinks-to-..." should be
>> merged upstream, but we find it really useful to test mesh configurations.
>> Please comment if you have different opinions on its adequacy or
>> implementation.
>
> As I said elsewhere in this thread I don't think that should be in,
> especially not, as Kalle points out, using nl80211.
Understood. I'll withdraw that patch and regenerate the series...
> All the other patches look ok on a cursory look, I just wish you'd write
> more detailed changelog entries.
... with more changelogs.
Cheers,
Javier
^ permalink raw reply
* Re: [PATCH] cfg80211: fix locking for SIWFREQ
From: Larry Finger @ 2009-08-09 2:55 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, Reinette Chatre, Kalle Valo, linux-wireless
In-Reply-To: <1249722238.31670.17.camel@johannes.local>
Johannes Berg wrote:
> "cfg80211: validate channel settings across interfaces"
> contained a locking bug -- in the managed-mode SIWFREQ
> call it would end up running into a lock recursion.
>
> This fixes it by not checking that particular interface
> for a channel that it needs to stay on, which is as it
> should be as that's the interface we're setting the
> channel for.
>
> Reported-by: Reinette Chatre <reinette.chatre@intel.com>
> Reported-by: Kalle Valo <kalle.valo@iki.fi>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> ---
This patch also fixes the problem that I had.
Larry
^ permalink raw reply
* [PATCH] ath9k: Fix regression on receiving PS poll frames
From: Luis R. Rodriguez @ 2009-08-09 1:55 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez, Jouni Malinen
In the the patch:
ath9k: use new FIF_PSPOLL configure filter
I forgot to add the new FIF_PSPOLL to the supported mask.
Without this we mask out the FIF_PSPOLL flag therefore
we'd ignore it from mac80211.
Cc: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
sorry about that.
drivers/net/wireless/ath/ath9k/main.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index a9e43f7..efe2e85 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2380,6 +2380,7 @@ skip_chan_change:
(FIF_PROMISC_IN_BSS | \
FIF_ALLMULTI | \
FIF_CONTROL | \
+ FIF_PSPOLL | \
FIF_OTHER_BSS | \
FIF_BCN_PRBRESP_PROMISC | \
FIF_FCSFAIL)
--
1.6.3.3
^ permalink raw reply related
* Re: [PATCH] MAINTAINERS: add information for wl1271 wireless driver
From: Joe Perches @ 2009-08-09 1:28 UTC (permalink / raw)
To: Luciano Coelho; +Cc: linux-wireless, kalle.valo
In-Reply-To: <1249681805-21015-1-git-send-email-luciano.coelho@nokia.com>
On Sat, 2009-08-08 at 00:50 +0300, Luciano Coelho wrote:
> Add maintainer information section for the wl1271 wireless driver and fix the
> information for wl1271.
Hi Luciano.
Could you please convert this to the new style?
WL1271 WIRELESS DRIVER
M: Luciano Coelho <luciano.coelho@nokia.com>
L: linux-wireless@vger.kernel.org
W: http://wireless.kernel.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
S: Maintained
F: drivers/net/wireless/wl12xx/wl1271*
^ permalink raw reply
* Re: [PATCH] mac80211: remove max_bandwidth
From: Johannes Berg @ 2009-08-08 22:53 UTC (permalink / raw)
To: Pat Erley; +Cc: linux-wireless
In-Reply-To: <1249768399-16855-1-git-send-email-pat-lkml@erley.org>
[-- Attachment #1: Type: text/plain, Size: 2595 bytes --]
On Sat, 2009-08-08 at 17:53 -0400, Pat Erley wrote:
> This removes the max_bandwidth attribute. It is only ever
> written to, and is duplicated by max_bandwidth_khz in the
> regulatory code.
>
> Signed-off-by: Pat Erley <pat-lkml@erley.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
> ---
> include/net/cfg80211.h | 2 --
> net/wireless/reg.c | 3 ---
> 2 files changed, 0 insertions(+), 5 deletions(-)
>
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index d5756c9..2239134 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -80,7 +80,6 @@ enum ieee80211_channel_flags {
> * with cfg80211.
> *
> * @center_freq: center frequency in MHz
> - * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
> * @hw_value: hardware-specific value for the channel
> * @flags: channel flags from &enum ieee80211_channel_flags.
> * @orig_flags: channel flags at registration time, used by regulatory
> @@ -97,7 +96,6 @@ enum ieee80211_channel_flags {
> struct ieee80211_channel {
> enum ieee80211_band band;
> u16 center_freq;
> - u8 max_bandwidth;
> u16 hw_value;
> u32 flags;
> int max_antenna_gain;
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index 0f61ae6..fc7a484 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -1018,7 +1018,6 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
> map_regdom_flags(reg_rule->flags) | bw_flags;
> chan->max_antenna_gain = chan->orig_mag =
> (int) MBI_TO_DBI(power_rule->max_antenna_gain);
> - chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
> chan->max_power = chan->orig_mpwr =
> (int) MBM_TO_DBM(power_rule->max_eirp);
> return;
> @@ -1027,7 +1026,6 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
> chan->flags = flags | bw_flags | map_regdom_flags(reg_rule->flags);
> chan->max_antenna_gain = min(chan->orig_mag,
> (int) MBI_TO_DBI(power_rule->max_antenna_gain));
> - chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
> if (chan->orig_mpwr)
> chan->max_power = min(chan->orig_mpwr,
> (int) MBM_TO_DBM(power_rule->max_eirp));
> @@ -1329,7 +1327,6 @@ static void handle_channel_custom(struct wiphy *wiphy,
>
> chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags;
> chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain);
> - chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
> chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
> }
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* [PATCH 7/7] [PATCH] rt2x00: FIF_PSPOLL filter flag support
From: Ivo van Doorn @ 2009-08-08 21:55 UTC (permalink / raw)
To: John Linville; +Cc: users, linux-wireless, Igor Perminov
In-Reply-To: <200908082355.19233.IvDoorn@gmail.com>
From: Igor Perminov <igor.perminov@inbox.ru>
This patch implements FIF_PSPOLL filter flag support in rt2x00 drivers,
which has been introduced in mac80211 (see
http://marc.info/?l=linux-wireless&m=124897986330807&w=2).
Signed-off-by: Igor Perminov <igor.perminov@inbox.ru>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2800usb.c | 9 ++++++++-
drivers/net/wireless/rt2x00/rt2x00.h | 2 ++
drivers/net/wireless/rt2x00/rt2x00mac.c | 17 +++++++++++++++++
drivers/net/wireless/rt2x00/rt61pci.c | 8 +++++++-
drivers/net/wireless/rt2x00/rt73usb.c | 8 +++++++-
5 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 9efb417..2de0389 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -518,7 +518,7 @@ static void rt2800usb_config_filter(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(®, RX_FILTER_CFG_DROP_RTS,
!(filter_flags & FIF_CONTROL));
rt2x00_set_field32(®, RX_FILTER_CFG_DROP_PSPOLL,
- !(filter_flags & FIF_CONTROL));
+ !(filter_flags & FIF_PSPOLL));
rt2x00_set_field32(®, RX_FILTER_CFG_DROP_BA, 1);
rt2x00_set_field32(®, RX_FILTER_CFG_DROP_BAR, 0);
rt2x00_set_field32(®, RX_FILTER_CFG_DROP_CNTL,
@@ -2624,6 +2624,13 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
return retval;
/*
+ * This device has multiple filters for control frames
+ * and has a separate filter for PS Poll frames.
+ */
+ __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
+ __set_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags);
+
+ /*
* This device requires firmware.
*/
__set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 806ef60..99e8959 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -624,6 +624,8 @@ enum rt2x00_flags {
*/
CONFIG_SUPPORT_HW_BUTTON,
CONFIG_SUPPORT_HW_CRYPTO,
+ DRIVER_SUPPORT_CONTROL_FILTERS,
+ DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL,
/*
* Driver configuration
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 74451f9..cb7b6d4 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -392,6 +392,7 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
FIF_FCSFAIL |
FIF_PLCPFAIL |
FIF_CONTROL |
+ FIF_PSPOLL |
FIF_OTHER_BSS |
FIF_PROMISC_IN_BSS;
@@ -407,6 +408,22 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
/*
+ * If the device has a single filter for all control frames,
+ * FIF_CONTROL and FIF_PSPOLL flags imply each other.
+ * And if the device has more than one filter for control frames
+ * of different types, but has no a separate filter for PS Poll frames,
+ * FIF_CONTROL flag implies FIF_PSPOLL.
+ */
+ if (!test_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags)) {
+ if (*total_flags & FIF_CONTROL || *total_flags & FIF_PSPOLL)
+ *total_flags |= FIF_CONTROL | FIF_PSPOLL;
+ }
+ if (!test_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags)) {
+ if (*total_flags & FIF_CONTROL)
+ *total_flags |= FIF_PSPOLL;
+ }
+
+ /*
* Check if there is any work left for us.
*/
if (rt2x00dev->packet_filter == *total_flags)
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index e20dd74..3447997 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -530,7 +530,7 @@ static void rt61pci_config_filter(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(®, TXRX_CSR0_DROP_PHYSICAL,
!(filter_flags & FIF_PLCPFAIL));
rt2x00_set_field32(®, TXRX_CSR0_DROP_CONTROL,
- !(filter_flags & FIF_CONTROL));
+ !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME,
!(filter_flags & FIF_PROMISC_IN_BSS));
rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS,
@@ -2624,6 +2624,12 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
return retval;
/*
+ * This device has multiple filters for control frames,
+ * but has no a separate filter for PS Poll frames.
+ */
+ __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
+
+ /*
* This device requires firmware and DMA mapped skbs.
*/
__set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 4f9b177..4b9955b 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -493,7 +493,7 @@ static void rt73usb_config_filter(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(®, TXRX_CSR0_DROP_PHYSICAL,
!(filter_flags & FIF_PLCPFAIL));
rt2x00_set_field32(®, TXRX_CSR0_DROP_CONTROL,
- !(filter_flags & FIF_CONTROL));
+ !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME,
!(filter_flags & FIF_PROMISC_IN_BSS));
rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS,
@@ -2144,6 +2144,12 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
return retval;
/*
+ * This device has multiple filters for control frames,
+ * but has no a separate filter for PS Poll frames.
+ */
+ __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
+
+ /*
* This device requires firmware.
*/
__set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
--
1.6.3.3
^ permalink raw reply related
* [PATCH 6/7] rt2x00: Fix for race condition while update beacon
From: Ivo van Doorn @ 2009-08-08 21:55 UTC (permalink / raw)
To: John Linville; +Cc: users, linux-wireless, Igor Perminov
In-Reply-To: <200908082354.51745.IvDoorn@gmail.com>
From: Igor Perminov <igor.perminov@inbox.ru>
The patch "Implement set_tim callback for all drivers" can cause kernel
oops in rt73usb_write_beacon. The oops is caused by one of the following
race conditions:
* In case of two near calls to set_tim: rt2x00lib_beacondone_iter is
cleaning the beacon skb, whereas rt73usb_write_beacon is still using it.
* In case of two near updates of beacon: first as the result of set_tim
and second as the result of a call from an application (e.g. hostapd).
This patch fixes the race condition by rearranging the update logic and
guarding rt2x00_intf->beacon->skb with a mutex.
Signed-off-by: Igor Perminov <igor.perminov@inbox.ru>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2x00.h | 5 +++++
drivers/net/wireless/rt2x00/rt2x00dev.c | 7 -------
drivers/net/wireless/rt2x00/rt2x00mac.c | 1 +
drivers/net/wireless/rt2x00/rt2x00queue.c | 15 ++++++++++++++-
4 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 19ca146..806ef60 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -334,6 +334,11 @@ struct rt2x00_intf {
u8 bssid[ETH_ALEN];
/*
+ * beacon->skb must be protected with the mutex.
+ */
+ struct mutex beacon_skb_mutex;
+
+ /*
* Entry in the beacon queue which belongs to
* this interface. Each interface has its own
* dedicated beacon entry.
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index e0348cc..b6676c6 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -186,7 +186,6 @@ static void rt2x00lib_intf_scheduled(struct work_struct *work)
static void rt2x00lib_beacondone_iter(void *data, u8 *mac,
struct ieee80211_vif *vif)
{
- struct rt2x00_dev *rt2x00dev = data;
struct rt2x00_intf *intf = vif_to_intf(vif);
if (vif->type != NL80211_IFTYPE_AP &&
@@ -195,12 +194,6 @@ static void rt2x00lib_beacondone_iter(void *data, u8 *mac,
vif->type != NL80211_IFTYPE_WDS)
return;
- /*
- * Clean up the beacon skb.
- */
- rt2x00queue_free_skb(rt2x00dev, intf->beacon->skb);
- intf->beacon->skb = NULL;
-
spin_lock(&intf->lock);
intf->delayed_flags |= DELAYED_UPDATE_BEACON;
spin_unlock(&intf->lock);
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 4164fce..74451f9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -274,6 +274,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
spin_lock_init(&intf->lock);
spin_lock_init(&intf->seqlock);
+ mutex_init(&intf->beacon_skb_mutex);
intf->beacon = entry;
if (conf->type == NL80211_IFTYPE_AP)
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index e67e339..06af823 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -503,14 +503,25 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
if (unlikely(!intf->beacon))
return -ENOBUFS;
+ mutex_lock(&intf->beacon_skb_mutex);
+
+ /*
+ * Clean up the beacon skb.
+ */
+ rt2x00queue_free_skb(rt2x00dev, intf->beacon->skb);
+ intf->beacon->skb = NULL;
+
if (!enable_beacon) {
rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev, QID_BEACON);
+ mutex_unlock(&intf->beacon_skb_mutex);
return 0;
}
intf->beacon->skb = ieee80211_beacon_get(rt2x00dev->hw, vif);
- if (!intf->beacon->skb)
+ if (!intf->beacon->skb) {
+ mutex_unlock(&intf->beacon_skb_mutex);
return -ENOMEM;
+ }
/*
* Copy all TX descriptor information into txdesc,
@@ -548,6 +559,8 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
rt2x00dev->ops->lib->write_beacon(intf->beacon);
rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON);
+ mutex_unlock(&intf->beacon_skb_mutex);
+
return 0;
}
--
1.6.3.3
^ permalink raw reply related
* [PATCH 5/7] rt2x00: Fix rounding errors in RSSI average calculation
From: Ivo van Doorn @ 2009-08-08 21:54 UTC (permalink / raw)
To: John Linville; +Cc: users, linux-wireless, Lars Ericsson
In-Reply-To: <200908082354.24733.IvDoorn@gmail.com>
From: Lars Ericsson <Lars_Ericsson@telia.com>
Small changes in signal level was not detected up by the
MOVING_AVERAGE() due to a rounding error, using 'int' type.
rt2x00lib_antenna_diversity_eval:
rssi: -62 -62 -62 -62 -62 -62 -62 -62 -62 -62 -62 -62 -62 -62 -62
rssi_avg: -57 -57 -57 -57 -57 -57 -57 -57 -57 -57 -57 -57 -57 -57 -57
The signal level reported back could be significantly (5dBm)
different from the actual value. A level +3dBm is the same as
double the AP output power.
Signed-off-by: Lars Ericsson <Lars_Ericsson@telia.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2x00.h | 15 ++++++-
drivers/net/wireless/rt2x00/rt2x00link.c | 65 ++++++++++++++++++------------
2 files changed, 52 insertions(+), 28 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index aa3ff0a..19ca146 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -134,6 +134,17 @@
GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) )
/*
+ * Structure for average calculation
+ * The avg field contains the actual average value,
+ * but avg_weight is internally used during calculations
+ * to prevent rounding errors.
+ */
+struct avg_val {
+ int avg;
+ int avg_weight;
+};
+
+/*
* Chipset identification
* The chipset on the device is composed of a RT and RF chip.
* The chipset combination is important for determining device capabilities.
@@ -256,7 +267,7 @@ struct link_ant {
* Similar to the avg_rssi in the link_qual structure
* this value is updated by using the walking average.
*/
- int rssi_ant;
+ struct avg_val rssi_ant;
};
/*
@@ -285,7 +296,7 @@ struct link {
/*
* Currently active average RSSI value
*/
- int avg_rssi;
+ struct avg_val avg_rssi;
/*
* Currently precalculated percentages of successful
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c
index dd68f3a..c64db0b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00link.c
+++ b/drivers/net/wireless/rt2x00/rt2x00link.c
@@ -46,7 +46,15 @@
#define DEFAULT_PERCENTAGE 50
/*
- * Small helper macro to work with moving/walking averages.
+ * Small helper macro for percentage calculation
+ * This is a very simple macro with the only catch that it will
+ * produce a default value in case no total value was provided.
+ */
+#define PERCENTAGE(__value, __total) \
+ ( (__total) ? (((__value) * 100) / (__total)) : (DEFAULT_PERCENTAGE) )
+
+/*
+ * Helper struct and macro to work with moving/walking averages.
* When adding a value to the average value the following calculation
* is needed:
*
@@ -60,18 +68,28 @@
* for a few minutes but when the device is moved away from the AP
* the average will not decrease fast enough to compensate.
* The walking average compensates this and will move towards
- * the new values correctly allowing a effective link tuning.
+ * the new values correctly allowing a effective link tuning,
+ * the speed of the average moving towards other values depends
+ * on the value for the number of samples. The higher the number
+ * of samples, the slower the average will move.
+ * We use two variables to keep track of the average value to
+ * compensate for the rounding errors. This can be a significant
+ * error (>5dBm) if the factor is too low.
*/
-#define MOVING_AVERAGE(__avg, __val, __samples) \
- ( (((__avg) * ((__samples) - 1)) + (__val)) / (__samples) )
-
-/*
- * Small helper macro for percentage calculation
- * This is a very simple macro with the only catch that it will
- * produce a default value in case no total value was provided.
- */
-#define PERCENTAGE(__value, __total) \
- ( (__total) ? (((__value) * 100) / (__total)) : (DEFAULT_PERCENTAGE) )
+#define AVG_SAMPLES 8
+#define AVG_FACTOR 1000
+#define MOVING_AVERAGE(__avg, __val) \
+({ \
+ struct avg_val __new; \
+ __new.avg_weight = \
+ (__avg).avg_weight ? \
+ ((((__avg).avg_weight * ((AVG_SAMPLES) - 1)) + \
+ ((__val) * (AVG_FACTOR))) / \
+ (AVG_SAMPLES) ) : \
+ ((__val) * (AVG_FACTOR)); \
+ __new.avg = __new.avg_weight / (AVG_FACTOR); \
+ __new; \
+})
/*
* For calculating the Signal quality we have determined
@@ -98,8 +116,8 @@ static int rt2x00link_antenna_get_link_rssi(struct rt2x00_dev *rt2x00dev)
{
struct link_ant *ant = &rt2x00dev->link.ant;
- if (ant->rssi_ant && rt2x00dev->link.qual.rx_success)
- return ant->rssi_ant;
+ if (ant->rssi_ant.avg && rt2x00dev->link.qual.rx_success)
+ return ant->rssi_ant.avg;
return DEFAULT_RSSI;
}
@@ -121,7 +139,8 @@ static void rt2x00link_antenna_update_rssi_history(struct rt2x00_dev *rt2x00dev,
static void rt2x00link_antenna_reset(struct rt2x00_dev *rt2x00dev)
{
- rt2x00dev->link.ant.rssi_ant = 0;
+ rt2x00dev->link.ant.rssi_ant.avg = 0;
+ rt2x00dev->link.ant.rssi_ant.avg_weight = 0;
}
static void rt2x00lib_antenna_diversity_sample(struct rt2x00_dev *rt2x00dev)
@@ -258,8 +277,6 @@ void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
struct link_qual *qual = &rt2x00dev->link.qual;
struct link_ant *ant = &rt2x00dev->link.ant;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- int avg_rssi = rxdesc->rssi;
- int ant_rssi = rxdesc->rssi;
/*
* Frame was received successfully since non-succesfull
@@ -279,16 +296,12 @@ void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
/*
* Update global RSSI
*/
- if (link->avg_rssi)
- avg_rssi = MOVING_AVERAGE(link->avg_rssi, rxdesc->rssi, 8);
- link->avg_rssi = avg_rssi;
+ link->avg_rssi = MOVING_AVERAGE(link->avg_rssi, rxdesc->rssi);
/*
* Update antenna RSSI
*/
- if (ant->rssi_ant)
- ant_rssi = MOVING_AVERAGE(ant->rssi_ant, rxdesc->rssi, 8);
- ant->rssi_ant = ant_rssi;
+ ant->rssi_ant = MOVING_AVERAGE(ant->rssi_ant, rxdesc->rssi);
}
static void rt2x00link_precalculate_signal(struct rt2x00_dev *rt2x00dev)
@@ -421,10 +434,10 @@ static void rt2x00link_tuner(struct work_struct *work)
* collect the RSSI data we could use this. Otherwise we
* must fallback to the default RSSI value.
*/
- if (!link->avg_rssi || !qual->rx_success)
+ if (!link->avg_rssi.avg || !qual->rx_success)
qual->rssi = DEFAULT_RSSI;
else
- qual->rssi = link->avg_rssi;
+ qual->rssi = link->avg_rssi.avg;
/*
* Only perform the link tuning when Link tuning
@@ -442,7 +455,7 @@ static void rt2x00link_tuner(struct work_struct *work)
/*
* Send a signal to the led to update the led signal strength.
*/
- rt2x00leds_led_quality(rt2x00dev, link->avg_rssi);
+ rt2x00leds_led_quality(rt2x00dev, qual->rssi);
/*
* Evaluate antenna setup, make this the last step when
--
1.6.3.3
^ permalink raw reply related
* [PATCH 3/7] rt2x00: Align ieee80211 header to 4-byte boundary for PCI devices
From: Ivo van Doorn @ 2009-08-08 21:53 UTC (permalink / raw)
To: John Linville; +Cc: users, linux-wireless
In-Reply-To: <200908082353.26986.IvDoorn@gmail.com>
Some hardware require the ieee80211 header to be aligned to a
4-byte boundary before mapping it to the DMA. Otherwise some
frames (like beacons) will not be send out correctly by the
device.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2x00queue.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 65435c9..e67e339 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -453,9 +453,21 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
rt2x00crypto_tx_remove_iv(skb, &txdesc);
}
+ /*
+ * When DMA allocation is required we should guarentee to the
+ * driver that the DMA is aligned to a 4-byte boundary.
+ * Aligning the header to this boundary can be done by calling
+ * rt2x00queue_payload_align with the header length of 0.
+ * However some drivers require L2 padding to pad the payload
+ * rather then the header. This could be a requirement for
+ * PCI and USB devices, while header alignment only is valid
+ * for PCI devices.
+ */
if (test_bit(DRIVER_REQUIRE_L2PAD, &queue->rt2x00dev->flags))
rt2x00queue_payload_align(entry->skb, true,
txdesc.header_length);
+ else if (test_bit(DRIVER_REQUIRE_DMA, &queue->rt2x00dev->flags))
+ rt2x00queue_payload_align(entry->skb, false, 0);
/*
* It could be possible that the queue was corrupted and this
--
1.6.3.3
^ permalink raw reply related
* [PATCH 4/7] rt2x00: Fix quality houskeeping for software diversity
From: Ivo van Doorn @ 2009-08-08 21:54 UTC (permalink / raw)
To: John Linville; +Cc: users, linux-wireless, Lars Ericsson
In-Reply-To: <200908082353.47835.IvDoorn@gmail.com>
From: Lars Ericsson <Lars_Ericsson@telia.com>
Antanna quality statistics is not handled correctly, which leads to
software diversity being shutdown completly.
The main problem is that during antenna diversity statistics can
be reset resulting in loosing the signal strength just before
evaluation.
rssi history is not updated correctly leading to incorrect comparison
material for basing antenna switching on.
Signed-off-by: Lars Ericsson <Lars_Ericsson@telia.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2x00.h | 11 ++---
drivers/net/wireless/rt2x00/rt2x00link.c | 77 +++++++++++++-----------------
2 files changed, 38 insertions(+), 50 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index ee9afab..aa3ff0a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -245,14 +245,11 @@ struct link_ant {
struct antenna_setup active;
/*
- * RSSI information for the different antennas.
- * These statistics are used to determine when
- * to switch antenna when using software diversity.
- *
- * rssi[0] -> Antenna A RSSI
- * rssi[1] -> Antenna B RSSI
+ * RSSI history information for the antenna.
+ * Used to determine when to switch antenna
+ * when using software diversity.
*/
- int rssi_history[2];
+ int rssi_history;
/*
* Current RSSI average of the currently active antenna.
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c
index fe951dc..dd68f3a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00link.c
+++ b/drivers/net/wireless/rt2x00/rt2x00link.c
@@ -103,39 +103,21 @@ static int rt2x00link_antenna_get_link_rssi(struct rt2x00_dev *rt2x00dev)
return DEFAULT_RSSI;
}
-static int rt2x00link_antenna_get_rssi_history(struct rt2x00_dev *rt2x00dev,
- enum antenna antenna)
+static int rt2x00link_antenna_get_rssi_history(struct rt2x00_dev *rt2x00dev)
{
struct link_ant *ant = &rt2x00dev->link.ant;
- if (ant->rssi_history[antenna - ANTENNA_A])
- return ant->rssi_history[antenna - ANTENNA_A];
+ if (ant->rssi_history)
+ return ant->rssi_history;
return DEFAULT_RSSI;
}
-/* Small wrapper for rt2x00link_antenna_get_rssi_history() */
-#define rt2x00link_antenna_get_rssi_rx_history(__dev) \
- rt2x00link_antenna_get_rssi_history((__dev), \
- (__dev)->link.ant.active.rx)
-#define rt2x00link_antenna_get_rssi_tx_history(__dev) \
- rt2x00link_antenna_get_rssi_history((__dev), \
- (__dev)->link.ant.active.tx)
static void rt2x00link_antenna_update_rssi_history(struct rt2x00_dev *rt2x00dev,
- enum antenna antenna,
int rssi)
{
struct link_ant *ant = &rt2x00dev->link.ant;
- ant->rssi_history[ant->active.rx - ANTENNA_A] = rssi;
+ ant->rssi_history = rssi;
}
-/* Small wrapper for rt2x00link_antenna_get_rssi_history() */
-#define rt2x00link_antenna_update_rssi_rx_history(__dev, __rssi) \
- rt2x00link_antenna_update_rssi_history((__dev), \
- (__dev)->link.ant.active.rx, \
- (__rssi))
-#define rt2x00link_antenna_update_rssi_tx_history(__dev, __rssi) \
- rt2x00link_antenna_update_rssi_history((__dev), \
- (__dev)->link.ant.active.tx, \
- (__rssi))
static void rt2x00link_antenna_reset(struct rt2x00_dev *rt2x00dev)
{
@@ -146,8 +128,10 @@ static void rt2x00lib_antenna_diversity_sample(struct rt2x00_dev *rt2x00dev)
{
struct link_ant *ant = &rt2x00dev->link.ant;
struct antenna_setup new_ant;
- int sample_a = rt2x00link_antenna_get_rssi_history(rt2x00dev, ANTENNA_A);
- int sample_b = rt2x00link_antenna_get_rssi_history(rt2x00dev, ANTENNA_B);
+ int other_antenna;
+
+ int sample_current = rt2x00link_antenna_get_link_rssi(rt2x00dev);
+ int sample_other = rt2x00link_antenna_get_rssi_history(rt2x00dev);
memcpy(&new_ant, &ant->active, sizeof(new_ant));
@@ -161,17 +145,22 @@ static void rt2x00lib_antenna_diversity_sample(struct rt2x00_dev *rt2x00dev)
* from both antennas. It now is time to determine
* which antenna demonstrated the best performance.
* When we are already on the antenna with the best
- * performance, then there really is nothing for us
- * left to do.
+ * performance, just create a good starting point
+ * for the history and we are done.
*/
- if (sample_a == sample_b)
+ if (sample_current >= sample_other) {
+ rt2x00link_antenna_update_rssi_history(rt2x00dev,
+ sample_current);
return;
+ }
+
+ other_antenna = (ant->active.rx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A;
if (ant->flags & ANTENNA_RX_DIVERSITY)
- new_ant.rx = (sample_a > sample_b) ? ANTENNA_A : ANTENNA_B;
+ new_ant.rx = other_antenna;
if (ant->flags & ANTENNA_TX_DIVERSITY)
- new_ant.tx = (sample_a > sample_b) ? ANTENNA_A : ANTENNA_B;
+ new_ant.tx = other_antenna;
rt2x00lib_config_antenna(rt2x00dev, new_ant);
}
@@ -190,8 +179,8 @@ static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev)
* after that update the history with the current value.
*/
rssi_curr = rt2x00link_antenna_get_link_rssi(rt2x00dev);
- rssi_old = rt2x00link_antenna_get_rssi_rx_history(rt2x00dev);
- rt2x00link_antenna_update_rssi_rx_history(rt2x00dev, rssi_curr);
+ rssi_old = rt2x00link_antenna_get_rssi_history(rt2x00dev);
+ rt2x00link_antenna_update_rssi_history(rt2x00dev, rssi_curr);
/*
* Legacy driver indicates that we should swap antenna's
@@ -216,7 +205,7 @@ static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev)
rt2x00lib_config_antenna(rt2x00dev, new_ant);
}
-static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
+static bool rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
{
struct link_ant *ant = &rt2x00dev->link.ant;
unsigned int flags = ant->flags;
@@ -238,7 +227,7 @@ static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
if (!(ant->flags & ANTENNA_RX_DIVERSITY) &&
!(ant->flags & ANTENNA_TX_DIVERSITY)) {
ant->flags = 0;
- return;
+ return true;
}
/* Update flags */
@@ -250,10 +239,15 @@ static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
* the data. The latter should only be performed once
* every 2 seconds.
*/
- if (ant->flags & ANTENNA_MODE_SAMPLE)
+ if (ant->flags & ANTENNA_MODE_SAMPLE) {
rt2x00lib_antenna_diversity_sample(rt2x00dev);
- else if (rt2x00dev->link.count & 1)
+ return true;
+ } else if (rt2x00dev->link.count & 1) {
rt2x00lib_antenna_diversity_eval(rt2x00dev);
+ return true;
+ }
+
+ return false;
}
void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
@@ -451,15 +445,12 @@ static void rt2x00link_tuner(struct work_struct *work)
rt2x00leds_led_quality(rt2x00dev, link->avg_rssi);
/*
- * Evaluate antenna setup, make this the last step since this could
- * possibly reset some statistics.
- */
- rt2x00lib_antenna_diversity(rt2x00dev);
-
- /*
- * Reset the quality counters which recounted during each period.
+ * Evaluate antenna setup, make this the last step when
+ * rt2x00lib_antenna_diversity made changes the quality
+ * statistics will be reset.
*/
- rt2x00link_reset_qual(rt2x00dev);
+ if (rt2x00lib_antenna_diversity(rt2x00dev))
+ rt2x00link_reset_qual(rt2x00dev);
/*
* Increase tuner counter, and reschedule the next link tuner run.
--
1.6.3.3
^ permalink raw reply related
* [PATCH 1/7] rt2x00: Remove usage of deprecated radio_enabled & IEEE80211_CONF_CHANGE_RADIO_ENABLED
From: Ivo van Doorn @ 2009-08-08 21:53 UTC (permalink / raw)
To: John Linville; +Cc: users, linux-wireless
In the config() callback function the fields radio_enabled and
the change flag IEEE80211_CONF_CHANGE_RADIO_ENABLED have been
deprecated. This removes the usage of those fields by improving
antenna change detection in the antenna configuration function.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2x00config.c | 22 ++++++++---
drivers/net/wireless/rt2x00/rt2x00dev.c | 7 ++++
drivers/net/wireless/rt2x00/rt2x00link.c | 12 ++++--
drivers/net/wireless/rt2x00/rt2x00mac.c | 54 ++++++++++------------------
4 files changed, 50 insertions(+), 45 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 3845316..3501788 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -124,8 +124,9 @@ enum antenna rt2x00lib_config_antenna_check(enum antenna current_ant,
}
void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
- struct antenna_setup ant)
+ struct antenna_setup config)
{
+ struct link_ant *ant = &rt2x00dev->link.ant;
struct antenna_setup *def = &rt2x00dev->default_ant;
struct antenna_setup *active = &rt2x00dev->link.ant.active;
@@ -134,14 +135,23 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
* ANTENNA_SW_DIVERSITY state to the driver.
* If that happens, fallback to hardware defaults,
* or our own default.
+ * If diversity handling is active for a particular antenna,
+ * we shouldn't overwrite that antenna.
* The calls to rt2x00lib_config_antenna_check()
* might have caused that we restore back to the already
* active setting. If that has happened we can quit.
*/
- ant.rx = rt2x00lib_config_antenna_check(ant.rx, def->rx);
- ant.tx = rt2x00lib_config_antenna_check(ant.tx, def->tx);
+ if (!(ant->flags & ANTENNA_RX_DIVERSITY))
+ config.rx = rt2x00lib_config_antenna_check(config.rx, def->rx);
+ else
+ config.rx = active->rx;
- if (ant.rx == active->rx && ant.tx == active->tx)
+ if (!(ant->flags & ANTENNA_TX_DIVERSITY))
+ config.tx = rt2x00lib_config_antenna_check(config.tx, def->tx);
+ else
+ config.tx = active->tx;
+
+ if (config.rx == active->rx && config.tx == active->tx)
return;
/*
@@ -156,11 +166,11 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
* The latter is required since we need to recalibrate the
* noise-sensitivity ratio for the new setup.
*/
- rt2x00dev->ops->lib->config_ant(rt2x00dev, &ant);
+ rt2x00dev->ops->lib->config_ant(rt2x00dev, &config);
rt2x00link_reset_tuner(rt2x00dev, true);
- memcpy(active, &ant, sizeof(ant));
+ memcpy(active, &config, sizeof(config));
if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK);
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index db54fcc..e0348cc 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -785,6 +785,13 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
rt2x00dev->intf_sta_count = 0;
rt2x00dev->intf_associated = 0;
+ /* Enable the radio */
+ retval = rt2x00lib_enable_radio(rt2x00dev);
+ if (retval) {
+ rt2x00queue_uninitialize(rt2x00dev);
+ return retval;
+ }
+
set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags);
return 0;
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c
index 9178316..fe951dc 100644
--- a/drivers/net/wireless/rt2x00/rt2x00link.c
+++ b/drivers/net/wireless/rt2x00/rt2x00link.c
@@ -219,6 +219,7 @@ static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev)
static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
{
struct link_ant *ant = &rt2x00dev->link.ant;
+ unsigned int flags = ant->flags;
/*
* Determine if software diversity is enabled for
@@ -226,13 +227,13 @@ static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
* Always perform this check since within the link
* tuner interval the configuration might have changed.
*/
- ant->flags &= ~ANTENNA_RX_DIVERSITY;
- ant->flags &= ~ANTENNA_TX_DIVERSITY;
+ flags &= ~ANTENNA_RX_DIVERSITY;
+ flags &= ~ANTENNA_TX_DIVERSITY;
if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
- ant->flags |= ANTENNA_RX_DIVERSITY;
+ flags |= ANTENNA_RX_DIVERSITY;
if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
- ant->flags |= ANTENNA_TX_DIVERSITY;
+ flags |= ANTENNA_TX_DIVERSITY;
if (!(ant->flags & ANTENNA_RX_DIVERSITY) &&
!(ant->flags & ANTENNA_TX_DIVERSITY)) {
@@ -240,6 +241,9 @@ static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
return;
}
+ /* Update flags */
+ ant->flags = flags;
+
/*
* If we have only sampled the data over the last period
* we should now harvest the data. Otherwise just evaluate
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 81febdf..4164fce 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -338,7 +338,6 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
{
struct rt2x00_dev *rt2x00dev = hw->priv;
struct ieee80211_conf *conf = &hw->conf;
- int status;
/*
* mac80211 might be calling this function while we are trying
@@ -348,44 +347,29 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
return 0;
/*
- * Only change device state when the radio is enabled. It does not
- * matter what parameters we have configured when the radio is disabled
- * because we won't be able to send or receive anyway. Also note that
- * some configuration parameters (e.g. channel and antenna values) can
- * only be set when the radio is enabled.
+ * Some configuration parameters (e.g. channel and antenna values) can
+ * only be set when the radio is enabled, but do require the RX to
+ * be off.
*/
- if (conf->radio_enabled) {
- /* For programming the values, we have to turn RX off */
- rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
+ rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
- /* Enable the radio */
- status = rt2x00lib_enable_radio(rt2x00dev);
- if (unlikely(status))
- return status;
+ /*
+ * When we've just turned on the radio, we want to reprogram
+ * everything to ensure a consistent state
+ */
+ rt2x00lib_config(rt2x00dev, conf, changed);
- /*
- * When we've just turned on the radio, we want to reprogram
- * everything to ensure a consistent state
- */
- rt2x00lib_config(rt2x00dev, conf, changed);
+ /*
+ * After the radio has been enabled we need to configure
+ * the antenna to the default settings. rt2x00lib_config_antenna()
+ * should determine if any action should be taken based on
+ * checking if diversity has been enabled or no antenna changes
+ * have been made since the last configuration change.
+ */
+ rt2x00lib_config_antenna(rt2x00dev, rt2x00dev->default_ant);
- /*
- * The radio was enabled, configure the antenna to the
- * default settings, the link tuner will later start
- * continue configuring the antenna based on the software
- * diversity. But for non-diversity configurations, we need
- * to have configured the correct state now.
- */
- if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED)
- rt2x00lib_config_antenna(rt2x00dev,
- rt2x00dev->default_ant);
-
- /* Turn RX back on */
- rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
- } else {
- /* Disable the radio */
- rt2x00lib_disable_radio(rt2x00dev);
- }
+ /* Turn RX back on */
+ rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
return 0;
}
--
1.6.3.3
^ permalink raw reply related
* [PATCH 2/7] rt2x00: Use IEEE80211_TX_CTL_MORE_FRAMES flag
From: Ivo van Doorn @ 2009-08-08 21:53 UTC (permalink / raw)
To: John Linville; +Cc: users, linux-wireless
In-Reply-To: <200908082353.04274.IvDoorn@gmail.com>
Check the IEEE80211_TX_CTL_MORE_FRAMES flag to help determining
if the DMA queue should be kicked. At the moment this is combined
with the ieee80211_has_morefrags() but we might remove that later.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2x00queue.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 44e5b32..65435c9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -324,7 +324,8 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
/*
* Check if more fragments are pending
*/
- if (ieee80211_has_morefrags(hdr->frame_control)) {
+ if (ieee80211_has_morefrags(hdr->frame_control) ||
+ (tx_info->flags & IEEE80211_TX_CTL_MORE_FRAMES)) {
__set_bit(ENTRY_TXD_BURST, &txdesc->flags);
__set_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags);
}
--
1.6.3.3
^ permalink raw reply related
* [PATCH] mac80211: remove max_bandwidth
From: Pat Erley @ 2009-08-08 21:53 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes, Pat Erley
This removes the max_bandwidth attribute. It is only ever
written to, and is duplicated by max_bandwidth_khz in the
regulatory code.
Signed-off-by: Pat Erley <pat-lkml@erley.org>
---
include/net/cfg80211.h | 2 --
net/wireless/reg.c | 3 ---
2 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index d5756c9..2239134 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -80,7 +80,6 @@ enum ieee80211_channel_flags {
* with cfg80211.
*
* @center_freq: center frequency in MHz
- * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
* @hw_value: hardware-specific value for the channel
* @flags: channel flags from &enum ieee80211_channel_flags.
* @orig_flags: channel flags at registration time, used by regulatory
@@ -97,7 +96,6 @@ enum ieee80211_channel_flags {
struct ieee80211_channel {
enum ieee80211_band band;
u16 center_freq;
- u8 max_bandwidth;
u16 hw_value;
u32 flags;
int max_antenna_gain;
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 0f61ae6..fc7a484 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1018,7 +1018,6 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
map_regdom_flags(reg_rule->flags) | bw_flags;
chan->max_antenna_gain = chan->orig_mag =
(int) MBI_TO_DBI(power_rule->max_antenna_gain);
- chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
chan->max_power = chan->orig_mpwr =
(int) MBM_TO_DBM(power_rule->max_eirp);
return;
@@ -1027,7 +1026,6 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
chan->flags = flags | bw_flags | map_regdom_flags(reg_rule->flags);
chan->max_antenna_gain = min(chan->orig_mag,
(int) MBI_TO_DBI(power_rule->max_antenna_gain));
- chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
if (chan->orig_mpwr)
chan->max_power = min(chan->orig_mpwr,
(int) MBM_TO_DBM(power_rule->max_eirp));
@@ -1329,7 +1327,6 @@ static void handle_channel_custom(struct wiphy *wiphy,
chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags;
chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain);
- chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
}
--
1.6.4
^ permalink raw reply related
* WARNING: at net/wireless/chan.c:19 rdev_fixed_channel
From: Kalle Valo @ 2009-08-08 20:18 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
I resumed my thinkpad x60s laptop (iwl3945, 32bit, old wpa_supplicant,
latest wireless-testing plus Johannes' siwfreq locking fix) and got the
warning below. Everything still worked, it automatically associated to a
WPA2 network and I'm sending this over that connection.
I have seen the page table error since rc2 or so, and I have been too
lazy to investigate it. I assume it's not related to the warning.
[30295.568384] phy0: device no longer idle - scanning
[30295.569126] phy0: device now idle
[30295.587033] render error detected, EIR: 0x00000010
[30295.587040] page table error
[30295.587043] PGTBL_ER: 0x00000001
[30295.587049] [drm:i915_driver_irq_handler] *ERROR* EIR stuck:
0x00000010, masking
[30295.587066] render error detected, EIR: 0x00000010
[30295.587070] page table error
[30295.587073] PGTBL_ER: 0x00000001
[30295.814045] ------------[ cut here ]------------
[30295.814088] WARNING: at net/wireless/chan.c:19
rdev_fixed_channel+0x28/0x7d [cfg80211]()
[30295.814094] Hardware name: 1703Y1F
[30295.814097] Modules linked in: tun cdc_ether usbnet cdc_acm mii i915
drm i2c_algo_bit sco bnep rfcomm l2cap binfmt_misc ipv6 fuse
acpi_cpufreq loop snd_hda_codec_analog snd_hda_intel snd_hda_codec arc4
ecb snd_pcm_oss snd_mixer_oss snd_pcm iwl3945 snd_seq_dummy snd_seq_oss
iwlcore snd_seq_midi_event mac80211 snd_seq pcmcia snd_timer
snd_seq_device cfg80211 btusb snd thinkpad_acpi yenta_socket bluetooth
soundcore rsrc_nonstatic rfkill rng_core battery ac button
snd_page_alloc pcmcia_core psmouse pcspkr nvram i2c_i801 evdev processor
ext3 jbd sha256_generic aes_i586 aes_generic cbc dm_crypt dm_mirror
dm_region_hash dm_log dm_snapshot dm_mod sd_mod sdhci_pci sdhci ata_piix
mmc_core led_class libata uhci_hcd ehci_hcd scsi_mod usbcore e1000e
video backlight output thermal fan
[30295.814237] Pid: 9925, comm: ip Tainted: G W 2.6.31-rc5-wl
#205
[30295.814242] Call Trace:
[30295.814254] [<c102965e>] warn_slowpath_common+0x65/0x95
[30295.814262] [<c10296a0>] warn_slowpath_null+0x12/0x15
[30295.814289] [<f8d09ecc>] rdev_fixed_channel+0x28/0x7d [cfg80211]
[30295.814317] [<f8d08e93>] __cfg80211_connect+0x50/0x385 [cfg80211]
[30295.814343] [<f8d0bf49>] cfg80211_mgd_wext_connect+0x101/0x11e
[cfg80211]
[30295.814368] [<f8cfc308>] cfg80211_netdev_notifier_call+0x218/0x2b3
[cfg80211]
[30295.814379] [<c103ea43>] notifier_call_chain+0x2b/0x55
[30295.814387] [<c103eb10>] raw_notifier_call_chain+0x11/0x13
[30295.814395] [<c1180d40>] dev_open+0xc9/0xd3
[30295.814404] [<c1180427>] dev_change_flags+0xaa/0x15f
[30295.814412] [<c1187580>] do_setlink+0x239/0x2f1
[30295.814421] [<c11886e4>] rtnl_newlink+0x275/0x3ef
[30295.814428] [<c11884a3>] ? rtnl_newlink+0x34/0x3ef
[30295.814435] [<c11884ec>] ? rtnl_newlink+0x7d/0x3ef
[30295.814444] [<c1187b00>] ? rtnl_fill_ifinfo+0x25f/0x4c2
[30295.814452] [<c118846f>] ? rtnl_newlink+0x0/0x3ef
[30295.814460] [<c1188455>] rtnetlink_rcv_msg+0x18f/0x1a9
[30295.814468] [<c11882c6>] ? rtnetlink_rcv_msg+0x0/0x1a9
[30295.814476] [<c118ebf7>] netlink_rcv_skb+0x35/0x7a
[30295.814483] [<c11882be>] rtnetlink_rcv+0x21/0x29
[30295.814490] [<c118e7eb>] netlink_unicast+0xcb/0x121
[30295.814498] [<c118ea63>] netlink_sendmsg+0x222/0x22f
[30295.814507] [<c1173b30>] sock_sendmsg+0xcf/0xe6
[30295.814516] [<c103b2d7>] ? autoremove_wake_function+0x0/0x38
[30295.814525] [<c103b2d7>] ? autoremove_wake_function+0x0/0x38
[30295.814533] [<c103b2d7>] ? autoremove_wake_function+0x0/0x38
[30295.814542] [<c106ffab>] ? get_page_from_freelist+0x8b/0x35a
[30295.814550] [<c10f34c0>] ? copy_from_user+0x2f/0x117
[30295.814557] [<c10f34c0>] ? copy_from_user+0x2f/0x117
[30295.814565] [<c117ab99>] ? verify_iovec+0x45/0x74
[30295.814572] [<c1173c8b>] sys_sendmsg+0x144/0x197
[30295.814580] [<c11745d9>] ? sys_recvmsg+0x11a/0x17f
[30295.814588] [<c1070521>] ? __alloc_pages_nodemask+0xe0/0x422
[30295.814597] [<c1081524>] ? vma_merge+0x138/0x229
[30295.814605] [<c1072955>] ? lru_cache_add_lru+0x2c/0x2e
[30295.814613] [<c1083cbf>] ? page_add_new_anon_rmap+0x5d/0x6a
[30295.814622] [<c107df6a>] ? handle_mm_fault+0x1a8/0x48d
[30295.814630] [<c1174ac5>] sys_socketcall+0x145/0x172
[30295.814638] [<c1002a08>] sysenter_do_call+0x12/0x26
[30295.814644] ---[ end trace 63d0b9ce8430ae90 ]---
[30295.814655] ADDRCONF(NETDEV_UP): wlan0: link is not ready
[30300.572081] phy0: device no longer idle - scanning
[30303.159685] phy0: device now idle
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH v4] cfg80211: validate channel settings across interfaces
From: Kalle Valo @ 2009-08-08 20:10 UTC (permalink / raw)
To: Larry Finger
Cc: reinette chatre, Johannes Berg, John Linville, linux-wireless,
Luis R. Rodriguez
In-Reply-To: <4A7DD307.6090209@lwfinger.net>
Larry Finger <Larry.Finger@lwfinger.net> writes:
>> For example, when I run:
>> $ iwconfig wlan0 channel <ch> essid <essid>
>>
>> then the command prompt never returns and system becomes progressively
>> unresponsive. The logs do not contain any details of the problem.
>
> I have the same problem here as well.
This patch fixes the issue:
commit 21e433f9ea04c319cc12b4094f292a8f1ad709e9
Author: Johannes Berg <johannes@sipsolutions.net>
Date: Sat Aug 8 11:03:58 2009 +0200
cfg80211: fix locking for SIWFREQ
Johannes sent it to the list this today and it's not in wireless-testing
yet.
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH 16/16] iwlwifi: disable powersave mode
From: reinette chatre @ 2009-08-08 19:36 UTC (permalink / raw)
To: Kalle Valo
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
ipw3945-devel@lists.sourceforge.net, Guy, Wey-Yi W
In-Reply-To: <878whun256.fsf@litku.valot.fi>
Hi Kalle,
Thank you for looking at our patches. You have great feedback.
On Sat, 2009-08-08 at 01:25 -0700, Kalle Valo wrote:
> Reinette Chatre <reinette.chatre@intel.com> writes:
>
> > From: Wey-Yi Guy <wey-yi.w.guy@intel.com>
> >
> > The enabling of powersaving had a big impact on reliability and
> > performance. Throughput on n band suffered especially. With power save
> > support enabled we see significant ping response times, dropped frames, and
> > reduced throughput. These are captured in the following bug reports:
> >
> > http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2051
> > http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2053
> >
> > Disable power save by default, add "iwl_support_ps" module parameter
> > that can be used to enable it again.
>
> You are again creating driver specific parameters. But we should be
> moving away from this and instead use just generic interfaces. Please,
> think three times (or even more) whenever creating new driver specific
> interfaces, be it module parameters, sysfs files etc.. It's a
> maintenance nightmare and also very confusing for the users. We need to
> focus on nl80211 and make it work properly with all drivers.
What we have done here is not intended to be maintained at all - this is
why the module parameter description reads "power save support
(deprecated) (default disabled)" - it is deprecated from the beginning.
>
> For the problem at hand, I see two options:
>
> 1. Users seeing the problem disable power save either via wext or with
> CONFIG_CFG80211_DEFAULT_PS and everyone else still can use power
> save. The issue will be investigated and fixed. If the AP is buggy,
> there isn't much we can do.
Please take a look at those bug reports. What we are seeing is huge ping
delays ( > 1000ms rtt), dropped frames which is stalling connections,
and throughput dropping in half. This is too severe to have powersave
enabled at this time.
>
> 2. If you think the problem is widespread, remove
> IEEE80211_HW_SUPPORTS_PS from the driver, fix the issues and renable
> power save support.
Yes - this is the goal of this patch. At the same time we would also
like to make it easier for the people who are testing this issue right
now and having the module parameter makes their life easier.
This module parameter is a temporary measure used to help us fix the
power save issues. When the issues have been resolved we will enable
power save support by default and remove the module parameter.
Reinette
^ permalink raw reply
* Re: [PATCH v4] cfg80211: validate channel settings across interfaces
From: Larry Finger @ 2009-08-08 19:33 UTC (permalink / raw)
To: reinette chatre
Cc: Johannes Berg, John Linville, linux-wireless, Luis R. Rodriguez
In-Reply-To: <1249712383.30019.5561.camel@rc-desk>
reinette chatre wrote:
> Hi Johannes,
>
> This patch is now in wireless-testing and it is causing a problem for
> me. This was determined using bisect.
>
> I am able to bring the interface up and scan, but when I try to
> associate I get a hang.
>
> For example, when I run:
> $ iwconfig wlan0 channel <ch> essid <essid>
>
> then the command prompt never returns and system becomes progressively
> unresponsive. The logs do not contain any details of the problem.
I have the same problem here as well.
Larry
^ permalink raw reply
* Re: [PATCH] drivers/net/wireless/ath/ath5k: Change constant name
From: Bob Copeland @ 2009-08-08 16:20 UTC (permalink / raw)
To: Julia Lawall
Cc: Luis R. Rodriguez, Nick Kossifidis, Jiri Slaby, ath5k-devel,
linux-wireless, netdev, linux-kernel, kernel-janitors, linville
In-Reply-To: <Pine.LNX.4.64.0908081521210.27715@ask.diku.dk>
On Sat, Aug 08, 2009 at 03:22:26PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> Elsewhere, the tqi_type field is compared to constants having a name
> beginning with AR5K_TX_QUEUE, rather than AR5K_TX_QUEUE_ID. I have thus
> converted AR5K_TX_QUEUE_ID_CAB to AR5K_TX_QUEUE_CAB. This does, however,
> change the value, so perhaps something else was wanted.
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Nice catch, thanks. Shouldn't cause any problem with 2.6.31 since we
don't use the CAB queue yet, but it was definitely wrong.
Acked-by: Bob Copeland <me@bobcopeland.com>
> diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c
> index 6d5aaf0..eeebb9a 100644
> --- a/drivers/net/wireless/ath/ath5k/qcu.c
> +++ b/drivers/net/wireless/ath/ath5k/qcu.c
> @@ -362,7 +362,7 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
> }
>
> if (tq->tqi_ready_time &&
> - (tq->tqi_type != AR5K_TX_QUEUE_ID_CAB))
> + (tq->tqi_type != AR5K_TX_QUEUE_CAB))
> ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_ready_time,
> AR5K_QCU_RDYTIMECFG_INTVAL) |
> AR5K_QCU_RDYTIMECFG_ENABLE,
>
--
Bob Copeland %% www.bobcopeland.com
^ permalink raw reply
* [PATCH] ar9170usb: fix spurious firmware related message
From: Christian Lamparter @ 2009-08-08 15:09 UTC (permalink / raw)
To: wireless; +Cc: John W. Linville
When ar9170-2.fw was missing, the driver erroneously complained
about missing the initialization values file ar9170-1.fw...
Signed-off-by: Christian Lamparter <chunkeey@web.de>
---
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
index 1aec7af..e0138ac 100644
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -598,11 +598,15 @@ static int ar9170_usb_request_firmware(struct ar9170_usb *aru)
err = request_firmware(&aru->init_values, "ar9170-1.fw",
&aru->udev->dev);
+ if (err) {
+ dev_err(&aru->udev->dev, "file with init values not found.\n");
+ return err;
+ }
err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev);
if (err) {
release_firmware(aru->init_values);
- dev_err(&aru->udev->dev, "file with init values not found.\n");
+ dev_err(&aru->udev->dev, "firmware file not found.\n");
return err;
}
^ permalink raw reply related
* Re: Libertas: Association request to the driver failed
From: Roel Kluin @ 2009-08-08 14:24 UTC (permalink / raw)
To: Daniel Mack; +Cc: John W. Linville, libertas-dev, linux-wireless, linux-kernel
In-Reply-To: <20090808123512.GZ19257@buzzloop.caiaq.de>
>>> Since a recent merge of the wireless tree to Linus' master, my SDIO
>>> connected libertas module fails to connect to our WLAN.
>>>
>>> 'iwlist scanning' works fine, but wpa_supplicant keeps on spitting out
>>> the following message:
>>>
>>> CTRL-EVENT-SCAN-RESULTS
>>> Trying to associate with 00:04:0e:4b:c7:b3 (SSID='caiaq' freq=2437 MHz)
>>> Association request to the driver failed
>> In this case, there
>> is only this on libertas patch in the range you mention:
>
> I was wrong with the range I provided. The change came in after -rc5,
> and I found 57921c31 ("libertas: Read buffer overflow") to be the
> culprit. Reverting it brings my libertas device back to life. I copied
> the author.
>
> Thanks,
> Daniel
Ah, I think I made an error, I think tmp is too small and should be
u8 tmp[*rates_size * ARRAY_SIZE(lbs_bg_rates) - 1];
Can we revert and does the patch below work?
Sorry and thanks for testing,
Roel
commit 57921c312e8cef72ba35a4cfe870b376da0b1b87
Author: Roel Kluin <roel.kluin@gmail.com>
Date: Tue Jul 28 12:05:00 2009 +0200
libertas: Read buffer overflow
Several arrays were read before checking whether the index was within
bounds. ARRAY_SIZE() should be used to determine the size of arrays.
rates->rates has an arraysize of 1, so calling get_common_rates()
with a rates_size of MAX_RATES (14) was causing reads out of bounds.
tmp_size can increment at most to (ARRAY_SIZE(lbs_bg_rates) - 1) *
(*rates_size - 1), so that should be the number of elements of tmp[].
A goto can be eliminated: ret was already set upon its declaration.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index b9b3741..d699737 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -1,6 +1,7 @@
/* Copyright (C) 2006, Red Hat, Inc. */
#include <linux/types.h>
+#include <linux/kernel.h>
#include <linux/etherdevice.h>
#include <linux/ieee80211.h>
#include <linux/if_arp.h>
@@ -43,21 +44,21 @@ static int get_common_rates(struct lbs_private *priv,
u16 *rates_size)
{
u8 *card_rates = lbs_bg_rates;
- size_t num_card_rates = sizeof(lbs_bg_rates);
int ret = 0, i, j;
- u8 tmp[30];
+ u8 tmp[*rates_size * ARRAY_SIZE(lbs_bg_rates) - 1];
size_t tmp_size = 0;
/* For each rate in card_rates that exists in rate1, copy to tmp */
- for (i = 0; card_rates[i] && (i < num_card_rates); i++) {
- for (j = 0; rates[j] && (j < *rates_size); j++) {
+ for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) {
+ for (j = 0; j < *rates_size && rates[j]; j++) {
if (rates[j] == card_rates[i])
tmp[tmp_size++] = card_rates[i];
}
}
lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size);
- lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates);
+ lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates,
+ ARRAY_SIZE(lbs_bg_rates));
lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size);
lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate);
@@ -69,10 +70,7 @@ static int get_common_rates(struct lbs_private *priv,
lbs_pr_alert("Previously set fixed data rate %#x isn't "
"compatible with the network.\n", priv->cur_rate);
ret = -1;
- goto done;
}
- ret = 0;
-
done:
memset(rates, 0, *rates_size);
*rates_size = min_t(int, tmp_size, *rates_size);
@@ -322,7 +320,7 @@ static int lbs_associate(struct lbs_private *priv,
rates = (struct mrvl_ie_rates_param_set *) pos;
rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
memcpy(&rates->rates, &bss->rates, MAX_RATES);
- tmplen = MAX_RATES;
+ tmplen = min_t(u16, ARRAY_SIZE(rates->rates), MAX_RATES);
if (get_common_rates(priv, rates->rates, &tmplen)) {
ret = -1;
goto done;
@@ -598,7 +596,7 @@ static int lbs_adhoc_join(struct lbs_private *priv,
/* Copy Data rates from the rates recorded in scan response */
memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates));
- ratesize = min_t(u16, sizeof(cmd.bss.rates), MAX_RATES);
+ ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), MAX_RATES);
memcpy(cmd.bss.rates, bss->rates, ratesize);
if (get_common_rates(priv, cmd.bss.rates, &ratesize)) {
lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n");
^ permalink raw reply related
* [PATCH] drivers/net/wireless/ath/ath5k: Change constant name
From: Julia Lawall @ 2009-08-08 13:22 UTC (permalink / raw)
To: Bob Copeland, Luis R. Rodriguez, Nick Kossifidis, Jiri Slaby,
ath5k-devel, linux-wireless, netdev, linux-kernel,
kernel-janitors
From: Julia Lawall <julia@diku.dk>
Elsewhere, the tqi_type field is compared to constants having a name
beginning with AR5K_TX_QUEUE, rather than AR5K_TX_QUEUE_ID. I have thus
converted AR5K_TX_QUEUE_ID_CAB to AR5K_TX_QUEUE_CAB. This does, however,
change the value, so perhaps something else was wanted.
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/wireless/ath/ath5k/qcu.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c
index 6d5aaf0..eeebb9a 100644
--- a/drivers/net/wireless/ath/ath5k/qcu.c
+++ b/drivers/net/wireless/ath/ath5k/qcu.c
@@ -362,7 +362,7 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
}
if (tq->tqi_ready_time &&
- (tq->tqi_type != AR5K_TX_QUEUE_ID_CAB))
+ (tq->tqi_type != AR5K_TX_QUEUE_CAB))
ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_ready_time,
AR5K_QCU_RDYTIMECFG_INTVAL) |
AR5K_QCU_RDYTIMECFG_ENABLE,
^ permalink raw reply related
* [PATCH 7/7] [compat-2.6] Remove unsed code.
From: Hauke Mehrtens @ 2009-08-08 12:38 UTC (permalink / raw)
To: lrodriguez; +Cc: linux-wireless, Hauke Mehrtens
In-Reply-To: <1249735096-27071-1-git-send-email-hauke@hauke-m.de>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
compat/compat-2.6.28.c | 40 ----------------------------------------
compat/compat-2.6.28.h | 3 ---
2 files changed, 0 insertions(+), 43 deletions(-)
diff --git a/compat/compat-2.6.28.c b/compat/compat-2.6.28.c
index 33871a2..965be80 100644
--- a/compat/compat-2.6.28.c
+++ b/compat/compat-2.6.28.c
@@ -167,46 +167,6 @@ struct urb *usb_get_from_anchor(struct usb_anchor *anchor)
EXPORT_SYMBOL_GPL(usb_get_from_anchor);
-/**
- * usb_scuttle_anchored_urbs - unanchor all an anchor's urbs
- * @anchor: the anchor whose urbs you want to unanchor
- *
- * use this to get rid of all an anchor's urbs
- */
-void usb_scuttle_anchored_urbs(struct usb_anchor *anchor)
-{
- struct urb *victim;
- unsigned long flags;
-
- spin_lock_irqsave(&anchor->lock, flags);
- while (!list_empty(&anchor->urb_list)) {
- victim = list_entry(anchor->urb_list.prev, struct urb,
- anchor_list);
- usb_get_urb(victim);
- spin_unlock_irqrestore(&anchor->lock, flags);
- /* this may free the URB */
- usb_unanchor_urb(victim);
- usb_put_urb(victim);
- spin_lock_irqsave(&anchor->lock, flags);
- }
- spin_unlock_irqrestore(&anchor->lock, flags);
-}
-
-EXPORT_SYMBOL_GPL(usb_scuttle_anchored_urbs);
-
-/**
- * usb_anchor_empty - is an anchor empty
- * @anchor: the anchor you want to query
- *
- * returns 1 if the anchor has no urbs associated with it
- */
-int usb_anchor_empty(struct usb_anchor *anchor)
-{
- return list_empty(&anchor->urb_list);
-}
-
-EXPORT_SYMBOL_GPL(usb_anchor_empty);
-
void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
{
diff --git a/compat/compat-2.6.28.h b/compat/compat-2.6.28.h
index e25259f..0a305d2 100644
--- a/compat/compat-2.6.28.h
+++ b/compat/compat-2.6.28.h
@@ -47,9 +47,6 @@ extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
#endif
extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
-extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
-extern int usb_anchor_empty(struct usb_anchor *anchor);
-
void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
--
1.6.2.1
^ permalink raw reply related
* [PATCH 5/7] [compat-2.6] Remove wext building
From: Hauke Mehrtens @ 2009-08-08 12:38 UTC (permalink / raw)
To: lrodriguez; +Cc: linux-wireless, Hauke Mehrtens
In-Reply-To: <1249735096-27071-1-git-send-email-hauke@hauke-m.de>
wext can not be build as a module. We do not need to build it,
so remove it from the Makefile.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
compat/patches/99-change-makefiles.patch | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/compat/patches/99-change-makefiles.patch b/compat/patches/99-change-makefiles.patch
index 19e5d1d..b5a0f10 100644
--- a/compat/patches/99-change-makefiles.patch
+++ b/compat/patches/99-change-makefiles.patch
@@ -84,3 +84,10 @@ only the wireless stuff.
obj-$(CONFIG_LIBERTAS) += libertas/
obj-$(CONFIG_LIBERTAS_THINFIRM) += libertas_tf/
+--- a/net/wireless/Makefile
++++ b/net/wireless/Makefile
+@@ -1,4 +1,3 @@
+-obj-$(CONFIG_WIRELESS_EXT) += wext.o
+ obj-$(CONFIG_CFG80211) += cfg80211.o
+ obj-$(CONFIG_LIB80211) += lib80211.o
+ obj-$(CONFIG_LIB80211_CRYPT_WEP) += lib80211_crypt_wep.o
--
1.6.2.1
^ permalink raw reply related
* [PATCH 6/7] [compat-2.6] Rename CONFIG_IWL4965 symbol
From: Hauke Mehrtens @ 2009-08-08 12:38 UTC (permalink / raw)
To: lrodriguez; +Cc: linux-wireless, Hauke Mehrtens
In-Reply-To: <1249735096-27071-1-git-send-email-hauke@hauke-m.de>
In kernel 2.6.26 and older CONFIG_IWL4965 was build as an extra
module, but now it is directly included in the iwlagn.
CONFIG_IWL4965 has to be set to y, to build correctly.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
compat/patches/09-rename-iwl4965-config.patch | 31 +++++++++++++++++++++++++
config.mk | 2 +-
2 files changed, 32 insertions(+), 1 deletions(-)
create mode 100644 compat/patches/09-rename-iwl4965-config.patch
diff --git a/compat/patches/09-rename-iwl4965-config.patch b/compat/patches/09-rename-iwl4965-config.patch
new file mode 100644
index 0000000..e539c75
--- /dev/null
+++ b/compat/patches/09-rename-iwl4965-config.patch
@@ -0,0 +1,31 @@
+In kernel 2.6.26 and older CONFIG_IWL4965 was build as an extra
+module, but now it is directly included in the iwlagn.
+
+CONFIG_IWL4965 has to be set to y, to build correctly.
+
+--- a/drivers/net/wireless/iwlwifi/Makefile
++++ b/drivers/net/wireless/iwlwifi/Makefile
+@@ -9,7 +9,7 @@ iwlcore-$(CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT) += iwl-spectrum.o
+ obj-$(CONFIG_IWLAGN) += iwlagn.o
+ iwlagn-objs := iwl-agn.o iwl-agn-rs.o
+
+-iwlagn-$(CONFIG_IWL4965) += iwl-4965.o
++iwlagn-$(CONFIG_COMPAT_IWL4965) += iwl-4965.o
+ iwlagn-$(CONFIG_IWL5000) += iwl-5000.o
+ iwlagn-$(CONFIG_IWL5000) += iwl-6000.o
+ iwlagn-$(CONFIG_IWL5000) += iwl-1000.o
+--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
++++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
+@@ -3088,10 +3088,10 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
+
+ /* Hardware specific file defines the PCI IDs table for that hardware module */
+ static struct pci_device_id iwl_hw_card_ids[] = {
+-#ifdef CONFIG_IWL4965
++#ifdef CONFIG_COMPAT_IWL4965
+ {IWL_PCI_DEVICE(0x4229, PCI_ANY_ID, iwl4965_agn_cfg)},
+ {IWL_PCI_DEVICE(0x4230, PCI_ANY_ID, iwl4965_agn_cfg)},
+-#endif /* CONFIG_IWL4965 */
++#endif /* CONFIG_COMPAT_IWL4965 */
+ #ifdef CONFIG_IWL5000
+ {IWL_PCI_DEVICE(0x4232, 0x1205, iwl5100_bg_cfg)},
+ {IWL_PCI_DEVICE(0x4232, 0x1305, iwl5100_bg_cfg)},
diff --git a/config.mk b/config.mk
index 0d8962b..2dab9af 100644
--- a/config.mk
+++ b/config.mk
@@ -135,7 +135,7 @@ CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT=y
# CONFIG_IWLWIFI_DEBUG=y
# CONFIG_IWLWIFI_DEBUGFS=y
CONFIG_IWLAGN=m
-CONFIG_IWL4965=y
+CONFIG_COMPAT_IWL4965=y
CONFIG_IWL5000=y
CONFIG_IWL3945=m
CONFIG_IWL3945_SPECTRUM_MEASUREMENT=y
--
1.6.2.1
^ permalink raw reply related
* [PATCH 4/7] [compat-2.6] Clean up compat-2.6.26.c
From: Hauke Mehrtens @ 2009-08-08 12:38 UTC (permalink / raw)
To: lrodriguez; +Cc: linux-wireless, Hauke Mehrtens
In-Reply-To: <1249735096-27071-1-git-send-email-hauke@hauke-m.de>
The exported methods are not used.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
compat/compat-2.6.26.c | 107 ------------------------------------------------
1 files changed, 0 insertions(+), 107 deletions(-)
diff --git a/compat/compat-2.6.26.c b/compat/compat-2.6.26.c
index 206e2f1..960a79a 100644
--- a/compat/compat-2.6.26.c
+++ b/compat/compat-2.6.26.c
@@ -19,75 +19,6 @@
/* All things not in 2.6.25 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
-#include <linux/kobject.h>
-#include <linux/string.h>
-#include <linux/module.h>
-#include <linux/stat.h>
-#include <linux/slab.h>
-
-static void device_create_release(struct device *dev)
-{
- pr_debug("device: '%s': %s\n", dev->bus_id, __func__);
- kfree(dev);
-}
-
-/**
- * device_create_vargs - creates a device and registers it with sysfs
- * @class: pointer to the struct class that this device should be registered to
- * @parent: pointer to the parent struct device of this new device, if any
- * @devt: the dev_t for the char device to be added
- * @drvdata: the data to be added to the device for callbacks
- * @fmt: string for the device's name
- * @args: va_list for the device's name
- *
- * This function can be used by char device classes. A struct device
- * will be created in sysfs, registered to the specified class.
- *
- * A "dev" file will be created, showing the dev_t for the device, if
- * the dev_t is not 0,0.
- * If a pointer to a parent struct device is passed in, the newly created
- * struct device will be a child of that device in sysfs.
- * The pointer to the struct device will be returned from the call.
- * Any further sysfs files that might be required can be created using this
- * pointer.
- *
- * Note: the struct class passed to this function must have previously
- * been created with a call to class_create().
- */
-struct device *device_create_vargs(struct class *class, struct device *parent,
- dev_t devt, void *drvdata, const char *fmt,
- va_list args)
-{
- struct device *dev = NULL;
- int retval = -ENODEV;
-
- if (class == NULL || IS_ERR(class))
- goto error;
-
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
- if (!dev) {
- retval = -ENOMEM;
- goto error;
- }
-
- dev->devt = devt;
- dev->class = class;
- dev->parent = parent;
- dev->release = device_create_release;
- dev_set_drvdata(dev, drvdata);
-
- vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args);
- retval = device_register(dev);
- if (retval)
- goto error;
-
- return dev;
-
-error:
- kfree(dev);
- return ERR_PTR(retval);
-}
-EXPORT_SYMBOL_GPL(device_create_vargs);
/**
* kobject_set_name_vargs - Set the name of an kobject
@@ -134,43 +65,5 @@ int dev_set_name(struct device *dev, const char *fmt, ...)
}
EXPORT_SYMBOL_GPL(dev_set_name);
-
-/**
- * device_create_drvdata - creates a device and registers it with sysfs
- * @class: pointer to the struct class that this device should be registered to
- * @parent: pointer to the parent struct device of this new device, if any
- * @devt: the dev_t for the char device to be added
- * @drvdata: the data to be added to the device for callbacks
- * @fmt: string for the device's name
- *
- * This function can be used by char device classes. A struct device
- * will be created in sysfs, registered to the specified class.
- *
- * A "dev" file will be created, showing the dev_t for the device, if
- * the dev_t is not 0,0.
- * If a pointer to a parent struct device is passed in, the newly created
- * struct device will be a child of that device in sysfs.
- * The pointer to the struct device will be returned from the call.
- * Any further sysfs files that might be required can be created using this
- * pointer.
- *
- * Note: the struct class passed to this function must have previously
- * been created with a call to class_create().
- */
-struct device *device_create_drvdata(struct class *class,
- struct device *parent,
- dev_t devt,
- void *drvdata,
- const char *fmt, ...)
-{
- va_list vargs;
- struct device *dev;
-
- va_start(vargs, fmt);
- dev = device_create_vargs(class, parent, devt, drvdata, fmt, vargs);
- va_end(vargs);
- return dev;
-}
-EXPORT_SYMBOL_GPL(device_create_drvdata);
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) */
--
1.6.2.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox