2012-12-20 13:32:17

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 1/3] iwlegacy: add flush callback

Dump implementation of flush, which just wait until all TX queues
become empty.

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/3945-mac.c | 1 +
drivers/net/wireless/iwlegacy/4965-mac.c | 1 +
drivers/net/wireless/iwlegacy/common.c | 36 ++++++++++++++++++++++++++++++
drivers/net/wireless/iwlegacy/common.h | 1 +
4 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index d604b40..962400a 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -3474,6 +3474,7 @@ struct ieee80211_ops il3945_mac_ops = {
.sta_add = il3945_mac_sta_add,
.sta_remove = il_mac_sta_remove,
.tx_last_beacon = il_mac_tx_last_beacon,
+ .flush = il_mac_flush,
};

static int
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index c3fbf67..7d462d8 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -6306,6 +6306,7 @@ const struct ieee80211_ops il4965_mac_ops = {
.sta_remove = il_mac_sta_remove,
.channel_switch = il4965_mac_channel_switch,
.tx_last_beacon = il_mac_tx_last_beacon,
+ .flush = il_mac_flush,
};

static int
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 7e16d10..56b8021 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -4707,6 +4707,42 @@ out:
}
EXPORT_SYMBOL(il_mac_change_interface);

+void
+il_mac_flush(struct ieee80211_hw *hw, bool drop)
+{
+ struct il_priv *il = hw->priv;
+ unsigned long timeout = jiffies + msecs_to_jiffies(500);
+ int i;
+
+ mutex_lock(&il->mutex);
+ D_MAC80211("enter\n");
+
+ if (il->txq == NULL)
+ goto out;
+
+ for (i = 0; i < il->hw_params.max_txq_num; i++) {
+ struct il_queue *q;
+
+ if (i == il->cmd_queue)
+ continue;
+
+ q = &il->txq[i].q;
+ if (q->read_ptr == q->write_ptr)
+ continue;
+
+ if (time_after(jiffies, timeout)) {
+ IL_ERR("Failed to flush queue %d\n", q->id);
+ break;
+ }
+
+ msleep(20);
+ }
+out:
+ D_MAC80211("leave\n");
+ mutex_unlock(&il->mutex);
+}
+EXPORT_SYMBOL(il_mac_flush);
+
/*
* On every watchdog tick we check (latest) time stamp. If it does not
* change during timeout period and queue is not empty we reset firmware.
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h
index a9a569f..37fe553 100644
--- a/drivers/net/wireless/iwlegacy/common.h
+++ b/drivers/net/wireless/iwlegacy/common.h
@@ -1723,6 +1723,7 @@ void il_mac_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
enum nl80211_iftype newtype, bool newp2p);
+void il_mac_flush(struct ieee80211_hw *hw, bool drop);
int il_alloc_txq_mem(struct il_priv *il);
void il_free_txq_mem(struct il_priv *il);

--
1.7.1



2012-12-20 13:32:06

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 3/3] iwlegacy: allow to enable PS

Power save support was removed from iwlegacy due to possible firmware
crashes problems it cause. I use to plan first inspect code to find
reason of problems, fix them and then allow to enable PS. But
realistically - code inspection will not happen, so let's do it, and
wait for eventual bug reports.

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/3945-mac.c | 5 ++++-
drivers/net/wireless/iwlegacy/4965-mac.c | 4 ++--
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index 7a6ce09..5e3ac6c 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -3551,7 +3551,8 @@ il3945_setup_mac(struct il_priv *il)
hw->vif_data_size = sizeof(struct il_vif_priv);

/* Tell mac80211 our characteristics */
- hw->flags = IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_SPECTRUM_MGMT;
+ hw->flags = IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_SPECTRUM_MGMT |
+ IEEE80211_HW_SUPPORTS_PS | IEEE80211_HW_SUPPORTS_DYNAMIC_PS;

hw->wiphy->interface_modes =
BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
@@ -3560,6 +3561,8 @@ il3945_setup_mac(struct il_priv *il)
WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_DISABLE_BEACON_HINTS |
WIPHY_FLAG_IBSS_RSN;

+ hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
+
hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX_3945;
/* we create the 802.11 header and a zero-length SSID element */
hw->wiphy->max_scan_ie_len = IL3945_MAX_PROBE_REQUEST - 24 - 2;
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index eb68c83..820f748 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -5712,8 +5712,8 @@ il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length)
hw->flags =
IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_AMPDU_AGGREGATION |
IEEE80211_HW_NEED_DTIM_PERIOD | IEEE80211_HW_SPECTRUM_MGMT |
- IEEE80211_HW_REPORTS_TX_ACK_STATUS;
-
+ IEEE80211_HW_REPORTS_TX_ACK_STATUS | IEEE80211_HW_SUPPORTS_PS |
+ IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
if (il->cfg->sku & IL_SKU_N)
hw->flags |=
IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
--
1.7.1


2012-12-20 13:40:03

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/3] iwl3945: disable 11a support

