From fc4e2d950160e7fad207b0a911f45d265ca91687 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 29 Nov 2009 13:04:21 +0200 Subject: [PATCH] HT: Remove unneeded struct ht_cap_ie wrapper It is simpler to just use the HT Capabilities IE payload structure as-is. --- hostapd/driver_i.h | 2 +- hostapd/ieee802_11.c | 22 +++++++++------------- hostapd/sta_info.h | 2 +- src/common/ieee802_11_defs.h | 6 ------ src/drivers/driver.h | 2 +- src/drivers/driver_nl80211.c | 7 ++----- 6 files changed, 14 insertions(+), 27 deletions(-) diff --git a/hostapd/driver_i.h b/hostapd/driver_i.h index a60e089aa..c9c044cc8 100644 --- a/hostapd/driver_i.h +++ b/hostapd/driver_i.h @@ -217,7 +217,7 @@ static inline int hostapd_sta_add(const char *ifname, struct hostapd_data *hapd, const u8 *addr, u16 aid, u16 capability, const u8 *supp_rates, size_t supp_rates_len, int flags, u16 listen_interval, - const struct ht_cap_ie *ht_capabilities) + const struct ieee80211_ht_capabilities *ht_capabilities) { struct hostapd_sta_add_params params; diff --git a/hostapd/ieee802_11.c b/hostapd/ieee802_11.c index eec5e65ad..be9a3a190 100644 --- a/hostapd/ieee802_11.c +++ b/hostapd/ieee802_11.c @@ -858,11 +858,7 @@ static void handle_assoc(struct hostapd_data *hapd, elems.ht_capabilities_len >= sizeof(struct ieee80211_ht_capabilities)) { sta->flags |= WLAN_STA_HT; - sta->ht_capabilities.id = WLAN_EID_HT_CAP; - sta->ht_capabilities.length = - sizeof(struct ieee80211_ht_capabilities); - os_memcpy(&sta->ht_capabilities.data, - elems.ht_capabilities, + os_memcpy(&sta->ht_capabilities, elems.ht_capabilities, sizeof(struct ieee80211_ht_capabilities)); } else sta->flags &= ~WLAN_STA_HT; @@ -1037,7 +1033,7 @@ static void handle_assoc(struct hostapd_data *hapd, #ifdef CONFIG_IEEE80211N if (sta->flags & WLAN_STA_HT) { u16 ht_capab = le_to_host16( - sta->ht_capabilities.data.ht_capabilities_info); + sta->ht_capabilities.ht_capabilities_info); wpa_printf(MSG_DEBUG, "HT: STA " MACSTR " HT Capabilities " "Info: 0x%04x", MAC2STR(sta->addr), ht_capab); if ((ht_capab & HT_CAP_INFO_GREEN_FIELD) == 0) { @@ -1583,19 +1579,19 @@ static void handle_auth_cb(struct hostapd_data *hapd, #ifdef CONFIG_IEEE80211N static void hostapd_get_ht_capab(struct hostapd_data *hapd, - struct ht_cap_ie *ht_cap_ie, - struct ht_cap_ie *neg_ht_cap_ie) + struct ieee80211_ht_capabilities *ht_cap, + struct ieee80211_ht_capabilities *neg_ht_cap) { u16 cap; - os_memcpy(neg_ht_cap_ie, ht_cap_ie, sizeof(struct ht_cap_ie)); - cap = le_to_host16(neg_ht_cap_ie->data.ht_capabilities_info); + os_memcpy(neg_ht_cap, ht_cap, sizeof(*neg_ht_cap)); + cap = le_to_host16(neg_ht_cap->ht_capabilities_info); cap &= hapd->iconf->ht_capab; cap |= (hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_DISABLED); /* FIXME: Rx STBC needs to be handled specially */ cap |= (hapd->iconf->ht_capab & HT_CAP_INFO_RX_STBC_MASK); - neg_ht_cap_ie->data.ht_capabilities_info = host_to_le16(cap); + neg_ht_cap->ht_capabilities_info = host_to_le16(cap); } #endif /* CONFIG_IEEE80211N */ @@ -1608,9 +1604,9 @@ static void handle_assoc_cb(struct hostapd_data *hapd, struct sta_info *sta; int new_assoc = 1; #ifdef CONFIG_IEEE80211N - struct ht_cap_ie ht_cap; + struct ieee80211_ht_capabilities ht_cap; #endif /* CONFIG_IEEE80211N */ - struct ht_cap_ie *ht_cap_ptr = NULL; + struct ieee80211_ht_capabilities *ht_cap_ptr = NULL; int set_flags, flags_and, flags_or; if (!ok) { diff --git a/hostapd/sta_info.h b/hostapd/sta_info.h index 993f0877a..a3f94c574 100644 --- a/hostapd/sta_info.h +++ b/hostapd/sta_info.h @@ -80,7 +80,7 @@ struct sta_info { int vlan_id; #ifdef CONFIG_IEEE80211N - struct ht_cap_ie ht_capabilities; /* IEEE 802.11n capabilities */ + struct ieee80211_ht_capabilities ht_capabilities; #endif /* CONFIG_IEEE80211N */ #ifdef CONFIG_IEEE80211W diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 93360b500..5efd55e12 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -379,12 +379,6 @@ struct ieee80211_ht_operation { u8 basic_set[16]; } STRUCT_PACKED; -struct ht_cap_ie { - u8 id; - u8 length; - struct ieee80211_ht_capabilities data; -} STRUCT_PACKED; - #ifdef _MSC_VER #pragma pack(pop) #endif /* _MSC_VER */ diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 3fd8145bb..14095762f 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -443,7 +443,7 @@ struct hostapd_sta_add_params { size_t supp_rates_len; int flags; u16 listen_interval; - const struct ht_cap_ie *ht_capabilities; + const struct ieee80211_ht_capabilities *ht_capabilities; }; struct hostapd_freq_params { diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 466e460a8..ab47a6738 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -2600,14 +2600,11 @@ static int wpa_driver_nl80211_sta_add(const char *ifname, void *priv, params->supp_rates); NLA_PUT_U16(msg, NL80211_ATTR_STA_LISTEN_INTERVAL, params->listen_interval); - -#ifdef CONFIG_IEEE80211N if (params->ht_capabilities) { NLA_PUT(msg, NL80211_ATTR_HT_CAPABILITY, - params->ht_capabilities->length, - ¶ms->ht_capabilities->data); + sizeof(*params->ht_capabilities), + params->ht_capabilities); } -#endif /* CONFIG_IEEE80211N */ ret = send_and_recv_msgs(drv, msg, NULL, NULL); if (ret)