summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/wl12xx/acx.c
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2011-04-18 14:15:21 +0300
committerLuciano Coelho <coelho@ti.com>2011-05-02 10:29:20 +0300
commit5f704d180e448d05859e1cb6572822ba27dbcdc7 (patch)
treeb82bf4812c6d99e0c532a71a067f8c15ecc0a4d1 /drivers/net/wireless/wl12xx/acx.c
parent801f870bc0524bad7ebef9cea52d20e4d4992e4a (diff)
wl12xx: use wiphy values for setting rts, frag thresholds on init
Use the wiphy RTS and fragmentation thresholds for initializing the FW when possible. This mitigates a bug where previously set values are forgotten after interface down/up. Add checks before settings these values to ensure they are valid. Use default values when invalid thresholds are configured. Update the default RTS threshold to the maximum value given by the specification. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/acx.c')
-rw-r--r--drivers/net/wireless/wl12xx/acx.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/net/wireless/wl12xx/acx.c b/drivers/net/wireless/wl12xx/acx.c
index 2b5fb3d2df1b..729f72a7b912 100644
--- a/drivers/net/wireless/wl12xx/acx.c
+++ b/drivers/net/wireless/wl12xx/acx.c
@@ -325,12 +325,19 @@ out:
return ret;
}
-int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold)
+int wl1271_acx_rts_threshold(struct wl1271 *wl, u32 rts_threshold)
{
struct acx_rts_threshold *rts;
int ret;
- wl1271_debug(DEBUG_ACX, "acx rts threshold");
+ /*
+ * If the RTS threshold is not configured or out of range, use the
+ * default value.
+ */
+ if (rts_threshold > IEEE80211_MAX_RTS_THRESHOLD)
+ rts_threshold = wl->conf.rx.rts_threshold;
+
+ wl1271_debug(DEBUG_ACX, "acx rts threshold: %d", rts_threshold);
rts = kzalloc(sizeof(*rts), GFP_KERNEL);
if (!rts) {
@@ -338,7 +345,7 @@ int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold)
goto out;
}
- rts->threshold = cpu_to_le16(rts_threshold);
+ rts->threshold = cpu_to_le16((u16)rts_threshold);
ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts));
if (ret < 0) {
@@ -928,12 +935,19 @@ out:
return ret;
}
-int wl1271_acx_frag_threshold(struct wl1271 *wl, u16 frag_threshold)
+int wl1271_acx_frag_threshold(struct wl1271 *wl, u32 frag_threshold)
{
struct acx_frag_threshold *acx;
int ret = 0;
- wl1271_debug(DEBUG_ACX, "acx frag threshold");
+ /*
+ * If the fragmentation is not configured or out of range, use the
+ * default value.
+ */
+ if (frag_threshold > IEEE80211_MAX_FRAG_THRESHOLD)
+ frag_threshold = wl->conf.tx.frag_threshold;
+
+ wl1271_debug(DEBUG_ACX, "acx frag threshold: %d", frag_threshold);
acx = kzalloc(sizeof(*acx), GFP_KERNEL);
@@ -942,7 +956,7 @@ int wl1271_acx_frag_threshold(struct wl1271 *wl, u16 frag_threshold)
goto out;
}
- acx->frag_threshold = cpu_to_le16(frag_threshold);
+ acx->frag_threshold = cpu_to_le16((u16)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);