On Thu, 2012-12-20 at 14:31 +0100, Stanislaw Gruszka wrote:
> I don't believe if there still are users using 11a mode. If they are,
> they should probably update their network to something that was
> designed in current century, but I also left module option for them.

Huh? All of VHT etc. is going to use 5 GHz and will be compatible with
legacy clients, so having 11a support will allow them to connect to new
networks? Or am I midunderstanding what you're doing here?

johannes


2012-12-20 15:26:10

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/3] iwl3945: disable 11a support

On Thu, 2012-12-20 at 15:45 +0100, Stanislaw Gruszka wrote:
> On Thu, Dec 20, 2012 at 02:40:19PM +0100, Johannes Berg wrote:
> > On Thu, 2012-12-20 at 14:31 +0100, Stanislaw Gruszka wrote:
> > > I don't believe if there still are users using 11a mode. If they are,
> > > they should probably update their network to something that was
> > > designed in current century, but I also left module option for them.
> >
> > Huh? All of VHT etc. is going to use 5 GHz and will be compatible with
> > legacy clients, so having 11a support will allow them to connect to new
> > networks? Or am I midunderstanding what you're doing here?
>
> Yes, this disable 5GHz for 3945. I assumed this is not and will not be
> used anymore, but seems I was wrong.
>
> BTW: I'm not expect that 11ac AP will work good with 11a, i.e. I'm not
> able to connect to mixed network 11a & 11n on my 5GHz AP, but at least
> this should be theoretically possible.
>
> What I'm looking for is possibility to disable 5GHz to avoid network
> traffic delays while scanning, but this should be done in cfg80211.

Sounds more like a policy decision in wpa_s?

johannes


2012-12-20 16:17:21

by Adrian Chadd

[permalink] [raw]
Subject: Re: [PATCH 2/3] iwl3945: disable 11a support

Yes, please don't disable 5ghz on legacy NICs.

I still have laptops with intel 3945's in them, which I use on my 11na
HT40 APs (especially for coexistence testing.)



Adrian

2012-12-20 13:32:02

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 2/3] iwl3945: disable 11a support

I don't believe if there still are users using 11a mode. If they are,
they should probably update their network to something that was
designed in current century, but I also left module option for them.

Having 11a (5GHz band) enabled on 3945 cause non-necessary scan delays.

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/iwlegacy/3945-mac.c | 6 ++++-
drivers/net/wireless/iwlegacy/4965-mac.c | 2 +-
drivers/net/wireless/iwlegacy/common.c | 36 ++++++++++++++++++-----------
drivers/net/wireless/iwlegacy/common.h | 3 +-
4 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index 962400a..7a6ce09 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -88,6 +88,7 @@ struct il_mod_params il3945_mod_params = {
.sw_crypto = 1,
.restart_fw = 1,
.disable_hw_scan = 1,
+ .disable_11a = 1,
/* the rest are 0 by default */
};

