aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2009-10-08 14:56:24 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-27 16:47:50 -0400
commit8a5a37a6c492f7c9602aa72ef19f69c926cdca15 (patch)
tree3f66b6e61ab2cca5422c1848e6a2392a73899b06 /drivers
parent545f1da8ef0f20923feb500bcfaf0e2fb6068fb4 (diff)
wl1271: Configure rate policies based on AP rates
Configure the rate policies to the firmware based on the rates given by the AP. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h3
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_acx.c4
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_acx.h2
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_init.c2
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c31
5 files changed, 38 insertions, 4 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 957da8c0d9cb..671dc5af2e68 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -369,6 +369,9 @@ struct wl1271 {
369 /* Our association ID */ 369 /* Our association ID */
370 u16 aid; 370 u16 aid;
371 371
372 /* The current band */
373 enum ieee80211_band band;
374
372 /* Default key (for WEP) */ 375 /* Default key (for WEP) */
373 u32 default_key; 376 u32 default_key;
374 377
diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.c b/drivers/net/wireless/wl12xx/wl1271_acx.c
index f622a4092615..2ae1081ed627 100644
--- a/drivers/net/wireless/wl12xx/wl1271_acx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_acx.c
@@ -703,7 +703,7 @@ int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats)
703 return 0; 703 return 0;
704} 704}
705 705
706int wl1271_acx_rate_policies(struct wl1271 *wl) 706int wl1271_acx_rate_policies(struct wl1271 *wl, u32 enabled_rates)
707{ 707{
708 struct acx_rate_policy *acx; 708 struct acx_rate_policy *acx;
709 int ret = 0; 709 int ret = 0;
@@ -719,7 +719,7 @@ int wl1271_acx_rate_policies(struct wl1271 *wl)
719 719
720 /* configure one default (one-size-fits-all) rate class */ 720 /* configure one default (one-size-fits-all) rate class */
721 acx->rate_class_cnt = 1; 721 acx->rate_class_cnt = 1;
722 acx->rate_class[0].enabled_rates = ACX_RATE_MASK_ALL; 722 acx->rate_class[0].enabled_rates = enabled_rates;
723 acx->rate_class[0].short_retry_limit = ACX_RATE_RETRY_LIMIT; 723 acx->rate_class[0].short_retry_limit = ACX_RATE_RETRY_LIMIT;
724 acx->rate_class[0].long_retry_limit = ACX_RATE_RETRY_LIMIT; 724 acx->rate_class[0].long_retry_limit = ACX_RATE_RETRY_LIMIT;
725 acx->rate_class[0].aflags = 0; 725 acx->rate_class[0].aflags = 0;
diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.h b/drivers/net/wireless/wl12xx/wl1271_acx.h
index 9068daaf0ddf..55850eb809ea 100644
--- a/drivers/net/wireless/wl12xx/wl1271_acx.h
+++ b/drivers/net/wireless/wl12xx/wl1271_acx.h
@@ -1209,7 +1209,7 @@ int wl1271_acx_set_preamble(struct wl1271 *wl, enum acx_preamble_type preamble);
1209int wl1271_acx_cts_protect(struct wl1271 *wl, 1209int wl1271_acx_cts_protect(struct wl1271 *wl,
1210 enum acx_ctsprotect_type ctsprotect); 1210 enum acx_ctsprotect_type ctsprotect);
1211int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats); 1211int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats);
1212int wl1271_acx_rate_policies(struct wl1271 *wl); 1212int wl1271_acx_rate_policies(struct wl1271 *wl, u32 enabled_rates);
1213int wl1271_acx_ac_cfg(struct wl1271 *wl); 1213int wl1271_acx_ac_cfg(struct wl1271 *wl);
1214int wl1271_acx_tid_cfg(struct wl1271 *wl); 1214int wl1271_acx_tid_cfg(struct wl1271 *wl);
1215int wl1271_acx_frag_threshold(struct wl1271 *wl); 1215int wl1271_acx_frag_threshold(struct wl1271 *wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c
index 490df217605a..eb6b91ab968a 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.c
+++ b/drivers/net/wireless/wl12xx/wl1271_init.c
@@ -369,7 +369,7 @@ int wl1271_hw_init(struct wl1271 *wl)
369 goto out_free_memmap; 369 goto out_free_memmap;
370 370
371 /* Configure TX rate classes */ 371 /* Configure TX rate classes */
372 ret = wl1271_acx_rate_policies(wl); 372 ret = wl1271_acx_rate_policies(wl, ACX_RATE_MASK_ALL);
373 if (ret < 0) 373 if (ret < 0)
374 goto out_free_memmap; 374 goto out_free_memmap;
375 375
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index cc5c3285deac..b9b1c2013744 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -583,6 +583,7 @@ static void wl1271_op_stop(struct ieee80211_hw *hw)
583 wl->ssid_len = 0; 583 wl->ssid_len = 0;
584 wl->listen_int = 1; 584 wl->listen_int = 1;
585 wl->bss_type = MAX_BSS_TYPE; 585 wl->bss_type = MAX_BSS_TYPE;
586 wl->band = IEEE80211_BAND_2GHZ;
586 587
587 wl->rx_counter = 0; 588 wl->rx_counter = 0;
588 wl->elp = false; 589 wl->elp = false;
@@ -727,6 +728,8 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
727 728
728 mutex_lock(&wl->mutex); 729 mutex_lock(&wl->mutex);
729 730
731 wl->band = conf->channel->band;
732
730 ret = wl1271_ps_elp_wakeup(wl, false); 733 ret = wl1271_ps_elp_wakeup(wl, false);
731 if (ret < 0) 734 if (ret < 0)
732 goto out; 735 goto out;
@@ -978,6 +981,22 @@ out:
978 return ret; 981 return ret;
979} 982}
980 983
984static u32 wl1271_enabled_rates_get(struct wl1271 *wl, u64 basic_rate_set)
985{
986 struct ieee80211_supported_band *band;
987 u32 enabled_rates = 0;
988 int bit;
989
990 band = wl->hw->wiphy->bands[wl->band];
991 for (bit = 0; bit < band->n_bitrates; bit++) {
992 if (basic_rate_set & 0x1)
993 enabled_rates |= band->bitrates[bit].hw_value;
994 basic_rate_set >>= 1;
995 }
996
997 return enabled_rates;
998}
999
981static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, 1000static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
982 struct ieee80211_vif *vif, 1001 struct ieee80211_vif *vif,
983 struct ieee80211_bss_conf *bss_conf, 1002 struct ieee80211_bss_conf *bss_conf,
@@ -1016,6 +1035,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1016 } 1035 }
1017 } 1036 }
1018 } 1037 }
1038
1019 if (changed & BSS_CHANGED_ERP_SLOT) { 1039 if (changed & BSS_CHANGED_ERP_SLOT) {
1020 if (bss_conf->use_short_slot) 1040 if (bss_conf->use_short_slot)
1021 ret = wl1271_acx_slot(wl, SLOT_TIME_SHORT); 1041 ret = wl1271_acx_slot(wl, SLOT_TIME_SHORT);
@@ -1045,6 +1065,16 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1045 } 1065 }
1046 } 1066 }
1047 1067
1068 if (changed & BSS_CHANGED_BASIC_RATES) {
1069 u32 enabled_rates = wl1271_enabled_rates_get(
1070 wl, bss_conf->basic_rates);
1071 ret = wl1271_acx_rate_policies(wl, enabled_rates);
1072 if (ret < 0) {
1073 wl1271_warning("Set rate policies failed %d", ret);
1074 goto out_sleep;
1075 }
1076 }
1077
1048out_sleep: 1078out_sleep:
1049 wl1271_ps_elp_sleep(wl); 1079 wl1271_ps_elp_sleep(wl);
1050 1080
@@ -1239,6 +1269,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
1239 wl->psm_requested = false; 1269 wl->psm_requested = false;
1240 wl->tx_queue_stopped = false; 1270 wl->tx_queue_stopped = false;
1241 wl->power_level = WL1271_DEFAULT_POWER_LEVEL; 1271 wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
1272 wl->band = IEEE80211_BAND_2GHZ;
1242 1273
1243 /* We use the default power on sleep time until we know which chip 1274 /* We use the default power on sleep time until we know which chip
1244 * we're using */ 1275 * we're using */