mac80211: refresh patches
authorFelix Fietkau <nbd@nbd.name>
Fri, 13 Jan 2017 09:42:35 +0000 (10:42 +0100)
committerFelix Fietkau <nbd@nbd.name>
Sat, 14 Jan 2017 17:28:24 +0000 (18:28 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
package/kernel/mac80211/patches/300-ath9k-Switch-to-using-mac80211-intermediate-software.patch
package/kernel/mac80211/patches/315-ath9k_hw-issue-external-reset-for-QCA955x.patch
package/kernel/mac80211/patches/319-mac80211-avoid-extra-memcpy-in-A-MSDU-head-creation.patch
package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
package/kernel/mac80211/patches/556-ath9k-define-all-EEPROM-fields-in-Little-Endian-form.patch
package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch

index b65b0bd..fbe22e5 100644 (file)
  #include "aes_ccm.h"
  
 -void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
+-                             u8 *data, size_t data_len, u8 *mic,
+-                             size_t mic_len)
 +static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0,
 +                          u8 *a, u8 *b)
-+{
+ {
+-      struct scatterlist sg[3];
 +      int i;
 +
 +      crypto_cipher_encrypt_one(tfm, b, b_0);
 +      for (i = 0; i < AES_BLOCK_SIZE; i++)
 +              aad[i] ^= b[i];
 +      crypto_cipher_encrypt_one(tfm, a, aad);
-+
+-      char aead_req_data[sizeof(struct aead_request) +
+-                         crypto_aead_reqsize(tfm)]
+-              __aligned(__alignof__(struct aead_request));
+-      struct aead_request *aead_req = (void *) aead_req_data;
 +      /* Mask out bits from auth-only-b_0 */
 +      b_0[0] &= 0x07;
-+
+-      memset(aead_req, 0, sizeof(aead_req_data));
 +      /* S_0 is used to encrypt T (= MIC) */
 +      b_0[14] = 0;
 +      b_0[15] = 0;
 +      crypto_cipher_encrypt_one(tfm, s_0, b_0);
 +}
-+
-+
+-      sg_init_table(sg, 3);
+-      sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
+-      sg_set_buf(&sg[1], data, data_len);
+-      sg_set_buf(&sg[2], mic, mic_len);
+-      aead_request_set_tfm(aead_req, tfm);
+-      aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
+-      aead_request_set_ad(aead_req, sg[0].length);
 +void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
-                              u8 *data, size_t data_len, u8 *mic,
-                              size_t mic_len)
- {
--      struct scatterlist sg[3];
++                             u8 *data, size_t data_len, u8 *mic,
++                             size_t mic_len)
++{
 +      int i, j, last_len, num_blocks;
 +      u8 b[AES_BLOCK_SIZE];
 +      u8 s_0[AES_BLOCK_SIZE];
 +      u8 e[AES_BLOCK_SIZE];
 +      u8 *pos, *cpos;
--      char aead_req_data[sizeof(struct aead_request) +
--                         crypto_aead_reqsize(tfm)]
--              __aligned(__alignof__(struct aead_request));
--      struct aead_request *aead_req = (void *) aead_req_data;
++
 +      num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
 +      last_len = data_len % AES_BLOCK_SIZE;
 +      aes_ccm_prepare(tfm, b_0, aad, s_0, b, b);
--      memset(aead_req, 0, sizeof(aead_req_data));
++
 +      /* Process payload blocks */
 +      pos = data;
 +      cpos = data;
 +      for (j = 1; j <= num_blocks; j++) {
 +              int blen = (j == num_blocks && last_len) ?
 +                      last_len : AES_BLOCK_SIZE;
--      sg_init_table(sg, 3);
--      sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
--      sg_set_buf(&sg[1], data, data_len);
--      sg_set_buf(&sg[2], mic, mic_len);
++
 +              /* Authentication followed by encryption */
 +              for (i = 0; i < blen; i++)
 +                      b[i] ^= pos[i];
 +              crypto_cipher_encrypt_one(tfm, b, b);
--      aead_request_set_tfm(aead_req, tfm);
--      aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
--      aead_request_set_ad(aead_req, sg[0].length);
++
 +              b_0[14] = (j >> 8) & 0xff;
 +              b_0[15] = j & 0xff;
 +              crypto_cipher_encrypt_one(tfm, e, b_0);
 -                         crypto_aead_reqsize(tfm)]
 -              __aligned(__alignof__(struct aead_request));
 -      struct aead_request *aead_req = (void *) aead_req_data;
+-
+-      if (data_len == 0)
+-              return -EINVAL;
+-
+-      memset(aead_req, 0, sizeof(aead_req_data));
+-
+-      sg_init_table(sg, 3);
+-      sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
+-      sg_set_buf(&sg[1], data, data_len);
+-      sg_set_buf(&sg[2], mic, mic_len);
+-
+-      aead_request_set_tfm(aead_req, tfm);
+-      aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
+-      aead_request_set_ad(aead_req, sg[0].length);
 +      int i, j, last_len, num_blocks;
 +      u8 *pos, *cpos;
 +      u8 a[AES_BLOCK_SIZE];
 +      u8 b[AES_BLOCK_SIZE];
 +      u8 s_0[AES_BLOCK_SIZE];
--      if (data_len == 0)
--              return -EINVAL;
++
 +      num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
 +      last_len = data_len % AES_BLOCK_SIZE;
 +      aes_ccm_prepare(tfm, b_0, aad, s_0, a, b);
--      memset(aead_req, 0, sizeof(aead_req_data));
++
 +      /* Process payload blocks */
 +      cpos = data;
 +      pos = data;
 +      for (j = 1; j <= num_blocks; j++) {
 +              int blen = (j == num_blocks && last_len) ?
 +                      last_len : AES_BLOCK_SIZE;
--      sg_init_table(sg, 3);
--      sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
--      sg_set_buf(&sg[1], data, data_len);
--      sg_set_buf(&sg[2], mic, mic_len);
++
 +              /* Decryption followed by authentication */
 +              b_0[14] = (j >> 8) & 0xff;
 +              b_0[15] = j & 0xff;
 +              }
 +              crypto_cipher_encrypt_one(tfm, a, a);
 +      }
