diff mbox

[09/23] wpa_supplicant/hostapd: Add awareness of CSA support

Message ID 1404732076-32252-10-git-send-email-ilan.peer@intel.com
State Rejected
Headers show

Commit Message

Peer, Ilan July 7, 2014, 11:21 a.m. UTC
From: Andrei Otcheretianski <andrei.otcheretianski@intel.com>

Store csa_supported flag in wpa_supplicant and hostapd_iface.
Don't start CSA flow when CSA is not supported.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
---
 hostapd/main.c                    |    1 +
 src/ap/hostapd.c                  |    3 ++-
 src/ap/hostapd.h                  |    2 ++
 wpa_supplicant/ap.c               |    1 +
 wpa_supplicant/wpa_supplicant.c   |    1 +
 wpa_supplicant/wpa_supplicant_i.h |    2 ++
 6 files changed, 9 insertions(+), 1 deletion(-)

Comments

Jouni Malinen March 30, 2015, 4:56 p.m. UTC | #1
On Mon, Jul 07, 2014 at 02:21:02PM +0300, Ilan Peer wrote:
> Store csa_supported flag in wpa_supplicant and hostapd_iface.
> Don't start CSA flow when CSA is not supported.

I'm dropping this since an earlier commit (from the same author for that
matter!) already took care of stopping CSA flow when CSA is not
supported (see commit d66873f5cf804bc247aa5c01cc3d5f17e5df35da ('Do not
start CSA flow when CSA is not supported by the driver').

There is no need to make another copy of the WPA_DRIVER_FLAGS_AP_CSA as
csa_supported since the set of driver flags are available in the same
data structures.
diff mbox

Patch

diff --git a/hostapd/main.c b/hostapd/main.c
index a9d7da5..e4e3f27 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -217,6 +217,7 @@  static int hostapd_driver_init(struct hostapd_iface *iface)
 		iface->extended_capa_mask = capa.extended_capa_mask;
 		iface->extended_capa_len = capa.extended_capa_len;
 		iface->drv_max_acl_mac_addrs = capa.max_acl_mac_addrs;
+		iface->csa_supported = !!(capa.flags & WPA_DRIVER_FLAGS_AP_CSA);
 	}
 
 	return 0;
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 26aca2b..d0a837b 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2314,7 +2314,8 @@  static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
 	int ret;
 
 	os_memset(&old_freq, 0, sizeof(old_freq));
-	if (!iface || !iface->freq || hapd->csa_in_progress)
+	if (!iface || !iface->csa_supported ||
+	    !iface->freq || hapd->csa_in_progress)
 		return -1;
 
 	ret = hostapd_change_config_freq(iface->bss[0], iface->conf,
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 3c8727b..4190956 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -351,6 +351,8 @@  struct hostapd_iface {
 	/* lowest observed noise floor in dBm */
 	s8 lowest_nf;
 
+	unsigned int csa_supported:1;
+
 	unsigned int dfs_cac_ms;
 	struct os_reltime dfs_cac_start;
 
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index f9aa807..82bee6d 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -559,6 +559,7 @@  int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
 	hapd_iface->extended_capa = wpa_s->extended_capa;
 	hapd_iface->extended_capa_mask = wpa_s->extended_capa_mask;
 	hapd_iface->extended_capa_len = wpa_s->extended_capa_len;
+	hapd_iface->csa_supported = wpa_s->csa_supported;
 
 	wpa_s->ap_iface->conf = conf = hostapd_config_defaults();
 	if (conf == NULL) {
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 55570de..e55e502 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -3671,6 +3671,7 @@  static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
 		wpa_s->extended_capa_len = capa.extended_capa_len;
 		wpa_s->num_multichan_concurrent =
 			capa.num_multichan_concurrent;
+		wpa_s->csa_supported = !!(capa.flags & WPA_DRIVER_FLAGS_AP_CSA);
 	}
 	if (wpa_s->max_remain_on_chan == 0)
 		wpa_s->max_remain_on_chan = 1000;
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index bfa5968..32cb2dd 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -865,6 +865,8 @@  struct wpa_supplicant {
 	struct wpa_radio_work *connect_work;
 
 	unsigned int ext_work_id;
+
+	unsigned int csa_supported:1;
 };