wl1271: add support for HW TX fragmentation
authorArik Nemtsov <arik@wizery.com>
Mon, 8 Nov 2010 09:51:07 +0000 (10:51 +0100)
committerLuciano Coelho <luciano.coelho@nokia.com>
Mon, 22 Nov 2010 14:45:13 +0000 (16:45 +0200)
Indicate to mac80211 we support HW fragmentation.
Support updates of the fragmentation threshold via the
set_frag_threshold callback.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
drivers/net/wireless/wl12xx/acx.c
drivers/net/wireless/wl12xx/acx.h
drivers/net/wireless/wl12xx/init.c
drivers/net/wireless/wl12xx/main.c

index bc1085bb6cfb81d92724bfb4ca082ac91017f443..7cbaeb6d2a3720db605947699505be67a236c33b 100644 (file)
@@ -862,7 +862,7 @@ out:
        return ret;
 }
 
-int wl1271_acx_frag_threshold(struct wl1271 *wl)
+int wl1271_acx_frag_threshold(struct wl1271 *wl, u16 frag_threshold)
 {
        struct acx_frag_threshold *acx;
        int ret = 0;
@@ -876,7 +876,7 @@ int wl1271_acx_frag_threshold(struct wl1271 *wl)
                goto out;
        }
 
-       acx->frag_threshold = cpu_to_le16(wl->conf.tx.frag_threshold);
+       acx->frag_threshold = cpu_to_le16(frag_threshold);
        ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx));
        if (ret < 0) {
                wl1271_warning("Setting of frag threshold failed: %d", ret);
index f41a9c1df12fb43f4bbba853f0983c7c81d17c18..75a6306ff554fe49cad0db1660b4a98dae1a804f 100644 (file)
@@ -1161,7 +1161,7 @@ int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max,
 int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type,
                       u8 tsid, u8 ps_scheme, u8 ack_policy,
                       u32 apsd_conf0, u32 apsd_conf1);
-int wl1271_acx_frag_threshold(struct wl1271 *wl);
+int wl1271_acx_frag_threshold(struct wl1271 *wl, u16 frag_threshold);
 int wl1271_acx_tx_config_options(struct wl1271 *wl);
 int wl1271_acx_mem_cfg(struct wl1271 *wl);
 int wl1271_acx_init_mem_config(struct wl1271 *wl);
index 492edc0f7aca3bd42fcad2c13ad859f49e3be158..7949d346aadb7c37dd7ef47e321f75d67d2b4d86 100644 (file)
@@ -290,7 +290,7 @@ int wl1271_hw_init(struct wl1271 *wl)
                goto out_free_memmap;
 
        /* Default fragmentation threshold */
-       ret = wl1271_acx_frag_threshold(wl);
+       ret = wl1271_acx_frag_threshold(wl, wl->conf.tx.frag_threshold);
        if (ret < 0)
                goto out_free_memmap;
 
index 6af270d382bb099a928c87c1991029d67b89385b..31f0e2f6ffc31cd2ad2910f91ea0838caecebe61 100644 (file)
@@ -425,7 +425,7 @@ static int wl1271_plt_init(struct wl1271 *wl)
                goto out_free_memmap;
 
        /* Default fragmentation threshold */
-       ret = wl1271_acx_frag_threshold(wl);
+       ret = wl1271_acx_frag_threshold(wl, wl->conf.tx.frag_threshold);
        if (ret < 0)
                goto out_free_memmap;
 
@@ -1745,6 +1745,34 @@ out:
        return ret;
 }
 
+static int wl1271_op_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
+{
+       struct wl1271 *wl = hw->priv;
+       int ret = 0;
+
+       mutex_lock(&wl->mutex);
+
+       if (unlikely(wl->state == WL1271_STATE_OFF)) {
+               ret = -EAGAIN;
+               goto out;
+       }
+
+       ret = wl1271_ps_elp_wakeup(wl, false);
+       if (ret < 0)
+               goto out;
+
+       ret = wl1271_acx_frag_threshold(wl, (u16)value);
+       if (ret < 0)
+               wl1271_warning("wl1271_op_set_frag_threshold failed: %d", ret);
+
+       wl1271_ps_elp_sleep(wl);
+
+out:
+       mutex_unlock(&wl->mutex);
+
+       return ret;
+}
+
 static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 {
        struct wl1271 *wl = hw->priv;
@@ -2421,6 +2449,7 @@ static const struct ieee80211_ops wl1271_ops = {
        .set_key = wl1271_op_set_key,
        .hw_scan = wl1271_op_hw_scan,
        .bss_info_changed = wl1271_op_bss_info_changed,
+       .set_frag_threshold = wl1271_op_set_frag_threshold,
        .set_rts_threshold = wl1271_op_set_rts_threshold,
        .conf_tx = wl1271_op_conf_tx,
        .get_tsf = wl1271_op_get_tsf,