@@ -3509,7 +3510,8 @@ il3945_init_drv(struct il_priv *il)
ret = -EINVAL;
goto err;
}
- ret = il_init_channel_map(il);
+
+ ret = il_init_channel_map(il, il3945_mod_params.disable_11a);
if (ret) {
IL_ERR("initializing regulatory failed: %d\n", ret);
goto err;
@@ -3938,6 +3940,8 @@ MODULE_PARM_DESC(debug, "debug output mask");
#endif
module_param_named(fw_restart, il3945_mod_params.restart_fw, int, S_IRUGO);
MODULE_PARM_DESC(fw_restart, "restart firmware in case of error");
+module_param_named(disable_11a, il3945_mod_params.disable_11a, bool, S_IRUGO);
+MODULE_PARM_DESC(disable_11a, "disable 11a support (default true)");

module_exit(il3945_exit);
module_init(il3945_init);
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index 7d462d8..eb68c83 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -6338,7 +6338,7 @@ il4965_init_drv(struct il_priv *il)

il_init_scan_params(il);

- ret = il_init_channel_map(il);
+ ret = il_init_channel_map(il, false);
if (ret) {
IL_ERR("initializing regulatory failed: %d\n", ret);
goto err;
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 56b8021..12f5655 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -899,16 +899,18 @@ il_mod_ht40_chan_info(struct il_priv *il, enum ieee80211_band band, u16 channel,
? # x " " : "")

/**
- * il_init_channel_map - Set up driver's info for all possible channels
+ * il_init_channel_map - Set up driver's info for all possible channels,
+ * disable 5GHz channels if requested.
*/
int
-il_init_channel_map(struct il_priv *il)
+il_init_channel_map(struct il_priv *il, bool disable_5ghz)
{
int eeprom_ch_count = 0;
const u8 *eeprom_ch_idx = NULL;
const struct il_eeprom_channel *eeprom_ch_info = NULL;
int band, ch;
struct il_channel_info *ch_info;
+ enum ieee80211_band ieeeband;

if (il->channel_count) {
D_EEPROM("Channel map already initialized.\n");
@@ -917,10 +919,11 @@ il_init_channel_map(struct il_priv *il)

D_EEPROM("Initializing regulatory info from EEPROM\n");

- il->channel_count =
- ARRAY_SIZE(il_eeprom_band_1) + ARRAY_SIZE(il_eeprom_band_2) +
- ARRAY_SIZE(il_eeprom_band_3) + ARRAY_SIZE(il_eeprom_band_4) +
- ARRAY_SIZE(il_eeprom_band_5);
+ il->channel_count = ARRAY_SIZE(il_eeprom_band_1);
+ if (!disable_5ghz)
+ il->channel_count +=
+ ARRAY_SIZE(il_eeprom_band_2) + ARRAY_SIZE(il_eeprom_band_3) +
+ ARRAY_SIZE(il_eeprom_band_4) + ARRAY_SIZE(il_eeprom_band_5);

D_EEPROM("Parsing data for %d channels.\n", il->channel_count);

@@ -939,6 +942,12 @@ il_init_channel_map(struct il_priv *il)
* channel map we maintain (that contains additional information than
* what just in the EEPROM) */
for (band = 1; band <= 5; band++) {
+ if (band == 1)
+ ieeeband = IEEE80211_BAND_2GHZ;
+ else if (disable_5ghz)
+ break;
+ else
+ ieeeband = IEEE80211_BAND_5GHZ;

il_init_band_reference(il, band, &eeprom_ch_count,
&eeprom_ch_info, &eeprom_ch_idx);
@@ -946,9 +955,7 @@ il_init_channel_map(struct il_priv *il)
/* Loop through each band adding each of the channels */
for (ch = 0; ch < eeprom_ch_count; ch++) {
ch_info->channel = eeprom_ch_idx[ch];
- ch_info->band =
- (band ==
- 1) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+ ch_info->band = ieeeband;

/* permanently store EEPROM's channel regulatory flags
* and max power in channel info database. */
@@ -1006,15 +1013,16 @@ il_init_channel_map(struct il_priv *il)

/* Two additional EEPROM bands for 2.4 and 5 GHz HT40 channels */
for (band = 6; band <= 7; band++) {
- enum ieee80211_band ieeeband;
+ if (band == 6)
+ ieeeband = IEEE80211_BAND_2GHZ;
+ else if (disable_5ghz)
+ break;
+ else
+ ieeeband = IEEE80211_BAND_5GHZ;

il_init_band_reference(il, band, &eeprom_ch_count,
&eeprom_ch_info, &eeprom_ch_idx);

- /* EEPROM band 6 is 2.4, band 7 is 5 GHz */
- ieeeband =
- (band == 6) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
-
/* Loop through each band adding each of the channels */
for (ch = 0; ch < eeprom_ch_count; ch++) {
/* Set up driver's info for lower half */
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h
index 37fe553..0ab8757 100644
--- a/drivers/net/wireless/iwlegacy/common.h
+++ b/drivers/net/wireless/iwlegacy/common.h
@@ -429,7 +429,7 @@ int il_eeprom_init(struct il_priv *il);
void il_eeprom_free(struct il_priv *il);
const u8 *il_eeprom_query_addr(const struct il_priv *il, size_t offset);
u16 il_eeprom_query16(const struct il_priv *il, size_t offset);
-int il_init_channel_map(struct il_priv *il);
+int il_init_channel_map(struct il_priv *il, bool disable_5ghz);
void il_free_channel_map(struct il_priv *il);
const struct il_channel_info *il_get_channel_info(const struct il_priv *il,
enum ieee80211_band band,
@@ -1601,6 +1601,7 @@ struct il_mod_params {
int amsdu_size_8K; /* def: 1 = enable 8K amsdu size */
int antenna; /* def: 0 = both antennas (use diversity) */
int restart_fw; /* def: 1 = restart firmware */
+ bool disable_11a; /* def: true = 11a disabled (3945 only) */
};

#define IL_LED_SOLID 11
--
1.7.1


2012-12-20 14:45:59

by Stanislaw Gruszka

[permalink] [raw]
Subject: Re: [PATCH 2/3] iwl3945: disable 11a support

On Thu, Dec 20, 2012 at 02:40:19PM +0100, Johannes Berg wrote:
> On Thu, 2012-12-20 at 14:31 +0100, Stanislaw Gruszka wrote:
> > I don't believe if there still are users using 11a mode. If they are,
> > they should probably update their network to something that was
> > designed in current century, but I also left module option for them.
>
> Huh? All of VHT etc. is going to use 5 GHz and will be compatible with
> legacy clients, so having 11a support will allow them to connect to new
> networks? Or am I midunderstanding what you're doing here?

Yes, this disable 5GHz for 3945. I assumed this is not and will not be
used anymore, but seems I was wrong.

BTW: I'm not expect that 11ac AP will work good with 11a, i.e. I'm not
able to connect to mixed network 11a & 11n on my 5GHz AP, but at least
this should be theoretically possible.

What I'm looking for is possibility to disable 5GHz to avoid network
traffic delays while scanning, but this should be done in cfg80211.

Let's skip this patch.

Thanks
Stanislaw