diff options
106 files changed, 1765 insertions, 721 deletions
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig index 06b3207adebd..a533af218368 100644 --- a/drivers/bcma/Kconfig +++ b/drivers/bcma/Kconfig | |||
@@ -48,12 +48,12 @@ config BCMA_DRIVER_MIPS | |||
48 | 48 | ||
49 | config BCMA_SFLASH | 49 | config BCMA_SFLASH |
50 | bool | 50 | bool |
51 | depends on BCMA_DRIVER_MIPS && BROKEN | 51 | depends on BCMA_DRIVER_MIPS |
52 | default y | 52 | default y |
53 | 53 | ||
54 | config BCMA_NFLASH | 54 | config BCMA_NFLASH |
55 | bool | 55 | bool |
56 | depends on BCMA_DRIVER_MIPS && BROKEN | 56 | depends on BCMA_DRIVER_MIPS |
57 | default y | 57 | default y |
58 | 58 | ||
59 | config BCMA_DRIVER_GMAC_CMN | 59 | config BCMA_DRIVER_GMAC_CMN |
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h index 3cf9cc923cd2..169fc58427d3 100644 --- a/drivers/bcma/bcma_private.h +++ b/drivers/bcma/bcma_private.h | |||
@@ -54,6 +54,7 @@ u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc); | |||
54 | #ifdef CONFIG_BCMA_SFLASH | 54 | #ifdef CONFIG_BCMA_SFLASH |
55 | /* driver_chipcommon_sflash.c */ | 55 | /* driver_chipcommon_sflash.c */ |
56 | int bcma_sflash_init(struct bcma_drv_cc *cc); | 56 | int bcma_sflash_init(struct bcma_drv_cc *cc); |
57 | extern struct platform_device bcma_sflash_dev; | ||
57 | #else | 58 | #else |
58 | static inline int bcma_sflash_init(struct bcma_drv_cc *cc) | 59 | static inline int bcma_sflash_init(struct bcma_drv_cc *cc) |
59 | { | 60 | { |
@@ -65,6 +66,7 @@ static inline int bcma_sflash_init(struct bcma_drv_cc *cc) | |||
65 | #ifdef CONFIG_BCMA_NFLASH | 66 | #ifdef CONFIG_BCMA_NFLASH |
66 | /* driver_chipcommon_nflash.c */ | 67 | /* driver_chipcommon_nflash.c */ |
67 | int bcma_nflash_init(struct bcma_drv_cc *cc); | 68 | int bcma_nflash_init(struct bcma_drv_cc *cc); |
69 | extern struct platform_device bcma_nflash_dev; | ||
68 | #else | 70 | #else |
69 | static inline int bcma_nflash_init(struct bcma_drv_cc *cc) | 71 | static inline int bcma_nflash_init(struct bcma_drv_cc *cc) |
70 | { | 72 | { |
diff --git a/drivers/bcma/driver_chipcommon_nflash.c b/drivers/bcma/driver_chipcommon_nflash.c index 574d62435bc2..9042781edec3 100644 --- a/drivers/bcma/driver_chipcommon_nflash.c +++ b/drivers/bcma/driver_chipcommon_nflash.c | |||
@@ -5,15 +5,37 @@ | |||
5 | * Licensed under the GNU/GPL. See COPYING for details. | 5 | * Licensed under the GNU/GPL. See COPYING for details. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/platform_device.h> | ||
8 | #include <linux/bcma/bcma.h> | 9 | #include <linux/bcma/bcma.h> |
9 | #include <linux/bcma/bcma_driver_chipcommon.h> | ||
10 | #include <linux/delay.h> | ||
11 | 10 | ||
12 | #include "bcma_private.h" | 11 | #include "bcma_private.h" |
13 | 12 | ||
13 | struct platform_device bcma_nflash_dev = { | ||
14 | .name = "bcma_nflash", | ||
15 | .num_resources = 0, | ||
16 | }; | ||
17 | |||
14 | /* Initialize NAND flash access */ | 18 | /* Initialize NAND flash access */ |
15 | int bcma_nflash_init(struct bcma_drv_cc *cc) | 19 | int bcma_nflash_init(struct bcma_drv_cc *cc) |
16 | { | 20 | { |
17 | bcma_err(cc->core->bus, "NAND flash support is broken\n"); | 21 | struct bcma_bus *bus = cc->core->bus; |
22 | |||
23 | if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4706 && | ||
24 | cc->core->id.rev != 0x38) { | ||
25 | bcma_err(bus, "NAND flash on unsupported board!\n"); | ||
26 | return -ENOTSUPP; | ||
27 | } | ||
28 | |||
29 | if (!(cc->capabilities & BCMA_CC_CAP_NFLASH)) { | ||
30 | bcma_err(bus, "NAND flash not present according to ChipCommon\n"); | ||
31 | return -ENODEV; | ||
32 | } | ||
33 | |||
34 | cc->nflash.present = true; | ||
35 | |||
36 | /* Prepare platform device, but don't register it yet. It's too early, | ||
37 | * malloc (required by device_private_init) is not available yet. */ | ||
38 | bcma_nflash_dev.dev.platform_data = &cc->nflash; | ||
39 | |||
18 | return 0; | 40 | return 0; |
19 | } | 41 | } |
diff --git a/drivers/bcma/driver_chipcommon_sflash.c b/drivers/bcma/driver_chipcommon_sflash.c index 6e157a58a1d7..2c4eec2ca5a0 100644 --- a/drivers/bcma/driver_chipcommon_sflash.c +++ b/drivers/bcma/driver_chipcommon_sflash.c | |||
@@ -5,15 +5,132 @@ | |||
5 | * Licensed under the GNU/GPL. See COPYING for details. | 5 | * Licensed under the GNU/GPL. See COPYING for details. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/platform_device.h> | ||
8 | #include <linux/bcma/bcma.h> | 9 | #include <linux/bcma/bcma.h> |
9 | #include <linux/bcma/bcma_driver_chipcommon.h> | ||
10 | #include <linux/delay.h> | ||
11 | 10 | ||
12 | #include "bcma_private.h" | 11 | #include "bcma_private.h" |
13 | 12 | ||
13 | static struct resource bcma_sflash_resource = { | ||
14 | .name = "bcma_sflash", | ||
15 | .start = BCMA_SFLASH, | ||
16 | .end = 0, | ||
17 | .flags = IORESOURCE_MEM | IORESOURCE_READONLY, | ||
18 | }; | ||
19 | |||
20 | struct platform_device bcma_sflash_dev = { | ||
21 | .name = "bcma_sflash", | ||
22 | .resource = &bcma_sflash_resource, | ||
23 | .num_resources = 1, | ||
24 | }; | ||
25 | |||
26 | struct bcma_sflash_tbl_e { | ||
27 | char *name; | ||
28 | u32 id; | ||
29 | u32 blocksize; | ||
30 | u16 numblocks; | ||
31 | }; | ||
32 | |||
33 | static struct bcma_sflash_tbl_e bcma_sflash_st_tbl[] = { | ||
34 | { "", 0x14, 0x10000, 32, }, | ||
35 | { 0 }, | ||
36 | }; | ||
37 | |||
38 | static struct bcma_sflash_tbl_e bcma_sflash_sst_tbl[] = { | ||
39 | { 0 }, | ||
40 | }; | ||
41 | |||
42 | static struct bcma_sflash_tbl_e bcma_sflash_at_tbl[] = { | ||
43 | { 0 }, | ||
44 | }; | ||
45 | |||
46 | static void bcma_sflash_cmd(struct bcma_drv_cc *cc, u32 opcode) | ||
47 | { | ||
48 | int i; | ||
49 | bcma_cc_write32(cc, BCMA_CC_FLASHCTL, | ||
50 | BCMA_CC_FLASHCTL_START | opcode); | ||
51 | for (i = 0; i < 1000; i++) { | ||
52 | if (!(bcma_cc_read32(cc, BCMA_CC_FLASHCTL) & | ||
53 | BCMA_CC_FLASHCTL_BUSY)) | ||
54 | return; | ||
55 | cpu_relax(); | ||
56 | } | ||
57 | bcma_err(cc->core->bus, "SFLASH control command failed (timeout)!\n"); | ||
58 | } | ||
59 | |||
14 | /* Initialize serial flash access */ | 60 | /* Initialize serial flash access */ |
15 | int bcma_sflash_init(struct bcma_drv_cc *cc) | 61 | int bcma_sflash_init(struct bcma_drv_cc *cc) |
16 | { | 62 | { |
17 | bcma_err(cc->core->bus, "Serial flash support is broken\n"); | 63 | struct bcma_bus *bus = cc->core->bus; |
64 | struct bcma_sflash *sflash = &cc->sflash; | ||
65 | struct bcma_sflash_tbl_e *e; | ||
66 | u32 id, id2; | ||
67 | |||
68 | switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { | ||
69 | case BCMA_CC_FLASHT_STSER: | ||
70 | bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_DP); | ||
71 | |||
72 | bcma_cc_write32(cc, BCMA_CC_FLASHADDR, 0); | ||
73 | bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_RES); | ||
74 | id = bcma_cc_read32(cc, BCMA_CC_FLASHDATA); | ||
75 | |||
76 | bcma_cc_write32(cc, BCMA_CC_FLASHADDR, 1); | ||
77 | bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_RES); | ||
78 | id2 = bcma_cc_read32(cc, BCMA_CC_FLASHDATA); | ||
79 | |||
80 | switch (id) { | ||
81 | case 0xbf: | ||
82 | for (e = bcma_sflash_sst_tbl; e->name; e++) { | ||
83 | if (e->id == id2) | ||
84 | break; | ||
85 | } | ||
86 | break; | ||
87 | default: | ||
88 | for (e = bcma_sflash_st_tbl; e->name; e++) { | ||
89 | if (e->id == id) | ||
90 | break; | ||
91 | } | ||
92 | break; | ||
93 | } | ||
94 | if (!e->name) { | ||
95 | bcma_err(bus, "Unsupported ST serial flash (id: 0x%X, id2: 0x%X)\n", id, id2); | ||
96 | return -ENOTSUPP; | ||
97 | } | ||
98 | |||
99 | break; | ||
100 | case BCMA_CC_FLASHT_ATSER: | ||
101 | bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_AT_STATUS); | ||
102 | id = bcma_cc_read32(cc, BCMA_CC_FLASHDATA) & 0x3c; | ||
103 | |||
104 | for (e = bcma_sflash_at_tbl; e->name; e++) { | ||
105 | if (e->id == id) | ||
106 | break; | ||
107 | } | ||
108 | if (!e->name) { | ||
109 | bcma_err(bus, "Unsupported Atmel serial flash (id: 0x%X)\n", id); | ||
110 | return -ENOTSUPP; | ||
111 | } | ||
112 | |||
113 | break; | ||
114 | default: | ||
115 | bcma_err(bus, "Unsupported flash type\n"); | ||
116 | return -ENOTSUPP; | ||
117 | } | ||
118 | |||
119 | sflash->window = BCMA_SFLASH; | ||
120 | sflash->blocksize = e->blocksize; | ||
121 | sflash->numblocks = e->numblocks; | ||
122 | sflash->size = sflash->blocksize * sflash->numblocks; | ||
123 | sflash->present = true; | ||
124 | |||
125 | bcma_info(bus, "Found %s serial flash (size: %dKiB, blocksize: 0x%X, blocks: %d)\n", | ||
126 | e->name, sflash->size / 1024, sflash->blocksize, | ||
127 | sflash->numblocks); | ||
128 | |||
129 | /* Prepare platform device, but don't register it yet. It's too early, | ||
130 | * malloc (required by device_private_init) is not available yet. */ | ||
131 | bcma_sflash_dev.resource[0].end = bcma_sflash_dev.resource[0].start + | ||
132 | sflash->size; | ||
133 | bcma_sflash_dev.dev.platform_data = sflash; | ||
134 | |||
18 | return 0; | 135 | return 0; |
19 | } | 136 | } |
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 758af9ccdef0..a8f570d69075 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include "bcma_private.h" | 8 | #include "bcma_private.h" |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/platform_device.h> | ||
10 | #include <linux/bcma/bcma.h> | 11 | #include <linux/bcma/bcma.h> |
11 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
12 | 13 | ||
@@ -136,6 +137,22 @@ static int bcma_register_cores(struct bcma_bus *bus) | |||
136 | dev_id++; | 137 | dev_id++; |
137 | } | 138 | } |
138 | 139 | ||
140 | #ifdef CONFIG_BCMA_SFLASH | ||
141 | if (bus->drv_cc.sflash.present) { | ||
142 | err = platform_device_register(&bcma_sflash_dev); | ||
143 | if (err) | ||
144 | bcma_err(bus, "Error registering serial flash\n"); | ||
145 | } | ||
146 | #endif | ||
147 | |||
148 | #ifdef CONFIG_BCMA_NFLASH | ||
149 | if (bus->drv_cc.nflash.present) { | ||
150 | err = platform_device_register(&bcma_nflash_dev); | ||
151 | if (err) | ||
152 | bcma_err(bus, "Error registering NAND flash\n"); | ||
153 | } | ||
154 | #endif | ||
155 | |||
139 | return 0; | 156 | return 0; |
140 | } | 157 | } |
141 | 158 | ||
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c index 689a71c1af71..154a4965be4f 100644 --- a/drivers/net/wireless/adm8211.c +++ b/drivers/net/wireless/adm8211.c | |||
@@ -1661,7 +1661,9 @@ static void adm8211_tx_raw(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
1661 | } | 1661 | } |
1662 | 1662 | ||
1663 | /* Put adm8211_tx_hdr on skb and transmit */ | 1663 | /* Put adm8211_tx_hdr on skb and transmit */ |
1664 | static void adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | 1664 | static void adm8211_tx(struct ieee80211_hw *dev, |
1665 | struct ieee80211_tx_control *control, | ||
1666 | struct sk_buff *skb) | ||
1665 | { | 1667 | { |
1666 | struct adm8211_tx_hdr *txhdr; | 1668 | struct adm8211_tx_hdr *txhdr; |
1667 | size_t payload_len, hdrlen; | 1669 | size_t payload_len, hdrlen; |
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index 88b8d64c90f1..e361afed99ff 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -1726,7 +1726,9 @@ static void at76_mac80211_tx_callback(struct urb *urb) | |||
1726 | ieee80211_wake_queues(priv->hw); | 1726 | ieee80211_wake_queues(priv->hw); |
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | static void at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 1729 | static void at76_mac80211_tx(struct ieee80211_hw *hw, |
1730 | struct ieee80211_tx_control *control, | ||
1731 | struct sk_buff *skb) | ||
1730 | { | 1732 | { |
1731 | struct at76_priv *priv = hw->priv; | 1733 | struct at76_priv *priv = hw->priv; |
1732 | struct at76_tx_buffer *tx_buffer = priv->bulk_out_buffer; | 1734 | struct at76_tx_buffer *tx_buffer = priv->bulk_out_buffer; |
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c index 384e67af73bc..df61a09adb6d 100644 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c | |||
@@ -55,7 +55,8 @@ | |||
55 | \********************/ | 55 | \********************/ |
56 | 56 | ||
57 | static void | 57 | static void |
58 | ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 58 | ath5k_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, |
59 | struct sk_buff *skb) | ||
59 | { | 60 | { |
60 | struct ath5k_hw *ah = hw->priv; | 61 | struct ath5k_hw *ah = hw->priv; |
61 | u16 qnum = skb_get_queue_mapping(skb); | 62 | u16 qnum = skb_get_queue_mapping(skb); |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index b09285c36c4a..7373e4b92c92 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -280,6 +280,7 @@ struct ath_tx_control { | |||
280 | struct ath_txq *txq; | 280 | struct ath_txq *txq; |
281 | struct ath_node *an; | 281 | struct ath_node *an; |
282 | u8 paprd; | 282 | u8 paprd; |
283 | struct ieee80211_sta *sta; | ||
283 | }; | 284 | }; |
284 | 285 | ||
285 | #define ATH_TX_ERROR 0x01 | 286 | #define ATH_TX_ERROR 0x01 |
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index 936e920fb88e..b30596fcf73a 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h | |||
@@ -542,6 +542,7 @@ void ath9k_htc_stop_ani(struct ath9k_htc_priv *priv); | |||
542 | 542 | ||
543 | int ath9k_tx_init(struct ath9k_htc_priv *priv); | 543 | int ath9k_tx_init(struct ath9k_htc_priv *priv); |
544 | int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, | 544 | int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, |
545 | struct ieee80211_sta *sta, | ||
545 | struct sk_buff *skb, u8 slot, bool is_cab); | 546 | struct sk_buff *skb, u8 slot, bool is_cab); |
546 | void ath9k_tx_cleanup(struct ath9k_htc_priv *priv); | 547 | void ath9k_tx_cleanup(struct ath9k_htc_priv *priv); |
547 | bool ath9k_htc_txq_setup(struct ath9k_htc_priv *priv, int subtype); | 548 | bool ath9k_htc_txq_setup(struct ath9k_htc_priv *priv, int subtype); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c index 77d541feb910..f42d2eb6af99 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c | |||
@@ -326,7 +326,7 @@ static void ath9k_htc_send_buffered(struct ath9k_htc_priv *priv, | |||
326 | goto next; | 326 | goto next; |
327 | } | 327 | } |
328 | 328 | ||
329 | ret = ath9k_htc_tx_start(priv, skb, tx_slot, true); | 329 | ret = ath9k_htc_tx_start(priv, NULL, skb, tx_slot, true); |
330 | if (ret != 0) { | 330 | if (ret != 0) { |
331 | ath9k_htc_tx_clear_slot(priv, tx_slot); | 331 | ath9k_htc_tx_clear_slot(priv, tx_slot); |
332 | dev_kfree_skb_any(skb); | 332 | dev_kfree_skb_any(skb); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index c785129692ff..c32f6e3ffb18 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -856,7 +856,9 @@ set_timer: | |||
856 | /* mac80211 Callbacks */ | 856 | /* mac80211 Callbacks */ |
857 | /**********************/ | 857 | /**********************/ |
858 | 858 | ||
859 | static void ath9k_htc_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 859 | static void ath9k_htc_tx(struct ieee80211_hw *hw, |
860 | struct ieee80211_tx_control *control, | ||
861 | struct sk_buff *skb) | ||
860 | { | 862 | { |
861 | struct ieee80211_hdr *hdr; | 863 | struct ieee80211_hdr *hdr; |
862 | struct ath9k_htc_priv *priv = hw->priv; | 864 | struct ath9k_htc_priv *priv = hw->priv; |
@@ -883,7 +885,7 @@ static void ath9k_htc_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
883 | goto fail_tx; | 885 | goto fail_tx; |
884 | } | 886 | } |
885 | 887 | ||
886 | ret = ath9k_htc_tx_start(priv, skb, slot, false); | 888 | ret = ath9k_htc_tx_start(priv, control->sta, skb, slot, false); |
887 | if (ret != 0) { | 889 | if (ret != 0) { |
888 | ath_dbg(common, XMIT, "Tx failed\n"); | 890 | ath_dbg(common, XMIT, "Tx failed\n"); |
889 | goto clear_slot; | 891 | goto clear_slot; |
@@ -1331,6 +1333,34 @@ static int ath9k_htc_sta_remove(struct ieee80211_hw *hw, | |||
1331 | return ret; | 1333 | return ret; |
1332 | } | 1334 | } |
1333 | 1335 | ||
1336 | static void ath9k_htc_sta_rc_update(struct ieee80211_hw *hw, | ||
1337 | struct ieee80211_vif *vif, | ||
1338 | struct ieee80211_sta *sta, u32 changed) | ||
1339 | { | ||
1340 | struct ath9k_htc_priv *priv = hw->priv; | ||
1341 | struct ath_common *common = ath9k_hw_common(priv->ah); | ||
1342 | struct ath9k_htc_target_rate trate; | ||
1343 | |||
1344 | mutex_lock(&priv->mutex); | ||
1345 | ath9k_htc_ps_wakeup(priv); | ||
1346 | |||
1347 | if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) { | ||
1348 | memset(&trate, 0, sizeof(struct ath9k_htc_target_rate)); | ||
1349 | ath9k_htc_setup_rate(priv, sta, &trate); | ||
1350 | if (!ath9k_htc_send_rate_cmd(priv, &trate)) | ||
1351 | ath_dbg(common, CONFIG, | ||
1352 | "Supported rates for sta: %pM updated, rate caps: 0x%X\n", | ||
1353 | sta->addr, be32_to_cpu(trate.capflags)); | ||
1354 | else | ||
1355 | ath_dbg(common, CONFIG, | ||
1356 | "Unable to update supported rates for sta: %pM\n", | ||
1357 | sta->addr); | ||
1358 | } | ||
1359 | |||
1360 | ath9k_htc_ps_restore(priv); | ||
1361 | mutex_unlock(&priv->mutex); | ||
1362 | } | ||
1363 | |||
1334 | static int ath9k_htc_conf_tx(struct ieee80211_hw *hw, | 1364 | static int ath9k_htc_conf_tx(struct ieee80211_hw *hw, |
1335 | struct ieee80211_vif *vif, u16 queue, | 1365 | struct ieee80211_vif *vif, u16 queue, |
1336 | const struct ieee80211_tx_queue_params *params) | 1366 | const struct ieee80211_tx_queue_params *params) |
@@ -1758,6 +1788,7 @@ struct ieee80211_ops ath9k_htc_ops = { | |||
1758 | .sta_add = ath9k_htc_sta_add, | 1788 | .sta_add = ath9k_htc_sta_add, |
1759 | .sta_remove = ath9k_htc_sta_remove, | 1789 | .sta_remove = ath9k_htc_sta_remove, |
1760 | .conf_tx = ath9k_htc_conf_tx, | 1790 | .conf_tx = ath9k_htc_conf_tx, |
1791 | .sta_rc_update = ath9k_htc_sta_rc_update, | ||
1761 | .bss_info_changed = ath9k_htc_bss_info_changed, | 1792 | .bss_info_changed = ath9k_htc_bss_info_changed, |
1762 | .set_key = ath9k_htc_set_key, | 1793 | .set_key = ath9k_htc_set_key, |
1763 | .get_tsf = ath9k_htc_get_tsf, | 1794 | .get_tsf = ath9k_htc_get_tsf, |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index 47e61d0da33b..06cdcb772d78 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
@@ -333,12 +333,12 @@ static void ath9k_htc_tx_data(struct ath9k_htc_priv *priv, | |||
333 | } | 333 | } |
334 | 334 | ||
335 | int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, | 335 | int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, |
336 | struct ieee80211_sta *sta, | ||
336 | struct sk_buff *skb, | 337 | struct sk_buff *skb, |
337 | u8 slot, bool is_cab) | 338 | u8 slot, bool is_cab) |
338 | { | 339 | { |
339 | struct ieee80211_hdr *hdr; | 340 | struct ieee80211_hdr *hdr; |
340 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 341 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
341 | struct ieee80211_sta *sta = tx_info->control.sta; | ||
342 | struct ieee80211_vif *vif = tx_info->control.vif; | 342 | struct ieee80211_vif *vif = tx_info->control.vif; |
343 | struct ath9k_htc_sta *ista; | 343 | struct ath9k_htc_sta *ista; |
344 | struct ath9k_htc_vif *avp = NULL; | 344 | struct ath9k_htc_vif *avp = NULL; |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index a22df749b8db..8a2b04d5922f 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -696,7 +696,9 @@ mutex_unlock: | |||
696 | return r; | 696 | return r; |
697 | } | 697 | } |
698 | 698 | ||
699 | static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 699 | static void ath9k_tx(struct ieee80211_hw *hw, |
700 | struct ieee80211_tx_control *control, | ||
701 | struct sk_buff *skb) | ||
700 | { | 702 | { |
701 | struct ath_softc *sc = hw->priv; | 703 | struct ath_softc *sc = hw->priv; |
702 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 704 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
@@ -756,6 +758,7 @@ static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
756 | 758 | ||
757 | memset(&txctl, 0, sizeof(struct ath_tx_control)); | 759 | memset(&txctl, 0, sizeof(struct ath_tx_control)); |
758 | txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)]; | 760 | txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)]; |
761 | txctl.sta = control->sta; | ||
759 | 762 | ||
760 | ath_dbg(common, XMIT, "transmitting packet, skb: %p\n", skb); | 763 | ath_dbg(common, XMIT, "transmitting packet, skb: %p\n", skb); |
761 | 764 | ||
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 2c9da6b2ecb1..ef91f6cc2d79 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1773,11 +1773,12 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, | |||
1773 | TX_STAT_INC(txq->axq_qnum, queued); | 1773 | TX_STAT_INC(txq->axq_qnum, queued); |
1774 | } | 1774 | } |
1775 | 1775 | ||
1776 | static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb, | 1776 | static void setup_frame_info(struct ieee80211_hw *hw, |
1777 | struct ieee80211_sta *sta, | ||
1778 | struct sk_buff *skb, | ||
1777 | int framelen) | 1779 | int framelen) |
1778 | { | 1780 | { |
1779 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 1781 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
1780 | struct ieee80211_sta *sta = tx_info->control.sta; | ||
1781 | struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; | 1782 | struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; |
1782 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1783 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1783 | const struct ieee80211_rate *rate; | 1784 | const struct ieee80211_rate *rate; |
@@ -1935,7 +1936,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
1935 | { | 1936 | { |
1936 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 1937 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1937 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1938 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1938 | struct ieee80211_sta *sta = info->control.sta; | 1939 | struct ieee80211_sta *sta = txctl->sta; |
1939 | struct ieee80211_vif *vif = info->control.vif; | 1940 | struct ieee80211_vif *vif = info->control.vif; |
1940 | struct ath_softc *sc = hw->priv; | 1941 | struct ath_softc *sc = hw->priv; |
1941 | struct ath_txq *txq = txctl->txq; | 1942 | struct ath_txq *txq = txctl->txq; |
@@ -1979,7 +1980,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
1979 | !ieee80211_is_data(hdr->frame_control)) | 1980 | !ieee80211_is_data(hdr->frame_control)) |
1980 | info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; | 1981 | info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; |
1981 | 1982 | ||
1982 | setup_frame_info(hw, skb, frmlen); | 1983 | setup_frame_info(hw, sta, skb, frmlen); |
1983 | 1984 | ||
1984 | /* | 1985 | /* |
1985 | * At this point, the vif, hw_key and sta pointers in the tx control | 1986 | * At this point, the vif, hw_key and sta pointers in the tx control |
diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h index 376be11161c0..2aa4a59c72c8 100644 --- a/drivers/net/wireless/ath/carl9170/carl9170.h +++ b/drivers/net/wireless/ath/carl9170/carl9170.h | |||
@@ -425,6 +425,7 @@ struct ar9170 { | |||
425 | bool rx_has_plcp; | 425 | bool rx_has_plcp; |
426 | struct sk_buff *rx_failover; | 426 | struct sk_buff *rx_failover; |
427 | int rx_failover_missing; | 427 | int rx_failover_missing; |
428 | u32 ampdu_ref; | ||
428 | 429 | ||
429 | /* FIFO for collecting outstanding BlockAckRequest */ | 430 | /* FIFO for collecting outstanding BlockAckRequest */ |
430 | struct list_head bar_list[__AR9170_NUM_TXQ]; | 431 | struct list_head bar_list[__AR9170_NUM_TXQ]; |
@@ -577,7 +578,9 @@ void carl9170_rx(struct ar9170 *ar, void *buf, unsigned int len); | |||
577 | void carl9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len); | 578 | void carl9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len); |
578 | 579 | ||
579 | /* TX */ | 580 | /* TX */ |
580 | void carl9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb); | 581 | void carl9170_op_tx(struct ieee80211_hw *hw, |
582 | struct ieee80211_tx_control *control, | ||
583 | struct sk_buff *skb); | ||
581 | void carl9170_tx_janitor(struct work_struct *work); | 584 | void carl9170_tx_janitor(struct work_struct *work); |
582 | void carl9170_tx_process_status(struct ar9170 *ar, | 585 | void carl9170_tx_process_status(struct ar9170 *ar, |
583 | const struct carl9170_rsp *cmd); | 586 | const struct carl9170_rsp *cmd); |
diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c index b813f43061f5..a0b723078547 100644 --- a/drivers/net/wireless/ath/carl9170/rx.c +++ b/drivers/net/wireless/ath/carl9170/rx.c | |||
@@ -624,7 +624,8 @@ static void carl9170_ba_check(struct ar9170 *ar, void *data, unsigned int len) | |||
624 | #undef TID_CHECK | 624 | #undef TID_CHECK |
625 | } | 625 | } |
626 | 626 | ||
627 | static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms) | 627 | static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms, |
628 | struct ieee80211_rx_status *rx_status) | ||
628 | { | 629 | { |
629 | __le16 fc; | 630 | __le16 fc; |
630 | 631 | ||
@@ -637,6 +638,9 @@ static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms) | |||
637 | return true; | 638 | return true; |
638 | } | 639 | } |
639 | 640 | ||
641 | rx_status->flag |= RX_FLAG_AMPDU_DETAILS | RX_FLAG_AMPDU_LAST_KNOWN; | ||
642 | rx_status->ampdu_reference = ar->ampdu_ref; | ||
643 | |||
640 | /* | 644 | /* |
641 | * "802.11n - 7.4a.3 A-MPDU contents" describes in which contexts | 645 | * "802.11n - 7.4a.3 A-MPDU contents" describes in which contexts |
642 | * certain frame types can be part of an aMPDU. | 646 | * certain frame types can be part of an aMPDU. |
@@ -685,12 +689,15 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len) | |||
685 | if (unlikely(len < sizeof(*mac))) | 689 | if (unlikely(len < sizeof(*mac))) |
686 | goto drop; | 690 | goto drop; |
687 | 691 | ||
692 | memset(&status, 0, sizeof(status)); | ||
693 | |||
688 | mpdu_len = len - sizeof(*mac); | 694 | mpdu_len = len - sizeof(*mac); |
689 | 695 | ||
690 | mac = (void *)(buf + mpdu_len); | 696 | mac = (void *)(buf + mpdu_len); |
691 | mac_status = mac->status; | 697 | mac_status = mac->status; |
692 | switch (mac_status & AR9170_RX_STATUS_MPDU) { | 698 | switch (mac_status & AR9170_RX_STATUS_MPDU) { |
693 | case AR9170_RX_STATUS_MPDU_FIRST: | 699 | case AR9170_RX_STATUS_MPDU_FIRST: |
700 | ar->ampdu_ref++; | ||
694 | /* Aggregated MPDUs start with an PLCP header */ | 701 | /* Aggregated MPDUs start with an PLCP header */ |
695 | if (likely(mpdu_len >= sizeof(struct ar9170_rx_head))) { | 702 | if (likely(mpdu_len >= sizeof(struct ar9170_rx_head))) { |
696 | head = (void *) buf; | 703 | head = (void *) buf; |
@@ -721,12 +728,13 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len) | |||
721 | break; | 728 | break; |
722 | 729 | ||
723 | case AR9170_RX_STATUS_MPDU_LAST: | 730 | case AR9170_RX_STATUS_MPDU_LAST: |
731 | status.flag |= RX_FLAG_AMPDU_IS_LAST; | ||
732 | |||
724 | /* | 733 | /* |
725 | * The last frame of an A-MPDU has an extra tail | 734 | * The last frame of an A-MPDU has an extra tail |
726 | * which does contain the phy status of the whole | 735 | * which does contain the phy status of the whole |
727 | * aggregate. | 736 | * aggregate. |
728 | */ | 737 | */ |
729 | |||
730 | if (likely(mpdu_len >= sizeof(struct ar9170_rx_phystatus))) { | 738 | if (likely(mpdu_len >= sizeof(struct ar9170_rx_phystatus))) { |
731 | mpdu_len -= sizeof(struct ar9170_rx_phystatus); | 739 | mpdu_len -= sizeof(struct ar9170_rx_phystatus); |
732 | phy = (void *)(buf + mpdu_len); | 740 | phy = (void *)(buf + mpdu_len); |
@@ -774,11 +782,10 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len) | |||
774 | if (unlikely(mpdu_len < (2 + 2 + ETH_ALEN + FCS_LEN))) | 782 | if (unlikely(mpdu_len < (2 + 2 + ETH_ALEN + FCS_LEN))) |
775 | goto drop; | 783 | goto drop; |
776 | 784 | ||
777 | memset(&status, 0, sizeof(status)); | ||
778 | if (unlikely(carl9170_rx_mac_status(ar, head, mac, &status))) | 785 | if (unlikely(carl9170_rx_mac_status(ar, head, mac, &status))) |
779 | goto drop; | 786 | goto drop; |
780 | 787 | ||
781 | if (!carl9170_ampdu_check(ar, buf, mac_status)) | 788 | if (!carl9170_ampdu_check(ar, buf, mac_status, &status)) |
782 | goto drop; | 789 | goto drop; |
783 | 790 | ||
784 | if (phy) | 791 | if (phy) |
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c index 6a8681407a1d..84377cf580e0 100644 --- a/drivers/net/wireless/ath/carl9170/tx.c +++ b/drivers/net/wireless/ath/carl9170/tx.c | |||
@@ -867,14 +867,15 @@ static bool carl9170_tx_cts_check(struct ar9170 *ar, | |||
867 | return false; | 867 | return false; |
868 | } | 868 | } |
869 | 869 | ||
870 | static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb) | 870 | static int carl9170_tx_prepare(struct ar9170 *ar, |
871 | struct ieee80211_sta *sta, | ||
872 | struct sk_buff *skb) | ||
871 | { | 873 | { |
872 | struct ieee80211_hdr *hdr; | 874 | struct ieee80211_hdr *hdr; |
873 | struct _carl9170_tx_superframe *txc; | 875 | struct _carl9170_tx_superframe *txc; |
874 | struct carl9170_vif_info *cvif; | 876 | struct carl9170_vif_info *cvif; |
875 | struct ieee80211_tx_info *info; | 877 | struct ieee80211_tx_info *info; |
876 | struct ieee80211_tx_rate *txrate; | 878 | struct ieee80211_tx_rate *txrate; |
877 | struct ieee80211_sta *sta; | ||
878 | struct carl9170_tx_info *arinfo; | 879 | struct carl9170_tx_info *arinfo; |
879 | unsigned int hw_queue; | 880 | unsigned int hw_queue; |
880 | int i; | 881 | int i; |
@@ -910,8 +911,6 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb) | |||
910 | else | 911 | else |
911 | cvif = NULL; | 912 | cvif = NULL; |
912 | 913 | ||
913 | sta = info->control.sta; | ||
914 | |||
915 | txc = (void *)skb_push(skb, sizeof(*txc)); | 914 | txc = (void *)skb_push(skb, sizeof(*txc)); |
916 | memset(txc, 0, sizeof(*txc)); | 915 | memset(txc, 0, sizeof(*txc)); |
917 | 916 | ||
@@ -1457,20 +1456,21 @@ err_unlock_rcu: | |||
1457 | return false; | 1456 | return false; |
1458 | } | 1457 | } |
1459 | 1458 | ||
1460 | void carl9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 1459 | void carl9170_op_tx(struct ieee80211_hw *hw, |
1460 | struct ieee80211_tx_control *control, | ||
1461 | struct sk_buff *skb) | ||
1461 | { | 1462 | { |
1462 | struct ar9170 *ar = hw->priv; | 1463 | struct ar9170 *ar = hw->priv; |
1463 | struct ieee80211_tx_info *info; | 1464 | struct ieee80211_tx_info *info; |
1464 | struct ieee80211_sta *sta; | 1465 | struct ieee80211_sta *sta = control->sta; |
1465 | bool run; | 1466 | bool run; |
1466 | 1467 | ||
1467 | if (unlikely(!IS_STARTED(ar))) | 1468 | if (unlikely(!IS_STARTED(ar))) |
1468 | goto err_free; | 1469 | goto err_free; |
1469 | 1470 | ||
1470 | info = IEEE80211_SKB_CB(skb); | 1471 | info = IEEE80211_SKB_CB(skb); |
1471 | sta = info->control.sta; | ||
1472 | 1472 | ||
1473 | if (unlikely(carl9170_tx_prepare(ar, skb))) | 1473 | if (unlikely(carl9170_tx_prepare(ar, sta, skb))) |
1474 | goto err_free; | 1474 | goto err_free; |
1475 | 1475 | ||
1476 | carl9170_tx_accounting(ar, skb); | 1476 | carl9170_tx_accounting(ar, skb); |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index d97a95b1addb..73730e94e0ac 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -3412,7 +3412,8 @@ static void b43_tx_work(struct work_struct *work) | |||
3412 | } | 3412 | } |
3413 | 3413 | ||
3414 | static void b43_op_tx(struct ieee80211_hw *hw, | 3414 | static void b43_op_tx(struct ieee80211_hw *hw, |
3415 | struct sk_buff *skb) | 3415 | struct ieee80211_tx_control *control, |
3416 | struct sk_buff *skb) | ||
3416 | { | 3417 | { |
3417 | struct b43_wl *wl = hw_to_b43_wl(hw); | 3418 | struct b43_wl *wl = hw_to_b43_wl(hw); |
3418 | 3419 | ||
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 3ea1a85d38d1..291cdf654088 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -2492,6 +2492,7 @@ static void b43legacy_tx_work(struct work_struct *work) | |||
2492 | } | 2492 | } |
2493 | 2493 | ||
2494 | static void b43legacy_op_tx(struct ieee80211_hw *hw, | 2494 | static void b43legacy_op_tx(struct ieee80211_hw *hw, |
2495 | struct ieee80211_tx_control *control, | ||
2495 | struct sk_buff *skb) | 2496 | struct sk_buff *skb) |
2496 | { | 2497 | { |
2497 | struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); | 2498 | struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index 1c70defba6c3..513e172832e1 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | |||
@@ -267,7 +267,9 @@ static void brcms_set_basic_rate(struct brcm_rateset *rs, u16 rate, bool is_br) | |||
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | static void brcms_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 270 | static void brcms_ops_tx(struct ieee80211_hw *hw, |
271 | struct ieee80211_tx_control *control, | ||
272 | struct sk_buff *skb) | ||
271 | { | 273 | { |
272 | struct brcms_info *wl = hw->priv; | 274 | struct brcms_info *wl = hw->priv; |
273 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 275 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
@@ -279,7 +281,7 @@ static void brcms_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
279 | goto done; | 281 | goto done; |
280 | } | 282 | } |
281 | brcms_c_sendpkt_mac80211(wl->wlc, skb, hw); | 283 | brcms_c_sendpkt_mac80211(wl->wlc, skb, hw); |
282 | tx_info->rate_driver_data[0] = tx_info->control.sta; | 284 | tx_info->rate_driver_data[0] = control->sta; |
283 | done: | 285 | done: |
284 | spin_unlock_bh(&wl->lock); | 286 | spin_unlock_bh(&wl->lock); |
285 | } | 287 | } |
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c index faec40467208..e252acb9c862 100644 --- a/drivers/net/wireless/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/iwlegacy/3945-mac.c | |||
@@ -460,7 +460,9 @@ il3945_build_tx_cmd_basic(struct il_priv *il, struct il_device_cmd *cmd, | |||
460 | * start C_TX command process | 460 | * start C_TX command process |
461 | */ | 461 | */ |
462 | static int | 462 | static int |
463 | il3945_tx_skb(struct il_priv *il, struct sk_buff *skb) | 463 | il3945_tx_skb(struct il_priv *il, |
464 | struct ieee80211_sta *sta, | ||
465 | struct sk_buff *skb) | ||
464 | { | 466 | { |
465 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 467 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
466 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 468 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
@@ -512,7 +514,7 @@ il3945_tx_skb(struct il_priv *il, struct sk_buff *skb) | |||
512 | hdr_len = ieee80211_hdrlen(fc); | 514 | hdr_len = ieee80211_hdrlen(fc); |
513 | 515 | ||
514 | /* Find idx into station table for destination station */ | 516 | /* Find idx into station table for destination station */ |
515 | sta_id = il_sta_id_or_broadcast(il, info->control.sta); | 517 | sta_id = il_sta_id_or_broadcast(il, sta); |
516 | if (sta_id == IL_INVALID_STATION) { | 518 | if (sta_id == IL_INVALID_STATION) { |
517 | D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1); | 519 | D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1); |
518 | goto drop; | 520 | goto drop; |
@@ -2859,7 +2861,9 @@ il3945_mac_stop(struct ieee80211_hw *hw) | |||
2859 | } | 2861 | } |
2860 | 2862 | ||
2861 | static void | 2863 | static void |
2862 | il3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 2864 | il3945_mac_tx(struct ieee80211_hw *hw, |
2865 | struct ieee80211_tx_control *control, | ||
2866 | struct sk_buff *skb) | ||
2863 | { | 2867 | { |
2864 | struct il_priv *il = hw->priv; | 2868 | struct il_priv *il = hw->priv; |
2865 | 2869 | ||
@@ -2868,7 +2872,7 @@ il3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2868 | D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, | 2872 | D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, |
2869 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); | 2873 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); |
2870 | 2874 | ||
2871 | if (il3945_tx_skb(il, skb)) | 2875 | if (il3945_tx_skb(il, control->sta, skb)) |
2872 | dev_kfree_skb_any(skb); | 2876 | dev_kfree_skb_any(skb); |
2873 | 2877 | ||
2874 | D_MAC80211("leave\n"); | 2878 | D_MAC80211("leave\n"); |
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 34f61a0581a2..eac4dc8bc879 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -1526,8 +1526,11 @@ il4965_tx_cmd_build_basic(struct il_priv *il, struct sk_buff *skb, | |||
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | static void | 1528 | static void |
1529 | il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd, | 1529 | il4965_tx_cmd_build_rate(struct il_priv *il, |
1530 | struct ieee80211_tx_info *info, __le16 fc) | 1530 | struct il_tx_cmd *tx_cmd, |
1531 | struct ieee80211_tx_info *info, | ||
1532 | struct ieee80211_sta *sta, | ||
1533 | __le16 fc) | ||
1531 | { | 1534 | { |
1532 | const u8 rts_retry_limit = 60; | 1535 | const u8 rts_retry_limit = 60; |
1533 | u32 rate_flags; | 1536 | u32 rate_flags; |
@@ -1561,9 +1564,7 @@ il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd, | |||
1561 | rate_idx = info->control.rates[0].idx; | 1564 | rate_idx = info->control.rates[0].idx; |
1562 | if ((info->control.rates[0].flags & IEEE80211_TX_RC_MCS) || rate_idx < 0 | 1565 | if ((info->control.rates[0].flags & IEEE80211_TX_RC_MCS) || rate_idx < 0 |
1563 | || rate_idx > RATE_COUNT_LEGACY) | 1566 | || rate_idx > RATE_COUNT_LEGACY) |
1564 | rate_idx = | 1567 | rate_idx = rate_lowest_index(&il->bands[info->band], sta); |
1565 | rate_lowest_index(&il->bands[info->band], | ||
1566 | info->control.sta); | ||
1567 | /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ | 1568 | /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ |
1568 | if (info->band == IEEE80211_BAND_5GHZ) | 1569 | if (info->band == IEEE80211_BAND_5GHZ) |
1569 | rate_idx += IL_FIRST_OFDM_RATE; | 1570 | rate_idx += IL_FIRST_OFDM_RATE; |
@@ -1630,11 +1631,12 @@ il4965_tx_cmd_build_hwcrypto(struct il_priv *il, struct ieee80211_tx_info *info, | |||
1630 | * start C_TX command process | 1631 | * start C_TX command process |
1631 | */ | 1632 | */ |
1632 | int | 1633 | int |
1633 | il4965_tx_skb(struct il_priv *il, struct sk_buff *skb) | 1634 | il4965_tx_skb(struct il_priv *il, |
1635 | struct ieee80211_sta *sta, | ||
1636 | struct sk_buff *skb) | ||
1634 | { | 1637 | { |
1635 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1638 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1636 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1639 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1637 | struct ieee80211_sta *sta = info->control.sta; | ||
1638 | struct il_station_priv *sta_priv = NULL; | 1640 | struct il_station_priv *sta_priv = NULL; |
1639 | struct il_tx_queue *txq; | 1641 | struct il_tx_queue *txq; |
1640 | struct il_queue *q; | 1642 | struct il_queue *q; |
@@ -1680,7 +1682,7 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb) | |||
1680 | sta_id = il->hw_params.bcast_id; | 1682 | sta_id = il->hw_params.bcast_id; |
1681 | else { | 1683 | else { |
1682 | /* Find idx into station table for destination station */ | 1684 | /* Find idx into station table for destination station */ |
1683 | sta_id = il_sta_id_or_broadcast(il, info->control.sta); | 1685 | sta_id = il_sta_id_or_broadcast(il, sta); |
1684 | 1686 | ||
1685 | if (sta_id == IL_INVALID_STATION) { | 1687 | if (sta_id == IL_INVALID_STATION) { |
1686 | D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1); | 1688 | D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1); |
@@ -1786,7 +1788,7 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb) | |||
1786 | /* TODO need this for burst mode later on */ | 1788 | /* TODO need this for burst mode later on */ |
1787 | il4965_tx_cmd_build_basic(il, skb, tx_cmd, info, hdr, sta_id); | 1789 | il4965_tx_cmd_build_basic(il, skb, tx_cmd, info, hdr, sta_id); |
1788 | 1790 | ||
1789 | il4965_tx_cmd_build_rate(il, tx_cmd, info, fc); | 1791 | il4965_tx_cmd_build_rate(il, tx_cmd, info, sta, fc); |
1790 | 1792 | ||
1791 | il_update_stats(il, true, fc, len); | 1793 | il_update_stats(il, true, fc, len); |
1792 | /* | 1794 | /* |
@@ -5828,7 +5830,9 @@ il4965_mac_stop(struct ieee80211_hw *hw) | |||
5828 | } | 5830 | } |
5829 | 5831 | ||
5830 | void | 5832 | void |
5831 | il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 5833 | il4965_mac_tx(struct ieee80211_hw *hw, |
5834 | struct ieee80211_tx_control *control, | ||
5835 | struct sk_buff *skb) | ||
5832 | { | 5836 | { |
5833 | struct il_priv *il = hw->priv; | 5837 | struct il_priv *il = hw->priv; |
5834 | 5838 | ||
@@ -5837,7 +5841,7 @@ il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
5837 | D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, | 5841 | D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, |
5838 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); | 5842 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); |
5839 | 5843 | ||
5840 | if (il4965_tx_skb(il, skb)) | 5844 | if (il4965_tx_skb(il, control->sta, skb)) |
5841 | dev_kfree_skb_any(skb); | 5845 | dev_kfree_skb_any(skb); |
5842 | 5846 | ||
5843 | D_MACDUMP("leave\n"); | 5847 | D_MACDUMP("leave\n"); |
diff --git a/drivers/net/wireless/iwlegacy/4965.h b/drivers/net/wireless/iwlegacy/4965.h index 1db677689cfe..2d092f328547 100644 --- a/drivers/net/wireless/iwlegacy/4965.h +++ b/drivers/net/wireless/iwlegacy/4965.h | |||
@@ -78,7 +78,9 @@ int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il, struct il_tx_queue *txq, | |||
78 | int il4965_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq); | 78 | int il4965_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq); |
79 | void il4965_hwrate_to_tx_control(struct il_priv *il, u32 rate_n_flags, | 79 | void il4965_hwrate_to_tx_control(struct il_priv *il, u32 rate_n_flags, |
80 | struct ieee80211_tx_info *info); | 80 | struct ieee80211_tx_info *info); |
81 | int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb); | 81 | int il4965_tx_skb(struct il_priv *il, |
82 | struct ieee80211_sta *sta, | ||
83 | struct sk_buff *skb); | ||
82 | int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif, | 84 | int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif, |
83 | struct ieee80211_sta *sta, u16 tid, u16 * ssn); | 85 | struct ieee80211_sta *sta, u16 tid, u16 * ssn); |
84 | int il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif, | 86 | int il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif, |
@@ -163,7 +165,9 @@ void il4965_eeprom_release_semaphore(struct il_priv *il); | |||
163 | int il4965_eeprom_check_version(struct il_priv *il); | 165 | int il4965_eeprom_check_version(struct il_priv *il); |
164 | 166 | ||
165 | /* mac80211 handlers (for 4965) */ | 167 | /* mac80211 handlers (for 4965) */ |
166 | void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); | 168 | void il4965_mac_tx(struct ieee80211_hw *hw, |
169 | struct ieee80211_tx_control *control, | ||
170 | struct sk_buff *skb); | ||
167 | int il4965_mac_start(struct ieee80211_hw *hw); | 171 | int il4965_mac_start(struct ieee80211_hw *hw); |
168 | void il4965_mac_stop(struct ieee80211_hw *hw); | 172 | void il4965_mac_stop(struct ieee80211_hw *hw); |
169 | void il4965_configure_filter(struct ieee80211_hw *hw, | 173 | void il4965_configure_filter(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/iwlwifi/dvm/agn.h b/drivers/net/wireless/iwlwifi/dvm/agn.h index 9bb16bdf6d26..75e12f29d9eb 100644 --- a/drivers/net/wireless/iwlwifi/dvm/agn.h +++ b/drivers/net/wireless/iwlwifi/dvm/agn.h | |||
@@ -201,7 +201,9 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success); | |||
201 | 201 | ||
202 | 202 | ||
203 | /* tx */ | 203 | /* tx */ |
204 | int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); | 204 | int iwlagn_tx_skb(struct iwl_priv *priv, |
205 | struct ieee80211_sta *sta, | ||
206 | struct sk_buff *skb); | ||
205 | int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, | 207 | int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, |
206 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); | 208 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
207 | int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif, | 209 | int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif, |
@@ -485,16 +487,13 @@ static inline void iwl_dvm_set_pmi(struct iwl_priv *priv, bool state) | |||
485 | } | 487 | } |
486 | 488 | ||
487 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 489 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
488 | int iwl_dbgfs_register(struct iwl_priv *priv, const char *name); | 490 | int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir); |
489 | void iwl_dbgfs_unregister(struct iwl_priv *priv); | ||
490 | #else | 491 | #else |
491 | static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | 492 | static inline int iwl_dbgfs_register(struct iwl_priv *priv, |
493 | struct dentry *dbgfs_dir) | ||
492 | { | 494 | { |
493 | return 0; | 495 | return 0; |
494 | } | 496 | } |
495 | static inline void iwl_dbgfs_unregister(struct iwl_priv *priv) | ||
496 | { | ||
497 | } | ||
498 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ | 497 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ |
499 | 498 | ||
500 | #ifdef CONFIG_IWLWIFI_DEBUG | 499 | #ifdef CONFIG_IWLWIFI_DEBUG |
diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c index 46782f1102ac..ce826bc5f111 100644 --- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c | |||
@@ -2349,24 +2349,19 @@ DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled); | |||
2349 | * Create the debugfs files and directories | 2349 | * Create the debugfs files and directories |
2350 | * | 2350 | * |
2351 | */ | 2351 | */ |
2352 | int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | 2352 | int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir) |
2353 | { | 2353 | { |
2354 | struct dentry *phyd = priv->hw->wiphy->debugfsdir; | 2354 | struct dentry *dir_data, *dir_rf, *dir_debug; |
2355 | struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug; | ||
2356 | 2355 | ||
2357 | dir_drv = debugfs_create_dir(name, phyd); | 2356 | priv->debugfs_dir = dbgfs_dir; |
2358 | if (!dir_drv) | ||
2359 | return -ENOMEM; | ||
2360 | |||
2361 | priv->debugfs_dir = dir_drv; | ||
2362 | 2357 | ||
2363 | dir_data = debugfs_create_dir("data", dir_drv); | 2358 | dir_data = debugfs_create_dir("data", dbgfs_dir); |
2364 | if (!dir_data) | 2359 | if (!dir_data) |
2365 | goto err; | 2360 | goto err; |
2366 | dir_rf = debugfs_create_dir("rf", dir_drv); | 2361 | dir_rf = debugfs_create_dir("rf", dbgfs_dir); |
2367 | if (!dir_rf) | 2362 | if (!dir_rf) |
2368 | goto err; | 2363 | goto err; |
2369 | dir_debug = debugfs_create_dir("debug", dir_drv); | 2364 | dir_debug = debugfs_create_dir("debug", dbgfs_dir); |
2370 | if (!dir_debug) | 2365 | if (!dir_debug) |
2371 | goto err; | 2366 | goto err; |
2372 | 2367 | ||
@@ -2412,25 +2407,30 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
2412 | /* Calibrations disabled/enabled status*/ | 2407 | /* Calibrations disabled/enabled status*/ |
2413 | DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IWUSR | S_IRUSR); | 2408 | DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IWUSR | S_IRUSR); |
2414 | 2409 | ||
2415 | if (iwl_trans_dbgfs_register(priv->trans, dir_debug)) | 2410 | /* |
2416 | goto err; | 2411 | * Create a symlink with mac80211. This is not very robust, as it does |
2412 | * not remove the symlink created. The implicit assumption is that | ||
2413 | * when the opmode exits, mac80211 will also exit, and will remove | ||
2414 | * this symlink as part of its cleanup. | ||
2415 | */ | ||
2416 | if (priv->mac80211_registered) { | ||
2417 | char buf[100]; | ||
2418 | struct dentry *mac80211_dir, *dev_dir, *root_dir; | ||
2419 | |||
2420 | dev_dir = dbgfs_dir->d_parent; | ||
2421 | root_dir = dev_dir->d_parent; | ||
2422 | mac80211_dir = priv->hw->wiphy->debugfsdir; | ||
2423 | |||
2424 | snprintf(buf, 100, "../../%s/%s", root_dir->d_name.name, | ||
2425 | dev_dir->d_name.name); | ||
2426 | |||
2427 | if (!debugfs_create_symlink("iwlwifi", mac80211_dir, buf)) | ||
2428 | goto err; | ||
2429 | } | ||
2430 | |||
2417 | return 0; | 2431 | return 0; |
2418 | 2432 | ||
2419 | err: | 2433 | err: |
2420 | IWL_ERR(priv, "Can't create the debugfs directory\n"); | 2434 | IWL_ERR(priv, "failed to create the dvm debugfs entries\n"); |
2421 | iwl_dbgfs_unregister(priv); | ||
2422 | return -ENOMEM; | 2435 | return -ENOMEM; |
2423 | } | 2436 | } |
2424 | |||
2425 | /** | ||
2426 | * Remove the debugfs files and directories | ||
2427 | * | ||
2428 | */ | ||
2429 | void iwl_dbgfs_unregister(struct iwl_priv *priv) | ||
2430 | { | ||
2431 | if (!priv->debugfs_dir) | ||
2432 | return; | ||
2433 | |||
2434 | debugfs_remove_recursive(priv->debugfs_dir); | ||
2435 | priv->debugfs_dir = NULL; | ||
2436 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c index a5f7bce96325..ff8162d4c454 100644 --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c | |||
@@ -195,7 +195,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
195 | ARRAY_SIZE(iwlagn_iface_combinations_dualmode); | 195 | ARRAY_SIZE(iwlagn_iface_combinations_dualmode); |
196 | } | 196 | } |
197 | 197 | ||
198 | hw->wiphy->max_remain_on_channel_duration = 1000; | 198 | hw->wiphy->max_remain_on_channel_duration = 500; |
199 | 199 | ||
200 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | | 200 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | |
201 | WIPHY_FLAG_DISABLE_BEACON_HINTS | | 201 | WIPHY_FLAG_DISABLE_BEACON_HINTS | |
@@ -511,14 +511,16 @@ static void iwlagn_mac_set_wakeup(struct ieee80211_hw *hw, bool enabled) | |||
511 | } | 511 | } |
512 | #endif | 512 | #endif |
513 | 513 | ||
514 | static void iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 514 | static void iwlagn_mac_tx(struct ieee80211_hw *hw, |
515 | struct ieee80211_tx_control *control, | ||
516 | struct sk_buff *skb) | ||
515 | { | 517 | { |
516 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); | 518 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); |
517 | 519 | ||
518 | IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, | 520 | IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, |
519 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); | 521 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); |
520 | 522 | ||
521 | if (iwlagn_tx_skb(priv, skb)) | 523 | if (iwlagn_tx_skb(priv, control->sta, skb)) |
522 | dev_kfree_skb_any(skb); | 524 | dev_kfree_skb_any(skb); |
523 | } | 525 | } |
524 | 526 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c index 84d3db5aa506..7ff3f1430678 100644 --- a/drivers/net/wireless/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/iwlwifi/dvm/main.c | |||
@@ -862,7 +862,8 @@ void iwl_down(struct iwl_priv *priv) | |||
862 | * No race since we hold the mutex here and a new one | 862 | * No race since we hold the mutex here and a new one |
863 | * can't come in at this time. | 863 | * can't come in at this time. |
864 | */ | 864 | */ |
865 | ieee80211_remain_on_channel_expired(priv->hw); | 865 | if (priv->ucode_loaded && priv->cur_ucode != IWL_UCODE_INIT) |
866 | ieee80211_remain_on_channel_expired(priv->hw); | ||
866 | 867 | ||
867 | exit_pending = | 868 | exit_pending = |
868 | test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); | 869 | test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); |
@@ -994,7 +995,11 @@ static void iwl_bg_restart(struct work_struct *data) | |||
994 | iwlagn_prepare_restart(priv); | 995 | iwlagn_prepare_restart(priv); |
995 | mutex_unlock(&priv->mutex); | 996 | mutex_unlock(&priv->mutex); |
996 | iwl_cancel_deferred_work(priv); | 997 | iwl_cancel_deferred_work(priv); |
997 | ieee80211_restart_hw(priv->hw); | 998 | if (priv->mac80211_registered) |
999 | ieee80211_restart_hw(priv->hw); | ||
1000 | else | ||
1001 | IWL_ERR(priv, | ||
1002 | "Cannot request restart before registrating with mac80211"); | ||
998 | } else { | 1003 | } else { |
999 | WARN_ON(1); | 1004 | WARN_ON(1); |
1000 | } | 1005 | } |
@@ -1222,7 +1227,8 @@ static int iwl_eeprom_init_hw_params(struct iwl_priv *priv) | |||
1222 | 1227 | ||
1223 | static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | 1228 | static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, |
1224 | const struct iwl_cfg *cfg, | 1229 | const struct iwl_cfg *cfg, |
1225 | const struct iwl_fw *fw) | 1230 | const struct iwl_fw *fw, |
1231 | struct dentry *dbgfs_dir) | ||
1226 | { | 1232 | { |
1227 | struct iwl_priv *priv; | 1233 | struct iwl_priv *priv; |
1228 | struct ieee80211_hw *hw; | 1234 | struct ieee80211_hw *hw; |
@@ -1466,13 +1472,17 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1466 | if (iwlagn_mac_setup_register(priv, &fw->ucode_capa)) | 1472 | if (iwlagn_mac_setup_register(priv, &fw->ucode_capa)) |
1467 | goto out_destroy_workqueue; | 1473 | goto out_destroy_workqueue; |
1468 | 1474 | ||
1469 | if (iwl_dbgfs_register(priv, DRV_NAME)) | 1475 | if (iwl_dbgfs_register(priv, dbgfs_dir)) |
1470 | IWL_ERR(priv, | 1476 | goto out_mac80211_unregister; |
1471 | "failed to create debugfs files. Ignoring error\n"); | ||
1472 | 1477 | ||
1473 | return op_mode; | 1478 | return op_mode; |
1474 | 1479 | ||
1480 | out_mac80211_unregister: | ||
1481 | iwlagn_mac_unregister(priv); | ||
1475 | out_destroy_workqueue: | 1482 | out_destroy_workqueue: |
1483 | iwl_tt_exit(priv); | ||
1484 | iwl_testmode_free(priv); | ||
1485 | iwl_cancel_deferred_work(priv); | ||
1476 | destroy_workqueue(priv->workqueue); | 1486 | destroy_workqueue(priv->workqueue); |
1477 | priv->workqueue = NULL; | 1487 | priv->workqueue = NULL; |
1478 | iwl_uninit_drv(priv); | 1488 | iwl_uninit_drv(priv); |
@@ -1493,8 +1503,6 @@ static void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode) | |||
1493 | 1503 | ||
1494 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); | 1504 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); |
1495 | 1505 | ||
1496 | iwl_dbgfs_unregister(priv); | ||
1497 | |||
1498 | iwl_testmode_free(priv); | 1506 | iwl_testmode_free(priv); |
1499 | iwlagn_mac_unregister(priv); | 1507 | iwlagn_mac_unregister(priv); |
1500 | 1508 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c index b29b798f7550..fe36a38f3505 100644 --- a/drivers/net/wireless/iwlwifi/dvm/sta.c +++ b/drivers/net/wireless/iwlwifi/dvm/sta.c | |||
@@ -150,7 +150,7 @@ int iwl_send_add_sta(struct iwl_priv *priv, | |||
150 | sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); | 150 | sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); |
151 | 151 | ||
152 | if (!(flags & CMD_ASYNC)) { | 152 | if (!(flags & CMD_ASYNC)) { |
153 | cmd.flags |= CMD_WANT_SKB; | 153 | cmd.flags |= CMD_WANT_SKB | CMD_WANT_HCMD; |
154 | might_sleep(); | 154 | might_sleep(); |
155 | } | 155 | } |
156 | 156 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c index 5971a23aa47d..f5ca73a89870 100644 --- a/drivers/net/wireless/iwlwifi/dvm/tx.c +++ b/drivers/net/wireless/iwlwifi/dvm/tx.c | |||
@@ -127,6 +127,7 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv, | |||
127 | static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv, | 127 | static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv, |
128 | struct iwl_tx_cmd *tx_cmd, | 128 | struct iwl_tx_cmd *tx_cmd, |
129 | struct ieee80211_tx_info *info, | 129 | struct ieee80211_tx_info *info, |
130 | struct ieee80211_sta *sta, | ||
130 | __le16 fc) | 131 | __le16 fc) |
131 | { | 132 | { |
132 | u32 rate_flags; | 133 | u32 rate_flags; |
@@ -187,8 +188,7 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv, | |||
187 | if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS || | 188 | if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS || |
188 | (rate_idx < 0) || (rate_idx > IWL_RATE_COUNT_LEGACY)) | 189 | (rate_idx < 0) || (rate_idx > IWL_RATE_COUNT_LEGACY)) |
189 | rate_idx = rate_lowest_index( | 190 | rate_idx = rate_lowest_index( |
190 | &priv->eeprom_data->bands[info->band], | 191 | &priv->eeprom_data->bands[info->band], sta); |
191 | info->control.sta); | ||
192 | /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ | 192 | /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ |
193 | if (info->band == IEEE80211_BAND_5GHZ) | 193 | if (info->band == IEEE80211_BAND_5GHZ) |
194 | rate_idx += IWL_FIRST_OFDM_RATE; | 194 | rate_idx += IWL_FIRST_OFDM_RATE; |
@@ -291,7 +291,9 @@ static int iwl_sta_id_or_broadcast(struct iwl_rxon_context *context, | |||
291 | /* | 291 | /* |
292 | * start REPLY_TX command process | 292 | * start REPLY_TX command process |
293 | */ | 293 | */ |
294 | int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | 294 | int iwlagn_tx_skb(struct iwl_priv *priv, |
295 | struct ieee80211_sta *sta, | ||
296 | struct sk_buff *skb) | ||
295 | { | 297 | { |
296 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 298 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
297 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 299 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
@@ -345,7 +347,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
345 | sta_id = ctx->bcast_sta_id; | 347 | sta_id = ctx->bcast_sta_id; |
346 | else { | 348 | else { |
347 | /* Find index into station table for destination station */ | 349 | /* Find index into station table for destination station */ |
348 | sta_id = iwl_sta_id_or_broadcast(ctx, info->control.sta); | 350 | sta_id = iwl_sta_id_or_broadcast(ctx, sta); |
349 | if (sta_id == IWL_INVALID_STATION) { | 351 | if (sta_id == IWL_INVALID_STATION) { |
350 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 352 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", |
351 | hdr->addr1); | 353 | hdr->addr1); |
@@ -355,8 +357,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
355 | 357 | ||
356 | IWL_DEBUG_TX(priv, "station Id %d\n", sta_id); | 358 | IWL_DEBUG_TX(priv, "station Id %d\n", sta_id); |
357 | 359 | ||
358 | if (info->control.sta) | 360 | if (sta) |
359 | sta_priv = (void *)info->control.sta->drv_priv; | 361 | sta_priv = (void *)sta->drv_priv; |
360 | 362 | ||
361 | if (sta_priv && sta_priv->asleep && | 363 | if (sta_priv && sta_priv->asleep && |
362 | (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) { | 364 | (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) { |
@@ -397,7 +399,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
397 | /* TODO need this for burst mode later on */ | 399 | /* TODO need this for burst mode later on */ |
398 | iwlagn_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); | 400 | iwlagn_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); |
399 | 401 | ||
400 | iwlagn_tx_cmd_build_rate(priv, tx_cmd, info, fc); | 402 | iwlagn_tx_cmd_build_rate(priv, tx_cmd, info, sta, fc); |
401 | 403 | ||
402 | memset(&info->status, 0, sizeof(info->status)); | 404 | memset(&info->status, 0, sizeof(info->status)); |
403 | 405 | ||
@@ -431,7 +433,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
431 | * only. Check this here. | 433 | * only. Check this here. |
432 | */ | 434 | */ |
433 | if (WARN_ONCE(tid_data->agg.state != IWL_AGG_ON && | 435 | if (WARN_ONCE(tid_data->agg.state != IWL_AGG_ON && |
434 | tid_data->agg.state != IWL_AGG_OFF, | 436 | tid_data->agg.state != IWL_AGG_OFF, |
435 | "Tx while agg.state = %d", tid_data->agg.state)) | 437 | "Tx while agg.state = %d", tid_data->agg.state)) |
436 | goto drop_unlock_sta; | 438 | goto drop_unlock_sta; |
437 | 439 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c index cc41cfaedfbd..48d6d44c16d0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/iwlwifi/iwl-drv.c | |||
@@ -101,6 +101,10 @@ MODULE_VERSION(DRV_VERSION); | |||
101 | MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); | 101 | MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); |
102 | MODULE_LICENSE("GPL"); | 102 | MODULE_LICENSE("GPL"); |
103 | 103 | ||
104 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
105 | static struct dentry *iwl_dbgfs_root; | ||
106 | #endif | ||
107 | |||
104 | /** | 108 | /** |
105 | * struct iwl_drv - drv common data | 109 | * struct iwl_drv - drv common data |
106 | * @list: list of drv structures using this opmode | 110 | * @list: list of drv structures using this opmode |
@@ -126,6 +130,12 @@ struct iwl_drv { | |||
126 | char firmware_name[25]; /* name of firmware file to load */ | 130 | char firmware_name[25]; /* name of firmware file to load */ |
127 | 131 | ||
128 | struct completion request_firmware_complete; | 132 | struct completion request_firmware_complete; |
133 | |||
134 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
135 | struct dentry *dbgfs_drv; | ||
136 | struct dentry *dbgfs_trans; | ||
137 | struct dentry *dbgfs_op_mode; | ||
138 | #endif | ||
129 | }; | 139 | }; |
130 | 140 | ||
131 | #define DVM_OP_MODE 0 | 141 | #define DVM_OP_MODE 0 |
@@ -194,7 +204,8 @@ static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc, | |||
194 | return 0; | 204 | return 0; |
195 | } | 205 | } |
196 | 206 | ||
197 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); | 207 | static void iwl_req_fw_callback(const struct firmware *ucode_raw, |
208 | void *context); | ||
198 | 209 | ||
199 | #define UCODE_EXPERIMENTAL_INDEX 100 | 210 | #define UCODE_EXPERIMENTAL_INDEX 100 |
200 | #define UCODE_EXPERIMENTAL_TAG "exp" | 211 | #define UCODE_EXPERIMENTAL_TAG "exp" |
@@ -231,7 +242,7 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) | |||
231 | 242 | ||
232 | return request_firmware_nowait(THIS_MODULE, 1, drv->firmware_name, | 243 | return request_firmware_nowait(THIS_MODULE, 1, drv->firmware_name, |
233 | drv->trans->dev, | 244 | drv->trans->dev, |
234 | GFP_KERNEL, drv, iwl_ucode_callback); | 245 | GFP_KERNEL, drv, iwl_req_fw_callback); |
235 | } | 246 | } |
236 | 247 | ||
237 | struct fw_img_parsing { | 248 | struct fw_img_parsing { |
@@ -759,13 +770,57 @@ static int validate_sec_sizes(struct iwl_drv *drv, | |||
759 | return 0; | 770 | return 0; |
760 | } | 771 | } |
761 | 772 | ||
773 | static struct iwl_op_mode * | ||
774 | _iwl_op_mode_start(struct iwl_drv *drv, struct iwlwifi_opmode_table *op) | ||
775 | { | ||
776 | const struct iwl_op_mode_ops *ops = op->ops; | ||
777 | struct dentry *dbgfs_dir = NULL; | ||
778 | struct iwl_op_mode *op_mode = NULL; | ||
779 | |||
780 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
781 | drv->dbgfs_op_mode = debugfs_create_dir(op->name, | ||
782 | drv->dbgfs_drv); | ||
783 | if (!drv->dbgfs_op_mode) { | ||
784 | IWL_ERR(drv, | ||
785 | "failed to create opmode debugfs directory\n"); | ||
786 | return op_mode; | ||
787 | } | ||
788 | dbgfs_dir = drv->dbgfs_op_mode; | ||
789 | #endif | ||
790 | |||
791 | op_mode = ops->start(drv->trans, drv->cfg, &drv->fw, dbgfs_dir); | ||
792 | |||
793 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
794 | if (!op_mode) { | ||
795 | debugfs_remove_recursive(drv->dbgfs_op_mode); | ||
796 | drv->dbgfs_op_mode = NULL; | ||
797 | } | ||
798 | #endif | ||
799 | |||
800 | return op_mode; | ||
801 | } | ||
802 | |||
803 | static void _iwl_op_mode_stop(struct iwl_drv *drv) | ||
804 | { | ||
805 | /* op_mode can be NULL if its start failed */ | ||
806 | if (drv->op_mode) { | ||
807 | iwl_op_mode_stop(drv->op_mode); | ||
808 | drv->op_mode = NULL; | ||
809 | |||
810 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
811 | debugfs_remove_recursive(drv->dbgfs_op_mode); | ||
812 | drv->dbgfs_op_mode = NULL; | ||
813 | #endif | ||
814 | } | ||
815 | } | ||
816 | |||
762 | /** | 817 | /** |
763 | * iwl_ucode_callback - callback when firmware was loaded | 818 | * iwl_req_fw_callback - callback when firmware was loaded |
764 | * | 819 | * |
765 | * If loaded successfully, copies the firmware into buffers | 820 | * If loaded successfully, copies the firmware into buffers |
766 | * for the card to fetch (via DMA). | 821 | * for the card to fetch (via DMA). |
767 | */ | 822 | */ |
768 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | 823 | static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
769 | { | 824 | { |
770 | struct iwl_drv *drv = context; | 825 | struct iwl_drv *drv = context; |
771 | struct iwl_fw *fw = &drv->fw; | 826 | struct iwl_fw *fw = &drv->fw; |
@@ -908,8 +963,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
908 | list_add_tail(&drv->list, &op->drv); | 963 | list_add_tail(&drv->list, &op->drv); |
909 | 964 | ||
910 | if (op->ops) { | 965 | if (op->ops) { |
911 | const struct iwl_op_mode_ops *ops = op->ops; | 966 | drv->op_mode = _iwl_op_mode_start(drv, op); |
912 | drv->op_mode = ops->start(drv->trans, drv->cfg, &drv->fw); | ||
913 | 967 | ||
914 | if (!drv->op_mode) { | 968 | if (!drv->op_mode) { |
915 | mutex_unlock(&iwlwifi_opmode_table_mtx); | 969 | mutex_unlock(&iwlwifi_opmode_table_mtx); |
@@ -969,24 +1023,51 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans, | |||
969 | init_completion(&drv->request_firmware_complete); | 1023 | init_completion(&drv->request_firmware_complete); |
970 | INIT_LIST_HEAD(&drv->list); | 1024 | INIT_LIST_HEAD(&drv->list); |
971 | 1025 | ||
1026 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
1027 | /* Create the device debugfs entries. */ | ||
1028 | drv->dbgfs_drv = debugfs_create_dir(dev_name(trans->dev), | ||
1029 | iwl_dbgfs_root); | ||
1030 | |||
1031 | if (!drv->dbgfs_drv) { | ||
1032 | IWL_ERR(drv, "failed to create debugfs directory\n"); | ||
1033 | goto err_free_drv; | ||
1034 | } | ||
1035 | |||
1036 | /* Create transport layer debugfs dir */ | ||
1037 | drv->trans->dbgfs_dir = debugfs_create_dir("trans", drv->dbgfs_drv); | ||
1038 | |||
1039 | if (!drv->trans->dbgfs_dir) { | ||
1040 | IWL_ERR(drv, "failed to create transport debugfs directory\n"); | ||
1041 | goto err_free_dbgfs; | ||
1042 | } | ||
1043 | #endif | ||
1044 | |||
972 | ret = iwl_request_firmware(drv, true); | 1045 | ret = iwl_request_firmware(drv, true); |
973 | 1046 | ||
974 | if (ret) { | 1047 | if (ret) { |
975 | IWL_ERR(trans, "Couldn't request the fw\n"); | 1048 | IWL_ERR(trans, "Couldn't request the fw\n"); |
976 | kfree(drv); | 1049 | goto err_fw; |
977 | drv = NULL; | ||
978 | } | 1050 | } |
979 | 1051 | ||
980 | return drv; | 1052 | return drv; |
1053 | |||
1054 | err_fw: | ||
1055 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
1056 | err_free_dbgfs: | ||
1057 | debugfs_remove_recursive(drv->dbgfs_drv); | ||
1058 | err_free_drv: | ||
1059 | #endif | ||
1060 | kfree(drv); | ||
1061 | drv = NULL; | ||
1062 | |||
1063 | return drv; | ||
981 | } | 1064 | } |
982 | 1065 | ||
983 | void iwl_drv_stop(struct iwl_drv *drv) | 1066 | void iwl_drv_stop(struct iwl_drv *drv) |
984 | { | 1067 | { |
985 | wait_for_completion(&drv->request_firmware_complete); | 1068 | wait_for_completion(&drv->request_firmware_complete); |
986 | 1069 | ||
987 | /* op_mode can be NULL if its start failed */ | 1070 | _iwl_op_mode_stop(drv); |
988 | if (drv->op_mode) | ||
989 | iwl_op_mode_stop(drv->op_mode); | ||
990 | 1071 | ||
991 | iwl_dealloc_ucode(drv); | 1072 | iwl_dealloc_ucode(drv); |
992 | 1073 | ||
@@ -1000,6 +1081,10 @@ void iwl_drv_stop(struct iwl_drv *drv) | |||
1000 | list_del(&drv->list); | 1081 | list_del(&drv->list); |
1001 | mutex_unlock(&iwlwifi_opmode_table_mtx); | 1082 | mutex_unlock(&iwlwifi_opmode_table_mtx); |
1002 | 1083 | ||
1084 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
1085 | debugfs_remove_recursive(drv->dbgfs_drv); | ||
1086 | #endif | ||
1087 | |||
1003 | kfree(drv); | 1088 | kfree(drv); |
1004 | } | 1089 | } |
1005 | 1090 | ||
@@ -1022,15 +1107,18 @@ int iwl_opmode_register(const char *name, const struct iwl_op_mode_ops *ops) | |||
1022 | { | 1107 | { |
1023 | int i; | 1108 | int i; |
1024 | struct iwl_drv *drv; | 1109 | struct iwl_drv *drv; |
1110 | struct iwlwifi_opmode_table *op; | ||
1025 | 1111 | ||
1026 | mutex_lock(&iwlwifi_opmode_table_mtx); | 1112 | mutex_lock(&iwlwifi_opmode_table_mtx); |
1027 | for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) { | 1113 | for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) { |
1028 | if (strcmp(iwlwifi_opmode_table[i].name, name)) | 1114 | op = &iwlwifi_opmode_table[i]; |
1115 | if (strcmp(op->name, name)) | ||
1029 | continue; | 1116 | continue; |
1030 | iwlwifi_opmode_table[i].ops = ops; | 1117 | op->ops = ops; |
1031 | list_for_each_entry(drv, &iwlwifi_opmode_table[i].drv, list) | 1118 | /* TODO: need to handle exceptional case */ |
1032 | drv->op_mode = ops->start(drv->trans, drv->cfg, | 1119 | list_for_each_entry(drv, &op->drv, list) |
1033 | &drv->fw); | 1120 | drv->op_mode = _iwl_op_mode_start(drv, op); |
1121 | |||
1034 | mutex_unlock(&iwlwifi_opmode_table_mtx); | 1122 | mutex_unlock(&iwlwifi_opmode_table_mtx); |
1035 | return 0; | 1123 | return 0; |
1036 | } | 1124 | } |
@@ -1051,12 +1139,9 @@ void iwl_opmode_deregister(const char *name) | |||
1051 | iwlwifi_opmode_table[i].ops = NULL; | 1139 | iwlwifi_opmode_table[i].ops = NULL; |
1052 | 1140 | ||
1053 | /* call the stop routine for all devices */ | 1141 | /* call the stop routine for all devices */ |
1054 | list_for_each_entry(drv, &iwlwifi_opmode_table[i].drv, list) { | 1142 | list_for_each_entry(drv, &iwlwifi_opmode_table[i].drv, list) |
1055 | if (drv->op_mode) { | 1143 | _iwl_op_mode_stop(drv); |
1056 | iwl_op_mode_stop(drv->op_mode); | 1144 | |
1057 | drv->op_mode = NULL; | ||
1058 | } | ||
1059 | } | ||
1060 | mutex_unlock(&iwlwifi_opmode_table_mtx); | 1145 | mutex_unlock(&iwlwifi_opmode_table_mtx); |
1061 | return; | 1146 | return; |
1062 | } | 1147 | } |
@@ -1076,6 +1161,14 @@ static int __init iwl_drv_init(void) | |||
1076 | pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); | 1161 | pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); |
1077 | pr_info(DRV_COPYRIGHT "\n"); | 1162 | pr_info(DRV_COPYRIGHT "\n"); |
1078 | 1163 | ||
1164 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
1165 | /* Create the root of iwlwifi debugfs subsystem. */ | ||
1166 | iwl_dbgfs_root = debugfs_create_dir(DRV_NAME, NULL); | ||
1167 | |||
1168 | if (!iwl_dbgfs_root) | ||
1169 | return -EFAULT; | ||
1170 | #endif | ||
1171 | |||
1079 | return iwl_pci_register_driver(); | 1172 | return iwl_pci_register_driver(); |
1080 | } | 1173 | } |
1081 | module_init(iwl_drv_init); | 1174 | module_init(iwl_drv_init); |
@@ -1083,6 +1176,10 @@ module_init(iwl_drv_init); | |||
1083 | static void __exit iwl_drv_exit(void) | 1176 | static void __exit iwl_drv_exit(void) |
1084 | { | 1177 | { |
1085 | iwl_pci_unregister_driver(); | 1178 | iwl_pci_unregister_driver(); |
1179 | |||
1180 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
1181 | debugfs_remove_recursive(iwl_dbgfs_root); | ||
1182 | #endif | ||
1086 | } | 1183 | } |
1087 | module_exit(iwl_drv_exit); | 1184 | module_exit(iwl_drv_exit); |
1088 | 1185 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.h b/drivers/net/wireless/iwlwifi/iwl-drv.h index 2cbf137b25bf..285de5f68c05 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.h +++ b/drivers/net/wireless/iwlwifi/iwl-drv.h | |||
@@ -90,9 +90,9 @@ | |||
90 | * 4) The bus specific component configures the bus | 90 | * 4) The bus specific component configures the bus |
91 | * 5) The bus specific component calls to the drv bus agnostic part | 91 | * 5) The bus specific component calls to the drv bus agnostic part |
92 | * (iwl_drv_start) | 92 | * (iwl_drv_start) |
93 | * 6) iwl_drv_start fetches the fw ASYNC, iwl_ucode_callback | 93 | * 6) iwl_drv_start fetches the fw ASYNC, iwl_req_fw_callback |
94 | * 7) iwl_ucode_callback parses the fw file | 94 | * 7) iwl_req_fw_callback parses the fw file |
95 | * 8) iwl_ucode_callback starts the wifi implementation to matches the fw | 95 | * 8) iwl_req_fw_callback starts the wifi implementation to matches the fw |
96 | */ | 96 | */ |
97 | 97 | ||
98 | struct iwl_drv; | 98 | struct iwl_drv; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/iwlwifi/iwl-op-mode.h index 64886f95664f..c8d9b9517468 100644 --- a/drivers/net/wireless/iwlwifi/iwl-op-mode.h +++ b/drivers/net/wireless/iwlwifi/iwl-op-mode.h | |||
@@ -134,7 +134,8 @@ struct iwl_cfg; | |||
134 | struct iwl_op_mode_ops { | 134 | struct iwl_op_mode_ops { |
135 | struct iwl_op_mode *(*start)(struct iwl_trans *trans, | 135 | struct iwl_op_mode *(*start)(struct iwl_trans *trans, |
136 | const struct iwl_cfg *cfg, | 136 | const struct iwl_cfg *cfg, |
137 | const struct iwl_fw *fw); | 137 | const struct iwl_fw *fw, |
138 | struct dentry *dbgfs_dir); | ||
138 | void (*stop)(struct iwl_op_mode *op_mode); | 139 | void (*stop)(struct iwl_op_mode *op_mode); |
139 | int (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, | 140 | int (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, |
140 | struct iwl_device_cmd *cmd); | 141 | struct iwl_device_cmd *cmd); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 92576a3e84ef..ff1154232885 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -184,14 +184,20 @@ struct iwl_rx_packet { | |||
184 | * @CMD_SYNC: The caller will be stalled until the fw responds to the command | 184 | * @CMD_SYNC: The caller will be stalled until the fw responds to the command |
185 | * @CMD_ASYNC: Return right away and don't want for the response | 185 | * @CMD_ASYNC: Return right away and don't want for the response |
186 | * @CMD_WANT_SKB: valid only with CMD_SYNC. The caller needs the buffer of the | 186 | * @CMD_WANT_SKB: valid only with CMD_SYNC. The caller needs the buffer of the |
187 | * response. | 187 | * response. The caller needs to call iwl_free_resp when done. |
188 | * @CMD_WANT_HCMD: The caller needs to get the HCMD that was sent in the | ||
189 | * response handler. Chunks flagged by %IWL_HCMD_DFL_NOCOPY won't be | ||
190 | * copied. The pointer passed to the response handler is in the transport | ||
191 | * ownership and don't need to be freed by the op_mode. This also means | ||
192 | * that the pointer is invalidated after the op_mode's handler returns. | ||
188 | * @CMD_ON_DEMAND: This command is sent by the test mode pipe. | 193 | * @CMD_ON_DEMAND: This command is sent by the test mode pipe. |
189 | */ | 194 | */ |
190 | enum CMD_MODE { | 195 | enum CMD_MODE { |
191 | CMD_SYNC = 0, | 196 | CMD_SYNC = 0, |
192 | CMD_ASYNC = BIT(0), | 197 | CMD_ASYNC = BIT(0), |
193 | CMD_WANT_SKB = BIT(1), | 198 | CMD_WANT_SKB = BIT(1), |
194 | CMD_ON_DEMAND = BIT(2), | 199 | CMD_WANT_HCMD = BIT(2), |
200 | CMD_ON_DEMAND = BIT(3), | ||
195 | }; | 201 | }; |
196 | 202 | ||
197 | #define DEF_CMD_PAYLOAD_SIZE 320 | 203 | #define DEF_CMD_PAYLOAD_SIZE 320 |
@@ -460,6 +466,8 @@ struct iwl_trans { | |||
460 | size_t dev_cmd_headroom; | 466 | size_t dev_cmd_headroom; |
461 | char dev_cmd_pool_name[50]; | 467 | char dev_cmd_pool_name[50]; |
462 | 468 | ||
469 | struct dentry *dbgfs_dir; | ||
470 | |||
463 | /* pointer to trans specific struct */ | 471 | /* pointer to trans specific struct */ |
464 | /*Ensure that this pointer will always be aligned to sizeof pointer */ | 472 | /*Ensure that this pointer will always be aligned to sizeof pointer */ |
465 | char trans_specific[0] __aligned(sizeof(void *)); | 473 | char trans_specific[0] __aligned(sizeof(void *)); |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index f4c3500b68c6..89bfb43f4946 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -282,8 +282,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
282 | if (!trans_pcie->drv) | 282 | if (!trans_pcie->drv) |
283 | goto out_free_trans; | 283 | goto out_free_trans; |
284 | 284 | ||
285 | /* register transport layer debugfs here */ | ||
286 | if (iwl_trans_dbgfs_register(iwl_trans, iwl_trans->dbgfs_dir)) | ||
287 | goto out_free_drv; | ||
288 | |||
285 | return 0; | 289 | return 0; |
286 | 290 | ||
291 | out_free_drv: | ||
292 | iwl_drv_stop(trans_pcie->drv); | ||
287 | out_free_trans: | 293 | out_free_trans: |
288 | iwl_trans_pcie_free(iwl_trans); | 294 | iwl_trans_pcie_free(iwl_trans); |
289 | pci_set_drvdata(pdev, NULL); | 295 | pci_set_drvdata(pdev, NULL); |
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h index d9694c58208c..3ef8d5adc991 100644 --- a/drivers/net/wireless/iwlwifi/pcie/internal.h +++ b/drivers/net/wireless/iwlwifi/pcie/internal.h | |||
@@ -184,6 +184,7 @@ struct iwl_queue { | |||
184 | 184 | ||
185 | struct iwl_pcie_tx_queue_entry { | 185 | struct iwl_pcie_tx_queue_entry { |
186 | struct iwl_device_cmd *cmd; | 186 | struct iwl_device_cmd *cmd; |
187 | struct iwl_device_cmd *copy_cmd; | ||
187 | struct sk_buff *skb; | 188 | struct sk_buff *skb; |
188 | struct iwl_cmd_meta meta; | 189 | struct iwl_cmd_meta meta; |
189 | }; | 190 | }; |
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index 39a6ca1f009c..d80604a2bb1a 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c | |||
@@ -421,13 +421,23 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans, | |||
421 | index = SEQ_TO_INDEX(sequence); | 421 | index = SEQ_TO_INDEX(sequence); |
422 | cmd_index = get_cmd_index(&txq->q, index); | 422 | cmd_index = get_cmd_index(&txq->q, index); |
423 | 423 | ||
424 | if (reclaim) | 424 | if (reclaim) { |
425 | cmd = txq->entries[cmd_index].cmd; | 425 | struct iwl_pcie_tx_queue_entry *ent; |
426 | else | 426 | ent = &txq->entries[cmd_index]; |
427 | cmd = ent->copy_cmd; | ||
428 | WARN_ON_ONCE(!cmd && ent->meta.flags & CMD_WANT_HCMD); | ||
429 | } else { | ||
427 | cmd = NULL; | 430 | cmd = NULL; |
431 | } | ||
428 | 432 | ||
429 | err = iwl_op_mode_rx(trans->op_mode, &rxcb, cmd); | 433 | err = iwl_op_mode_rx(trans->op_mode, &rxcb, cmd); |
430 | 434 | ||
435 | if (reclaim) { | ||
436 | /* The original command isn't needed any more */ | ||
437 | kfree(txq->entries[cmd_index].copy_cmd); | ||
438 | txq->entries[cmd_index].copy_cmd = NULL; | ||
439 | } | ||
440 | |||
431 | /* | 441 | /* |
432 | * After here, we should always check rxcb._page_stolen, | 442 | * After here, we should always check rxcb._page_stolen, |
433 | * if it is true then one of the handlers took the page. | 443 | * if it is true then one of the handlers took the page. |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 939c2f78df58..38f51b04217e 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -492,10 +492,11 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id) | |||
492 | iwl_tx_queue_unmap(trans, txq_id); | 492 | iwl_tx_queue_unmap(trans, txq_id); |
493 | 493 | ||
494 | /* De-alloc array of command/tx buffers */ | 494 | /* De-alloc array of command/tx buffers */ |
495 | |||
496 | if (txq_id == trans_pcie->cmd_queue) | 495 | if (txq_id == trans_pcie->cmd_queue) |
497 | for (i = 0; i < txq->q.n_window; i++) | 496 | for (i = 0; i < txq->q.n_window; i++) { |
498 | kfree(txq->entries[i].cmd); | 497 | kfree(txq->entries[i].cmd); |
498 | kfree(txq->entries[i].copy_cmd); | ||
499 | } | ||
499 | 500 | ||
500 | /* De-alloc circular buffer of TFDs */ | 501 | /* De-alloc circular buffer of TFDs */ |
501 | if (txq->q.n_bd) { | 502 | if (txq->q.n_bd) { |
@@ -896,6 +897,7 @@ static int iwl_set_hw_ready(struct iwl_trans *trans) | |||
896 | static int iwl_prepare_card_hw(struct iwl_trans *trans) | 897 | static int iwl_prepare_card_hw(struct iwl_trans *trans) |
897 | { | 898 | { |
898 | int ret; | 899 | int ret; |
900 | int t = 0; | ||
899 | 901 | ||
900 | IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n"); | 902 | IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n"); |
901 | 903 | ||
@@ -908,17 +910,15 @@ static int iwl_prepare_card_hw(struct iwl_trans *trans) | |||
908 | iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, | 910 | iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, |
909 | CSR_HW_IF_CONFIG_REG_PREPARE); | 911 | CSR_HW_IF_CONFIG_REG_PREPARE); |
910 | 912 | ||
911 | ret = iwl_poll_bit(trans, CSR_HW_IF_CONFIG_REG, | 913 | do { |
912 | ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, | 914 | ret = iwl_set_hw_ready(trans); |
913 | CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000); | 915 | if (ret >= 0) |
916 | return 0; | ||
914 | 917 | ||
915 | if (ret < 0) | 918 | usleep_range(200, 1000); |
916 | return ret; | 919 | t += 200; |
920 | } while (t < 150000); | ||
917 | 921 | ||
918 | /* HW should be ready by now, check again. */ | ||
919 | ret = iwl_set_hw_ready(trans); | ||
920 | if (ret >= 0) | ||
921 | return 0; | ||
922 | return ret; | 922 | return ret; |
923 | } | 923 | } |
924 | 924 | ||
@@ -1769,7 +1769,7 @@ void iwl_dump_csr(struct iwl_trans *trans) | |||
1769 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ | 1769 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ |
1770 | if (!debugfs_create_file(#name, mode, parent, trans, \ | 1770 | if (!debugfs_create_file(#name, mode, parent, trans, \ |
1771 | &iwl_dbgfs_##name##_ops)) \ | 1771 | &iwl_dbgfs_##name##_ops)) \ |
1772 | return -ENOMEM; \ | 1772 | goto err; \ |
1773 | } while (0) | 1773 | } while (0) |
1774 | 1774 | ||
1775 | /* file operation */ | 1775 | /* file operation */ |
@@ -2033,6 +2033,10 @@ static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, | |||
2033 | DEBUGFS_ADD_FILE(fh_reg, dir, S_IRUSR); | 2033 | DEBUGFS_ADD_FILE(fh_reg, dir, S_IRUSR); |
2034 | DEBUGFS_ADD_FILE(fw_restart, dir, S_IWUSR); | 2034 | DEBUGFS_ADD_FILE(fw_restart, dir, S_IWUSR); |
2035 | return 0; | 2035 | return 0; |
2036 | |||
2037 | err: | ||
2038 | IWL_ERR(trans, "failed to create the trans debugfs entry\n"); | ||
2039 | return -ENOMEM; | ||
2036 | } | 2040 | } |
2037 | #else | 2041 | #else |
2038 | static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, | 2042 | static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, |
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index 6baf8deef519..392d2bc5e357 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -521,7 +521,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | |||
521 | u16 copy_size, cmd_size; | 521 | u16 copy_size, cmd_size; |
522 | bool had_nocopy = false; | 522 | bool had_nocopy = false; |
523 | int i; | 523 | int i; |
524 | u8 *cmd_dest; | 524 | u32 cmd_pos; |
525 | #ifdef CONFIG_IWLWIFI_DEVICE_TRACING | 525 | #ifdef CONFIG_IWLWIFI_DEVICE_TRACING |
526 | const void *trace_bufs[IWL_MAX_CMD_TFDS + 1] = {}; | 526 | const void *trace_bufs[IWL_MAX_CMD_TFDS + 1] = {}; |
527 | int trace_lens[IWL_MAX_CMD_TFDS + 1] = {}; | 527 | int trace_lens[IWL_MAX_CMD_TFDS + 1] = {}; |
@@ -584,15 +584,31 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | |||
584 | INDEX_TO_SEQ(q->write_ptr)); | 584 | INDEX_TO_SEQ(q->write_ptr)); |
585 | 585 | ||
586 | /* and copy the data that needs to be copied */ | 586 | /* and copy the data that needs to be copied */ |
587 | 587 | cmd_pos = offsetof(struct iwl_device_cmd, payload); | |
588 | cmd_dest = out_cmd->payload; | ||
589 | for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { | 588 | for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { |
590 | if (!cmd->len[i]) | 589 | if (!cmd->len[i]) |
591 | continue; | 590 | continue; |
592 | if (cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY) | 591 | if (cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY) |
593 | break; | 592 | break; |
594 | memcpy(cmd_dest, cmd->data[i], cmd->len[i]); | 593 | memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], cmd->len[i]); |
595 | cmd_dest += cmd->len[i]; | 594 | cmd_pos += cmd->len[i]; |
595 | } | ||
596 | |||
597 | WARN_ON_ONCE(txq->entries[idx].copy_cmd); | ||
598 | |||
599 | /* | ||
600 | * since out_cmd will be the source address of the FH, it will write | ||
601 | * the retry count there. So when the user needs to receivce the HCMD | ||
602 | * that corresponds to the response in the response handler, it needs | ||
603 | * to set CMD_WANT_HCMD. | ||
604 | */ | ||
605 | if (cmd->flags & CMD_WANT_HCMD) { | ||
606 | txq->entries[idx].copy_cmd = | ||
607 | kmemdup(out_cmd, cmd_pos, GFP_ATOMIC); | ||
608 | if (unlikely(!txq->entries[idx].copy_cmd)) { | ||
609 | idx = -ENOMEM; | ||
610 | goto out; | ||
611 | } | ||
596 | } | 612 | } |
597 | 613 | ||
598 | IWL_DEBUG_HC(trans, | 614 | IWL_DEBUG_HC(trans, |
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c index a03457292c88..7001856241e6 100644 --- a/drivers/net/wireless/libertas_tf/main.c +++ b/drivers/net/wireless/libertas_tf/main.c | |||
@@ -227,7 +227,9 @@ static void lbtf_free_adapter(struct lbtf_private *priv) | |||
227 | lbtf_deb_leave(LBTF_DEB_MAIN); | 227 | lbtf_deb_leave(LBTF_DEB_MAIN); |
228 | } | 228 | } |
229 | 229 | ||
230 | static void lbtf_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 230 | static void lbtf_op_tx(struct ieee80211_hw *hw, |
231 | struct ieee80211_tx_control *control, | ||
232 | struct sk_buff *skb) | ||
231 | { | 233 | { |
232 | struct lbtf_private *priv = hw->priv; | 234 | struct lbtf_private *priv = hw->priv; |
233 | 235 | ||
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 00838395778c..72b0456e41bf 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -709,7 +709,9 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw, | |||
709 | return ack; | 709 | return ack; |
710 | } | 710 | } |
711 | 711 | ||
712 | static void mac80211_hwsim_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 712 | static void mac80211_hwsim_tx(struct ieee80211_hw *hw, |
713 | struct ieee80211_tx_control *control, | ||
714 | struct sk_buff *skb) | ||
713 | { | 715 | { |
714 | bool ack; | 716 | bool ack; |
715 | struct ieee80211_tx_info *txi; | 717 | struct ieee80211_tx_info *txi; |
@@ -1727,6 +1729,7 @@ static const struct ieee80211_iface_limit hwsim_if_limits[] = { | |||
1727 | #endif | 1729 | #endif |
1728 | BIT(NL80211_IFTYPE_AP) | | 1730 | BIT(NL80211_IFTYPE_AP) | |
1729 | BIT(NL80211_IFTYPE_P2P_GO) }, | 1731 | BIT(NL80211_IFTYPE_P2P_GO) }, |
1732 | { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_DEVICE) }, | ||
1730 | }; | 1733 | }; |
1731 | 1734 | ||
1732 | static const struct ieee80211_iface_combination hwsim_if_comb = { | 1735 | static const struct ieee80211_iface_combination hwsim_if_comb = { |
@@ -1813,7 +1816,8 @@ static int __init init_mac80211_hwsim(void) | |||
1813 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | 1816 | BIT(NL80211_IFTYPE_P2P_CLIENT) | |
1814 | BIT(NL80211_IFTYPE_P2P_GO) | | 1817 | BIT(NL80211_IFTYPE_P2P_GO) | |
1815 | BIT(NL80211_IFTYPE_ADHOC) | | 1818 | BIT(NL80211_IFTYPE_ADHOC) | |
1816 | BIT(NL80211_IFTYPE_MESH_POINT); | 1819 | BIT(NL80211_IFTYPE_MESH_POINT) | |
1820 | BIT(NL80211_IFTYPE_P2P_DEVICE); | ||
1817 | 1821 | ||
1818 | hw->flags = IEEE80211_HW_MFP_CAPABLE | | 1822 | hw->flags = IEEE80211_HW_MFP_CAPABLE | |
1819 | IEEE80211_HW_SIGNAL_DBM | | 1823 | IEEE80211_HW_SIGNAL_DBM | |
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 224e03ade145..5099e5375cb3 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -1830,12 +1830,14 @@ static inline void mwl8k_tx_count_packet(struct ieee80211_sta *sta, u8 tid) | |||
1830 | } | 1830 | } |
1831 | 1831 | ||
1832 | static void | 1832 | static void |
1833 | mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb) | 1833 | mwl8k_txq_xmit(struct ieee80211_hw *hw, |
1834 | int index, | ||
1835 | struct ieee80211_sta *sta, | ||
1836 | struct sk_buff *skb) | ||
1834 | { | 1837 | { |
1835 | struct mwl8k_priv *priv = hw->priv; | 1838 | struct mwl8k_priv *priv = hw->priv; |
1836 | struct ieee80211_tx_info *tx_info; | 1839 | struct ieee80211_tx_info *tx_info; |
1837 | struct mwl8k_vif *mwl8k_vif; | 1840 | struct mwl8k_vif *mwl8k_vif; |
1838 | struct ieee80211_sta *sta; | ||
1839 | struct ieee80211_hdr *wh; | 1841 | struct ieee80211_hdr *wh; |
1840 | struct mwl8k_tx_queue *txq; | 1842 | struct mwl8k_tx_queue *txq; |
1841 | struct mwl8k_tx_desc *tx; | 1843 | struct mwl8k_tx_desc *tx; |
@@ -1867,7 +1869,6 @@ mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb) | |||
1867 | wh = &((struct mwl8k_dma_data *)skb->data)->wh; | 1869 | wh = &((struct mwl8k_dma_data *)skb->data)->wh; |
1868 | 1870 | ||
1869 | tx_info = IEEE80211_SKB_CB(skb); | 1871 | tx_info = IEEE80211_SKB_CB(skb); |
1870 | sta = tx_info->control.sta; | ||
1871 | mwl8k_vif = MWL8K_VIF(tx_info->control.vif); | 1872 | mwl8k_vif = MWL8K_VIF(tx_info->control.vif); |
1872 | 1873 | ||
1873 | if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | 1874 | if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { |
@@ -2019,8 +2020,8 @@ mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb) | |||
2019 | tx->pkt_phys_addr = cpu_to_le32(dma); | 2020 | tx->pkt_phys_addr = cpu_to_le32(dma); |
2020 | tx->pkt_len = cpu_to_le16(skb->len); | 2021 | tx->pkt_len = cpu_to_le16(skb->len); |
2021 | tx->rate_info = 0; | 2022 | tx->rate_info = 0; |
2022 | if (!priv->ap_fw && tx_info->control.sta != NULL) | 2023 | if (!priv->ap_fw && sta != NULL) |
2023 | tx->peer_id = MWL8K_STA(tx_info->control.sta)->peer_id; | 2024 | tx->peer_id = MWL8K_STA(sta)->peer_id; |
2024 | else | 2025 | else |
2025 | tx->peer_id = 0; | 2026 | tx->peer_id = 0; |
2026 | 2027 | ||
@@ -4364,7 +4365,9 @@ static void mwl8k_rx_poll(unsigned long data) | |||
4364 | /* | 4365 | /* |
4365 | * Core driver operations. | 4366 | * Core driver operations. |
4366 | */ | 4367 | */ |
4367 | static void mwl8k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 4368 | static void mwl8k_tx(struct ieee80211_hw *hw, |
4369 | struct ieee80211_tx_control *control, | ||
4370 | struct sk_buff *skb) | ||
4368 | { | 4371 | { |
4369 | struct mwl8k_priv *priv = hw->priv; | 4372 | struct mwl8k_priv *priv = hw->priv; |
4370 | int index = skb_get_queue_mapping(skb); | 4373 | int index = skb_get_queue_mapping(skb); |
@@ -4376,7 +4379,7 @@ static void mwl8k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
4376 | return; | 4379 | return; |
4377 | } | 4380 | } |
4378 | 4381 | ||
4379 | mwl8k_txq_xmit(hw, index, skb); | 4382 | mwl8k_txq_xmit(hw, index, control->sta, skb); |
4380 | } | 4383 | } |
4381 | 4384 | ||
4382 | static int mwl8k_start(struct ieee80211_hw *hw) | 4385 | static int mwl8k_start(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/p54/lmac.h b/drivers/net/wireless/p54/lmac.h index 3d8d622bec55..de1d46bf97df 100644 --- a/drivers/net/wireless/p54/lmac.h +++ b/drivers/net/wireless/p54/lmac.h | |||
@@ -526,7 +526,9 @@ int p54_init_leds(struct p54_common *priv); | |||
526 | void p54_unregister_leds(struct p54_common *priv); | 526 | void p54_unregister_leds(struct p54_common *priv); |
527 | 527 | ||
528 | /* xmit functions */ | 528 | /* xmit functions */ |
529 | void p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb); | 529 | void p54_tx_80211(struct ieee80211_hw *dev, |
530 | struct ieee80211_tx_control *control, | ||
531 | struct sk_buff *skb); | ||
530 | int p54_tx_cancel(struct p54_common *priv, __le32 req_id); | 532 | int p54_tx_cancel(struct p54_common *priv, __le32 req_id); |
531 | void p54_tx(struct p54_common *priv, struct sk_buff *skb); | 533 | void p54_tx(struct p54_common *priv, struct sk_buff *skb); |
532 | 534 | ||
diff --git a/drivers/net/wireless/p54/main.c b/drivers/net/wireless/p54/main.c index 7cffea795ad2..5e91ad06dd5d 100644 --- a/drivers/net/wireless/p54/main.c +++ b/drivers/net/wireless/p54/main.c | |||
@@ -158,7 +158,7 @@ static int p54_beacon_update(struct p54_common *priv, | |||
158 | * to cancel the old beacon template by hand, instead the firmware | 158 | * to cancel the old beacon template by hand, instead the firmware |
159 | * will release the previous one through the feedback mechanism. | 159 | * will release the previous one through the feedback mechanism. |
160 | */ | 160 | */ |
161 | p54_tx_80211(priv->hw, beacon); | 161 | p54_tx_80211(priv->hw, NULL, beacon); |
162 | priv->tsf_high32 = 0; | 162 | priv->tsf_high32 = 0; |
163 | priv->tsf_low32 = 0; | 163 | priv->tsf_low32 = 0; |
164 | 164 | ||
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c index f38786e02623..5861e13a6fd8 100644 --- a/drivers/net/wireless/p54/txrx.c +++ b/drivers/net/wireless/p54/txrx.c | |||
@@ -676,8 +676,9 @@ int p54_rx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
676 | EXPORT_SYMBOL_GPL(p54_rx); | 676 | EXPORT_SYMBOL_GPL(p54_rx); |
677 | 677 | ||
678 | static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb, | 678 | static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb, |
679 | struct ieee80211_tx_info *info, u8 *queue, | 679 | struct ieee80211_tx_info *info, |
680 | u32 *extra_len, u16 *flags, u16 *aid, | 680 | struct ieee80211_sta *sta, |
681 | u8 *queue, u32 *extra_len, u16 *flags, u16 *aid, | ||
681 | bool *burst_possible) | 682 | bool *burst_possible) |
682 | { | 683 | { |
683 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 684 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
@@ -746,8 +747,8 @@ static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb, | |||
746 | } | 747 | } |
747 | } | 748 | } |
748 | 749 | ||
749 | if (info->control.sta) | 750 | if (sta) |
750 | *aid = info->control.sta->aid; | 751 | *aid = sta->aid; |
751 | break; | 752 | break; |
752 | } | 753 | } |
753 | } | 754 | } |
@@ -767,7 +768,9 @@ static u8 p54_convert_algo(u32 cipher) | |||
767 | } | 768 | } |
768 | } | 769 | } |
769 | 770 | ||
770 | void p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb) | 771 | void p54_tx_80211(struct ieee80211_hw *dev, |
772 | struct ieee80211_tx_control *control, | ||
773 | struct sk_buff *skb) | ||
771 | { | 774 | { |
772 | struct p54_common *priv = dev->priv; | 775 | struct p54_common *priv = dev->priv; |
773 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 776 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
@@ -784,7 +787,7 @@ void p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
784 | u8 nrates = 0, nremaining = 8; | 787 | u8 nrates = 0, nremaining = 8; |
785 | bool burst_allowed = false; | 788 | bool burst_allowed = false; |
786 | 789 | ||
787 | p54_tx_80211_header(priv, skb, info, &queue, &extra_len, | 790 | p54_tx_80211_header(priv, skb, info, control->sta, &queue, &extra_len, |
788 | &hdr_flags, &aid, &burst_allowed); | 791 | &hdr_flags, &aid, &burst_allowed); |
789 | 792 | ||
790 | if (p54_tx_qos_accounting_alloc(priv, skb, queue)) { | 793 | if (p54_tx_qos_accounting_alloc(priv, skb, queue)) { |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 8afb546c2b2d..f991e8bedc70 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -1287,7 +1287,9 @@ void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp); | |||
1287 | /* | 1287 | /* |
1288 | * mac80211 handlers. | 1288 | * mac80211 handlers. |
1289 | */ | 1289 | */ |
1290 | void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); | 1290 | void rt2x00mac_tx(struct ieee80211_hw *hw, |
1291 | struct ieee80211_tx_control *control, | ||
1292 | struct sk_buff *skb); | ||
1291 | int rt2x00mac_start(struct ieee80211_hw *hw); | 1293 | int rt2x00mac_start(struct ieee80211_hw *hw); |
1292 | void rt2x00mac_stop(struct ieee80211_hw *hw); | 1294 | void rt2x00mac_stop(struct ieee80211_hw *hw); |
1293 | int rt2x00mac_add_interface(struct ieee80211_hw *hw, | 1295 | int rt2x00mac_add_interface(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index a6b88bd4a1a5..a59048ffa092 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -194,7 +194,7 @@ static void rt2x00lib_bc_buffer_iter(void *data, u8 *mac, | |||
194 | */ | 194 | */ |
195 | skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); | 195 | skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); |
196 | while (skb) { | 196 | while (skb) { |
197 | rt2x00mac_tx(rt2x00dev->hw, skb); | 197 | rt2x00mac_tx(rt2x00dev->hw, NULL, skb); |
198 | skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); | 198 | skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); |
199 | } | 199 | } |
200 | } | 200 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 4ff26c2159bf..c3d0f2f87b69 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -99,7 +99,9 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev, | |||
99 | return retval; | 99 | return retval; |
100 | } | 100 | } |
101 | 101 | ||
102 | void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 102 | void rt2x00mac_tx(struct ieee80211_hw *hw, |
103 | struct ieee80211_tx_control *control, | ||
104 | struct sk_buff *skb) | ||
103 | { | 105 | { |
104 | struct rt2x00_dev *rt2x00dev = hw->priv; | 106 | struct rt2x00_dev *rt2x00dev = hw->priv; |
105 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 107 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index f7e74a0a7759..e488b944a034 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -315,6 +315,7 @@ static void rt2x00queue_create_tx_descriptor_plcp(struct rt2x00_dev *rt2x00dev, | |||
315 | static void rt2x00queue_create_tx_descriptor_ht(struct rt2x00_dev *rt2x00dev, | 315 | static void rt2x00queue_create_tx_descriptor_ht(struct rt2x00_dev *rt2x00dev, |
316 | struct sk_buff *skb, | 316 | struct sk_buff *skb, |
317 | struct txentry_desc *txdesc, | 317 | struct txentry_desc *txdesc, |
318 | struct ieee80211_sta *sta, | ||
318 | const struct rt2x00_rate *hwrate) | 319 | const struct rt2x00_rate *hwrate) |
319 | { | 320 | { |
320 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 321 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
@@ -322,11 +323,11 @@ static void rt2x00queue_create_tx_descriptor_ht(struct rt2x00_dev *rt2x00dev, | |||
322 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 323 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
323 | struct rt2x00_sta *sta_priv = NULL; | 324 | struct rt2x00_sta *sta_priv = NULL; |
324 | 325 | ||
325 | if (tx_info->control.sta) { | 326 | if (sta) { |
326 | txdesc->u.ht.mpdu_density = | 327 | txdesc->u.ht.mpdu_density = |
327 | tx_info->control.sta->ht_cap.ampdu_density; | 328 | sta->ht_cap.ampdu_density; |
328 | 329 | ||
329 | sta_priv = sta_to_rt2x00_sta(tx_info->control.sta); | 330 | sta_priv = sta_to_rt2x00_sta(sta); |
330 | txdesc->u.ht.wcid = sta_priv->wcid; | 331 | txdesc->u.ht.wcid = sta_priv->wcid; |
331 | } | 332 | } |
332 | 333 | ||
@@ -341,8 +342,8 @@ static void rt2x00queue_create_tx_descriptor_ht(struct rt2x00_dev *rt2x00dev, | |||
341 | * MIMO PS should be set to 1 for STA's using dynamic SM PS | 342 | * MIMO PS should be set to 1 for STA's using dynamic SM PS |
342 | * when using more then one tx stream (>MCS7). | 343 | * when using more then one tx stream (>MCS7). |
343 | */ | 344 | */ |
344 | if (tx_info->control.sta && txdesc->u.ht.mcs > 7 && | 345 | if (sta && txdesc->u.ht.mcs > 7 && |
345 | ((tx_info->control.sta->ht_cap.cap & | 346 | ((sta->ht_cap.cap & |
346 | IEEE80211_HT_CAP_SM_PS) >> | 347 | IEEE80211_HT_CAP_SM_PS) >> |
347 | IEEE80211_HT_CAP_SM_PS_SHIFT) == | 348 | IEEE80211_HT_CAP_SM_PS_SHIFT) == |
348 | WLAN_HT_CAP_SM_PS_DYNAMIC) | 349 | WLAN_HT_CAP_SM_PS_DYNAMIC) |
@@ -409,7 +410,8 @@ static void rt2x00queue_create_tx_descriptor_ht(struct rt2x00_dev *rt2x00dev, | |||
409 | 410 | ||
410 | static void rt2x00queue_create_tx_descriptor(struct rt2x00_dev *rt2x00dev, | 411 | static void rt2x00queue_create_tx_descriptor(struct rt2x00_dev *rt2x00dev, |
411 | struct sk_buff *skb, | 412 | struct sk_buff *skb, |
412 | struct txentry_desc *txdesc) | 413 | struct txentry_desc *txdesc, |
414 | struct ieee80211_sta *sta) | ||
413 | { | 415 | { |
414 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 416 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
415 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 417 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
@@ -503,7 +505,7 @@ static void rt2x00queue_create_tx_descriptor(struct rt2x00_dev *rt2x00dev, | |||
503 | 505 | ||
504 | if (test_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags)) | 506 | if (test_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags)) |
505 | rt2x00queue_create_tx_descriptor_ht(rt2x00dev, skb, txdesc, | 507 | rt2x00queue_create_tx_descriptor_ht(rt2x00dev, skb, txdesc, |
506 | hwrate); | 508 | sta, hwrate); |
507 | else | 509 | else |
508 | rt2x00queue_create_tx_descriptor_plcp(rt2x00dev, skb, txdesc, | 510 | rt2x00queue_create_tx_descriptor_plcp(rt2x00dev, skb, txdesc, |
509 | hwrate); | 511 | hwrate); |
@@ -595,7 +597,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, | |||
595 | * after that we are free to use the skb->cb array | 597 | * after that we are free to use the skb->cb array |
596 | * for our information. | 598 | * for our information. |
597 | */ | 599 | */ |
598 | rt2x00queue_create_tx_descriptor(queue->rt2x00dev, skb, &txdesc); | 600 | rt2x00queue_create_tx_descriptor(queue->rt2x00dev, skb, &txdesc, NULL); |
599 | 601 | ||
600 | /* | 602 | /* |
601 | * All information is retrieved from the skb->cb array, | 603 | * All information is retrieved from the skb->cb array, |
@@ -740,7 +742,7 @@ int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev, | |||
740 | * after that we are free to use the skb->cb array | 742 | * after that we are free to use the skb->cb array |
741 | * for our information. | 743 | * for our information. |
742 | */ | 744 | */ |
743 | rt2x00queue_create_tx_descriptor(rt2x00dev, intf->beacon->skb, &txdesc); | 745 | rt2x00queue_create_tx_descriptor(rt2x00dev, intf->beacon->skb, &txdesc, NULL); |
744 | 746 | ||
745 | /* | 747 | /* |
746 | * Fill in skb descriptor | 748 | * Fill in skb descriptor |
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c index aceaf689f737..021d83e1b1d3 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c | |||
@@ -244,7 +244,9 @@ static irqreturn_t rtl8180_interrupt(int irq, void *dev_id) | |||
244 | return IRQ_HANDLED; | 244 | return IRQ_HANDLED; |
245 | } | 245 | } |
246 | 246 | ||
247 | static void rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | 247 | static void rtl8180_tx(struct ieee80211_hw *dev, |
248 | struct ieee80211_tx_control *control, | ||
249 | struct sk_buff *skb) | ||
248 | { | 250 | { |
249 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 251 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
250 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 252 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
@@ -710,7 +712,7 @@ static void rtl8180_beacon_work(struct work_struct *work) | |||
710 | /* TODO: use actual beacon queue */ | 712 | /* TODO: use actual beacon queue */ |
711 | skb_set_queue_mapping(skb, 0); | 713 | skb_set_queue_mapping(skb, 0); |
712 | 714 | ||
713 | rtl8180_tx(dev, skb); | 715 | rtl8180_tx(dev, NULL, skb); |
714 | 716 | ||
715 | resched: | 717 | resched: |
716 | /* | 718 | /* |
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c index 533024095c43..7811b6315973 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c | |||
@@ -228,7 +228,9 @@ static void rtl8187_tx_cb(struct urb *urb) | |||
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | static void rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | 231 | static void rtl8187_tx(struct ieee80211_hw *dev, |
232 | struct ieee80211_tx_control *control, | ||
233 | struct sk_buff *skb) | ||
232 | { | 234 | { |
233 | struct rtl8187_priv *priv = dev->priv; | 235 | struct rtl8187_priv *priv = dev->priv; |
234 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 236 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
@@ -1076,7 +1078,7 @@ static void rtl8187_beacon_work(struct work_struct *work) | |||
1076 | /* TODO: use actual beacon queue */ | 1078 | /* TODO: use actual beacon queue */ |
1077 | skb_set_queue_mapping(skb, 0); | 1079 | skb_set_queue_mapping(skb, 0); |
1078 | 1080 | ||
1079 | rtl8187_tx(dev, skb); | 1081 | rtl8187_tx(dev, NULL, skb); |
1080 | 1082 | ||
1081 | resched: | 1083 | resched: |
1082 | /* | 1084 | /* |
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 942e56b77b60..59381fe8ed06 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
@@ -1341,9 +1341,8 @@ int rtl_send_smps_action(struct ieee80211_hw *hw, | |||
1341 | rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0); | 1341 | rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0); |
1342 | 1342 | ||
1343 | info->control.rates[0].idx = 0; | 1343 | info->control.rates[0].idx = 0; |
1344 | info->control.sta = sta; | ||
1345 | info->band = hw->conf.channel->band; | 1344 | info->band = hw->conf.channel->band; |
1346 | rtlpriv->intf_ops->adapter_tx(hw, skb, &tcb_desc); | 1345 | rtlpriv->intf_ops->adapter_tx(hw, sta, skb, &tcb_desc); |
1347 | } | 1346 | } |
1348 | err_free: | 1347 | err_free: |
1349 | return 0; | 1348 | return 0; |
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index a18ad2a98938..a7c0e52869ba 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c | |||
@@ -124,7 +124,9 @@ static void rtl_op_stop(struct ieee80211_hw *hw) | |||
124 | mutex_unlock(&rtlpriv->locks.conf_mutex); | 124 | mutex_unlock(&rtlpriv->locks.conf_mutex); |
125 | } | 125 | } |
126 | 126 | ||
127 | static void rtl_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 127 | static void rtl_op_tx(struct ieee80211_hw *hw, |
128 | struct ieee80211_tx_control *control, | ||
129 | struct sk_buff *skb) | ||
128 | { | 130 | { |
129 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 131 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
130 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 132 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
@@ -138,8 +140,8 @@ static void rtl_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
138 | if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status)) | 140 | if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status)) |
139 | goto err_free; | 141 | goto err_free; |
140 | 142 | ||
141 | if (!rtlpriv->intf_ops->waitq_insert(hw, skb)) | 143 | if (!rtlpriv->intf_ops->waitq_insert(hw, control->sta, skb)) |
142 | rtlpriv->intf_ops->adapter_tx(hw, skb, &tcb_desc); | 144 | rtlpriv->intf_ops->adapter_tx(hw, control->sta, skb, &tcb_desc); |
143 | 145 | ||
144 | return; | 146 | return; |
145 | 147 | ||
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 80f75d3ba84a..aad9d44c0a51 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -504,7 +504,7 @@ static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw) | |||
504 | _rtl_update_earlymode_info(hw, skb, | 504 | _rtl_update_earlymode_info(hw, skb, |
505 | &tcb_desc, tid); | 505 | &tcb_desc, tid); |
506 | 506 | ||
507 | rtlpriv->intf_ops->adapter_tx(hw, skb, &tcb_desc); | 507 | rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, &tcb_desc); |
508 | } | 508 | } |
509 | } | 509 | } |
510 | } | 510 | } |
@@ -929,7 +929,7 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) | |||
929 | info = IEEE80211_SKB_CB(pskb); | 929 | info = IEEE80211_SKB_CB(pskb); |
930 | pdesc = &ring->desc[0]; | 930 | pdesc = &ring->desc[0]; |
931 | rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *) pdesc, | 931 | rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *) pdesc, |
932 | info, pskb, BEACON_QUEUE, &tcb_desc); | 932 | info, NULL, pskb, BEACON_QUEUE, &tcb_desc); |
933 | 933 | ||
934 | __skb_queue_tail(&ring->queue, pskb); | 934 | __skb_queue_tail(&ring->queue, pskb); |
935 | 935 | ||
@@ -1305,11 +1305,10 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) | |||
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | static bool rtl_pci_tx_chk_waitq_insert(struct ieee80211_hw *hw, | 1307 | static bool rtl_pci_tx_chk_waitq_insert(struct ieee80211_hw *hw, |
1308 | struct ieee80211_sta *sta, | ||
1308 | struct sk_buff *skb) | 1309 | struct sk_buff *skb) |
1309 | { | 1310 | { |
1310 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1311 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1311 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
1312 | struct ieee80211_sta *sta = info->control.sta; | ||
1313 | struct rtl_sta_info *sta_entry = NULL; | 1312 | struct rtl_sta_info *sta_entry = NULL; |
1314 | u8 tid = rtl_get_tid(skb); | 1313 | u8 tid = rtl_get_tid(skb); |
1315 | 1314 | ||
@@ -1337,13 +1336,14 @@ static bool rtl_pci_tx_chk_waitq_insert(struct ieee80211_hw *hw, | |||
1337 | return true; | 1336 | return true; |
1338 | } | 1337 | } |
1339 | 1338 | ||
1340 | static int rtl_pci_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | 1339 | static int rtl_pci_tx(struct ieee80211_hw *hw, |
1341 | struct rtl_tcb_desc *ptcb_desc) | 1340 | struct ieee80211_sta *sta, |
1341 | struct sk_buff *skb, | ||
1342 | struct rtl_tcb_desc *ptcb_desc) | ||
1342 | { | 1343 | { |
1343 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1344 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1344 | struct rtl_sta_info *sta_entry = NULL; | 1345 | struct rtl_sta_info *sta_entry = NULL; |
1345 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1346 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1346 | struct ieee80211_sta *sta = info->control.sta; | ||
1347 | struct rtl8192_tx_ring *ring; | 1347 | struct rtl8192_tx_ring *ring; |
1348 | struct rtl_tx_desc *pdesc; | 1348 | struct rtl_tx_desc *pdesc; |
1349 | u8 idx; | 1349 | u8 idx; |
@@ -1418,7 +1418,7 @@ static int rtl_pci_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
1418 | rtlpriv->cfg->ops->led_control(hw, LED_CTL_TX); | 1418 | rtlpriv->cfg->ops->led_control(hw, LED_CTL_TX); |
1419 | 1419 | ||
1420 | rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *)pdesc, | 1420 | rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *)pdesc, |
1421 | info, skb, hw_queue, ptcb_desc); | 1421 | info, sta, skb, hw_queue, ptcb_desc); |
1422 | 1422 | ||
1423 | __skb_queue_tail(&ring->queue, skb); | 1423 | __skb_queue_tail(&ring->queue, skb); |
1424 | 1424 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c index 52166640f167..390d6d4fcaa0 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c | |||
@@ -596,7 +596,9 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw, | |||
596 | 596 | ||
597 | void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, | 597 | void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, |
598 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, | 598 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, |
599 | struct ieee80211_tx_info *info, struct sk_buff *skb, | 599 | struct ieee80211_tx_info *info, |
600 | struct ieee80211_sta *sta, | ||
601 | struct sk_buff *skb, | ||
600 | u8 hw_queue, struct rtl_tcb_desc *tcb_desc) | 602 | u8 hw_queue, struct rtl_tcb_desc *tcb_desc) |
601 | { | 603 | { |
602 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 604 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
@@ -604,7 +606,6 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, | |||
604 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 606 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
605 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); | 607 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); |
606 | bool defaultadapter = true; | 608 | bool defaultadapter = true; |
607 | struct ieee80211_sta *sta; | ||
608 | u8 *pdesc = pdesc_tx; | 609 | u8 *pdesc = pdesc_tx; |
609 | u16 seq_number; | 610 | u16 seq_number; |
610 | __le16 fc = hdr->frame_control; | 611 | __le16 fc = hdr->frame_control; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h index c4adb9777365..a7cdd514cb2e 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h | |||
@@ -713,6 +713,7 @@ struct rx_desc_92c { | |||
713 | void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, | 713 | void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, |
714 | struct ieee80211_hdr *hdr, | 714 | struct ieee80211_hdr *hdr, |
715 | u8 *pdesc, struct ieee80211_tx_info *info, | 715 | u8 *pdesc, struct ieee80211_tx_info *info, |
716 | struct ieee80211_sta *sta, | ||
716 | struct sk_buff *skb, u8 hw_queue, | 717 | struct sk_buff *skb, u8 hw_queue, |
717 | struct rtl_tcb_desc *ptcb_desc); | 718 | struct rtl_tcb_desc *ptcb_desc); |
718 | bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw, | 719 | bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c index 2e6eb356a93e..27863d773790 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | |||
@@ -496,7 +496,9 @@ static void _rtl_tx_desc_checksum(u8 *txdesc) | |||
496 | 496 | ||
497 | void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, | 497 | void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, |
498 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, | 498 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, |
499 | struct ieee80211_tx_info *info, struct sk_buff *skb, | 499 | struct ieee80211_tx_info *info, |
500 | struct ieee80211_sta *sta, | ||
501 | struct sk_buff *skb, | ||
500 | u8 queue_index, | 502 | u8 queue_index, |
501 | struct rtl_tcb_desc *tcb_desc) | 503 | struct rtl_tcb_desc *tcb_desc) |
502 | { | 504 | { |
@@ -504,7 +506,6 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, | |||
504 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 506 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
505 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); | 507 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); |
506 | bool defaultadapter = true; | 508 | bool defaultadapter = true; |
507 | struct ieee80211_sta *sta = info->control.sta = info->control.sta; | ||
508 | u8 *qc = ieee80211_get_qos_ctl(hdr); | 509 | u8 *qc = ieee80211_get_qos_ctl(hdr); |
509 | u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; | 510 | u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; |
510 | u16 seq_number; | 511 | u16 seq_number; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h index 332b06e78b00..725c53accc58 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h | |||
@@ -420,7 +420,9 @@ struct sk_buff *rtl8192c_tx_aggregate_hdl(struct ieee80211_hw *, | |||
420 | struct sk_buff_head *); | 420 | struct sk_buff_head *); |
421 | void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, | 421 | void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, |
422 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, | 422 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, |
423 | struct ieee80211_tx_info *info, struct sk_buff *skb, | 423 | struct ieee80211_tx_info *info, |
424 | struct ieee80211_sta *sta, | ||
425 | struct sk_buff *skb, | ||
424 | u8 queue_index, | 426 | u8 queue_index, |
425 | struct rtl_tcb_desc *tcb_desc); | 427 | struct rtl_tcb_desc *tcb_desc); |
426 | void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc, | 428 | void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c index f80690d82c11..4686f340b9d6 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c | |||
@@ -551,7 +551,9 @@ static void _rtl92de_insert_emcontent(struct rtl_tcb_desc *ptcb_desc, | |||
551 | 551 | ||
552 | void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, | 552 | void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, |
553 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, | 553 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, |
554 | struct ieee80211_tx_info *info, struct sk_buff *skb, | 554 | struct ieee80211_tx_info *info, |
555 | struct ieee80211_sta *sta, | ||
556 | struct sk_buff *skb, | ||
555 | u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) | 557 | u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) |
556 | { | 558 | { |
557 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 559 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
@@ -559,7 +561,6 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, | |||
559 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 561 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
560 | struct rtl_hal *rtlhal = rtl_hal(rtlpriv); | 562 | struct rtl_hal *rtlhal = rtl_hal(rtlpriv); |
561 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); | 563 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); |
562 | struct ieee80211_sta *sta = info->control.sta; | ||
563 | u8 *pdesc = pdesc_tx; | 564 | u8 *pdesc = pdesc_tx; |
564 | u16 seq_number; | 565 | u16 seq_number; |
565 | __le16 fc = hdr->frame_control; | 566 | __le16 fc = hdr->frame_control; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.h b/drivers/net/wireless/rtlwifi/rtl8192de/trx.h index 057a52431b00..c1b5dfb79d53 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.h +++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.h | |||
@@ -730,6 +730,7 @@ struct rx_desc_92d { | |||
730 | void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, | 730 | void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, |
731 | struct ieee80211_hdr *hdr, | 731 | struct ieee80211_hdr *hdr, |
732 | u8 *pdesc, struct ieee80211_tx_info *info, | 732 | u8 *pdesc, struct ieee80211_tx_info *info, |
733 | struct ieee80211_sta *sta, | ||
733 | struct sk_buff *skb, u8 hw_queue, | 734 | struct sk_buff *skb, u8 hw_queue, |
734 | struct rtl_tcb_desc *ptcb_desc); | 735 | struct rtl_tcb_desc *ptcb_desc); |
735 | bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, | 736 | bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c index 36d1cb3aef8a..28c53fb12aeb 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c | |||
@@ -591,14 +591,15 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, | |||
591 | 591 | ||
592 | void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, | 592 | void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, |
593 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, | 593 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, |
594 | struct ieee80211_tx_info *info, struct sk_buff *skb, | 594 | struct ieee80211_tx_info *info, |
595 | struct ieee80211_sta *sta, | ||
596 | struct sk_buff *skb, | ||
595 | u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) | 597 | u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) |
596 | { | 598 | { |
597 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 599 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
598 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 600 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
599 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 601 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
600 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 602 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
601 | struct ieee80211_sta *sta = info->control.sta; | ||
602 | u8 *pdesc = pdesc_tx; | 603 | u8 *pdesc = pdesc_tx; |
603 | u16 seq_number; | 604 | u16 seq_number; |
604 | __le16 fc = hdr->frame_control; | 605 | __le16 fc = hdr->frame_control; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.h b/drivers/net/wireless/rtlwifi/rtl8192se/trx.h index 011e7b0695f2..64dd66f287c1 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.h +++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.h | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, | 32 | void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, |
33 | u8 *pdesc, struct ieee80211_tx_info *info, | 33 | u8 *pdesc, struct ieee80211_tx_info *info, |
34 | struct ieee80211_sta *sta, | ||
34 | struct sk_buff *skb, u8 hw_queue, | 35 | struct sk_buff *skb, u8 hw_queue, |
35 | struct rtl_tcb_desc *ptcb_desc); | 36 | struct rtl_tcb_desc *ptcb_desc); |
36 | void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, bool firstseg, | 37 | void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, bool firstseg, |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index aa970fc18a21..914046903cfd 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -848,8 +848,10 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
848 | _rtl_submit_tx_urb(hw, _urb); | 848 | _rtl_submit_tx_urb(hw, _urb); |
849 | } | 849 | } |
850 | 850 | ||
851 | static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw, struct sk_buff *skb, | 851 | static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw, |
852 | u16 hw_queue) | 852 | struct ieee80211_sta *sta, |
853 | struct sk_buff *skb, | ||
854 | u16 hw_queue) | ||
853 | { | 855 | { |
854 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 856 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
855 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 857 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
@@ -891,7 +893,7 @@ static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
891 | seq_number += 1; | 893 | seq_number += 1; |
892 | seq_number <<= 4; | 894 | seq_number <<= 4; |
893 | } | 895 | } |
894 | rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *)pdesc, info, skb, | 896 | rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *)pdesc, info, sta, skb, |
895 | hw_queue, &tcb_desc); | 897 | hw_queue, &tcb_desc); |
896 | if (!ieee80211_has_morefrags(hdr->frame_control)) { | 898 | if (!ieee80211_has_morefrags(hdr->frame_control)) { |
897 | if (qc) | 899 | if (qc) |
@@ -901,7 +903,9 @@ static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
901 | rtlpriv->cfg->ops->led_control(hw, LED_CTL_TX); | 903 | rtlpriv->cfg->ops->led_control(hw, LED_CTL_TX); |
902 | } | 904 | } |
903 | 905 | ||
904 | static int rtl_usb_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | 906 | static int rtl_usb_tx(struct ieee80211_hw *hw, |
907 | struct ieee80211_sta *sta, | ||
908 | struct sk_buff *skb, | ||
905 | struct rtl_tcb_desc *dummy) | 909 | struct rtl_tcb_desc *dummy) |
906 | { | 910 | { |
907 | struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); | 911 | struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); |
@@ -913,7 +917,7 @@ static int rtl_usb_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
913 | if (unlikely(is_hal_stop(rtlhal))) | 917 | if (unlikely(is_hal_stop(rtlhal))) |
914 | goto err_free; | 918 | goto err_free; |
915 | hw_queue = rtlusb->usb_mq_to_hwq(fc, skb_get_queue_mapping(skb)); | 919 | hw_queue = rtlusb->usb_mq_to_hwq(fc, skb_get_queue_mapping(skb)); |
916 | _rtl_usb_tx_preprocess(hw, skb, hw_queue); | 920 | _rtl_usb_tx_preprocess(hw, sta, skb, hw_queue); |
917 | _rtl_usb_transmit(hw, skb, hw_queue); | 921 | _rtl_usb_transmit(hw, skb, hw_queue); |
918 | return NETDEV_TX_OK; | 922 | return NETDEV_TX_OK; |
919 | 923 | ||
@@ -923,6 +927,7 @@ err_free: | |||
923 | } | 927 | } |
924 | 928 | ||
925 | static bool rtl_usb_tx_chk_waitq_insert(struct ieee80211_hw *hw, | 929 | static bool rtl_usb_tx_chk_waitq_insert(struct ieee80211_hw *hw, |
930 | struct ieee80211_sta *sta, | ||
926 | struct sk_buff *skb) | 931 | struct sk_buff *skb) |
927 | { | 932 | { |
928 | return false; | 933 | return false; |
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index cdaa21f29710..40153e7bf702 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -122,7 +122,7 @@ enum rt_eeprom_type { | |||
122 | EEPROM_BOOT_EFUSE, | 122 | EEPROM_BOOT_EFUSE, |
123 | }; | 123 | }; |
124 | 124 | ||
125 | enum rtl_status { | 125 | enum ttl_status { |
126 | RTL_STATUS_INTERFACE_START = 0, | 126 | RTL_STATUS_INTERFACE_START = 0, |
127 | }; | 127 | }; |
128 | 128 | ||
@@ -1418,6 +1418,7 @@ struct rtl_hal_ops { | |||
1418 | void (*fill_tx_desc) (struct ieee80211_hw *hw, | 1418 | void (*fill_tx_desc) (struct ieee80211_hw *hw, |
1419 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, | 1419 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, |
1420 | struct ieee80211_tx_info *info, | 1420 | struct ieee80211_tx_info *info, |
1421 | struct ieee80211_sta *sta, | ||
1421 | struct sk_buff *skb, u8 hw_queue, | 1422 | struct sk_buff *skb, u8 hw_queue, |
1422 | struct rtl_tcb_desc *ptcb_desc); | 1423 | struct rtl_tcb_desc *ptcb_desc); |
1423 | void (*fill_fake_txdesc) (struct ieee80211_hw *hw, u8 *pDesc, | 1424 | void (*fill_fake_txdesc) (struct ieee80211_hw *hw, u8 *pDesc, |
@@ -1475,11 +1476,15 @@ struct rtl_intf_ops { | |||
1475 | int (*adapter_start) (struct ieee80211_hw *hw); | 1476 | int (*adapter_start) (struct ieee80211_hw *hw); |
1476 | void (*adapter_stop) (struct ieee80211_hw *hw); | 1477 | void (*adapter_stop) (struct ieee80211_hw *hw); |
1477 | 1478 | ||
1478 | int (*adapter_tx) (struct ieee80211_hw *hw, struct sk_buff *skb, | 1479 | int (*adapter_tx) (struct ieee80211_hw *hw, |
1479 | struct rtl_tcb_desc *ptcb_desc); | 1480 | struct ieee80211_sta *sta, |
1481 | struct sk_buff *skb, | ||
1482 | struct rtl_tcb_desc *ptcb_desc); | ||
1480 | void (*flush)(struct ieee80211_hw *hw, bool drop); | 1483 | void (*flush)(struct ieee80211_hw *hw, bool drop); |
1481 | int (*reset_trx_ring) (struct ieee80211_hw *hw); | 1484 | int (*reset_trx_ring) (struct ieee80211_hw *hw); |
1482 | bool (*waitq_insert) (struct ieee80211_hw *hw, struct sk_buff *skb); | 1485 | bool (*waitq_insert) (struct ieee80211_hw *hw, |
1486 | struct ieee80211_sta *sta, | ||
1487 | struct sk_buff *skb); | ||
1483 | 1488 | ||
1484 | /*pci */ | 1489 | /*pci */ |
1485 | void (*disable_aspm) (struct ieee80211_hw *hw); | 1490 | void (*disable_aspm) (struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c index 3118c425bcf1..441cbccbd381 100644 --- a/drivers/net/wireless/ti/wl1251/main.c +++ b/drivers/net/wireless/ti/wl1251/main.c | |||
@@ -354,7 +354,9 @@ out: | |||
354 | return ret; | 354 | return ret; |
355 | } | 355 | } |
356 | 356 | ||
357 | static void wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 357 | static void wl1251_op_tx(struct ieee80211_hw *hw, |
358 | struct ieee80211_tx_control *control, | ||
359 | struct sk_buff *skb) | ||
358 | { | 360 | { |
359 | struct wl1251 *wl = hw->priv; | 361 | struct wl1251 *wl = hw->priv; |
360 | unsigned long flags; | 362 | unsigned long flags; |
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 72548609f711..ff830cf50c70 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -1181,7 +1181,9 @@ out: | |||
1181 | return ret; | 1181 | return ret; |
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 1184 | static void wl1271_op_tx(struct ieee80211_hw *hw, |
1185 | struct ieee80211_tx_control *control, | ||
1186 | struct sk_buff *skb) | ||
1185 | { | 1187 | { |
1186 | struct wl1271 *wl = hw->priv; | 1188 | struct wl1271 *wl = hw->priv; |
1187 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1189 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
@@ -1197,7 +1199,7 @@ static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1197 | mapping = skb_get_queue_mapping(skb); | 1199 | mapping = skb_get_queue_mapping(skb); |
1198 | q = wl1271_tx_get_queue(mapping); | 1200 | q = wl1271_tx_get_queue(mapping); |
1199 | 1201 | ||
1200 | hlid = wl12xx_tx_get_hlid(wl, wlvif, skb); | 1202 | hlid = wl12xx_tx_get_hlid(wl, wlvif, skb, control->sta); |
1201 | 1203 | ||
1202 | spin_lock_irqsave(&wl->wl_lock, flags); | 1204 | spin_lock_irqsave(&wl->wl_lock, flags); |
1203 | 1205 | ||
diff --git a/drivers/net/wireless/ti/wlcore/tx.c b/drivers/net/wireless/ti/wlcore/tx.c index f0081f746482..1a2f31c289c5 100644 --- a/drivers/net/wireless/ti/wlcore/tx.c +++ b/drivers/net/wireless/ti/wlcore/tx.c | |||
@@ -130,16 +130,13 @@ bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb) | |||
130 | } | 130 | } |
131 | EXPORT_SYMBOL(wl12xx_is_dummy_packet); | 131 | EXPORT_SYMBOL(wl12xx_is_dummy_packet); |
132 | 132 | ||
133 | u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif, | 133 | static u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
134 | struct sk_buff *skb) | 134 | struct sk_buff *skb, struct ieee80211_sta *sta) |
135 | { | 135 | { |
136 | struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb); | 136 | if (sta) { |
137 | |||
138 | if (control->control.sta) { | ||
139 | struct wl1271_station *wl_sta; | 137 | struct wl1271_station *wl_sta; |
140 | 138 | ||
141 | wl_sta = (struct wl1271_station *) | 139 | wl_sta = (struct wl1271_station *)sta->drv_priv; |
142 | control->control.sta->drv_priv; | ||
143 | return wl_sta->hlid; | 140 | return wl_sta->hlid; |
144 | } else { | 141 | } else { |
145 | struct ieee80211_hdr *hdr; | 142 | struct ieee80211_hdr *hdr; |
@@ -156,7 +153,7 @@ u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
156 | } | 153 | } |
157 | 154 | ||
158 | u8 wl12xx_tx_get_hlid(struct wl1271 *wl, struct wl12xx_vif *wlvif, | 155 | u8 wl12xx_tx_get_hlid(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
159 | struct sk_buff *skb) | 156 | struct sk_buff *skb, struct ieee80211_sta *sta) |
160 | { | 157 | { |
161 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 158 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
162 | 159 | ||
@@ -164,7 +161,7 @@ u8 wl12xx_tx_get_hlid(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
164 | return wl->system_hlid; | 161 | return wl->system_hlid; |
165 | 162 | ||
166 | if (wlvif->bss_type == BSS_TYPE_AP_BSS) | 163 | if (wlvif->bss_type == BSS_TYPE_AP_BSS) |
167 | return wl12xx_tx_get_hlid_ap(wl, wlvif, skb); | 164 | return wl12xx_tx_get_hlid_ap(wl, wlvif, skb, sta); |
168 | 165 | ||
169 | if ((test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) || | 166 | if ((test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) || |
170 | test_bit(WLVIF_FLAG_IBSS_JOINED, &wlvif->flags)) && | 167 | test_bit(WLVIF_FLAG_IBSS_JOINED, &wlvif->flags)) && |
@@ -344,13 +341,12 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
344 | 341 | ||
345 | /* caller must hold wl->mutex */ | 342 | /* caller must hold wl->mutex */ |
346 | static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct wl12xx_vif *wlvif, | 343 | static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
347 | struct sk_buff *skb, u32 buf_offset) | 344 | struct sk_buff *skb, u32 buf_offset, u8 hlid) |
348 | { | 345 | { |
349 | struct ieee80211_tx_info *info; | 346 | struct ieee80211_tx_info *info; |
350 | u32 extra = 0; | 347 | u32 extra = 0; |
351 | int ret = 0; | 348 | int ret = 0; |
352 | u32 total_len; | 349 | u32 total_len; |
353 | u8 hlid; | ||
354 | bool is_dummy; | 350 | bool is_dummy; |
355 | bool is_gem = false; | 351 | bool is_gem = false; |
356 | 352 | ||
@@ -359,9 +355,13 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
359 | return -EINVAL; | 355 | return -EINVAL; |
360 | } | 356 | } |
361 | 357 | ||
358 | if (hlid == WL12XX_INVALID_LINK_ID) { | ||
359 | wl1271_error("invalid hlid. dropping skb 0x%p", skb); | ||
360 | return -EINVAL; | ||
361 | } | ||
362 | |||
362 | info = IEEE80211_SKB_CB(skb); | 363 | info = IEEE80211_SKB_CB(skb); |
363 | 364 | ||
364 | /* TODO: handle dummy packets on multi-vifs */ | ||
365 | is_dummy = wl12xx_is_dummy_packet(wl, skb); | 365 | is_dummy = wl12xx_is_dummy_packet(wl, skb); |
366 | 366 | ||
367 | if ((wl->quirks & WLCORE_QUIRK_TKIP_HEADER_SPACE) && | 367 | if ((wl->quirks & WLCORE_QUIRK_TKIP_HEADER_SPACE) && |
@@ -386,11 +386,6 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
386 | 386 | ||
387 | is_gem = (cipher == WL1271_CIPHER_SUITE_GEM); | 387 | is_gem = (cipher == WL1271_CIPHER_SUITE_GEM); |
388 | } | 388 | } |
389 | hlid = wl12xx_tx_get_hlid(wl, wlvif, skb); | ||
390 | if (hlid == WL12XX_INVALID_LINK_ID) { | ||
391 | wl1271_error("invalid hlid. dropping skb 0x%p", skb); | ||
392 | return -EINVAL; | ||
393 | } | ||
394 | 389 | ||
395 | ret = wl1271_tx_allocate(wl, wlvif, skb, extra, buf_offset, hlid, | 390 | ret = wl1271_tx_allocate(wl, wlvif, skb, extra, buf_offset, hlid, |
396 | is_gem); | 391 | is_gem); |
@@ -517,7 +512,8 @@ static struct sk_buff *wl12xx_lnk_skb_dequeue(struct wl1271 *wl, | |||
517 | } | 512 | } |
518 | 513 | ||
519 | static struct sk_buff *wl12xx_vif_skb_dequeue(struct wl1271 *wl, | 514 | static struct sk_buff *wl12xx_vif_skb_dequeue(struct wl1271 *wl, |
520 | struct wl12xx_vif *wlvif) | 515 | struct wl12xx_vif *wlvif, |
516 | u8 *hlid) | ||
521 | { | 517 | { |
522 | struct sk_buff *skb = NULL; | 518 | struct sk_buff *skb = NULL; |
523 | int i, h, start_hlid; | 519 | int i, h, start_hlid; |
@@ -544,10 +540,11 @@ static struct sk_buff *wl12xx_vif_skb_dequeue(struct wl1271 *wl, | |||
544 | if (!skb) | 540 | if (!skb) |
545 | wlvif->last_tx_hlid = 0; | 541 | wlvif->last_tx_hlid = 0; |
546 | 542 | ||
543 | *hlid = wlvif->last_tx_hlid; | ||
547 | return skb; | 544 | return skb; |
548 | } | 545 | } |
549 | 546 | ||
550 | static struct sk_buff *wl1271_skb_dequeue(struct wl1271 *wl) | 547 | static struct sk_buff *wl1271_skb_dequeue(struct wl1271 *wl, u8 *hlid) |
551 | { | 548 | { |
552 | unsigned long flags; | 549 | unsigned long flags; |
553 | struct wl12xx_vif *wlvif = wl->last_wlvif; | 550 | struct wl12xx_vif *wlvif = wl->last_wlvif; |
@@ -556,7 +553,7 @@ static struct sk_buff *wl1271_skb_dequeue(struct wl1271 *wl) | |||
556 | /* continue from last wlvif (round robin) */ | 553 | /* continue from last wlvif (round robin) */ |
557 | if (wlvif) { | 554 | if (wlvif) { |
558 | wl12xx_for_each_wlvif_continue(wl, wlvif) { | 555 | wl12xx_for_each_wlvif_continue(wl, wlvif) { |
559 | skb = wl12xx_vif_skb_dequeue(wl, wlvif); | 556 | skb = wl12xx_vif_skb_dequeue(wl, wlvif, hlid); |
560 | if (skb) { | 557 | if (skb) { |
561 | wl->last_wlvif = wlvif; | 558 | wl->last_wlvif = wlvif; |
562 | break; | 559 | break; |
@@ -565,13 +562,15 @@ static struct sk_buff *wl1271_skb_dequeue(struct wl1271 *wl) | |||
565 | } | 562 | } |
566 | 563 | ||
567 | /* dequeue from the system HLID before the restarting wlvif list */ | 564 | /* dequeue from the system HLID before the restarting wlvif list */ |
568 | if (!skb) | 565 | if (!skb) { |
569 | skb = wl12xx_lnk_skb_dequeue(wl, &wl->links[wl->system_hlid]); | 566 | skb = wl12xx_lnk_skb_dequeue(wl, &wl->links[wl->system_hlid]); |
567 | *hlid = wl->system_hlid; | ||
568 | } | ||
570 | 569 | ||
571 | /* do a new pass over the wlvif list */ | 570 | /* do a new pass over the wlvif list */ |
572 | if (!skb) { | 571 | if (!skb) { |
573 | wl12xx_for_each_wlvif(wl, wlvif) { | 572 | wl12xx_for_each_wlvif(wl, wlvif) { |
574 | skb = wl12xx_vif_skb_dequeue(wl, wlvif); | 573 | skb = wl12xx_vif_skb_dequeue(wl, wlvif, hlid); |
575 | if (skb) { | 574 | if (skb) { |
576 | wl->last_wlvif = wlvif; | 575 | wl->last_wlvif = wlvif; |
577 | break; | 576 | break; |
@@ -591,6 +590,7 @@ static struct sk_buff *wl1271_skb_dequeue(struct wl1271 *wl) | |||
591 | int q; | 590 | int q; |
592 | 591 | ||
593 | skb = wl->dummy_packet; | 592 | skb = wl->dummy_packet; |
593 | *hlid = wl->system_hlid; | ||
594 | q = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); | 594 | q = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); |
595 | spin_lock_irqsave(&wl->wl_lock, flags); | 595 | spin_lock_irqsave(&wl->wl_lock, flags); |
596 | WARN_ON_ONCE(wl->tx_queue_count[q] <= 0); | 596 | WARN_ON_ONCE(wl->tx_queue_count[q] <= 0); |
@@ -602,7 +602,7 @@ static struct sk_buff *wl1271_skb_dequeue(struct wl1271 *wl) | |||
602 | } | 602 | } |
603 | 603 | ||
604 | static void wl1271_skb_queue_head(struct wl1271 *wl, struct wl12xx_vif *wlvif, | 604 | static void wl1271_skb_queue_head(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
605 | struct sk_buff *skb) | 605 | struct sk_buff *skb, u8 hlid) |
606 | { | 606 | { |
607 | unsigned long flags; | 607 | unsigned long flags; |
608 | int q = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); | 608 | int q = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); |
@@ -610,7 +610,6 @@ static void wl1271_skb_queue_head(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
610 | if (wl12xx_is_dummy_packet(wl, skb)) { | 610 | if (wl12xx_is_dummy_packet(wl, skb)) { |
611 | set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags); | 611 | set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags); |
612 | } else { | 612 | } else { |
613 | u8 hlid = wl12xx_tx_get_hlid(wl, wlvif, skb); | ||
614 | skb_queue_head(&wl->links[hlid].tx_queue[q], skb); | 613 | skb_queue_head(&wl->links[hlid].tx_queue[q], skb); |
615 | 614 | ||
616 | /* make sure we dequeue the same packet next time */ | 615 | /* make sure we dequeue the same packet next time */ |
@@ -686,26 +685,30 @@ int wlcore_tx_work_locked(struct wl1271 *wl) | |||
686 | unsigned long active_hlids[BITS_TO_LONGS(WL12XX_MAX_LINKS)] = {0}; | 685 | unsigned long active_hlids[BITS_TO_LONGS(WL12XX_MAX_LINKS)] = {0}; |
687 | int ret = 0; | 686 | int ret = 0; |
688 | int bus_ret = 0; | 687 | int bus_ret = 0; |
688 | u8 hlid; | ||
689 | 689 | ||
690 | if (unlikely(wl->state == WL1271_STATE_OFF)) | 690 | if (unlikely(wl->state == WL1271_STATE_OFF)) |
691 | return 0; | 691 | return 0; |
692 | 692 | ||
693 | while ((skb = wl1271_skb_dequeue(wl))) { | 693 | while ((skb = wl1271_skb_dequeue(wl, &hlid))) { |
694 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 694 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
695 | bool has_data = false; | 695 | bool has_data = false; |
696 | 696 | ||
697 | wlvif = NULL; | 697 | wlvif = NULL; |
698 | if (!wl12xx_is_dummy_packet(wl, skb) && info->control.vif) | 698 | if (!wl12xx_is_dummy_packet(wl, skb) && info->control.vif) |
699 | wlvif = wl12xx_vif_to_data(info->control.vif); | 699 | wlvif = wl12xx_vif_to_data(info->control.vif); |
700 | else | ||
701 | hlid = wl->system_hlid; | ||
700 | 702 | ||
701 | has_data = wlvif && wl1271_tx_is_data_present(skb); | 703 | has_data = wlvif && wl1271_tx_is_data_present(skb); |
702 | ret = wl1271_prepare_tx_frame(wl, wlvif, skb, buf_offset); | 704 | ret = wl1271_prepare_tx_frame(wl, wlvif, skb, buf_offset, |
705 | hlid); | ||
703 | if (ret == -EAGAIN) { | 706 | if (ret == -EAGAIN) { |
704 | /* | 707 | /* |
705 | * Aggregation buffer is full. | 708 | * Aggregation buffer is full. |
706 | * Flush buffer and try again. | 709 | * Flush buffer and try again. |
707 | */ | 710 | */ |
708 | wl1271_skb_queue_head(wl, wlvif, skb); | 711 | wl1271_skb_queue_head(wl, wlvif, skb, hlid); |
709 | 712 | ||
710 | buf_offset = wlcore_hw_pre_pkt_send(wl, buf_offset, | 713 | buf_offset = wlcore_hw_pre_pkt_send(wl, buf_offset, |
711 | last_len); | 714 | last_len); |
@@ -722,7 +725,7 @@ int wlcore_tx_work_locked(struct wl1271 *wl) | |||
722 | * Firmware buffer is full. | 725 | * Firmware buffer is full. |
723 | * Queue back last skb, and stop aggregating. | 726 | * Queue back last skb, and stop aggregating. |
724 | */ | 727 | */ |
725 | wl1271_skb_queue_head(wl, wlvif, skb); | 728 | wl1271_skb_queue_head(wl, wlvif, skb, hlid); |
726 | /* No work left, avoid scheduling redundant tx work */ | 729 | /* No work left, avoid scheduling redundant tx work */ |
727 | set_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags); | 730 | set_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags); |
728 | goto out_ack; | 731 | goto out_ack; |
@@ -732,7 +735,7 @@ int wlcore_tx_work_locked(struct wl1271 *wl) | |||
732 | * fw still expects dummy packet, | 735 | * fw still expects dummy packet, |
733 | * so re-enqueue it | 736 | * so re-enqueue it |
734 | */ | 737 | */ |
735 | wl1271_skb_queue_head(wl, wlvif, skb); | 738 | wl1271_skb_queue_head(wl, wlvif, skb, hlid); |
736 | else | 739 | else |
737 | ieee80211_free_txskb(wl->hw, skb); | 740 | ieee80211_free_txskb(wl->hw, skb); |
738 | goto out_ack; | 741 | goto out_ack; |
diff --git a/drivers/net/wireless/ti/wlcore/tx.h b/drivers/net/wireless/ti/wlcore/tx.h index 1e939b016155..349520d8b724 100644 --- a/drivers/net/wireless/ti/wlcore/tx.h +++ b/drivers/net/wireless/ti/wlcore/tx.h | |||
@@ -243,10 +243,8 @@ u8 wlcore_rate_to_idx(struct wl1271 *wl, u8 rate, enum ieee80211_band band); | |||
243 | u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set, | 243 | u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set, |
244 | enum ieee80211_band rate_band); | 244 | enum ieee80211_band rate_band); |
245 | u32 wl1271_tx_min_rate_get(struct wl1271 *wl, u32 rate_set); | 245 | u32 wl1271_tx_min_rate_get(struct wl1271 *wl, u32 rate_set); |
246 | u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif, | ||
247 | struct sk_buff *skb); | ||
248 | u8 wl12xx_tx_get_hlid(struct wl1271 *wl, struct wl12xx_vif *wlvif, | 246 | u8 wl12xx_tx_get_hlid(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
249 | struct sk_buff *skb); | 247 | struct sk_buff *skb, struct ieee80211_sta *sta); |
250 | void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid); | 248 | void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid); |
251 | void wl1271_handle_tx_low_watermark(struct wl1271 *wl); | 249 | void wl1271_handle_tx_low_watermark(struct wl1271 *wl); |
252 | bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb); | 250 | bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb); |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index c9e2660e1263..459880104758 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -937,7 +937,9 @@ static int fill_ctrlset(struct zd_mac *mac, | |||
937 | * control block of the skbuff will be initialized. If necessary the incoming | 937 | * control block of the skbuff will be initialized. If necessary the incoming |
938 | * mac80211 queues will be stopped. | 938 | * mac80211 queues will be stopped. |
939 | */ | 939 | */ |
940 | static void zd_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 940 | static void zd_op_tx(struct ieee80211_hw *hw, |
941 | struct ieee80211_tx_control *control, | ||
942 | struct sk_buff *skb) | ||
941 | { | 943 | { |
942 | struct zd_mac *mac = zd_hw_mac(hw); | 944 | struct zd_mac *mac = zd_hw_mac(hw); |
943 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 945 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
@@ -1176,7 +1178,7 @@ static void zd_beacon_done(struct zd_mac *mac) | |||
1176 | skb = ieee80211_get_buffered_bc(mac->hw, mac->vif); | 1178 | skb = ieee80211_get_buffered_bc(mac->hw, mac->vif); |
1177 | if (!skb) | 1179 | if (!skb) |
1178 | break; | 1180 | break; |
1179 | zd_op_tx(mac->hw, skb); | 1181 | zd_op_tx(mac->hw, NULL, skb); |
1180 | } | 1182 | } |
1181 | 1183 | ||
1182 | /* | 1184 | /* |
diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index 0ca857ac473e..48aa1361903e 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c | |||
@@ -119,7 +119,9 @@ static void wbsoft_configure_filter(struct ieee80211_hw *dev, | |||
119 | *total_flags = new_flags; | 119 | *total_flags = new_flags; |
120 | } | 120 | } |
121 | 121 | ||
122 | static void wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | 122 | static void wbsoft_tx(struct ieee80211_hw *dev, |
123 | struct ieee80211_tx_control *control, | ||
124 | struct sk_buff *skb) | ||
123 | { | 125 | { |
124 | struct wbsoft_priv *priv = dev->priv; | 126 | struct wbsoft_priv *priv = dev->priv; |
125 | 127 | ||
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h index 3fb8bbafe5e7..6ba45d2b99db 100644 --- a/include/linux/bcma/bcma_driver_chipcommon.h +++ b/include/linux/bcma/bcma_driver_chipcommon.h | |||
@@ -515,6 +515,26 @@ struct bcma_pflash { | |||
515 | u32 window_size; | 515 | u32 window_size; |
516 | }; | 516 | }; |
517 | 517 | ||
518 | #ifdef CONFIG_BCMA_SFLASH | ||
519 | struct bcma_sflash { | ||
520 | bool present; | ||
521 | u32 window; | ||
522 | u32 blocksize; | ||
523 | u16 numblocks; | ||
524 | u32 size; | ||
525 | }; | ||
526 | #endif | ||
527 | |||
528 | #ifdef CONFIG_BCMA_NFLASH | ||
529 | struct mtd_info; | ||
530 | |||
531 | struct bcma_nflash { | ||
532 | bool present; | ||
533 | |||
534 | struct mtd_info *mtd; | ||
535 | }; | ||
536 | #endif | ||
537 | |||
518 | struct bcma_serial_port { | 538 | struct bcma_serial_port { |
519 | void *regs; | 539 | void *regs; |
520 | unsigned long clockspeed; | 540 | unsigned long clockspeed; |
@@ -535,6 +555,12 @@ struct bcma_drv_cc { | |||
535 | struct bcma_chipcommon_pmu pmu; | 555 | struct bcma_chipcommon_pmu pmu; |
536 | #ifdef CONFIG_BCMA_DRIVER_MIPS | 556 | #ifdef CONFIG_BCMA_DRIVER_MIPS |
537 | struct bcma_pflash pflash; | 557 | struct bcma_pflash pflash; |
558 | #ifdef CONFIG_BCMA_SFLASH | ||
559 | struct bcma_sflash sflash; | ||
560 | #endif | ||
561 | #ifdef CONFIG_BCMA_NFLASH | ||
562 | struct bcma_nflash nflash; | ||
563 | #endif | ||
538 | 564 | ||
539 | int nr_serial_ports; | 565 | int nr_serial_ports; |
540 | struct bcma_serial_port serial_ports[4]; | 566 | struct bcma_serial_port serial_ports[4]; |
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h index a393e82bf7bf..6c9cb93ae3de 100644 --- a/include/linux/bcma/bcma_regs.h +++ b/include/linux/bcma/bcma_regs.h | |||
@@ -85,4 +85,6 @@ | |||
85 | * (2 ZettaBytes), high 32 bits | 85 | * (2 ZettaBytes), high 32 bits |
86 | */ | 86 | */ |
87 | 87 | ||
88 | #define BCMA_SFLASH 0x1c000000 | ||
89 | |||
88 | #endif /* LINUX_BCMA_REGS_H_ */ | 90 | #endif /* LINUX_BCMA_REGS_H_ */ |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 2f3878806403..458416279347 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -565,6 +565,14 @@ | |||
565 | * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with | 565 | * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with |
566 | * %NL80211_ATTR_WIPHY_CHANNEL_TYPE. | 566 | * %NL80211_ATTR_WIPHY_CHANNEL_TYPE. |
567 | * | 567 | * |
568 | * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by | ||
569 | * its %NL80211_ATTR_WDEV identifier. It must have been created with | ||
570 | * %NL80211_CMD_NEW_INTERFACE previously. After it has been started, the | ||
571 | * P2P Device can be used for P2P operations, e.g. remain-on-channel and | ||
572 | * public action frame TX. | ||
573 | * @NL80211_CMD_STOP_P2P_DEVICE: Stop the given P2P Device, identified by | ||
574 | * its %NL80211_ATTR_WDEV identifier. | ||
575 | * | ||
568 | * @NL80211_CMD_MAX: highest used command number | 576 | * @NL80211_CMD_MAX: highest used command number |
569 | * @__NL80211_CMD_AFTER_LAST: internal use | 577 | * @__NL80211_CMD_AFTER_LAST: internal use |
570 | */ | 578 | */ |
@@ -708,6 +716,9 @@ enum nl80211_commands { | |||
708 | 716 | ||
709 | NL80211_CMD_CH_SWITCH_NOTIFY, | 717 | NL80211_CMD_CH_SWITCH_NOTIFY, |
710 | 718 | ||
719 | NL80211_CMD_START_P2P_DEVICE, | ||
720 | NL80211_CMD_STOP_P2P_DEVICE, | ||
721 | |||
711 | /* add new commands above here */ | 722 | /* add new commands above here */ |
712 | 723 | ||
713 | /* used to define NL80211_CMD_MAX below */ | 724 | /* used to define NL80211_CMD_MAX below */ |
@@ -1575,6 +1586,10 @@ enum nl80211_attrs { | |||
1575 | * @NL80211_IFTYPE_MESH_POINT: mesh point | 1586 | * @NL80211_IFTYPE_MESH_POINT: mesh point |
1576 | * @NL80211_IFTYPE_P2P_CLIENT: P2P client | 1587 | * @NL80211_IFTYPE_P2P_CLIENT: P2P client |
1577 | * @NL80211_IFTYPE_P2P_GO: P2P group owner | 1588 | * @NL80211_IFTYPE_P2P_GO: P2P group owner |
1589 | * @NL80211_IFTYPE_P2P_DEVICE: P2P device interface type, this is not a netdev | ||
1590 | * and therefore can't be created in the normal ways, use the | ||
1591 | * %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE | ||
1592 | * commands to create and destroy one | ||
1578 | * @NL80211_IFTYPE_MAX: highest interface type number currently defined | 1593 | * @NL80211_IFTYPE_MAX: highest interface type number currently defined |
1579 | * @NUM_NL80211_IFTYPES: number of defined interface types | 1594 | * @NUM_NL80211_IFTYPES: number of defined interface types |
1580 | * | 1595 | * |
@@ -1593,6 +1608,7 @@ enum nl80211_iftype { | |||
1593 | NL80211_IFTYPE_MESH_POINT, | 1608 | NL80211_IFTYPE_MESH_POINT, |
1594 | NL80211_IFTYPE_P2P_CLIENT, | 1609 | NL80211_IFTYPE_P2P_CLIENT, |
1595 | NL80211_IFTYPE_P2P_GO, | 1610 | NL80211_IFTYPE_P2P_GO, |
1611 | NL80211_IFTYPE_P2P_DEVICE, | ||
1596 | 1612 | ||
1597 | /* keep last */ | 1613 | /* keep last */ |
1598 | NUM_NL80211_IFTYPES, | 1614 | NUM_NL80211_IFTYPES, |
@@ -2994,12 +3010,18 @@ enum nl80211_ap_sme_features { | |||
2994 | * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested | 3010 | * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested |
2995 | * to work properly to suppport receiving regulatory hints from | 3011 | * to work properly to suppport receiving regulatory hints from |
2996 | * cellular base stations. | 3012 | * cellular base stations. |
3013 | * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: If this is set, an active | ||
3014 | * P2P Device (%NL80211_IFTYPE_P2P_DEVICE) requires its own channel | ||
3015 | * in the interface combinations, even when it's only used for scan | ||
3016 | * and remain-on-channel. This could be due to, for example, the | ||
3017 | * remain-on-channel implementation requiring a channel context. | ||
2997 | */ | 3018 | */ |
2998 | enum nl80211_feature_flags { | 3019 | enum nl80211_feature_flags { |
2999 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, | 3020 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, |
3000 | NL80211_FEATURE_HT_IBSS = 1 << 1, | 3021 | NL80211_FEATURE_HT_IBSS = 1 << 1, |
3001 | NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, | 3022 | NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, |
3002 | NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3, | 3023 | NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3, |
3024 | NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL = 1 << 4, | ||
3003 | }; | 3025 | }; |
3004 | 3026 | ||
3005 | /** | 3027 | /** |
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index 6fdf02737e9d..0ec590bb3611 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
@@ -354,6 +354,37 @@ static inline bool rfkill_blocked(struct rfkill *rfkill) | |||
354 | } | 354 | } |
355 | #endif /* RFKILL || RFKILL_MODULE */ | 355 | #endif /* RFKILL || RFKILL_MODULE */ |
356 | 356 | ||
357 | |||
358 | #ifdef CONFIG_RFKILL_LEDS | ||
359 | /** | ||
360 | * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED. | ||
361 | * This function might return a NULL pointer if registering of the | ||
362 | * LED trigger failed. Use this as "default_trigger" for the LED. | ||
363 | */ | ||
364 | const char *rfkill_get_led_trigger_name(struct rfkill *rfkill); | ||
365 | |||
366 | /** | ||
367 | * rfkill_set_led_trigger_name -- set the LED trigger name | ||
368 | * @rfkill: rfkill struct | ||
369 | * @name: LED trigger name | ||
370 | * | ||
371 | * This function sets the LED trigger name of the radio LED | ||
372 | * trigger that rfkill creates. It is optional, but if called | ||
373 | * must be called before rfkill_register() to be effective. | ||
374 | */ | ||
375 | void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name); | ||
376 | #else | ||
377 | static inline const char *rfkill_get_led_trigger_name(struct rfkill *rfkill) | ||
378 | { | ||
379 | return NULL; | ||
380 | } | ||
381 | |||
382 | static inline void | ||
383 | rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name) | ||
384 | { | ||
385 | } | ||
386 | #endif | ||
387 | |||
357 | #endif /* __KERNEL__ */ | 388 | #endif /* __KERNEL__ */ |
358 | 389 | ||
359 | #endif /* RFKILL_H */ | 390 | #endif /* RFKILL_H */ |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 3d254e10ff30..ba2e6160fad1 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1439,7 +1439,8 @@ struct cfg80211_gtk_rekey_data { | |||
1439 | * @add_virtual_intf: create a new virtual interface with the given name, | 1439 | * @add_virtual_intf: create a new virtual interface with the given name, |
1440 | * must set the struct wireless_dev's iftype. Beware: You must create | 1440 | * must set the struct wireless_dev's iftype. Beware: You must create |
1441 | * the new netdev in the wiphy's network namespace! Returns the struct | 1441 | * the new netdev in the wiphy's network namespace! Returns the struct |
1442 | * wireless_dev, or an ERR_PTR. | 1442 | * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must |
1443 | * also set the address member in the wdev. | ||
1443 | * | 1444 | * |
1444 | * @del_virtual_intf: remove the virtual interface | 1445 | * @del_virtual_intf: remove the virtual interface |
1445 | * | 1446 | * |
@@ -1618,6 +1619,9 @@ struct cfg80211_gtk_rekey_data { | |||
1618 | * @get_channel: Get the current operating channel for the virtual interface. | 1619 | * @get_channel: Get the current operating channel for the virtual interface. |
1619 | * For monitor interfaces, it should return %NULL unless there's a single | 1620 | * For monitor interfaces, it should return %NULL unless there's a single |
1620 | * current monitoring channel. | 1621 | * current monitoring channel. |
1622 | * | ||
1623 | * @start_p2p_device: Start the given P2P device. | ||
1624 | * @stop_p2p_device: Stop the given P2P device. | ||
1621 | */ | 1625 | */ |
1622 | struct cfg80211_ops { | 1626 | struct cfg80211_ops { |
1623 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); | 1627 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); |
@@ -1834,6 +1838,11 @@ struct cfg80211_ops { | |||
1834 | (*get_channel)(struct wiphy *wiphy, | 1838 | (*get_channel)(struct wiphy *wiphy, |
1835 | struct wireless_dev *wdev, | 1839 | struct wireless_dev *wdev, |
1836 | enum nl80211_channel_type *type); | 1840 | enum nl80211_channel_type *type); |
1841 | |||
1842 | int (*start_p2p_device)(struct wiphy *wiphy, | ||
1843 | struct wireless_dev *wdev); | ||
1844 | void (*stop_p2p_device)(struct wiphy *wiphy, | ||
1845 | struct wireless_dev *wdev); | ||
1837 | }; | 1846 | }; |
1838 | 1847 | ||
1839 | /* | 1848 | /* |
@@ -2397,6 +2406,8 @@ struct cfg80211_cached_keys; | |||
2397 | * @cleanup_work: work struct used for cleanup that can't be done directly | 2406 | * @cleanup_work: work struct used for cleanup that can't be done directly |
2398 | * @beacon_interval: beacon interval used on this device for transmitting | 2407 | * @beacon_interval: beacon interval used on this device for transmitting |
2399 | * beacons, 0 when not valid | 2408 | * beacons, 0 when not valid |
2409 | * @address: The address for this device, valid only if @netdev is %NULL | ||
2410 | * @p2p_started: true if this is a P2P Device that has been started | ||
2400 | */ | 2411 | */ |
2401 | struct wireless_dev { | 2412 | struct wireless_dev { |
2402 | struct wiphy *wiphy; | 2413 | struct wiphy *wiphy; |
@@ -2415,7 +2426,9 @@ struct wireless_dev { | |||
2415 | 2426 | ||
2416 | struct work_struct cleanup_work; | 2427 | struct work_struct cleanup_work; |
2417 | 2428 | ||
2418 | bool use_4addr; | 2429 | bool use_4addr, p2p_started; |
2430 | |||
2431 | u8 address[ETH_ALEN] __aligned(sizeof(u16)); | ||
2419 | 2432 | ||
2420 | /* currently used for IBSS and SME - might be rearranged later */ | 2433 | /* currently used for IBSS and SME - might be rearranged later */ |
2421 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | 2434 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
@@ -2463,6 +2476,13 @@ struct wireless_dev { | |||
2463 | #endif | 2476 | #endif |
2464 | }; | 2477 | }; |
2465 | 2478 | ||
2479 | static inline u8 *wdev_address(struct wireless_dev *wdev) | ||
2480 | { | ||
2481 | if (wdev->netdev) | ||
2482 | return wdev->netdev->dev_addr; | ||
2483 | return wdev->address; | ||
2484 | } | ||
2485 | |||
2466 | /** | 2486 | /** |
2467 | * wdev_priv - return wiphy priv from wireless_dev | 2487 | * wdev_priv - return wiphy priv from wireless_dev |
2468 | * | 2488 | * |
@@ -3530,6 +3550,22 @@ void cfg80211_ch_switch_notify(struct net_device *dev, int freq, | |||
3530 | */ | 3550 | */ |
3531 | u32 cfg80211_calculate_bitrate(struct rate_info *rate); | 3551 | u32 cfg80211_calculate_bitrate(struct rate_info *rate); |
3532 | 3552 | ||
3553 | /** | ||
3554 | * cfg80211_unregister_wdev - remove the given wdev | ||
3555 | * @wdev: struct wireless_dev to remove | ||
3556 | * | ||
3557 | * Call this function only for wdevs that have no netdev assigned, | ||
3558 | * e.g. P2P Devices. It removes the device from the list so that | ||
3559 | * it can no longer be used. It is necessary to call this function | ||
3560 | * even when cfg80211 requests the removal of the interface by | ||
3561 | * calling the del_virtual_intf() callback. The function must also | ||
3562 | * be called when the driver wishes to unregister the wdev, e.g. | ||
3563 | * when the device is unbound from the driver. | ||
3564 | * | ||
3565 | * Requires the RTNL to be held. | ||
3566 | */ | ||
3567 | void cfg80211_unregister_wdev(struct wireless_dev *wdev); | ||
3568 | |||
3533 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 3569 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
3534 | 3570 | ||
3535 | /* wiphy_printk helpers, similar to dev_printk */ | 3571 | /* wiphy_printk helpers, similar to dev_printk */ |
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h index 71392545d0a1..7f0df133d119 100644 --- a/include/net/ieee80211_radiotap.h +++ b/include/net/ieee80211_radiotap.h | |||
@@ -183,6 +183,9 @@ struct ieee80211_radiotap_header { | |||
183 | * Contains a bitmap of known fields/flags, the flags, and | 183 | * Contains a bitmap of known fields/flags, the flags, and |
184 | * the MCS index. | 184 | * the MCS index. |
185 | * | 185 | * |
186 | * IEEE80211_RADIOTAP_AMPDU_STATUS u32, u16, u8, u8 unitless | ||
187 | * | ||
188 | * Contains the AMPDU information for the subframe. | ||
186 | */ | 189 | */ |
187 | enum ieee80211_radiotap_type { | 190 | enum ieee80211_radiotap_type { |
188 | IEEE80211_RADIOTAP_TSFT = 0, | 191 | IEEE80211_RADIOTAP_TSFT = 0, |
@@ -205,6 +208,7 @@ enum ieee80211_radiotap_type { | |||
205 | IEEE80211_RADIOTAP_DATA_RETRIES = 17, | 208 | IEEE80211_RADIOTAP_DATA_RETRIES = 17, |
206 | 209 | ||
207 | IEEE80211_RADIOTAP_MCS = 19, | 210 | IEEE80211_RADIOTAP_MCS = 19, |
211 | IEEE80211_RADIOTAP_AMPDU_STATUS = 20, | ||
208 | 212 | ||
209 | /* valid in every it_present bitmap, even vendor namespaces */ | 213 | /* valid in every it_present bitmap, even vendor namespaces */ |
210 | IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, | 214 | IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, |
@@ -270,6 +274,13 @@ enum ieee80211_radiotap_type { | |||
270 | #define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08 | 274 | #define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08 |
271 | #define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 | 275 | #define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 |
272 | 276 | ||
277 | /* For IEEE80211_RADIOTAP_AMPDU_STATUS */ | ||
278 | #define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN 0x0001 | ||
279 | #define IEEE80211_RADIOTAP_AMPDU_IS_ZEROLEN 0x0002 | ||
280 | #define IEEE80211_RADIOTAP_AMPDU_LAST_KNOWN 0x0004 | ||
281 | #define IEEE80211_RADIOTAP_AMPDU_IS_LAST 0x0008 | ||
282 | #define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR 0x0010 | ||
283 | #define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN 0x0020 | ||
273 | 284 | ||
274 | /* helpers */ | 285 | /* helpers */ |
275 | static inline int ieee80211_get_radiotap_len(unsigned char *data) | 286 | static inline int ieee80211_get_radiotap_len(unsigned char *data) |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index bb86aa6f98dd..71f8262fc1df 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -171,6 +171,7 @@ struct ieee80211_low_level_stats { | |||
171 | * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. | 171 | * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. |
172 | * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) | 172 | * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) |
173 | * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) | 173 | * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) |
174 | * @BSS_CHANGED_PS: PS changed for this BSS (STA mode) | ||
174 | */ | 175 | */ |
175 | enum ieee80211_bss_change { | 176 | enum ieee80211_bss_change { |
176 | BSS_CHANGED_ASSOC = 1<<0, | 177 | BSS_CHANGED_ASSOC = 1<<0, |
@@ -190,6 +191,7 @@ enum ieee80211_bss_change { | |||
190 | BSS_CHANGED_IDLE = 1<<14, | 191 | BSS_CHANGED_IDLE = 1<<14, |
191 | BSS_CHANGED_SSID = 1<<15, | 192 | BSS_CHANGED_SSID = 1<<15, |
192 | BSS_CHANGED_AP_PROBE_RESP = 1<<16, | 193 | BSS_CHANGED_AP_PROBE_RESP = 1<<16, |
194 | BSS_CHANGED_PS = 1<<17, | ||
193 | 195 | ||
194 | /* when adding here, make sure to change ieee80211_reconfig */ | 196 | /* when adding here, make sure to change ieee80211_reconfig */ |
195 | }; | 197 | }; |
@@ -266,6 +268,8 @@ enum ieee80211_rssi_event { | |||
266 | * @idle: This interface is idle. There's also a global idle flag in the | 268 | * @idle: This interface is idle. There's also a global idle flag in the |
267 | * hardware config which may be more appropriate depending on what | 269 | * hardware config which may be more appropriate depending on what |
268 | * your driver/device needs to do. | 270 | * your driver/device needs to do. |
271 | * @ps: power-save mode (STA only). This flag is NOT affected by | ||
272 | * offchannel/dynamic_ps operations. | ||
269 | * @ssid: The SSID of the current vif. Only valid in AP-mode. | 273 | * @ssid: The SSID of the current vif. Only valid in AP-mode. |
270 | * @ssid_len: Length of SSID given in @ssid. | 274 | * @ssid_len: Length of SSID given in @ssid. |
271 | * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. | 275 | * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. |
@@ -296,6 +300,7 @@ struct ieee80211_bss_conf { | |||
296 | bool arp_filter_enabled; | 300 | bool arp_filter_enabled; |
297 | bool qos; | 301 | bool qos; |
298 | bool idle; | 302 | bool idle; |
303 | bool ps; | ||
299 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | 304 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
300 | size_t ssid_len; | 305 | size_t ssid_len; |
301 | bool hidden_ssid; | 306 | bool hidden_ssid; |
@@ -522,9 +527,6 @@ struct ieee80211_tx_rate { | |||
522 | * (2) driver internal use (if applicable) | 527 | * (2) driver internal use (if applicable) |
523 | * (3) TX status information - driver tells mac80211 what happened | 528 | * (3) TX status information - driver tells mac80211 what happened |
524 | * | 529 | * |
525 | * The TX control's sta pointer is only valid during the ->tx call, | ||
526 | * it may be NULL. | ||
527 | * | ||
528 | * @flags: transmit info flags, defined above | 530 | * @flags: transmit info flags, defined above |
529 | * @band: the band to transmit on (use for checking for races) | 531 | * @band: the band to transmit on (use for checking for races) |
530 | * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC | 532 | * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC |
@@ -555,6 +557,7 @@ struct ieee80211_tx_info { | |||
555 | struct ieee80211_tx_rate rates[ | 557 | struct ieee80211_tx_rate rates[ |
556 | IEEE80211_TX_MAX_RATES]; | 558 | IEEE80211_TX_MAX_RATES]; |
557 | s8 rts_cts_rate_idx; | 559 | s8 rts_cts_rate_idx; |
560 | /* 3 bytes free */ | ||
558 | }; | 561 | }; |
559 | /* only needed before rate control */ | 562 | /* only needed before rate control */ |
560 | unsigned long jiffies; | 563 | unsigned long jiffies; |
@@ -562,7 +565,7 @@ struct ieee80211_tx_info { | |||
562 | /* NB: vif can be NULL for injected frames */ | 565 | /* NB: vif can be NULL for injected frames */ |
563 | struct ieee80211_vif *vif; | 566 | struct ieee80211_vif *vif; |
564 | struct ieee80211_key_conf *hw_key; | 567 | struct ieee80211_key_conf *hw_key; |
565 | struct ieee80211_sta *sta; | 568 | /* 8 bytes free */ |
566 | } control; | 569 | } control; |
567 | struct { | 570 | struct { |
568 | struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; | 571 | struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; |
@@ -673,21 +676,41 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
673 | * @RX_FLAG_HT_GF: This frame was received in a HT-greenfield transmission, if | 676 | * @RX_FLAG_HT_GF: This frame was received in a HT-greenfield transmission, if |
674 | * the driver fills this value it should add %IEEE80211_RADIOTAP_MCS_HAVE_FMT | 677 | * the driver fills this value it should add %IEEE80211_RADIOTAP_MCS_HAVE_FMT |
675 | * to hw.radiotap_mcs_details to advertise that fact | 678 | * to hw.radiotap_mcs_details to advertise that fact |
679 | * @RX_FLAG_AMPDU_DETAILS: A-MPDU details are known, in particular the reference | ||
680 | * number (@ampdu_reference) must be populated and be a distinct number for | ||
681 | * each A-MPDU | ||
682 | * @RX_FLAG_AMPDU_REPORT_ZEROLEN: driver reports 0-length subframes | ||
683 | * @RX_FLAG_AMPDU_IS_ZEROLEN: This is a zero-length subframe, for | ||
684 | * monitoring purposes only | ||
685 | * @RX_FLAG_AMPDU_LAST_KNOWN: last subframe is known, should be set on all | ||
686 | * subframes of a single A-MPDU | ||
687 | * @RX_FLAG_AMPDU_IS_LAST: this subframe is the last subframe of the A-MPDU | ||
688 | * @RX_FLAG_AMPDU_DELIM_CRC_ERROR: A delimiter CRC error has been detected | ||
689 | * on this subframe | ||
690 | * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC | ||
691 | * is stored in the @ampdu_delimiter_crc field) | ||
676 | */ | 692 | */ |
677 | enum mac80211_rx_flags { | 693 | enum mac80211_rx_flags { |
678 | RX_FLAG_MMIC_ERROR = 1<<0, | 694 | RX_FLAG_MMIC_ERROR = BIT(0), |
679 | RX_FLAG_DECRYPTED = 1<<1, | 695 | RX_FLAG_DECRYPTED = BIT(1), |
680 | RX_FLAG_MMIC_STRIPPED = 1<<3, | 696 | RX_FLAG_MMIC_STRIPPED = BIT(3), |
681 | RX_FLAG_IV_STRIPPED = 1<<4, | 697 | RX_FLAG_IV_STRIPPED = BIT(4), |
682 | RX_FLAG_FAILED_FCS_CRC = 1<<5, | 698 | RX_FLAG_FAILED_FCS_CRC = BIT(5), |
683 | RX_FLAG_FAILED_PLCP_CRC = 1<<6, | 699 | RX_FLAG_FAILED_PLCP_CRC = BIT(6), |
684 | RX_FLAG_MACTIME_MPDU = 1<<7, | 700 | RX_FLAG_MACTIME_MPDU = BIT(7), |
685 | RX_FLAG_SHORTPRE = 1<<8, | 701 | RX_FLAG_SHORTPRE = BIT(8), |
686 | RX_FLAG_HT = 1<<9, | 702 | RX_FLAG_HT = BIT(9), |
687 | RX_FLAG_40MHZ = 1<<10, | 703 | RX_FLAG_40MHZ = BIT(10), |
688 | RX_FLAG_SHORT_GI = 1<<11, | 704 | RX_FLAG_SHORT_GI = BIT(11), |
689 | RX_FLAG_NO_SIGNAL_VAL = 1<<12, | 705 | RX_FLAG_NO_SIGNAL_VAL = BIT(12), |
690 | RX_FLAG_HT_GF = 1<<13, | 706 | RX_FLAG_HT_GF = BIT(13), |
707 | RX_FLAG_AMPDU_DETAILS = BIT(14), | ||
708 | RX_FLAG_AMPDU_REPORT_ZEROLEN = BIT(15), | ||
709 | RX_FLAG_AMPDU_IS_ZEROLEN = BIT(16), | ||
710 | RX_FLAG_AMPDU_LAST_KNOWN = BIT(17), | ||
711 | RX_FLAG_AMPDU_IS_LAST = BIT(18), | ||
712 | RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19), | ||
713 | RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20), | ||
691 | }; | 714 | }; |
692 | 715 | ||
693 | /** | 716 | /** |
@@ -711,17 +734,22 @@ enum mac80211_rx_flags { | |||
711 | * HT rates are use (RX_FLAG_HT) | 734 | * HT rates are use (RX_FLAG_HT) |
712 | * @flag: %RX_FLAG_* | 735 | * @flag: %RX_FLAG_* |
713 | * @rx_flags: internal RX flags for mac80211 | 736 | * @rx_flags: internal RX flags for mac80211 |
737 | * @ampdu_reference: A-MPDU reference number, must be a different value for | ||
738 | * each A-MPDU but the same for each subframe within one A-MPDU | ||
739 | * @ampdu_delimiter_crc: A-MPDU delimiter CRC | ||
714 | */ | 740 | */ |
715 | struct ieee80211_rx_status { | 741 | struct ieee80211_rx_status { |
716 | u64 mactime; | 742 | u64 mactime; |
717 | u32 device_timestamp; | 743 | u32 device_timestamp; |
718 | u16 flag; | 744 | u32 ampdu_reference; |
745 | u32 flag; | ||
719 | u16 freq; | 746 | u16 freq; |
720 | u8 rate_idx; | 747 | u8 rate_idx; |
721 | u8 rx_flags; | 748 | u8 rx_flags; |
722 | u8 band; | 749 | u8 band; |
723 | u8 antenna; | 750 | u8 antenna; |
724 | s8 signal; | 751 | s8 signal; |
752 | u8 ampdu_delimiter_crc; | ||
725 | }; | 753 | }; |
726 | 754 | ||
727 | /** | 755 | /** |
@@ -1074,6 +1102,16 @@ enum sta_notify_cmd { | |||
1074 | }; | 1102 | }; |
1075 | 1103 | ||
1076 | /** | 1104 | /** |
1105 | * struct ieee80211_tx_control - TX control data | ||
1106 | * | ||
1107 | * @sta: station table entry, this sta pointer may be NULL and | ||
1108 | * it is not allowed to copy the pointer, due to RCU. | ||
1109 | */ | ||
1110 | struct ieee80211_tx_control { | ||
1111 | struct ieee80211_sta *sta; | ||
1112 | }; | ||
1113 | |||
1114 | /** | ||
1077 | * enum ieee80211_hw_flags - hardware flags | 1115 | * enum ieee80211_hw_flags - hardware flags |
1078 | * | 1116 | * |
1079 | * These flags are used to indicate hardware capabilities to | 1117 | * These flags are used to indicate hardware capabilities to |
@@ -1203,6 +1241,10 @@ enum sta_notify_cmd { | |||
1203 | * queue mapping in order to use different queues (not just one per AC) | 1241 | * queue mapping in order to use different queues (not just one per AC) |
1204 | * for different virtual interfaces. See the doc section on HW queue | 1242 | * for different virtual interfaces. See the doc section on HW queue |
1205 | * control for more details. | 1243 | * control for more details. |
1244 | * | ||
1245 | * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any | ||
1246 | * P2P Interface. This will be honoured even if more than one interface | ||
1247 | * is supported. | ||
1206 | */ | 1248 | */ |
1207 | enum ieee80211_hw_flags { | 1249 | enum ieee80211_hw_flags { |
1208 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, | 1250 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, |
@@ -1230,6 +1272,7 @@ enum ieee80211_hw_flags { | |||
1230 | IEEE80211_HW_AP_LINK_PS = 1<<22, | 1272 | IEEE80211_HW_AP_LINK_PS = 1<<22, |
1231 | IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, | 1273 | IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, |
1232 | IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24, | 1274 | IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24, |
1275 | IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, | ||
1233 | }; | 1276 | }; |
1234 | 1277 | ||
1235 | /** | 1278 | /** |
@@ -1884,10 +1927,14 @@ enum ieee80211_frame_release_type { | |||
1884 | * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit | 1927 | * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit |
1885 | * to this station changed. | 1928 | * to this station changed. |
1886 | * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed. | 1929 | * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed. |
1930 | * @IEEE80211_RC_SUPP_RATES_CHANGED: The supported rate set of this peer | ||
1931 | * changed (in IBSS mode) due to discovering more information about | ||
1932 | * the peer. | ||
1887 | */ | 1933 | */ |
1888 | enum ieee80211_rate_control_changed { | 1934 | enum ieee80211_rate_control_changed { |
1889 | IEEE80211_RC_BW_CHANGED = BIT(0), | 1935 | IEEE80211_RC_BW_CHANGED = BIT(0), |
1890 | IEEE80211_RC_SMPS_CHANGED = BIT(1), | 1936 | IEEE80211_RC_SMPS_CHANGED = BIT(1), |
1937 | IEEE80211_RC_SUPP_RATES_CHANGED = BIT(2), | ||
1891 | }; | 1938 | }; |
1892 | 1939 | ||
1893 | /** | 1940 | /** |
@@ -2264,7 +2311,9 @@ enum ieee80211_rate_control_changed { | |||
2264 | * The callback is optional and can (should!) sleep. | 2311 | * The callback is optional and can (should!) sleep. |
2265 | */ | 2312 | */ |
2266 | struct ieee80211_ops { | 2313 | struct ieee80211_ops { |
2267 | void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); | 2314 | void (*tx)(struct ieee80211_hw *hw, |
2315 | struct ieee80211_tx_control *control, | ||
2316 | struct sk_buff *skb); | ||
2268 | int (*start)(struct ieee80211_hw *hw); | 2317 | int (*start)(struct ieee80211_hw *hw); |
2269 | void (*stop)(struct ieee80211_hw *hw); | 2318 | void (*stop)(struct ieee80211_hw *hw); |
2270 | #ifdef CONFIG_PM | 2319 | #ifdef CONFIG_PM |
diff --git a/net/mac80211/aes_cmac.c b/net/mac80211/aes_cmac.c index 8dfd70d8fcfb..a04752e91023 100644 --- a/net/mac80211/aes_cmac.c +++ b/net/mac80211/aes_cmac.c | |||
@@ -38,14 +38,10 @@ static void gf_mulx(u8 *pad) | |||
38 | static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem, | 38 | static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem, |
39 | const u8 *addr[], const size_t *len, u8 *mac) | 39 | const u8 *addr[], const size_t *len, u8 *mac) |
40 | { | 40 | { |
41 | u8 scratch[2 * AES_BLOCK_SIZE]; | 41 | u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE]; |
42 | u8 *cbc, *pad; | ||
43 | const u8 *pos, *end; | 42 | const u8 *pos, *end; |
44 | size_t i, e, left, total_len; | 43 | size_t i, e, left, total_len; |
45 | 44 | ||
46 | cbc = scratch; | ||
47 | pad = scratch + AES_BLOCK_SIZE; | ||
48 | |||
49 | memset(cbc, 0, AES_BLOCK_SIZE); | 45 | memset(cbc, 0, AES_BLOCK_SIZE); |
50 | 46 | ||
51 | total_len = 0; | 47 | total_len = 0; |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index d41974aacf51..929f897a8ded 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -102,6 +102,18 @@ static int ieee80211_change_iface(struct wiphy *wiphy, | |||
102 | return 0; | 102 | return 0; |
103 | } | 103 | } |
104 | 104 | ||
105 | static int ieee80211_start_p2p_device(struct wiphy *wiphy, | ||
106 | struct wireless_dev *wdev) | ||
107 | { | ||
108 | return ieee80211_do_open(wdev, true); | ||
109 | } | ||
110 | |||
111 | static void ieee80211_stop_p2p_device(struct wiphy *wiphy, | ||
112 | struct wireless_dev *wdev) | ||
113 | { | ||
114 | ieee80211_sdata_stop(IEEE80211_WDEV_TO_SUB_IF(wdev)); | ||
115 | } | ||
116 | |||
105 | static int ieee80211_set_noack_map(struct wiphy *wiphy, | 117 | static int ieee80211_set_noack_map(struct wiphy *wiphy, |
106 | struct net_device *dev, | 118 | struct net_device *dev, |
107 | u16 noack_map) | 119 | u16 noack_map) |
@@ -330,7 +342,7 @@ static void rate_idx_to_bitrate(struct rate_info *rate, struct sta_info *sta, in | |||
330 | if (!(rate->flags & RATE_INFO_FLAGS_MCS)) { | 342 | if (!(rate->flags & RATE_INFO_FLAGS_MCS)) { |
331 | struct ieee80211_supported_band *sband; | 343 | struct ieee80211_supported_band *sband; |
332 | sband = sta->local->hw.wiphy->bands[ | 344 | sband = sta->local->hw.wiphy->bands[ |
333 | sta->local->hw.conf.channel->band]; | 345 | sta->local->oper_channel->band]; |
334 | rate->legacy = sband->bitrates[idx].bitrate; | 346 | rate->legacy = sband->bitrates[idx].bitrate; |
335 | } else | 347 | } else |
336 | rate->mcs = idx; | 348 | rate->mcs = idx; |
@@ -725,25 +737,23 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy, | |||
725 | static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, | 737 | static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, |
726 | const u8 *resp, size_t resp_len) | 738 | const u8 *resp, size_t resp_len) |
727 | { | 739 | { |
728 | struct sk_buff *new, *old; | 740 | struct probe_resp *new, *old; |
729 | 741 | ||
730 | if (!resp || !resp_len) | 742 | if (!resp || !resp_len) |
731 | return 1; | 743 | return 1; |
732 | 744 | ||
733 | old = rtnl_dereference(sdata->u.ap.probe_resp); | 745 | old = rtnl_dereference(sdata->u.ap.probe_resp); |
734 | 746 | ||
735 | new = dev_alloc_skb(resp_len); | 747 | new = kzalloc(sizeof(struct probe_resp) + resp_len, GFP_KERNEL); |
736 | if (!new) | 748 | if (!new) |
737 | return -ENOMEM; | 749 | return -ENOMEM; |
738 | 750 | ||
739 | memcpy(skb_put(new, resp_len), resp, resp_len); | 751 | new->len = resp_len; |
752 | memcpy(new->data, resp, resp_len); | ||
740 | 753 | ||
741 | rcu_assign_pointer(sdata->u.ap.probe_resp, new); | 754 | rcu_assign_pointer(sdata->u.ap.probe_resp, new); |
742 | if (old) { | 755 | if (old) |
743 | /* TODO: use call_rcu() */ | 756 | kfree_rcu(old, rcu_head); |
744 | synchronize_rcu(); | ||
745 | dev_kfree_skb(old); | ||
746 | } | ||
747 | 757 | ||
748 | return 0; | 758 | return 0; |
749 | } | 759 | } |
@@ -950,7 +960,7 @@ static void ieee80211_send_layer2_update(struct sta_info *sta) | |||
950 | /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) | 960 | /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) |
951 | * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ | 961 | * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ |
952 | 962 | ||
953 | memset(msg->da, 0xff, ETH_ALEN); | 963 | eth_broadcast_addr(msg->da); |
954 | memcpy(msg->sa, sta->sta.addr, ETH_ALEN); | 964 | memcpy(msg->sa, sta->sta.addr, ETH_ALEN); |
955 | msg->len = htons(6); | 965 | msg->len = htons(6); |
956 | msg->dsap = 0; | 966 | msg->dsap = 0; |
@@ -1285,9 +1295,10 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
1285 | mutex_unlock(&local->sta_mtx); | 1295 | mutex_unlock(&local->sta_mtx); |
1286 | 1296 | ||
1287 | if (sdata->vif.type == NL80211_IFTYPE_STATION && | 1297 | if (sdata->vif.type == NL80211_IFTYPE_STATION && |
1288 | params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) | 1298 | params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) { |
1289 | ieee80211_recalc_ps(local, -1); | 1299 | ieee80211_recalc_ps(local, -1); |
1290 | 1300 | ieee80211_recalc_ps_vif(sdata); | |
1301 | } | ||
1291 | return 0; | 1302 | return 0; |
1292 | } | 1303 | } |
1293 | 1304 | ||
@@ -1661,7 +1672,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy, | |||
1661 | } | 1672 | } |
1662 | 1673 | ||
1663 | if (!sdata->vif.bss_conf.use_short_slot && | 1674 | if (!sdata->vif.bss_conf.use_short_slot && |
1664 | sdata->local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) { | 1675 | sdata->local->oper_channel->band == IEEE80211_BAND_5GHZ) { |
1665 | sdata->vif.bss_conf.use_short_slot = true; | 1676 | sdata->vif.bss_conf.use_short_slot = true; |
1666 | changed |= BSS_CHANGED_ERP_SLOT; | 1677 | changed |= BSS_CHANGED_ERP_SLOT; |
1667 | } | 1678 | } |
@@ -1775,6 +1786,7 @@ static int ieee80211_scan(struct wiphy *wiphy, | |||
1775 | case NL80211_IFTYPE_ADHOC: | 1786 | case NL80211_IFTYPE_ADHOC: |
1776 | case NL80211_IFTYPE_MESH_POINT: | 1787 | case NL80211_IFTYPE_MESH_POINT: |
1777 | case NL80211_IFTYPE_P2P_CLIENT: | 1788 | case NL80211_IFTYPE_P2P_CLIENT: |
1789 | case NL80211_IFTYPE_P2P_DEVICE: | ||
1778 | break; | 1790 | break; |
1779 | case NL80211_IFTYPE_P2P_GO: | 1791 | case NL80211_IFTYPE_P2P_GO: |
1780 | if (sdata->local->ops->hw_scan) | 1792 | if (sdata->local->ops->hw_scan) |
@@ -1927,7 +1939,7 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, | |||
1927 | enum nl80211_tx_power_setting type, int mbm) | 1939 | enum nl80211_tx_power_setting type, int mbm) |
1928 | { | 1940 | { |
1929 | struct ieee80211_local *local = wiphy_priv(wiphy); | 1941 | struct ieee80211_local *local = wiphy_priv(wiphy); |
1930 | struct ieee80211_channel *chan = local->hw.conf.channel; | 1942 | struct ieee80211_channel *chan = local->oper_channel; |
1931 | u32 changes = 0; | 1943 | u32 changes = 0; |
1932 | 1944 | ||
1933 | switch (type) { | 1945 | switch (type) { |
@@ -2079,6 +2091,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
2079 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); | 2091 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); |
2080 | 2092 | ||
2081 | ieee80211_recalc_ps(local, -1); | 2093 | ieee80211_recalc_ps(local, -1); |
2094 | ieee80211_recalc_ps_vif(sdata); | ||
2082 | 2095 | ||
2083 | return 0; | 2096 | return 0; |
2084 | } | 2097 | } |
@@ -2461,6 +2474,9 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
2461 | if (!sdata->u.mgd.associated) | 2474 | if (!sdata->u.mgd.associated) |
2462 | need_offchan = true; | 2475 | need_offchan = true; |
2463 | break; | 2476 | break; |
2477 | case NL80211_IFTYPE_P2P_DEVICE: | ||
2478 | need_offchan = true; | ||
2479 | break; | ||
2464 | default: | 2480 | default: |
2465 | return -EOPNOTSUPP; | 2481 | return -EOPNOTSUPP; |
2466 | } | 2482 | } |
@@ -2653,6 +2669,7 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, | |||
2653 | u16 status_code, struct sk_buff *skb) | 2669 | u16 status_code, struct sk_buff *skb) |
2654 | { | 2670 | { |
2655 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2671 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2672 | struct ieee80211_local *local = sdata->local; | ||
2656 | struct ieee80211_tdls_data *tf; | 2673 | struct ieee80211_tdls_data *tf; |
2657 | 2674 | ||
2658 | tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); | 2675 | tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); |
@@ -2672,8 +2689,10 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, | |||
2672 | tf->u.setup_req.capability = | 2689 | tf->u.setup_req.capability = |
2673 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); | 2690 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); |
2674 | 2691 | ||
2675 | ieee80211_add_srates_ie(sdata, skb, false); | 2692 | ieee80211_add_srates_ie(sdata, skb, false, |
2676 | ieee80211_add_ext_srates_ie(sdata, skb, false); | 2693 | local->oper_channel->band); |
2694 | ieee80211_add_ext_srates_ie(sdata, skb, false, | ||
2695 | local->oper_channel->band); | ||
2677 | ieee80211_tdls_add_ext_capab(skb); | 2696 | ieee80211_tdls_add_ext_capab(skb); |
2678 | break; | 2697 | break; |
2679 | case WLAN_TDLS_SETUP_RESPONSE: | 2698 | case WLAN_TDLS_SETUP_RESPONSE: |
@@ -2686,8 +2705,10 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, | |||
2686 | tf->u.setup_resp.capability = | 2705 | tf->u.setup_resp.capability = |
2687 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); | 2706 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); |
2688 | 2707 | ||
2689 | ieee80211_add_srates_ie(sdata, skb, false); | 2708 | ieee80211_add_srates_ie(sdata, skb, false, |
2690 | ieee80211_add_ext_srates_ie(sdata, skb, false); | 2709 | local->oper_channel->band); |
2710 | ieee80211_add_ext_srates_ie(sdata, skb, false, | ||
2711 | local->oper_channel->band); | ||
2691 | ieee80211_tdls_add_ext_capab(skb); | 2712 | ieee80211_tdls_add_ext_capab(skb); |
2692 | break; | 2713 | break; |
2693 | case WLAN_TDLS_SETUP_CONFIRM: | 2714 | case WLAN_TDLS_SETUP_CONFIRM: |
@@ -2725,6 +2746,7 @@ ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev, | |||
2725 | u16 status_code, struct sk_buff *skb) | 2746 | u16 status_code, struct sk_buff *skb) |
2726 | { | 2747 | { |
2727 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2748 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2749 | struct ieee80211_local *local = sdata->local; | ||
2728 | struct ieee80211_mgmt *mgmt; | 2750 | struct ieee80211_mgmt *mgmt; |
2729 | 2751 | ||
2730 | mgmt = (void *)skb_put(skb, 24); | 2752 | mgmt = (void *)skb_put(skb, 24); |
@@ -2747,8 +2769,10 @@ ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev, | |||
2747 | mgmt->u.action.u.tdls_discover_resp.capability = | 2769 | mgmt->u.action.u.tdls_discover_resp.capability = |
2748 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); | 2770 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); |
2749 | 2771 | ||
2750 | ieee80211_add_srates_ie(sdata, skb, false); | 2772 | ieee80211_add_srates_ie(sdata, skb, false, |
2751 | ieee80211_add_ext_srates_ie(sdata, skb, false); | 2773 | local->oper_channel->band); |
2774 | ieee80211_add_ext_srates_ie(sdata, skb, false, | ||
2775 | local->oper_channel->band); | ||
2752 | ieee80211_tdls_add_ext_capab(skb); | 2776 | ieee80211_tdls_add_ext_capab(skb); |
2753 | break; | 2777 | break; |
2754 | default: | 2778 | default: |
@@ -3005,6 +3029,8 @@ struct cfg80211_ops mac80211_config_ops = { | |||
3005 | .add_virtual_intf = ieee80211_add_iface, | 3029 | .add_virtual_intf = ieee80211_add_iface, |
3006 | .del_virtual_intf = ieee80211_del_iface, | 3030 | .del_virtual_intf = ieee80211_del_iface, |
3007 | .change_virtual_intf = ieee80211_change_iface, | 3031 | .change_virtual_intf = ieee80211_change_iface, |
3032 | .start_p2p_device = ieee80211_start_p2p_device, | ||
3033 | .stop_p2p_device = ieee80211_stop_p2p_device, | ||
3008 | .add_key = ieee80211_add_key, | 3034 | .add_key = ieee80211_add_key, |
3009 | .del_key = ieee80211_del_key, | 3035 | .del_key = ieee80211_del_key, |
3010 | .get_key = ieee80211_get_key, | 3036 | .get_key = ieee80211_get_key, |
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index b8dfb440c8ef..97173f8144d4 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -63,8 +63,6 @@ DEBUGFS_READONLY_FILE(user_power, "%d", | |||
63 | local->user_power_level); | 63 | local->user_power_level); |
64 | DEBUGFS_READONLY_FILE(power, "%d", | 64 | DEBUGFS_READONLY_FILE(power, "%d", |
65 | local->hw.conf.power_level); | 65 | local->hw.conf.power_level); |
66 | DEBUGFS_READONLY_FILE(frequency, "%d", | ||
67 | local->hw.conf.channel->center_freq); | ||
68 | DEBUGFS_READONLY_FILE(total_ps_buffered, "%d", | 66 | DEBUGFS_READONLY_FILE(total_ps_buffered, "%d", |
69 | local->total_ps_buffered); | 67 | local->total_ps_buffered); |
70 | DEBUGFS_READONLY_FILE(wep_iv, "%#08x", | 68 | DEBUGFS_READONLY_FILE(wep_iv, "%#08x", |
@@ -91,33 +89,6 @@ static const struct file_operations reset_ops = { | |||
91 | .llseek = noop_llseek, | 89 | .llseek = noop_llseek, |
92 | }; | 90 | }; |
93 | 91 | ||
94 | static ssize_t channel_type_read(struct file *file, char __user *user_buf, | ||
95 | size_t count, loff_t *ppos) | ||
96 | { | ||
97 | struct ieee80211_local *local = file->private_data; | ||
98 | const char *buf; | ||
99 | |||
100 | switch (local->hw.conf.channel_type) { | ||
101 | case NL80211_CHAN_NO_HT: | ||
102 | buf = "no ht\n"; | ||
103 | break; | ||
104 | case NL80211_CHAN_HT20: | ||
105 | buf = "ht20\n"; | ||
106 | break; | ||
107 | case NL80211_CHAN_HT40MINUS: | ||
108 | buf = "ht40-\n"; | ||
109 | break; | ||
110 | case NL80211_CHAN_HT40PLUS: | ||
111 | buf = "ht40+\n"; | ||
112 | break; | ||
113 | default: | ||
114 | buf = "???"; | ||
115 | break; | ||
116 | } | ||
117 | |||
118 | return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); | ||
119 | } | ||
120 | |||
121 | static ssize_t hwflags_read(struct file *file, char __user *user_buf, | 92 | static ssize_t hwflags_read(struct file *file, char __user *user_buf, |
122 | size_t count, loff_t *ppos) | 93 | size_t count, loff_t *ppos) |
123 | { | 94 | { |
@@ -205,7 +176,6 @@ static ssize_t queues_read(struct file *file, char __user *user_buf, | |||
205 | } | 176 | } |
206 | 177 | ||
207 | DEBUGFS_READONLY_FILE_OPS(hwflags); | 178 | DEBUGFS_READONLY_FILE_OPS(hwflags); |
208 | DEBUGFS_READONLY_FILE_OPS(channel_type); | ||
209 | DEBUGFS_READONLY_FILE_OPS(queues); | 179 | DEBUGFS_READONLY_FILE_OPS(queues); |
210 | 180 | ||
211 | /* statistics stuff */ | 181 | /* statistics stuff */ |
@@ -272,12 +242,10 @@ void debugfs_hw_add(struct ieee80211_local *local) | |||
272 | 242 | ||
273 | local->debugfs.keys = debugfs_create_dir("keys", phyd); | 243 | local->debugfs.keys = debugfs_create_dir("keys", phyd); |
274 | 244 | ||
275 | DEBUGFS_ADD(frequency); | ||
276 | DEBUGFS_ADD(total_ps_buffered); | 245 | DEBUGFS_ADD(total_ps_buffered); |
277 | DEBUGFS_ADD(wep_iv); | 246 | DEBUGFS_ADD(wep_iv); |
278 | DEBUGFS_ADD(queues); | 247 | DEBUGFS_ADD(queues); |
279 | DEBUGFS_ADD_MODE(reset, 0200); | 248 | DEBUGFS_ADD_MODE(reset, 0200); |
280 | DEBUGFS_ADD(channel_type); | ||
281 | DEBUGFS_ADD(hwflags); | 249 | DEBUGFS_ADD(hwflags); |
282 | DEBUGFS_ADD(user_power); | 250 | DEBUGFS_ADD(user_power); |
283 | DEBUGFS_ADD(power); | 251 | DEBUGFS_ADD(power); |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index df9203199102..da9003b20004 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -9,7 +9,7 @@ static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata) | |||
9 | { | 9 | { |
10 | WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER), | 10 | WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER), |
11 | "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", | 11 | "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", |
12 | sdata->dev->name, sdata->flags); | 12 | sdata->dev ? sdata->dev->name : sdata->name, sdata->flags); |
13 | } | 13 | } |
14 | 14 | ||
15 | static inline struct ieee80211_sub_if_data * | 15 | static inline struct ieee80211_sub_if_data * |
@@ -22,9 +22,11 @@ get_bss_sdata(struct ieee80211_sub_if_data *sdata) | |||
22 | return sdata; | 22 | return sdata; |
23 | } | 23 | } |
24 | 24 | ||
25 | static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb) | 25 | static inline void drv_tx(struct ieee80211_local *local, |
26 | struct ieee80211_tx_control *control, | ||
27 | struct sk_buff *skb) | ||
26 | { | 28 | { |
27 | local->ops->tx(&local->hw, skb); | 29 | local->ops->tx(&local->hw, control, skb); |
28 | } | 30 | } |
29 | 31 | ||
30 | static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata, | 32 | static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata, |
@@ -526,6 +528,9 @@ static inline void drv_sta_rc_update(struct ieee80211_local *local, | |||
526 | sdata = get_bss_sdata(sdata); | 528 | sdata = get_bss_sdata(sdata); |
527 | check_sdata_in_driver(sdata); | 529 | check_sdata_in_driver(sdata); |
528 | 530 | ||
531 | WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED && | ||
532 | sdata->vif.type != NL80211_IFTYPE_ADHOC); | ||
533 | |||
529 | trace_drv_sta_rc_update(local, sdata, sta, changed); | 534 | trace_drv_sta_rc_update(local, sdata, sta, changed); |
530 | if (local->ops->sta_rc_update) | 535 | if (local->ops->sta_rc_update) |
531 | local->ops->sta_rc_update(&local->hw, &sdata->vif, | 536 | local->ops->sta_rc_update(&local->hw, &sdata->vif, |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 5746d62faba1..a9d93285dba7 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -109,7 +109,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
109 | memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); | 109 | memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); |
110 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 110 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
111 | IEEE80211_STYPE_PROBE_RESP); | 111 | IEEE80211_STYPE_PROBE_RESP); |
112 | memset(mgmt->da, 0xff, ETH_ALEN); | 112 | eth_broadcast_addr(mgmt->da); |
113 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); | 113 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
114 | memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); | 114 | memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); |
115 | mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int); | 115 | mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int); |
@@ -205,7 +205,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
205 | mod_timer(&ifibss->timer, | 205 | mod_timer(&ifibss->timer, |
206 | round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL)); | 206 | round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL)); |
207 | 207 | ||
208 | bss = cfg80211_inform_bss_frame(local->hw.wiphy, local->hw.conf.channel, | 208 | bss = cfg80211_inform_bss_frame(local->hw.wiphy, chan, |
209 | mgmt, skb->len, 0, GFP_KERNEL); | 209 | mgmt, skb->len, 0, GFP_KERNEL); |
210 | cfg80211_put_bss(bss); | 210 | cfg80211_put_bss(bss); |
211 | netif_carrier_on(sdata->dev); | 211 | netif_carrier_on(sdata->dev); |
@@ -294,7 +294,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
294 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | 294 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; |
295 | struct ieee80211_local *local = sdata->local; | 295 | struct ieee80211_local *local = sdata->local; |
296 | struct sta_info *sta; | 296 | struct sta_info *sta; |
297 | int band = local->hw.conf.channel->band; | 297 | int band = local->oper_channel->band; |
298 | 298 | ||
299 | /* | 299 | /* |
300 | * XXX: Consider removing the least recently used entry and | 300 | * XXX: Consider removing the least recently used entry and |
@@ -459,8 +459,11 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
459 | } | 459 | } |
460 | } | 460 | } |
461 | 461 | ||
462 | if (sta && rates_updated) | 462 | if (sta && rates_updated) { |
463 | drv_sta_rc_update(local, sdata, &sta->sta, | ||
464 | IEEE80211_RC_SUPP_RATES_CHANGED); | ||
463 | rate_control_rate_init(sta); | 465 | rate_control_rate_init(sta); |
466 | } | ||
464 | 467 | ||
465 | rcu_read_unlock(); | 468 | rcu_read_unlock(); |
466 | } | 469 | } |
@@ -561,7 +564,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, | |||
561 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | 564 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; |
562 | struct ieee80211_local *local = sdata->local; | 565 | struct ieee80211_local *local = sdata->local; |
563 | struct sta_info *sta; | 566 | struct sta_info *sta; |
564 | int band = local->hw.conf.channel->band; | 567 | int band = local->oper_channel->band; |
565 | 568 | ||
566 | /* | 569 | /* |
567 | * XXX: Consider removing the least recently used entry and | 570 | * XXX: Consider removing the least recently used entry and |
@@ -759,7 +762,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
759 | return; | 762 | return; |
760 | } | 763 | } |
761 | sdata_info(sdata, "IBSS not allowed on %d MHz\n", | 764 | sdata_info(sdata, "IBSS not allowed on %d MHz\n", |
762 | local->hw.conf.channel->center_freq); | 765 | local->oper_channel->center_freq); |
763 | 766 | ||
764 | /* No IBSS found - decrease scan interval and continue | 767 | /* No IBSS found - decrease scan interval and continue |
765 | * scanning. */ | 768 | * scanning. */ |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index bb61f7718c4c..204bfedba306 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -193,8 +193,6 @@ struct ieee80211_tx_data { | |||
193 | struct sta_info *sta; | 193 | struct sta_info *sta; |
194 | struct ieee80211_key *key; | 194 | struct ieee80211_key *key; |
195 | 195 | ||
196 | struct ieee80211_channel *channel; | ||
197 | |||
198 | unsigned int flags; | 196 | unsigned int flags; |
199 | }; | 197 | }; |
200 | 198 | ||
@@ -274,9 +272,15 @@ struct beacon_data { | |||
274 | struct rcu_head rcu_head; | 272 | struct rcu_head rcu_head; |
275 | }; | 273 | }; |
276 | 274 | ||
275 | struct probe_resp { | ||
276 | struct rcu_head rcu_head; | ||
277 | int len; | ||
278 | u8 data[0]; | ||
279 | }; | ||
280 | |||
277 | struct ieee80211_if_ap { | 281 | struct ieee80211_if_ap { |
278 | struct beacon_data __rcu *beacon; | 282 | struct beacon_data __rcu *beacon; |
279 | struct sk_buff __rcu *probe_resp; | 283 | struct probe_resp __rcu *probe_resp; |
280 | 284 | ||
281 | struct list_head vlans; | 285 | struct list_head vlans; |
282 | 286 | ||
@@ -359,6 +363,7 @@ enum ieee80211_sta_flags { | |||
359 | IEEE80211_STA_NULLFUNC_ACKED = BIT(8), | 363 | IEEE80211_STA_NULLFUNC_ACKED = BIT(8), |
360 | IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9), | 364 | IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9), |
361 | IEEE80211_STA_DISABLE_40MHZ = BIT(10), | 365 | IEEE80211_STA_DISABLE_40MHZ = BIT(10), |
366 | IEEE80211_STA_DISABLE_VHT = BIT(11), | ||
362 | }; | 367 | }; |
363 | 368 | ||
364 | struct ieee80211_mgd_auth_data { | 369 | struct ieee80211_mgd_auth_data { |
@@ -1075,6 +1080,8 @@ struct ieee80211_local { | |||
1075 | struct idr ack_status_frames; | 1080 | struct idr ack_status_frames; |
1076 | spinlock_t ack_status_lock; | 1081 | spinlock_t ack_status_lock; |
1077 | 1082 | ||
1083 | struct ieee80211_sub_if_data __rcu *p2p_sdata; | ||
1084 | |||
1078 | /* dummy netdev for use w/ NAPI */ | 1085 | /* dummy netdev for use w/ NAPI */ |
1079 | struct net_device napi_dev; | 1086 | struct net_device napi_dev; |
1080 | 1087 | ||
@@ -1131,7 +1138,7 @@ struct ieee802_11_elems { | |||
1131 | u8 *prep; | 1138 | u8 *prep; |
1132 | u8 *perr; | 1139 | u8 *perr; |
1133 | struct ieee80211_rann_ie *rann; | 1140 | struct ieee80211_rann_ie *rann; |
1134 | u8 *ch_switch_elem; | 1141 | struct ieee80211_channel_sw_ie *ch_switch_ie; |
1135 | u8 *country_elem; | 1142 | u8 *country_elem; |
1136 | u8 *pwr_constr_elem; | 1143 | u8 *pwr_constr_elem; |
1137 | u8 *quiet_elem; /* first quite element */ | 1144 | u8 *quiet_elem; /* first quite element */ |
@@ -1157,7 +1164,6 @@ struct ieee802_11_elems { | |||
1157 | u8 preq_len; | 1164 | u8 preq_len; |
1158 | u8 prep_len; | 1165 | u8 prep_len; |
1159 | u8 perr_len; | 1166 | u8 perr_len; |
1160 | u8 ch_switch_elem_len; | ||
1161 | u8 country_elem_len; | 1167 | u8 country_elem_len; |
1162 | u8 pwr_constr_elem_len; | 1168 | u8 pwr_constr_elem_len; |
1163 | u8 quiet_elem_len; | 1169 | u8 quiet_elem_len; |
@@ -1202,6 +1208,7 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1202 | void ieee80211_send_pspoll(struct ieee80211_local *local, | 1208 | void ieee80211_send_pspoll(struct ieee80211_local *local, |
1203 | struct ieee80211_sub_if_data *sdata); | 1209 | struct ieee80211_sub_if_data *sdata); |
1204 | void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency); | 1210 | void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency); |
1211 | void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata); | ||
1205 | int ieee80211_max_network_latency(struct notifier_block *nb, | 1212 | int ieee80211_max_network_latency(struct notifier_block *nb, |
1206 | unsigned long data, void *dummy); | 1213 | unsigned long data, void *dummy); |
1207 | int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); | 1214 | int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); |
@@ -1291,6 +1298,8 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local); | |||
1291 | void ieee80211_recalc_idle(struct ieee80211_local *local); | 1298 | void ieee80211_recalc_idle(struct ieee80211_local *local); |
1292 | void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, | 1299 | void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, |
1293 | const int offset); | 1300 | const int offset); |
1301 | int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up); | ||
1302 | void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata); | ||
1294 | 1303 | ||
1295 | static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) | 1304 | static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) |
1296 | { | 1305 | { |
@@ -1425,7 +1434,6 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, | |||
1425 | struct ieee80211_hdr *hdr); | 1434 | struct ieee80211_hdr *hdr); |
1426 | void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, | 1435 | void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, |
1427 | struct ieee80211_hdr *hdr, bool ack); | 1436 | struct ieee80211_hdr *hdr, bool ack); |
1428 | void ieee80211_beacon_connection_loss_work(struct work_struct *work); | ||
1429 | 1437 | ||
1430 | void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, | 1438 | void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, |
1431 | enum queue_stop_reason reason); | 1439 | enum queue_stop_reason reason); |
@@ -1457,13 +1465,15 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, | |||
1457 | u8 channel); | 1465 | u8 channel); |
1458 | struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | 1466 | struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, |
1459 | u8 *dst, u32 ratemask, | 1467 | u8 *dst, u32 ratemask, |
1468 | struct ieee80211_channel *chan, | ||
1460 | const u8 *ssid, size_t ssid_len, | 1469 | const u8 *ssid, size_t ssid_len, |
1461 | const u8 *ie, size_t ie_len, | 1470 | const u8 *ie, size_t ie_len, |
1462 | bool directed); | 1471 | bool directed); |
1463 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | 1472 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, |
1464 | const u8 *ssid, size_t ssid_len, | 1473 | const u8 *ssid, size_t ssid_len, |
1465 | const u8 *ie, size_t ie_len, | 1474 | const u8 *ie, size_t ie_len, |
1466 | u32 ratemask, bool directed, bool no_cck); | 1475 | u32 ratemask, bool directed, bool no_cck, |
1476 | struct ieee80211_channel *channel); | ||
1467 | 1477 | ||
1468 | void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, | 1478 | void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, |
1469 | const size_t supp_rates_len, | 1479 | const size_t supp_rates_len, |
@@ -1487,9 +1497,11 @@ u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, | |||
1487 | u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, | 1497 | u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, |
1488 | u32 cap); | 1498 | u32 cap); |
1489 | int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, | 1499 | int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, |
1490 | struct sk_buff *skb, bool need_basic); | 1500 | struct sk_buff *skb, bool need_basic, |
1501 | enum ieee80211_band band); | ||
1491 | int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, | 1502 | int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, |
1492 | struct sk_buff *skb, bool need_basic); | 1503 | struct sk_buff *skb, bool need_basic, |
1504 | enum ieee80211_band band); | ||
1493 | 1505 | ||
1494 | /* channel management */ | 1506 | /* channel management */ |
1495 | enum ieee80211_chan_mode { | 1507 | enum ieee80211_chan_mode { |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index bfb57dcc1538..59f8adc2aa5f 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -100,6 +100,10 @@ static u32 __ieee80211_recalc_idle(struct ieee80211_local *local) | |||
100 | sdata->vif.bss_conf.idle = true; | 100 | sdata->vif.bss_conf.idle = true; |
101 | continue; | 101 | continue; |
102 | } | 102 | } |
103 | |||
104 | if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) | ||
105 | continue; | ||
106 | |||
103 | /* count everything else */ | 107 | /* count everything else */ |
104 | sdata->vif.bss_conf.idle = false; | 108 | sdata->vif.bss_conf.idle = false; |
105 | count++; | 109 | count++; |
@@ -121,7 +125,8 @@ static u32 __ieee80211_recalc_idle(struct ieee80211_local *local) | |||
121 | 125 | ||
122 | list_for_each_entry(sdata, &local->interfaces, list) { | 126 | list_for_each_entry(sdata, &local->interfaces, list) { |
123 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR || | 127 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR || |
124 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 128 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN || |
129 | sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) | ||
125 | continue; | 130 | continue; |
126 | if (sdata->old_idle == sdata->vif.bss_conf.idle) | 131 | if (sdata->old_idle == sdata->vif.bss_conf.idle) |
127 | continue; | 132 | continue; |
@@ -204,6 +209,8 @@ static inline int identical_mac_addr_allowed(int type1, int type2) | |||
204 | { | 209 | { |
205 | return type1 == NL80211_IFTYPE_MONITOR || | 210 | return type1 == NL80211_IFTYPE_MONITOR || |
206 | type2 == NL80211_IFTYPE_MONITOR || | 211 | type2 == NL80211_IFTYPE_MONITOR || |
212 | type1 == NL80211_IFTYPE_P2P_DEVICE || | ||
213 | type2 == NL80211_IFTYPE_P2P_DEVICE || | ||
207 | (type1 == NL80211_IFTYPE_AP && type2 == NL80211_IFTYPE_WDS) || | 214 | (type1 == NL80211_IFTYPE_AP && type2 == NL80211_IFTYPE_WDS) || |
208 | (type1 == NL80211_IFTYPE_WDS && | 215 | (type1 == NL80211_IFTYPE_WDS && |
209 | (type2 == NL80211_IFTYPE_WDS || | 216 | (type2 == NL80211_IFTYPE_WDS || |
@@ -406,9 +413,10 @@ static void ieee80211_del_virtual_monitor(struct ieee80211_local *local) | |||
406 | * an error on interface type changes that have been pre-checked, so most | 413 | * an error on interface type changes that have been pre-checked, so most |
407 | * checks should be in ieee80211_check_concurrent_iface. | 414 | * checks should be in ieee80211_check_concurrent_iface. |
408 | */ | 415 | */ |
409 | static int ieee80211_do_open(struct net_device *dev, bool coming_up) | 416 | int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) |
410 | { | 417 | { |
411 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 418 | struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); |
419 | struct net_device *dev = wdev->netdev; | ||
412 | struct ieee80211_local *local = sdata->local; | 420 | struct ieee80211_local *local = sdata->local; |
413 | struct sta_info *sta; | 421 | struct sta_info *sta; |
414 | u32 changed = 0; | 422 | u32 changed = 0; |
@@ -443,6 +451,7 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
443 | case NL80211_IFTYPE_STATION: | 451 | case NL80211_IFTYPE_STATION: |
444 | case NL80211_IFTYPE_MONITOR: | 452 | case NL80211_IFTYPE_MONITOR: |
445 | case NL80211_IFTYPE_ADHOC: | 453 | case NL80211_IFTYPE_ADHOC: |
454 | case NL80211_IFTYPE_P2P_DEVICE: | ||
446 | /* no special treatment */ | 455 | /* no special treatment */ |
447 | break; | 456 | break; |
448 | case NL80211_IFTYPE_UNSPECIFIED: | 457 | case NL80211_IFTYPE_UNSPECIFIED: |
@@ -471,7 +480,7 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
471 | * Copy the hopefully now-present MAC address to | 480 | * Copy the hopefully now-present MAC address to |
472 | * this interface, if it has the special null one. | 481 | * this interface, if it has the special null one. |
473 | */ | 482 | */ |
474 | if (is_zero_ether_addr(dev->dev_addr)) { | 483 | if (dev && is_zero_ether_addr(dev->dev_addr)) { |
475 | memcpy(dev->dev_addr, | 484 | memcpy(dev->dev_addr, |
476 | local->hw.wiphy->perm_addr, | 485 | local->hw.wiphy->perm_addr, |
477 | ETH_ALEN); | 486 | ETH_ALEN); |
@@ -536,15 +545,23 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
536 | local->fif_probe_req++; | 545 | local->fif_probe_req++; |
537 | } | 546 | } |
538 | 547 | ||
539 | changed |= ieee80211_reset_erp_info(sdata); | 548 | if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE) |
549 | changed |= ieee80211_reset_erp_info(sdata); | ||
540 | ieee80211_bss_info_change_notify(sdata, changed); | 550 | ieee80211_bss_info_change_notify(sdata, changed); |
541 | 551 | ||
542 | if (sdata->vif.type == NL80211_IFTYPE_STATION || | 552 | switch (sdata->vif.type) { |
543 | sdata->vif.type == NL80211_IFTYPE_ADHOC || | 553 | case NL80211_IFTYPE_STATION: |
544 | sdata->vif.type == NL80211_IFTYPE_AP) | 554 | case NL80211_IFTYPE_ADHOC: |
555 | case NL80211_IFTYPE_AP: | ||
556 | case NL80211_IFTYPE_MESH_POINT: | ||
545 | netif_carrier_off(dev); | 557 | netif_carrier_off(dev); |
546 | else | 558 | break; |
559 | case NL80211_IFTYPE_WDS: | ||
560 | case NL80211_IFTYPE_P2P_DEVICE: | ||
561 | break; | ||
562 | default: | ||
547 | netif_carrier_on(dev); | 563 | netif_carrier_on(dev); |
564 | } | ||
548 | 565 | ||
549 | /* | 566 | /* |
550 | * set default queue parameters so drivers don't | 567 | * set default queue parameters so drivers don't |
@@ -576,6 +593,9 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
576 | } | 593 | } |
577 | 594 | ||
578 | rate_control_rate_init(sta); | 595 | rate_control_rate_init(sta); |
596 | netif_carrier_on(dev); | ||
597 | } else if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) { | ||
598 | rcu_assign_pointer(local->p2p_sdata, sdata); | ||
579 | } | 599 | } |
580 | 600 | ||
581 | /* | 601 | /* |
@@ -601,7 +621,8 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
601 | 621 | ||
602 | ieee80211_recalc_ps(local, -1); | 622 | ieee80211_recalc_ps(local, -1); |
603 | 623 | ||
604 | netif_tx_start_all_queues(dev); | 624 | if (dev) |
625 | netif_tx_start_all_queues(dev); | ||
605 | 626 | ||
606 | return 0; | 627 | return 0; |
607 | err_del_interface: | 628 | err_del_interface: |
@@ -631,7 +652,7 @@ static int ieee80211_open(struct net_device *dev) | |||
631 | if (err) | 652 | if (err) |
632 | return err; | 653 | return err; |
633 | 654 | ||
634 | return ieee80211_do_open(dev, true); | 655 | return ieee80211_do_open(&sdata->wdev, true); |
635 | } | 656 | } |
636 | 657 | ||
637 | static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | 658 | static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, |
@@ -652,7 +673,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
652 | /* | 673 | /* |
653 | * Stop TX on this interface first. | 674 | * Stop TX on this interface first. |
654 | */ | 675 | */ |
655 | netif_tx_stop_all_queues(sdata->dev); | 676 | if (sdata->dev) |
677 | netif_tx_stop_all_queues(sdata->dev); | ||
656 | 678 | ||
657 | ieee80211_roc_purge(sdata); | 679 | ieee80211_roc_purge(sdata); |
658 | 680 | ||
@@ -691,14 +713,16 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
691 | local->fif_probe_req--; | 713 | local->fif_probe_req--; |
692 | } | 714 | } |
693 | 715 | ||
694 | netif_addr_lock_bh(sdata->dev); | 716 | if (sdata->dev) { |
695 | spin_lock_bh(&local->filter_lock); | 717 | netif_addr_lock_bh(sdata->dev); |
696 | __hw_addr_unsync(&local->mc_list, &sdata->dev->mc, | 718 | spin_lock_bh(&local->filter_lock); |
697 | sdata->dev->addr_len); | 719 | __hw_addr_unsync(&local->mc_list, &sdata->dev->mc, |
698 | spin_unlock_bh(&local->filter_lock); | 720 | sdata->dev->addr_len); |
699 | netif_addr_unlock_bh(sdata->dev); | 721 | spin_unlock_bh(&local->filter_lock); |
722 | netif_addr_unlock_bh(sdata->dev); | ||
700 | 723 | ||
701 | ieee80211_configure_filter(local); | 724 | ieee80211_configure_filter(local); |
725 | } | ||
702 | 726 | ||
703 | del_timer_sync(&local->dynamic_ps_timer); | 727 | del_timer_sync(&local->dynamic_ps_timer); |
704 | cancel_work_sync(&local->dynamic_ps_enable_work); | 728 | cancel_work_sync(&local->dynamic_ps_enable_work); |
@@ -708,7 +732,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
708 | struct ieee80211_sub_if_data *vlan, *tmpsdata; | 732 | struct ieee80211_sub_if_data *vlan, *tmpsdata; |
709 | struct beacon_data *old_beacon = | 733 | struct beacon_data *old_beacon = |
710 | rtnl_dereference(sdata->u.ap.beacon); | 734 | rtnl_dereference(sdata->u.ap.beacon); |
711 | struct sk_buff *old_probe_resp = | 735 | struct probe_resp *old_probe_resp = |
712 | rtnl_dereference(sdata->u.ap.probe_resp); | 736 | rtnl_dereference(sdata->u.ap.probe_resp); |
713 | 737 | ||
714 | /* sdata_running will return false, so this will disable */ | 738 | /* sdata_running will return false, so this will disable */ |
@@ -720,7 +744,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
720 | RCU_INIT_POINTER(sdata->u.ap.probe_resp, NULL); | 744 | RCU_INIT_POINTER(sdata->u.ap.probe_resp, NULL); |
721 | synchronize_rcu(); | 745 | synchronize_rcu(); |
722 | kfree(old_beacon); | 746 | kfree(old_beacon); |
723 | kfree_skb(old_probe_resp); | 747 | kfree(old_probe_resp); |
724 | 748 | ||
725 | /* down all dependent devices, that is VLANs */ | 749 | /* down all dependent devices, that is VLANs */ |
726 | list_for_each_entry_safe(vlan, tmpsdata, &sdata->u.ap.vlans, | 750 | list_for_each_entry_safe(vlan, tmpsdata, &sdata->u.ap.vlans, |
@@ -759,6 +783,10 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
759 | ieee80211_adjust_monitor_flags(sdata, -1); | 783 | ieee80211_adjust_monitor_flags(sdata, -1); |
760 | ieee80211_configure_filter(local); | 784 | ieee80211_configure_filter(local); |
761 | break; | 785 | break; |
786 | case NL80211_IFTYPE_P2P_DEVICE: | ||
787 | /* relies on synchronize_rcu() below */ | ||
788 | rcu_assign_pointer(local->p2p_sdata, NULL); | ||
789 | /* fall through */ | ||
762 | default: | 790 | default: |
763 | flush_work(&sdata->work); | 791 | flush_work(&sdata->work); |
764 | /* | 792 | /* |
@@ -771,14 +799,6 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
771 | skb_queue_purge(&sdata->skb_queue); | 799 | skb_queue_purge(&sdata->skb_queue); |
772 | 800 | ||
773 | /* | 801 | /* |
774 | * Disable beaconing here for mesh only, AP and IBSS | ||
775 | * are already taken care of. | ||
776 | */ | ||
777 | if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) | ||
778 | ieee80211_bss_info_change_notify(sdata, | ||
779 | BSS_CHANGED_BEACON_ENABLED); | ||
780 | |||
781 | /* | ||
782 | * Free all remaining keys, there shouldn't be any, | 802 | * Free all remaining keys, there shouldn't be any, |
783 | * except maybe group keys in AP more or WDS? | 803 | * except maybe group keys in AP more or WDS? |
784 | */ | 804 | */ |
@@ -877,9 +897,8 @@ static void ieee80211_set_multicast_list(struct net_device *dev) | |||
877 | * Called when the netdev is removed or, by the code below, before | 897 | * Called when the netdev is removed or, by the code below, before |
878 | * the interface type changes. | 898 | * the interface type changes. |
879 | */ | 899 | */ |
880 | static void ieee80211_teardown_sdata(struct net_device *dev) | 900 | static void ieee80211_teardown_sdata(struct ieee80211_sub_if_data *sdata) |
881 | { | 901 | { |
882 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
883 | struct ieee80211_local *local = sdata->local; | 902 | struct ieee80211_local *local = sdata->local; |
884 | int flushed; | 903 | int flushed; |
885 | int i; | 904 | int i; |
@@ -900,6 +919,11 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
900 | WARN_ON(flushed); | 919 | WARN_ON(flushed); |
901 | } | 920 | } |
902 | 921 | ||
922 | static void ieee80211_uninit(struct net_device *dev) | ||
923 | { | ||
924 | ieee80211_teardown_sdata(IEEE80211_DEV_TO_SUB_IF(dev)); | ||
925 | } | ||
926 | |||
903 | static u16 ieee80211_netdev_select_queue(struct net_device *dev, | 927 | static u16 ieee80211_netdev_select_queue(struct net_device *dev, |
904 | struct sk_buff *skb) | 928 | struct sk_buff *skb) |
905 | { | 929 | { |
@@ -909,7 +933,7 @@ static u16 ieee80211_netdev_select_queue(struct net_device *dev, | |||
909 | static const struct net_device_ops ieee80211_dataif_ops = { | 933 | static const struct net_device_ops ieee80211_dataif_ops = { |
910 | .ndo_open = ieee80211_open, | 934 | .ndo_open = ieee80211_open, |
911 | .ndo_stop = ieee80211_stop, | 935 | .ndo_stop = ieee80211_stop, |
912 | .ndo_uninit = ieee80211_teardown_sdata, | 936 | .ndo_uninit = ieee80211_uninit, |
913 | .ndo_start_xmit = ieee80211_subif_start_xmit, | 937 | .ndo_start_xmit = ieee80211_subif_start_xmit, |
914 | .ndo_set_rx_mode = ieee80211_set_multicast_list, | 938 | .ndo_set_rx_mode = ieee80211_set_multicast_list, |
915 | .ndo_change_mtu = ieee80211_change_mtu, | 939 | .ndo_change_mtu = ieee80211_change_mtu, |
@@ -940,7 +964,7 @@ static u16 ieee80211_monitor_select_queue(struct net_device *dev, | |||
940 | static const struct net_device_ops ieee80211_monitorif_ops = { | 964 | static const struct net_device_ops ieee80211_monitorif_ops = { |
941 | .ndo_open = ieee80211_open, | 965 | .ndo_open = ieee80211_open, |
942 | .ndo_stop = ieee80211_stop, | 966 | .ndo_stop = ieee80211_stop, |
943 | .ndo_uninit = ieee80211_teardown_sdata, | 967 | .ndo_uninit = ieee80211_uninit, |
944 | .ndo_start_xmit = ieee80211_monitor_start_xmit, | 968 | .ndo_start_xmit = ieee80211_monitor_start_xmit, |
945 | .ndo_set_rx_mode = ieee80211_set_multicast_list, | 969 | .ndo_set_rx_mode = ieee80211_set_multicast_list, |
946 | .ndo_change_mtu = ieee80211_change_mtu, | 970 | .ndo_change_mtu = ieee80211_change_mtu, |
@@ -1099,7 +1123,6 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
1099 | /* and set some type-dependent values */ | 1123 | /* and set some type-dependent values */ |
1100 | sdata->vif.type = type; | 1124 | sdata->vif.type = type; |
1101 | sdata->vif.p2p = false; | 1125 | sdata->vif.p2p = false; |
1102 | sdata->dev->netdev_ops = &ieee80211_dataif_ops; | ||
1103 | sdata->wdev.iftype = type; | 1126 | sdata->wdev.iftype = type; |
1104 | 1127 | ||
1105 | sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE); | 1128 | sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE); |
@@ -1107,8 +1130,11 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
1107 | 1130 | ||
1108 | sdata->noack_map = 0; | 1131 | sdata->noack_map = 0; |
1109 | 1132 | ||
1110 | /* only monitor differs */ | 1133 | /* only monitor/p2p-device differ */ |
1111 | sdata->dev->type = ARPHRD_ETHER; | 1134 | if (sdata->dev) { |
1135 | sdata->dev->netdev_ops = &ieee80211_dataif_ops; | ||
1136 | sdata->dev->type = ARPHRD_ETHER; | ||
1137 | } | ||
1112 | 1138 | ||
1113 | skb_queue_head_init(&sdata->skb_queue); | 1139 | skb_queue_head_init(&sdata->skb_queue); |
1114 | INIT_WORK(&sdata->work, ieee80211_iface_work); | 1140 | INIT_WORK(&sdata->work, ieee80211_iface_work); |
@@ -1146,6 +1172,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
1146 | break; | 1172 | break; |
1147 | case NL80211_IFTYPE_WDS: | 1173 | case NL80211_IFTYPE_WDS: |
1148 | case NL80211_IFTYPE_AP_VLAN: | 1174 | case NL80211_IFTYPE_AP_VLAN: |
1175 | case NL80211_IFTYPE_P2P_DEVICE: | ||
1149 | break; | 1176 | break; |
1150 | case NL80211_IFTYPE_UNSPECIFIED: | 1177 | case NL80211_IFTYPE_UNSPECIFIED: |
1151 | case NUM_NL80211_IFTYPES: | 1178 | case NUM_NL80211_IFTYPES: |
@@ -1156,18 +1183,6 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
1156 | ieee80211_debugfs_add_netdev(sdata); | 1183 | ieee80211_debugfs_add_netdev(sdata); |
1157 | } | 1184 | } |
1158 | 1185 | ||
1159 | static void ieee80211_clean_sdata(struct ieee80211_sub_if_data *sdata) | ||
1160 | { | ||
1161 | switch (sdata->vif.type) { | ||
1162 | case NL80211_IFTYPE_MESH_POINT: | ||
1163 | mesh_path_flush_by_iface(sdata); | ||
1164 | break; | ||
1165 | |||
1166 | default: | ||
1167 | break; | ||
1168 | } | ||
1169 | } | ||
1170 | |||
1171 | static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, | 1186 | static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, |
1172 | enum nl80211_iftype type) | 1187 | enum nl80211_iftype type) |
1173 | { | 1188 | { |
@@ -1225,7 +1240,7 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, | |||
1225 | 1240 | ||
1226 | ieee80211_do_stop(sdata, false); | 1241 | ieee80211_do_stop(sdata, false); |
1227 | 1242 | ||
1228 | ieee80211_teardown_sdata(sdata->dev); | 1243 | ieee80211_teardown_sdata(sdata); |
1229 | 1244 | ||
1230 | ret = drv_change_interface(local, sdata, internal_type, p2p); | 1245 | ret = drv_change_interface(local, sdata, internal_type, p2p); |
1231 | if (ret) | 1246 | if (ret) |
@@ -1240,7 +1255,7 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, | |||
1240 | 1255 | ||
1241 | ieee80211_setup_sdata(sdata, type); | 1256 | ieee80211_setup_sdata(sdata, type); |
1242 | 1257 | ||
1243 | err = ieee80211_do_open(sdata->dev, false); | 1258 | err = ieee80211_do_open(&sdata->wdev, false); |
1244 | WARN(err, "type change: do_open returned %d", err); | 1259 | WARN(err, "type change: do_open returned %d", err); |
1245 | 1260 | ||
1246 | return ret; | 1261 | return ret; |
@@ -1267,14 +1282,14 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
1267 | return ret; | 1282 | return ret; |
1268 | } else { | 1283 | } else { |
1269 | /* Purge and reset type-dependent state. */ | 1284 | /* Purge and reset type-dependent state. */ |
1270 | ieee80211_teardown_sdata(sdata->dev); | 1285 | ieee80211_teardown_sdata(sdata); |
1271 | ieee80211_setup_sdata(sdata, type); | 1286 | ieee80211_setup_sdata(sdata, type); |
1272 | } | 1287 | } |
1273 | 1288 | ||
1274 | /* reset some values that shouldn't be kept across type changes */ | 1289 | /* reset some values that shouldn't be kept across type changes */ |
1275 | sdata->vif.bss_conf.basic_rates = | 1290 | sdata->vif.bss_conf.basic_rates = |
1276 | ieee80211_mandatory_rates(sdata->local, | 1291 | ieee80211_mandatory_rates(sdata->local, |
1277 | sdata->local->hw.conf.channel->band); | 1292 | sdata->local->oper_channel->band); |
1278 | sdata->drop_unencrypted = 0; | 1293 | sdata->drop_unencrypted = 0; |
1279 | if (type == NL80211_IFTYPE_STATION) | 1294 | if (type == NL80211_IFTYPE_STATION) |
1280 | sdata->u.mgd.use_4addr = false; | 1295 | sdata->u.mgd.use_4addr = false; |
@@ -1283,8 +1298,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
1283 | } | 1298 | } |
1284 | 1299 | ||
1285 | static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | 1300 | static void ieee80211_assign_perm_addr(struct ieee80211_local *local, |
1286 | struct net_device *dev, | 1301 | u8 *perm_addr, enum nl80211_iftype type) |
1287 | enum nl80211_iftype type) | ||
1288 | { | 1302 | { |
1289 | struct ieee80211_sub_if_data *sdata; | 1303 | struct ieee80211_sub_if_data *sdata; |
1290 | u64 mask, start, addr, val, inc; | 1304 | u64 mask, start, addr, val, inc; |
@@ -1293,13 +1307,12 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
1293 | int i; | 1307 | int i; |
1294 | 1308 | ||
1295 | /* default ... something at least */ | 1309 | /* default ... something at least */ |
1296 | memcpy(dev->perm_addr, local->hw.wiphy->perm_addr, ETH_ALEN); | 1310 | memcpy(perm_addr, local->hw.wiphy->perm_addr, ETH_ALEN); |
1297 | 1311 | ||
1298 | if (is_zero_ether_addr(local->hw.wiphy->addr_mask) && | 1312 | if (is_zero_ether_addr(local->hw.wiphy->addr_mask) && |
1299 | local->hw.wiphy->n_addresses <= 1) | 1313 | local->hw.wiphy->n_addresses <= 1) |
1300 | return; | 1314 | return; |
1301 | 1315 | ||
1302 | |||
1303 | mutex_lock(&local->iflist_mtx); | 1316 | mutex_lock(&local->iflist_mtx); |
1304 | 1317 | ||
1305 | switch (type) { | 1318 | switch (type) { |
@@ -1312,11 +1325,24 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
1312 | list_for_each_entry(sdata, &local->interfaces, list) { | 1325 | list_for_each_entry(sdata, &local->interfaces, list) { |
1313 | if (sdata->vif.type != NL80211_IFTYPE_AP) | 1326 | if (sdata->vif.type != NL80211_IFTYPE_AP) |
1314 | continue; | 1327 | continue; |
1315 | memcpy(dev->perm_addr, sdata->vif.addr, ETH_ALEN); | 1328 | memcpy(perm_addr, sdata->vif.addr, ETH_ALEN); |
1316 | break; | 1329 | break; |
1317 | } | 1330 | } |
1318 | /* keep default if no AP interface present */ | 1331 | /* keep default if no AP interface present */ |
1319 | break; | 1332 | break; |
1333 | case NL80211_IFTYPE_P2P_CLIENT: | ||
1334 | case NL80211_IFTYPE_P2P_GO: | ||
1335 | if (local->hw.flags & IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF) { | ||
1336 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
1337 | if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE) | ||
1338 | continue; | ||
1339 | if (!ieee80211_sdata_running(sdata)) | ||
1340 | continue; | ||
1341 | memcpy(perm_addr, sdata->vif.addr, ETH_ALEN); | ||
1342 | goto out_unlock; | ||
1343 | } | ||
1344 | } | ||
1345 | /* otherwise fall through */ | ||
1320 | default: | 1346 | default: |
1321 | /* assign a new address if possible -- try n_addresses first */ | 1347 | /* assign a new address if possible -- try n_addresses first */ |
1322 | for (i = 0; i < local->hw.wiphy->n_addresses; i++) { | 1348 | for (i = 0; i < local->hw.wiphy->n_addresses; i++) { |
@@ -1331,7 +1357,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
1331 | } | 1357 | } |
1332 | 1358 | ||
1333 | if (!used) { | 1359 | if (!used) { |
1334 | memcpy(dev->perm_addr, | 1360 | memcpy(perm_addr, |
1335 | local->hw.wiphy->addresses[i].addr, | 1361 | local->hw.wiphy->addresses[i].addr, |
1336 | ETH_ALEN); | 1362 | ETH_ALEN); |
1337 | break; | 1363 | break; |
@@ -1382,7 +1408,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
1382 | } | 1408 | } |
1383 | 1409 | ||
1384 | if (!used) { | 1410 | if (!used) { |
1385 | memcpy(dev->perm_addr, tmp_addr, ETH_ALEN); | 1411 | memcpy(perm_addr, tmp_addr, ETH_ALEN); |
1386 | break; | 1412 | break; |
1387 | } | 1413 | } |
1388 | addr = (start & ~mask) | (val & mask); | 1414 | addr = (start & ~mask) | (val & mask); |
@@ -1391,6 +1417,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
1391 | break; | 1417 | break; |
1392 | } | 1418 | } |
1393 | 1419 | ||
1420 | out_unlock: | ||
1394 | mutex_unlock(&local->iflist_mtx); | 1421 | mutex_unlock(&local->iflist_mtx); |
1395 | } | 1422 | } |
1396 | 1423 | ||
@@ -1398,49 +1425,68 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
1398 | struct wireless_dev **new_wdev, enum nl80211_iftype type, | 1425 | struct wireless_dev **new_wdev, enum nl80211_iftype type, |
1399 | struct vif_params *params) | 1426 | struct vif_params *params) |
1400 | { | 1427 | { |
1401 | struct net_device *ndev; | 1428 | struct net_device *ndev = NULL; |
1402 | struct ieee80211_sub_if_data *sdata = NULL; | 1429 | struct ieee80211_sub_if_data *sdata = NULL; |
1403 | int ret, i; | 1430 | int ret, i; |
1404 | int txqs = 1; | 1431 | int txqs = 1; |
1405 | 1432 | ||
1406 | ASSERT_RTNL(); | 1433 | ASSERT_RTNL(); |
1407 | 1434 | ||
1408 | if (local->hw.queues >= IEEE80211_NUM_ACS) | 1435 | if (type == NL80211_IFTYPE_P2P_DEVICE) { |
1409 | txqs = IEEE80211_NUM_ACS; | 1436 | struct wireless_dev *wdev; |
1410 | 1437 | ||
1411 | ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size, | 1438 | sdata = kzalloc(sizeof(*sdata) + local->hw.vif_data_size, |
1412 | name, ieee80211_if_setup, txqs, 1); | 1439 | GFP_KERNEL); |
1413 | if (!ndev) | 1440 | if (!sdata) |
1414 | return -ENOMEM; | 1441 | return -ENOMEM; |
1415 | dev_net_set(ndev, wiphy_net(local->hw.wiphy)); | 1442 | wdev = &sdata->wdev; |
1416 | 1443 | ||
1417 | ndev->needed_headroom = local->tx_headroom + | 1444 | sdata->dev = NULL; |
1418 | 4*6 /* four MAC addresses */ | 1445 | strlcpy(sdata->name, name, IFNAMSIZ); |
1419 | + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */ | 1446 | ieee80211_assign_perm_addr(local, wdev->address, type); |
1420 | + 6 /* mesh */ | 1447 | memcpy(sdata->vif.addr, wdev->address, ETH_ALEN); |
1421 | + 8 /* rfc1042/bridge tunnel */ | 1448 | } else { |
1422 | - ETH_HLEN /* ethernet hard_header_len */ | 1449 | if (local->hw.queues >= IEEE80211_NUM_ACS) |
1423 | + IEEE80211_ENCRYPT_HEADROOM; | 1450 | txqs = IEEE80211_NUM_ACS; |
1424 | ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM; | 1451 | |
1425 | 1452 | ndev = alloc_netdev_mqs(sizeof(*sdata) + | |
1426 | ret = dev_alloc_name(ndev, ndev->name); | 1453 | local->hw.vif_data_size, |
1427 | if (ret < 0) | 1454 | name, ieee80211_if_setup, txqs, 1); |
1428 | goto fail; | 1455 | if (!ndev) |
1429 | 1456 | return -ENOMEM; | |
1430 | ieee80211_assign_perm_addr(local, ndev, type); | 1457 | dev_net_set(ndev, wiphy_net(local->hw.wiphy)); |
1431 | memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN); | 1458 | |
1432 | SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy)); | 1459 | ndev->needed_headroom = local->tx_headroom + |
1433 | 1460 | 4*6 /* four MAC addresses */ | |
1434 | /* don't use IEEE80211_DEV_TO_SUB_IF because it checks too much */ | 1461 | + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */ |
1435 | sdata = netdev_priv(ndev); | 1462 | + 6 /* mesh */ |
1436 | ndev->ieee80211_ptr = &sdata->wdev; | 1463 | + 8 /* rfc1042/bridge tunnel */ |
1437 | memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN); | 1464 | - ETH_HLEN /* ethernet hard_header_len */ |
1438 | memcpy(sdata->name, ndev->name, IFNAMSIZ); | 1465 | + IEEE80211_ENCRYPT_HEADROOM; |
1466 | ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM; | ||
1467 | |||
1468 | ret = dev_alloc_name(ndev, ndev->name); | ||
1469 | if (ret < 0) { | ||
1470 | free_netdev(ndev); | ||
1471 | return ret; | ||
1472 | } | ||
1473 | |||
1474 | ieee80211_assign_perm_addr(local, ndev->perm_addr, type); | ||
1475 | memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN); | ||
1476 | SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy)); | ||
1477 | |||
1478 | /* don't use IEEE80211_DEV_TO_SUB_IF -- it checks too much */ | ||
1479 | sdata = netdev_priv(ndev); | ||
1480 | ndev->ieee80211_ptr = &sdata->wdev; | ||
1481 | memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN); | ||
1482 | memcpy(sdata->name, ndev->name, IFNAMSIZ); | ||
1483 | |||
1484 | sdata->dev = ndev; | ||
1485 | } | ||
1439 | 1486 | ||
1440 | /* initialise type-independent data */ | 1487 | /* initialise type-independent data */ |
1441 | sdata->wdev.wiphy = local->hw.wiphy; | 1488 | sdata->wdev.wiphy = local->hw.wiphy; |
1442 | sdata->local = local; | 1489 | sdata->local = local; |
1443 | sdata->dev = ndev; | ||
1444 | #ifdef CONFIG_INET | 1490 | #ifdef CONFIG_INET |
1445 | sdata->arp_filter_state = true; | 1491 | sdata->arp_filter_state = true; |
1446 | #endif | 1492 | #endif |
@@ -1469,17 +1515,21 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
1469 | /* setup type-dependent data */ | 1515 | /* setup type-dependent data */ |
1470 | ieee80211_setup_sdata(sdata, type); | 1516 | ieee80211_setup_sdata(sdata, type); |
1471 | 1517 | ||
1472 | if (params) { | 1518 | if (ndev) { |
1473 | ndev->ieee80211_ptr->use_4addr = params->use_4addr; | 1519 | if (params) { |
1474 | if (type == NL80211_IFTYPE_STATION) | 1520 | ndev->ieee80211_ptr->use_4addr = params->use_4addr; |
1475 | sdata->u.mgd.use_4addr = params->use_4addr; | 1521 | if (type == NL80211_IFTYPE_STATION) |
1476 | } | 1522 | sdata->u.mgd.use_4addr = params->use_4addr; |
1523 | } | ||
1477 | 1524 | ||
1478 | ndev->features |= local->hw.netdev_features; | 1525 | ndev->features |= local->hw.netdev_features; |
1479 | 1526 | ||
1480 | ret = register_netdevice(ndev); | 1527 | ret = register_netdevice(ndev); |
1481 | if (ret) | 1528 | if (ret) { |
1482 | goto fail; | 1529 | free_netdev(ndev); |
1530 | return ret; | ||
1531 | } | ||
1532 | } | ||
1483 | 1533 | ||
1484 | mutex_lock(&local->iflist_mtx); | 1534 | mutex_lock(&local->iflist_mtx); |
1485 | list_add_tail_rcu(&sdata->list, &local->interfaces); | 1535 | list_add_tail_rcu(&sdata->list, &local->interfaces); |
@@ -1489,10 +1539,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
1489 | *new_wdev = &sdata->wdev; | 1539 | *new_wdev = &sdata->wdev; |
1490 | 1540 | ||
1491 | return 0; | 1541 | return 0; |
1492 | |||
1493 | fail: | ||
1494 | free_netdev(ndev); | ||
1495 | return ret; | ||
1496 | } | 1542 | } |
1497 | 1543 | ||
1498 | void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) | 1544 | void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) |
@@ -1503,11 +1549,22 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) | |||
1503 | list_del_rcu(&sdata->list); | 1549 | list_del_rcu(&sdata->list); |
1504 | mutex_unlock(&sdata->local->iflist_mtx); | 1550 | mutex_unlock(&sdata->local->iflist_mtx); |
1505 | 1551 | ||
1506 | /* clean up type-dependent data */ | ||
1507 | ieee80211_clean_sdata(sdata); | ||
1508 | |||
1509 | synchronize_rcu(); | 1552 | synchronize_rcu(); |
1510 | unregister_netdevice(sdata->dev); | 1553 | |
1554 | if (sdata->dev) { | ||
1555 | unregister_netdevice(sdata->dev); | ||
1556 | } else { | ||
1557 | cfg80211_unregister_wdev(&sdata->wdev); | ||
1558 | kfree(sdata); | ||
1559 | } | ||
1560 | } | ||
1561 | |||
1562 | void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata) | ||
1563 | { | ||
1564 | if (WARN_ON_ONCE(!test_bit(SDATA_STATE_RUNNING, &sdata->state))) | ||
1565 | return; | ||
1566 | ieee80211_do_stop(sdata, true); | ||
1567 | ieee80211_teardown_sdata(sdata); | ||
1511 | } | 1568 | } |
1512 | 1569 | ||
1513 | /* | 1570 | /* |
@@ -1518,6 +1575,7 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local) | |||
1518 | { | 1575 | { |
1519 | struct ieee80211_sub_if_data *sdata, *tmp; | 1576 | struct ieee80211_sub_if_data *sdata, *tmp; |
1520 | LIST_HEAD(unreg_list); | 1577 | LIST_HEAD(unreg_list); |
1578 | LIST_HEAD(wdev_list); | ||
1521 | 1579 | ||
1522 | ASSERT_RTNL(); | 1580 | ASSERT_RTNL(); |
1523 | 1581 | ||
@@ -1525,13 +1583,20 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local) | |||
1525 | list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { | 1583 | list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { |
1526 | list_del(&sdata->list); | 1584 | list_del(&sdata->list); |
1527 | 1585 | ||
1528 | ieee80211_clean_sdata(sdata); | 1586 | if (sdata->dev) |
1529 | 1587 | unregister_netdevice_queue(sdata->dev, &unreg_list); | |
1530 | unregister_netdevice_queue(sdata->dev, &unreg_list); | 1588 | else |
1589 | list_add(&sdata->list, &wdev_list); | ||
1531 | } | 1590 | } |
1532 | mutex_unlock(&local->iflist_mtx); | 1591 | mutex_unlock(&local->iflist_mtx); |
1533 | unregister_netdevice_many(&unreg_list); | 1592 | unregister_netdevice_many(&unreg_list); |
1534 | list_del(&unreg_list); | 1593 | list_del(&unreg_list); |
1594 | |||
1595 | list_for_each_entry_safe(sdata, tmp, &wdev_list, list) { | ||
1596 | list_del(&sdata->list); | ||
1597 | cfg80211_unregister_wdev(&sdata->wdev); | ||
1598 | kfree(sdata); | ||
1599 | } | ||
1535 | } | 1600 | } |
1536 | 1601 | ||
1537 | static int netdev_notify(struct notifier_block *nb, | 1602 | static int netdev_notify(struct notifier_block *nb, |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index c26e231c733a..bd7529363193 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -207,6 +207,10 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | |||
207 | sdata->vif.bss_conf.bssid = NULL; | 207 | sdata->vif.bss_conf.bssid = NULL; |
208 | else if (ieee80211_vif_is_mesh(&sdata->vif)) { | 208 | else if (ieee80211_vif_is_mesh(&sdata->vif)) { |
209 | sdata->vif.bss_conf.bssid = zero; | 209 | sdata->vif.bss_conf.bssid = zero; |
210 | } else if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) { | ||
211 | sdata->vif.bss_conf.bssid = sdata->vif.addr; | ||
212 | WARN_ONCE(changed & ~(BSS_CHANGED_IDLE), | ||
213 | "P2P Device BSS changed %#x", changed); | ||
210 | } else { | 214 | } else { |
211 | WARN_ON(1); | 215 | WARN_ON(1); |
212 | return; | 216 | return; |
@@ -514,6 +518,11 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { | |||
514 | BIT(IEEE80211_STYPE_AUTH >> 4) | | 518 | BIT(IEEE80211_STYPE_AUTH >> 4) | |
515 | BIT(IEEE80211_STYPE_DEAUTH >> 4), | 519 | BIT(IEEE80211_STYPE_DEAUTH >> 4), |
516 | }, | 520 | }, |
521 | [NL80211_IFTYPE_P2P_DEVICE] = { | ||
522 | .tx = 0xffff, | ||
523 | .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | | ||
524 | BIT(IEEE80211_STYPE_PROBE_REQ >> 4), | ||
525 | }, | ||
517 | }; | 526 | }; |
518 | 527 | ||
519 | static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = { | 528 | static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = { |
@@ -536,6 +545,11 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
536 | int priv_size, i; | 545 | int priv_size, i; |
537 | struct wiphy *wiphy; | 546 | struct wiphy *wiphy; |
538 | 547 | ||
548 | if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config || | ||
549 | !ops->add_interface || !ops->remove_interface || | ||
550 | !ops->configure_filter)) | ||
551 | return NULL; | ||
552 | |||
539 | if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove))) | 553 | if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove))) |
540 | return NULL; | 554 | return NULL; |
541 | 555 | ||
@@ -588,13 +602,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
588 | 602 | ||
589 | local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN); | 603 | local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN); |
590 | 604 | ||
591 | BUG_ON(!ops->tx); | ||
592 | BUG_ON(!ops->start); | ||
593 | BUG_ON(!ops->stop); | ||
594 | BUG_ON(!ops->config); | ||
595 | BUG_ON(!ops->add_interface); | ||
596 | BUG_ON(!ops->remove_interface); | ||
597 | BUG_ON(!ops->configure_filter); | ||
598 | local->ops = ops; | 605 | local->ops = ops; |
599 | 606 | ||
600 | /* set up some defaults */ | 607 | /* set up some defaults */ |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 0e2f83e71277..ff0296c7bab8 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -109,11 +109,11 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata, | |||
109 | 109 | ||
110 | /* Disallow HT40+/- mismatch */ | 110 | /* Disallow HT40+/- mismatch */ |
111 | if (ie->ht_operation && | 111 | if (ie->ht_operation && |
112 | (local->_oper_channel_type == NL80211_CHAN_HT40MINUS || | 112 | (sdata->vif.bss_conf.channel_type == NL80211_CHAN_HT40MINUS || |
113 | local->_oper_channel_type == NL80211_CHAN_HT40PLUS) && | 113 | sdata->vif.bss_conf.channel_type == NL80211_CHAN_HT40PLUS) && |
114 | (sta_channel_type == NL80211_CHAN_HT40MINUS || | 114 | (sta_channel_type == NL80211_CHAN_HT40MINUS || |
115 | sta_channel_type == NL80211_CHAN_HT40PLUS) && | 115 | sta_channel_type == NL80211_CHAN_HT40PLUS) && |
116 | local->_oper_channel_type != sta_channel_type) | 116 | sdata->vif.bss_conf.channel_type != sta_channel_type) |
117 | goto mismatch; | 117 | goto mismatch; |
118 | 118 | ||
119 | return true; | 119 | return true; |
@@ -355,17 +355,18 @@ int mesh_add_ds_params_ie(struct sk_buff *skb, | |||
355 | { | 355 | { |
356 | struct ieee80211_local *local = sdata->local; | 356 | struct ieee80211_local *local = sdata->local; |
357 | struct ieee80211_supported_band *sband; | 357 | struct ieee80211_supported_band *sband; |
358 | struct ieee80211_channel *chan = local->oper_channel; | ||
358 | u8 *pos; | 359 | u8 *pos; |
359 | 360 | ||
360 | if (skb_tailroom(skb) < 3) | 361 | if (skb_tailroom(skb) < 3) |
361 | return -ENOMEM; | 362 | return -ENOMEM; |
362 | 363 | ||
363 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 364 | sband = local->hw.wiphy->bands[chan->band]; |
364 | if (sband->band == IEEE80211_BAND_2GHZ) { | 365 | if (sband->band == IEEE80211_BAND_2GHZ) { |
365 | pos = skb_put(skb, 2 + 1); | 366 | pos = skb_put(skb, 2 + 1); |
366 | *pos++ = WLAN_EID_DS_PARAMS; | 367 | *pos++ = WLAN_EID_DS_PARAMS; |
367 | *pos++ = 1; | 368 | *pos++ = 1; |
368 | *pos++ = ieee80211_frequency_to_channel(local->hw.conf.channel->center_freq); | 369 | *pos++ = ieee80211_frequency_to_channel(chan->center_freq); |
369 | } | 370 | } |
370 | 371 | ||
371 | return 0; | 372 | return 0; |
@@ -380,7 +381,7 @@ int mesh_add_ht_cap_ie(struct sk_buff *skb, | |||
380 | 381 | ||
381 | sband = local->hw.wiphy->bands[local->oper_channel->band]; | 382 | sband = local->hw.wiphy->bands[local->oper_channel->band]; |
382 | if (!sband->ht_cap.ht_supported || | 383 | if (!sband->ht_cap.ht_supported || |
383 | local->_oper_channel_type == NL80211_CHAN_NO_HT) | 384 | sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) |
384 | return 0; | 385 | return 0; |
385 | 386 | ||
386 | if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap)) | 387 | if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap)) |
@@ -397,7 +398,8 @@ int mesh_add_ht_oper_ie(struct sk_buff *skb, | |||
397 | { | 398 | { |
398 | struct ieee80211_local *local = sdata->local; | 399 | struct ieee80211_local *local = sdata->local; |
399 | struct ieee80211_channel *channel = local->oper_channel; | 400 | struct ieee80211_channel *channel = local->oper_channel; |
400 | enum nl80211_channel_type channel_type = local->_oper_channel_type; | 401 | enum nl80211_channel_type channel_type = |
402 | sdata->vif.bss_conf.channel_type; | ||
401 | struct ieee80211_supported_band *sband = | 403 | struct ieee80211_supported_band *sband = |
402 | local->hw.wiphy->bands[channel->band]; | 404 | local->hw.wiphy->bands[channel->band]; |
403 | struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap; | 405 | struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap; |
@@ -608,12 +610,14 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) | |||
608 | sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL; | 610 | sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL; |
609 | sdata->vif.bss_conf.basic_rates = | 611 | sdata->vif.bss_conf.basic_rates = |
610 | ieee80211_mandatory_rates(sdata->local, | 612 | ieee80211_mandatory_rates(sdata->local, |
611 | sdata->local->hw.conf.channel->band); | 613 | sdata->local->oper_channel->band); |
612 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON | | 614 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON | |
613 | BSS_CHANGED_BEACON_ENABLED | | 615 | BSS_CHANGED_BEACON_ENABLED | |
614 | BSS_CHANGED_HT | | 616 | BSS_CHANGED_HT | |
615 | BSS_CHANGED_BASIC_RATES | | 617 | BSS_CHANGED_BASIC_RATES | |
616 | BSS_CHANGED_BEACON_INT); | 618 | BSS_CHANGED_BEACON_INT); |
619 | |||
620 | netif_carrier_on(sdata->dev); | ||
617 | } | 621 | } |
618 | 622 | ||
619 | void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) | 623 | void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) |
@@ -621,9 +625,15 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) | |||
621 | struct ieee80211_local *local = sdata->local; | 625 | struct ieee80211_local *local = sdata->local; |
622 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | 626 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
623 | 627 | ||
628 | netif_carrier_off(sdata->dev); | ||
629 | |||
630 | /* stop the beacon */ | ||
624 | ifmsh->mesh_id_len = 0; | 631 | ifmsh->mesh_id_len = 0; |
625 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); | 632 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); |
626 | sta_info_flush(local, NULL); | 633 | |
634 | /* flush STAs and mpaths on this iface */ | ||
635 | sta_info_flush(sdata->local, sdata); | ||
636 | mesh_path_flush_by_iface(sdata); | ||
627 | 637 | ||
628 | del_timer_sync(&sdata->u.mesh.housekeeping_timer); | 638 | del_timer_sync(&sdata->u.mesh.housekeeping_timer); |
629 | del_timer_sync(&sdata->u.mesh.mesh_path_root_timer); | 639 | del_timer_sync(&sdata->u.mesh.mesh_path_root_timer); |
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index 13fd5b5fdb0a..25d0f17dec71 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h | |||
@@ -215,6 +215,9 @@ struct mesh_rmc { | |||
215 | /* Maximum number of paths per interface */ | 215 | /* Maximum number of paths per interface */ |
216 | #define MESH_MAX_MPATHS 1024 | 216 | #define MESH_MAX_MPATHS 1024 |
217 | 217 | ||
218 | /* Number of frames buffered per destination for unresolved destinations */ | ||
219 | #define MESH_FRAME_QUEUE_LEN 10 | ||
220 | |||
218 | /* Public interfaces */ | 221 | /* Public interfaces */ |
219 | /* Various */ | 222 | /* Various */ |
220 | int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc, | 223 | int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc, |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 494bc39f61a4..47aeee2d8db1 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -17,8 +17,6 @@ | |||
17 | #define MAX_METRIC 0xffffffff | 17 | #define MAX_METRIC 0xffffffff |
18 | #define ARITH_SHIFT 8 | 18 | #define ARITH_SHIFT 8 |
19 | 19 | ||
20 | /* Number of frames buffered per destination for unresolved destinations */ | ||
21 | #define MESH_FRAME_QUEUE_LEN 10 | ||
22 | #define MAX_PREQ_QUEUE_LEN 64 | 20 | #define MAX_PREQ_QUEUE_LEN 64 |
23 | 21 | ||
24 | /* Destination only */ | 22 | /* Destination only */ |
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 075bc535c601..aa749818860e 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -203,23 +203,17 @@ void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta) | |||
203 | { | 203 | { |
204 | struct sk_buff *skb; | 204 | struct sk_buff *skb; |
205 | struct ieee80211_hdr *hdr; | 205 | struct ieee80211_hdr *hdr; |
206 | struct sk_buff_head tmpq; | ||
207 | unsigned long flags; | 206 | unsigned long flags; |
208 | 207 | ||
209 | rcu_assign_pointer(mpath->next_hop, sta); | 208 | rcu_assign_pointer(mpath->next_hop, sta); |
210 | 209 | ||
211 | __skb_queue_head_init(&tmpq); | ||
212 | |||
213 | spin_lock_irqsave(&mpath->frame_queue.lock, flags); | 210 | spin_lock_irqsave(&mpath->frame_queue.lock, flags); |
214 | 211 | skb_queue_walk(&mpath->frame_queue, skb) { | |
215 | while ((skb = __skb_dequeue(&mpath->frame_queue)) != NULL) { | ||
216 | hdr = (struct ieee80211_hdr *) skb->data; | 212 | hdr = (struct ieee80211_hdr *) skb->data; |
217 | memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN); | 213 | memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN); |
218 | memcpy(hdr->addr2, mpath->sdata->vif.addr, ETH_ALEN); | 214 | memcpy(hdr->addr2, mpath->sdata->vif.addr, ETH_ALEN); |
219 | __skb_queue_tail(&tmpq, skb); | ||
220 | } | 215 | } |
221 | 216 | ||
222 | skb_queue_splice(&tmpq, &mpath->frame_queue); | ||
223 | spin_unlock_irqrestore(&mpath->frame_queue.lock, flags); | 217 | spin_unlock_irqrestore(&mpath->frame_queue.lock, flags); |
224 | } | 218 | } |
225 | 219 | ||
@@ -285,40 +279,42 @@ static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, | |||
285 | struct mesh_path *from_mpath, | 279 | struct mesh_path *from_mpath, |
286 | bool copy) | 280 | bool copy) |
287 | { | 281 | { |
288 | struct sk_buff *skb, *cp_skb = NULL; | 282 | struct sk_buff *skb, *fskb, *tmp; |
289 | struct sk_buff_head gateq, failq; | 283 | struct sk_buff_head failq; |
290 | unsigned long flags; | 284 | unsigned long flags; |
291 | int num_skbs; | ||
292 | 285 | ||
293 | BUG_ON(gate_mpath == from_mpath); | 286 | BUG_ON(gate_mpath == from_mpath); |
294 | BUG_ON(!gate_mpath->next_hop); | 287 | BUG_ON(!gate_mpath->next_hop); |
295 | 288 | ||
296 | __skb_queue_head_init(&gateq); | ||
297 | __skb_queue_head_init(&failq); | 289 | __skb_queue_head_init(&failq); |
298 | 290 | ||
299 | spin_lock_irqsave(&from_mpath->frame_queue.lock, flags); | 291 | spin_lock_irqsave(&from_mpath->frame_queue.lock, flags); |
300 | skb_queue_splice_init(&from_mpath->frame_queue, &failq); | 292 | skb_queue_splice_init(&from_mpath->frame_queue, &failq); |
301 | spin_unlock_irqrestore(&from_mpath->frame_queue.lock, flags); | 293 | spin_unlock_irqrestore(&from_mpath->frame_queue.lock, flags); |
302 | 294 | ||
303 | num_skbs = skb_queue_len(&failq); | 295 | skb_queue_walk_safe(&failq, fskb, tmp) { |
304 | 296 | if (skb_queue_len(&gate_mpath->frame_queue) >= | |
305 | while (num_skbs--) { | 297 | MESH_FRAME_QUEUE_LEN) { |
306 | skb = __skb_dequeue(&failq); | 298 | mpath_dbg(gate_mpath->sdata, "mpath queue full!\n"); |
307 | if (copy) { | 299 | break; |
308 | cp_skb = skb_copy(skb, GFP_ATOMIC); | ||
309 | if (cp_skb) | ||
310 | __skb_queue_tail(&failq, cp_skb); | ||
311 | } | 300 | } |
312 | 301 | ||
302 | skb = skb_copy(fskb, GFP_ATOMIC); | ||
303 | if (WARN_ON(!skb)) | ||
304 | break; | ||
305 | |||
313 | prepare_for_gate(skb, gate_mpath->dst, gate_mpath); | 306 | prepare_for_gate(skb, gate_mpath->dst, gate_mpath); |
314 | __skb_queue_tail(&gateq, skb); | 307 | skb_queue_tail(&gate_mpath->frame_queue, skb); |
308 | |||
309 | if (copy) | ||
310 | continue; | ||
311 | |||
312 | __skb_unlink(fskb, &failq); | ||
313 | kfree_skb(fskb); | ||
315 | } | 314 | } |
316 | 315 | ||
317 | spin_lock_irqsave(&gate_mpath->frame_queue.lock, flags); | ||
318 | skb_queue_splice(&gateq, &gate_mpath->frame_queue); | ||
319 | mpath_dbg(gate_mpath->sdata, "Mpath queue for gate %pM has %d frames\n", | 316 | mpath_dbg(gate_mpath->sdata, "Mpath queue for gate %pM has %d frames\n", |
320 | gate_mpath->dst, skb_queue_len(&gate_mpath->frame_queue)); | 317 | gate_mpath->dst, skb_queue_len(&gate_mpath->frame_queue)); |
321 | spin_unlock_irqrestore(&gate_mpath->frame_queue.lock, flags); | ||
322 | 318 | ||
323 | if (!copy) | 319 | if (!copy) |
324 | return; | 320 | return; |
@@ -531,7 +527,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata) | |||
531 | 527 | ||
532 | read_lock_bh(&pathtbl_resize_lock); | 528 | read_lock_bh(&pathtbl_resize_lock); |
533 | memcpy(new_mpath->dst, dst, ETH_ALEN); | 529 | memcpy(new_mpath->dst, dst, ETH_ALEN); |
534 | memset(new_mpath->rann_snd_addr, 0xff, ETH_ALEN); | 530 | eth_broadcast_addr(new_mpath->rann_snd_addr); |
535 | new_mpath->is_root = false; | 531 | new_mpath->is_root = false; |
536 | new_mpath->sdata = sdata; | 532 | new_mpath->sdata = sdata; |
537 | new_mpath->flags = 0; | 533 | new_mpath->flags = 0; |
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index f20e9f26d137..9d7ad366ef09 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -117,7 +117,7 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata) | |||
117 | u16 ht_opmode; | 117 | u16 ht_opmode; |
118 | bool non_ht_sta = false, ht20_sta = false; | 118 | bool non_ht_sta = false, ht20_sta = false; |
119 | 119 | ||
120 | if (local->_oper_channel_type == NL80211_CHAN_NO_HT) | 120 | if (sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) |
121 | return 0; | 121 | return 0; |
122 | 122 | ||
123 | rcu_read_lock(); | 123 | rcu_read_lock(); |
@@ -147,7 +147,8 @@ out: | |||
147 | 147 | ||
148 | if (non_ht_sta) | 148 | if (non_ht_sta) |
149 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; | 149 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
150 | else if (ht20_sta && local->_oper_channel_type > NL80211_CHAN_HT20) | 150 | else if (ht20_sta && |
151 | sdata->vif.bss_conf.channel_type > NL80211_CHAN_HT20) | ||
151 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; | 152 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
152 | else | 153 | else |
153 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONE; | 154 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
@@ -215,12 +216,14 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
215 | u8 *da, __le16 llid, __le16 plid, __le16 reason) { | 216 | u8 *da, __le16 llid, __le16 plid, __le16 reason) { |
216 | struct ieee80211_local *local = sdata->local; | 217 | struct ieee80211_local *local = sdata->local; |
217 | struct sk_buff *skb; | 218 | struct sk_buff *skb; |
219 | struct ieee80211_tx_info *info; | ||
218 | struct ieee80211_mgmt *mgmt; | 220 | struct ieee80211_mgmt *mgmt; |
219 | bool include_plid = false; | 221 | bool include_plid = false; |
220 | u16 peering_proto = 0; | 222 | u16 peering_proto = 0; |
221 | u8 *pos, ie_len = 4; | 223 | u8 *pos, ie_len = 4; |
222 | int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.self_prot) + | 224 | int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.self_prot) + |
223 | sizeof(mgmt->u.action.u.self_prot); | 225 | sizeof(mgmt->u.action.u.self_prot); |
226 | int err = -ENOMEM; | ||
224 | 227 | ||
225 | skb = dev_alloc_skb(local->tx_headroom + | 228 | skb = dev_alloc_skb(local->tx_headroom + |
226 | hdr_len + | 229 | hdr_len + |
@@ -236,6 +239,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
236 | sdata->u.mesh.ie_len); | 239 | sdata->u.mesh.ie_len); |
237 | if (!skb) | 240 | if (!skb) |
238 | return -1; | 241 | return -1; |
242 | info = IEEE80211_SKB_CB(skb); | ||
239 | skb_reserve(skb, local->tx_headroom); | 243 | skb_reserve(skb, local->tx_headroom); |
240 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); | 244 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); |
241 | memset(mgmt, 0, hdr_len); | 245 | memset(mgmt, 0, hdr_len); |
@@ -256,15 +260,18 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
256 | pos = skb_put(skb, 2); | 260 | pos = skb_put(skb, 2); |
257 | memcpy(pos + 2, &plid, 2); | 261 | memcpy(pos + 2, &plid, 2); |
258 | } | 262 | } |
259 | if (ieee80211_add_srates_ie(sdata, skb, true) || | 263 | if (ieee80211_add_srates_ie(sdata, skb, true, |
260 | ieee80211_add_ext_srates_ie(sdata, skb, true) || | 264 | local->oper_channel->band) || |
265 | ieee80211_add_ext_srates_ie(sdata, skb, true, | ||
266 | local->oper_channel->band) || | ||
261 | mesh_add_rsn_ie(skb, sdata) || | 267 | mesh_add_rsn_ie(skb, sdata) || |
262 | mesh_add_meshid_ie(skb, sdata) || | 268 | mesh_add_meshid_ie(skb, sdata) || |
263 | mesh_add_meshconf_ie(skb, sdata)) | 269 | mesh_add_meshconf_ie(skb, sdata)) |
264 | return -1; | 270 | goto free; |
265 | } else { /* WLAN_SP_MESH_PEERING_CLOSE */ | 271 | } else { /* WLAN_SP_MESH_PEERING_CLOSE */ |
272 | info->flags |= IEEE80211_TX_CTL_NO_ACK; | ||
266 | if (mesh_add_meshid_ie(skb, sdata)) | 273 | if (mesh_add_meshid_ie(skb, sdata)) |
267 | return -1; | 274 | goto free; |
268 | } | 275 | } |
269 | 276 | ||
270 | /* Add Mesh Peering Management element */ | 277 | /* Add Mesh Peering Management element */ |
@@ -283,11 +290,12 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
283 | ie_len += 2; /* reason code */ | 290 | ie_len += 2; /* reason code */ |
284 | break; | 291 | break; |
285 | default: | 292 | default: |
286 | return -EINVAL; | 293 | err = -EINVAL; |
294 | goto free; | ||
287 | } | 295 | } |
288 | 296 | ||
289 | if (WARN_ON(skb_tailroom(skb) < 2 + ie_len)) | 297 | if (WARN_ON(skb_tailroom(skb) < 2 + ie_len)) |
290 | return -ENOMEM; | 298 | goto free; |
291 | 299 | ||
292 | pos = skb_put(skb, 2 + ie_len); | 300 | pos = skb_put(skb, 2 + ie_len); |
293 | *pos++ = WLAN_EID_PEER_MGMT; | 301 | *pos++ = WLAN_EID_PEER_MGMT; |
@@ -308,14 +316,17 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
308 | if (action != WLAN_SP_MESH_PEERING_CLOSE) { | 316 | if (action != WLAN_SP_MESH_PEERING_CLOSE) { |
309 | if (mesh_add_ht_cap_ie(skb, sdata) || | 317 | if (mesh_add_ht_cap_ie(skb, sdata) || |
310 | mesh_add_ht_oper_ie(skb, sdata)) | 318 | mesh_add_ht_oper_ie(skb, sdata)) |
311 | return -1; | 319 | goto free; |
312 | } | 320 | } |
313 | 321 | ||
314 | if (mesh_add_vendor_ies(skb, sdata)) | 322 | if (mesh_add_vendor_ies(skb, sdata)) |
315 | return -1; | 323 | goto free; |
316 | 324 | ||
317 | ieee80211_tx_skb(sdata, skb); | 325 | ieee80211_tx_skb(sdata, skb); |
318 | return 0; | 326 | return 0; |
327 | free: | ||
328 | kfree_skb(skb); | ||
329 | return err; | ||
319 | } | 330 | } |
320 | 331 | ||
321 | /** | 332 | /** |
@@ -360,9 +371,14 @@ static struct sta_info *mesh_peer_init(struct ieee80211_sub_if_data *sdata, | |||
360 | 371 | ||
361 | spin_lock_bh(&sta->lock); | 372 | spin_lock_bh(&sta->lock); |
362 | sta->last_rx = jiffies; | 373 | sta->last_rx = jiffies; |
374 | if (sta->plink_state == NL80211_PLINK_ESTAB) { | ||
375 | spin_unlock_bh(&sta->lock); | ||
376 | return sta; | ||
377 | } | ||
378 | |||
363 | sta->sta.supp_rates[band] = rates; | 379 | sta->sta.supp_rates[band] = rates; |
364 | if (elems->ht_cap_elem && | 380 | if (elems->ht_cap_elem && |
365 | sdata->local->_oper_channel_type != NL80211_CHAN_NO_HT) | 381 | sdata->vif.bss_conf.channel_type != NL80211_CHAN_NO_HT) |
366 | ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, | 382 | ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, |
367 | elems->ht_cap_elem, | 383 | elems->ht_cap_elem, |
368 | &sta->sta.ht_cap); | 384 | &sta->sta.ht_cap); |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index a4a5acdbaa4d..a8cf70bf1cba 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -146,6 +146,9 @@ void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata) | |||
146 | if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) | 146 | if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) |
147 | return; | 147 | return; |
148 | 148 | ||
149 | if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) | ||
150 | return; | ||
151 | |||
149 | mod_timer(&sdata->u.mgd.bcn_mon_timer, | 152 | mod_timer(&sdata->u.mgd.bcn_mon_timer, |
150 | round_jiffies_up(jiffies + sdata->u.mgd.beacon_timeout)); | 153 | round_jiffies_up(jiffies + sdata->u.mgd.beacon_timeout)); |
151 | } | 154 | } |
@@ -182,15 +185,15 @@ static u32 ieee80211_config_ht_tx(struct ieee80211_sub_if_data *sdata, | |||
182 | u16 ht_opmode; | 185 | u16 ht_opmode; |
183 | bool disable_40 = false; | 186 | bool disable_40 = false; |
184 | 187 | ||
185 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 188 | sband = local->hw.wiphy->bands[local->oper_channel->band]; |
186 | 189 | ||
187 | switch (sdata->vif.bss_conf.channel_type) { | 190 | switch (sdata->vif.bss_conf.channel_type) { |
188 | case NL80211_CHAN_HT40PLUS: | 191 | case NL80211_CHAN_HT40PLUS: |
189 | if (local->hw.conf.channel->flags & IEEE80211_CHAN_NO_HT40PLUS) | 192 | if (local->oper_channel->flags & IEEE80211_CHAN_NO_HT40PLUS) |
190 | disable_40 = true; | 193 | disable_40 = true; |
191 | break; | 194 | break; |
192 | case NL80211_CHAN_HT40MINUS: | 195 | case NL80211_CHAN_HT40MINUS: |
193 | if (local->hw.conf.channel->flags & IEEE80211_CHAN_NO_HT40MINUS) | 196 | if (local->oper_channel->flags & IEEE80211_CHAN_NO_HT40MINUS) |
194 | disable_40 = true; | 197 | disable_40 = true; |
195 | break; | 198 | break; |
196 | default: | 199 | default: |
@@ -326,6 +329,26 @@ static void ieee80211_add_ht_ie(struct ieee80211_sub_if_data *sdata, | |||
326 | ieee80211_ie_build_ht_cap(pos, &ht_cap, cap); | 329 | ieee80211_ie_build_ht_cap(pos, &ht_cap, cap); |
327 | } | 330 | } |
328 | 331 | ||
332 | static void ieee80211_add_vht_ie(struct ieee80211_sub_if_data *sdata, | ||
333 | struct sk_buff *skb, | ||
334 | struct ieee80211_supported_band *sband) | ||
335 | { | ||
336 | u8 *pos; | ||
337 | u32 cap; | ||
338 | struct ieee80211_sta_vht_cap vht_cap; | ||
339 | |||
340 | BUILD_BUG_ON(sizeof(vht_cap) != sizeof(sband->vht_cap)); | ||
341 | |||
342 | memcpy(&vht_cap, &sband->vht_cap, sizeof(vht_cap)); | ||
343 | |||
344 | /* determine capability flags */ | ||
345 | cap = vht_cap.cap; | ||
346 | |||
347 | /* reserve and fill IE */ | ||
348 | pos = skb_put(skb, sizeof(struct ieee80211_vht_capabilities) + 2); | ||
349 | ieee80211_ie_build_vht_cap(pos, &vht_cap, cap); | ||
350 | } | ||
351 | |||
329 | static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | 352 | static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) |
330 | { | 353 | { |
331 | struct ieee80211_local *local = sdata->local; | 354 | struct ieee80211_local *local = sdata->local; |
@@ -371,6 +394,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | |||
371 | 4 + /* power capability */ | 394 | 4 + /* power capability */ |
372 | 2 + 2 * sband->n_channels + /* supported channels */ | 395 | 2 + 2 * sband->n_channels + /* supported channels */ |
373 | 2 + sizeof(struct ieee80211_ht_cap) + /* HT */ | 396 | 2 + sizeof(struct ieee80211_ht_cap) + /* HT */ |
397 | 2 + sizeof(struct ieee80211_vht_capabilities) + /* VHT */ | ||
374 | assoc_data->ie_len + /* extra IEs */ | 398 | assoc_data->ie_len + /* extra IEs */ |
375 | 9, /* WMM */ | 399 | 9, /* WMM */ |
376 | GFP_KERNEL); | 400 | GFP_KERNEL); |
@@ -503,6 +527,9 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | |||
503 | ieee80211_add_ht_ie(sdata, skb, assoc_data->ap_ht_param, | 527 | ieee80211_add_ht_ie(sdata, skb, assoc_data->ap_ht_param, |
504 | sband, local->oper_channel, ifmgd->ap_smps); | 528 | sband, local->oper_channel, ifmgd->ap_smps); |
505 | 529 | ||
530 | if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) | ||
531 | ieee80211_add_vht_ie(sdata, skb, sband); | ||
532 | |||
506 | /* if present, add any custom non-vendor IEs that go after HT */ | 533 | /* if present, add any custom non-vendor IEs that go after HT */ |
507 | if (assoc_data->ie_len && assoc_data->ie) { | 534 | if (assoc_data->ie_len && assoc_data->ie) { |
508 | noffset = ieee80211_ie_split_vendor(assoc_data->ie, | 535 | noffset = ieee80211_ie_split_vendor(assoc_data->ie, |
@@ -583,8 +610,6 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, | |||
583 | IEEE80211_SKB_CB(skb)->flags |= | 610 | IEEE80211_SKB_CB(skb)->flags |= |
584 | IEEE80211_TX_INTFL_DONT_ENCRYPT; | 611 | IEEE80211_TX_INTFL_DONT_ENCRYPT; |
585 | 612 | ||
586 | drv_mgd_prepare_tx(local, sdata); | ||
587 | |||
588 | ieee80211_tx_skb(sdata, skb); | 613 | ieee80211_tx_skb(sdata, skb); |
589 | } | 614 | } |
590 | } | 615 | } |
@@ -687,6 +712,7 @@ static void ieee80211_chswitch_work(struct work_struct *work) | |||
687 | /* XXX: shouldn't really modify cfg80211-owned data! */ | 712 | /* XXX: shouldn't really modify cfg80211-owned data! */ |
688 | ifmgd->associated->channel = sdata->local->oper_channel; | 713 | ifmgd->associated->channel = sdata->local->oper_channel; |
689 | 714 | ||
715 | /* XXX: wait for a beacon first? */ | ||
690 | ieee80211_wake_queues_by_reason(&sdata->local->hw, | 716 | ieee80211_wake_queues_by_reason(&sdata->local->hw, |
691 | IEEE80211_QUEUE_STOP_REASON_CSA); | 717 | IEEE80211_QUEUE_STOP_REASON_CSA); |
692 | out: | 718 | out: |
@@ -763,36 +789,32 @@ void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
763 | 789 | ||
764 | sdata->local->csa_channel = new_ch; | 790 | sdata->local->csa_channel = new_ch; |
765 | 791 | ||
792 | ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; | ||
793 | |||
794 | if (sw_elem->mode) | ||
795 | ieee80211_stop_queues_by_reason(&sdata->local->hw, | ||
796 | IEEE80211_QUEUE_STOP_REASON_CSA); | ||
797 | |||
766 | if (sdata->local->ops->channel_switch) { | 798 | if (sdata->local->ops->channel_switch) { |
767 | /* use driver's channel switch callback */ | 799 | /* use driver's channel switch callback */ |
768 | struct ieee80211_channel_switch ch_switch; | 800 | struct ieee80211_channel_switch ch_switch = { |
769 | memset(&ch_switch, 0, sizeof(ch_switch)); | 801 | .timestamp = timestamp, |
770 | ch_switch.timestamp = timestamp; | 802 | .block_tx = sw_elem->mode, |
771 | if (sw_elem->mode) { | 803 | .channel = new_ch, |
772 | ch_switch.block_tx = true; | 804 | .count = sw_elem->count, |
773 | ieee80211_stop_queues_by_reason(&sdata->local->hw, | 805 | }; |
774 | IEEE80211_QUEUE_STOP_REASON_CSA); | 806 | |
775 | } | ||
776 | ch_switch.channel = new_ch; | ||
777 | ch_switch.count = sw_elem->count; | ||
778 | ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; | ||
779 | drv_channel_switch(sdata->local, &ch_switch); | 807 | drv_channel_switch(sdata->local, &ch_switch); |
780 | return; | 808 | return; |
781 | } | 809 | } |
782 | 810 | ||
783 | /* channel switch handled in software */ | 811 | /* channel switch handled in software */ |
784 | if (sw_elem->count <= 1) { | 812 | if (sw_elem->count <= 1) |
785 | ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); | 813 | ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); |
786 | } else { | 814 | else |
787 | if (sw_elem->mode) | ||
788 | ieee80211_stop_queues_by_reason(&sdata->local->hw, | ||
789 | IEEE80211_QUEUE_STOP_REASON_CSA); | ||
790 | ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; | ||
791 | mod_timer(&ifmgd->chswitch_timer, | 815 | mod_timer(&ifmgd->chswitch_timer, |
792 | jiffies + | 816 | TU_TO_EXP_TIME(sw_elem->count * |
793 | msecs_to_jiffies(sw_elem->count * | 817 | cbss->beacon_interval)); |
794 | cbss->beacon_interval)); | ||
795 | } | ||
796 | } | 818 | } |
797 | 819 | ||
798 | static void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, | 820 | static void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, |
@@ -1007,6 +1029,16 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency) | |||
1007 | ieee80211_change_ps(local); | 1029 | ieee80211_change_ps(local); |
1008 | } | 1030 | } |
1009 | 1031 | ||
1032 | void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata) | ||
1033 | { | ||
1034 | bool ps_allowed = ieee80211_powersave_allowed(sdata); | ||
1035 | |||
1036 | if (sdata->vif.bss_conf.ps != ps_allowed) { | ||
1037 | sdata->vif.bss_conf.ps = ps_allowed; | ||
1038 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_PS); | ||
1039 | } | ||
1040 | } | ||
1041 | |||
1010 | void ieee80211_dynamic_ps_disable_work(struct work_struct *work) | 1042 | void ieee80211_dynamic_ps_disable_work(struct work_struct *work) |
1011 | { | 1043 | { |
1012 | struct ieee80211_local *local = | 1044 | struct ieee80211_local *local = |
@@ -1239,7 +1271,7 @@ static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, | |||
1239 | } | 1271 | } |
1240 | 1272 | ||
1241 | use_short_slot = !!(capab & WLAN_CAPABILITY_SHORT_SLOT_TIME); | 1273 | use_short_slot = !!(capab & WLAN_CAPABILITY_SHORT_SLOT_TIME); |
1242 | if (sdata->local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) | 1274 | if (sdata->local->oper_channel->band == IEEE80211_BAND_5GHZ) |
1243 | use_short_slot = true; | 1275 | use_short_slot = true; |
1244 | 1276 | ||
1245 | if (use_protection != bss_conf->use_cts_prot) { | 1277 | if (use_protection != bss_conf->use_cts_prot) { |
@@ -1310,6 +1342,8 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
1310 | ieee80211_recalc_smps(local); | 1342 | ieee80211_recalc_smps(local); |
1311 | mutex_unlock(&local->iflist_mtx); | 1343 | mutex_unlock(&local->iflist_mtx); |
1312 | 1344 | ||
1345 | ieee80211_recalc_ps_vif(sdata); | ||
1346 | |||
1313 | netif_tx_start_all_queues(sdata->dev); | 1347 | netif_tx_start_all_queues(sdata->dev); |
1314 | netif_carrier_on(sdata->dev); | 1348 | netif_carrier_on(sdata->dev); |
1315 | } | 1349 | } |
@@ -1371,6 +1405,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1371 | } | 1405 | } |
1372 | local->ps_sdata = NULL; | 1406 | local->ps_sdata = NULL; |
1373 | 1407 | ||
1408 | /* disable per-vif ps */ | ||
1409 | ieee80211_recalc_ps_vif(sdata); | ||
1410 | |||
1374 | /* flush out any pending frame (e.g. DELBA) before deauth/disassoc */ | 1411 | /* flush out any pending frame (e.g. DELBA) before deauth/disassoc */ |
1375 | if (tx) | 1412 | if (tx) |
1376 | drv_flush(local, false); | 1413 | drv_flush(local, false); |
@@ -1542,7 +1579,8 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) | |||
1542 | ssid_len = ssid[1]; | 1579 | ssid_len = ssid[1]; |
1543 | 1580 | ||
1544 | ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid_len, NULL, | 1581 | ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid_len, NULL, |
1545 | 0, (u32) -1, true, false); | 1582 | 0, (u32) -1, true, false, |
1583 | ifmgd->associated->channel); | ||
1546 | } | 1584 | } |
1547 | 1585 | ||
1548 | ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); | 1586 | ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); |
@@ -1645,7 +1683,9 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw, | |||
1645 | ssid_len = ssid[1]; | 1683 | ssid_len = ssid[1]; |
1646 | 1684 | ||
1647 | skb = ieee80211_build_probe_req(sdata, cbss->bssid, | 1685 | skb = ieee80211_build_probe_req(sdata, cbss->bssid, |
1648 | (u32) -1, ssid + 2, ssid_len, | 1686 | (u32) -1, |
1687 | sdata->local->oper_channel, | ||
1688 | ssid + 2, ssid_len, | ||
1649 | NULL, 0, true); | 1689 | NULL, 0, true); |
1650 | 1690 | ||
1651 | return skb; | 1691 | return skb; |
@@ -1656,7 +1696,6 @@ static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata) | |||
1656 | { | 1696 | { |
1657 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 1697 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
1658 | struct ieee80211_local *local = sdata->local; | 1698 | struct ieee80211_local *local = sdata->local; |
1659 | u8 bssid[ETH_ALEN]; | ||
1660 | u8 frame_buf[DEAUTH_DISASSOC_LEN]; | 1699 | u8 frame_buf[DEAUTH_DISASSOC_LEN]; |
1661 | 1700 | ||
1662 | mutex_lock(&ifmgd->mtx); | 1701 | mutex_lock(&ifmgd->mtx); |
@@ -1665,9 +1704,8 @@ static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata) | |||
1665 | return; | 1704 | return; |
1666 | } | 1705 | } |
1667 | 1706 | ||
1668 | memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); | 1707 | sdata_info(sdata, "Connection to AP %pM lost\n", |
1669 | 1708 | ifmgd->associated->bssid); | |
1670 | sdata_info(sdata, "Connection to AP %pM lost\n", bssid); | ||
1671 | 1709 | ||
1672 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | 1710 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, |
1673 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, | 1711 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, |
@@ -1685,7 +1723,7 @@ static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata) | |||
1685 | mutex_unlock(&local->mtx); | 1723 | mutex_unlock(&local->mtx); |
1686 | } | 1724 | } |
1687 | 1725 | ||
1688 | void ieee80211_beacon_connection_loss_work(struct work_struct *work) | 1726 | static void ieee80211_beacon_connection_loss_work(struct work_struct *work) |
1689 | { | 1727 | { |
1690 | struct ieee80211_sub_if_data *sdata = | 1728 | struct ieee80211_sub_if_data *sdata = |
1691 | container_of(work, struct ieee80211_sub_if_data, | 1729 | container_of(work, struct ieee80211_sub_if_data, |
@@ -2232,14 +2270,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
2232 | mutex_unlock(&local->iflist_mtx); | 2270 | mutex_unlock(&local->iflist_mtx); |
2233 | } | 2271 | } |
2234 | 2272 | ||
2235 | if (elems->ch_switch_elem && (elems->ch_switch_elem_len == 3) && | 2273 | if (elems->ch_switch_ie && |
2236 | (memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid, | 2274 | memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid, ETH_ALEN) == 0) |
2237 | ETH_ALEN) == 0)) { | 2275 | ieee80211_sta_process_chanswitch(sdata, elems->ch_switch_ie, |
2238 | struct ieee80211_channel_sw_ie *sw_elem = | ||
2239 | (struct ieee80211_channel_sw_ie *)elems->ch_switch_elem; | ||
2240 | ieee80211_sta_process_chanswitch(sdata, sw_elem, | ||
2241 | bss, rx_status->mactime); | 2276 | bss, rx_status->mactime); |
2242 | } | ||
2243 | } | 2277 | } |
2244 | 2278 | ||
2245 | 2279 | ||
@@ -2326,7 +2360,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
2326 | if (baselen > len) | 2360 | if (baselen > len) |
2327 | return; | 2361 | return; |
2328 | 2362 | ||
2329 | if (rx_status->freq != local->hw.conf.channel->center_freq) | 2363 | if (rx_status->freq != local->oper_channel->center_freq) |
2330 | return; | 2364 | return; |
2331 | 2365 | ||
2332 | if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon && | 2366 | if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon && |
@@ -2490,7 +2524,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
2490 | !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) { | 2524 | !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) { |
2491 | struct ieee80211_supported_band *sband; | 2525 | struct ieee80211_supported_band *sband; |
2492 | 2526 | ||
2493 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 2527 | sband = local->hw.wiphy->bands[local->oper_channel->band]; |
2494 | 2528 | ||
2495 | changed |= ieee80211_config_ht_tx(sdata, elems.ht_operation, | 2529 | changed |= ieee80211_config_ht_tx(sdata, elems.ht_operation, |
2496 | bssid, true); | 2530 | bssid, true); |
@@ -2673,7 +2707,8 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) | |||
2673 | * will not answer to direct packet in unassociated state. | 2707 | * will not answer to direct packet in unassociated state. |
2674 | */ | 2708 | */ |
2675 | ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1], | 2709 | ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1], |
2676 | NULL, 0, (u32) -1, true, false); | 2710 | NULL, 0, (u32) -1, true, false, |
2711 | auth_data->bss->channel); | ||
2677 | } | 2712 | } |
2678 | 2713 | ||
2679 | auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; | 2714 | auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; |
@@ -3000,41 +3035,17 @@ int ieee80211_max_network_latency(struct notifier_block *nb, | |||
3000 | return 0; | 3035 | return 0; |
3001 | } | 3036 | } |
3002 | 3037 | ||
3003 | static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | 3038 | static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, |
3004 | struct cfg80211_bss *cbss, bool assoc) | 3039 | struct cfg80211_bss *cbss) |
3005 | { | 3040 | { |
3006 | struct ieee80211_local *local = sdata->local; | 3041 | struct ieee80211_local *local = sdata->local; |
3007 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 3042 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
3008 | struct ieee80211_bss *bss = (void *)cbss->priv; | ||
3009 | struct sta_info *sta = NULL; | ||
3010 | bool have_sta = false; | ||
3011 | int err; | ||
3012 | int ht_cfreq; | 3043 | int ht_cfreq; |
3013 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; | 3044 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; |
3014 | const u8 *ht_oper_ie; | 3045 | const u8 *ht_oper_ie; |
3015 | const struct ieee80211_ht_operation *ht_oper = NULL; | 3046 | const struct ieee80211_ht_operation *ht_oper = NULL; |
3016 | struct ieee80211_supported_band *sband; | 3047 | struct ieee80211_supported_band *sband; |
3017 | 3048 | ||
3018 | if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) | ||
3019 | return -EINVAL; | ||
3020 | |||
3021 | if (assoc) { | ||
3022 | rcu_read_lock(); | ||
3023 | have_sta = sta_info_get(sdata, cbss->bssid); | ||
3024 | rcu_read_unlock(); | ||
3025 | } | ||
3026 | |||
3027 | if (!have_sta) { | ||
3028 | sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL); | ||
3029 | if (!sta) | ||
3030 | return -ENOMEM; | ||
3031 | } | ||
3032 | |||
3033 | mutex_lock(&local->mtx); | ||
3034 | ieee80211_recalc_idle(sdata->local); | ||
3035 | mutex_unlock(&local->mtx); | ||
3036 | |||
3037 | /* switch to the right channel */ | ||
3038 | sband = local->hw.wiphy->bands[cbss->channel->band]; | 3049 | sband = local->hw.wiphy->bands[cbss->channel->band]; |
3039 | 3050 | ||
3040 | ifmgd->flags &= ~IEEE80211_STA_DISABLE_40MHZ; | 3051 | ifmgd->flags &= ~IEEE80211_STA_DISABLE_40MHZ; |
@@ -3097,10 +3108,51 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3097 | local->oper_channel = cbss->channel; | 3108 | local->oper_channel = cbss->channel; |
3098 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); | 3109 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); |
3099 | 3110 | ||
3100 | if (sta) { | 3111 | return 0; |
3112 | } | ||
3113 | |||
3114 | static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | ||
3115 | struct cfg80211_bss *cbss, bool assoc) | ||
3116 | { | ||
3117 | struct ieee80211_local *local = sdata->local; | ||
3118 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | ||
3119 | struct ieee80211_bss *bss = (void *)cbss->priv; | ||
3120 | struct sta_info *new_sta = NULL; | ||
3121 | bool have_sta = false; | ||
3122 | int err; | ||
3123 | |||
3124 | if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) | ||
3125 | return -EINVAL; | ||
3126 | |||
3127 | if (assoc) { | ||
3128 | rcu_read_lock(); | ||
3129 | have_sta = sta_info_get(sdata, cbss->bssid); | ||
3130 | rcu_read_unlock(); | ||
3131 | } | ||
3132 | |||
3133 | if (!have_sta) { | ||
3134 | new_sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL); | ||
3135 | if (!new_sta) | ||
3136 | return -ENOMEM; | ||
3137 | } | ||
3138 | |||
3139 | mutex_lock(&local->mtx); | ||
3140 | ieee80211_recalc_idle(sdata->local); | ||
3141 | mutex_unlock(&local->mtx); | ||
3142 | |||
3143 | if (new_sta) { | ||
3101 | u32 rates = 0, basic_rates = 0; | 3144 | u32 rates = 0, basic_rates = 0; |
3102 | bool have_higher_than_11mbit; | 3145 | bool have_higher_than_11mbit; |
3103 | int min_rate = INT_MAX, min_rate_index = -1; | 3146 | int min_rate = INT_MAX, min_rate_index = -1; |
3147 | struct ieee80211_supported_band *sband; | ||
3148 | |||
3149 | sband = local->hw.wiphy->bands[cbss->channel->band]; | ||
3150 | |||
3151 | err = ieee80211_prep_channel(sdata, cbss); | ||
3152 | if (err) { | ||
3153 | sta_info_free(local, new_sta); | ||
3154 | return err; | ||
3155 | } | ||
3104 | 3156 | ||
3105 | ieee80211_get_rates(sband, bss->supp_rates, | 3157 | ieee80211_get_rates(sband, bss->supp_rates, |
3106 | bss->supp_rates_len, | 3158 | bss->supp_rates_len, |
@@ -3122,7 +3174,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3122 | basic_rates = BIT(min_rate_index); | 3174 | basic_rates = BIT(min_rate_index); |
3123 | } | 3175 | } |
3124 | 3176 | ||
3125 | sta->sta.supp_rates[cbss->channel->band] = rates; | 3177 | new_sta->sta.supp_rates[cbss->channel->band] = rates; |
3126 | sdata->vif.bss_conf.basic_rates = basic_rates; | 3178 | sdata->vif.bss_conf.basic_rates = basic_rates; |
3127 | 3179 | ||
3128 | /* cf. IEEE 802.11 9.2.12 */ | 3180 | /* cf. IEEE 802.11 9.2.12 */ |
@@ -3145,10 +3197,10 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3145 | BSS_CHANGED_BEACON_INT); | 3197 | BSS_CHANGED_BEACON_INT); |
3146 | 3198 | ||
3147 | if (assoc) | 3199 | if (assoc) |
3148 | sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); | 3200 | sta_info_pre_move_state(new_sta, IEEE80211_STA_AUTH); |
3149 | 3201 | ||
3150 | err = sta_info_insert(sta); | 3202 | err = sta_info_insert(new_sta); |
3151 | sta = NULL; | 3203 | new_sta = NULL; |
3152 | if (err) { | 3204 | if (err) { |
3153 | sdata_info(sdata, | 3205 | sdata_info(sdata, |
3154 | "failed to insert STA entry for the AP (error %d)\n", | 3206 | "failed to insert STA entry for the AP (error %d)\n", |
@@ -3300,9 +3352,13 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
3300 | } | 3352 | } |
3301 | 3353 | ||
3302 | /* prepare assoc data */ | 3354 | /* prepare assoc data */ |
3303 | 3355 | ||
3304 | ifmgd->flags &= ~IEEE80211_STA_DISABLE_11N; | 3356 | /* |
3305 | ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; | 3357 | * keep only the 40 MHz disable bit set as it might have |
3358 | * been set during authentication already, all other bits | ||
3359 | * should be reset for a new connection | ||
3360 | */ | ||
3361 | ifmgd->flags &= IEEE80211_STA_DISABLE_40MHZ; | ||
3306 | 3362 | ||
3307 | ifmgd->beacon_crc_valid = false; | 3363 | ifmgd->beacon_crc_valid = false; |
3308 | 3364 | ||
@@ -3318,21 +3374,34 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
3318 | req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP || | 3374 | req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP || |
3319 | req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) { | 3375 | req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) { |
3320 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; | 3376 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; |
3377 | ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; | ||
3321 | netdev_info(sdata->dev, | 3378 | netdev_info(sdata->dev, |
3322 | "disabling HT due to WEP/TKIP use\n"); | 3379 | "disabling HT/VHT due to WEP/TKIP use\n"); |
3323 | } | 3380 | } |
3324 | } | 3381 | } |
3325 | 3382 | ||
3326 | if (req->flags & ASSOC_REQ_DISABLE_HT) | 3383 | if (req->flags & ASSOC_REQ_DISABLE_HT) { |
3327 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; | 3384 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; |
3385 | ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; | ||
3386 | } | ||
3328 | 3387 | ||
3329 | /* Also disable HT if we don't support it or the AP doesn't use WMM */ | 3388 | /* Also disable HT if we don't support it or the AP doesn't use WMM */ |
3330 | sband = local->hw.wiphy->bands[req->bss->channel->band]; | 3389 | sband = local->hw.wiphy->bands[req->bss->channel->band]; |
3331 | if (!sband->ht_cap.ht_supported || | 3390 | if (!sband->ht_cap.ht_supported || |
3332 | local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used) { | 3391 | local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used) { |
3333 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; | 3392 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; |
3334 | netdev_info(sdata->dev, | 3393 | if (!bss->wmm_used) |
3335 | "disabling HT as WMM/QoS is not supported\n"); | 3394 | netdev_info(sdata->dev, |
3395 | "disabling HT as WMM/QoS is not supported by the AP\n"); | ||
3396 | } | ||
3397 | |||
3398 | /* disable VHT if we don't support it or the AP doesn't use WMM */ | ||
3399 | if (!sband->vht_cap.vht_supported || | ||
3400 | local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used) { | ||
3401 | ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; | ||
3402 | if (!bss->wmm_used) | ||
3403 | netdev_info(sdata->dev, | ||
3404 | "disabling VHT as WMM/QoS is not supported by the AP\n"); | ||
3336 | } | 3405 | } |
3337 | 3406 | ||
3338 | memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa)); | 3407 | memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa)); |
@@ -3467,14 +3536,17 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
3467 | req->bssid, req->reason_code); | 3536 | req->bssid, req->reason_code); |
3468 | 3537 | ||
3469 | if (ifmgd->associated && | 3538 | if (ifmgd->associated && |
3470 | ether_addr_equal(ifmgd->associated->bssid, req->bssid)) | 3539 | ether_addr_equal(ifmgd->associated->bssid, req->bssid)) { |
3471 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | 3540 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, |
3472 | req->reason_code, true, frame_buf); | 3541 | req->reason_code, true, frame_buf); |
3473 | else | 3542 | } else { |
3543 | drv_mgd_prepare_tx(sdata->local, sdata); | ||
3474 | ieee80211_send_deauth_disassoc(sdata, req->bssid, | 3544 | ieee80211_send_deauth_disassoc(sdata, req->bssid, |
3475 | IEEE80211_STYPE_DEAUTH, | 3545 | IEEE80211_STYPE_DEAUTH, |
3476 | req->reason_code, true, | 3546 | req->reason_code, true, |
3477 | frame_buf); | 3547 | frame_buf); |
3548 | } | ||
3549 | |||
3478 | mutex_unlock(&ifmgd->mtx); | 3550 | mutex_unlock(&ifmgd->mtx); |
3479 | 3551 | ||
3480 | __cfg80211_send_deauth(sdata->dev, frame_buf, DEAUTH_DISASSOC_LEN); | 3552 | __cfg80211_send_deauth(sdata->dev, frame_buf, DEAUTH_DISASSOC_LEN); |
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c index 635c3250c668..507121dad082 100644 --- a/net/mac80211/offchannel.c +++ b/net/mac80211/offchannel.c | |||
@@ -116,6 +116,9 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, | |||
116 | if (!ieee80211_sdata_running(sdata)) | 116 | if (!ieee80211_sdata_running(sdata)) |
117 | continue; | 117 | continue; |
118 | 118 | ||
119 | if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) | ||
120 | continue; | ||
121 | |||
119 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) | 122 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) |
120 | set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); | 123 | set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); |
121 | 124 | ||
@@ -144,6 +147,9 @@ void ieee80211_offchannel_return(struct ieee80211_local *local, | |||
144 | 147 | ||
145 | mutex_lock(&local->iflist_mtx); | 148 | mutex_lock(&local->iflist_mtx); |
146 | list_for_each_entry(sdata, &local->interfaces, list) { | 149 | list_for_each_entry(sdata, &local->interfaces, list) { |
150 | if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) | ||
151 | continue; | ||
152 | |||
147 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) | 153 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) |
148 | clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); | 154 | clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); |
149 | 155 | ||
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h index 6e4fd32c6617..10de668eb9f6 100644 --- a/net/mac80211/rate.h +++ b/net/mac80211/rate.h | |||
@@ -56,7 +56,7 @@ static inline void rate_control_rate_init(struct sta_info *sta) | |||
56 | if (!ref) | 56 | if (!ref) |
57 | return; | 57 | return; |
58 | 58 | ||
59 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 59 | sband = local->hw.wiphy->bands[local->oper_channel->band]; |
60 | 60 | ||
61 | ref->ops->rate_init(ref->priv, sband, ista, priv_sta); | 61 | ref->ops->rate_init(ref->priv, sband, ista, priv_sta); |
62 | set_sta_flag(sta, WLAN_STA_RATE_CONTROL); | 62 | set_sta_flag(sta, WLAN_STA_RATE_CONTROL); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 0cb4edee6af5..b382605c5733 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -60,7 +60,9 @@ static inline int should_drop_frame(struct sk_buff *skb, | |||
60 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 60 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
61 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 61 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
62 | 62 | ||
63 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) | 63 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | |
64 | RX_FLAG_FAILED_PLCP_CRC | | ||
65 | RX_FLAG_AMPDU_IS_ZEROLEN)) | ||
64 | return 1; | 66 | return 1; |
65 | if (unlikely(skb->len < 16 + present_fcs_len)) | 67 | if (unlikely(skb->len < 16 + present_fcs_len)) |
66 | return 1; | 68 | return 1; |
@@ -91,6 +93,13 @@ ieee80211_rx_radiotap_len(struct ieee80211_local *local, | |||
91 | if (status->flag & RX_FLAG_HT) /* HT info */ | 93 | if (status->flag & RX_FLAG_HT) /* HT info */ |
92 | len += 3; | 94 | len += 3; |
93 | 95 | ||
96 | if (status->flag & RX_FLAG_AMPDU_DETAILS) { | ||
97 | /* padding */ | ||
98 | while (len & 3) | ||
99 | len++; | ||
100 | len += 8; | ||
101 | } | ||
102 | |||
94 | return len; | 103 | return len; |
95 | } | 104 | } |
96 | 105 | ||
@@ -215,6 +224,37 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
215 | pos++; | 224 | pos++; |
216 | *pos++ = status->rate_idx; | 225 | *pos++ = status->rate_idx; |
217 | } | 226 | } |
227 | |||
228 | if (status->flag & RX_FLAG_AMPDU_DETAILS) { | ||
229 | u16 flags = 0; | ||
230 | |||
231 | /* ensure 4 byte alignment */ | ||
232 | while ((pos - (u8 *)rthdr) & 3) | ||
233 | pos++; | ||
234 | rthdr->it_present |= | ||
235 | cpu_to_le32(1 << IEEE80211_RADIOTAP_AMPDU_STATUS); | ||
236 | put_unaligned_le32(status->ampdu_reference, pos); | ||
237 | pos += 4; | ||
238 | if (status->flag & RX_FLAG_AMPDU_REPORT_ZEROLEN) | ||
239 | flags |= IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN; | ||
240 | if (status->flag & RX_FLAG_AMPDU_IS_ZEROLEN) | ||
241 | flags |= IEEE80211_RADIOTAP_AMPDU_IS_ZEROLEN; | ||
242 | if (status->flag & RX_FLAG_AMPDU_LAST_KNOWN) | ||
243 | flags |= IEEE80211_RADIOTAP_AMPDU_LAST_KNOWN; | ||
244 | if (status->flag & RX_FLAG_AMPDU_IS_LAST) | ||
245 | flags |= IEEE80211_RADIOTAP_AMPDU_IS_LAST; | ||
246 | if (status->flag & RX_FLAG_AMPDU_DELIM_CRC_ERROR) | ||
247 | flags |= IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR; | ||
248 | if (status->flag & RX_FLAG_AMPDU_DELIM_CRC_KNOWN) | ||
249 | flags |= IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN; | ||
250 | put_unaligned_le16(flags, pos); | ||
251 | pos += 2; | ||
252 | if (status->flag & RX_FLAG_AMPDU_DELIM_CRC_KNOWN) | ||
253 | *pos++ = status->ampdu_delimiter_crc; | ||
254 | else | ||
255 | *pos++ = 0; | ||
256 | *pos++ = 0; | ||
257 | } | ||
218 | } | 258 | } |
219 | 259 | ||
220 | /* | 260 | /* |
@@ -2268,7 +2308,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
2268 | 2308 | ||
2269 | goto queue; | 2309 | goto queue; |
2270 | case WLAN_CATEGORY_SPECTRUM_MGMT: | 2310 | case WLAN_CATEGORY_SPECTRUM_MGMT: |
2271 | if (local->hw.conf.channel->band != IEEE80211_BAND_5GHZ) | 2311 | if (status->band != IEEE80211_BAND_5GHZ) |
2272 | break; | 2312 | break; |
2273 | 2313 | ||
2274 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 2314 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
@@ -2772,8 +2812,7 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx, | |||
2772 | if (!bssid) { | 2812 | if (!bssid) { |
2773 | if (!ether_addr_equal(sdata->vif.addr, hdr->addr1)) | 2813 | if (!ether_addr_equal(sdata->vif.addr, hdr->addr1)) |
2774 | return 0; | 2814 | return 0; |
2775 | } else if (!ieee80211_bssid_match(bssid, | 2815 | } else if (!ieee80211_bssid_match(bssid, sdata->vif.addr)) { |
2776 | sdata->vif.addr)) { | ||
2777 | /* | 2816 | /* |
2778 | * Accept public action frames even when the | 2817 | * Accept public action frames even when the |
2779 | * BSSID doesn't match, this is used for P2P | 2818 | * BSSID doesn't match, this is used for P2P |
@@ -2793,9 +2832,18 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx, | |||
2793 | if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2)) | 2832 | if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2)) |
2794 | return 0; | 2833 | return 0; |
2795 | break; | 2834 | break; |
2835 | case NL80211_IFTYPE_P2P_DEVICE: | ||
2836 | if (!ieee80211_is_public_action(hdr, skb->len) && | ||
2837 | !ieee80211_is_probe_req(hdr->frame_control) && | ||
2838 | !ieee80211_is_probe_resp(hdr->frame_control) && | ||
2839 | !ieee80211_is_beacon(hdr->frame_control)) | ||
2840 | return 0; | ||
2841 | if (!ether_addr_equal(sdata->vif.addr, hdr->addr1)) | ||
2842 | status->rx_flags &= ~IEEE80211_RX_RA_MATCH; | ||
2843 | break; | ||
2796 | default: | 2844 | default: |
2797 | /* should never get here */ | 2845 | /* should never get here */ |
2798 | WARN_ON(1); | 2846 | WARN_ON_ONCE(1); |
2799 | break; | 2847 | break; |
2800 | } | 2848 | } |
2801 | 2849 | ||
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 839dd9737989..740e414d44f4 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -416,7 +416,8 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local, | |||
416 | local->scan_req->ssids[i].ssid_len, | 416 | local->scan_req->ssids[i].ssid_len, |
417 | local->scan_req->ie, local->scan_req->ie_len, | 417 | local->scan_req->ie, local->scan_req->ie_len, |
418 | local->scan_req->rates[band], false, | 418 | local->scan_req->rates[band], false, |
419 | local->scan_req->no_cck); | 419 | local->scan_req->no_cck, |
420 | local->hw.conf.channel); | ||
420 | 421 | ||
421 | /* | 422 | /* |
422 | * After sending probe requests, wait for probe responses | 423 | * After sending probe requests, wait for probe responses |
@@ -479,11 +480,10 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, | |||
479 | if (local->ops->hw_scan) { | 480 | if (local->ops->hw_scan) { |
480 | __set_bit(SCAN_HW_SCANNING, &local->scanning); | 481 | __set_bit(SCAN_HW_SCANNING, &local->scanning); |
481 | } else if ((req->n_channels == 1) && | 482 | } else if ((req->n_channels == 1) && |
482 | (req->channels[0]->center_freq == | 483 | (req->channels[0] == local->oper_channel)) { |
483 | local->hw.conf.channel->center_freq)) { | 484 | /* |
484 | 485 | * If we are scanning only on the operating channel | |
485 | /* If we are scanning only on the current channel, then | 486 | * then we do not need to stop normal activities |
486 | * we do not need to stop normal activities | ||
487 | */ | 487 | */ |
488 | unsigned long next_delay; | 488 | unsigned long next_delay; |
489 | 489 | ||
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 8cd72914cdaf..b0801b7d572d 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -519,19 +519,27 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
519 | u64 cookie = (unsigned long)skb; | 519 | u64 cookie = (unsigned long)skb; |
520 | acked = info->flags & IEEE80211_TX_STAT_ACK; | 520 | acked = info->flags & IEEE80211_TX_STAT_ACK; |
521 | 521 | ||
522 | /* | ||
523 | * TODO: When we have non-netdev frame TX, | ||
524 | * we cannot use skb->dev->ieee80211_ptr | ||
525 | */ | ||
526 | |||
527 | if (ieee80211_is_nullfunc(hdr->frame_control) || | 522 | if (ieee80211_is_nullfunc(hdr->frame_control) || |
528 | ieee80211_is_qos_nullfunc(hdr->frame_control)) | 523 | ieee80211_is_qos_nullfunc(hdr->frame_control)) { |
529 | cfg80211_probe_status(skb->dev, hdr->addr1, | 524 | cfg80211_probe_status(skb->dev, hdr->addr1, |
530 | cookie, acked, GFP_ATOMIC); | 525 | cookie, acked, GFP_ATOMIC); |
531 | else | 526 | } else if (skb->dev) { |
532 | cfg80211_mgmt_tx_status( | 527 | cfg80211_mgmt_tx_status( |
533 | skb->dev->ieee80211_ptr, cookie, skb->data, | 528 | skb->dev->ieee80211_ptr, cookie, skb->data, |
534 | skb->len, acked, GFP_ATOMIC); | 529 | skb->len, acked, GFP_ATOMIC); |
530 | } else { | ||
531 | struct ieee80211_sub_if_data *p2p_sdata; | ||
532 | |||
533 | rcu_read_lock(); | ||
534 | |||
535 | p2p_sdata = rcu_dereference(local->p2p_sdata); | ||
536 | if (p2p_sdata) { | ||
537 | cfg80211_mgmt_tx_status( | ||
538 | &p2p_sdata->wdev, cookie, skb->data, | ||
539 | skb->len, acked, GFP_ATOMIC); | ||
540 | } | ||
541 | rcu_read_unlock(); | ||
542 | } | ||
535 | } | 543 | } |
536 | 544 | ||
537 | if (unlikely(info->ack_frame_id)) { | 545 | if (unlikely(info->ack_frame_id)) { |
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index c6d33b55b2df..18d9c8a52e9e 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h | |||
@@ -24,7 +24,7 @@ | |||
24 | __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") | 24 | __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") |
25 | #define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ | 25 | #define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ |
26 | __entry->p2p = sdata->vif.p2p; \ | 26 | __entry->p2p = sdata->vif.p2p; \ |
27 | __assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") | 27 | __assign_str(vif_name, sdata->dev ? sdata->dev->name : sdata->name) |
28 | #define VIF_PR_FMT " vif:%s(%d%s)" | 28 | #define VIF_PR_FMT " vif:%s(%d%s)" |
29 | #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" | 29 | #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" |
30 | 30 | ||
@@ -274,9 +274,12 @@ TRACE_EVENT(drv_config, | |||
274 | __entry->dynamic_ps_timeout = local->hw.conf.dynamic_ps_timeout; | 274 | __entry->dynamic_ps_timeout = local->hw.conf.dynamic_ps_timeout; |
275 | __entry->max_sleep_period = local->hw.conf.max_sleep_period; | 275 | __entry->max_sleep_period = local->hw.conf.max_sleep_period; |
276 | __entry->listen_interval = local->hw.conf.listen_interval; | 276 | __entry->listen_interval = local->hw.conf.listen_interval; |
277 | __entry->long_frame_max_tx_count = local->hw.conf.long_frame_max_tx_count; | 277 | __entry->long_frame_max_tx_count = |
278 | __entry->short_frame_max_tx_count = local->hw.conf.short_frame_max_tx_count; | 278 | local->hw.conf.long_frame_max_tx_count; |
279 | __entry->center_freq = local->hw.conf.channel->center_freq; | 279 | __entry->short_frame_max_tx_count = |
280 | local->hw.conf.short_frame_max_tx_count; | ||
281 | __entry->center_freq = local->hw.conf.channel ? | ||
282 | local->hw.conf.channel->center_freq : 0; | ||
280 | __entry->channel_type = local->hw.conf.channel_type; | 283 | __entry->channel_type = local->hw.conf.channel_type; |
281 | __entry->smps = local->hw.conf.smps_mode; | 284 | __entry->smps = local->hw.conf.smps_mode; |
282 | ), | 285 | ), |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index acf712ffb5e6..3b807bcb8fc9 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -55,7 +55,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, | |||
55 | if (WARN_ON_ONCE(info->control.rates[0].idx < 0)) | 55 | if (WARN_ON_ONCE(info->control.rates[0].idx < 0)) |
56 | return 0; | 56 | return 0; |
57 | 57 | ||
58 | sband = local->hw.wiphy->bands[tx->channel->band]; | 58 | sband = local->hw.wiphy->bands[info->band]; |
59 | txrate = &sband->bitrates[info->control.rates[0].idx]; | 59 | txrate = &sband->bitrates[info->control.rates[0].idx]; |
60 | 60 | ||
61 | erp = txrate->flags & IEEE80211_RATE_ERP_G; | 61 | erp = txrate->flags & IEEE80211_RATE_ERP_G; |
@@ -615,7 +615,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
615 | 615 | ||
616 | memset(&txrc, 0, sizeof(txrc)); | 616 | memset(&txrc, 0, sizeof(txrc)); |
617 | 617 | ||
618 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 618 | sband = tx->local->hw.wiphy->bands[info->band]; |
619 | 619 | ||
620 | len = min_t(u32, tx->skb->len + FCS_LEN, | 620 | len = min_t(u32, tx->skb->len + FCS_LEN, |
621 | tx->local->hw.wiphy->frag_threshold); | 621 | tx->local->hw.wiphy->frag_threshold); |
@@ -626,13 +626,13 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
626 | txrc.bss_conf = &tx->sdata->vif.bss_conf; | 626 | txrc.bss_conf = &tx->sdata->vif.bss_conf; |
627 | txrc.skb = tx->skb; | 627 | txrc.skb = tx->skb; |
628 | txrc.reported_rate.idx = -1; | 628 | txrc.reported_rate.idx = -1; |
629 | txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[tx->channel->band]; | 629 | txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[info->band]; |
630 | if (txrc.rate_idx_mask == (1 << sband->n_bitrates) - 1) | 630 | if (txrc.rate_idx_mask == (1 << sband->n_bitrates) - 1) |
631 | txrc.max_rate_idx = -1; | 631 | txrc.max_rate_idx = -1; |
632 | else | 632 | else |
633 | txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; | 633 | txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; |
634 | memcpy(txrc.rate_idx_mcs_mask, | 634 | memcpy(txrc.rate_idx_mcs_mask, |
635 | tx->sdata->rc_rateidx_mcs_mask[tx->channel->band], | 635 | tx->sdata->rc_rateidx_mcs_mask[info->band], |
636 | sizeof(txrc.rate_idx_mcs_mask)); | 636 | sizeof(txrc.rate_idx_mcs_mask)); |
637 | txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP || | 637 | txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP || |
638 | tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT || | 638 | tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT || |
@@ -667,7 +667,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
667 | "scanning and associated. Target station: " | 667 | "scanning and associated. Target station: " |
668 | "%pM on %d GHz band\n", | 668 | "%pM on %d GHz band\n", |
669 | tx->sdata->name, hdr->addr1, | 669 | tx->sdata->name, hdr->addr1, |
670 | tx->channel->band ? 5 : 2)) | 670 | info->band ? 5 : 2)) |
671 | return TX_DROP; | 671 | return TX_DROP; |
672 | 672 | ||
673 | /* | 673 | /* |
@@ -1131,7 +1131,6 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
1131 | tx->skb = skb; | 1131 | tx->skb = skb; |
1132 | tx->local = local; | 1132 | tx->local = local; |
1133 | tx->sdata = sdata; | 1133 | tx->sdata = sdata; |
1134 | tx->channel = local->hw.conf.channel; | ||
1135 | __skb_queue_head_init(&tx->skbs); | 1134 | __skb_queue_head_init(&tx->skbs); |
1136 | 1135 | ||
1137 | /* | 1136 | /* |
@@ -1204,6 +1203,7 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local, | |||
1204 | struct sk_buff_head *skbs, | 1203 | struct sk_buff_head *skbs, |
1205 | bool txpending) | 1204 | bool txpending) |
1206 | { | 1205 | { |
1206 | struct ieee80211_tx_control control; | ||
1207 | struct sk_buff *skb, *tmp; | 1207 | struct sk_buff *skb, *tmp; |
1208 | unsigned long flags; | 1208 | unsigned long flags; |
1209 | 1209 | ||
@@ -1240,10 +1240,10 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local, | |||
1240 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); | 1240 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
1241 | 1241 | ||
1242 | info->control.vif = vif; | 1242 | info->control.vif = vif; |
1243 | info->control.sta = sta; | 1243 | control.sta = sta; |
1244 | 1244 | ||
1245 | __skb_unlink(skb, skbs); | 1245 | __skb_unlink(skb, skbs); |
1246 | drv_tx(local, skb); | 1246 | drv_tx(local, &control, skb); |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | return true; | 1249 | return true; |
@@ -1399,8 +1399,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, | |||
1399 | goto out; | 1399 | goto out; |
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | tx.channel = local->hw.conf.channel; | 1402 | info->band = local->hw.conf.channel->band; |
1403 | info->band = tx.channel->band; | ||
1404 | 1403 | ||
1405 | /* set up hw_queue value early */ | 1404 | /* set up hw_queue value early */ |
1406 | if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) || | 1405 | if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) || |
@@ -1720,7 +1719,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1720 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1719 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1721 | struct ieee80211_local *local = sdata->local; | 1720 | struct ieee80211_local *local = sdata->local; |
1722 | struct ieee80211_tx_info *info; | 1721 | struct ieee80211_tx_info *info; |
1723 | int ret = NETDEV_TX_BUSY, head_need; | 1722 | int head_need; |
1724 | u16 ethertype, hdrlen, meshhdrlen = 0; | 1723 | u16 ethertype, hdrlen, meshhdrlen = 0; |
1725 | __le16 fc; | 1724 | __le16 fc; |
1726 | struct ieee80211_hdr hdr; | 1725 | struct ieee80211_hdr hdr; |
@@ -1736,10 +1735,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1736 | u32 info_flags = 0; | 1735 | u32 info_flags = 0; |
1737 | u16 info_id = 0; | 1736 | u16 info_id = 0; |
1738 | 1737 | ||
1739 | if (unlikely(skb->len < ETH_HLEN)) { | 1738 | if (unlikely(skb->len < ETH_HLEN)) |
1740 | ret = NETDEV_TX_OK; | ||
1741 | goto fail; | 1739 | goto fail; |
1742 | } | ||
1743 | 1740 | ||
1744 | /* convert Ethernet header to proper 802.11 header (based on | 1741 | /* convert Ethernet header to proper 802.11 header (based on |
1745 | * operation mode) */ | 1742 | * operation mode) */ |
@@ -1787,7 +1784,6 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1787 | if (!sdata->u.mesh.mshcfg.dot11MeshTTL) { | 1784 | if (!sdata->u.mesh.mshcfg.dot11MeshTTL) { |
1788 | /* Do not send frames with mesh_ttl == 0 */ | 1785 | /* Do not send frames with mesh_ttl == 0 */ |
1789 | sdata->u.mesh.mshstats.dropped_frames_ttl++; | 1786 | sdata->u.mesh.mshstats.dropped_frames_ttl++; |
1790 | ret = NETDEV_TX_OK; | ||
1791 | goto fail; | 1787 | goto fail; |
1792 | } | 1788 | } |
1793 | rcu_read_lock(); | 1789 | rcu_read_lock(); |
@@ -1880,10 +1876,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1880 | 1876 | ||
1881 | if (tdls_direct) { | 1877 | if (tdls_direct) { |
1882 | /* link during setup - throw out frames to peer */ | 1878 | /* link during setup - throw out frames to peer */ |
1883 | if (!tdls_auth) { | 1879 | if (!tdls_auth) |
1884 | ret = NETDEV_TX_OK; | ||
1885 | goto fail; | 1880 | goto fail; |
1886 | } | ||
1887 | 1881 | ||
1888 | /* DA SA BSSID */ | 1882 | /* DA SA BSSID */ |
1889 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 1883 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
@@ -1917,7 +1911,6 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1917 | hdrlen = 24; | 1911 | hdrlen = 24; |
1918 | break; | 1912 | break; |
1919 | default: | 1913 | default: |
1920 | ret = NETDEV_TX_OK; | ||
1921 | goto fail; | 1914 | goto fail; |
1922 | } | 1915 | } |
1923 | 1916 | ||
@@ -1962,7 +1955,6 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1962 | 1955 | ||
1963 | I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); | 1956 | I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); |
1964 | 1957 | ||
1965 | ret = NETDEV_TX_OK; | ||
1966 | goto fail; | 1958 | goto fail; |
1967 | } | 1959 | } |
1968 | 1960 | ||
@@ -2017,10 +2009,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
2017 | skb = skb_clone(skb, GFP_ATOMIC); | 2009 | skb = skb_clone(skb, GFP_ATOMIC); |
2018 | kfree_skb(tmp_skb); | 2010 | kfree_skb(tmp_skb); |
2019 | 2011 | ||
2020 | if (!skb) { | 2012 | if (!skb) |
2021 | ret = NETDEV_TX_OK; | ||
2022 | goto fail; | 2013 | goto fail; |
2023 | } | ||
2024 | } | 2014 | } |
2025 | 2015 | ||
2026 | hdr.frame_control = fc; | 2016 | hdr.frame_control = fc; |
@@ -2123,10 +2113,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
2123 | return NETDEV_TX_OK; | 2113 | return NETDEV_TX_OK; |
2124 | 2114 | ||
2125 | fail: | 2115 | fail: |
2126 | if (ret == NETDEV_TX_OK) | 2116 | dev_kfree_skb(skb); |
2127 | dev_kfree_skb(skb); | 2117 | return NETDEV_TX_OK; |
2128 | |||
2129 | return ret; | ||
2130 | } | 2118 | } |
2131 | 2119 | ||
2132 | 2120 | ||
@@ -2301,12 +2289,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2301 | struct ieee80211_sub_if_data *sdata = NULL; | 2289 | struct ieee80211_sub_if_data *sdata = NULL; |
2302 | struct ieee80211_if_ap *ap = NULL; | 2290 | struct ieee80211_if_ap *ap = NULL; |
2303 | struct beacon_data *beacon; | 2291 | struct beacon_data *beacon; |
2304 | struct ieee80211_supported_band *sband; | 2292 | enum ieee80211_band band = local->oper_channel->band; |
2305 | enum ieee80211_band band = local->hw.conf.channel->band; | ||
2306 | struct ieee80211_tx_rate_control txrc; | 2293 | struct ieee80211_tx_rate_control txrc; |
2307 | 2294 | ||
2308 | sband = local->hw.wiphy->bands[band]; | ||
2309 | |||
2310 | rcu_read_lock(); | 2295 | rcu_read_lock(); |
2311 | 2296 | ||
2312 | sdata = vif_to_sdata(vif); | 2297 | sdata = vif_to_sdata(vif); |
@@ -2416,7 +2401,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2416 | memset(mgmt, 0, hdr_len); | 2401 | memset(mgmt, 0, hdr_len); |
2417 | mgmt->frame_control = | 2402 | mgmt->frame_control = |
2418 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); | 2403 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
2419 | memset(mgmt->da, 0xff, ETH_ALEN); | 2404 | eth_broadcast_addr(mgmt->da); |
2420 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); | 2405 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
2421 | memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); | 2406 | memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); |
2422 | mgmt->u.beacon.beacon_int = | 2407 | mgmt->u.beacon.beacon_int = |
@@ -2428,9 +2413,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2428 | *pos++ = WLAN_EID_SSID; | 2413 | *pos++ = WLAN_EID_SSID; |
2429 | *pos++ = 0x0; | 2414 | *pos++ = 0x0; |
2430 | 2415 | ||
2431 | if (ieee80211_add_srates_ie(sdata, skb, true) || | 2416 | if (ieee80211_add_srates_ie(sdata, skb, true, band) || |
2432 | mesh_add_ds_params_ie(skb, sdata) || | 2417 | mesh_add_ds_params_ie(skb, sdata) || |
2433 | ieee80211_add_ext_srates_ie(sdata, skb, true) || | 2418 | ieee80211_add_ext_srates_ie(sdata, skb, true, band) || |
2434 | mesh_add_rsn_ie(skb, sdata) || | 2419 | mesh_add_rsn_ie(skb, sdata) || |
2435 | mesh_add_ht_cap_ie(skb, sdata) || | 2420 | mesh_add_ht_cap_ie(skb, sdata) || |
2436 | mesh_add_ht_oper_ie(skb, sdata) || | 2421 | mesh_add_ht_oper_ie(skb, sdata) || |
@@ -2453,12 +2438,12 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2453 | 2438 | ||
2454 | memset(&txrc, 0, sizeof(txrc)); | 2439 | memset(&txrc, 0, sizeof(txrc)); |
2455 | txrc.hw = hw; | 2440 | txrc.hw = hw; |
2456 | txrc.sband = sband; | 2441 | txrc.sband = local->hw.wiphy->bands[band]; |
2457 | txrc.bss_conf = &sdata->vif.bss_conf; | 2442 | txrc.bss_conf = &sdata->vif.bss_conf; |
2458 | txrc.skb = skb; | 2443 | txrc.skb = skb; |
2459 | txrc.reported_rate.idx = -1; | 2444 | txrc.reported_rate.idx = -1; |
2460 | txrc.rate_idx_mask = sdata->rc_rateidx_mask[band]; | 2445 | txrc.rate_idx_mask = sdata->rc_rateidx_mask[band]; |
2461 | if (txrc.rate_idx_mask == (1 << sband->n_bitrates) - 1) | 2446 | if (txrc.rate_idx_mask == (1 << txrc.sband->n_bitrates) - 1) |
2462 | txrc.max_rate_idx = -1; | 2447 | txrc.max_rate_idx = -1; |
2463 | else | 2448 | else |
2464 | txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; | 2449 | txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; |
@@ -2482,7 +2467,8 @@ struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, | |||
2482 | struct ieee80211_vif *vif) | 2467 | struct ieee80211_vif *vif) |
2483 | { | 2468 | { |
2484 | struct ieee80211_if_ap *ap = NULL; | 2469 | struct ieee80211_if_ap *ap = NULL; |
2485 | struct sk_buff *presp = NULL, *skb = NULL; | 2470 | struct sk_buff *skb = NULL; |
2471 | struct probe_resp *presp = NULL; | ||
2486 | struct ieee80211_hdr *hdr; | 2472 | struct ieee80211_hdr *hdr; |
2487 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | 2473 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); |
2488 | 2474 | ||
@@ -2496,10 +2482,12 @@ struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, | |||
2496 | if (!presp) | 2482 | if (!presp) |
2497 | goto out; | 2483 | goto out; |
2498 | 2484 | ||
2499 | skb = skb_copy(presp, GFP_ATOMIC); | 2485 | skb = dev_alloc_skb(presp->len); |
2500 | if (!skb) | 2486 | if (!skb) |
2501 | goto out; | 2487 | goto out; |
2502 | 2488 | ||
2489 | memcpy(skb_put(skb, presp->len), presp->data, presp->len); | ||
2490 | |||
2503 | hdr = (struct ieee80211_hdr *) skb->data; | 2491 | hdr = (struct ieee80211_hdr *) skb->data; |
2504 | memset(hdr->addr1, 0, sizeof(hdr->addr1)); | 2492 | memset(hdr->addr1, 0, sizeof(hdr->addr1)); |
2505 | 2493 | ||
@@ -2610,9 +2598,9 @@ struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, | |||
2610 | memset(hdr, 0, sizeof(*hdr)); | 2598 | memset(hdr, 0, sizeof(*hdr)); |
2611 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 2599 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
2612 | IEEE80211_STYPE_PROBE_REQ); | 2600 | IEEE80211_STYPE_PROBE_REQ); |
2613 | memset(hdr->addr1, 0xff, ETH_ALEN); | 2601 | eth_broadcast_addr(hdr->addr1); |
2614 | memcpy(hdr->addr2, vif->addr, ETH_ALEN); | 2602 | memcpy(hdr->addr2, vif->addr, ETH_ALEN); |
2615 | memset(hdr->addr3, 0xff, ETH_ALEN); | 2603 | eth_broadcast_addr(hdr->addr3); |
2616 | 2604 | ||
2617 | pos = skb_put(skb, ie_ssid_len); | 2605 | pos = skb_put(skb, ie_ssid_len); |
2618 | *pos++ = WLAN_EID_SSID; | 2606 | *pos++ = WLAN_EID_SSID; |
@@ -2709,8 +2697,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
2709 | info = IEEE80211_SKB_CB(skb); | 2697 | info = IEEE80211_SKB_CB(skb); |
2710 | 2698 | ||
2711 | tx.flags |= IEEE80211_TX_PS_BUFFERED; | 2699 | tx.flags |= IEEE80211_TX_PS_BUFFERED; |
2712 | tx.channel = local->hw.conf.channel; | 2700 | info->band = local->oper_channel->band; |
2713 | info->band = tx.channel->band; | ||
2714 | 2701 | ||
2715 | if (invoke_tx_handlers(&tx)) | 2702 | if (invoke_tx_handlers(&tx)) |
2716 | skb = NULL; | 2703 | skb = NULL; |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 39b82fee4904..471fb0516c99 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -276,6 +276,9 @@ void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue) | |||
276 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 276 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
277 | int ac; | 277 | int ac; |
278 | 278 | ||
279 | if (!sdata->dev) | ||
280 | continue; | ||
281 | |||
279 | if (test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) | 282 | if (test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) |
280 | continue; | 283 | continue; |
281 | 284 | ||
@@ -364,6 +367,9 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue, | |||
364 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 367 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
365 | int ac; | 368 | int ac; |
366 | 369 | ||
370 | if (!sdata->dev) | ||
371 | continue; | ||
372 | |||
367 | for (ac = 0; ac < n_acs; ac++) { | 373 | for (ac = 0; ac < n_acs; ac++) { |
368 | if (sdata->vif.hw_queue[ac] == queue || | 374 | if (sdata->vif.hw_queue[ac] == queue || |
369 | sdata->vif.cab_queue == queue) | 375 | sdata->vif.cab_queue == queue) |
@@ -768,8 +774,11 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, | |||
768 | elem_parse_failed = true; | 774 | elem_parse_failed = true; |
769 | break; | 775 | break; |
770 | case WLAN_EID_CHANNEL_SWITCH: | 776 | case WLAN_EID_CHANNEL_SWITCH: |
771 | elems->ch_switch_elem = pos; | 777 | if (elen != sizeof(struct ieee80211_channel_sw_ie)) { |
772 | elems->ch_switch_elem_len = elen; | 778 | elem_parse_failed = true; |
779 | break; | ||
780 | } | ||
781 | elems->ch_switch_ie = (void *)pos; | ||
773 | break; | 782 | break; |
774 | case WLAN_EID_QUIET: | 783 | case WLAN_EID_QUIET: |
775 | if (!elems->quiet_elem) { | 784 | if (!elems->quiet_elem) { |
@@ -832,7 +841,7 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, | |||
832 | 841 | ||
833 | memset(&qparam, 0, sizeof(qparam)); | 842 | memset(&qparam, 0, sizeof(qparam)); |
834 | 843 | ||
835 | use_11b = (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ) && | 844 | use_11b = (local->oper_channel->band == IEEE80211_BAND_2GHZ) && |
836 | !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); | 845 | !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); |
837 | 846 | ||
838 | /* | 847 | /* |
@@ -899,7 +908,8 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, | |||
899 | drv_conf_tx(local, sdata, ac, &qparam); | 908 | drv_conf_tx(local, sdata, ac, &qparam); |
900 | } | 909 | } |
901 | 910 | ||
902 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { | 911 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR && |
912 | sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE) { | ||
903 | sdata->vif.bss_conf.qos = enable_qos; | 913 | sdata->vif.bss_conf.qos = enable_qos; |
904 | if (bss_notify) | 914 | if (bss_notify) |
905 | ieee80211_bss_info_change_notify(sdata, | 915 | ieee80211_bss_info_change_notify(sdata, |
@@ -919,7 +929,7 @@ void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, | |||
919 | if ((supp_rates[i] & 0x7f) * 5 > 110) | 929 | if ((supp_rates[i] & 0x7f) * 5 > 110) |
920 | have_higher_than_11mbit = 1; | 930 | have_higher_than_11mbit = 1; |
921 | 931 | ||
922 | if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && | 932 | if (local->oper_channel->band == IEEE80211_BAND_2GHZ && |
923 | have_higher_than_11mbit) | 933 | have_higher_than_11mbit) |
924 | sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; | 934 | sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; |
925 | else | 935 | else |
@@ -1100,6 +1110,7 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, | |||
1100 | 1110 | ||
1101 | struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | 1111 | struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, |
1102 | u8 *dst, u32 ratemask, | 1112 | u8 *dst, u32 ratemask, |
1113 | struct ieee80211_channel *chan, | ||
1103 | const u8 *ssid, size_t ssid_len, | 1114 | const u8 *ssid, size_t ssid_len, |
1104 | const u8 *ie, size_t ie_len, | 1115 | const u8 *ie, size_t ie_len, |
1105 | bool directed) | 1116 | bool directed) |
@@ -1109,7 +1120,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1109 | struct ieee80211_mgmt *mgmt; | 1120 | struct ieee80211_mgmt *mgmt; |
1110 | size_t buf_len; | 1121 | size_t buf_len; |
1111 | u8 *buf; | 1122 | u8 *buf; |
1112 | u8 chan; | 1123 | u8 chan_no; |
1113 | 1124 | ||
1114 | /* FIXME: come up with a proper value */ | 1125 | /* FIXME: come up with a proper value */ |
1115 | buf = kmalloc(200 + ie_len, GFP_KERNEL); | 1126 | buf = kmalloc(200 + ie_len, GFP_KERNEL); |
@@ -1122,14 +1133,12 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1122 | * badly-behaved APs don't respond when this parameter is included. | 1133 | * badly-behaved APs don't respond when this parameter is included. |
1123 | */ | 1134 | */ |
1124 | if (directed) | 1135 | if (directed) |
1125 | chan = 0; | 1136 | chan_no = 0; |
1126 | else | 1137 | else |
1127 | chan = ieee80211_frequency_to_channel( | 1138 | chan_no = ieee80211_frequency_to_channel(chan->center_freq); |
1128 | local->hw.conf.channel->center_freq); | ||
1129 | 1139 | ||
1130 | buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, | 1140 | buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, chan->band, |
1131 | local->hw.conf.channel->band, | 1141 | ratemask, chan_no); |
1132 | ratemask, chan); | ||
1133 | 1142 | ||
1134 | skb = ieee80211_probereq_get(&local->hw, &sdata->vif, | 1143 | skb = ieee80211_probereq_get(&local->hw, &sdata->vif, |
1135 | ssid, ssid_len, | 1144 | ssid, ssid_len, |
@@ -1154,11 +1163,13 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1154 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | 1163 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, |
1155 | const u8 *ssid, size_t ssid_len, | 1164 | const u8 *ssid, size_t ssid_len, |
1156 | const u8 *ie, size_t ie_len, | 1165 | const u8 *ie, size_t ie_len, |
1157 | u32 ratemask, bool directed, bool no_cck) | 1166 | u32 ratemask, bool directed, bool no_cck, |
1167 | struct ieee80211_channel *channel) | ||
1158 | { | 1168 | { |
1159 | struct sk_buff *skb; | 1169 | struct sk_buff *skb; |
1160 | 1170 | ||
1161 | skb = ieee80211_build_probe_req(sdata, dst, ratemask, ssid, ssid_len, | 1171 | skb = ieee80211_build_probe_req(sdata, dst, ratemask, channel, |
1172 | ssid, ssid_len, | ||
1162 | ie, ie_len, directed); | 1173 | ie, ie_len, directed); |
1163 | if (skb) { | 1174 | if (skb) { |
1164 | if (no_cck) | 1175 | if (no_cck) |
@@ -1359,7 +1370,8 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1359 | switch (sdata->vif.type) { | 1370 | switch (sdata->vif.type) { |
1360 | case NL80211_IFTYPE_STATION: | 1371 | case NL80211_IFTYPE_STATION: |
1361 | changed |= BSS_CHANGED_ASSOC | | 1372 | changed |= BSS_CHANGED_ASSOC | |
1362 | BSS_CHANGED_ARP_FILTER; | 1373 | BSS_CHANGED_ARP_FILTER | |
1374 | BSS_CHANGED_PS; | ||
1363 | mutex_lock(&sdata->u.mgd.mtx); | 1375 | mutex_lock(&sdata->u.mgd.mtx); |
1364 | ieee80211_bss_info_change_notify(sdata, changed); | 1376 | ieee80211_bss_info_change_notify(sdata, changed); |
1365 | mutex_unlock(&sdata->u.mgd.mtx); | 1377 | mutex_unlock(&sdata->u.mgd.mtx); |
@@ -1385,6 +1397,9 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1385 | case NL80211_IFTYPE_MONITOR: | 1397 | case NL80211_IFTYPE_MONITOR: |
1386 | /* ignore virtual */ | 1398 | /* ignore virtual */ |
1387 | break; | 1399 | break; |
1400 | case NL80211_IFTYPE_P2P_DEVICE: | ||
1401 | changed = BSS_CHANGED_IDLE; | ||
1402 | break; | ||
1388 | case NL80211_IFTYPE_UNSPECIFIED: | 1403 | case NL80211_IFTYPE_UNSPECIFIED: |
1389 | case NUM_NL80211_IFTYPES: | 1404 | case NUM_NL80211_IFTYPES: |
1390 | case NL80211_IFTYPE_P2P_CLIENT: | 1405 | case NL80211_IFTYPE_P2P_CLIENT: |
@@ -1571,6 +1586,8 @@ void ieee80211_recalc_smps(struct ieee80211_local *local) | |||
1571 | list_for_each_entry(sdata, &local->interfaces, list) { | 1586 | list_for_each_entry(sdata, &local->interfaces, list) { |
1572 | if (!ieee80211_sdata_running(sdata)) | 1587 | if (!ieee80211_sdata_running(sdata)) |
1573 | continue; | 1588 | continue; |
1589 | if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) | ||
1590 | continue; | ||
1574 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 1591 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
1575 | goto set; | 1592 | goto set; |
1576 | 1593 | ||
@@ -1809,7 +1826,8 @@ ieee80211_ht_oper_to_channel_type(struct ieee80211_ht_operation *ht_oper) | |||
1809 | } | 1826 | } |
1810 | 1827 | ||
1811 | int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, | 1828 | int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, |
1812 | struct sk_buff *skb, bool need_basic) | 1829 | struct sk_buff *skb, bool need_basic, |
1830 | enum ieee80211_band band) | ||
1813 | { | 1831 | { |
1814 | struct ieee80211_local *local = sdata->local; | 1832 | struct ieee80211_local *local = sdata->local; |
1815 | struct ieee80211_supported_band *sband; | 1833 | struct ieee80211_supported_band *sband; |
@@ -1817,7 +1835,7 @@ int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, | |||
1817 | u8 i, rates, *pos; | 1835 | u8 i, rates, *pos; |
1818 | u32 basic_rates = sdata->vif.bss_conf.basic_rates; | 1836 | u32 basic_rates = sdata->vif.bss_conf.basic_rates; |
1819 | 1837 | ||
1820 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1838 | sband = local->hw.wiphy->bands[band]; |
1821 | rates = sband->n_bitrates; | 1839 | rates = sband->n_bitrates; |
1822 | if (rates > 8) | 1840 | if (rates > 8) |
1823 | rates = 8; | 1841 | rates = 8; |
@@ -1840,7 +1858,8 @@ int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, | |||
1840 | } | 1858 | } |
1841 | 1859 | ||
1842 | int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, | 1860 | int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, |
1843 | struct sk_buff *skb, bool need_basic) | 1861 | struct sk_buff *skb, bool need_basic, |
1862 | enum ieee80211_band band) | ||
1844 | { | 1863 | { |
1845 | struct ieee80211_local *local = sdata->local; | 1864 | struct ieee80211_local *local = sdata->local; |
1846 | struct ieee80211_supported_band *sband; | 1865 | struct ieee80211_supported_band *sband; |
@@ -1848,7 +1867,7 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, | |||
1848 | u8 i, exrates, *pos; | 1867 | u8 i, exrates, *pos; |
1849 | u32 basic_rates = sdata->vif.bss_conf.basic_rates; | 1868 | u32 basic_rates = sdata->vif.bss_conf.basic_rates; |
1850 | 1869 | ||
1851 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1870 | sband = local->hw.wiphy->bands[band]; |
1852 | exrates = sband->n_bitrates; | 1871 | exrates = sband->n_bitrates; |
1853 | if (exrates > 8) | 1872 | if (exrates > 8) |
1854 | exrates -= 8; | 1873 | exrates -= 8; |
diff --git a/net/rfkill/core.c b/net/rfkill/core.c index 752b72360ebc..c275bad12068 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c | |||
@@ -150,6 +150,20 @@ static void rfkill_led_trigger_activate(struct led_classdev *led) | |||
150 | rfkill_led_trigger_event(rfkill); | 150 | rfkill_led_trigger_event(rfkill); |
151 | } | 151 | } |
152 | 152 | ||
153 | const char *rfkill_get_led_trigger_name(struct rfkill *rfkill) | ||
154 | { | ||
155 | return rfkill->led_trigger.name; | ||
156 | } | ||
157 | EXPORT_SYMBOL(rfkill_get_led_trigger_name); | ||
158 | |||
159 | void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name) | ||
160 | { | ||
161 | BUG_ON(!rfkill); | ||
162 | |||
163 | rfkill->ledtrigname = name; | ||
164 | } | ||
165 | EXPORT_SYMBOL(rfkill_set_led_trigger_name); | ||
166 | |||
153 | static int rfkill_led_trigger_register(struct rfkill *rfkill) | 167 | static int rfkill_led_trigger_register(struct rfkill *rfkill) |
154 | { | 168 | { |
155 | rfkill->led_trigger.name = rfkill->ledtrigname | 169 | rfkill->led_trigger.name = rfkill->ledtrigname |
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index d355f67d0cdd..2f876b9ee344 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c | |||
@@ -105,7 +105,7 @@ cfg80211_get_chan_state(struct wireless_dev *wdev, | |||
105 | 105 | ||
106 | ASSERT_WDEV_LOCK(wdev); | 106 | ASSERT_WDEV_LOCK(wdev); |
107 | 107 | ||
108 | if (!netif_running(wdev->netdev)) | 108 | if (wdev->netdev && !netif_running(wdev->netdev)) |
109 | return; | 109 | return; |
110 | 110 | ||
111 | switch (wdev->iftype) { | 111 | switch (wdev->iftype) { |
@@ -143,6 +143,11 @@ cfg80211_get_chan_state(struct wireless_dev *wdev, | |||
143 | case NL80211_IFTYPE_WDS: | 143 | case NL80211_IFTYPE_WDS: |
144 | /* these interface types don't really have a channel */ | 144 | /* these interface types don't really have a channel */ |
145 | return; | 145 | return; |
146 | case NL80211_IFTYPE_P2P_DEVICE: | ||
147 | if (wdev->wiphy->features & | ||
148 | NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL) | ||
149 | *chanmode = CHAN_MODE_EXCLUSIVE; | ||
150 | return; | ||
146 | case NL80211_IFTYPE_UNSPECIFIED: | 151 | case NL80211_IFTYPE_UNSPECIFIED: |
147 | case NUM_NL80211_IFTYPES: | 152 | case NUM_NL80211_IFTYPES: |
148 | WARN_ON(1); | 153 | WARN_ON(1); |
diff --git a/net/wireless/core.c b/net/wireless/core.c index dcd64d5b07aa..443d4d7deea2 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -230,9 +230,24 @@ static int cfg80211_rfkill_set_block(void *data, bool blocked) | |||
230 | rtnl_lock(); | 230 | rtnl_lock(); |
231 | mutex_lock(&rdev->devlist_mtx); | 231 | mutex_lock(&rdev->devlist_mtx); |
232 | 232 | ||
233 | list_for_each_entry(wdev, &rdev->wdev_list, list) | 233 | list_for_each_entry(wdev, &rdev->wdev_list, list) { |
234 | if (wdev->netdev) | 234 | if (wdev->netdev) { |
235 | dev_close(wdev->netdev); | 235 | dev_close(wdev->netdev); |
236 | continue; | ||
237 | } | ||
238 | /* otherwise, check iftype */ | ||
239 | switch (wdev->iftype) { | ||
240 | case NL80211_IFTYPE_P2P_DEVICE: | ||
241 | if (!wdev->p2p_started) | ||
242 | break; | ||
243 | rdev->ops->stop_p2p_device(&rdev->wiphy, wdev); | ||
244 | wdev->p2p_started = false; | ||
245 | rdev->opencount--; | ||
246 | break; | ||
247 | default: | ||
248 | break; | ||
249 | } | ||
250 | } | ||
236 | 251 | ||
237 | mutex_unlock(&rdev->devlist_mtx); | 252 | mutex_unlock(&rdev->devlist_mtx); |
238 | rtnl_unlock(); | 253 | rtnl_unlock(); |
@@ -407,6 +422,11 @@ static int wiphy_verify_combinations(struct wiphy *wiphy) | |||
407 | if (WARN_ON(wiphy->software_iftypes & types)) | 422 | if (WARN_ON(wiphy->software_iftypes & types)) |
408 | return -EINVAL; | 423 | return -EINVAL; |
409 | 424 | ||
425 | /* Only a single P2P_DEVICE can be allowed */ | ||
426 | if (WARN_ON(types & BIT(NL80211_IFTYPE_P2P_DEVICE) && | ||
427 | c->limits[j].max > 1)) | ||
428 | return -EINVAL; | ||
429 | |||
410 | cnt += c->limits[j].max; | 430 | cnt += c->limits[j].max; |
411 | /* | 431 | /* |
412 | * Don't advertise an unsupported type | 432 | * Don't advertise an unsupported type |
@@ -734,6 +754,35 @@ static void wdev_cleanup_work(struct work_struct *work) | |||
734 | dev_put(wdev->netdev); | 754 | dev_put(wdev->netdev); |
735 | } | 755 | } |
736 | 756 | ||
757 | void cfg80211_unregister_wdev(struct wireless_dev *wdev) | ||
758 | { | ||
759 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | ||
760 | |||
761 | ASSERT_RTNL(); | ||
762 | |||
763 | if (WARN_ON(wdev->netdev)) | ||
764 | return; | ||
765 | |||
766 | mutex_lock(&rdev->devlist_mtx); | ||
767 | list_del_rcu(&wdev->list); | ||
768 | rdev->devlist_generation++; | ||
769 | |||
770 | switch (wdev->iftype) { | ||
771 | case NL80211_IFTYPE_P2P_DEVICE: | ||
772 | if (!wdev->p2p_started) | ||
773 | break; | ||
774 | rdev->ops->stop_p2p_device(&rdev->wiphy, wdev); | ||
775 | wdev->p2p_started = false; | ||
776 | rdev->opencount--; | ||
777 | break; | ||
778 | default: | ||
779 | WARN_ON_ONCE(1); | ||
780 | break; | ||
781 | } | ||
782 | mutex_unlock(&rdev->devlist_mtx); | ||
783 | } | ||
784 | EXPORT_SYMBOL(cfg80211_unregister_wdev); | ||
785 | |||
737 | static struct device_type wiphy_type = { | 786 | static struct device_type wiphy_type = { |
738 | .name = "wlan", | 787 | .name = "wlan", |
739 | }; | 788 | }; |
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 1cdb1d5e6b0f..8fd0242ee169 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -736,7 +736,6 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, | |||
736 | const u8 *buf, size_t len, bool no_cck, | 736 | const u8 *buf, size_t len, bool no_cck, |
737 | bool dont_wait_for_ack, u64 *cookie) | 737 | bool dont_wait_for_ack, u64 *cookie) |
738 | { | 738 | { |
739 | struct net_device *dev = wdev->netdev; | ||
740 | const struct ieee80211_mgmt *mgmt; | 739 | const struct ieee80211_mgmt *mgmt; |
741 | u16 stype; | 740 | u16 stype; |
742 | 741 | ||
@@ -796,7 +795,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, | |||
796 | case NL80211_IFTYPE_AP: | 795 | case NL80211_IFTYPE_AP: |
797 | case NL80211_IFTYPE_P2P_GO: | 796 | case NL80211_IFTYPE_P2P_GO: |
798 | case NL80211_IFTYPE_AP_VLAN: | 797 | case NL80211_IFTYPE_AP_VLAN: |
799 | if (!ether_addr_equal(mgmt->bssid, dev->dev_addr)) | 798 | if (!ether_addr_equal(mgmt->bssid, wdev_address(wdev))) |
800 | err = -EINVAL; | 799 | err = -EINVAL; |
801 | break; | 800 | break; |
802 | case NL80211_IFTYPE_MESH_POINT: | 801 | case NL80211_IFTYPE_MESH_POINT: |
@@ -809,6 +808,11 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, | |||
809 | * cfg80211 doesn't track the stations | 808 | * cfg80211 doesn't track the stations |
810 | */ | 809 | */ |
811 | break; | 810 | break; |
811 | case NL80211_IFTYPE_P2P_DEVICE: | ||
812 | /* | ||
813 | * fall through, P2P device only supports | ||
814 | * public action frames | ||
815 | */ | ||
812 | default: | 816 | default: |
813 | err = -EOPNOTSUPP; | 817 | err = -EOPNOTSUPP; |
814 | break; | 818 | break; |
@@ -819,7 +823,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, | |||
819 | return err; | 823 | return err; |
820 | } | 824 | } |
821 | 825 | ||
822 | if (!ether_addr_equal(mgmt->sa, dev->dev_addr)) | 826 | if (!ether_addr_equal(mgmt->sa, wdev_address(wdev))) |
823 | return -EINVAL; | 827 | return -EINVAL; |
824 | 828 | ||
825 | /* Transmit the Action frame as requested by user space */ | 829 | /* Transmit the Action frame as requested by user space */ |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 97026f3b215a..787aeaa902fe 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -1100,6 +1100,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
1100 | if (nla_put_u32(msg, i, NL80211_CMD_REGISTER_BEACONS)) | 1100 | if (nla_put_u32(msg, i, NL80211_CMD_REGISTER_BEACONS)) |
1101 | goto nla_put_failure; | 1101 | goto nla_put_failure; |
1102 | } | 1102 | } |
1103 | CMD(start_p2p_device, START_P2P_DEVICE); | ||
1103 | 1104 | ||
1104 | #ifdef CONFIG_NL80211_TESTMODE | 1105 | #ifdef CONFIG_NL80211_TESTMODE |
1105 | CMD(testmode_cmd, TESTMODE); | 1106 | CMD(testmode_cmd, TESTMODE); |
@@ -1748,13 +1749,13 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
1748 | 1749 | ||
1749 | if (dev && | 1750 | if (dev && |
1750 | (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || | 1751 | (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || |
1751 | nla_put_string(msg, NL80211_ATTR_IFNAME, dev->name) || | 1752 | nla_put_string(msg, NL80211_ATTR_IFNAME, dev->name))) |
1752 | nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, dev->dev_addr))) | ||
1753 | goto nla_put_failure; | 1753 | goto nla_put_failure; |
1754 | 1754 | ||
1755 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || | 1755 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || |
1756 | nla_put_u32(msg, NL80211_ATTR_IFTYPE, wdev->iftype) || | 1756 | nla_put_u32(msg, NL80211_ATTR_IFTYPE, wdev->iftype) || |
1757 | nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) || | 1757 | nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) || |
1758 | nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, wdev_address(wdev)) || | ||
1758 | nla_put_u32(msg, NL80211_ATTR_GENERATION, | 1759 | nla_put_u32(msg, NL80211_ATTR_GENERATION, |
1759 | rdev->devlist_generation ^ | 1760 | rdev->devlist_generation ^ |
1760 | (cfg80211_rdev_list_generation << 2))) | 1761 | (cfg80211_rdev_list_generation << 2))) |
@@ -2021,8 +2022,10 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
2021 | return PTR_ERR(wdev); | 2022 | return PTR_ERR(wdev); |
2022 | } | 2023 | } |
2023 | 2024 | ||
2024 | if (type == NL80211_IFTYPE_MESH_POINT && | 2025 | switch (type) { |
2025 | info->attrs[NL80211_ATTR_MESH_ID]) { | 2026 | case NL80211_IFTYPE_MESH_POINT: |
2027 | if (!info->attrs[NL80211_ATTR_MESH_ID]) | ||
2028 | break; | ||
2026 | wdev_lock(wdev); | 2029 | wdev_lock(wdev); |
2027 | BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != | 2030 | BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != |
2028 | IEEE80211_MAX_MESH_ID_LEN); | 2031 | IEEE80211_MAX_MESH_ID_LEN); |
@@ -2031,6 +2034,26 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
2031 | memcpy(wdev->ssid, nla_data(info->attrs[NL80211_ATTR_MESH_ID]), | 2034 | memcpy(wdev->ssid, nla_data(info->attrs[NL80211_ATTR_MESH_ID]), |
2032 | wdev->mesh_id_up_len); | 2035 | wdev->mesh_id_up_len); |
2033 | wdev_unlock(wdev); | 2036 | wdev_unlock(wdev); |
2037 | break; | ||
2038 | case NL80211_IFTYPE_P2P_DEVICE: | ||
2039 | /* | ||
2040 | * P2P Device doesn't have a netdev, so doesn't go | ||
2041 | * through the netdev notifier and must be added here | ||
2042 | */ | ||
2043 | mutex_init(&wdev->mtx); | ||
2044 | INIT_LIST_HEAD(&wdev->event_list); | ||
2045 | spin_lock_init(&wdev->event_lock); | ||
2046 | INIT_LIST_HEAD(&wdev->mgmt_registrations); | ||
2047 | spin_lock_init(&wdev->mgmt_registrations_lock); | ||
2048 | |||
2049 | mutex_lock(&rdev->devlist_mtx); | ||
2050 | wdev->identifier = ++rdev->wdev_id; | ||
2051 | list_add_rcu(&wdev->list, &rdev->wdev_list); | ||
2052 | rdev->devlist_generation++; | ||
2053 | mutex_unlock(&rdev->devlist_mtx); | ||
2054 | break; | ||
2055 | default: | ||
2056 | break; | ||
2034 | } | 2057 | } |
2035 | 2058 | ||
2036 | if (nl80211_send_iface(msg, info->snd_pid, info->snd_seq, 0, | 2059 | if (nl80211_send_iface(msg, info->snd_pid, info->snd_seq, 0, |
@@ -6053,6 +6076,7 @@ static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
6053 | case NL80211_IFTYPE_AP_VLAN: | 6076 | case NL80211_IFTYPE_AP_VLAN: |
6054 | case NL80211_IFTYPE_MESH_POINT: | 6077 | case NL80211_IFTYPE_MESH_POINT: |
6055 | case NL80211_IFTYPE_P2P_GO: | 6078 | case NL80211_IFTYPE_P2P_GO: |
6079 | case NL80211_IFTYPE_P2P_DEVICE: | ||
6056 | break; | 6080 | break; |
6057 | default: | 6081 | default: |
6058 | return -EOPNOTSUPP; | 6082 | return -EOPNOTSUPP; |
@@ -6099,6 +6123,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
6099 | case NL80211_IFTYPE_AP_VLAN: | 6123 | case NL80211_IFTYPE_AP_VLAN: |
6100 | case NL80211_IFTYPE_MESH_POINT: | 6124 | case NL80211_IFTYPE_MESH_POINT: |
6101 | case NL80211_IFTYPE_P2P_GO: | 6125 | case NL80211_IFTYPE_P2P_GO: |
6126 | case NL80211_IFTYPE_P2P_DEVICE: | ||
6102 | break; | 6127 | break; |
6103 | default: | 6128 | default: |
6104 | return -EOPNOTSUPP; | 6129 | return -EOPNOTSUPP; |
@@ -6195,6 +6220,7 @@ static int nl80211_tx_mgmt_cancel_wait(struct sk_buff *skb, struct genl_info *in | |||
6195 | case NL80211_IFTYPE_AP: | 6220 | case NL80211_IFTYPE_AP: |
6196 | case NL80211_IFTYPE_AP_VLAN: | 6221 | case NL80211_IFTYPE_AP_VLAN: |
6197 | case NL80211_IFTYPE_P2P_GO: | 6222 | case NL80211_IFTYPE_P2P_GO: |
6223 | case NL80211_IFTYPE_P2P_DEVICE: | ||
6198 | break; | 6224 | break; |
6199 | default: | 6225 | default: |
6200 | return -EOPNOTSUPP; | 6226 | return -EOPNOTSUPP; |
@@ -6810,6 +6836,68 @@ static int nl80211_register_beacons(struct sk_buff *skb, struct genl_info *info) | |||
6810 | return 0; | 6836 | return 0; |
6811 | } | 6837 | } |
6812 | 6838 | ||
6839 | static int nl80211_start_p2p_device(struct sk_buff *skb, struct genl_info *info) | ||
6840 | { | ||
6841 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | ||
6842 | struct wireless_dev *wdev = info->user_ptr[1]; | ||
6843 | int err; | ||
6844 | |||
6845 | if (!rdev->ops->start_p2p_device) | ||
6846 | return -EOPNOTSUPP; | ||
6847 | |||
6848 | if (wdev->iftype != NL80211_IFTYPE_P2P_DEVICE) | ||
6849 | return -EOPNOTSUPP; | ||
6850 | |||
6851 | if (wdev->p2p_started) | ||
6852 | return 0; | ||
6853 | |||
6854 | mutex_lock(&rdev->devlist_mtx); | ||
6855 | err = cfg80211_can_add_interface(rdev, wdev->iftype); | ||
6856 | mutex_unlock(&rdev->devlist_mtx); | ||
6857 | if (err) | ||
6858 | return err; | ||
6859 | |||
6860 | err = rdev->ops->start_p2p_device(&rdev->wiphy, wdev); | ||
6861 | if (err) | ||
6862 | return err; | ||
6863 | |||
6864 | wdev->p2p_started = true; | ||
6865 | mutex_lock(&rdev->devlist_mtx); | ||
6866 | rdev->opencount++; | ||
6867 | mutex_unlock(&rdev->devlist_mtx); | ||
6868 | |||
6869 | return 0; | ||
6870 | } | ||
6871 | |||
6872 | static int nl80211_stop_p2p_device(struct sk_buff *skb, struct genl_info *info) | ||
6873 | { | ||
6874 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | ||
6875 | struct wireless_dev *wdev = info->user_ptr[1]; | ||
6876 | |||
6877 | if (wdev->iftype != NL80211_IFTYPE_P2P_DEVICE) | ||
6878 | return -EOPNOTSUPP; | ||
6879 | |||
6880 | if (!rdev->ops->stop_p2p_device) | ||
6881 | return -EOPNOTSUPP; | ||
6882 | |||
6883 | if (!wdev->p2p_started) | ||
6884 | return 0; | ||
6885 | |||
6886 | rdev->ops->stop_p2p_device(&rdev->wiphy, wdev); | ||
6887 | wdev->p2p_started = false; | ||
6888 | |||
6889 | mutex_lock(&rdev->devlist_mtx); | ||
6890 | rdev->opencount--; | ||
6891 | mutex_unlock(&rdev->devlist_mtx); | ||
6892 | |||
6893 | if (WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev)) { | ||
6894 | rdev->scan_req->aborted = true; | ||
6895 | ___cfg80211_scan_done(rdev, true); | ||
6896 | } | ||
6897 | |||
6898 | return 0; | ||
6899 | } | ||
6900 | |||
6813 | #define NL80211_FLAG_NEED_WIPHY 0x01 | 6901 | #define NL80211_FLAG_NEED_WIPHY 0x01 |
6814 | #define NL80211_FLAG_NEED_NETDEV 0x02 | 6902 | #define NL80211_FLAG_NEED_NETDEV 0x02 |
6815 | #define NL80211_FLAG_NEED_RTNL 0x04 | 6903 | #define NL80211_FLAG_NEED_RTNL 0x04 |
@@ -6817,7 +6905,7 @@ static int nl80211_register_beacons(struct sk_buff *skb, struct genl_info *info) | |||
6817 | #define NL80211_FLAG_NEED_NETDEV_UP (NL80211_FLAG_NEED_NETDEV |\ | 6905 | #define NL80211_FLAG_NEED_NETDEV_UP (NL80211_FLAG_NEED_NETDEV |\ |
6818 | NL80211_FLAG_CHECK_NETDEV_UP) | 6906 | NL80211_FLAG_CHECK_NETDEV_UP) |
6819 | #define NL80211_FLAG_NEED_WDEV 0x10 | 6907 | #define NL80211_FLAG_NEED_WDEV 0x10 |
6820 | /* If a netdev is associated, it must be UP */ | 6908 | /* If a netdev is associated, it must be UP, P2P must be started */ |
6821 | #define NL80211_FLAG_NEED_WDEV_UP (NL80211_FLAG_NEED_WDEV |\ | 6909 | #define NL80211_FLAG_NEED_WDEV_UP (NL80211_FLAG_NEED_WDEV |\ |
6822 | NL80211_FLAG_CHECK_NETDEV_UP) | 6910 | NL80211_FLAG_CHECK_NETDEV_UP) |
6823 | 6911 | ||
@@ -6878,6 +6966,13 @@ static int nl80211_pre_doit(struct genl_ops *ops, struct sk_buff *skb, | |||
6878 | } | 6966 | } |
6879 | 6967 | ||
6880 | dev_hold(dev); | 6968 | dev_hold(dev); |
6969 | } else if (ops->internal_flags & NL80211_FLAG_CHECK_NETDEV_UP) { | ||
6970 | if (!wdev->p2p_started) { | ||
6971 | mutex_unlock(&cfg80211_mutex); | ||
6972 | if (rtnl) | ||
6973 | rtnl_unlock(); | ||
6974 | return -ENETDOWN; | ||
6975 | } | ||
6881 | } | 6976 | } |
6882 | 6977 | ||
6883 | cfg80211_lock_rdev(rdev); | 6978 | cfg80211_lock_rdev(rdev); |
@@ -7439,7 +7534,22 @@ static struct genl_ops nl80211_ops[] = { | |||
7439 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 7534 | .internal_flags = NL80211_FLAG_NEED_NETDEV | |
7440 | NL80211_FLAG_NEED_RTNL, | 7535 | NL80211_FLAG_NEED_RTNL, |
7441 | }, | 7536 | }, |
7442 | 7537 | { | |
7538 | .cmd = NL80211_CMD_START_P2P_DEVICE, | ||
7539 | .doit = nl80211_start_p2p_device, | ||
7540 | .policy = nl80211_policy, | ||
7541 | .flags = GENL_ADMIN_PERM, | ||
7542 | .internal_flags = NL80211_FLAG_NEED_WDEV | | ||
7543 | NL80211_FLAG_NEED_RTNL, | ||
7544 | }, | ||
7545 | { | ||
7546 | .cmd = NL80211_CMD_STOP_P2P_DEVICE, | ||
7547 | .doit = nl80211_stop_p2p_device, | ||
7548 | .policy = nl80211_policy, | ||
7549 | .flags = GENL_ADMIN_PERM, | ||
7550 | .internal_flags = NL80211_FLAG_NEED_WDEV_UP | | ||
7551 | NL80211_FLAG_NEED_RTNL, | ||
7552 | }, | ||
7443 | }; | 7553 | }; |
7444 | 7554 | ||
7445 | static struct genl_multicast_group nl80211_mlme_mcgrp = { | 7555 | static struct genl_multicast_group nl80211_mlme_mcgrp = { |
diff --git a/net/wireless/radiotap.c b/net/wireless/radiotap.c index c4ad7958af52..7d604c06c3dc 100644 --- a/net/wireless/radiotap.c +++ b/net/wireless/radiotap.c | |||
@@ -41,6 +41,8 @@ static const struct radiotap_align_size rtap_namespace_sizes[] = { | |||
41 | [IEEE80211_RADIOTAP_TX_FLAGS] = { .align = 2, .size = 2, }, | 41 | [IEEE80211_RADIOTAP_TX_FLAGS] = { .align = 2, .size = 2, }, |
42 | [IEEE80211_RADIOTAP_RTS_RETRIES] = { .align = 1, .size = 1, }, | 42 | [IEEE80211_RADIOTAP_RTS_RETRIES] = { .align = 1, .size = 1, }, |
43 | [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, }, | 43 | [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, }, |
44 | [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, }, | ||
45 | [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, }, | ||
44 | /* | 46 | /* |
45 | * add more here as they are defined in radiotap.h | 47 | * add more here as they are defined in radiotap.h |
46 | */ | 48 | */ |
diff --git a/net/wireless/util.c b/net/wireless/util.c index 994e2f0cc7a8..ef35f4ef2aa6 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -684,22 +684,10 @@ EXPORT_SYMBOL(cfg80211_classify8021d); | |||
684 | 684 | ||
685 | const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie) | 685 | const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie) |
686 | { | 686 | { |
687 | u8 *end, *pos; | 687 | if (bss->information_elements == NULL) |
688 | |||
689 | pos = bss->information_elements; | ||
690 | if (pos == NULL) | ||
691 | return NULL; | 688 | return NULL; |
692 | end = pos + bss->len_information_elements; | 689 | return cfg80211_find_ie(ie, bss->information_elements, |
693 | 690 | bss->len_information_elements); | |
694 | while (pos + 1 < end) { | ||
695 | if (pos + 2 + pos[1] > end) | ||
696 | break; | ||
697 | if (pos[0] == ie) | ||
698 | return pos; | ||
699 | pos += 2 + pos[1]; | ||
700 | } | ||
701 | |||
702 | return NULL; | ||
703 | } | 691 | } |
704 | EXPORT_SYMBOL(ieee80211_bss_get_ie); | 692 | EXPORT_SYMBOL(ieee80211_bss_get_ie); |
705 | 693 | ||
@@ -812,6 +800,10 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, | |||
812 | if (otype == NL80211_IFTYPE_AP_VLAN) | 800 | if (otype == NL80211_IFTYPE_AP_VLAN) |
813 | return -EOPNOTSUPP; | 801 | return -EOPNOTSUPP; |
814 | 802 | ||
803 | /* cannot change into P2P device type */ | ||
804 | if (ntype == NL80211_IFTYPE_P2P_DEVICE) | ||
805 | return -EOPNOTSUPP; | ||
806 | |||
815 | if (!rdev->ops->change_virtual_intf || | 807 | if (!rdev->ops->change_virtual_intf || |
816 | !(rdev->wiphy.interface_modes & (1 << ntype))) | 808 | !(rdev->wiphy.interface_modes & (1 << ntype))) |
817 | return -EOPNOTSUPP; | 809 | return -EOPNOTSUPP; |
@@ -889,6 +881,9 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, | |||
889 | case NUM_NL80211_IFTYPES: | 881 | case NUM_NL80211_IFTYPES: |
890 | /* not happening */ | 882 | /* not happening */ |
891 | break; | 883 | break; |
884 | case NL80211_IFTYPE_P2P_DEVICE: | ||
885 | WARN_ON(1); | ||
886 | break; | ||
892 | } | 887 | } |
893 | } | 888 | } |
894 | 889 | ||
@@ -1053,8 +1048,15 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev, | |||
1053 | list_for_each_entry(wdev_iter, &rdev->wdev_list, list) { | 1048 | list_for_each_entry(wdev_iter, &rdev->wdev_list, list) { |
1054 | if (wdev_iter == wdev) | 1049 | if (wdev_iter == wdev) |
1055 | continue; | 1050 | continue; |
1056 | if (!netif_running(wdev_iter->netdev)) | 1051 | if (wdev_iter->netdev) { |
1057 | continue; | 1052 | if (!netif_running(wdev_iter->netdev)) |
1053 | continue; | ||
1054 | } else if (wdev_iter->iftype == NL80211_IFTYPE_P2P_DEVICE) { | ||
1055 | if (!wdev_iter->p2p_started) | ||
1056 | continue; | ||
1057 | } else { | ||
1058 | WARN_ON(1); | ||
1059 | } | ||
1058 | 1060 | ||
1059 | if (rdev->wiphy.software_iftypes & BIT(wdev_iter->iftype)) | 1061 | if (rdev->wiphy.software_iftypes & BIT(wdev_iter->iftype)) |
1060 | continue; | 1062 | continue; |