aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/driver_nl80211.c
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2014-04-29 10:53:02 -0700
committerDmitry Shmidt <dimitrysh@google.com>2014-04-29 10:53:02 -0700
commit7832adbbd72a1b784b7fb74a71a5d4085b0cb0d3 (patch)
tree10a92c1068bf401c047f88baa658cafd2710f433 /src/drivers/driver_nl80211.c
parentf9bdef99ce3b2858f2812c745a3d6bb093fb0e5d (diff)
downloadandroid_external_wpa_supplicant_8-7832adbbd72a1b784b7fb74a71a5d4085b0cb0d3.tar.gz
android_external_wpa_supplicant_8-7832adbbd72a1b784b7fb74a71a5d4085b0cb0d3.tar.bz2
android_external_wpa_supplicant_8-7832adbbd72a1b784b7fb74a71a5d4085b0cb0d3.zip
Cumulative patch from commit c0333c8dd59b9e254d3fc725c984b1c0cd3d496a
c0333c8 Check rx_mgmt::frame more consistently against NULL d6c6b1f Make sta NULL-check easier for static analyzers 0bceb8d Make dl_list_first() and dl_list_last() uses easier for static analyzers 5f693cb WPS HTTP: Remove unused assignment ee4fefc Remove duplicated variable zeroing 4a9d0eb Make PMKID check easier for static analyzers 06df2aa Remove floating constant suffix 'd' from test coee 9670f87 ACS: Clean up ifdef CONFIG_ACS to avoid unreachable code ece88f7 Make last_scan_res update easier for static analyzers d06e9ac P2P: Verify operating channel validity for NFC connection handover 13a524a nl80211: Remove unnecessary wpa_driver_nl80211_set_freq() wrapper e87ef75 nl80211: Add support for changing AP mode channel bandwidth 3057518 Sync with mac80211-next.git nl80211.h 5f0bca7 Retry initial 20/40 MHz co-ex scan if the driver is busy 587d60d Add AP mode support for HT 20/40 co-ex Action frame 9c47f6a hostapd: Extend support for HT 20/40 coexistence feature 196c9c7 Make channel parameters available in set_ap() driver operation b7a6702 Indicate disconnection event on interface disabled b89962b Fix wpa_config_read() with existing config block 27b4187 WPS: Print setsockopt() failure in debug log 52cb207 trace: Replace demangle.h with internal defines 0e80ea2 nl80211: Fix some coding style issues a26582c Make qca-vendor.h independent of other header files 4a64d5a nl80211: Allocate QCA vendor subcmd for extended statistics Change-Id: Ibabee77b2b87f04f99d6b1ca0f1ac741cb9222c0 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'src/drivers/driver_nl80211.c')
-rw-r--r--src/drivers/driver_nl80211.c62
1 files changed, 46 insertions, 16 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 1300703e..b0c8a35f 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -29,6 +29,7 @@
#include "eloop.h"
#include "utils/list.h"
#include "common/qca-vendor.h"
+#include "common/qca-vendor-attr.h"
#include "common/ieee802_11_defs.h"
#include "common/ieee802_11_common.h"
#include "l2_packet/l2_packet.h"
@@ -235,6 +236,7 @@ struct i802_bss {
u8 addr[ETH_ALEN];
int freq;
+ int bandwidth;
int if_dynamic;
void *ctx;
@@ -385,8 +387,8 @@ static int wpa_driver_nl80211_if_remove(struct i802_bss *bss,
enum wpa_driver_if_type type,
const char *ifname);
-static int wpa_driver_nl80211_set_freq(struct i802_bss *bss,
- struct hostapd_freq_params *freq);
+static int nl80211_set_channel(struct i802_bss *bss,
+ struct hostapd_freq_params *freq, int set_chan);
static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
int ifindex, int disabled);
@@ -536,22 +538,22 @@ static enum chan_width convert2width(int width)
static int is_ap_interface(enum nl80211_iftype nlmode)
{
- return (nlmode == NL80211_IFTYPE_AP ||
- nlmode == NL80211_IFTYPE_P2P_GO);
+ return nlmode == NL80211_IFTYPE_AP ||
+ nlmode == NL80211_IFTYPE_P2P_GO;
}
static int is_sta_interface(enum nl80211_iftype nlmode)
{
- return (nlmode == NL80211_IFTYPE_STATION ||
- nlmode == NL80211_IFTYPE_P2P_CLIENT);
+ return nlmode == NL80211_IFTYPE_STATION ||
+ nlmode == NL80211_IFTYPE_P2P_CLIENT;
}
static int is_p2p_net_interface(enum nl80211_iftype nlmode)
{
- return (nlmode == NL80211_IFTYPE_P2P_CLIENT ||
- nlmode == NL80211_IFTYPE_P2P_GO);
+ return nlmode == NL80211_IFTYPE_P2P_CLIENT ||
+ nlmode == NL80211_IFTYPE_P2P_GO;
}
@@ -3656,6 +3658,9 @@ static void wiphy_info_feature_flags(struct wiphy_info_data *info,
if (flags & NL80211_FEATURE_NEED_OBSS_SCAN)
capa->flags |= WPA_DRIVER_FLAGS_OBSS_SCAN;
+
+ if (flags & NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE)
+ capa->flags |= WPA_DRIVER_FLAGS_HT_2040_COEX;
}
@@ -4522,7 +4527,7 @@ static int nl80211_mgmt_subscribe_ap(struct i802_bss *bss)
* it isn't per interface ... maybe just dump the scan
* results periodically for OLBC?
*/
-// WLAN_FC_STYPE_BEACON,
+ /* WLAN_FC_STYPE_BEACON, */
};
unsigned int i;
@@ -7299,6 +7304,30 @@ static int wpa_driver_nl80211_set_ap(void *priv,
nl80211_set_bss(bss, params->cts_protect, params->preamble,
params->short_slot_time, params->ht_opmode,
params->isolate, params->basic_rates);
+ if (beacon_set && params->freq &&
+ params->freq->bandwidth != bss->bandwidth) {
+ wpa_printf(MSG_DEBUG,
+ "nl80211: Update BSS %s bandwidth: %d -> %d",
+ bss->ifname, bss->bandwidth,
+ params->freq->bandwidth);
+ ret = nl80211_set_channel(bss, params->freq, 1);
+ if (ret) {
+ wpa_printf(MSG_DEBUG,
+ "nl80211: Frequency set failed: %d (%s)",
+ ret, strerror(-ret));
+ } else {
+ wpa_printf(MSG_DEBUG,
+ "nl80211: Frequency set succeeded for ht2040 coex");
+ bss->bandwidth = params->freq->bandwidth;
+ }
+ } else if (!beacon_set) {
+ /*
+ * cfg80211 updates the driver on frequence change in AP
+ * mode only at the point when beaconing is started, so
+ * set the initial value here.
+ */
+ bss->bandwidth = params->freq->bandwidth;
+ }
}
return ret;
nla_put_failure:
@@ -7363,8 +7392,8 @@ nla_put_failure:
}
-static int wpa_driver_nl80211_set_freq(struct i802_bss *bss,
- struct hostapd_freq_params *freq)
+static int nl80211_set_channel(struct i802_bss *bss,
+ struct hostapd_freq_params *freq, int set_chan)
{
struct wpa_driver_nl80211_data *drv = bss->drv;
struct nl_msg *msg;
@@ -7378,7 +7407,8 @@ static int wpa_driver_nl80211_set_freq(struct i802_bss *bss,
if (!msg)
return -1;
- nl80211_cmd(drv, msg, 0, NL80211_CMD_SET_WIPHY);
+ nl80211_cmd(drv, msg, 0, set_chan ? NL80211_CMD_SET_CHANNEL :
+ NL80211_CMD_SET_WIPHY);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
if (nl80211_put_freq_params(msg, freq) < 0)
@@ -7841,7 +7871,7 @@ static void handle_monitor_read(int sock, void *eloop_ctx, void *sock_ctx)
return;
}
- if (ieee80211_radiotap_iterator_init(&iter, (void*)buf, len, NULL)) {
+ if (ieee80211_radiotap_iterator_init(&iter, (void *) buf, len, NULL)) {
wpa_printf(MSG_INFO, "nl80211: received invalid radiotap frame");
return;
}
@@ -8395,7 +8425,7 @@ static int wpa_driver_nl80211_ap(struct wpa_driver_nl80211_data *drv,
return -1;
}
- if (wpa_driver_nl80211_set_freq(drv->first_bss, &freq)) {
+ if (nl80211_set_channel(drv->first_bss, &freq, 0)) {
if (old_mode != nlmode)
wpa_driver_nl80211_set_mode(drv->first_bss, old_mode);
nl80211_remove_monitor_interface(drv);
@@ -9121,7 +9151,7 @@ static int wpa_driver_nl80211_set_supp_port(void *priv, int authorized)
static int i802_set_freq(void *priv, struct hostapd_freq_params *freq)
{
struct i802_bss *bss = priv;
- return wpa_driver_nl80211_set_freq(bss, freq);
+ return nl80211_set_channel(bss, freq, 0);
}
@@ -9620,7 +9650,7 @@ static int have_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx)
static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
- const char *bridge_ifname, char *ifname_wds)
+ const char *bridge_ifname, char *ifname_wds)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;