WMM AC: Add wmm_ac_status control interface command

This wmm_ac_status command will show the current status for WMM AC.

Signed-off-by: Moshe Benji <moshe.benji@intel.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
This commit is contained in:
Moshe Benji 2014-10-22 08:04:02 -04:00 committed by Jouni Malinen
parent 71d263ea70
commit 8506ea6f17
4 changed files with 104 additions and 0 deletions

View file

@ -7354,6 +7354,8 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
if (wpa_supplicant_ctrl_iface_tdls_teardown(wpa_s, buf + 14))
reply_len = -1;
#endif /* CONFIG_TDLS */
} else if (os_strcmp(buf, "WMM_AC_STATUS") == 0) {
reply_len = wpas_wmm_ac_status(wpa_s, reply, reply_size);
} else if (os_strncmp(buf, "WMM_AC_ADDTS ", 13) == 0) {
if (wmm_ac_ctrl_addts(wpa_s, buf + 13))
reply_len = -1;

View file

@ -817,3 +817,94 @@ void wmm_ac_rx_action(struct wpa_supplicant *wpa_s, const u8 *da,
break;
}
}
static const char * get_ac_str(u8 ac)
{
switch (ac) {
case WMM_AC_BE:
return "BE";
case WMM_AC_BK:
return "BK";
case WMM_AC_VI:
return "VI";
case WMM_AC_VO:
return "VO";
default:
return "N/A";
}
}
static const char * get_direction_str(u8 direction)
{
switch (direction) {
case WMM_AC_DIR_DOWNLINK:
return "Downlink";
case WMM_AC_DIR_UPLINK:
return "Uplink";
case WMM_AC_DIR_BIDIRECTIONAL:
return "Bi-directional";
default:
return "N/A";
}
}
int wpas_wmm_ac_status(struct wpa_supplicant *wpa_s, char *buf, size_t buflen)
{
struct wmm_ac_assoc_data *assoc_info = wpa_s->wmm_ac_assoc_info;
enum ts_dir_idx idx;
int pos = 0;
u8 ac;
if (!assoc_info) {
return wpa_scnprintf(buf, buflen - pos,
"Not associated to a WMM AP, WMM AC is Disabled\n");
}
pos += wpa_scnprintf(buf + pos, buflen - pos, "WMM AC is Enabled\n");
for (ac = 0; ac < WMM_AC_NUM; ac++) {
int ts_count = 0;
pos += wpa_scnprintf(buf + pos, buflen - pos,
"%s: acm=%d uapsd=%d\n",
get_ac_str(ac),
assoc_info->ac_params[ac].acm,
assoc_info->ac_params[ac].uapsd);
for (idx = 0; idx < TS_DIR_IDX_COUNT; idx++) {
struct wmm_tspec_element *tspec;
u8 dir, tsid;
const char *dir_str;
tspec = wpa_s->tspecs[ac][idx];
if (!tspec)
continue;
ts_count++;
dir = wmm_ac_get_direction(tspec);
dir_str = get_direction_str(dir);
tsid = wmm_ac_get_tsid(tspec);
pos += wpa_scnprintf(buf + pos, buflen - pos,
"\tTSID = %u\n"
"\tAddress = "MACSTR"\n"
"\tWMM AC dir = %s\n"
"\tTotal admitted time = %u\n\n",
tsid,
MAC2STR(wpa_s->bssid),
dir_str,
le_to_host16(tspec->medium_time));
}
if (!ts_count) {
pos += wpa_scnprintf(buf + pos, buflen - pos,
"\t(No Traffic Stream)\n\n");
}
}
return pos;
}

View file

@ -168,5 +168,6 @@ int wpas_wmm_ac_addts(struct wpa_supplicant *wpa_s,
int wpas_wmm_ac_delts(struct wpa_supplicant *wpa_s, u8 tsid);
void wmm_ac_rx_action(struct wpa_supplicant *wpa_s, const u8 *da,
const u8 *sa, const u8 *data, size_t len);
int wpas_wmm_ac_status(struct wpa_supplicant *wpa_s, char *buf, size_t buflen);
#endif /* WMM_AC_H */

View file

@ -2412,6 +2412,13 @@ static int wpa_cli_cmd_wmm_ac_delts(struct wpa_ctrl *ctrl, int argc,
}
static int wpa_cli_cmd_wmm_ac_status(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
return wpa_ctrl_command(ctrl, "WMM_AC_STATUS");
}
static int wpa_cli_cmd_signal_poll(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@ -2969,6 +2976,9 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
{ "wmm_ac_delts", wpa_cli_cmd_wmm_ac_delts, NULL,
cli_cmd_flag_none,
"<tsid> = delete WMM-AC traffic stream" },
{ "wmm_ac_status", wpa_cli_cmd_wmm_ac_status, NULL,
cli_cmd_flag_none,
"= show status for Wireless Multi-Media Admission-Control" },
{ "signal_poll", wpa_cli_cmd_signal_poll, NULL,
cli_cmd_flag_none,
"= get signal parameters" },