]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - build-utilities/hostap.git/commitdiff
Merge set_rate_sets() driver_ops into set_ap()
authorJouni Malinen <j@w1.fi>
Sat, 3 Dec 2011 10:16:03 +0000 (12:16 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 3 Dec 2011 10:16:03 +0000 (12:16 +0200)
Signed-hostap: Jouni Malinen <j@w1.fi>

src/ap/ap_drv_ops.c
src/ap/ap_drv_ops.h
src/ap/beacon.c
src/ap/hostapd.c
src/ap/hostapd.h
src/ap/hw_features.c
src/drivers/driver.h
src/drivers/driver_nl80211.c

index 484db59ccd700844ccaaee96e825ecfc57b0939f..9419440e17f2a8478d7a66134e7da6543ff6e229 100644 (file)
@@ -475,14 +475,6 @@ int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
 }
 
 
-int hostapd_set_rate_sets(struct hostapd_data *hapd, int *basic_rates)
-{
-       if (hapd->driver == NULL || hapd->driver->set_rate_sets == NULL)
-               return 0;
-       return hapd->driver->set_rate_sets(hapd->drv_priv, basic_rates);
-}
-
-
 int hostapd_set_country(struct hostapd_data *hapd, const char *country)
 {
        if (hapd->driver == NULL ||
index 7f8e83a161e84602fa675837ec4a2434d25e2fd8..477a1b745e89d805ac916bfd689a71fdde523586 100644 (file)
@@ -66,7 +66,6 @@ int hostapd_set_rts(struct hostapd_data *hapd, int rts);
 int hostapd_set_frag(struct hostapd_data *hapd, int frag);
 int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
                          int total_flags, int flags_or, int flags_and);
-int hostapd_set_rate_sets(struct hostapd_data *hapd, int *basic_rates);
 int hostapd_set_country(struct hostapd_data *hapd, const char *country);
 int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
                                int cw_min, int cw_max, int burst_time);
index c9bbfa93bc818d9a8ca585ca18fec097277cbb9b..710436f23dd5e1ce671179688b3f64a349487901 100644 (file)
@@ -567,6 +567,7 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
        params.tail_len = tail_len;
        params.dtim_period = hapd->conf->dtim_period;
        params.beacon_int = hapd->iconf->beacon_int;
+       params.basic_rates = hapd->iconf->basic_rates;
        params.ssid = (u8 *) hapd->conf->ssid.ssid;
        params.ssid_len = hapd->conf->ssid.ssid_len;
        params.pairwise_ciphers = hapd->conf->rsn_pairwise ?
index e180a08c5d7eafb8888dc4a867895c4e76eb3e6c..8f3be0efebf2770f4730f80e552dd60f56dda308 100644 (file)
@@ -291,6 +291,8 @@ static void hostapd_cleanup_iface(struct hostapd_iface *iface)
        iface->hw_features = NULL;
        os_free(iface->current_rates);
        iface->current_rates = NULL;
+       os_free(iface->basic_rates);
+       iface->basic_rates = NULL;
        ap_list_deinit(iface);
        hostapd_config_free(iface->conf);
        iface->conf = NULL;
