wlcore/wl18xx: enable MIMO/wide-chan rates in AP-mode rate config
authorArik Nemtsov <arik@wizery.com>
Thu, 10 May 2012 09:13:34 +0000 (12:13 +0300)
committerLuciano Coelho <coelho@ti.com>
Tue, 5 Jun 2012 12:55:41 +0000 (15:55 +0300)
Add a HW op to add extra enabled rates for AP-mode data-rates. Since
the rates might depend on channel properties, reconfigure AP-mode rates
when these change.

Implement the HW op for the 18xx family, where MIMO or wide-chan rates
can be added.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/ti/wl12xx/main.c
drivers/net/wireless/ti/wl18xx/main.c
drivers/net/wireless/ti/wlcore/hw_ops.h
drivers/net/wireless/ti/wlcore/init.c
drivers/net/wireless/ti/wlcore/main.c
drivers/net/wireless/ti/wlcore/wlcore.h

index a3336534eb2a252ed3d70fd11bdfe4804ccab9b0..ad760a329c6a80eac90d210c76017d1e90013712 100644 (file)
@@ -1315,6 +1315,7 @@ static struct wlcore_ops wl12xx_ops = {
        .get_mac                = wl12xx_get_mac,
        .set_tx_desc_csum       = wl12xx_set_tx_desc_csum,
        .set_rx_csum            = NULL,
+       .ap_get_mimo_wide_rate_mask = NULL,
 };
 
 static struct ieee80211_sta_ht_cap wl12xx_ht_cap = {
index 77840ddd31299f9b64ec0cc7b61ee218fbcbafb9..9da94e62b7accf8fa3a6427791634b935943c249 100644 (file)
@@ -879,6 +879,19 @@ static u32 wl18xx_sta_get_ap_rate_mask(struct wl1271 *wl,
        return hw_rate_set;
 }
 
+static u32 wl18xx_ap_get_mimo_wide_rate_mask(struct wl1271 *wl,
+                                            struct wl12xx_vif *wlvif)
+{
+       if (wlvif->channel_type == NL80211_CHAN_HT40MINUS ||
+           wlvif->channel_type == NL80211_CHAN_HT40PLUS) {
+               wl1271_debug(DEBUG_ACX, "using wide channel rate mask");
+               return CONF_TX_RATE_USE_WIDE_CHAN;
+       } else {
+               wl1271_debug(DEBUG_ACX, "using MIMO rate mask");
+               return CONF_TX_MIMO_RATES;
+       }
+}
+
 static void wl18xx_conf_init(struct wl1271 *wl)
 {
        struct wl18xx_priv *priv = wl->priv;
@@ -906,6 +919,7 @@ static struct wlcore_ops wl18xx_ops = {
        .set_tx_desc_csum = wl18xx_set_tx_desc_csum,
        .set_rx_csum = wl18xx_set_rx_csum,
        .sta_get_ap_rate_mask = wl18xx_sta_get_ap_rate_mask,
+       .ap_get_mimo_wide_rate_mask = wl18xx_ap_get_mimo_wide_rate_mask,
 };
 
 int __devinit wl18xx_probe(struct platform_device *pdev)
index 80f3d75ceddf5341e0323df7145f91c52669de44..6d3e378bd0c78bdf8bbcb30f9410973cc22b617a 100644 (file)
@@ -139,4 +139,14 @@ wlcore_hw_set_rx_csum(struct wl1271 *wl,
                wl->ops->set_rx_csum(wl, desc, skb);
 }
 
+static inline u32
+wlcore_hw_ap_get_mimo_wide_rate_mask(struct wl1271 *wl,
+                                    struct wl12xx_vif *wlvif)
+{
+       if (wl->ops->ap_get_mimo_wide_rate_mask)
+               return wl->ops->ap_get_mimo_wide_rate_mask(wl, wlvif);
+
+       return 0;
+}
+
 #endif
index 9f89255eb6e616e6fd47c2544121584f32156e06..645abd4b660db5284b15aa23b24eda2e7673e932 100644 (file)
@@ -460,6 +460,9 @@ int wl1271_init_ap_rates(struct wl1271 *wl, struct wl12xx_vif *wlvif)
        /* unconditionally enable HT rates */
        supported_rates |= CONF_TX_MCS_RATES;
 
+       /* get extra MIMO or wide-chan rates where the HW supports it */
+       supported_rates |= wlcore_hw_ap_get_mimo_wide_rate_mask(wl, wlvif);
+
        /* configure unicast TX rate classes */
        for (i = 0; i < wl->conf.tx.ac_conf_count; i++) {
                rc.enabled_rates = supported_rates;
index 47dfc9d1295c7564a2c19109ed052d5abfcdcd14..03d4a4b1f59ceff71209481faa17ffcc46857637 100644 (file)
@@ -2479,7 +2479,12 @@ static int wl12xx_config_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                wlvif->channel = channel;
                wlvif->channel_type = conf->channel_type;
 
-               if (!is_ap) {
+               if (is_ap) {
+                       ret = wl1271_init_ap_rates(wl, wlvif);
+                       if (ret < 0)
+                               wl1271_error("AP rate policy change failed %d",
+                                            ret);
+               } else {
                        /*
                         * FIXME: the mac80211 should really provide a fixed
                         * rate to use here. for now, just use the smallest
index 83c43c9b10ed9aadb8b5a2df5b3fc5767cdacaae..f9ec84da3f7954089976b862c09ee7cfff0928f8 100644 (file)
@@ -68,6 +68,8 @@ struct wlcore_ops {
        void (*set_rx_csum)(struct wl1271 *wl,
                            struct wl1271_rx_descriptor *desc,
                            struct sk_buff *skb);
+       u32 (*ap_get_mimo_wide_rate_mask)(struct wl1271 *wl,
+                                         struct wl12xx_vif *wlvif);
 };
 
 enum wlcore_partitions {