mac80211: update to wireless-testing 2013-11-05
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 38783v19.07.3_mercusys_ac12_duma
parent
37756a97a0
commit
5f1c42d8b6
@ -0,0 +1,347 @@
|
||||
--- a/net/mac80211/Kconfig
|
||||
+++ b/net/mac80211/Kconfig
|
||||
@@ -5,7 +5,6 @@ config MAC80211
|
||||
depends on CRYPTO
|
||||
depends on CRYPTO_ARC4
|
||||
depends on CRYPTO_AES
|
||||
- depends on CRYPTO_CCM
|
||||
depends on CRC32
|
||||
select BACKPORT_AVERAGE
|
||||
---help---
|
||||
--- a/net/mac80211/aes_ccm.c
|
||||
+++ b/net/mac80211/aes_ccm.c
|
||||
@@ -2,8 +2,6 @@
|
||||
* Copyright 2003-2004, Instant802 Networks, Inc.
|
||||
* Copyright 2005-2006, Devicescape Software, Inc.
|
||||
*
|
||||
- * Rewrite: Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
|
||||
- *
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
@@ -19,75 +17,134 @@
|
||||
#include "key.h"
|
||||
#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)
|
||||
+static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a)
|
||||
{
|
||||
- struct scatterlist assoc, pt, ct[2];
|
||||
- struct {
|
||||
- struct aead_request req;
|
||||
- u8 priv[crypto_aead_reqsize(tfm)];
|
||||
- } aead_req;
|
||||
-
|
||||
- memset(&aead_req, 0, sizeof(aead_req));
|
||||
-
|
||||
- sg_init_one(&pt, data, data_len);
|
||||
- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
|
||||
- sg_init_table(ct, 2);
|
||||
- sg_set_buf(&ct[0], data, data_len);
|
||||
- sg_set_buf(&ct[1], mic, IEEE80211_CCMP_MIC_LEN);
|
||||
-
|
||||
- aead_request_set_tfm(&aead_req.req, tfm);
|
||||
- aead_request_set_assoc(&aead_req.req, &assoc, assoc.length);
|
||||
- aead_request_set_crypt(&aead_req.req, &pt, ct, data_len, b_0);
|
||||
+ int i;
|
||||
+ u8 *b_0, *aad, *b, *s_0;
|
||||
|
||||
- crypto_aead_encrypt(&aead_req.req);
|
||||
+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
|
||||
+ aad = scratch + 4 * AES_BLOCK_SIZE;
|
||||
+ b = scratch;
|
||||
+ s_0 = scratch + AES_BLOCK_SIZE;
|
||||
+
|
||||
+ crypto_cipher_encrypt_one(tfm, b, b_0);
|
||||
+
|
||||
+ /* Extra Authenticate-only data (always two AES blocks) */
|
||||
+ for (i = 0; i < AES_BLOCK_SIZE; i++)
|
||||
+ aad[i] ^= b[i];
|
||||
+ crypto_cipher_encrypt_one(tfm, b, aad);
|
||||
+
|
||||
+ aad += AES_BLOCK_SIZE;
|
||||
+
|
||||
+ for (i = 0; i < AES_BLOCK_SIZE; i++)
|
||||
+ aad[i] ^= b[i];
|
||||
+ crypto_cipher_encrypt_one(tfm, a, aad);
|
||||
+
|
||||
+ /* Mask out bits from auth-only-b_0 */
|
||||
+ b_0[0] &= 0x07;
|
||||
+
|
||||
+ /* 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);
|
||||
}
|
||||
|
||||
-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
|
||||
- u8 *data, size_t data_len, u8 *mic)
|
||||
+
|
||||
+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
|
||||
+ u8 *data, size_t data_len,
|
||||
+ u8 *cdata, u8 *mic)
|
||||
{
|
||||
- struct scatterlist assoc, pt, ct[2];
|
||||
- struct {
|
||||
- struct aead_request req;
|
||||
- u8 priv[crypto_aead_reqsize(tfm)];
|
||||
- } aead_req;
|
||||
-
|
||||
- memset(&aead_req, 0, sizeof(aead_req));
|
||||
-
|
||||
- sg_init_one(&pt, data, data_len);
|
||||
- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
|
||||
- sg_init_table(ct, 2);
|
||||
- sg_set_buf(&ct[0], data, data_len);
|
||||
- sg_set_buf(&ct[1], mic, IEEE80211_CCMP_MIC_LEN);
|
||||
-
|
||||
- aead_request_set_tfm(&aead_req.req, tfm);
|
||||
- aead_request_set_assoc(&aead_req.req, &assoc, assoc.length);
|
||||
- aead_request_set_crypt(&aead_req.req, ct, &pt,
|
||||
- data_len + IEEE80211_CCMP_MIC_LEN, b_0);
|
||||
+ int i, j, last_len, num_blocks;
|
||||
+ u8 *pos, *cpos, *b, *s_0, *e, *b_0;
|
||||
+
|
||||
+ b = scratch;
|
||||
+ s_0 = scratch + AES_BLOCK_SIZE;
|
||||
+ e = scratch + 2 * AES_BLOCK_SIZE;
|
||||
+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
|
||||
+
|
||||
+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
|
||||
+ last_len = data_len % AES_BLOCK_SIZE;
|
||||
+ aes_ccm_prepare(tfm, scratch, b);
|
||||
+
|
||||
+ /* Process payload blocks */
|
||||
+ pos = data;
|
||||
+ cpos = cdata;
|
||||
+ for (j = 1; j <= num_blocks; j++) {
|
||||
+ int blen = (j == num_blocks && last_len) ?
|
||||
+ last_len : AES_BLOCK_SIZE;
|
||||
+
|
||||
+ /* Authentication followed by encryption */
|
||||
+ for (i = 0; i < blen; i++)
|
||||
+ b[i] ^= pos[i];
|
||||
+ crypto_cipher_encrypt_one(tfm, b, b);
|
||||
+
|
||||
+ b_0[14] = (j >> 8) & 0xff;
|
||||
+ b_0[15] = j & 0xff;
|
||||
+ crypto_cipher_encrypt_one(tfm, e, b_0);
|
||||
+ for (i = 0; i < blen; i++)
|
||||
+ *cpos++ = *pos++ ^ e[i];
|
||||
+ }
|
||||
|
||||
- return crypto_aead_decrypt(&aead_req.req);
|
||||
+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++)
|
||||
+ mic[i] = b[i] ^ s_0[i];
|
||||
}
|
||||
|
||||
-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[])
|
||||
+
|
||||
+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
|
||||
+ u8 *cdata, size_t data_len, u8 *mic, u8 *data)
|
||||
{
|
||||
- struct crypto_aead *tfm;
|
||||
- int err;
|
||||
+ int i, j, last_len, num_blocks;
|
||||
+ u8 *pos, *cpos, *b, *s_0, *a, *b_0;
|
||||
|
||||
- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
|
||||
- if (IS_ERR(tfm))
|
||||
- return tfm;
|
||||
-
|
||||
- err = crypto_aead_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
|
||||
- if (!err)
|
||||
- err = crypto_aead_setauthsize(tfm, IEEE80211_CCMP_MIC_LEN);
|
||||
- if (!err)
|
||||
- return tfm;
|
||||
+ b = scratch;
|
||||
+ s_0 = scratch + AES_BLOCK_SIZE;
|
||||
+ a = scratch + 2 * AES_BLOCK_SIZE;
|
||||
+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
|
||||
+
|
||||
+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
|
||||
+ last_len = data_len % AES_BLOCK_SIZE;
|
||||
+ aes_ccm_prepare(tfm, scratch, a);
|
||||
+
|
||||
+ /* Process payload blocks */
|
||||
+ cpos = cdata;
|
||||
+ pos = data;
|
||||
+ for (j = 1; j <= num_blocks; j++) {
|
||||
+ int blen = (j == num_blocks && last_len) ?
|
||||
+ last_len : AES_BLOCK_SIZE;
|
||||
+
|
||||
+ /* Decryption followed by authentication */
|
||||
+ b_0[14] = (j >> 8) & 0xff;
|
||||
+ b_0[15] = j & 0xff;
|
||||
+ crypto_cipher_encrypt_one(tfm, b, b_0);
|
||||
+ for (i = 0; i < blen; i++) {
|
||||
+ *pos = *cpos++ ^ b[i];
|
||||
+ a[i] ^= *pos++;
|
||||
+ }
|
||||
+ crypto_cipher_encrypt_one(tfm, a, a);
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) {
|
||||
+ if ((mic[i] ^ s_0[i]) != a[i])
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
- crypto_free_aead(tfm);
|
||||
- return ERR_PTR(err);
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
-void ieee80211_aes_key_free(struct crypto_aead *tfm)
|
||||
+
|
||||
+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[])
|
||||
+{
|
||||
+ struct crypto_cipher *tfm;
|
||||
+
|
||||
+ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
|
||||
+ if (!IS_ERR(tfm))
|
||||
+ crypto_cipher_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
|
||||
+
|
||||
+ return tfm;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void ieee80211_aes_key_free(struct crypto_cipher *tfm)
|
||||
{
|
||||
- crypto_free_aead(tfm);
|
||||
+ crypto_free_cipher(tfm);
|
||||
}
|
||||
--- a/net/mac80211/aes_ccm.h
|
||||
+++ b/net/mac80211/aes_ccm.h
|
||||
@@ -12,11 +12,13 @@
|
||||
|
||||
#include <linux/crypto.h>
|
||||
|
||||
-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[]);
|
||||
-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
|
||||
- u8 *data, size_t data_len, u8 *mic);
|
||||
-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
|
||||
- u8 *data, size_t data_len, u8 *mic);
|
||||
-void ieee80211_aes_key_free(struct crypto_aead *tfm);
|
||||
+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]);
|
||||
+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
|
||||
+ u8 *data, size_t data_len,
|
||||
+ u8 *cdata, u8 *mic);
|
||||
+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
|
||||
+ u8 *cdata, size_t data_len,
|
||||
+ u8 *mic, u8 *data);
|
||||
+void ieee80211_aes_key_free(struct crypto_cipher *tfm);
|
||||
|
||||
#endif /* AES_CCM_H */
|
||||
--- a/net/mac80211/key.h
|
||||
+++ b/net/mac80211/key.h
|
||||
@@ -83,7 +83,7 @@ struct ieee80211_key {
|
||||
* Management frames.
|
||||
*/
|
||||
u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
|
||||
- struct crypto_aead *tfm;
|
||||
+ struct crypto_cipher *tfm;
|
||||
u32 replays; /* dot11RSNAStatsCCMPReplays */
|
||||
} ccmp;
|
||||
struct {
|
||||
--- a/net/mac80211/wpa.c
|
||||
+++ b/net/mac80211/wpa.c
|
||||
@@ -301,16 +301,22 @@ ieee80211_crypto_tkip_decrypt(struct iee
|
||||
}
|
||||
|
||||
|
||||
-static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
|
||||
+static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
|
||||
int encrypted)
|
||||
{
|
||||
__le16 mask_fc;
|
||||
int a4_included, mgmt;
|
||||
u8 qos_tid;
|
||||
- u16 len_a;
|
||||
+ u8 *b_0, *aad;
|
||||
+ u16 data_len, len_a;
|
||||
unsigned int hdrlen;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
|
||||
+ memset(scratch, 0, 6 * AES_BLOCK_SIZE);
|
||||
+
|
||||
+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
|
||||
+ aad = scratch + 4 * AES_BLOCK_SIZE;
|
||||
+
|
||||
/*
|
||||
* Mask FC: zero subtype b4 b5 b6 (if not mgmt)
|
||||
* Retry, PwrMgt, MoreData; set Protected
|
||||
@@ -332,21 +338,20 @@ static void ccmp_special_blocks(struct s
|
||||
else
|
||||
qos_tid = 0;
|
||||
|
||||
- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
|
||||
- * mode authentication are not allowed to collide, yet both are derived
|
||||
- * from this vector b_0. We only set L := 1 here to indicate that the
|
||||
- * data size can be represented in (L+1) bytes. The CCM layer will take
|
||||
- * care of storing the data length in the top (L+1) bytes and setting
|
||||
- * and clearing the other bits as is required to derive the two IVs.
|
||||
- */
|
||||
- b_0[0] = 0x1;
|
||||
+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN;
|
||||
+ if (encrypted)
|
||||
+ data_len -= IEEE80211_CCMP_MIC_LEN;
|
||||
|
||||
+ /* First block, b_0 */
|
||||
+ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
|
||||
/* Nonce: Nonce Flags | A2 | PN
|
||||
* Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
|
||||
*/
|
||||
b_0[1] = qos_tid | (mgmt << 4);
|
||||
memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
|
||||
memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
|
||||
+ /* l(m) */
|
||||
+ put_unaligned_be16(data_len, &b_0[14]);
|
||||
|
||||
/* AAD (extra authenticate-only data) / masked 802.11 header
|
||||
* FC | A1 | A2 | A3 | SC | [A4] | [QC] */
|
||||
@@ -402,8 +407,7 @@ static int ccmp_encrypt_skb(struct ieee8
|
||||
u8 *pos;
|
||||
u8 pn[6];
|
||||
u64 pn64;
|
||||
- u8 aad[2 * AES_BLOCK_SIZE];
|
||||
- u8 b_0[AES_BLOCK_SIZE];
|
||||
+ u8 scratch[6 * AES_BLOCK_SIZE];
|
||||
|
||||
if (info->control.hw_key &&
|
||||
!(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
|
||||
@@ -456,9 +460,9 @@ static int ccmp_encrypt_skb(struct ieee8
|
||||
return 0;
|
||||
|
||||
pos += IEEE80211_CCMP_HDR_LEN;
|
||||
- ccmp_special_blocks(skb, pn, b_0, aad, 0);
|
||||
- ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
|
||||
- skb_put(skb, IEEE80211_CCMP_MIC_LEN));
|
||||
+ ccmp_special_blocks(skb, pn, scratch, 0);
|
||||
+ ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len,
|
||||
+ pos, skb_put(skb, IEEE80211_CCMP_MIC_LEN));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -521,16 +525,16 @@ ieee80211_crypto_ccmp_decrypt(struct iee
|
||||
}
|
||||
|
||||
if (!(status->flag & RX_FLAG_DECRYPTED)) {
|
||||
- u8 aad[2 * AES_BLOCK_SIZE];
|
||||
- u8 b_0[AES_BLOCK_SIZE];
|
||||
+ u8 scratch[6 * AES_BLOCK_SIZE];
|
||||
/* hardware didn't decrypt/verify MIC */
|
||||
- ccmp_special_blocks(skb, pn, b_0, aad, 1);
|
||||
+ ccmp_special_blocks(skb, pn, scratch, 1);
|
||||
|
||||
if (ieee80211_aes_ccm_decrypt(
|
||||
- key->u.ccmp.tfm, b_0, aad,
|
||||
+ key->u.ccmp.tfm, scratch,
|
||||
skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
|
||||
data_len,
|
||||
- skb->data + skb->len - IEEE80211_CCMP_MIC_LEN))
|
||||
+ skb->data + skb->len - IEEE80211_CCMP_MIC_LEN,
|
||||
+ skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN))
|
||||
return RX_DROP_UNUSABLE;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,10 @@
|
||||
--- a/drivers/net/wireless/ath/ath9k/init.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/init.c
|
||||
@@ -814,6 +814,7 @@ static const struct ieee80211_iface_limi
|
||||
@@ -844,6 +844,7 @@ static const struct ieee80211_iface_limi
|
||||
#endif
|
||||
BIT(NL80211_IFTYPE_AP) |
|
||||
BIT(NL80211_IFTYPE_P2P_GO) },
|
||||
+ { .max = 1, .types = BIT(NL80211_IFTYPE_ADHOC) },
|
||||
};
|
||||
|
||||
|
||||
static const struct ieee80211_iface_limit if_dfs_limits[] = {
|
||||
|
@ -0,0 +1,31 @@
|
||||
--- a/drivers/net/wireless/rt2x00/rt2x00eeprom.c
|
||||
+++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
|
||||
#include "rt2x00.h"
|
||||
#include "rt2x00lib.h"
|
||||
@@ -34,11 +35,19 @@ static const char *
|
||||
rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
|
||||
{
|
||||
struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
|
||||
+ struct device_node *np;
|
||||
+ char *eep;
|
||||
|
||||
if (pdata && pdata->eeprom_file_name)
|
||||
return pdata->eeprom_file_name;
|
||||
|
||||
- return NULL
|
||||
+#ifdef CONFIG_OF
|
||||
+ np = rt2x00dev->dev->of_node;
|
||||
+ if (np && of_property_read_string(np, "ralink,eeprom", &eep) == 0)
|
||||
+ return eep;
|
||||
+#endif
|
||||
+
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
static int rt2x00lib_request_eeprom_file(struct rt2x00_dev *rt2x00dev)
|
@ -1,46 +0,0 @@
|
||||
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
|
||||
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
|
||||
@@ -90,7 +90,7 @@ static void rt2800pci_mcu_status(struct
|
||||
rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
|
||||
}
|
||||
|
||||
-static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
|
||||
+static int rt2800pci_read_eeprom_file(struct rt2x00_dev *rt2x00dev)
|
||||
{
|
||||
memcpy(rt2x00dev->eeprom, rt2x00dev->eeprom_file->data, EEPROM_SIZE);
|
||||
return 0;
|
||||
@@ -1097,8 +1097,9 @@ static int rt2800pci_read_eeprom(struct
|
||||
{
|
||||
int retval;
|
||||
|
||||
- if (rt2x00_is_soc(rt2x00dev))
|
||||
- retval = rt2800pci_read_eeprom_soc(rt2x00dev);
|
||||
+ if (rt2x00_is_soc(rt2x00dev) ||
|
||||
+ test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags))
|
||||
+ retval = rt2800pci_read_eeprom_file(rt2x00dev);
|
||||
else if (rt2800pci_efuse_detect(rt2x00dev))
|
||||
retval = rt2800pci_read_eeprom_efuse(rt2x00dev);
|
||||
else
|
||||
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
|
||||
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
|
||||
@@ -78,6 +78,7 @@ exit:
|
||||
int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops)
|
||||
{
|
||||
struct ieee80211_hw *hw;
|
||||
+ struct rt2x00_platform_data *pdata;
|
||||
struct rt2x00_dev *rt2x00dev;
|
||||
int retval;
|
||||
u16 chip;
|
||||
@@ -125,6 +126,12 @@ int rt2x00pci_probe(struct pci_dev *pci_
|
||||
rt2x00dev->irq = pci_dev->irq;
|
||||
rt2x00dev->name = pci_name(pci_dev);
|
||||
|
||||
+ /* if we get passed the name of a eeprom_file_name, then use this in
|
||||
+ favour of the eeprom */
|
||||
+ pdata = rt2x00dev->dev->platform_data;
|
||||
+ if (pdata && pdata->eeprom_file_name)
|
||||
+ set_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags);
|
||||
+
|
||||
if (pci_is_pcie(pci_dev))
|
||||
rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
|
||||
else
|
@ -1,28 +0,0 @@
|
||||
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
|
||||
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/eeprom_93cx6.h>
|
||||
+#include <linux/of.h>
|
||||
|
||||
#include "rt2x00.h"
|
||||
#include "rt2x00mmio.h"
|
||||
@@ -323,11 +324,17 @@ static int rt2800pci_write_firmware(stru
|
||||
static char *rt2800pci_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
|
||||
{
|
||||
struct rt2x00_platform_data *pdata;
|
||||
+ struct device_node *np;
|
||||
+ char *eep;
|
||||
|
||||
pdata = rt2x00dev->dev->platform_data;
|
||||
if (pdata)
|
||||
return pdata->eeprom_file_name;
|
||||
|
||||
+ np = rt2x00dev->dev->of_node;
|
||||
+ if (np && !of_property_read_string(np, "ralink,eeprom", &eep))
|
||||
+ return eep;
|
||||
+
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
|
||||
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
|
||||
@@ -108,7 +108,9 @@ int rt2x00pci_probe(struct pci_dev *pci_
|
||||
goto exit_release_regions;
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_PCI_MSI
|
||||
pci_enable_msi(pci_dev);
|
||||
+#endif
|
||||
|
||||
hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
|
||||
if (!hw) {
|
||||
@@ -162,7 +164,9 @@ exit_free_device:
|
||||
ieee80211_free_hw(hw);
|
||||
|
||||
exit_disable_msi:
|
||||
+#ifdef CONFIG_PCI_SET_MWI
|
||||
pci_disable_msi(pci_dev);
|
||||
+#endif
|
||||
|
||||
exit_release_regions:
|
||||
pci_release_regions(pci_dev);
|
||||
@@ -188,7 +192,9 @@ void rt2x00pci_remove(struct pci_dev *pc
|
||||
rt2x00pci_free_reg(rt2x00dev);
|
||||
ieee80211_free_hw(hw);
|
||||
|
||||
+#ifdef CONFIG_PCI_MSI
|
||||
pci_disable_msi(pci_dev);
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Free the PCI device data.
|
@ -1,27 +0,0 @@
|
||||
From 60ce314d1750fef843e9db70050e09e49f838b69 Mon Sep 17 00:00:00 2001
|
||||
From: Larry Finger <Larry.Finger@lwfinger.net>
|
||||
Date: Thu, 19 Sep 2013 02:21:35 +0000
|
||||
Subject: rtlwifi: Align private space in rtl_priv struct
|
||||
|
||||
The private array at the end of the rtl_priv struct is not aligned.
|
||||
On ARM architecture, this causes an alignment trap and is fixed by aligning
|
||||
that array with __align(sizeof(void *)). That should properly align that
|
||||
space according to the requirements of all architectures.
|
||||
|
||||
Reported-by: Jason Andrews <jasona@cadence.com>
|
||||
Tested-by: Jason Andrews <jasona@cadence.com>
|
||||
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
|
||||
Cc: Stable <stable@vger.kernel.org>
|
||||
Signed-off-by: John W. Linville <linville@tuxdriver.com>
|
||||
---
|
||||
--- a/drivers/net/wireless/rtlwifi/wifi.h
|
||||
+++ b/drivers/net/wireless/rtlwifi/wifi.h
|
||||
@@ -2057,7 +2057,7 @@ struct rtl_priv {
|
||||
that it points to the data allocated
|
||||
beyond this structure like:
|
||||
rtl_pci_priv or rtl_usb_priv */
|
||||
- u8 priv[0];
|
||||
+ u8 priv[0] __aligned(sizeof(void *));
|
||||
};
|
||||
|
||||
#define rtl_priv(hw) (((struct rtl_priv *)(hw)->priv))
|
@ -0,0 +1,29 @@
|
||||
--- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
|
||||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
|
||||
@@ -58,21 +58,12 @@
|
||||
(((c) < 149) ? 3 : 4))))
|
||||
|
||||
#define BRCM_2GHZ_2412_2462 REG_RULE(2412-10, 2462+10, 40, 0, 19, 0)
|
||||
-#define BRCM_2GHZ_2467_2472 REG_RULE(2467-10, 2472+10, 20, 0, 19, \
|
||||
- NL80211_RRF_NO_IR)
|
||||
+#define BRCM_2GHZ_2467_2472 REG_RULE(2467-10, 2472+10, 20, 0, 19, 0)
|
||||
|
||||
-#define BRCM_5GHZ_5180_5240 REG_RULE(5180-10, 5240+10, 40, 0, 21, \
|
||||
- NL80211_RRF_NO_IR)
|
||||
-#define BRCM_5GHZ_5260_5320 REG_RULE(5260-10, 5320+10, 40, 0, 21, \
|
||||
- NL80211_RRF_NO_IR | \
|
||||
- NL80211_RRF_DFS | \
|
||||
- NL80211_RRF_NO_IR)
|
||||
-#define BRCM_5GHZ_5500_5700 REG_RULE(5500-10, 5700+10, 40, 0, 21, \
|
||||
- NL80211_RRF_NO_IR | \
|
||||
- NL80211_RRF_DFS | \
|
||||
- NL80211_RRF_NO_IR)
|
||||
-#define BRCM_5GHZ_5745_5825 REG_RULE(5745-10, 5825+10, 40, 0, 21, \
|
||||
- NL80211_RRF_NO_IR)
|
||||
+#define BRCM_5GHZ_5180_5240 REG_RULE(5180-10, 5240+10, 40, 0, 21, 0)
|
||||
+#define BRCM_5GHZ_5260_5320 REG_RULE(5260-10, 5320+10, 40, 0, 21, 0)
|
||||
+#define BRCM_5GHZ_5500_5700 REG_RULE(5500-10, 5700+10, 40, 0, 21, 0)
|
||||
+#define BRCM_5GHZ_5745_5825 REG_RULE(5745-10, 5825+10, 40, 0, 21, 0)
|
||||
|
||||
static const struct ieee80211_regdomain brcms_regdom_x2 = {
|
||||
.n_reg_rules = 6,
|
@ -1,31 +0,0 @@
|
||||
--- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
|
||||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
|
||||
@@ -59,23 +59,16 @@
|
||||
|
||||
#define BRCM_2GHZ_2412_2462 REG_RULE(2412-10, 2462+10, 40, 0, 19, 0)
|
||||
#define BRCM_2GHZ_2467_2472 REG_RULE(2467-10, 2472+10, 20, 0, 19, \
|
||||
- NL80211_RRF_PASSIVE_SCAN | \
|
||||
- NL80211_RRF_NO_IBSS)
|
||||
+ 0)
|
||||
|
||||
#define BRCM_5GHZ_5180_5240 REG_RULE(5180-10, 5240+10, 40, 0, 21, \
|
||||
- NL80211_RRF_PASSIVE_SCAN | \
|
||||
- NL80211_RRF_NO_IBSS)
|
||||
+ 0)
|
||||
#define BRCM_5GHZ_5260_5320 REG_RULE(5260-10, 5320+10, 40, 0, 21, \
|
||||
- NL80211_RRF_PASSIVE_SCAN | \
|
||||
- NL80211_RRF_DFS | \
|
||||
- NL80211_RRF_NO_IBSS)
|
||||
+ 0)
|
||||
#define BRCM_5GHZ_5500_5700 REG_RULE(5500-10, 5700+10, 40, 0, 21, \
|
||||
- NL80211_RRF_PASSIVE_SCAN | \
|
||||
- NL80211_RRF_DFS | \
|
||||
- NL80211_RRF_NO_IBSS)
|
||||
+ 0)
|
||||
#define BRCM_5GHZ_5745_5825 REG_RULE(5745-10, 5825+10, 40, 0, 21, \
|
||||
- NL80211_RRF_PASSIVE_SCAN | \
|
||||
- NL80211_RRF_NO_IBSS)
|
||||
+ 0)
|
||||
|
||||
static const struct ieee80211_regdomain brcms_regdom_x2 = {
|
||||
.n_reg_rules = 6,
|
@ -1,84 +0,0 @@
|
||||
brcmsmac: use bcma PCIe up and down functions
|
||||
|
||||
replace the calls to bcma_core_pci_extend_L1timer() by calls to the
|
||||
newly introduced bcma_core_pci_ip() and bcma_core_pci_down()
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
|
||||
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
|
||||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
|
||||
@@ -679,27 +679,6 @@ bool ai_clkctl_cc(struct si_pub *sih, en
|
||||
return mode == BCMA_CLKMODE_FAST;
|
||||
}
|
||||
|
||||
-void ai_pci_up(struct si_pub *sih)
|
||||
-{
|
||||
- struct si_info *sii;
|
||||
-
|
||||
- sii = container_of(sih, struct si_info, pub);
|
||||
-
|
||||
- if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
|
||||
- bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], true);
|
||||
-}
|
||||
-
|
||||
-/* Unconfigure and/or apply various WARs when going down */
|
||||
-void ai_pci_down(struct si_pub *sih)
|
||||
-{
|
||||
- struct si_info *sii;
|
||||
-
|
||||
- sii = container_of(sih, struct si_info, pub);
|
||||
-
|
||||
- if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
|
||||
- bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], false);
|
||||
-}
|
||||
-
|
||||
/* Enable BT-COEX & Ex-PA for 4313 */
|
||||
void ai_epa_4313war(struct si_pub *sih)
|
||||
{
|
||||
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
|
||||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
|
||||
@@ -183,9 +183,6 @@ extern u16 ai_clkctl_fast_pwrup_delay(st
|
||||
extern bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode);
|
||||
extern bool ai_deviceremoved(struct si_pub *sih);
|
||||
|
||||
-extern void ai_pci_down(struct si_pub *sih);
|
||||
-extern void ai_pci_up(struct si_pub *sih);
|
||||
-
|
||||
/* Enable Ex-PA for 4313 */
|
||||
extern void ai_epa_4313war(struct si_pub *sih);
|
||||
|
||||
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
|
||||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
|
||||
@@ -4667,7 +4667,7 @@ static int brcms_b_attach(struct brcms_c
|
||||
brcms_c_coredisable(wlc_hw);
|
||||
|
||||
/* Match driver "down" state */
|
||||
- ai_pci_down(wlc_hw->sih);
|
||||
+ bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
|
||||
/* turn off pll and xtal to match driver "down" state */
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
@@ -5010,12 +5010,12 @@ static int brcms_b_up_prep(struct brcms_
|
||||
*/
|
||||
if (brcms_b_radio_read_hwdisabled(wlc_hw)) {
|
||||
/* put SB PCI in down state again */
|
||||
- ai_pci_down(wlc_hw->sih);
|
||||
+ bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
|
||||
- ai_pci_up(wlc_hw->sih);
|
||||
+ bcma_core_pci_up(wlc_hw->d11core->bus);
|
||||
|
||||
/* reset the d11 core */
|
||||
brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS);
|
||||
@@ -5212,7 +5212,7 @@ static int brcms_b_down_finish(struct br
|
||||
|
||||
/* turn off primary xtal and pll */
|
||||
if (!wlc_hw->noreset) {
|
||||
- ai_pci_down(wlc_hw->sih);
|
||||
+ bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
b43: call PCIe up and down functions
|
||||
|
||||
Tell the PCIe host core when the wifi is activated.
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
|
||||
--- a/drivers/net/wireless/b43/main.c
|
||||
+++ b/drivers/net/wireless/b43/main.c
|
||||
@@ -4670,6 +4670,19 @@ static void b43_wireless_core_exit(struc
|
||||
b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_RUN,
|
||||
B43_MACCTL_PSM_JMP0);
|
||||
|
||||
+ switch (dev->dev->bus_type) {
|
||||
+#ifdef CPTCFG_B43_BCMA
|
||||
+ case B43_BUS_BCMA:
|
||||
+ bcma_core_pci_down(dev->dev->bdev->bus);
|
||||
+ break;
|
||||
+#endif
|
||||
+#ifdef CPTCFG_B43_SSB
|
||||
+ case B43_BUS_SSB:
|
||||
+ /* TODO */
|
||||
+ break;
|
||||
+#endif
|
||||
+ }
|
||||
+
|
||||
b43_dma_free(dev);
|
||||
b43_pio_free(dev);
|
||||
b43_chip_exit(dev);
|
||||
@@ -4709,6 +4722,7 @@ static int b43_wireless_core_init(struct
|
||||
case B43_BUS_BCMA:
|
||||
bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0],
|
||||
dev->dev->bdev, true);
|
||||
+ bcma_core_pci_up(dev->dev->bdev->bus);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CPTCFG_B43_SSB
|
Loading…
Reference in New Issue