Enable WMM support in the test MLME code

This allows driver_test to be used to test WMM negotiation.
This commit is contained in:
Jouni Malinen 2009-03-06 16:47:05 +02:00 committed by Jouni Malinen
parent 9cf548c082
commit 5c3dd4ebbe

View file

@ -116,8 +116,6 @@ static int ieee80211_sta_set_channel(struct wpa_supplicant *wpa_s,
} }
#if 0 /* FIX */
static int ecw2cw(int ecw) static int ecw2cw(int ecw)
{ {
int cw = 1; int cw = 1;
@ -127,7 +125,6 @@ static int ecw2cw(int ecw)
} }
return cw - 1; return cw - 1;
} }
#endif
static void ieee80211_sta_wmm_params(struct wpa_supplicant *wpa_s, static void ieee80211_sta_wmm_params(struct wpa_supplicant *wpa_s,
@ -136,6 +133,7 @@ static void ieee80211_sta_wmm_params(struct wpa_supplicant *wpa_s,
size_t left; size_t left;
int count; int count;
u8 *pos; u8 *pos;
u8 wmm_acm;
if (wmm_param_len < 8 || wmm_param[5] /* version */ != 1) if (wmm_param_len < 8 || wmm_param[5] /* version */ != 1)
return; return;
@ -147,54 +145,42 @@ static void ieee80211_sta_wmm_params(struct wpa_supplicant *wpa_s,
pos = wmm_param + 8; pos = wmm_param + 8;
left = wmm_param_len - 8; left = wmm_param_len - 8;
#if 0 /* FIX */
wmm_acm = 0; wmm_acm = 0;
for (; left >= 4; left -= 4, pos += 4) { for (; left >= 4; left -= 4, pos += 4) {
int aci = (pos[0] >> 5) & 0x03; int aci = (pos[0] >> 5) & 0x03;
int acm = (pos[0] >> 4) & 0x01; int acm = (pos[0] >> 4) & 0x01;
int queue; int aifs, cw_max, cw_min, burst_time;
switch (aci) { switch (aci) {
case 1: case 1: /* AC_BK */
queue = IEEE80211_TX_QUEUE_DATA3;
if (acm) if (acm)
wmm_acm |= BIT(1) | BIT(2); wmm_acm |= BIT(1) | BIT(2); /* BK/- */
break; break;
case 2: case 2: /* AC_VI */
queue = IEEE80211_TX_QUEUE_DATA1;
if (acm) if (acm)
wmm_acm |= BIT(4) | BIT(5); wmm_acm |= BIT(4) | BIT(5); /* CL/VI */
break; break;
case 3: case 3: /* AC_VO */
queue = IEEE80211_TX_QUEUE_DATA0;
if (acm) if (acm)
wmm_acm |= BIT(6) | BIT(7); wmm_acm |= BIT(6) | BIT(7); /* VO/NC */
break; break;
case 0: case 0: /* AC_BE */
default: default:
queue = IEEE80211_TX_QUEUE_DATA2;
if (acm) if (acm)
wpa_s->mlme.wmm_acm |= BIT(0) | BIT(3); wmm_acm |= BIT(0) | BIT(3); /* BE/EE */
break; break;
} }
params.aifs = pos[0] & 0x0f; aifs = pos[0] & 0x0f;
params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4); cw_max = ecw2cw((pos[1] & 0xf0) >> 4);
params.cw_min = ecw2cw(pos[1] & 0x0f); cw_min = ecw2cw(pos[1] & 0x0f);
/* TXOP is in units of 32 usec; burst_time in 0.1 ms */ /* TXOP is in units of 32 usec; burst_time in 0.1 ms */
params.burst_time = (pos[2] | (pos[3] << 8)) * 32 / 100; burst_time = (pos[2] | (pos[3] << 8)) * 32 / 100;
wpa_printf(MSG_DEBUG, "MLME: WMM queue=%d aci=%d acm=%d " wpa_printf(MSG_DEBUG, "MLME: WMM aci=%d acm=%d aifs=%d "
"aifs=%d cWmin=%d cWmax=%d burst=%d", "cWmin=%d cWmax=%d burst=%d",
queue, aci, acm, params.aifs, params.cw_min, aci, acm, aifs, cw_min, cw_max, burst_time);
params.cw_max, params.burst_time); /* TODO: driver configuration */
/* TODO: handle ACM (block TX, fallback to next lowest allowed
* AC for now) */
if (local->hw->conf_tx(local->mdev, queue, &params)) {
wpa_printf(MSG_DEBUG, "MLME: failed to set TX queue "
"parameters for queue %d", queue);
}
} }
#endif
} }
@ -1172,14 +1158,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct wpa_supplicant *wpa_s,
"netstack"); "netstack");
} }
#if 0 /* FIX? */ if (elems.wmm && wpa_s->mlme.wmm_enabled)
sta->assoc_ap = 1;
if (elems.wmm && wpa_s->mlme.wmm_enabled) {
sta->flags |= WLAN_STA_WMM;
ieee80211_sta_wmm_params(wpa_s, elems.wmm, elems.wmm_len); ieee80211_sta_wmm_params(wpa_s, elems.wmm, elems.wmm_len);
}
#endif
ieee80211_associated(wpa_s); ieee80211_associated(wpa_s);
} }
@ -2866,6 +2846,8 @@ int ieee80211_sta_init(struct wpa_supplicant *wpa_s)
wpa_s->mlme.hw_modes |= 1 << WPA_MODE_IEEE80211B; wpa_s->mlme.hw_modes |= 1 << WPA_MODE_IEEE80211B;
wpa_s->mlme.hw_modes |= 1 << WPA_MODE_IEEE80211G; wpa_s->mlme.hw_modes |= 1 << WPA_MODE_IEEE80211G;
wpa_s->mlme.wmm_enabled = 1;
return 0; return 0;
} }