hostapd: Add IEEE 802.11ac VHT IEs into Beacon/Probe Response
authorMahesh Palivela <maheshp@posedge.com>
Sat, 30 Jun 2012 10:57:52 +0000 (13:57 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 30 Jun 2012 10:57:52 +0000 (13:57 +0300)
IEEE 802.11ac VHT changes to include VHT IEs in Beacon and Probe
Response frames.

Signed-hostap: Mahesh Palivela <maheshp@posedge.com>

hostapd/Makefile
src/ap/beacon.c
src/ap/ieee802_11.h
src/ap/ieee802_11_vht.c [new file with mode: 0644]

index 5789ee3..b43aa75 100644 (file)
@@ -761,6 +761,10 @@ ifdef CONFIG_IEEE80211N
 OBJS += ../src/ap/ieee802_11_ht.o
 endif
 
+ifdef CONFIG_IEEE80211AC
+OBJS += ../src/ap/ieee802_11_vht.o
+endif
+
 ifdef CONFIG_P2P_MANAGER
 CFLAGS += -DCONFIG_P2P_MANAGER
 OBJS += ../src/ap/p2p_hostapd.o
index b711063..0f29ccd 100644 (file)
@@ -262,6 +262,11 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
        pos = hostapd_eid_adv_proto(hapd, pos);
        pos = hostapd_eid_roaming_consortium(hapd, pos);
 
+#ifdef CONFIG_IEEE80211AC
+       pos = hostapd_eid_vht_capabilities(hapd, pos);
+       pos = hostapd_eid_vht_operation(hapd, pos);
+#endif /* CONFIG_IEEE80211AC */
+
        /* Wi-Fi Alliance WMM */
        pos = hostapd_eid_wmm(hapd, pos);
 
@@ -595,6 +600,11 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
        tailpos = hostapd_eid_adv_proto(hapd, tailpos);
        tailpos = hostapd_eid_roaming_consortium(hapd, tailpos);
 
+#ifdef CONFIG_IEEE80211AC
+       tailpos = hostapd_eid_vht_capabilities(hapd, tailpos);
+       tailpos = hostapd_eid_vht_operation(hapd, tailpos);
+#endif /* CONFIG_IEEE80211AC */
+
        /* Wi-Fi Alliance WMM */
        tailpos = hostapd_eid_wmm(hapd, tailpos);
 
index b60350f..9993bee 100644 (file)
@@ -45,6 +45,8 @@ u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid);
 u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid);
 u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid);
 u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid);
+u8 * hostapd_eid_vht_capabilities(struct hostapd_data *hapd, u8 *eid);
+u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid);
 int hostapd_ht_operation_update(struct hostapd_iface *iface);
 void ieee802_11_send_sa_query_req(struct hostapd_data *hapd,
                                  const u8 *addr, const u8 *trans_id);
diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c
new file mode 100644 (file)
index 0000000..3ad33c8
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * hostapd / IEEE 802.11ac VHT
+ * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of BSD license
+ *
+ * See README and COPYING for more details.
+ */
+
+#include "utils/includes.h"
+
+#include "utils/common.h"
+#include "common/ieee802_11_defs.h"
+#include "drivers/driver.h"
+#include "hostapd.h"
+#include "ap_config.h"
+#include "sta_info.h"
+#include "beacon.h"
+#include "ieee802_11.h"
+
+
+u8 * hostapd_eid_vht_capabilities(struct hostapd_data *hapd, u8 *eid)
+{
+       struct ieee80211_vht_capabilities *cap;
+       u8 *pos = eid;
+
+       if (!hapd->iconf->ieee80211ac || !hapd->iface->current_mode ||
+           hapd->conf->disable_11ac)
+               return eid;
+
+       *pos++ = WLAN_EID_VHT_CAP;
+       *pos++ = sizeof(*cap);
+
+       cap = (struct ieee80211_vht_capabilities *) pos;
+       os_memset(cap, 0, sizeof(*cap));
+       cap->vht_capabilities_info = host_to_le32(
+               hapd->iface->current_mode->vht_capab);
+
+       /* Supported MCS set comes from hw */
+       os_memcpy(cap->vht_supported_mcs_set,
+                 hapd->iface->current_mode->vht_mcs_set, 8);
+
+       pos += sizeof(*cap);
+
+       return pos;
+}
+
+
+u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
+{
+       struct ieee80211_vht_operation *oper;
+       u8 *pos = eid;
+
+       if (!hapd->iconf->ieee80211ac || hapd->conf->disable_11ac)
+               return eid;
+
+       *pos++ = WLAN_EID_VHT_OPERATION;
+       *pos++ = sizeof(*oper);
+
+       oper = (struct ieee80211_vht_operation *) pos;
+       os_memset(oper, 0, sizeof(*oper));
+
+       oper->vht_op_info_chwidth = hapd->iconf->vht_oper_chwidth;
+
+       /* VHT Basic MCS set comes from hw */
+       /* Hard code 1 stream, MCS0-7 is a min Basic VHT MCS rates */
+       oper->vht_basic_mcs_set = 0xfffc;
+       pos += sizeof(*oper);
+
+       return pos;
+}