2008-08-15 02:04:41

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 00/15] iwlwifi driver 08/15 updates

Hi,

Here are some fix and cleanup for iwlwifi and mac80211. Note mac80211
patches 07~10 are already submitted by Tomas Winkler before.

Thanks,
-yi

[PATCH 01/15] iwlwifi: Added bss_info_changed callback to 3945
[PATCH 02/15] iwlwifi: W/A for the TSF correction in IBSS
[PATCH 03/15] iwlwifi: clean up hw scan handler
[PATCH 04/15] iwlwifi: remove obsolete 4965 forward declarations
[PATCH 05/15] iwlwifi: allow consecutive scans in unassociated state
[PATCH 06/15] iwlwifi: align set channel with mac80211
[PATCH 07/15] mac80211: filter probes in ieee80211_rx_mgmt_probe_resp
[PATCH 08/15] mac80211: cleanup mlme state namespace
[PATCH 09/15] mac80211: change number of pre-assoc scans
[PATCH 10/15] mac80211: add direct probe before association
[PATCH 11/15] iwl3945: fix unbalanced mutex
[PATCH 12/15] iwl3945: replace association and beacon hooks with bss_info_changed cb
[PATCH 13/15] iwlwifi: fix hidden ssid discovery in passive channels
[PATCH 14/15] iwl3945: removed bg_post_associate work
[PATCH 15/15] iwl3945: avoid redundant iwl3945_get_active_dwell_time


2008-08-15 02:04:42

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 01/15] iwlwifi: Added bss_info_changed callback to 3945

From: Abhijeet Kolekar <[email protected]>

Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl3945-base.c | 74 ++++++++++++++++++++++++--
1 files changed, 68 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 7095d8c..8e88f3c 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6321,11 +6321,8 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data)

#define IWL_DELAY_NEXT_SCAN (HZ*2)

-static void iwl3945_bg_post_associate(struct work_struct *data)
+static void iwl3945_post_associate(struct iwl3945_priv *priv)
{
- struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv,
- post_associate.work);
-
int rc = 0;
struct ieee80211_conf *conf = NULL;
DECLARE_MAC_BUF(mac);
@@ -6343,8 +6340,6 @@ static void iwl3945_bg_post_associate(struct work_struct *data)
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

- mutex_lock(&priv->mutex);
-
if (!priv->vif || !priv->is_open) {
mutex_unlock(&priv->mutex);
return;
@@ -6420,6 +6415,15 @@ static void iwl3945_bg_post_associate(struct work_struct *data)

/* we have just associated, don't start scan too early */
priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN;
+}
+
+static void iwl3945_bg_post_associate(struct work_struct *data)
+{
+ struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv,
+ post_associate.work);
+
+ mutex_lock(&priv->mutex);
+ iwl3945_post_associate(priv);
mutex_unlock(&priv->mutex);
}

@@ -6949,6 +6953,63 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
IWL_DEBUG_MAC80211("leave\n");
}

+#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
+
+static void iwl3945_bss_info_changed(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *bss_conf,
+ u32 changes)
+{
+ struct iwl3945_priv *priv = hw->priv;
+
+ IWL_DEBUG_MAC80211("changes = 0x%X\n", changes);
+
+ if (changes & BSS_CHANGED_ERP_PREAMBLE) {
+ IWL_DEBUG_MAC80211("ERP_PREAMBLE %d\n",
+ bss_conf->use_short_preamble);
+ if (bss_conf->use_short_preamble)
+ priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
+ else
+ priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
+ }
+
+ if (changes & BSS_CHANGED_ERP_CTS_PROT) {
+ IWL_DEBUG_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot);
+ if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ))
+ priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK;
+ else
+ priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
+ }
+
+ if (changes & BSS_CHANGED_ASSOC) {
+ IWL_DEBUG_MAC80211("ASSOC %d\n", bss_conf->assoc);
+ /* This should never happen as this function should
+ * never be called from interrupt context. */
+ if (WARN_ON_ONCE(in_interrupt()))
+ return;
+ if (bss_conf->assoc) {
+ priv->assoc_id = bss_conf->aid;
+ priv->beacon_int = bss_conf->beacon_int;
+ priv->timestamp0 = bss_conf->timestamp & 0xFFFFFFFF;
+ priv->timestamp1 = (bss_conf->timestamp >> 32) &
+ 0xFFFFFFFF;
+ priv->assoc_capability = bss_conf->assoc_capability;
+ priv->next_scan_jiffies = jiffies +
+ IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
+ mutex_lock(&priv->mutex);
+ iwl3945_post_associate(priv);
+ mutex_unlock(&priv->mutex);
+ } else {
+ priv->assoc_id = 0;
+ IWL_DEBUG_MAC80211("DISASSOC %d\n", bss_conf->assoc);
+ }
+ } else if (changes && iwl3945_is_associated(priv) && priv->assoc_id) {
+ IWL_DEBUG_MAC80211("Associated Changes %d\n", changes);
+ iwl3945_send_rxon_assoc(priv);
+ }
+
+}
+
static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
{
int rc = 0;
@@ -7829,6 +7890,7 @@ static struct ieee80211_ops iwl3945_hw_ops = {
.conf_tx = iwl3945_mac_conf_tx,
.get_tsf = iwl3945_mac_get_tsf,
.reset_tsf = iwl3945_mac_reset_tsf,
+ .bss_info_changed = iwl3945_bss_info_changed,
.hw_scan = iwl3945_mac_hw_scan
};

--
1.5.3.6


2008-08-15 02:04:57

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 10/15] mac80211: add direct probe before association

From: Ron Rindjunsky <[email protected]>

This patch adds a direct probe request as first step in the association
flow if data we have is not up to date. Motivation of this step is to make
sure that the bss information we have is correct, since last scan could
have been done a while ago, and beacons do not fully answer this need as
there are potential differences between them and probe responses (e.g.
WMM parameter element).

