From: Haim Dreyfuss <haim.dreyfuss@xxxxxxxxx> Check if the channel has WMM limitaion. In that case store the data so it can be used later. Signed-off-by: Haim Dreyfuss <haim.dreyfuss@xxxxxxxxx> --- src/drivers/driver_nl80211_capa.c | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 37eeb5e668..8d04833507 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -1492,6 +1492,57 @@ static void phy_info_freq(struct hostapd_hw_modes *mode, chan->dfs_cac_ms = nla_get_u32( tb_freq[NL80211_FREQUENCY_ATTR_DFS_CAC_TIME]); } + + chan->wmm_rules_valid = 0; + if (tb_freq[NL80211_FREQUENCY_ATTR_WMM]) { + static struct nla_policy wmm_policy[NL80211_WMMR_MAX + 1] = { + [NL80211_WMMR_CW_MIN] = { .type = NLA_U16 }, + [NL80211_WMMR_CW_MAX] = { .type = NLA_U16 }, + [NL80211_WMMR_AIFSN] = { .type = NLA_U8 }, + [NL80211_WMMR_TXOP] = { .type = NLA_U16 }, + }; + struct nlattr *nl_wmm; + struct nlattr *tb_wmm[NL80211_WMMR_MAX + 1]; + int rem_wmm, ac = 0; + + nla_for_each_nested(nl_wmm, tb_freq[NL80211_FREQUENCY_ATTR_WMM], + rem_wmm) { + if (nla_parse_nested(tb_wmm, NL80211_WMMR_MAX, nl_wmm, + wmm_policy)) { + wpa_printf(MSG_DEBUG, + "nl80211: Failed to parse wmm rules attribute"); + return; + } + if (!tb_wmm[NL80211_WMMR_CW_MIN] || + !tb_wmm[NL80211_WMMR_CW_MAX] || + !tb_wmm[NL80211_WMMR_AIFSN] || + !tb_wmm[NL80211_WMMR_TXOP]) { + wpa_printf(MSG_DEBUG, + "nl80211: channel is missing wmm rule attribute"); + return; + } + ac = nl_wmm->nla_type; + if (ac >= WMM_AC_NUM) { + wpa_printf(MSG_DEBUG, + "nl80211: invalid ac value %d", + ac); + return; + } + + chan->wmm_rules[ac].min_cwmin = + nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN]); + chan->wmm_rules[ac].min_cwmax = + nla_get_u16(tb_wmm[NL80211_WMMR_CW_MAX]); + chan->wmm_rules[ac].min_aifs = + nla_get_u8(tb_wmm[NL80211_WMMR_AIFSN]); + chan->wmm_rules[ac].max_txop = + nla_get_u16(tb_wmm[NL80211_WMMR_TXOP]) / 32; + } + + /* Set valid flag if all the AC rules are present */ + if (ac == WMM_AC_NUM - 1) + chan->wmm_rules_valid = 1; + } } -- 2.19.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap