]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
driver: Make DFS domain information available to core
authorVasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Fri, 12 May 2017 07:48:00 +0000 (13:18 +0530)
committerJouni Malinen <j@w1.fi>
Sat, 13 May 2017 17:01:44 +0000 (20:01 +0300)
Current DFS domain information of the driver can be used in ap/dfs
to comply with DFS domain specific requirements like uniform spreading
for ETSI domain.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
src/ap/ap_drv_ops.c
src/ap/ap_drv_ops.h
src/ap/hw_features.c
src/drivers/driver.h
src/drivers/driver_hostap.c
src/drivers/driver_nl80211.h
src/drivers/driver_nl80211_capa.c
wpa_supplicant/driver_i.h
wpa_supplicant/events.c
wpa_supplicant/wpa_supplicant.c

index c1861cb8ba10cd65aab4279c5bf033086b613c7a..ecf60e2479faafb6f01724ae0d54655adaea60f6 100644 (file)
@@ -596,13 +596,13 @@ int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
 
 struct hostapd_hw_modes *
 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
-                           u16 *flags)
+                           u16 *flags, u8 *dfs_domain)
 {
        if (hapd->driver == NULL ||
            hapd->driver->get_hw_feature_data == NULL)
                return NULL;
        return hapd->driver->get_hw_feature_data(hapd->drv_priv, num_modes,
-                                                flags);
+                                                flags, dfs_domain);
 }
 
 
index aa82eb3a711687db4bdff94347df588c42b3a8f0..b598015a919b5ffa36fe26de1ea22a92c0f19764 100644 (file)
@@ -72,7 +72,7 @@ int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
                                int cw_min, int cw_max, int burst_time);
 struct hostapd_hw_modes *
 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
