Change HT parameter configuration to use a single driver ops function

It is better to pass both HT Capabilities and HT Operation IEs in the
same function call since it may be easier for the driver wrappers to
handle the changes without having to wait for the other IE in the
wrapper code.
This commit is contained in:
Jouni Malinen 2008-11-25 14:57:34 +02:00 committed by Jouni Malinen
parent 3e0cb2c503
commit ffbcf648ed
2 changed files with 21 additions and 34 deletions

View file

@ -400,21 +400,20 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
#ifdef CONFIG_IEEE80211N #ifdef CONFIG_IEEE80211N
if (hapd->iconf->ieee80211n) { if (hapd->iconf->ieee80211n) {
u8 *start; u8 *ht_capab, *ht_oper;
start = tailpos; ht_capab = tailpos;
tailpos = hostapd_eid_ht_capabilities_info(hapd, tailpos); tailpos = hostapd_eid_ht_capabilities_info(hapd, tailpos);
if (hostapd_set_ht_capability(hapd->conf->iface, hapd,
start + 2)) { ht_oper = tailpos;
tailpos = hostapd_eid_ht_operation(hapd, tailpos);
if (tailpos > ht_oper && ht_oper > ht_capab &&
hostapd_set_ht_params(hapd->conf->iface, hapd,
ht_capab + 2, ht_capab[1],
ht_oper + 2, ht_oper[1])) {
wpa_printf(MSG_ERROR, "Could not set HT capabilities " wpa_printf(MSG_ERROR, "Could not set HT capabilities "
"for kernel driver"); "for kernel driver");
} }
start = tailpos;
tailpos = hostapd_eid_ht_operation(hapd, tailpos);
if (hostapd_set_ht_operation(hapd->conf->iface, hapd,
start + 2))
wpa_printf(MSG_ERROR, "Could not set HT operation for "
"kernel driver");
} }
#endif /* CONFIG_IEEE80211N */ #endif /* CONFIG_IEEE80211N */

View file

@ -176,10 +176,9 @@ struct wpa_driver_ops {
u32 session_timeout); u32 session_timeout);
int (*set_radius_acl_expire)(void *priv, const u8 *mac); int (*set_radius_acl_expire)(void *priv, const u8 *mac);
int (*set_ht_capability)(const char *ifname, void *priv, int (*set_ht_params)(const char *ifname, void *priv,
const u8 *data, size_t data_len); const u8 *ht_capab, size_t ht_capab_len,
int (*set_ht_operation)(const char *ifname, void *priv, const u8 *ht_oper, size_t ht_oper_len);
const u8 *data, size_t data_len);
int (*set_wps_beacon_ie)(const char *ifname, void *priv, int (*set_wps_beacon_ie)(const char *ifname, void *priv,
const u8 *ie, size_t len); const u8 *ie, size_t len);
@ -733,27 +732,16 @@ hostapd_set_radius_acl_expire(struct hostapd_data *hapd, const u8 *mac)
#ifdef CONFIG_IEEE80211N #ifdef CONFIG_IEEE80211N
static inline int static inline int
hostapd_set_ht_capability(const char *ifname, struct hostapd_data *hapd, hostapd_set_ht_params(const char *ifname, struct hostapd_data *hapd,
const u8 *ht_cap) const u8 *ht_capab, size_t ht_capab_len,
const u8 *ht_oper, size_t ht_oper_len)
{ {
if (hapd->driver == NULL || hapd->driver->set_ht_capability == NULL || if (hapd->driver == NULL || hapd->driver->set_ht_params == NULL ||
ht_cap == NULL) ht_capab == NULL || ht_oper == NULL)
return 0; return 0;
return hapd->driver->set_ht_capability( return hapd->driver->set_ht_params(
ifname, hapd->drv_priv, ht_cap, ifname, hapd->drv_priv, ht_capab, ht_capab_len,
sizeof(struct ieee80211_ht_capability)); ht_oper, ht_oper_len);
}
static inline int
hostapd_set_ht_operation(const char *ifname, struct hostapd_data *hapd,
const u8 *ht_operation)
{
if (hapd->driver == NULL || hapd->driver->set_ht_operation == NULL ||
ht_operation == NULL)
return 0;
return hapd->driver->set_ht_operation(
ifname, hapd->drv_priv, ht_operation,
sizeof(struct ieee80211_ht_operation));
} }
#endif /* CONFIG_IEEE80211N */ #endif /* CONFIG_IEEE80211N */