Signed-off-by: Ron Rindjunsky <[email protected]>
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
net/mac80211/ieee80211_i.h | 9 +++--
net/mac80211/mlme.c | 79 +++++++++++++++++++++++++++++++++++++-------
2 files changed, 73 insertions(+), 15 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index f71785e..07aac7d 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -108,7 +108,7 @@ struct ieee80211_sta_bss {
u64 timestamp;
int beacon_int;

- bool probe_resp;
+ unsigned long last_probe_resp;
unsigned long last_update;

/* during assocation, we save an ERP value from a probe response so
@@ -302,12 +302,14 @@ struct mesh_config {
#define IEEE80211_STA_PRIVACY_INVOKED BIT(13)
/* flags for MLME request*/
#define IEEE80211_STA_REQ_SCAN 0
-#define IEEE80211_STA_REQ_AUTH 1
-#define IEEE80211_STA_REQ_RUN 2
+#define IEEE80211_STA_REQ_DIRECT_PROBE 1
+#define IEEE80211_STA_REQ_AUTH 2
+#define IEEE80211_STA_REQ_RUN 3

/* flags used for setting mlme state */
enum ieee80211_sta_mlme_state {
IEEE80211_STA_MLME_DISABLED,
+ IEEE80211_STA_MLME_DIRECT_PROBE,
IEEE80211_STA_MLME_AUTHENTICATE,
IEEE80211_STA_MLME_ASSOCIATE,
IEEE80211_STA_MLME_ASSOCIATED,
@@ -370,6 +372,7 @@ struct ieee80211_if_sta {
struct sk_buff_head skb_queue;

int assoc_scan_tries; /* number of scans done pre-association */
+ int direct_probe_tries; /* retries for direct probes */
int auth_tries; /* retries for auth req */
int assoc_tries; /* retries for assoc req */

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e1368f6..e1f1ca3 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -598,8 +598,10 @@ static void ieee80211_set_associated(struct net_device *dev,
static void ieee80211_set_disassoc(struct net_device *dev,
struct ieee80211_if_sta *ifsta, int deauth)
{
- if (deauth)
+ if (deauth) {
+ ifsta->direct_probe_tries = 0;
ifsta->auth_tries = 0;
+ }
ifsta->assoc_scan_tries = 0;
ifsta->assoc_tries = 0;
ieee80211_set_associated(dev, ifsta, 0);
@@ -660,6 +662,36 @@ static void ieee80211_send_auth(struct net_device *dev,
ieee80211_sta_tx(dev, skb, encrypt);
}

+static void ieee80211_direct_probe(struct net_device *dev,
+ struct ieee80211_if_sta *ifsta)
+{
+ DECLARE_MAC_BUF(mac);
+
+ ifsta->direct_probe_tries++;
+ if (ifsta->direct_probe_tries > IEEE80211_AUTH_MAX_TRIES) {
+ printk(KERN_DEBUG "%s: direct probe to AP %s timed out\n",
+ dev->name, print_mac(mac, ifsta->bssid));
+ ifsta->state = IEEE80211_STA_MLME_DISABLED;
+ return;
+ }
+
+ printk(KERN_DEBUG "%s: direct probe to AP %s try %d\n",
+ dev->name, print_mac(mac, ifsta->bssid),
+ ifsta->direct_probe_tries);
+
+ ifsta->state = IEEE80211_STA_MLME_DIRECT_PROBE;
+
+ set_bit(IEEE80211_STA_REQ_DIRECT_PROBE, &ifsta->request);
+
+ /* Direct probe is sent to broadcast address as some APs
+ * will not answer to direct packet in unassociated state.
+ */
+ ieee80211_send_probe_req(dev, NULL,
+ ifsta->ssid, ifsta->ssid_len);
+
+ mod_timer(&ifsta->timer, jiffies + IEEE80211_AUTH_TIMEOUT);
+}
+

static void ieee80211_authenticate(struct net_device *dev,
struct ieee80211_if_sta *ifsta)
@@ -1960,7 +1992,7 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev,
if (ifsta->state == IEEE80211_STA_MLME_AUTHENTICATE ||
ifsta->state == IEEE80211_STA_MLME_ASSOCIATE ||
ifsta->state == IEEE80211_STA_MLME_ASSOCIATED) {
- ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
+ ifsta->state = IEEE80211_STA_MLME_DIRECT_PROBE;
mod_timer(&ifsta->timer, jiffies +
IEEE80211_RETRY_AUTH_INTERVAL);
}
@@ -2559,8 +2591,7 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
struct ieee80211_mgmt *mgmt,
size_t len,
struct ieee80211_rx_status *rx_status,
- struct ieee802_11_elems *elems,
- int beacon)
+ struct ieee802_11_elems *elems)
{
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
int freq, clen;
@@ -2569,6 +2600,7 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
u64 beacon_timestamp, rx_timestamp;
struct ieee80211_channel *channel;
+ bool beacon = ieee80211_is_beacon(mgmt->frame_control);
DECLARE_MAC_BUF(mac);
DECLARE_MAC_BUF(mac2);

@@ -2725,15 +2757,14 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
bss->signal = rx_status->signal;
bss->noise = rx_status->noise;
bss->qual = rx_status->qual;
- if (!beacon && !bss->probe_resp)
- bss->probe_resp = true;
-
+ if (!beacon)
+ bss->last_probe_resp = jiffies;
/*
* In STA mode, the remaining parameters should not be overridden
* by beacons because they're not necessarily accurate there.
*/
if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
- bss->probe_resp && beacon) {
+ bss->last_probe_resp && beacon) {
ieee80211_rx_bss_put(local, bss);
return;
}
@@ -2888,6 +2919,8 @@ static void ieee80211_rx_mgmt_probe_resp(struct net_device *dev,
{
size_t baselen;
struct ieee802_11_elems elems;
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ struct ieee80211_if_sta *ifsta = &sdata->u.sta;

if (memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
return; /* ignore ProbeResp to foreign address */
@@ -2899,7 +2932,14 @@ static void ieee80211_rx_mgmt_probe_resp(struct net_device *dev,
ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen,
&elems);

- ieee80211_rx_bss_info(dev, mgmt, len, rx_status, &elems, 0);
+ ieee80211_rx_bss_info(dev, mgmt, len, rx_status, &elems);
+
+ /* direct probe may be part of the association flow */
+ if (test_and_clear_bit(IEEE80211_STA_REQ_DIRECT_PROBE,
+ &ifsta->request)) {
+ printk(KERN_DEBUG "%s direct probe responded\n", dev->name);
+ ieee80211_authenticate(dev, ifsta);
+ }
}


@@ -2923,7 +2963,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,

ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems);

- ieee80211_rx_bss_info(dev, mgmt, len, rx_status, &elems, 1);
+ ieee80211_rx_bss_info(dev, mgmt, len, rx_status, &elems);

sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
@@ -3361,7 +3401,8 @@ void ieee80211_sta_work(struct work_struct *work)
mesh_path_start_discovery(dev);
#endif

- if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
+ if (ifsta->state != IEEE80211_STA_MLME_DIRECT_PROBE &&
+ ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
ifsta->state != IEEE80211_STA_MLME_ASSOCIATE &&
test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) {
if (ifsta->scan_ssid_len)
@@ -3381,6 +3422,9 @@ void ieee80211_sta_work(struct work_struct *work)
switch (ifsta->state) {
case IEEE80211_STA_MLME_DISABLED:
break;
+ case IEEE80211_STA_MLME_DIRECT_PROBE:
+ ieee80211_direct_probe(dev, ifsta);
+ break;
case IEEE80211_STA_MLME_AUTHENTICATE:
ieee80211_authenticate(dev, ifsta);
break;
@@ -3440,6 +3484,7 @@ static void ieee80211_sta_reset_auth(struct net_device *dev,
ifsta->auth_transaction = -1;
ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
ifsta->assoc_scan_tries = 0;
+ ifsta->direct_probe_tries = 0;
ifsta->auth_tries = 0;
ifsta->assoc_tries = 0;
netif_carrier_off(dev);
@@ -3543,8 +3588,18 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
selected->ssid_len);
ieee80211_sta_set_bssid(dev, selected->bssid);
ieee80211_sta_def_wmm_params(dev, selected, 0);
+
+ /* Send out direct probe if no probe resp was received or
+ * the one we have is outdated
+ */
+ if (!selected->last_probe_resp ||
+ time_after(jiffies, selected->last_probe_resp
+ + IEEE80211_SCAN_RESULT_EXPIRE))
+ ifsta->state = IEEE80211_STA_MLME_DIRECT_PROBE;
+ else
+ ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
+
ieee80211_rx_bss_put(local, selected);
- ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
ieee80211_sta_reset_auth(dev, ifsta);
return 0;
} else {
--
1.5.3.6


2008-08-15 02:05:01

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 13/15] iwlwifi: fix hidden ssid discovery in passive channels

From: Ron Rindjunsky <[email protected]>

This patch gives the HW the possibility to send direct probes in passive
channels (as long as traffic was detected in that channel) if such ssid
was requested, so hidden ssid can be found now in those channels as well.

Signed-off-by: Cahill Ben <[email protected]>
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Ron Rindjunsky <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-scan.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 9bb6adb..6c8ac3a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -421,7 +421,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
else
scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE;

- if ((scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) && n_probes)
+ if (n_probes)
scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes);

scan_ch->active_dwell = cpu_to_le16(active_dwell);
--
1.5.3.6


2008-08-15 02:04:49

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 06/15] iwlwifi: align set channel with mac80211

From: Tomas Winkler <[email protected]>

This patch makes use of mac80211 defaults for channel and band.
Older code that uses G band channel 6 was removed. This patch also
changes iwl_set_rxon_channel signature.

Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-core.c | 11 +++++------
drivers/net/wireless/iwlwifi/iwl-core.h | 4 +---
3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index bf855c8..18764a5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2842,7 +2842,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
)
priv->staging_rxon.flags = 0;

- iwl_set_rxon_channel(priv, conf->channel->band, channel);
+ iwl_set_rxon_channel(priv, conf->channel);

iwl_set_flags_for_band(priv, conf->channel->band);

diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index f3dd622..e2587b9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -774,7 +774,7 @@ void iwl_set_rxon_chain(struct iwl_priv *priv)
EXPORT_SYMBOL(iwl_set_rxon_chain);

/**
- * iwlcore_set_rxon_channel - Set the phymode and channel values in staging RXON
+ * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON
* @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz
* @channel: Any channel valid for the requested phymode

@@ -783,10 +783,11 @@ EXPORT_SYMBOL(iwl_set_rxon_chain);
* NOTE: Does not commit to the hardware; it sets appropriate bit fields
* in the staging RXON flag structure based on the phymode
*/
-int iwl_set_rxon_channel(struct iwl_priv *priv,
- enum ieee80211_band band,
- u16 channel)
+int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch)
{
+ enum ieee80211_band band = ch->band;
+ u16 channel = ieee80211_frequency_to_channel(ch->center_freq);
+
if (!iwl_get_channel_info(priv, band, channel)) {
IWL_DEBUG_INFO("Could not set channel to %d [%d]\n",
channel, band);
@@ -907,8 +908,6 @@ int iwl_init_drv(struct iwl_priv *priv)
priv->qos_data.qos_active = 0;
priv->qos_data.qos_cap.val = 0;

- iwl_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6);
-
priv->rates_mask = IWL_RATES_MASK;
/* If power management is turned on, default to AC mode */
priv->power_mode = IWL_POWER_AC;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 64f139e..ff86abc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -189,9 +189,7 @@ void iwl_clear_stations_table(struct iwl_priv *priv);
void iwl_free_calib_results(struct iwl_priv *priv);
void iwl_reset_qos(struct iwl_priv *priv);
void iwl_set_rxon_chain(struct iwl_priv *priv);
-int iwl_set_rxon_channel(struct iwl_priv *priv,
- enum ieee80211_band band,
- u16 channel);
+int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch);
void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info);
u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
struct ieee80211_ht_info *sta_ht_inf);
--
1.5.3.6


