mac80211: backport some upstream mwl8k fixes
authorJonas Gorski <jogo@openwrt.org>
Wed, 27 Mar 2013 12:39:52 +0000 (12:39 +0000)
committerJonas Gorski <jogo@openwrt.org>
Wed, 27 Mar 2013 12:39:52 +0000 (12:39 +0000)
SVN-Revision: 36134

package/mac80211/patches/300-pending_work.patch
package/mac80211/patches/701-mwl8k-don-t-overwrite-regulatory-settings.patch [new file with mode: 0644]
package/mac80211/patches/702-mwl8k-always-apply-configuration-even-when-device-is.patch [new file with mode: 0644]

index cf51aae5cc63cf8edfb8df9976c1cbf6b1a7661f..3a09420321b9ddc5efb863579db008ffc83d63a7 100644 (file)
  static void ieee80211_iface_work(struct work_struct *work)
  {
        struct ieee80211_sub_if_data *sdata =
-@@ -1126,6 +1175,9 @@ static void ieee80211_iface_work(struct 
+@@ -1126,6 +1175,9 @@ static void ieee80211_iface_work(struct
                                break;
                        ieee80211_mesh_rx_queued_mgmt(sdata, skb);
                        break;
diff --git a/package/mac80211/patches/701-mwl8k-don-t-overwrite-regulatory-settings.patch b/package/mac80211/patches/701-mwl8k-don-t-overwrite-regulatory-settings.patch
new file mode 100644 (file)
index 0000000..dd6348f
--- /dev/null
@@ -0,0 +1,70 @@
+From f340b99171e923eb6b54c1d0c22c15b45df40647 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Mon, 11 Mar 2013 17:17:28 +0100
+Subject: [PATCH] mwl8k: don't overwrite regulatory settings
+
+Currently the caps are parsed on every firmware reload, causing any
+channel flags to be cleared.
+When there is a firmware to interface mode mismatch, the triggered
+firmware reload causes a reset of the regulatory settings, causing all
+channels to become available:
+
+root@openrouter:/# iw phy phy0 info
+Wiphy phy0
+        Band 1:
+               (...)
+                Frequencies:
+                        * 2412 MHz [1] (0.0 dBm)
+                        * 2417 MHz [2] (0.0 dBm)
+                        * 2422 MHz [3] (0.0 dBm)
+                        * 2427 MHz [4] (0.0 dBm)
+                        * 2432 MHz [5] (0.0 dBm)
+                        * 2437 MHz [6] (0.0 dBm)
+                        * 2442 MHz [7] (0.0 dBm)
+                        * 2447 MHz [8] (0.0 dBm)
+                        * 2452 MHz [9] (0.0 dBm)
+                        * 2457 MHz [10] (0.0 dBm)
+                        * 2462 MHz [11] (0.0 dBm)
+                        * 2467 MHz [12] (0.0 dBm)
+                        * 2472 MHz [13] (0.0 dBm)
+                        * 2484 MHz [14] (0.0 dBm)
+               (...)
+
+To prevent this, only parse the caps on the first firmware load during
+hardware probe, and store them locally to know we have already parsed
+them.
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ drivers/net/wireless/mwl8k.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/net/wireless/mwl8k.c
++++ b/drivers/net/wireless/mwl8k.c
+@@ -232,6 +232,7 @@ struct mwl8k_priv {
+       u16 num_mcaddrs;
+       u8 hw_rev;
+       u32 fw_rev;
++      u32 caps;
+       /*
+        * Running count of TX packets in flight, to avoid
+@@ -2401,6 +2402,9 @@ mwl8k_set_caps(struct ieee80211_hw *hw,
+ {
+       struct mwl8k_priv *priv = hw->priv;
++      if (priv->caps)
++              return;
++
+       if ((caps & MWL8K_CAP_2GHZ4) || !(caps & MWL8K_CAP_BAND_MASK)) {
+               mwl8k_setup_2ghz_band(hw);
+               if (caps & MWL8K_CAP_MIMO)
+@@ -2412,6 +2416,8 @@ mwl8k_set_caps(struct ieee80211_hw *hw,
+               if (caps & MWL8K_CAP_MIMO)
+                       mwl8k_set_ht_caps(hw, &priv->band_50, caps);
+       }
++
++      priv->caps = caps;
+ }
+ static int mwl8k_cmd_get_hw_spec_sta(struct ieee80211_hw *hw)
diff --git a/package/mac80211/patches/702-mwl8k-always-apply-configuration-even-when-device-is.patch b/package/mac80211/patches/702-mwl8k-always-apply-configuration-even-when-device-is.patch
new file mode 100644 (file)
index 0000000..ff25479
--- /dev/null
@@ -0,0 +1,44 @@
+From 5d1ed64614ccb21c26bc0ee321e9c51b6359ceb8 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Mon, 25 Mar 2013 15:37:42 +0100
+Subject: [PATCH] mwl8k: always apply configuration even when device is idle
+
+Fix settings not being applied when the device is idle and the firmware
+gets reloaded (because of changing from STA to AP mode). This caused
+the device using the wrong channel (and likely band), e.g. a 5 GHz only
+card still defaulted to channel 6 in the 2.4 GHz band when left
+unconfigured.
+
+This issue was always present, but only made visible with "mwl8k: Do not
+call mwl8k_cmd_set_rf_channel unconditionally" (0f4316b9), since before
+that the channel was (re-)configured at the next _config call even when
+it did not change from the mac80211 perspective.
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ drivers/net/wireless/mwl8k.c |   10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/wireless/mwl8k.c
++++ b/drivers/net/wireless/mwl8k.c
+@@ -4818,16 +4818,14 @@ static int mwl8k_config(struct ieee80211
+       struct mwl8k_priv *priv = hw->priv;
+       int rc;
+-      if (conf->flags & IEEE80211_CONF_IDLE) {
+-              mwl8k_cmd_radio_disable(hw);
+-              return 0;
+-      }
+-
+       rc = mwl8k_fw_lock(hw);
+       if (rc)
+               return rc;
+-      rc = mwl8k_cmd_radio_enable(hw);
++      if (conf->flags & IEEE80211_CONF_IDLE)
++              rc = mwl8k_cmd_radio_disable(hw);
++      else
++              rc = mwl8k_cmd_radio_enable(hw);
+       if (rc)
+               goto out;