]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
wl1271: Update join usage
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>
Thu, 8 Oct 2009 18:56:25 +0000 (21:56 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 27 Oct 2009 20:47:50 +0000 (16:47 -0400)
Update the usage of join's, including using actual beacon interval and
dtim from AP, and configuring a basic rate set from AP.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/wl12xx/wl1271.h
drivers/net/wireless/wl12xx/wl1271_cmd.c
drivers/net/wireless/wl12xx/wl1271_cmd.h
drivers/net/wireless/wl12xx/wl1271_main.c

index 671dc5af2e689330cdbafd3fe86cf757360e56c0..05eb29c847c6b804b43c677dacc58c4b8b0aa7d3 100644 (file)
@@ -104,6 +104,8 @@ enum {
                                  CFG_RX_CTL_EN | CFG_RX_BCN_EN |     \
                                  CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN)
 
+#define WL1271_DEFAULT_BASIC_RATE_SET (ACX_RATE_MASK_ALL)
+
 #define WL1271_FW_NAME "wl1271-fw.bin"
 #define WL1271_NVS_NAME "wl1271-nvs.bin"
 
@@ -118,6 +120,9 @@ enum {
 #define WL1271_ELP_HW_STATE_ASLEEP 0
 #define WL1271_ELP_HW_STATE_IRQ    1
 
+#define WL1271_DEFAULT_BEACON_INT  100
+#define WL1271_DEFAULT_DTIM_PERIOD 1
+
 enum wl1271_state {
        WL1271_STATE_OFF,
        WL1271_STATE_ON,
@@ -369,6 +374,13 @@ struct wl1271 {
        /* Our association ID */
        u16 aid;
 
+       /* Beacon parameters */
+       u16 beacon_int;
+       u8 dtim_period;
+
+       /* currently configured rate set */
+       u32 basic_rate_set;
+
        /* The current band */
        enum ieee80211_band band;
 
index bd65b38eb1d9b6c952deb02f7730af294d01dee4..35a6e67f7ae47d7a9d532d6d1b55f1c85f4147ad 100644 (file)
@@ -175,11 +175,9 @@ int wl1271_cmd_cal(struct wl1271 *wl)
        return ret;
 }
 
-int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
-                   u16 beacon_interval, u8 wait)
+int wl1271_cmd_join(struct wl1271 *wl)
 {
        static bool do_cal = true;
-       unsigned long timeout;
        struct wl1271_cmd_join *join;
        int ret, i;
        u8 *bssid;
@@ -213,9 +211,9 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
        join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS |
                RATE_MASK_5_5MBPS | RATE_MASK_11MBPS;
 
-       join->beacon_interval = beacon_interval;
-       join->dtim_interval = dtim_interval;
-       join->bss_type = bss_type;
+       join->beacon_interval = wl->beacon_int;
+       join->dtim_interval = wl->dtim_period;
+       join->bss_type = wl->bss_type;
        join->channel = wl->channel;
        join->ssid_len = wl->ssid_len;
        memcpy(join->ssid, wl->ssid, wl->ssid_len);
@@ -239,14 +237,11 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
                goto out_free;
        }
 
-       timeout = msecs_to_jiffies(JOIN_TIMEOUT);
-
        /*
         * ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to
         * simplify locking we just sleep instead, for now
         */
-       if (wait)
-               msleep(10);
+       msleep(10);
 
 out_free:
        kfree(join);
index 7c4d3aaaa8199ed8e4d9f9db6e38420705910c2f..63bc4417deb8318ff03c7d4e3ce97d4ab9e1af02 100644 (file)
@@ -30,8 +30,7 @@
 struct acx_header;
 
 int wl1271_cmd_send(struct wl1271 *wl, u16 type, void *buf, size_t buf_len);
-int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
-                   u16 beacon_interval, u8 wait);
+int wl1271_cmd_join(struct wl1271 *wl);
 int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
 int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
 int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
index b9b1c20137445bdd7400e9bc15af787bf5f6f921..6e35fcf37e4f182396ff618bb96269957a7974e5 100644 (file)
@@ -394,8 +394,7 @@ static void wl1271_filter_work(struct work_struct *work)
        if (ret < 0)
                goto out;
 
-       /* FIXME: replace the magic numbers with proper definitions */
-       ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
+       ret = wl1271_cmd_join(wl);
        if (ret < 0)
                goto out_sleep;
 
@@ -672,8 +671,7 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
                memcpy(wl->ssid, conf->ssid, wl->ssid_len);
 
        if (wl->bss_type != BSS_TYPE_IBSS) {
-               /* FIXME: replace the magic numbers with proper definitions */
-               ret = wl1271_cmd_join(wl, wl->bss_type, 5, 100, 1);
+               ret = wl1271_cmd_join(wl);
                if (ret < 0)
                        goto out_sleep;
        }
@@ -696,8 +694,7 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
                if (ret < 0)
                        goto out_sleep;
 
-               /* FIXME: replace the magic numbers with proper definitions */
-               ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
+               ret = wl1271_cmd_join(wl);
 
                if (ret < 0)
                        goto out_sleep;
@@ -738,8 +735,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
                u8 old_channel = wl->channel;
                wl->channel = channel;
 
-               /* FIXME: use beacon interval provided by mac80211 */
-               ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
+               ret = wl1271_cmd_join(wl);
                if (ret < 0) {
                        wl->channel = old_channel;
                        goto out_sleep;
@@ -1016,8 +1012,17 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 
        if (changed & BSS_CHANGED_ASSOC) {
                if (bss_conf->assoc) {
+                       wl->beacon_int = bss_conf->beacon_int;
+                       wl->dtim_period = bss_conf->dtim_period;
                        wl->aid = bss_conf->aid;
 
+                       ret = wl1271_cmd_join(wl);
+                       if (ret < 0) {
+                               wl1271_warning("Association configuration "
+                                              "failed %d", ret);
+                               goto out_sleep;
+                       }
+
                        ret = wl1271_cmd_build_ps_poll(wl, wl->aid);
                        if (ret < 0)
                                goto out_sleep;
@@ -1033,7 +1038,14 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
                                if (ret < 0)
                                        goto out_sleep;
                        }
+               } else {
+                       /* use defaults when not associated */
+                       wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
+                       wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
+                       wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
+                       wl->aid = 0;
                }
+
        }
 
        if (changed & BSS_CHANGED_ERP_SLOT) {
@@ -1066,13 +1078,20 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
        }
 
        if (changed & BSS_CHANGED_BASIC_RATES) {
-               u32 enabled_rates = wl1271_enabled_rates_get(
+               wl->basic_rate_set = wl1271_enabled_rates_get(
                        wl, bss_conf->basic_rates);
-               ret = wl1271_acx_rate_policies(wl, enabled_rates);
+               ret = wl1271_acx_rate_policies(wl, wl->basic_rate_set);
+
                if (ret < 0) {
                        wl1271_warning("Set rate policies failed %d", ret);
                        goto out_sleep;
                }
+               ret = wl1271_cmd_join(wl);
+               if (ret < 0) {
+                       wl1271_warning("Join with new basic rate "
+                                      "set failed %d", ret);
+                       goto out_sleep;
+               }
        }
 
 out_sleep:
@@ -1269,6 +1288,9 @@ static int __devinit wl1271_probe(struct spi_device *spi)
        wl->psm_requested = false;
        wl->tx_queue_stopped = false;
        wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
+       wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
+       wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
+       wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
        wl->band = IEEE80211_BAND_2GHZ;
 
        /* We use the default power on sleep time until we know which chip