2008-08-15 02:04:55

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 08/15] mac80211: cleanup mlme state namespace

From: Tomas Winkler <[email protected]>

This patch moves STA_MLME to station mlme state defines.

Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
net/mac80211/ieee80211_i.h | 34 +++++++++++++-------
net/mac80211/main.c | 2 +-
net/mac80211/mlme.c | 72 ++++++++++++++++++++++----------------------
net/mac80211/wext.c | 4 +-
4 files changed, 61 insertions(+), 51 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index ec59345..d19f67e 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -300,17 +300,33 @@ struct mesh_config {
#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11)
#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
#define IEEE80211_STA_PRIVACY_INVOKED BIT(13)
+/* flags for MLME request*/
+#define IEEE80211_STA_REQ_SCAN 0
+#define IEEE80211_STA_REQ_AUTH 1
+#define IEEE80211_STA_REQ_RUN 2
+
+/* flags used for setting mlme state */
+enum ieee80211_sta_mlme_state {
+ IEEE80211_STA_MLME_DISABLED,
+ IEEE80211_STA_MLME_AUTHENTICATE,
+ IEEE80211_STA_MLME_ASSOCIATE,
+ IEEE80211_STA_MLME_ASSOCIATED,
+ IEEE80211_STA_MLME_IBSS_SEARCH,
+ IEEE80211_STA_MLME_IBSS_JOINED,
+ IEEE80211_STA_MLME_MESH_UP
+};
+
+/* bitfield of allowed auth algs */
+#define IEEE80211_AUTH_ALG_OPEN BIT(0)
+#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
+#define IEEE80211_AUTH_ALG_LEAP BIT(2)
+
struct ieee80211_if_sta {
struct timer_list timer;
struct work_struct work;
u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
u8 ssid[IEEE80211_MAX_SSID_LEN];
- enum {
- IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
- IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
- IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED,
- IEEE80211_MESH_UP
- } state;
+ enum ieee80211_sta_mlme_state state;
size_t ssid_len;
u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
size_t scan_ssid_len;
@@ -360,13 +376,7 @@ struct ieee80211_if_sta {
unsigned long last_probe;

unsigned int flags;
-#define IEEE80211_STA_REQ_SCAN 0
-#define IEEE80211_STA_REQ_AUTH 1
-#define IEEE80211_STA_REQ_RUN 2

-#define IEEE80211_AUTH_ALG_OPEN BIT(0)
-#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
-#define IEEE80211_AUTH_ALG_LEAP BIT(2)
unsigned int auth_algs; /* bitfield of allowed auth algs */
int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
int auth_transaction;
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index aa5a191..2784e91 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -503,7 +503,7 @@ static int ieee80211_stop(struct net_device *dev)
/* fall through */
case IEEE80211_IF_TYPE_STA:
case IEEE80211_IF_TYPE_IBSS:
- sdata->u.sta.state = IEEE80211_DISABLED;
+ sdata->u.sta.state = IEEE80211_STA_MLME_DISABLED;
memset(sdata->u.sta.bssid, 0, ETH_ALEN);
del_timer_sync(&sdata->u.sta.timer);
/*
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index af61416..784ccd5 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -669,11 +669,11 @@ static void ieee80211_authenticate(struct net_device *dev,
printk(KERN_DEBUG "%s: authentication with AP %s"
" timed out\n",
dev->name, print_mac(mac, ifsta->bssid));
- ifsta->state = IEEE80211_DISABLED;
+ ifsta->state = IEEE80211_STA_MLME_DISABLED;
return;
}

- ifsta->state = IEEE80211_AUTHENTICATE;
+ ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
printk(KERN_DEBUG "%s: authenticate with AP %s\n",
dev->name, print_mac(mac, ifsta->bssid));

@@ -1010,17 +1010,17 @@ static void ieee80211_associate(struct net_device *dev,
printk(KERN_DEBUG "%s: association with AP %s"
" timed out\n",
dev->name, print_mac(mac, ifsta->bssid));
- ifsta->state = IEEE80211_DISABLED;
+ ifsta->state = IEEE80211_STA_MLME_DISABLED;
return;
}

- ifsta->state = IEEE80211_ASSOCIATE;
+ ifsta->state = IEEE80211_STA_MLME_ASSOCIATE;
printk(KERN_DEBUG "%s: associate with AP %s\n",
dev->name, print_mac(mac, ifsta->bssid));
if (ieee80211_privacy_mismatch(dev, ifsta)) {
printk(KERN_DEBUG "%s: mismatch in privacy configuration and "
"mixed-cell disabled - abort association\n", dev->name);
- ifsta->state = IEEE80211_DISABLED;
+ ifsta->state = IEEE80211_STA_MLME_DISABLED;
return;
}

@@ -1043,7 +1043,7 @@ static void ieee80211_associated(struct net_device *dev,
* for better APs. */
/* TODO: remove expired BSSes */

- ifsta->state = IEEE80211_ASSOCIATED;
+ ifsta->state = IEEE80211_STA_MLME_ASSOCIATED;

rcu_read_lock();

@@ -1086,7 +1086,7 @@ static void ieee80211_associated(struct net_device *dev,
sta_info_destroy(sta);

if (disassoc) {
- ifsta->state = IEEE80211_DISABLED;
+ ifsta->state = IEEE80211_STA_MLME_DISABLED;
ieee80211_set_associated(dev, ifsta, 0);
} else {
mod_timer(&ifsta->timer, jiffies +
@@ -1851,7 +1851,7 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev,
u16 auth_alg, auth_transaction, status_code;
DECLARE_MAC_BUF(mac);

- if (ifsta->state != IEEE80211_AUTHENTICATE &&
+ if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
sdata->vif.type != IEEE80211_IF_TYPE_IBSS)
return;

@@ -1955,10 +1955,10 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev,
if (ifsta->flags & IEEE80211_STA_AUTHENTICATED)
printk(KERN_DEBUG "%s: deauthenticated\n", dev->name);

- if (ifsta->state == IEEE80211_AUTHENTICATE ||
- ifsta->state == IEEE80211_ASSOCIATE ||
- ifsta->state == IEEE80211_ASSOCIATED) {
- ifsta->state = IEEE80211_AUTHENTICATE;
+ if (ifsta->state == IEEE80211_STA_MLME_AUTHENTICATE ||
+ ifsta->state == IEEE80211_STA_MLME_ASSOCIATE ||
+ ifsta->state == IEEE80211_STA_MLME_ASSOCIATED) {
+ ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
mod_timer(&ifsta->timer, jiffies +
IEEE80211_RETRY_AUTH_INTERVAL);
}
@@ -1987,8 +1987,8 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev,
if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
printk(KERN_DEBUG "%s: disassociated\n", dev->name);

- if (ifsta->state == IEEE80211_ASSOCIATED) {
- ifsta->state = IEEE80211_ASSOCIATE;
+ if (ifsta->state == IEEE80211_STA_MLME_ASSOCIATED) {
+ ifsta->state = IEEE80211_STA_MLME_ASSOCIATE;
mod_timer(&ifsta->timer, jiffies +
IEEE80211_RETRY_AUTH_INTERVAL);
}
@@ -2019,7 +2019,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
/* AssocResp and ReassocResp have identical structure, so process both
* of them in this function. */

- if (ifsta->state != IEEE80211_ASSOCIATE)
+ if (ifsta->state != IEEE80211_STA_MLME_ASSOCIATE)
return;

if (len < 24 + 6)
@@ -2506,7 +2506,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,

ieee80211_sta_def_wmm_params(dev, bss, 1);

- ifsta->state = IEEE80211_IBSS_JOINED;
+ ifsta->state = IEEE80211_STA_MLME_IBSS_JOINED;
mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL);

memset(&wrqu, 0, sizeof(wrqu));
@@ -2983,7 +2983,7 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev,
#endif

if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS ||
- ifsta->state != IEEE80211_IBSS_JOINED ||
+ ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED ||
len < 24 + 2 || !ifsta->probe_resp)
return;

@@ -3310,7 +3310,7 @@ void ieee80211_start_mesh(struct net_device *dev)
struct ieee80211_if_sta *ifsta;
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
ifsta = &sdata->u.sta;
- ifsta->state = IEEE80211_MESH_UP;
+ ifsta->state = IEEE80211_STA_MLME_MESH_UP;
ieee80211_sta_timer((unsigned long)sdata);
ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
}
@@ -3359,8 +3359,8 @@ void ieee80211_sta_work(struct work_struct *work)
mesh_path_start_discovery(dev);
#endif

- if (ifsta->state != IEEE80211_AUTHENTICATE &&
- ifsta->state != IEEE80211_ASSOCIATE &&
+ if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
+ ifsta->state != IEEE80211_STA_MLME_ASSOCIATE &&
test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) {
if (ifsta->scan_ssid_len)
ieee80211_sta_start_scan(dev, ifsta->scan_ssid, ifsta->scan_ssid_len);
@@ -3377,25 +3377,25 @@ void ieee80211_sta_work(struct work_struct *work)
return;

switch (ifsta->state) {
- case IEEE80211_DISABLED:
+ case IEEE80211_STA_MLME_DISABLED:
break;
- case IEEE80211_AUTHENTICATE:
+ case IEEE80211_STA_MLME_AUTHENTICATE:
ieee80211_authenticate(dev, ifsta);
break;
- case IEEE80211_ASSOCIATE:
+ case IEEE80211_STA_MLME_ASSOCIATE:
ieee80211_associate(dev, ifsta);
break;
- case IEEE80211_ASSOCIATED:
+ case IEEE80211_STA_MLME_ASSOCIATED:
ieee80211_associated(dev, ifsta);
break;
- case IEEE80211_IBSS_SEARCH:
+ case IEEE80211_STA_MLME_IBSS_SEARCH:
ieee80211_sta_find_ibss(dev, ifsta);
break;
- case IEEE80211_IBSS_JOINED:
+ case IEEE80211_STA_MLME_IBSS_JOINED:
ieee80211_sta_merge_ibss(dev, ifsta);
break;
#ifdef CONFIG_MAC80211_MESH
- case IEEE80211_MESH_UP:
+ case IEEE80211_STA_MLME_MESH_UP:
ieee80211_mesh_housekeeping(dev, ifsta);
break;
#endif
@@ -3540,20 +3540,20 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
ieee80211_sta_set_bssid(dev, selected->bssid);
ieee80211_sta_def_wmm_params(dev, selected, 0);
ieee80211_rx_bss_put(local, selected);
- ifsta->state = IEEE80211_AUTHENTICATE;
+ ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
ieee80211_sta_reset_auth(dev, ifsta);
return 0;
} else {
- if (ifsta->state != IEEE80211_AUTHENTICATE) {
+ if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE) {
if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL)
ieee80211_sta_start_scan(dev, NULL, 0);
else
ieee80211_sta_start_scan(dev, ifsta->ssid,
ifsta->ssid_len);
- ifsta->state = IEEE80211_AUTHENTICATE;
+ ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request);
} else
- ifsta->state = IEEE80211_DISABLED;
+ ifsta->state = IEEE80211_STA_MLME_DISABLED;
}
return -1;
}
@@ -3692,7 +3692,7 @@ dont_join:
#endif /* CONFIG_MAC80211_IBSS_DEBUG */

/* Selected IBSS not found in current scan results - try to scan */
- if (ifsta->state == IEEE80211_IBSS_JOINED &&
+ if (ifsta->state == IEEE80211_STA_MLME_IBSS_JOINED &&
!ieee80211_sta_active_ibss(dev)) {
mod_timer(&ifsta->timer, jiffies +
IEEE80211_IBSS_MERGE_INTERVAL);
@@ -3702,7 +3702,7 @@ dont_join:
"join\n", dev->name);
return ieee80211_sta_req_scan(dev, ifsta->ssid,
ifsta->ssid_len);
- } else if (ifsta->state != IEEE80211_IBSS_JOINED) {
+ } else if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED) {
int interval = IEEE80211_SCAN_INTERVAL;

if (time_after(jiffies, ifsta->ibss_join_req +
@@ -3722,7 +3722,7 @@ dont_join:
interval = IEEE80211_SCAN_INTERVAL_SLOW;
}

- ifsta->state = IEEE80211_IBSS_SEARCH;
+ ifsta->state = IEEE80211_STA_MLME_IBSS_SEARCH;
mod_timer(&ifsta->timer, jiffies + interval);
return 0;
}
@@ -3770,7 +3770,7 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len)
if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS &&
!(ifsta->flags & IEEE80211_STA_BSSID_SET)) {
ifsta->ibss_join_req = jiffies;
- ifsta->state = IEEE80211_IBSS_SEARCH;
+ ifsta->state = IEEE80211_STA_MLME_IBSS_SEARCH;
return ieee80211_sta_find_ibss(dev, ifsta);
}

@@ -3920,7 +3920,7 @@ done:
if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
struct ieee80211_if_sta *ifsta = &sdata->u.sta;
if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) ||
- (!(ifsta->state == IEEE80211_IBSS_JOINED) &&
+ (!(ifsta->state == IEEE80211_STA_MLME_IBSS_JOINED) &&
!ieee80211_sta_active_ibss(dev)))
ieee80211_sta_find_ibss(dev, ifsta);
}
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 34fa8ed..4de14a5 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -539,8 +539,8 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
- if (sdata->u.sta.state == IEEE80211_ASSOCIATED ||
- sdata->u.sta.state == IEEE80211_IBSS_JOINED) {
+ if (sdata->u.sta.state == IEEE80211_STA_MLME_ASSOCIATED ||
+ sdata->u.sta.state == IEEE80211_STA_MLME_IBSS_JOINED) {
ap_addr->sa_family = ARPHRD_ETHER;
memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
return 0;
--
1.5.3.6


2008-08-15 02:04:55

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 09/15] mac80211: change number of pre-assoc scans

From: Ron Rindjunsky <[email protected]>

This patch fixes noticed problem in noisy environments of 50+ APs.
That scan fails to find the requested AP on first try, which leads
to connection refusal. Second scan has empirically proven to fix
this problem in almost all cases.

Signed-off-by: Ron Rindjunsky <[email protected]>
Signed-off-by: Esti Kummer <[email protected]>
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
net/mac80211/ieee80211_i.h | 4 +++-
net/mac80211/mlme.c | 9 +++++++--
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index d19f67e..f71785e 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -369,7 +369,9 @@ struct ieee80211_if_sta {

struct sk_buff_head skb_queue;

- int auth_tries, assoc_tries;
+ int assoc_scan_tries; /* number of scans done pre-association */
+ int auth_tries; /* retries for auth req */
+ int assoc_tries; /* retries for assoc req */

unsigned long request;

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 784ccd5..e1368f6 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -34,6 +34,7 @@
#include "led.h"
#include "mesh.h"

+#define IEEE80211_ASSOC_SCANS_MAX_TRIES 2
#define IEEE80211_AUTH_TIMEOUT (HZ / 5)
#define IEEE80211_AUTH_MAX_TRIES 3
#define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
@@ -599,6 +600,7 @@ static void ieee80211_set_disassoc(struct net_device *dev,
{
if (deauth)
ifsta->auth_tries = 0;
+ ifsta->assoc_scan_tries = 0;
ifsta->assoc_tries = 0;
ieee80211_set_associated(dev, ifsta, 0);
}
@@ -3437,7 +3439,9 @@ static void ieee80211_sta_reset_auth(struct net_device *dev,
ifsta->auth_alg = WLAN_AUTH_OPEN;
ifsta->auth_transaction = -1;
ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
- ifsta->auth_tries = ifsta->assoc_tries = 0;
+ ifsta->assoc_scan_tries = 0;
+ ifsta->auth_tries = 0;
+ ifsta->assoc_tries = 0;
netif_carrier_off(dev);
}

@@ -3544,7 +3548,8 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
ieee80211_sta_reset_auth(dev, ifsta);
return 0;
} else {
- if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE) {
+ if (ifsta->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) {
+ ifsta->assoc_scan_tries++;
if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL)
ieee80211_sta_start_scan(dev, NULL, 0);
else
--
1.5.3.6


2008-08-15 02:04:58

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 11/15] iwl3945: fix unbalanced mutex

From: Abhijeet Kolekar <[email protected]>

The patch removes unlocking of mutex from post_associate.

Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl3945-base.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 8e88f3c..845e751 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6340,10 +6340,9 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv)
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;

- if (!priv->vif || !priv->is_open) {
- mutex_unlock(&priv->mutex);
+ if (!priv->vif || !priv->is_open)
return;
- }
+
iwl3945_scan_cancel_timeout(priv, 200);

conf = ieee80211_get_hw_conf(priv->hw);
--
1.5.3.6


2008-08-15 02:05:02

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 14/15] iwl3945: removed bg_post_associate work

