[PATCH 03/14] ap: Store computed channel in cs_freq_params

Ilan Peer ilan.peer
Mon May 19 00:07:05 PDT 2014


From: Andrei Otcheretianski <andrei.otcheretianski at intel.com>

When CSA is started, hostapd_change_config_freq computes channel from provided
frequency. Store this channel, and use it to add CSA IE in beacons, instead
of recomputing it each time

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 src/ap/beacon.c  |   10 ++--------
 src/ap/hostapd.c |    2 ++
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index ca4fc71..f9ec5c8 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -263,19 +263,13 @@ static u8 * hostapd_eid_wpa(struct hostapd_data *hapd, u8 *eid, size_t len)
 
 static u8 * hostapd_eid_csa(struct hostapd_data *hapd, u8 *eid)
 {
-	u8 chan;
-
-	if (!hapd->iface->cs_freq_params.freq)
-		return eid;
-
-	if (ieee80211_freq_to_chan(hapd->iface->cs_freq_params.freq, &chan) ==
-	    NUM_HOSTAPD_MODES)
+	if (!hapd->iface->cs_freq_params.channel)
 		return eid;
 
 	*eid++ = WLAN_EID_CHANNEL_SWITCH;
 	*eid++ = 3;
 	*eid++ = hapd->iface->cs_block_tx;
-	*eid++ = chan;
+	*eid++ = hapd->iface->cs_freq_params.channel;
 	*eid++ = hapd->iface->cs_count;
 
 	return eid;
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 16ceea1..e5a75ab 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2266,6 +2266,8 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
 		channel = hostapd_hw_get_channel(hapd, params->freq);
 		if (!channel)
 			return -1;
+
+		params->channel = channel;
 	} else {
 		channel = params->channel;
 	}
-- 
1.7.10.4




More information about the Hostap mailing list