aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-05-07 10:16:24 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-11 15:23:54 -0400
commitaa837e1d6bd1a71b3c30c7738b6c29d41512fe7d (patch)
treeee5ad78a279d22fb63821e4664de7ce03fe6d4d8 /net/mac80211
parent58905ca5b11a0ff3860f55b789cbbf052f7158a7 (diff)
mac80211: set default QoS values according to spec
We've never really cared about the default QoS (WMM) values, but we really should if the AP doesn't send any. This patch makes mac80211 use the default values according to 802.11-2007, and additionally syncs the default values when we disassociate so whatever the last AP said gets "unconfigured". Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/mlme.c4
-rw-r--r--net/mac80211/util.c60
2 files changed, 52 insertions, 12 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 75c487229f2e..c5445bae9d6c 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1043,6 +1043,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1043 1043
1044 rcu_read_unlock(); 1044 rcu_read_unlock();
1045 1045
1046 ieee80211_set_wmm_default(sdata);
1047
1046 ieee80211_recalc_idle(local); 1048 ieee80211_recalc_idle(local);
1047 1049
1048 /* channel(_type) changes are handled by ieee80211_hw_config */ 1050 /* channel(_type) changes are handled by ieee80211_hw_config */
@@ -1658,6 +1660,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1658 if (elems.wmm_param) 1660 if (elems.wmm_param)
1659 ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param, 1661 ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param,
1660 elems.wmm_param_len); 1662 elems.wmm_param_len);
1663 else
1664 ieee80211_set_wmm_default(sdata);
1661 1665
1662 if (elems.ht_info_elem && elems.wmm_param && 1666 if (elems.ht_info_elem && elems.wmm_param &&
1663 (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) && 1667 (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) &&
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 97b613affe08..0689a8fbd1e6 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -708,26 +708,62 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata)
708{ 708{
709 struct ieee80211_local *local = sdata->local; 709 struct ieee80211_local *local = sdata->local;
710 struct ieee80211_tx_queue_params qparam; 710 struct ieee80211_tx_queue_params qparam;
711 int i; 711 int queue;
712 bool use_11b;
713 int aCWmin, aCWmax;
712 714
713 if (!local->ops->conf_tx) 715 if (!local->ops->conf_tx)
714 return; 716 return;
715 717
716 memset(&qparam, 0, sizeof(qparam)); 718 memset(&qparam, 0, sizeof(qparam));
717 719
718 qparam.aifs = 2; 720 use_11b = (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ) &&
719 721 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE);
720 if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
721 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE))
722 qparam.cw_min = 31;
723 else
724 qparam.cw_min = 15;
725 722
726 qparam.cw_max = 1023; 723 for (queue = 0; queue < local_to_hw(local)->queues; queue++) {
727 qparam.txop = 0; 724 /* Set defaults according to 802.11-2007 Table 7-37 */
725 aCWmax = 1023;
726 if (use_11b)
727 aCWmin = 31;
728 else
729 aCWmin = 15;
730
731 switch (queue) {
732 case 3: /* AC_BK */
733 qparam.cw_max = aCWmin;
734 qparam.cw_min = aCWmax;
735 qparam.txop = 0;
736 qparam.aifs = 7;
737 break;
738 default: /* never happens but let's not leave undefined */
739 case 2: /* AC_BE */
740 qparam.cw_max = aCWmin;
741 qparam.cw_min = aCWmax;
742 qparam.txop = 0;
743 qparam.aifs = 3;
744 break;
745 case 1: /* AC_VI */
746 qparam.cw_max = aCWmin;
747 qparam.cw_min = (aCWmin + 1) / 2 - 1;
748 if (use_11b)
749 qparam.txop = 6016/32;
750 else
751 qparam.txop = 3008/32;
752 qparam.aifs = 2;
753 break;
754 case 0: /* AC_VO */
755 qparam.cw_max = (aCWmin + 1) / 2 - 1;
756 qparam.cw_min = (aCWmin + 1) / 4 - 1;
757 if (use_11b)
758 qparam.txop = 3264/32;
759 else
760 qparam.txop = 1504/32;
761 qparam.aifs = 2;
762 break;
763 }
728 764
729 for (i = 0; i < local_to_hw(local)->queues; i++) 765 drv_conf_tx(local, queue, &qparam);
730 drv_conf_tx(local, i, &qparam); 766 }
731} 767}
732 768
733void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, 769void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,