--      aead_request_set_tfm(aead_req, tfm);
--      aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
--      aead_request_set_ad(aead_req, sg[0].length);
++
 +      for (i = 0; i < mic_len; i++) {
 +              if ((mic[i] ^ s_0[i]) != a[i])
 +                      return -1;
  {
 -      struct crypto_aead *tfm;
 -      int err;
--
++      struct crypto_cipher *tfm;
 -      tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
 -      if (IS_ERR(tfm))
 -              return tfm;
-+      struct crypto_cipher *tfm;
+-
 -      err = crypto_aead_setkey(tfm, key, key_len);
 -      if (err)
 -              goto free_aead;
index 57917c5..b93d116 100644 (file)
@@ -875,10 +875,10 @@ Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
 -              ath_txq_lock(sc, txq);
 -      } else if (txctl->an && queue) {
 -              WARN_ON(tid->txq != txctl->txq);
--
 -              if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
 -                      tid->clear_ps_filter = true;
+-
 -              /*
 -               * Add this frame to software queue for scheduling later
 -               * for aggregation.
index 34d7d3b..5eb69b8 100644 (file)
@@ -29,6 +29,21 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 -              npend = ath9k_hw_numtxpending(ah, i);
 -              if (npend)
 -                      break;
+-      }
+-
+-      if (ah->external_reset &&
+-          (npend || type == ATH9K_RESET_COLD)) {
+-              int reset_err = 0;
+-
+-              ath_dbg(ath9k_hw_common(ah), RESET,
+-                      "reset MAC via external reset\n");
+-
+-              reset_err = ah->external_reset();
+-              if (reset_err) {
+-                      ath_err(ath9k_hw_common(ah),
+-                              "External reset failed, err=%d\n",
+-                              reset_err);
+-                      return false;
 +      if (type == ATH9K_RESET_COLD)
 +              return true;
 +
@@ -44,47 +59,35 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +              for (i = 0; i < AR_NUM_QCU; i++) {
 +                      if (ath9k_hw_numtxpending(ah, i))
 +                              return true;
-+              }
-       }
--      if (ah->external_reset &&
--          (npend || type == ATH9K_RESET_COLD)) {
--              int reset_err = 0;
+               }
++      }
++
 +      return false;
 +}
--              ath_dbg(ath9k_hw_common(ah), RESET,
--                      "reset MAC via external reset\n");
++
 +static bool ath9k_hw_external_reset(struct ath_hw *ah, int type)
 +{
 +      int err;
--              reset_err = ah->external_reset();
--              if (reset_err) {
--                      ath_err(ath9k_hw_common(ah),
--                              "External reset failed, err=%d\n",
--                              reset_err);
--                      return false;
--              }
++
 +      if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type))
 +              return true;
--              REG_WRITE(ah, AR_RTC_RESET, 1);
++
 +      ath_dbg(ath9k_hw_common(ah), RESET,
 +              "reset MAC via external reset\n");
-+
+-              REG_WRITE(ah, AR_RTC_RESET, 1);
 +      err = ah->external_reset();
 +      if (err) {
 +              ath_err(ath9k_hw_common(ah),
 +                      "External reset failed, err=%d\n", err);
 +              return false;
-+      }
-+
+       }
 +      if (AR_SREV_9550(ah)) {
 +              REG_WRITE(ah, AR_RTC_RESET, 0);
 +              udelay(10);
-       }
++      }
++
 +      REG_WRITE(ah, AR_RTC_RESET, 1);
 +      udelay(10);
 +
index fb6bd30..4668226 100644 (file)
@@ -34,22 +34,23 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
 -      amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
 -      memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
 -      memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
+-
+-      data = skb_push(skb, sizeof(amsdu_hdr));
+-      memmove(data, data + sizeof(amsdu_hdr), hdr_len);
+-      memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
+-
 +      data = skb_push(skb, sizeof(*amsdu_hdr));
 +      memmove(data, data + sizeof(*amsdu_hdr), hdr_len);
-+      hdr = data;
+       hdr = data;
 +      amsdu_hdr = data + hdr_len;
 +      /* h_80211_src/dst is addr* field within hdr */
 +      h_80211_src = data + fast_tx->sa_offs;
 +      h_80211_dst = data + fast_tx->da_offs;
--      data = skb_push(skb, sizeof(amsdu_hdr));
--      memmove(data, data + sizeof(amsdu_hdr), hdr_len);
--      memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
++
 +      amsdu_hdr->h_proto = cpu_to_be16(subframe_len);
 +      ether_addr_copy(amsdu_hdr->h_source, h_80211_src);
 +      ether_addr_copy(amsdu_hdr->h_dest, h_80211_dst);
--      hdr = data;
++
        qc = ieee80211_get_qos_ctl(hdr);
        *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
  
index 1ef5545..469da90 100644 (file)
@@ -1,6 +1,6 @@
 --- a/net/wireless/reg.c
 +++ b/net/wireless/reg.c
-@@ -2411,6 +2411,8 @@ void regulatory_hint_country_ie(struct w
+@@ -2398,6 +2398,8 @@ void regulatory_hint_country_ie(struct w
        enum environment_cap env = ENVIRON_ANY;
        struct regulatory_request *request = NULL, *lr;
  
@@ -9,7 +9,7 @@
        /* IE len must be evenly divisible by 2 */
        if (country_ie_len & 0x01)
                return;
-@@ -2617,6 +2619,7 @@ static void restore_regulatory_settings(
+@@ -2604,6 +2606,7 @@ static void restore_regulatory_settings(
  
  void regulatory_hint_disconnect(void)
  {
index 3fbe316..cb58f95 100644 (file)
 +                    GFP_KERNEL);
 +      if (!led)
 +              return -ENOMEM;
--      ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
++
 +      led->gpio = gpio = (struct gpio_led *) (led + 1);
 +      _name = (char *) (led->gpio + 1);
 +
 +      ret = ath_add_led(sc, led);
 +      if (unlikely(ret < 0))
 +              kfree(led);
-+
+-      ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
 +      return ret;
  }
  
  {
 -      if (!sc->led_registered)
 -              return;
--
--      ath_led_brightness(&sc->led_cdev, LED_OFF);
--      led_classdev_unregister(&sc->led_cdev);
 +      struct ath_led *led;
  
+-      ath_led_brightness(&sc->led_cdev, LED_OFF);
+-      led_classdev_unregister(&sc->led_cdev);
+-
 -      ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
 +      while (!list_empty(&sc->leds)) {
 +              led = list_first_entry(&sc->leds, struct ath_led, list);
index 292ea8a..04714f8 100644 (file)
@@ -349,6 +349,16 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
 -
 -              integer = swab32(eep->modalHeader.antCtrlCommon);
 -              eep->modalHeader.antCtrlCommon = integer;
+-
+-              for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
+-                      integer = swab32(eep->modalHeader.antCtrlChain[i]);
+-                      eep->modalHeader.antCtrlChain[i] = integer;
+-              }
+-
+-              for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
+-                      word = swab16(eep->modalHeader.spurChans[i].spurChan);
+-                      eep->modalHeader.spurChans[i].spurChan = word;
+-              }
 +              EEPROM_FIELD_SWAB16(eep->baseEepHeader.length);
 +              EEPROM_FIELD_SWAB16(eep->baseEepHeader.checksum);
 +              EEPROM_FIELD_SWAB16(eep->baseEepHeader.version);
@@ -358,18 +368,10 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
 +              EEPROM_FIELD_SWAB16(eep->baseEepHeader.blueToothOptions);
 +              EEPROM_FIELD_SWAB16(eep->baseEepHeader.deviceCap);
 +              EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlCommon);
--              for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
--                      integer = swab32(eep->modalHeader.antCtrlChain[i]);
--                      eep->modalHeader.antCtrlChain[i] = integer;
--              }
++
 +              for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++)
 +                      EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlChain[i]);
--              for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
--                      word = swab16(eep->modalHeader.spurChans[i].spurChan);
--                      eep->modalHeader.spurChans[i].spurChan = word;
--              }
++
 +              for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++)
 +                      EEPROM_FIELD_SWAB16(
 +                              eep->modalHeader.spurChans[i].spurChan);
