wl12xx: add channel field to wlvif
authorEliad Peller <eliad@wizery.com>
Mon, 10 Oct 2011 08:13:10 +0000 (10:13 +0200)
committerLuciano Coelho <coelho@ti.com>
Tue, 11 Oct 2011 12:12:13 +0000 (15:12 +0300)
add channel into the per-interface data.

mac80211 configures some values (e.g. band, channel)
globally, while we configure them per-interface.

In order to make it easier to keep track of the
configured value for each value while keeping sync
with mac80211, save these values both globally
and per-vif.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/cmd.c
drivers/net/wireless/wl12xx/main.c
drivers/net/wireless/wl12xx/wl12xx.h

index 6cf8cdc72b598b99113009c58a923e37b3d7b726..4c5c51810fda65db54af1d517a9133d580212cce 100644 (file)
@@ -483,7 +483,7 @@ int wl12xx_cmd_role_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif)
        cmd->role_id = wlvif->dev_role_id;
        if (wlvif->band == IEEE80211_BAND_5GHZ)
                cmd->band = WL12XX_BAND_5GHZ;
-       cmd->channel = wl->channel;
+       cmd->channel = wlvif->channel;
 
        if (wlvif->dev_hlid == WL12XX_INVALID_LINK_ID) {
                ret = wl12xx_allocate_link(wl, wlvif, &wlvif->dev_hlid);
@@ -573,7 +573,7 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif)
        cmd->role_id = wlvif->role_id;
        if (wlvif->band == IEEE80211_BAND_5GHZ)
                cmd->band = WL12XX_BAND_5GHZ;
-       cmd->channel = wl->channel;
+       cmd->channel = wlvif->channel;
        cmd->sta.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
        cmd->sta.beacon_interval = cpu_to_le16(wlvif->beacon_int);
        cmd->sta.ssid_type = WL12XX_SSID_TYPE_ANY;
@@ -689,7 +689,7 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
        cmd->ap.beacon_interval = cpu_to_le16(wlvif->beacon_int);
        cmd->ap.dtim_interval = bss_conf->dtim_period;
        cmd->ap.beacon_expiry = WL1271_AP_DEF_BEACON_EXP;
-       cmd->channel = wl->channel;
+       cmd->channel = wlvif->channel;
 
        if (!bss_conf->hidden_ssid) {
                /* take the SSID from the beacon for backward compatibility */
@@ -787,7 +787,7 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif)
        cmd->role_id = wlvif->role_id;
        if (wlvif->band == IEEE80211_BAND_5GHZ)
                cmd->band = WL12XX_BAND_5GHZ;
-       cmd->channel = wl->channel;
+       cmd->channel = wlvif->channel;
        cmd->ibss.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
        cmd->ibss.beacon_interval = cpu_to_le16(wlvif->beacon_int);
        cmd->ibss.dtim_interval = bss_conf->dtim_period;
@@ -1608,7 +1608,7 @@ static int wl12xx_cmd_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif,
        struct wl12xx_cmd_roc *cmd;
        int ret = 0;
 
-       wl1271_debug(DEBUG_CMD, "cmd roc %d (%d)", wl->channel, role_id);
+       wl1271_debug(DEBUG_CMD, "cmd roc %d (%d)", wlvif->channel, role_id);
 
        if (WARN_ON(role_id == WL12XX_INVALID_ROLE_ID))
                return -EINVAL;
@@ -1620,7 +1620,7 @@ static int wl12xx_cmd_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif,
        }
 
        cmd->role_id = role_id;
-       cmd->channel = wl->channel;
+       cmd->channel = wlvif->channel;
        switch (wlvif->band) {
        case IEEE80211_BAND_2GHZ:
                cmd->band = RADIO_BAND_2_4GHZ;
index 8e395f1f4b1aa1dccf55ab2885e160bbf96a7bfc..5137275d35913f7e71cf65b763e0527c796ae537 100644 (file)
@@ -1973,6 +1973,7 @@ static int wl12xx_init_vif_data(struct wl1271 *wl, struct ieee80211_vif *vif)
         * per-interface. thus, on init, we have to copy them from wl
         */
        wlvif->band = wl->band;
+       wlvif->channel = wl->channel;
 
        INIT_WORK(&wlvif->rx_streaming_enable_work,
                  wl1271_rx_streaming_enable_work);
@@ -2458,12 +2459,13 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
        /* if the channel changes while joined, join again */
        if (changed & IEEE80211_CONF_CHANGE_CHANNEL &&
            ((wlvif->band != conf->channel->band) ||
-            (wl->channel != channel))) {
+            (wlvif->channel != channel))) {
                /* send all pending packets */
                wl1271_tx_work_locked(wl);
                wl->band = conf->channel->band;
-               wlvif->band = conf->channel->band;
                wl->channel = channel;
+               wlvif->band = conf->channel->band;
+               wlvif->channel = channel;
 
                if (!is_ap) {
                        /*
index a689ad02a357d9b53e98b24d2fe4f9991d645c27..02dedd191bd409f5ff117ab0d6f7010bf53c05a1 100644 (file)
@@ -593,6 +593,7 @@ struct wl12xx_vif {
 
        /* The current band */
        enum ieee80211_band band;
+       int channel;
 
        u32 bitrate_masks[IEEE80211_NUM_BANDS];
        u32 basic_rate_set;