Define helper function set_disable_ht40()

This functionality can be used outside wpa_set_disable_ht40(), so move
the generic part to a helper function.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
Masashi Honma 2017-01-27 13:43:19 +09:00 committed by Jouni Malinen
parent 7813b7c34d
commit 9eb5757a86
3 changed files with 18 additions and 10 deletions

View file

@ -453,3 +453,17 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
return 0; return 0;
} }
void set_disable_ht40(struct ieee80211_ht_capabilities *htcaps,
int disabled)
{
/* Masking these out disables HT40 */
le16 msk = host_to_le16(HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET |
HT_CAP_INFO_SHORT_GI40MHZ);
if (disabled)
htcaps->ht_capabilities_info &= ~msk;
else
htcaps->ht_capabilities_info |= msk;
}

View file

@ -35,5 +35,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
int vht_enabled, int sec_channel_offset, int vht_enabled, int sec_channel_offset,
int vht_oper_chwidth, int center_segment0, int vht_oper_chwidth, int center_segment0,
int center_segment1, u32 vht_caps); int center_segment1, u32 vht_caps);
void set_disable_ht40(struct ieee80211_ht_capabilities *htcaps,
int disabled);
#endif /* HW_FEATURES_COMMON_H */ #endif /* HW_FEATURES_COMMON_H */

View file

@ -3873,18 +3873,10 @@ static int wpa_set_disable_ht40(struct wpa_supplicant *wpa_s,
struct ieee80211_ht_capabilities *htcaps_mask, struct ieee80211_ht_capabilities *htcaps_mask,
int disabled) int disabled)
{ {
/* Masking these out disables HT40 */
le16 msk = host_to_le16(HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET |
HT_CAP_INFO_SHORT_GI40MHZ);
wpa_msg(wpa_s, MSG_DEBUG, "set_disable_ht40: %d", disabled); wpa_msg(wpa_s, MSG_DEBUG, "set_disable_ht40: %d", disabled);
if (disabled) set_disable_ht40(htcaps, disabled);
htcaps->ht_capabilities_info &= ~msk; set_disable_ht40(htcaps_mask, 0);
else
htcaps->ht_capabilities_info |= msk;
htcaps_mask->ht_capabilities_info |= msk;
return 0; return 0;
} }