From: Abhijeet Kolekar <[email protected]>

This patch removes bg_post_associate work. A direct call
iwl3945_post_associate is made to avoid the waiting by
userspace programs.

Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945.h | 1 -
drivers/net/wireless/iwlwifi/iwl3945-base.c | 18 +-----------------
2 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 4dd3f0d..9bbbc9d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -894,7 +894,6 @@ struct iwl3945_priv {
struct delayed_work thermal_periodic;
struct delayed_work gather_stats;
struct delayed_work scan_check;
- struct delayed_work post_associate;

#define IWL_DEFAULT_TX_POWER 0x0F
s8 user_txpower_limit;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 845e751..e5ab646 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6416,16 +6416,6 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv)
priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN;
}

-static void iwl3945_bg_post_associate(struct work_struct *data)
-{
- struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv,
- post_associate.work);
-
- mutex_lock(&priv->mutex);
- iwl3945_post_associate(priv);
- mutex_unlock(&priv->mutex);
-}
-
static void iwl3945_bg_abort_scan(struct work_struct *work)
{
struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv, abort_scan);
@@ -6571,7 +6561,6 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw)
*/
mutex_lock(&priv->mutex);
iwl3945_scan_cancel_timeout(priv, 100);
- cancel_delayed_work(&priv->post_associate);
mutex_unlock(&priv->mutex);
}

@@ -6937,7 +6926,6 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,

if (iwl3945_is_ready_rf(priv)) {
iwl3945_scan_cancel_timeout(priv, 100);
- cancel_delayed_work(&priv->post_associate);
priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
iwl3945_commit_rxon(priv);
}
@@ -7241,8 +7229,6 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)

iwl3945_reset_qos(priv);

- cancel_delayed_work(&priv->post_associate);
-
spin_lock_irqsave(&priv->lock, flags);
priv->assoc_id = 0;
priv->assoc_capability = 0;
@@ -7327,7 +7313,7 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk

iwl3945_reset_qos(priv);

- queue_work(priv->workqueue, &priv->post_associate.work);
+ iwl3945_post_associate(priv);

mutex_unlock(&priv->mutex);

@@ -7826,7 +7812,6 @@ static void iwl3945_setup_deferred_work(struct iwl3945_priv *priv)
INIT_WORK(&priv->rf_kill, iwl3945_bg_rf_kill);
INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update);
INIT_WORK(&priv->set_monitor, iwl3945_bg_set_monitor);
- INIT_DELAYED_WORK(&priv->post_associate, iwl3945_bg_post_associate);
INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start);
INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start);
INIT_DELAYED_WORK(&priv->scan_check, iwl3945_bg_scan_check);
@@ -7844,7 +7829,6 @@ static void iwl3945_cancel_deferred_work(struct iwl3945_priv *priv)
cancel_delayed_work_sync(&priv->init_alive_start);
cancel_delayed_work(&priv->scan_check);
cancel_delayed_work(&priv->alive_start);
- cancel_delayed_work(&priv->post_associate);
cancel_work_sync(&priv->beacon_update);
}

