From dcca2219aec260fba9d8b1c5eb010fd6bfe64efd Mon Sep 17 00:00:00 2001 From: Andrei Otcheretianski Date: Thu, 14 Nov 2013 12:28:29 +0200 Subject: [PATCH] wpa_supplicant: Update channel switch driver interface Add csa_settings struct which holds parameters for CSA. Change driver interface for switch_channel(), so that it will receive this struct and not only the new frequency as it was before. This allows wpa_supplicant to provide all the required parameters (beacons, proberesp, assocresp, CSA IE) which are required by cfg80211 implementation. Signed-hostap: Andrei Otcheretianski --- src/drivers/driver.h | 57 +++++++++++++++++++++++++++++++++++++-- wpa_supplicant/driver_i.h | 4 +-- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index c56af83bc..55b344d57 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1163,6 +1163,59 @@ struct wpa_signal_info { int center_frq2; }; +/** + * struct beacon_data - Beacon data + * @head: Head portion of Beacon frame (before TIM IE) + * @tail: Tail portion of Beacon frame (after TIM IE) + * @beacon_ies: Extra information element(s) to add into Beacon frames or %NULL + * @proberesp_ies: Extra information element(s) to add into Probe Response + * frames or %NULL + * @assocresp_ies: Extra information element(s) to add into (Re)Association + * Response frames or %NULL + * @probe_resp: Probe Response frame template + * @head_len: Length of @head + * @tail_len: Length of @tail + * @beacon_ies_len: Length of beacon_ies in octets + * @proberesp_ies_len: Length of proberesp_ies in octets + * @proberesp_ies_len: Length of proberesp_ies in octets + * @probe_resp_len: Length of probe response template (@probe_resp) + */ +struct beacon_data { + u8 *head, *tail; + u8 *beacon_ies; + u8 *proberesp_ies; + u8 *assocresp_ies; + u8 *probe_resp; + + size_t head_len, tail_len; + size_t beacon_ies_len; + size_t proberesp_ies_len; + size_t assocresp_ies_len; + size_t probe_resp_len; +}; + +/** + * struct csa_settings - Settings for channel switch command + * @cs_count: Count in Beacon frames (TBTT) to perform the switch + * @block_tx: 1 - block transmission for CSA period + * @freq_params: Next channel frequency parameter + * @beacon_csa: Beacon/probe resp/asooc resp info for CSA period + * @beacon_after: Next beacon/probe resp/asooc resp info + * @counter_offset_beacon: Offset to the count field in beacon's tail + * @counter_offset_presp: Offset to the count field in probe resp. + */ +struct csa_settings { + u8 cs_count; + u8 block_tx; + + struct hostapd_freq_params freq_params; + struct beacon_data beacon_csa; + struct beacon_data beacon_after; + + u16 counter_offset_beacon; + u16 counter_offset_presp; +}; + /** * struct wpa_driver_ops - Driver interface API definition * @@ -2754,13 +2807,13 @@ struct wpa_driver_ops { * switch_channel - Announce channel switch and migrate the GO to the * given frequency * @priv: Private driver interface data - * @freq: Frequency in MHz + * @settings: Settings for CSA period and new channel * Returns: 0 on success, -1 on failure * * This function is used to move the GO to the legacy STA channel to * avoid frequency conflict in single channel concurrency. */ - int (*switch_channel)(void *priv, unsigned int freq); + int (*switch_channel)(void *priv, struct csa_settings *settings); /** * start_dfs_cac - Listen for radar interference on the channel diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index 6b5d49a83..56d652990 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -683,11 +683,11 @@ static inline int wpa_drv_radio_disable(struct wpa_supplicant *wpa_s, } static inline int wpa_drv_switch_channel(struct wpa_supplicant *wpa_s, - unsigned int freq) + struct csa_settings *settings) { if (!wpa_s->driver->switch_channel) return -1; - return wpa_s->driver->switch_channel(wpa_s->drv_priv, freq); + return wpa_s->driver->switch_channel(wpa_s->drv_priv, settings); } static inline int wpa_drv_wnm_oper(struct wpa_supplicant *wpa_s,