@@ -540,6 +542,16 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
 -
 -              integer = swab32(eep->modalHeader.antCtrlCommon);
 -              eep->modalHeader.antCtrlCommon = integer;
+-
+-              for (i = 0; i < AR9287_MAX_CHAINS; i++) {
+-                      integer = swab32(eep->modalHeader.antCtrlChain[i]);
+-                      eep->modalHeader.antCtrlChain[i] = integer;
+-              }
+-
+-              for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
+-                      word = swab16(eep->modalHeader.spurChans[i].spurChan);
+-                      eep->modalHeader.spurChans[i].spurChan = word;
+-              }
 +              EEPROM_FIELD_SWAB16(eep->baseEepHeader.length);
 +              EEPROM_FIELD_SWAB16(eep->baseEepHeader.checksum);
 +              EEPROM_FIELD_SWAB16(eep->baseEepHeader.version);
@@ -549,18 +561,10 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
 +              EEPROM_FIELD_SWAB16(eep->baseEepHeader.blueToothOptions);
 +              EEPROM_FIELD_SWAB16(eep->baseEepHeader.deviceCap);
 +              EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlCommon);
--              for (i = 0; i < AR9287_MAX_CHAINS; i++) {
--                      integer = swab32(eep->modalHeader.antCtrlChain[i]);
--                      eep->modalHeader.antCtrlChain[i] = integer;
--              }
++
 +              for (i = 0; i < AR9287_MAX_CHAINS; i++)
 +                      EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlChain[i]);