--
1.5.3.6


2008-08-15 02:04:50

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 07/15] mac80211: filter probes in ieee80211_rx_mgmt_probe_resp

From: Tomas Winkler <[email protected]>

This patch moves filtering statement from ieee80211_rx_bss_info
which is called for both beacon and probe to
ieee80211_rx_mgmt_probe_resp and save few cycles in beacon parsing.

Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
net/mac80211/mlme.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e1d11c9..af61416 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2570,9 +2570,6 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
DECLARE_MAC_BUF(mac);
DECLARE_MAC_BUF(mac2);

- if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
- return; /* ignore ProbeResp to foreign address */
-
beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp);

if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id &&
@@ -2890,6 +2887,9 @@ static void ieee80211_rx_mgmt_probe_resp(struct net_device *dev,
size_t baselen;
struct ieee802_11_elems elems;

+ if (memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
+ return; /* ignore ProbeResp to foreign address */
+
baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
if (baselen > len)
return;
--
1.5.3.6


2008-08-15 02:05:04

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 15/15] iwl3945: avoid redundant iwl3945_get_active_dwell_time

From: Abhijeet Kolekar <[email protected]>

iwl3945_get_active_dwell_time is called twice within the same context.
The patch removes one instance.

Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl3945-base.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index e5ab646..28e141d 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -4815,7 +4815,6 @@ static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv,
static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv,
enum ieee80211_band band)
{
- u16 active = iwl3945_get_active_dwell_time(priv, band);
u16 passive = (band == IEEE80211_BAND_2GHZ) ?
IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 :
IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52;
@@ -4830,9 +4829,6 @@ static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv,
passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2;
}

