ath9k: fix rx issues introduced in my last commit (fixes #14307)
authorFelix Fietkau <nbd@openwrt.org>
Thu, 10 Oct 2013 21:10:45 +0000 (21:10 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 10 Oct 2013 21:10:45 +0000 (21:10 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 38362

package/kernel/mac80211/patches/300-pending_work.patch
package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
package/kernel/mac80211/patches/501-ath9k-eeprom_endianess.patch
package/kernel/mac80211/patches/502-ath9k_ahb_init.patch
package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch

index 28f6a5bfa01c1117d4e66c7a541ad0e29b6eac9b..94b3076c2ef2a9433b126cc798487ebfb0d1ee22 100644 (file)
  
  bool is_ath9k_unloaded;
  /* We use the hw_value as an index into our private channel structure */
-@@ -429,7 +429,6 @@ static int ath9k_init_queues(struct ath_
+@@ -339,7 +339,6 @@ int ath_descdma_setup(struct ath_softc *
+ {
+       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+       u8 *ds;
+-      struct ath_buf *bf;
+       int i, bsize, desc_len;
+       ath_dbg(common, CONFIG, "%s DMA: %u buffers %u desc/buf\n",
+@@ -391,33 +390,68 @@ int ath_descdma_setup(struct ath_softc *
+               ito64(dd->dd_desc_paddr), /*XXX*/(u32) dd->dd_desc_len);
+       /* allocate buffers */
+-      bsize = sizeof(struct ath_buf) * nbuf;
+-      bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL);
+-      if (!bf)
+-              return -ENOMEM;
++      if (is_tx) {
++              struct ath_buf *bf;
++
++              bsize = sizeof(struct ath_buf) * nbuf;
++              bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL);
++              if (!bf)
++                      return -ENOMEM;
++
++              for (i = 0; i < nbuf; i++, bf++, ds += (desc_len * ndesc)) {
++                      bf->bf_desc = ds;
++                      bf->bf_daddr = DS2PHYS(dd, ds);
++
++                      if (!(sc->sc_ah->caps.hw_caps &
++                                ATH9K_HW_CAP_4KB_SPLITTRANS)) {
++                              /*
++                               * Skip descriptor addresses which can cause 4KB
++                               * boundary crossing (addr + length) with a 32 dword
++                               * descriptor fetch.
++                               */
++                              while (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr)) {
++                                      BUG_ON((caddr_t) bf->bf_desc >=
++                                                 ((caddr_t) dd->dd_desc +
++                                              dd->dd_desc_len));
++
++                                      ds += (desc_len * ndesc);
++                                      bf->bf_desc = ds;
++                                      bf->bf_daddr = DS2PHYS(dd, ds);
++                              }
++                      }
++                      list_add_tail(&bf->list, head);
++              }
++      } else {
++              struct ath_rxbuf *bf;
+-      for (i = 0; i < nbuf; i++, bf++, ds += (desc_len * ndesc)) {
+-              bf->bf_desc = ds;
+-              bf->bf_daddr = DS2PHYS(dd, ds);
+-
+-              if (!(sc->sc_ah->caps.hw_caps &
+-                    ATH9K_HW_CAP_4KB_SPLITTRANS)) {
+-                      /*
+-                       * Skip descriptor addresses which can cause 4KB
+-                       * boundary crossing (addr + length) with a 32 dword
+-                       * descriptor fetch.
+-                       */
+-                      while (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr)) {
+-                              BUG_ON((caddr_t) bf->bf_desc >=
+-                                     ((caddr_t) dd->dd_desc +
+-                                      dd->dd_desc_len));
+-
+-                              ds += (desc_len * ndesc);
+-                              bf->bf_desc = ds;
+-                              bf->bf_daddr = DS2PHYS(dd, ds);
++              bsize = sizeof(struct ath_buf) * nbuf;
++              bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL);
++              if (!bf)
++                      return -ENOMEM;
++
++              for (i = 0; i < nbuf; i++, bf++, ds += (desc_len * ndesc)) {
++                      bf->bf_desc = ds;
++                      bf->bf_daddr = DS2PHYS(dd, ds);
++
++                      if (!(sc->sc_ah->caps.hw_caps &
++                                ATH9K_HW_CAP_4KB_SPLITTRANS)) {
++                              /*
++                               * Skip descriptor addresses which can cause 4KB
++                               * boundary crossing (addr + length) with a 32 dword
++                               * descriptor fetch.
++                               */
++                              while (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr)) {
++                                      BUG_ON((caddr_t) bf->bf_desc >=
++                                                 ((caddr_t) dd->dd_desc +
++                                              dd->dd_desc_len));
++
++                                      ds += (desc_len * ndesc);
++                                      bf->bf_desc = ds;
++                                      bf->bf_daddr = DS2PHYS(dd, ds);
++                              }
+                       }
++                      list_add_tail(&bf->list, head);
+               }
+-              list_add_tail(&bf->list, head);
+       }
+       return 0;
+ }
+@@ -429,7 +463,6 @@ static int ath9k_init_queues(struct ath_
        sc->beacon.beaconq = ath9k_hw_beaconq_setup(sc->sc_ah);
        sc->beacon.cabq = ath_txq_setup(sc, ATH9K_TX_QUEUE_CAB, 0);
  
        ath_cabq_update(sc);
  
        sc->tx.uapsdq = ath_txq_setup(sc, ATH9K_TX_QUEUE_UAPSD, 0);
-@@ -516,6 +515,7 @@ static void ath9k_init_misc(struct ath_s
+@@ -516,6 +549,7 @@ static void ath9k_init_misc(struct ath_s
  static void ath9k_init_platform(struct ath_softc *sc)
  {
        struct ath_hw *ah = sc->sc_ah;
        struct ath_common *common = ath9k_hw_common(ah);
  
        if (common->bus_ops->ath_bus_type != ATH_PCI)
-@@ -525,12 +525,27 @@ static void ath9k_init_platform(struct a
+@@ -525,12 +559,27 @@ static void ath9k_init_platform(struct a
                               ATH9K_PCI_CUS230)) {
                ah->config.xlna_gpio = 9;
                ah->config.xatten_margin_cfg = true;
        }
  }
  
-@@ -584,6 +599,7 @@ static int ath9k_init_softc(u16 devid, s
+@@ -584,6 +633,7 @@ static int ath9k_init_softc(u16 devid, s
  {
        struct ath9k_platform_data *pdata = sc->dev->platform_data;
        struct ath_hw *ah = NULL;
        struct ath_common *common;
        int ret = 0, i;
        int csz = 0;
-@@ -600,6 +616,7 @@ static int ath9k_init_softc(u16 devid, s
+@@ -600,6 +650,7 @@ static int ath9k_init_softc(u16 devid, s
        ah->reg_ops.rmw = ath9k_reg_rmw;
        atomic_set(&ah->intr_ref_cnt, -1);
        sc->sc_ah = ah;
  
        sc->dfs_detector = dfs_pattern_detector_init(ah, NL80211_DFS_UNSET);
  
-@@ -631,11 +648,15 @@ static int ath9k_init_softc(u16 devid, s
+@@ -631,11 +682,15 @@ static int ath9k_init_softc(u16 devid, s
        ath9k_init_platform(sc);
  
        /*
  
        spin_lock_init(&common->cc_lock);
  
-@@ -710,13 +731,15 @@ static void ath9k_init_band_txpower(stru
+@@ -710,13 +765,15 @@ static void ath9k_init_band_txpower(stru
        struct ieee80211_supported_band *sband;
        struct ieee80211_channel *chan;
        struct ath_hw *ah = sc->sc_ah;
                ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true);
        }
  }
-@@ -802,7 +825,8 @@ void ath9k_set_hw_capab(struct ath_softc
+@@ -802,7 +859,8 @@ void ath9k_set_hw_capab(struct ath_softc
                IEEE80211_HW_PS_NULLFUNC_STACK |
                IEEE80211_HW_SPECTRUM_MGMT |
                IEEE80211_HW_REPORTS_TX_ACK_STATUS |
index c0a1a211cf90e456d698078d7a400536bda22dfb..e65292b34046c70dfc9a77647fca3c58ca71c0c3 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -778,6 +778,7 @@ static const struct ieee80211_iface_limi
+@@ -812,6 +812,7 @@ static const struct ieee80211_iface_limi
  #endif
                                 BIT(NL80211_IFTYPE_AP) |
                                 BIT(NL80211_IFTYPE_P2P_GO) },
index a65698b20d98d6fa512c1a332e83d377c0de6af0..9588649457c44cb3b532645ef6cac6dd66307ae7 100644 (file)
@@ -81,7 +81,7 @@
        struct ath_ops reg_ops;
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -630,6 +630,8 @@ static int ath9k_init_softc(u16 devid, s
+@@ -664,6 +664,8 @@ static int ath9k_init_softc(u16 devid, s
                ah->is_clk_25mhz = pdata->is_clk_25mhz;
                ah->get_mac_revision = pdata->get_mac_revision;
                ah->external_reset = pdata->external_reset;
index 8a710fd7b05e44572832f5790707fa562a617df9..e951ec76f6ce699c32444fee727675b45ebb34c1 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -1035,23 +1035,23 @@ static int __init ath9k_init(void)
+@@ -1069,23 +1069,23 @@ static int __init ath9k_init(void)
                goto err_out;
        }
  
index 8891b86a47edb33aa71accd12aa68da0d1e24d51..78b6cd79d4984cd0f83c5a42d1b40b245fe1590f 100644 (file)
  void ath_fill_led_pin(struct ath_softc *sc)
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct 
+@@ -976,7 +976,7 @@ int ath9k_init_device(u16 devid, struct 
  
  #ifdef CPTCFG_MAC80211_LEDS
        /* must be initialized before ieee80211_register_hw */
index ae5d5483f33d6d764867fc4f9d3d27c479da2e28..621caf71c28c8d97bd2e7b97950d3339f8db97b7 100644 (file)
@@ -59,7 +59,7 @@
  };
 --- a/drivers/net/wireless/ath/ath9k/init.c
 +++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -630,6 +630,8 @@ static int ath9k_init_softc(u16 devid, s
+@@ -664,6 +664,8 @@ static int ath9k_init_softc(u16 devid, s
                ah->is_clk_25mhz = pdata->is_clk_25mhz;
                ah->get_mac_revision = pdata->get_mac_revision;
                ah->external_reset = pdata->external_reset;