--              for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
--                      word = swab16(eep->modalHeader.spurChans[i].spurChan);
--                      eep->modalHeader.spurChans[i].spurChan = word;
--              }
++
 +              for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++)
 +                      EEPROM_FIELD_SWAB16(
 +                              eep->modalHeader.spurChans[i].spurChan);
@@ -712,7 +716,8 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
        if (need_swap) {
 -              u32 integer, j;
 -              u16 word;
--
++              u32 j;
 -              word = swab16(eep->baseEepHeader.length);
 -              eep->baseEepHeader.length = word;
 -
@@ -733,8 +738,7 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
 -
 -              word = swab16(eep->baseEepHeader.blueToothOptions);
 -              eep->baseEepHeader.blueToothOptions = word;
-+              u32 j;
+-
 -              word = swab16(eep->baseEepHeader.deviceCap);
 -              eep->baseEepHeader.deviceCap = word;
 +              EEPROM_FIELD_SWAB16(eep->baseEepHeader.length);
index e506f5a..5ba5580 100644 (file)
@@ -91,8 +91,7 @@
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM_MT7620, word);
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE_MT7620, 1);
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY_MT7620, 1);
--              rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
++
 +                      rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
 +              }
 +              break;
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 1);
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
-+
+-              rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
 +                      rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
 +              }
 +              break;