- if (passive <= active)
- passive = active + 1;
-
return passive;
}

@@ -4857,6 +4853,9 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
active_dwell = iwl3945_get_active_dwell_time(priv, band);
passive_dwell = iwl3945_get_passive_dwell_time(priv, band);

+ if (passive_dwell <= active_dwell)
+ passive_dwell = active_dwell + 1;
+
for (i = 0, added = 0; i < sband->n_channels; i++) {
if (channels[i].flags & IEEE80211_CHAN_DISABLED)
continue;
--
1.5.3.6


2008-08-15 02:04:48

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 05/15] iwlwifi: allow consecutive scans in unassociated state

From: Ron Rindjunsky <[email protected]>

This patch allows consecutive scans requests when driver is in
unassociated state.

Signed-off-by: Ron Rindjunsky <[email protected]>
Signed-off-by: Esti Kummer <[email protected]>
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 9798883..bf855c8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3206,12 +3206,14 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t ssid_len)
/* we don't schedule scan within next_scan_jiffies period */
if (priv->next_scan_jiffies &&
time_after(priv->next_scan_jiffies, jiffies)) {
+ IWL_DEBUG_SCAN("scan rejected: within next scan period\n");
ret = -EAGAIN;
goto out_unlock;
}
/* if we just finished scan ask for delay */
- if (priv->last_scan_jiffies &&
+ if (iwl_is_associated(priv) && priv->last_scan_jiffies &&
time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, jiffies)) {
+ IWL_DEBUG_SCAN("scan rejected: within previous scan period\n");
ret = -EAGAIN;
goto out_unlock;
}
--
1.5.3.6


2008-08-15 02:04:59

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 12/15] iwl3945: replace association and beacon hooks with bss_info_changed cb

From: Abhijeet Kolekar <[email protected]>

Let mac80211 and bss_info_changed callback handle the association and
beacon changes.

Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945.c | 81 -------------------------------
1 files changed, 0 insertions(+), 81 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 6e7ad0a..163470a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -689,87 +689,6 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,

switch (le16_to_cpu(header->frame_control) & IEEE80211_FCTL_FTYPE) {
case IEEE80211_FTYPE_MGMT:
- switch (le16_to_cpu(header->frame_control) &
- IEEE80211_FCTL_STYPE) {
- case IEEE80211_STYPE_PROBE_RESP:
- case IEEE80211_STYPE_BEACON:{
- /* If this is a beacon or probe response for
- * our network then cache the beacon
- * timestamp */
- if ((((priv->iw_mode == IEEE80211_IF_TYPE_STA)
- && !compare_ether_addr(header->addr2,
- priv->bssid)) ||
- ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS)
- && !compare_ether_addr(header->addr3,
- priv->bssid)))) {
- struct ieee80211_mgmt *mgmt =
- (struct ieee80211_mgmt *)header;
- __le32 *pos;
- pos = (__le32 *)&mgmt->u.beacon.
- timestamp;
- priv->timestamp0 = le32_to_cpu(pos[0]);
- priv->timestamp1 = le32_to_cpu(pos[1]);
- priv->beacon_int = le16_to_cpu(
- mgmt->u.beacon.beacon_int);
- if (priv->call_post_assoc_from_beacon &&
- (priv->iw_mode ==
- IEEE80211_IF_TYPE_STA))
- queue_work(priv->workqueue,
- &priv->post_associate.work);
-
- priv->call_post_assoc_from_beacon = 0;
- }
-
- break;
- }
-
- case IEEE80211_STYPE_ACTION:
- /* TODO: Parse 802.11h frames for CSA... */
- break;
-
- /*
- * TODO: Use the new callback function from
- * mac80211 instead of sniffing these packets.
- */
- case IEEE80211_STYPE_ASSOC_RESP:
- case IEEE80211_STYPE_REASSOC_RESP:{
- struct ieee80211_mgmt *mgnt =
- (struct ieee80211_mgmt *)header;
-
- /* We have just associated, give some
- * time for the 4-way handshake if
- * any. Don't start scan too early. */
- priv->next_scan_jiffies = jiffies +
- IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
-
- priv->assoc_id = (~((1 << 15) | (1 << 14)) &
- le16_to_cpu(mgnt->u.
- assoc_resp.aid));
- priv->assoc_capability =
- le16_to_cpu(mgnt->u.assoc_resp.capab_info);
- if (priv->beacon_int)
- queue_work(priv->workqueue,
- &priv->post_associate.work);
- else
- priv->call_post_assoc_from_beacon = 1;
- break;
- }
-
- case IEEE80211_STYPE_PROBE_REQ:{
- DECLARE_MAC_BUF(mac1);
- DECLARE_MAC_BUF(mac2);
- DECLARE_MAC_BUF(mac3);
- if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS)
- IWL_DEBUG_DROP
- ("Dropping (non network): %s"
- ", %s, %s\n",
- print_mac(mac1, header->addr1),
- print_mac(mac2, header->addr2),
- print_mac(mac3, header->addr3));
- return;
- }
- }
-
case IEEE80211_FTYPE_DATA:
/* fall through */
default:
--
1.5.3.6


2008-08-15 02:04:46

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 04/15] iwlwifi: remove obsolete 4965 forward declarations

From: Ron Rindjunsky <[email protected]>

This patch removes unused forward declarations functions.

Signed-off-by: Ron Rindjunsky <[email protected]>
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-dev.h | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index f46e9cd..0711b35 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -637,12 +637,6 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)

struct iwl_priv;

-/*
- * Forward declare iwl-4965.c functions for iwl-base.c
- */
-extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv);
-int iwl4965_check_empty_hw_queue(struct iwl_priv *priv, int sta_id,
- u8 tid, int txq_id);

/* Structures, enum, and defines specific to the 4965 */

--
1.5.3.6


2008-08-15 02:04:45

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 03/15] iwlwifi: clean up hw scan handler