-                           u16 *flags);
+                           u16 *flags, u8 *dfs_domain);
 int hostapd_driver_commit(struct hostapd_data *hapd);
 int hostapd_drv_none(struct hostapd_data *hapd);
 int hostapd_driver_scan(struct hostapd_data *hapd,
index c677d30f4781cbf576e5d4a851c45aaab2c894be..da7c3f6371e4cff091d84fcb51d28e330dc2352e 100644 (file)
@@ -78,10 +78,12 @@ int hostapd_get_hw_features(struct hostapd_iface *iface)
        int i, j;
        u16 num_modes, flags;
        struct hostapd_hw_modes *modes;
+       u8 dfs_domain;
 
        if (hostapd_drv_none(hapd))
                return -1;
-       modes = hostapd_get_hw_feature_data(hapd, &num_modes, &flags);
+       modes = hostapd_get_hw_feature_data(hapd, &num_modes, &flags,
+                                           &dfs_domain);
        if (modes == NULL) {
                hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
                               HOSTAPD_LEVEL_DEBUG,
index 8103c28e4098c8cc78d92ef326131b2b0324047a..9587d063e79b640f33d8a98febf37e9ee30efa36 100644 (file)
 /* Filter unicast IP packets encrypted using the GTK */
 #define WPA_DATA_FRAME_FILTER_FLAG_GTK BIT(2)
 
+#define HOSTAPD_DFS_REGION_FCC 1
+#define HOSTAPD_DFS_REGION_ETSI        2
+#define HOSTAPD_DFS_REGION_JP  3
+
 /**
  * enum reg_change_initiator - Regulatory change initiator
  */
@@ -2368,12 +2372,13 @@ struct wpa_driver_ops {
         * @priv: Private driver interface data
         * @num_modes: Variable for returning the number of returned modes
         * flags: Variable for returning hardware feature flags
+        * @dfs: Variable for returning DFS region (HOSTAPD_DFS_REGION_*)
         * Returns: Pointer to allocated hardware data on success or %NULL on
         * failure. Caller is responsible for freeing this.
         */
        struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
                                                         u16 *num_modes,
-                                                        u16 *flags);
+                                                        u16 *flags, u8 *dfs);
 
        /**
         * send_mlme - Send management frame from MLME
index c657ce918bd2d7aeee956a93b47f27d9dbc6716c..597da335e4748206b179176e1ed573215abe8b02 100644 (file)
@@ -1088,7 +1088,7 @@ static int hostap_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
 
 static struct hostapd_hw_modes * hostap_get_hw_feature_data(void *priv,
                                                            u16 *num_modes,
-                                                           u16 *flags)
+                                                           u16 *flags, u8 *dfs)
 {
        struct hostapd_hw_modes *mode;
        int i, clen, rlen;
@@ -1103,6 +1103,7 @@ static struct hostapd_hw_modes * hostap_get_hw_feature_data(void *priv,
 
        *num_modes = 1;
        *flags = 0;
+       *dfs = 0;
 
        mode->mode = HOSTAPD_MODE_IEEE80211B;
        mode->num_channels = 14;
index 7e1f52c2562dcc649ba8ce627cbeaf68587ccccd..3eaccaa9b947593e6757b2e3ab336ebf842af075 100644 (file)
@@ -260,7 +260,8 @@ int nl80211_send_monitor(struct wpa_driver_nl80211_data *drv,
 
 int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv);
 struct hostapd_hw_modes *
-nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags);
+nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags,
+                           u8 *dfs_domain);
 
 int process_global_event(struct nl_msg *msg, void *arg);
 int process_bss_event(struct nl_msg *msg, void *arg);
index ea7bac1d60a4d248f9cf9f60706b6d67f54674d2..9aa4e14e6aaea3867a235cfaac44043ab8e2702b 100644 (file)
@@ -1209,6 +1209,7 @@ struct phy_info_arg {
        struct hostapd_hw_modes *modes;
        int last_mode, last_chan_idx;
        int failed;
+       u8 dfs_domain;
 };
 
 static void phy_info_ht_capa(struct hostapd_hw_modes *mode, struct nlattr *capa,
@@ -1737,6 +1738,20 @@ static void nl80211_reg_rule_vht(struct nlattr *tb[],
 }
 
 
+static void nl80211_set_dfs_domain(enum nl80211_dfs_regions region,
+                                  u8 *dfs_domain)
+{
+       if (region == NL80211_DFS_FCC)
+               *dfs_domain = HOSTAPD_DFS_REGION_FCC;
+       else if (region == NL80211_DFS_ETSI)
+               *dfs_domain = HOSTAPD_DFS_REGION_ETSI;
+       else if (region == NL80211_DFS_JP)
+               *dfs_domain = HOSTAPD_DFS_REGION_JP;
+       else
+               *dfs_domain = 0;
+}
+
+
 static const char * dfs_domain_name(enum nl80211_dfs_regions region)
 {
        switch (region) {
@@ -1783,6 +1798,7 @@ static int nl80211_get_reg(struct nl_msg *msg, void *arg)
        if (tb_msg[NL80211_ATTR_DFS_REGION]) {
                enum nl80211_dfs_regions dfs_domain;
                dfs_domain = nla_get_u8(tb_msg[NL80211_ATTR_DFS_REGION]);
+               nl80211_set_dfs_domain(dfs_domain, &results->dfs_domain);
                wpa_printf(MSG_DEBUG, "nl80211: Regulatory information - country=%s (%s)",
                           (char *) nla_data(tb_msg[NL80211_ATTR_REG_ALPHA2]),
                           dfs_domain_name(dfs_domain));
@@ -1859,7 +1875,8 @@ static int nl80211_set_regulatory_flags(struct wpa_driver_nl80211_data *drv,
 
 
 struct hostapd_hw_modes *
-nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags)
+nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags,
+                           u8 *dfs_domain)
 {
        u32 feat;
        struct i802_bss *bss = priv;
@@ -1871,10 +1888,12 @@ nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags)
                .modes = NULL,
                .last_mode = -1,
                .failed = 0,
+               .dfs_domain = 0,
        };
 
        *num_modes = 0;
        *flags = 0;
+       *dfs_domain = 0;
 
        feat = get_nl80211_protocol_features(drv);
        if (feat & NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP)
@@ -1898,6 +1917,9 @@ nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags)
                        *num_modes = 0;
                        return NULL;
                }
+
+               *dfs_domain = result.dfs_domain;
+
                return wpa_driver_nl80211_postprocess_modes(result.modes,
                                                            num_modes);
        }
index 39b08ac099bc2078f64548f9208a878b7705742c..fa2296b7336e93acad3e42716c87f41e14717c1f 100644 (file)
@@ -275,11 +275,12 @@ static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
 
 static inline struct hostapd_hw_modes *
 wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
-                           u16 *flags)
+                           u16 *flags, u8 *dfs_domain)
 {
        if (wpa_s->driver->get_hw_feature_data)
                return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
-                                                         num_modes, flags);
+                                                         num_modes, flags,
+                                                         dfs_domain);
        return NULL;
 }
 
index e6f6b000e754ca3f79f0dcedfaffd5701269e0b6..3a2ec64e6b398d60b66e072537e303449a093f7d 100644 (file)
@@ -3428,6 +3428,7 @@ static void wpa_supplicant_update_channel_list(
        struct wpa_supplicant *wpa_s, struct channel_list_changed *info)
 {
        struct wpa_supplicant *ifs;
+       u8 dfs_domain;
 
        /*
         * To allow backwards compatibility with higher level layers that
@@ -3452,7 +3453,7 @@ static void wpa_supplicant_update_channel_list(
                           ifs->ifname);
                free_hw_features(ifs);
                ifs->hw.modes = wpa_drv_get_hw_feature_data(
-                       ifs, &ifs->hw.num_modes, &ifs->hw.flags);
+                       ifs, &ifs->hw.num_modes, &ifs->hw.flags, &dfs_domain);
 
                /* Restart PNO/sched_scan with updated channel list */
                if (ifs->pno) {
index b4680eae91900612cafa5f39dc84729e4db478cb..b72e0df38608fb09c3928d794181039a4c5426b4 100644 (file)
@@ -4939,6 +4939,7 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
 {
        struct wpa_driver_capa capa;
        int capa_res;
+       u8 dfs_domain;
 
        wpa_printf(MSG_DEBUG, "Initializing interface '%s' conf '%s' driver "
                   "'%s' ctrl_interface '%s' bridge '%s'", iface->ifname,
@@ -5066,7 +5067,8 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
 
        wpa_s->hw.modes = wpa_drv_get_hw_feature_data(wpa_s,
                                                      &wpa_s->hw.num_modes,
-                                                     &wpa_s->hw.flags);
+                                                     &wpa_s->hw.flags,
+                                                     &dfs_domain);
        if (wpa_s->hw.modes) {
                u16 i;