wl12xx: add power_level field to wlvif
authorEliad Peller <eliad@wizery.com>
Mon, 10 Oct 2011 08:13:11 +0000 (10:13 +0200)
committerLuciano Coelho <coelho@ti.com>
Tue, 11 Oct 2011 12:12:13 +0000 (15:12 +0300)
move power_level 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/init.c
drivers/net/wireless/wl12xx/main.c
drivers/net/wireless/wl12xx/wl12xx.h

index 4af7e2fb52fd5d406ae7c689e26431899f0e10dd..74f569099b531197dc82eaf97a63cc5f4bd11b0b 100644 (file)
@@ -554,7 +554,7 @@ static int wl12xx_init_ap_role(struct wl1271 *wl, struct wl12xx_vif *wlvif)
                return ret;
 
        /* initialize Tx power */
-       ret = wl1271_acx_tx_power(wl, wlvif, wl->power_level);
+       ret = wl1271_acx_tx_power(wl, wlvif, wlvif->power_level);
        if (ret < 0)
                return ret;
 
index 5137275d35913f7e71cf65b763e0527c796ae537..cffb40be7b5b620c53d9c9e777e7b4575140156c 100644 (file)
@@ -1974,6 +1974,7 @@ static int wl12xx_init_vif_data(struct wl1271 *wl, struct ieee80211_vif *vif)
         */
        wlvif->band = wl->band;
        wlvif->channel = wl->channel;
+       wlvif->power_level = wl->power_level;
 
        INIT_WORK(&wlvif->rx_streaming_enable_work,
                  wl1271_rx_streaming_enable_work);
@@ -2562,12 +2563,13 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
                                                 wlvif->basic_rate, true);
        }
 
-       if (conf->power_level != wl->power_level) {
+       if (conf->power_level != wlvif->power_level) {
                ret = wl1271_acx_tx_power(wl, wlvif, conf->power_level);
                if (ret < 0)
                        goto out_sleep;
 
                wl->power_level = conf->power_level;
+               wlvif->power_level = conf->power_level;
        }
 
 out_sleep:
index 02dedd191bd409f5ff117ab0d6f7010bf53c05a1..2689522ba4edc6e2087af6b651267983bd614676 100644 (file)
@@ -631,6 +631,9 @@ struct wl12xx_vif {
        /* retry counter for PSM entries */
        u8 psm_entry_retry;
 
+       /* in dBm */
+       int power_level;
+
        int rssi_thold;
        int last_rssi_event;