From: Tomas Winkler <[email protected]>

This patch cleans up iwl_mac_hw_scan handler.

Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 35 ++++++++++++++-----------------
1 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 5262a2d..9798883 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3180,9 +3180,9 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,

}

-static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
+static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t ssid_len)
{
- int rc = 0;
+ int ret;
unsigned long flags;
struct iwl_priv *priv = hw->priv;

@@ -3192,41 +3192,38 @@ static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
spin_lock_irqsave(&priv->lock, flags);

if (!iwl_is_ready_rf(priv)) {
- rc = -EIO;
+ ret = -EIO;
IWL_DEBUG_MAC80211("leave - not ready or exit pending\n");
goto out_unlock;
}

if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { /* APs don't scan */
- rc = -EIO;
+ ret = -EIO;
IWL_ERROR("ERROR: APs don't scan\n");
goto out_unlock;
}

/* we don't schedule scan within next_scan_jiffies period */
if (priv->next_scan_jiffies &&
- time_after(priv->next_scan_jiffies, jiffies)) {
- rc = -EAGAIN;
+ time_after(priv->next_scan_jiffies, jiffies)) {
+ ret = -EAGAIN;
goto out_unlock;
}
/* if we just finished scan ask for delay */
- if (priv->last_scan_jiffies && time_after(priv->last_scan_jiffies +
- IWL_DELAY_NEXT_SCAN, jiffies)) {
- rc = -EAGAIN;
+ if (priv->last_scan_jiffies &&
+ time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, jiffies)) {
+ ret = -EAGAIN;
goto out_unlock;
}
- if (len) {
- IWL_DEBUG_SCAN("direct scan for %s [%d]\n ",
- iwl_escape_essid(ssid, len), (int)len);
-
+ if (ssid_len) {
priv->one_direct_scan = 1;
- priv->direct_ssid_len = (u8)
- min((u8) len, (u8) IW_ESSID_MAX_SIZE);
+ priv->direct_ssid_len = min_t(u8, ssid_len, IW_ESSID_MAX_SIZE);
memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len);
- } else
+ } else {
priv->one_direct_scan = 0;
+ }

- rc = iwl_scan_initiate(priv);
+ ret = iwl_scan_initiate(priv);

IWL_DEBUG_MAC80211("leave\n");

@@ -3234,7 +3231,7 @@ out_unlock:
spin_unlock_irqrestore(&priv->lock, flags);
mutex_unlock(&priv->mutex);

- return rc;
+ return ret;
}

static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
@@ -4141,7 +4138,7 @@ static struct ieee80211_ops iwl4965_hw_ops = {
.reset_tsf = iwl4965_mac_reset_tsf,
.bss_info_changed = iwl4965_bss_info_changed,
.ampdu_action = iwl4965_mac_ampdu_action,
- .hw_scan = iwl4965_mac_hw_scan
+ .hw_scan = iwl_mac_hw_scan
};

static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
--
1.5.3.6


2008-08-17 22:57:15

by Tomas Winkler

[permalink] [raw]
Subject: Re: [PATCH 00/15] iwlwifi driver 08/15 updates

On Fri, Aug 15, 2008 at 5:01 AM, Zhu Yi <[email protected]> wrote:
> Hi,
>
> Here are some fix and cleanup for iwlwifi and mac80211. Note mac80211
> patches 07~10 are already submitted by Tomas Winkler before.
>
> Thanks,
> -yi
>
I would just merge everyting into 2.6.27 but here are important
changes from my point of view (4965 and 5000)

> [PATCH 01/15] iwlwifi: Added bss_info_changed callback to 3945

> [PATCH 02/15] iwlwifi: W/A for the TSF correction in IBSS
For 2.6.27 -Fixes IBSS connectivity - constant merging

> [PATCH 03/15] iwlwifi: clean up hw scan handler
Needed for dependencies.

> [PATCH 04/15] iwlwifi: remove obsolete 4965 forward declarations

> [PATCH 05/15] iwlwifi: allow consecutive scans in unassociated state
> [PATCH 06/15] iwlwifi: align set channel with mac80211
For 2.6.27 (hidden SSID connectivity)

> [PATCH 07/15] mac80211: filter probes in ieee80211_rx_mgmt_probe_resp
> [PATCH 08/15] mac80211: cleanup mlme state namespace
> [PATCH 09/15] mac80211: change number of pre-assoc scans
> [PATCH 10/15] mac80211: add direct probe before association

For 2.6.27 mac patches - enable hidden SSID connectivity and more
robust connection in general

> [PATCH 11/15] iwl3945: fix unbalanced mutex
> [PATCH 12/15] iwl3945: replace association and beacon hooks with bss_info_changed cb

> [PATCH 13/15] iwlwifi: fix hidden ssid discovery in passive channels
For 2.6.27 enable hidden SSID in 5.2 Band

> [PATCH 14/15] iwl3945: removed bg_post_associate work
> [PATCH 15/15] iwl3945: avoid redundant iwl3945_get_active_dwell_time
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

Thanks
Tomas

2008-08-15 02:04:43

by Zhu Yi

[permalink] [raw]
Subject: [PATCH 02/15] iwlwifi: W/A for the TSF correction in IBSS

From: Assaf Krauss <[email protected]>

This patch is a W/A for the TSF sync issue, in which the ucode's timestamp
is constantly a little behind incoming beacons' timestamps (in IBSS cells).
The W/A simply stops the driver from declaring it has a reliable TSF value.

Signed-off-by: Assaf Krauss <[email protected]>
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-rx.c | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 981fdad..5262a2d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3579,7 +3579,7 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk

priv->assoc_id = 0;
timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp;
- priv->timestamp = le64_to_cpu(timestamp) + (priv->beacon_int * 1000);
+ priv->timestamp = le64_to_cpu(timestamp);

IWL_DEBUG_MAC80211("leave\n");
spin_unlock_irqrestore(&priv->lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index b92a580..faad4d3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -1068,7 +1068,10 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
rx_status.rate_idx -= IWL_FIRST_OFDM_RATE;

rx_status.flag = 0;
- rx_status.flag |= RX_FLAG_TSFT;
+
+ /* TSF isn't reliable. In order to allow smooth user experience,
+ * this W/A doesn't propagate it to the mac80211 */
+ /*rx_status.flag |= RX_FLAG_TSFT;*/

if ((unlikely(rx_start->cfg_phy_cnt > 20))) {
IWL_DEBUG_DROP("dsp size out of range [0,20]: %d/n",
--
1.5.3.6