index c9bec4ff1c823915380e5817fac3b21ec25990b5..b717b45b9d9ede43999c086cb9b8f3807cac6015 100644 (file)
@@ -199,6 +199,7 @@ struct hostapd_iface {
         * current_mode->channels */
        int num_rates;
        struct hostapd_rate_data *current_rates;
+       int *basic_rates;
        int freq;
 
        u16 hw_flags;
index d46e74e39c31b4458bc0ba1090cf55bf90bf5e19..36b7f7553e38d4a51fff78075ace3404afbb208b 100644 (file)
@@ -126,10 +126,14 @@ int hostapd_prepare_rates(struct hostapd_data *hapd,
                return -1;
        }
 
-       if (hostapd_set_rate_sets(hapd, basic_rates)) {
-               wpa_printf(MSG_ERROR, "Failed to update rate sets in kernel "
-                          "module");
-       }
+       i = 0;
+       while (basic_rates[i] >= 0)
+               i++;
+       os_free(hapd->iface->basic_rates);
+       hapd->iface->basic_rates = os_malloc(i * sizeof(int *));
+       if (hapd->iface->basic_rates)
+               os_memcpy(hapd->iface->basic_rates, basic_rates,
+                         i * sizeof(int *));
 
        os_free(hapd->iface->current_rates);
        hapd->iface->num_rates = 0;
index 816377b858eb99826ee6523e0d11957b3562dcf7..388b405b86c87d5d63ff001b20bd7e16b0aad400 100644 (file)
@@ -555,6 +555,14 @@ struct wpa_driver_ap_params {
         */
        int beacon_int;
 
+       /**
+        * basic_rates: -1 terminated array of basic rates in 100 kbps
+        *
+        * This parameter can be used to set a specific basic rate set for the
+        * BSS. If %NULL, default basic rate set is used.
+        */
+       int *basic_rates;
+
        /**
         * ssid - The SSID to use in Beacon/Probe Response frames
         */
@@ -1684,14 +1692,6 @@ struct wpa_driver_ops {
        int (*sta_set_flags)(void *priv, const u8 *addr,
                             int total_flags, int flags_or, int flags_and);
 
-       /**
-        * set_rate_sets - Set basic rate set (AP only)
-        * @priv: Private driver interface data
-        * @basic_rates: -1 terminated array of basic rates in 100 kbps
-        * Returns: 0 on success, -1 on failure
-        */
-       int (*set_rate_sets)(void *priv, int *basic_rates);
-
        /**
         * set_tx_queue_params - Set TX queue parameters
         * @priv: Private driver interface data
index d5be4b841e030456e0731f1b62ddd1f6fda2425e..e385e1366e344009f91bd0f5f55ed6fc6ce431a0 100644 (file)
@@ -4285,7 +4285,8 @@ static int wpa_driver_nl80211_send_mlme(void *priv, const u8 *data,
 
 
 static int nl80211_set_bss(struct i802_bss *bss, int cts, int preamble,
-                          int slot, int ht_opmode, int ap_isolate)
+                          int slot, int ht_opmode, int ap_isolate,
+                          int *basic_rates)
 {
        struct wpa_driver_nl80211_data *drv = bss->drv;
        struct nl_msg *msg;
@@ -4306,6 +4307,19 @@ static int nl80211_set_bss(struct i802_bss *bss, int cts, int preamble,
                NLA_PUT_U16(msg, NL80211_ATTR_BSS_HT_OPMODE, ht_opmode);
        if (ap_isolate >= 0)
                NLA_PUT_U8(msg, NL80211_ATTR_AP_ISOLATE, ap_isolate);
+
+       if (basic_rates) {
+               u8 rates[NL80211_MAX_SUPP_RATES];
+               u8 rates_len = 0;
+               int i;
+
+               for (i = 0; i < NL80211_MAX_SUPP_RATES && basic_rates[i] >= 0;
+                    i++)
+                       rates[rates_len++] = basic_rates[i] / 5;
+
+               NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, rates_len, rates);
+       }
+
        NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname));
 
        return send_and_recv_msgs(drv, msg, NULL, NULL);
@@ -4447,7 +4461,7 @@ static int wpa_driver_nl80211_set_ap(void *priv,
                bss->beacon_set = 1;
                nl80211_set_bss(bss, params->cts_protect, params->preamble,
                                params->short_slot_time, params->ht_opmode,
-                               params->isolate);
+                               params->isolate, params->basic_rates);
        }
        return ret;
  nla_put_failure:
@@ -6017,34 +6031,6 @@ static int i802_get_seqnum(const char *iface, void *priv, const u8 *addr,
 }
 
 
-static int i802_set_rate_sets(void *priv, int *basic_rates)
-{
-       struct i802_bss *bss = priv;
-       struct wpa_driver_nl80211_data *drv = bss->drv;
-       struct nl_msg *msg;
-       u8 rates[NL80211_MAX_SUPP_RATES];
-       u8 rates_len = 0;
-       int i;
-
-       msg = nlmsg_alloc();
-       if (!msg)
-               return -ENOMEM;
-
-       nl80211_cmd(drv, msg, 0, NL80211_CMD_SET_BSS);
-
-       for (i = 0; i < NL80211_MAX_SUPP_RATES && basic_rates[i] >= 0; i++)
-               rates[rates_len++] = basic_rates[i] / 5;
-
-       NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, rates_len, rates);
-
-       NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname));
-
-       return send_and_recv_msgs(drv, msg, NULL, NULL);
- nla_put_failure:
-       return -ENOBUFS;
-}
-
-
 static int i802_set_rts(void *priv, int rts)
 {
        struct i802_bss *bss = priv;
@@ -7864,7 +7850,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
        .set_frag = i802_set_frag,
        .set_tx_queue_params = i802_set_tx_queue_params,
        .set_sta_vlan = i802_set_sta_vlan,
-       .set_rate_sets = i802_set_rate_sets,
        .sta_deauth = i802_sta_deauth,
        .sta_disassoc = i802_sta_disassoc,
 #endif /* HOSTAPD || CONFIG_AP */