aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.h9
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h14
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c25
-rw-r--r--drivers/net/wireless/ath/ath9k/mac.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/reg.h11
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c138
-rw-r--r--drivers/net/wireless/atmel.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c18
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c16
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/fweh.c3
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h6
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/p2p.c74
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c89
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h3
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/sta.c2
-rw-r--r--drivers/nfc/Kconfig2
-rw-r--r--drivers/nfc/mei_phy.c9
-rw-r--r--drivers/nfc/microread/mei.c20
-rw-r--r--drivers/nfc/pn544/mei.c20
-rw-r--r--net/mac80211/iface.c44
-rw-r--r--net/mac80211/mlme.c12
-rw-r--r--net/nfc/Makefile1
-rw-r--r--net/wireless/nl80211.c2
-rw-r--r--net/wireless/sme.c3
27 files changed, 301 insertions, 235 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
index 54ba42f4108a..874f6570bd1c 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
@@ -68,13 +68,16 @@
68#define AR9300_BASE_ADDR 0x3ff 68#define AR9300_BASE_ADDR 0x3ff
69#define AR9300_BASE_ADDR_512 0x1ff 69#define AR9300_BASE_ADDR_512 0x1ff
70 70
71#define AR9300_OTP_BASE (AR_SREV_9340(ah) ? 0x30000 : 0x14000) 71#define AR9300_OTP_BASE \
72#define AR9300_OTP_STATUS (AR_SREV_9340(ah) ? 0x30018 : 0x15f18) 72 ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30000 : 0x14000)
73#define AR9300_OTP_STATUS \
74 ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30018 : 0x15f18)
73#define AR9300_OTP_STATUS_TYPE 0x7 75#define AR9300_OTP_STATUS_TYPE 0x7
74#define AR9300_OTP_STATUS_VALID 0x4 76#define AR9300_OTP_STATUS_VALID 0x4
75#define AR9300_OTP_STATUS_ACCESS_BUSY 0x2 77#define AR9300_OTP_STATUS_ACCESS_BUSY 0x2
76#define AR9300_OTP_STATUS_SM_BUSY 0x1 78#define AR9300_OTP_STATUS_SM_BUSY 0x1
77#define AR9300_OTP_READ_DATA (AR_SREV_9340(ah) ? 0x3001c : 0x15f1c) 79#define AR9300_OTP_READ_DATA \
80 ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x3001c : 0x15f1c)
78 81
79enum targetPowerHTRates { 82enum targetPowerHTRates {
80 HT_TARGET_RATE_0_8_16, 83 HT_TARGET_RATE_0_8_16,
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 2bf6548dd143..e1714d7c9eeb 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -334,7 +334,8 @@ static void ar9003_hw_spur_ofdm(struct ath_hw *ah,
334 REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, 334 REG_RMW_FIELD(ah, AR_PHY_SPUR_REG,
335 AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI, 1); 335 AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI, 1);
336 336
337 if (REG_READ_FIELD(ah, AR_PHY_MODE, 337 if (!AR_SREV_9340(ah) &&
338 REG_READ_FIELD(ah, AR_PHY_MODE,
338 AR_PHY_MODE_DYNAMIC) == 0x1) 339 AR_PHY_MODE_DYNAMIC) == 0x1)
339 REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, 340 REG_RMW_FIELD(ah, AR_PHY_SPUR_REG,
340 AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT, 1); 341 AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT, 1);
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 366002f266f8..42b03dc39d14 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -251,10 +251,9 @@ struct ath_atx_tid {
251 int tidno; 251 int tidno;
252 int baw_head; /* first un-acked tx buffer */ 252 int baw_head; /* first un-acked tx buffer */
253 int baw_tail; /* next unused tx buffer slot */ 253 int baw_tail; /* next unused tx buffer slot */
254 int sched; 254 bool sched;
255 int paused; 255 bool paused;
256 u8 state; 256 bool active;
257 bool stop_cb;
258}; 257};
259 258
260struct ath_node { 259struct ath_node {
@@ -275,10 +274,6 @@ struct ath_node {
275#endif 274#endif
276}; 275};
277 276
278#define AGGR_CLEANUP BIT(1)
279#define AGGR_ADDBA_COMPLETE BIT(2)
280#define AGGR_ADDBA_PROGRESS BIT(3)
281
282struct ath_tx_control { 277struct ath_tx_control {
283 struct ath_txq *txq; 278 struct ath_txq *txq;
284 struct ath_node *an; 279 struct ath_node *an;
@@ -352,8 +347,7 @@ void ath_tx_tasklet(struct ath_softc *sc);
352void ath_tx_edma_tasklet(struct ath_softc *sc); 347void ath_tx_edma_tasklet(struct ath_softc *sc);
353int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, 348int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
354 u16 tid, u16 *ssn); 349 u16 tid, u16 *ssn);
355bool ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid, 350void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
356 bool flush);
357void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 351void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
358 352
359void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an); 353void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an);
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 7f25da8444fe..15dfefcf2d0f 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1172,6 +1172,7 @@ u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan)
1172static inline void ath9k_hw_set_dma(struct ath_hw *ah) 1172static inline void ath9k_hw_set_dma(struct ath_hw *ah)
1173{ 1173{
1174 struct ath_common *common = ath9k_hw_common(ah); 1174 struct ath_common *common = ath9k_hw_common(ah);
1175 int txbuf_size;
1175 1176
1176 ENABLE_REGWRITE_BUFFER(ah); 1177 ENABLE_REGWRITE_BUFFER(ah);
1177 1178
@@ -1225,13 +1226,17 @@ static inline void ath9k_hw_set_dma(struct ath_hw *ah)
1225 * So set the usable tx buf size also to half to 1226 * So set the usable tx buf size also to half to
1226 * avoid data/delimiter underruns 1227 * avoid data/delimiter underruns
1227 */ 1228 */
1228 REG_WRITE(ah, AR_PCU_TXBUF_CTRL, 1229 txbuf_size = AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE;
1229 AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE); 1230 } else if (AR_SREV_9340_13_OR_LATER(ah)) {
1230 } else if (!AR_SREV_9271(ah)) { 1231 /* Uses fewer entries for AR934x v1.3+ to prevent rx overruns */
1231 REG_WRITE(ah, AR_PCU_TXBUF_CTRL, 1232 txbuf_size = AR_9340_PCU_TXBUF_CTRL_USABLE_SIZE;
1232 AR_PCU_TXBUF_CTRL_USABLE_SIZE); 1233 } else {
1234 txbuf_size = AR_PCU_TXBUF_CTRL_USABLE_SIZE;
1233 } 1235 }
1234 1236
1237 if (!AR_SREV_9271(ah))
1238 REG_WRITE(ah, AR_PCU_TXBUF_CTRL, txbuf_size);
1239
1235 REGWRITE_BUFFER_FLUSH(ah); 1240 REGWRITE_BUFFER_FLUSH(ah);
1236 1241
1237 if (AR_SREV_9300_20_OR_LATER(ah)) 1242 if (AR_SREV_9300_20_OR_LATER(ah))
@@ -1306,9 +1311,13 @@ static bool ath9k_hw_set_reset(struct ath_hw *ah, int type)
1306 AR_RTC_RC_COLD_RESET | AR_RTC_RC_WARM_RESET; 1311 AR_RTC_RC_COLD_RESET | AR_RTC_RC_WARM_RESET;
1307 } else { 1312 } else {
1308 tmpReg = REG_READ(ah, AR_INTR_SYNC_CAUSE); 1313 tmpReg = REG_READ(ah, AR_INTR_SYNC_CAUSE);
1309 if (tmpReg & 1314 if (AR_SREV_9340(ah))
1310 (AR_INTR_SYNC_LOCAL_TIMEOUT | 1315 tmpReg &= AR9340_INTR_SYNC_LOCAL_TIMEOUT;
1311 AR_INTR_SYNC_RADM_CPL_TIMEOUT)) { 1316 else
1317 tmpReg &= AR_INTR_SYNC_LOCAL_TIMEOUT |
1318 AR_INTR_SYNC_RADM_CPL_TIMEOUT;
1319
1320 if (tmpReg) {
1312 u32 val; 1321 u32 val;
1313 REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0); 1322 REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0);
1314 1323
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index 498fee04afa0..566109a40fb3 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -410,7 +410,7 @@ bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q)
410 410
411 REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ); 411 REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ);
412 412
413 if (AR_SREV_9340(ah)) 413 if (AR_SREV_9340(ah) && !AR_SREV_9340_13_OR_LATER(ah))
414 REG_WRITE(ah, AR_DMISC(q), 414 REG_WRITE(ah, AR_DMISC(q),
415 AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x1); 415 AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x1);
416 else 416 else
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 2382d1262e7f..5092ecae7706 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1709,7 +1709,8 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1709 flush = true; 1709 flush = true;
1710 case IEEE80211_AMPDU_TX_STOP_CONT: 1710 case IEEE80211_AMPDU_TX_STOP_CONT:
1711 ath9k_ps_wakeup(sc); 1711 ath9k_ps_wakeup(sc);
1712 if (ath_tx_aggr_stop(sc, sta, tid, flush)) 1712 ath_tx_aggr_stop(sc, sta, tid);
1713 if (!flush)
1713 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); 1714 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1714 ath9k_ps_restore(sc); 1715 ath9k_ps_restore(sc);
1715 break; 1716 break;
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index aa4d368d8d3d..7eb1f4b458e4 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1227,10 +1227,7 @@ static bool ath_tx_aggr_check(struct ath_softc *sc, struct ieee80211_sta *sta,
1227 return false; 1227 return false;
1228 1228
1229 txtid = ATH_AN_2_TID(an, tidno); 1229 txtid = ATH_AN_2_TID(an, tidno);
1230 1230 return !txtid->active;
1231 if (!(txtid->state & (AGGR_ADDBA_COMPLETE | AGGR_ADDBA_PROGRESS)))
1232 return true;
1233 return false;
1234} 1231}
1235 1232
1236 1233
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h
index 5c4ab5026dca..f7c90cc58d56 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -798,6 +798,10 @@
798#define AR_SREV_REVISION_9485_10 0 798#define AR_SREV_REVISION_9485_10 0
799#define AR_SREV_REVISION_9485_11 1 799#define AR_SREV_REVISION_9485_11 1
800#define AR_SREV_VERSION_9340 0x300 800#define AR_SREV_VERSION_9340 0x300
801#define AR_SREV_REVISION_9340_10 0
802#define AR_SREV_REVISION_9340_11 1
803#define AR_SREV_REVISION_9340_12 2
804#define AR_SREV_REVISION_9340_13 3
801#define AR_SREV_VERSION_9580 0x1C0 805#define AR_SREV_VERSION_9580 0x1C0
802#define AR_SREV_REVISION_9580_10 4 /* AR9580 1.0 */ 806#define AR_SREV_REVISION_9580_10 4 /* AR9580 1.0 */
803#define AR_SREV_VERSION_9462 0x280 807#define AR_SREV_VERSION_9462 0x280
@@ -897,6 +901,10 @@
897#define AR_SREV_9340(_ah) \ 901#define AR_SREV_9340(_ah) \
898 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340)) 902 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340))
899 903
904#define AR_SREV_9340_13_OR_LATER(_ah) \
905 (AR_SREV_9340((_ah)) && \
906 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9340_13))
907
900#define AR_SREV_9285E_20(_ah) \ 908#define AR_SREV_9285E_20(_ah) \
901 (AR_SREV_9285_12_OR_LATER(_ah) && \ 909 (AR_SREV_9285_12_OR_LATER(_ah) && \
902 ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) 910 ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1))
@@ -1007,6 +1015,8 @@ enum {
1007 AR_INTR_SYNC_LOCAL_TIMEOUT | 1015 AR_INTR_SYNC_LOCAL_TIMEOUT |
1008 AR_INTR_SYNC_MAC_SLEEP_ACCESS), 1016 AR_INTR_SYNC_MAC_SLEEP_ACCESS),
1009 1017
1018 AR9340_INTR_SYNC_LOCAL_TIMEOUT = 0x00000010,
1019
1010 AR_INTR_SYNC_SPURIOUS = 0xFFFFFFFF, 1020 AR_INTR_SYNC_SPURIOUS = 0xFFFFFFFF,
1011 1021
1012}; 1022};
@@ -1881,6 +1891,7 @@ enum {
1881#define AR_PCU_TXBUF_CTRL_SIZE_MASK 0x7FF 1891#define AR_PCU_TXBUF_CTRL_SIZE_MASK 0x7FF
1882#define AR_PCU_TXBUF_CTRL_USABLE_SIZE 0x700 1892#define AR_PCU_TXBUF_CTRL_USABLE_SIZE 0x700
1883#define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE 0x380 1893#define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE 0x380
1894#define AR_9340_PCU_TXBUF_CTRL_USABLE_SIZE 0x500
1884 1895
1885#define AR_PCU_MISC_MODE2 0x8344 1896#define AR_PCU_MISC_MODE2 0x8344
1886#define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002 1897#define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 14bb3354ea64..1c9b1bac8b0d 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -125,24 +125,6 @@ static void ath_tx_queue_tid(struct ath_txq *txq, struct ath_atx_tid *tid)
125 list_add_tail(&ac->list, &txq->axq_acq); 125 list_add_tail(&ac->list, &txq->axq_acq);
126} 126}
127 127
128static void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
129{
130 struct ath_txq *txq = tid->ac->txq;
131
132 WARN_ON(!tid->paused);
133
134 ath_txq_lock(sc, txq);
135 tid->paused = false;
136
137 if (skb_queue_empty(&tid->buf_q))
138 goto unlock;
139
140 ath_tx_queue_tid(txq, tid);
141 ath_txq_schedule(sc, txq);
142unlock:
143 ath_txq_unlock_complete(sc, txq);
144}
145
146static struct ath_frame_info *get_frame_info(struct sk_buff *skb) 128static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
147{ 129{
148 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 130 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
@@ -164,20 +146,7 @@ static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
164 ARRAY_SIZE(bf->rates)); 146 ARRAY_SIZE(bf->rates));
165} 147}
166 148
167static void ath_tx_clear_tid(struct ath_softc *sc, struct ath_atx_tid *tid) 149static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
168{
169 tid->state &= ~AGGR_ADDBA_COMPLETE;
170 tid->state &= ~AGGR_CLEANUP;
171 if (!tid->stop_cb)
172 return;
173
174 ieee80211_start_tx_ba_cb_irqsafe(tid->an->vif, tid->an->sta->addr,
175 tid->tidno);
176 tid->stop_cb = false;
177}
178
179static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid,
180 bool flush_packets)
181{ 150{
182 struct ath_txq *txq = tid->ac->txq; 151 struct ath_txq *txq = tid->ac->txq;
183 struct sk_buff *skb; 152 struct sk_buff *skb;
@@ -194,15 +163,16 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid,
194 while ((skb = __skb_dequeue(&tid->buf_q))) { 163 while ((skb = __skb_dequeue(&tid->buf_q))) {
195 fi = get_frame_info(skb); 164 fi = get_frame_info(skb);
196 bf = fi->bf; 165 bf = fi->bf;
197 if (!bf && !flush_packets)
198 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
199 166
200 if (!bf) { 167 if (!bf) {
201 ieee80211_free_txskb(sc->hw, skb); 168 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
202 continue; 169 if (!bf) {
170 ieee80211_free_txskb(sc->hw, skb);
171 continue;
172 }
203 } 173 }
204 174
205 if (fi->retries || flush_packets) { 175 if (fi->retries) {
206 list_add_tail(&bf->list, &bf_head); 176 list_add_tail(&bf->list, &bf_head);
207 ath_tx_update_baw(sc, tid, bf->bf_state.seqno); 177 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
208 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); 178 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
@@ -213,10 +183,7 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid,
213 } 183 }
214 } 184 }
215 185
216 if (tid->baw_head == tid->baw_tail) 186 if (sendbar) {
217 ath_tx_clear_tid(sc, tid);
218
219 if (sendbar && !flush_packets) {
220 ath_txq_unlock(sc, txq); 187 ath_txq_unlock(sc, txq);
221 ath_send_bar(tid, tid->seq_start); 188 ath_send_bar(tid, tid->seq_start);
222 ath_txq_lock(sc, txq); 189 ath_txq_lock(sc, txq);
@@ -499,19 +466,19 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
499 tx_info = IEEE80211_SKB_CB(skb); 466 tx_info = IEEE80211_SKB_CB(skb);
500 fi = get_frame_info(skb); 467 fi = get_frame_info(skb);
501 468
502 if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, seqno))) { 469 if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) {
470 /*
471 * Outside of the current BlockAck window,
472 * maybe part of a previous session
473 */
474 txfail = 1;
475 } else if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, seqno))) {
503 /* transmit completion, subframe is 476 /* transmit completion, subframe is
504 * acked by block ack */ 477 * acked by block ack */
505 acked_cnt++; 478 acked_cnt++;
506 } else if (!isaggr && txok) { 479 } else if (!isaggr && txok) {
507 /* transmit completion */ 480 /* transmit completion */
508 acked_cnt++; 481 acked_cnt++;
509 } else if (tid->state & AGGR_CLEANUP) {
510 /*
511 * cleanup in progress, just fail
512 * the un-acked sub-frames
513 */
514 txfail = 1;
515 } else if (flush) { 482 } else if (flush) {
516 txpending = 1; 483 txpending = 1;
517 } else if (fi->retries < ATH_MAX_SW_RETRIES) { 484 } else if (fi->retries < ATH_MAX_SW_RETRIES) {
@@ -535,7 +502,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
535 if (bf_next != NULL || !bf_last->bf_stale) 502 if (bf_next != NULL || !bf_last->bf_stale)
536 list_move_tail(&bf->list, &bf_head); 503 list_move_tail(&bf->list, &bf_head);
537 504
538 if (!txpending || (tid->state & AGGR_CLEANUP)) { 505 if (!txpending) {
539 /* 506 /*
540 * complete the acked-ones/xretried ones; update 507 * complete the acked-ones/xretried ones; update
541 * block-ack window 508 * block-ack window
@@ -609,9 +576,6 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
609 ath_txq_lock(sc, txq); 576 ath_txq_lock(sc, txq);
610 } 577 }
611 578
612 if (tid->state & AGGR_CLEANUP)
613 ath_tx_flush_tid(sc, tid, false);
614
615 rcu_read_unlock(); 579 rcu_read_unlock();
616 580
617 if (needreset) 581 if (needreset)
@@ -1244,9 +1208,6 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
1244 an = (struct ath_node *)sta->drv_priv; 1208 an = (struct ath_node *)sta->drv_priv;
1245 txtid = ATH_AN_2_TID(an, tid); 1209 txtid = ATH_AN_2_TID(an, tid);
1246 1210
1247 if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE))
1248 return -EAGAIN;
1249
1250 /* update ampdu factor/density, they may have changed. This may happen 1211 /* update ampdu factor/density, they may have changed. This may happen
1251 * in HT IBSS when a beacon with HT-info is received after the station 1212 * in HT IBSS when a beacon with HT-info is received after the station
1252 * has already been added. 1213 * has already been added.
@@ -1258,7 +1219,7 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
1258 an->mpdudensity = density; 1219 an->mpdudensity = density;
1259 } 1220 }
1260 1221
1261 txtid->state |= AGGR_ADDBA_PROGRESS; 1222 txtid->active = true;
1262 txtid->paused = true; 1223 txtid->paused = true;
1263 *ssn = txtid->seq_start = txtid->seq_next; 1224 *ssn = txtid->seq_start = txtid->seq_next;
1264 txtid->bar_index = -1; 1225 txtid->bar_index = -1;
@@ -1269,45 +1230,17 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
1269 return 0; 1230 return 0;
1270} 1231}
1271 1232
1272bool ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid, 1233void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
1273 bool flush)
1274{ 1234{
1275 struct ath_node *an = (struct ath_node *)sta->drv_priv; 1235 struct ath_node *an = (struct ath_node *)sta->drv_priv;
1276 struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); 1236 struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
1277 struct ath_txq *txq = txtid->ac->txq; 1237 struct ath_txq *txq = txtid->ac->txq;
1278 bool ret = !flush;
1279
1280 if (flush)
1281 txtid->stop_cb = false;
1282
1283 if (txtid->state & AGGR_CLEANUP)
1284 return false;
1285
1286 if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
1287 txtid->state &= ~AGGR_ADDBA_PROGRESS;
1288 return ret;
1289 }
1290 1238
1291 ath_txq_lock(sc, txq); 1239 ath_txq_lock(sc, txq);
1240 txtid->active = false;
1292 txtid->paused = true; 1241 txtid->paused = true;
1293 1242 ath_tx_flush_tid(sc, txtid);
1294 /*
1295 * If frames are still being transmitted for this TID, they will be
1296 * cleaned up during tx completion. To prevent race conditions, this
1297 * TID can only be reused after all in-progress subframes have been
1298 * completed.
1299 */
1300 if (txtid->baw_head != txtid->baw_tail) {
1301 txtid->state |= AGGR_CLEANUP;
1302 ret = false;
1303 txtid->stop_cb = !flush;
1304 } else {
1305 txtid->state &= ~AGGR_ADDBA_COMPLETE;
1306 }
1307
1308 ath_tx_flush_tid(sc, txtid, flush);
1309 ath_txq_unlock_complete(sc, txq); 1243 ath_txq_unlock_complete(sc, txq);
1310 return ret;
1311} 1244}
1312 1245
1313void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, 1246void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
@@ -1371,18 +1304,28 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
1371 } 1304 }
1372} 1305}
1373 1306
1374void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) 1307void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta,
1308 u16 tidno)
1375{ 1309{
1376 struct ath_atx_tid *txtid; 1310 struct ath_atx_tid *tid;
1377 struct ath_node *an; 1311 struct ath_node *an;
1312 struct ath_txq *txq;
1378 1313
1379 an = (struct ath_node *)sta->drv_priv; 1314 an = (struct ath_node *)sta->drv_priv;
1315 tid = ATH_AN_2_TID(an, tidno);
1316 txq = tid->ac->txq;
1380 1317
1381 txtid = ATH_AN_2_TID(an, tid); 1318 ath_txq_lock(sc, txq);
1382 txtid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; 1319
1383 txtid->state |= AGGR_ADDBA_COMPLETE; 1320 tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
1384 txtid->state &= ~AGGR_ADDBA_PROGRESS; 1321 tid->paused = false;
1385 ath_tx_resume_tid(sc, txtid); 1322
1323 if (!skb_queue_empty(&tid->buf_q)) {
1324 ath_tx_queue_tid(txq, tid);
1325 ath_txq_schedule(sc, txq);
1326 }
1327
1328 ath_txq_unlock_complete(sc, txq);
1386} 1329}
1387 1330
1388/********************/ 1331/********************/
@@ -2431,13 +2374,10 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
2431 tid->baw_head = tid->baw_tail = 0; 2374 tid->baw_head = tid->baw_tail = 0;
2432 tid->sched = false; 2375 tid->sched = false;
2433 tid->paused = false; 2376 tid->paused = false;
2434 tid->state &= ~AGGR_CLEANUP; 2377 tid->active = false;
2435 __skb_queue_head_init(&tid->buf_q); 2378 __skb_queue_head_init(&tid->buf_q);
2436 acno = TID_TO_WME_AC(tidno); 2379 acno = TID_TO_WME_AC(tidno);
2437 tid->ac = &an->ac[acno]; 2380 tid->ac = &an->ac[acno];
2438 tid->state &= ~AGGR_ADDBA_COMPLETE;
2439 tid->state &= ~AGGR_ADDBA_PROGRESS;
2440 tid->stop_cb = false;
2441 } 2381 }
2442 2382
2443 for (acno = 0, ac = &an->ac[acno]; 2383 for (acno = 0, ac = &an->ac[acno];
@@ -2474,7 +2414,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
2474 } 2414 }
2475 2415
2476 ath_tid_drain(sc, txq, tid); 2416 ath_tid_drain(sc, txq, tid);
2477 ath_tx_clear_tid(sc, tid); 2417 tid->active = false;
2478 2418
2479 ath_txq_unlock(sc, txq); 2419 ath_txq_unlock(sc, txq);
2480 } 2420 }
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 830bb1d1f957..b827d51c30a3 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -1624,7 +1624,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
1624 1624
1625 netif_carrier_off(dev); 1625 netif_carrier_off(dev);
1626 1626
1627 if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)); 1627 if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv))
1628 printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); 1628 printk(KERN_WARNING "atmel: unable to create /proc entry.\n");
1629 1629
1630 printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", 1630 printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n",
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
index be0787cab24f..9431af2465f3 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
@@ -27,7 +27,6 @@
27#include "tracepoint.h" 27#include "tracepoint.h"
28 28
29#define PKTFILTER_BUF_SIZE 128 29#define PKTFILTER_BUF_SIZE 128
30#define BRCMF_ARPOL_MODE 0xb /* agent|snoop|peer_autoreply */
31#define BRCMF_DEFAULT_BCN_TIMEOUT 3 30#define BRCMF_DEFAULT_BCN_TIMEOUT 3
32#define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40 31#define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
33#define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 32#define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40
@@ -338,23 +337,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
338 goto done; 337 goto done;
339 } 338 }
340 339
341 /* Try to set and enable ARP offload feature, this may fail */
342 err = brcmf_fil_iovar_int_set(ifp, "arp_ol", BRCMF_ARPOL_MODE);
343 if (err) {
344 brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n",
345 BRCMF_ARPOL_MODE, err);
346 err = 0;
347 } else {
348 err = brcmf_fil_iovar_int_set(ifp, "arpoe", 1);
349 if (err) {
350 brcmf_dbg(TRACE, "failed to enable ARP offload err = %d\n",
351 err);
352 err = 0;
353 } else
354 brcmf_dbg(TRACE, "successfully enabled ARP offload to 0x%x\n",
355 BRCMF_ARPOL_MODE);
356 }
357
358 /* Setup packet filter */ 340 /* Setup packet filter */
359 brcmf_c_pktfilter_offload_set(ifp, BRCMF_DEFAULT_PACKET_FILTER); 341 brcmf_c_pktfilter_offload_set(ifp, BRCMF_DEFAULT_PACKET_FILTER);
360 brcmf_c_pktfilter_offload_enable(ifp, BRCMF_DEFAULT_PACKET_FILTER, 342 brcmf_c_pktfilter_offload_enable(ifp, BRCMF_DEFAULT_PACKET_FILTER,
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
index 59c25463e428..b98f2235978e 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
@@ -653,10 +653,13 @@ int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked)
653 653
654 brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name); 654 brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
655 655
656 ndev->destructor = free_netdev;
656 return 0; 657 return 0;
657 658
658fail: 659fail:
660 drvr->iflist[ifp->bssidx] = NULL;
659 ndev->netdev_ops = NULL; 661 ndev->netdev_ops = NULL;
662 free_netdev(ndev);
660 return -EBADE; 663 return -EBADE;
661} 664}
662 665
@@ -720,6 +723,9 @@ static int brcmf_net_p2p_attach(struct brcmf_if *ifp)
720 return 0; 723 return 0;
721 724
722fail: 725fail:
726 ifp->drvr->iflist[ifp->bssidx] = NULL;
727 ndev->netdev_ops = NULL;
728 free_netdev(ndev);
723 return -EBADE; 729 return -EBADE;
724} 730}
725 731
@@ -788,6 +794,7 @@ void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx)
788 struct brcmf_if *ifp; 794 struct brcmf_if *ifp;
789 795
790 ifp = drvr->iflist[bssidx]; 796 ifp = drvr->iflist[bssidx];
797 drvr->iflist[bssidx] = NULL;
791 if (!ifp) { 798 if (!ifp) {
792 brcmf_err("Null interface, idx=%d\n", bssidx); 799 brcmf_err("Null interface, idx=%d\n", bssidx);
793 return; 800 return;
@@ -808,15 +815,13 @@ void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx)
808 cancel_work_sync(&ifp->setmacaddr_work); 815 cancel_work_sync(&ifp->setmacaddr_work);
809 cancel_work_sync(&ifp->multicast_work); 816 cancel_work_sync(&ifp->multicast_work);
810 } 817 }
811 818 /* unregister will take care of freeing it */
812 unregister_netdev(ifp->ndev); 819 unregister_netdev(ifp->ndev);
813 if (bssidx == 0) 820 if (bssidx == 0)
814 brcmf_cfg80211_detach(drvr->config); 821 brcmf_cfg80211_detach(drvr->config);
815 free_netdev(ifp->ndev);
816 } else { 822 } else {
817 kfree(ifp); 823 kfree(ifp);
818 } 824 }
819 drvr->iflist[bssidx] = NULL;
820} 825}
821 826
822int brcmf_attach(uint bus_hdrlen, struct device *dev) 827int brcmf_attach(uint bus_hdrlen, struct device *dev)
@@ -925,8 +930,6 @@ fail:
925 brcmf_fws_del_interface(ifp); 930 brcmf_fws_del_interface(ifp);
926 brcmf_fws_deinit(drvr); 931 brcmf_fws_deinit(drvr);
927 } 932 }
928 free_netdev(ifp->ndev);
929 drvr->iflist[0] = NULL;
930 if (p2p_ifp) { 933 if (p2p_ifp) {
931 free_netdev(p2p_ifp->ndev); 934 free_netdev(p2p_ifp->ndev);
932 drvr->iflist[1] = NULL; 935 drvr->iflist[1] = NULL;
@@ -934,7 +937,8 @@ fail:
934 return ret; 937 return ret;
935 } 938 }
936 if ((brcmf_p2p_enable) && (p2p_ifp)) 939 if ((brcmf_p2p_enable) && (p2p_ifp))
937 brcmf_net_p2p_attach(p2p_ifp); 940 if (brcmf_net_p2p_attach(p2p_ifp) < 0)
941 brcmf_p2p_enable = 0;
938 942
939 return 0; 943 return 0;
940} 944}
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
index 5a64280e6485..83ee53a7c76e 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
@@ -202,7 +202,8 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
202 return; 202 return;
203 brcmf_fws_add_interface(ifp); 203 brcmf_fws_add_interface(ifp);
204 if (!drvr->fweh.evt_handler[BRCMF_E_IF]) 204 if (!drvr->fweh.evt_handler[BRCMF_E_IF])
205 err = brcmf_net_attach(ifp, false); 205 if (brcmf_net_attach(ifp, false) < 0)
206 return;
206 } 207 }
207 208
208 if (ifevent->action == BRCMF_E_IF_CHANGE) 209 if (ifevent->action == BRCMF_E_IF_CHANGE)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
index 0f2c83bc95dc..665ef69e974b 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
@@ -23,6 +23,12 @@
23 23
24#define BRCMF_FIL_ACTION_FRAME_SIZE 1800 24#define BRCMF_FIL_ACTION_FRAME_SIZE 1800
25 25
26/* ARP Offload feature flags for arp_ol iovar */
27#define BRCMF_ARP_OL_AGENT 0x00000001
28#define BRCMF_ARP_OL_SNOOP 0x00000002
29#define BRCMF_ARP_OL_HOST_AUTO_REPLY 0x00000004
30#define BRCMF_ARP_OL_PEER_AUTO_REPLY 0x00000008
31
26 32
27enum brcmf_fil_p2p_if_types { 33enum brcmf_fil_p2p_if_types {
28 BRCMF_FIL_P2P_IF_CLIENT, 34 BRCMF_FIL_P2P_IF_CLIENT,
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
index e7a1a4770996..79555f006d53 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
@@ -47,6 +47,7 @@
47#define IS_P2P_SOCIAL_CHANNEL(channel) ((channel == SOCIAL_CHAN_1) || \ 47#define IS_P2P_SOCIAL_CHANNEL(channel) ((channel == SOCIAL_CHAN_1) || \
48 (channel == SOCIAL_CHAN_2) || \ 48 (channel == SOCIAL_CHAN_2) || \
49 (channel == SOCIAL_CHAN_3)) 49 (channel == SOCIAL_CHAN_3))
50#define BRCMF_P2P_TEMP_CHAN SOCIAL_CHAN_3
50#define SOCIAL_CHAN_CNT 3 51#define SOCIAL_CHAN_CNT 3
51#define AF_PEER_SEARCH_CNT 2 52#define AF_PEER_SEARCH_CNT 2
52 53
@@ -1954,21 +1955,21 @@ s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
1954 err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); 1955 err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
1955 if (err < 0) { 1956 if (err < 0) {
1956 brcmf_err("set p2p_disc error\n"); 1957 brcmf_err("set p2p_disc error\n");
1957 brcmf_free_vif(p2p_vif); 1958 brcmf_free_vif(cfg, p2p_vif);
1958 goto exit; 1959 goto exit;
1959 } 1960 }
1960 /* obtain bsscfg index for P2P discovery */ 1961 /* obtain bsscfg index for P2P discovery */
1961 err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx); 1962 err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
1962 if (err < 0) { 1963 if (err < 0) {
1963 brcmf_err("retrieving discover bsscfg index failed\n"); 1964 brcmf_err("retrieving discover bsscfg index failed\n");
1964 brcmf_free_vif(p2p_vif); 1965 brcmf_free_vif(cfg, p2p_vif);
1965 goto exit; 1966 goto exit;
1966 } 1967 }
1967 /* Verify that firmware uses same bssidx as driver !! */ 1968 /* Verify that firmware uses same bssidx as driver !! */
1968 if (p2p_ifp->bssidx != bssidx) { 1969 if (p2p_ifp->bssidx != bssidx) {
1969 brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n", 1970 brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
1970 bssidx, p2p_ifp->bssidx); 1971 bssidx, p2p_ifp->bssidx);
1971 brcmf_free_vif(p2p_vif); 1972 brcmf_free_vif(cfg, p2p_vif);
1972 goto exit; 1973 goto exit;
1973 } 1974 }
1974 1975
@@ -1996,7 +1997,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
1996 brcmf_p2p_cancel_remain_on_channel(vif->ifp); 1997 brcmf_p2p_cancel_remain_on_channel(vif->ifp);
1997 brcmf_p2p_deinit_discovery(p2p); 1998 brcmf_p2p_deinit_discovery(p2p);
1998 /* remove discovery interface */ 1999 /* remove discovery interface */
1999 brcmf_free_vif(vif); 2000 brcmf_free_vif(p2p->cfg, vif);
2000 p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; 2001 p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
2001 } 2002 }
2002 /* just set it all to zero */ 2003 /* just set it all to zero */
@@ -2013,17 +2014,30 @@ static void brcmf_p2p_get_current_chanspec(struct brcmf_p2p_info *p2p,
2013 u16 *chanspec) 2014 u16 *chanspec)
2014{ 2015{
2015 struct brcmf_if *ifp; 2016 struct brcmf_if *ifp;
2016 struct brcmf_fil_chan_info_le ci; 2017 u8 mac_addr[ETH_ALEN];
2017 struct brcmu_chan ch; 2018 struct brcmu_chan ch;
2018 s32 err; 2019 struct brcmf_bss_info_le *bi;
2020 u8 *buf;
2019 2021
2020 ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; 2022 ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp;
2021 2023
2022 ch.chnum = 11; 2024 if (brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSSID, mac_addr,
2023 2025 ETH_ALEN) == 0) {
2024 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_CHANNEL, &ci, sizeof(ci)); 2026 buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
2025 if (!err) 2027 if (buf != NULL) {
2026 ch.chnum = le32_to_cpu(ci.hw_channel); 2028 *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX);
2029 if (brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
2030 buf, WL_BSS_INFO_MAX) == 0) {
2031 bi = (struct brcmf_bss_info_le *)(buf + 4);
2032 *chanspec = le16_to_cpu(bi->chanspec);
2033 kfree(buf);
2034 return;
2035 }
2036 kfree(buf);
2037 }
2038 }
2039 /* Use default channel for P2P */
2040 ch.chnum = BRCMF_P2P_TEMP_CHAN;
2027 ch.bw = BRCMU_CHAN_BW_20; 2041 ch.bw = BRCMU_CHAN_BW_20;
2028 p2p->cfg->d11inf.encchspec(&ch); 2042 p2p->cfg->d11inf.encchspec(&ch);
2029 *chanspec = ch.chspec; 2043 *chanspec = ch.chspec;
@@ -2208,7 +2222,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
2208 return &p2p_vif->wdev; 2222 return &p2p_vif->wdev;
2209 2223
2210fail: 2224fail:
2211 brcmf_free_vif(p2p_vif); 2225 brcmf_free_vif(p2p->cfg, p2p_vif);
2212 return ERR_PTR(err); 2226 return ERR_PTR(err);
2213} 2227}
2214 2228
@@ -2217,13 +2231,31 @@ fail:
2217 * 2231 *
2218 * @vif: virtual interface object to delete. 2232 * @vif: virtual interface object to delete.
2219 */ 2233 */
2220static void brcmf_p2p_delete_p2pdev(struct brcmf_cfg80211_vif *vif) 2234static void brcmf_p2p_delete_p2pdev(struct brcmf_cfg80211_info *cfg,
2235 struct brcmf_cfg80211_vif *vif)
2221{ 2236{
2222 struct brcmf_p2p_info *p2p = &vif->ifp->drvr->config->p2p;
2223
2224 cfg80211_unregister_wdev(&vif->wdev); 2237 cfg80211_unregister_wdev(&vif->wdev);
2225 p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; 2238 cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
2226 brcmf_free_vif(vif); 2239 brcmf_free_vif(cfg, vif);
2240}
2241
2242/**
2243 * brcmf_p2p_free_p2p_if() - free up net device related data.
2244 *
2245 * @ndev: net device that needs to be freed.
2246 */
2247static void brcmf_p2p_free_p2p_if(struct net_device *ndev)
2248{
2249 struct brcmf_cfg80211_info *cfg;
2250 struct brcmf_cfg80211_vif *vif;
2251 struct brcmf_if *ifp;
2252
2253 ifp = netdev_priv(ndev);
2254 cfg = ifp->drvr->config;
2255 vif = ifp->vif;
2256
2257 brcmf_free_vif(cfg, vif);
2258 free_netdev(ifp->ndev);
2227} 2259}
2228 2260
2229/** 2261/**
@@ -2303,6 +2335,9 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
2303 brcmf_err("Registering netdevice failed\n"); 2335 brcmf_err("Registering netdevice failed\n");
2304 goto fail; 2336 goto fail;
2305 } 2337 }
2338 /* override destructor */
2339 ifp->ndev->destructor = brcmf_p2p_free_p2p_if;
2340
2306 cfg->p2p.bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = vif; 2341 cfg->p2p.bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = vif;
2307 /* Disable firmware roaming for P2P interface */ 2342 /* Disable firmware roaming for P2P interface */
2308 brcmf_fil_iovar_int_set(ifp, "roam_off", 1); 2343 brcmf_fil_iovar_int_set(ifp, "roam_off", 1);
@@ -2314,7 +2349,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
2314 return &ifp->vif->wdev; 2349 return &ifp->vif->wdev;
2315 2350
2316fail: 2351fail:
2317 brcmf_free_vif(vif); 2352 brcmf_free_vif(cfg, vif);
2318 return ERR_PTR(err); 2353 return ERR_PTR(err);
2319} 2354}
2320 2355
@@ -2350,7 +2385,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
2350 break; 2385 break;
2351 2386
2352 case NL80211_IFTYPE_P2P_DEVICE: 2387 case NL80211_IFTYPE_P2P_DEVICE:
2353 brcmf_p2p_delete_p2pdev(vif); 2388 brcmf_p2p_delete_p2pdev(cfg, vif);
2354 return 0; 2389 return 0;
2355 default: 2390 default:
2356 return -ENOTSUPP; 2391 return -ENOTSUPP;
@@ -2378,7 +2413,6 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
2378 err = 0; 2413 err = 0;
2379 } 2414 }
2380 brcmf_cfg80211_arm_vif_event(cfg, NULL); 2415 brcmf_cfg80211_arm_vif_event(cfg, NULL);
2381 brcmf_free_vif(vif);
2382 p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL; 2416 p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL;
2383 2417
2384 return err; 2418 return err;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 761f501959a9..301e572e8923 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -459,6 +459,38 @@ send_key_to_dongle(struct net_device *ndev, struct brcmf_wsec_key *key)
459 return err; 459 return err;
460} 460}
461 461
462static s32
463brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable)
464{
465 s32 err;
466 u32 mode;
467
468 if (enable)
469 mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY;
470 else
471 mode = 0;
472
473 /* Try to set and enable ARP offload feature, this may fail, then it */
474 /* is simply not supported and err 0 will be returned */
475 err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode);
476 if (err) {
477 brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n",
478 mode, err);
479 err = 0;
480 } else {
481 err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable);
482 if (err) {
483 brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n",
484 enable, err);
485 err = 0;
486 } else
487 brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n",
488 enable, mode);
489 }
490
491 return err;
492}
493
462static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, 494static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
463 const char *name, 495 const char *name,
464 enum nl80211_iftype type, 496 enum nl80211_iftype type,
@@ -2216,6 +2248,11 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
2216 } 2248 }
2217 2249
2218 pm = enabled ? PM_FAST : PM_OFF; 2250 pm = enabled ? PM_FAST : PM_OFF;
2251 /* Do not enable the power save after assoc if it is a p2p interface */
2252 if (ifp->vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) {
2253 brcmf_dbg(INFO, "Do not enable power save for P2P clients\n");
2254 pm = PM_OFF;
2255 }
2219 brcmf_dbg(INFO, "power save %s\n", (pm ? "enabled" : "disabled")); 2256 brcmf_dbg(INFO, "power save %s\n", (pm ? "enabled" : "disabled"));
2220 2257
2221 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); 2258 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
@@ -3640,10 +3677,28 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
3640} 3677}
3641 3678
3642static s32 3679static s32
3680brcmf_cfg80211_set_channel(struct brcmf_cfg80211_info *cfg,
3681 struct brcmf_if *ifp,
3682 struct ieee80211_channel *channel)
3683{
3684 u16 chanspec;
3685 s32 err;
3686
3687 brcmf_dbg(TRACE, "band=%d, center_freq=%d\n", channel->band,
3688 channel->center_freq);
3689
3690 chanspec = channel_to_chanspec(&cfg->d11inf, channel);
3691 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
3692
3693 return err;
3694}
3695
3696static s32
3643brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, 3697brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3644 struct cfg80211_ap_settings *settings) 3698 struct cfg80211_ap_settings *settings)
3645{ 3699{
3646 s32 ie_offset; 3700 s32 ie_offset;
3701 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3647 struct brcmf_if *ifp = netdev_priv(ndev); 3702 struct brcmf_if *ifp = netdev_priv(ndev);
3648 struct brcmf_tlv *ssid_ie; 3703 struct brcmf_tlv *ssid_ie;
3649 struct brcmf_ssid_le ssid_le; 3704 struct brcmf_ssid_le ssid_le;
@@ -3683,6 +3738,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3683 } 3738 }
3684 3739
3685 brcmf_set_mpc(ifp, 0); 3740 brcmf_set_mpc(ifp, 0);
3741 brcmf_configure_arp_offload(ifp, false);
3686 3742
3687 /* find the RSN_IE */ 3743 /* find the RSN_IE */
3688 rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, 3744 rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
@@ -3713,6 +3769,12 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3713 3769
3714 brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); 3770 brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon);
3715 3771
3772 err = brcmf_cfg80211_set_channel(cfg, ifp, settings->chandef.chan);
3773 if (err < 0) {
3774 brcmf_err("Set Channel failed, %d\n", err);
3775 goto exit;
3776 }
3777
3716 if (settings->beacon_interval) { 3778 if (settings->beacon_interval) {
3717 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, 3779 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
3718 settings->beacon_interval); 3780 settings->beacon_interval);
@@ -3789,8 +3851,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3789 set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); 3851 set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
3790 3852
3791exit: 3853exit:
3792 if (err) 3854 if (err) {
3793 brcmf_set_mpc(ifp, 1); 3855 brcmf_set_mpc(ifp, 1);
3856 brcmf_configure_arp_offload(ifp, true);
3857 }
3794 return err; 3858 return err;
3795} 3859}
3796 3860
@@ -3831,6 +3895,7 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
3831 brcmf_err("bss_enable config failed %d\n", err); 3895 brcmf_err("bss_enable config failed %d\n", err);
3832 } 3896 }
3833 brcmf_set_mpc(ifp, 1); 3897 brcmf_set_mpc(ifp, 1);
3898 brcmf_configure_arp_offload(ifp, true);
3834 set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); 3899 set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state);
3835 clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); 3900 clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
3836 3901
@@ -4148,7 +4213,7 @@ static const struct ieee80211_iface_limit brcmf_iface_limits[] = {
4148static const struct ieee80211_iface_combination brcmf_iface_combos[] = { 4213static const struct ieee80211_iface_combination brcmf_iface_combos[] = {
4149 { 4214 {
4150 .max_interfaces = BRCMF_IFACE_MAX_CNT, 4215 .max_interfaces = BRCMF_IFACE_MAX_CNT,
4151 .num_different_channels = 1, /* no multi-channel for now */ 4216 .num_different_channels = 2,
4152 .n_limits = ARRAY_SIZE(brcmf_iface_limits), 4217 .n_limits = ARRAY_SIZE(brcmf_iface_limits),
4153 .limits = brcmf_iface_limits 4218 .limits = brcmf_iface_limits
4154 } 4219 }
@@ -4256,20 +4321,16 @@ struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
4256 return vif; 4321 return vif;
4257} 4322}
4258 4323
4259void brcmf_free_vif(struct brcmf_cfg80211_vif *vif) 4324void brcmf_free_vif(struct brcmf_cfg80211_info *cfg,
4325 struct brcmf_cfg80211_vif *vif)
4260{ 4326{
4261 struct brcmf_cfg80211_info *cfg;
4262 struct wiphy *wiphy;
4263
4264 wiphy = vif->wdev.wiphy;
4265 cfg = wiphy_priv(wiphy);
4266 list_del(&vif->list); 4327 list_del(&vif->list);
4267 cfg->vif_cnt--; 4328 cfg->vif_cnt--;
4268 4329
4269 kfree(vif); 4330 kfree(vif);
4270 if (!cfg->vif_cnt) { 4331 if (!cfg->vif_cnt) {
4271 wiphy_unregister(wiphy); 4332 wiphy_unregister(cfg->wiphy);
4272 wiphy_free(wiphy); 4333 wiphy_free(cfg->wiphy);
4273 } 4334 }
4274} 4335}
4275 4336
@@ -4646,7 +4707,6 @@ static s32 brcmf_notify_vif_event(struct brcmf_if *ifp,
4646 return 0; 4707 return 0;
4647 4708
4648 case BRCMF_E_IF_DEL: 4709 case BRCMF_E_IF_DEL:
4649 ifp->vif = NULL;
4650 mutex_unlock(&event->vif_event_lock); 4710 mutex_unlock(&event->vif_event_lock);
4651 /* event may not be upon user request */ 4711 /* event may not be upon user request */
4652 if (brcmf_cfg80211_vif_event_armed(cfg)) 4712 if (brcmf_cfg80211_vif_event_armed(cfg))
@@ -4852,8 +4912,7 @@ cfg80211_p2p_attach_out:
4852 wl_deinit_priv(cfg); 4912 wl_deinit_priv(cfg);
4853 4913
4854cfg80211_attach_out: 4914cfg80211_attach_out:
4855 brcmf_free_vif(vif); 4915 brcmf_free_vif(cfg, vif);
4856 wiphy_free(wiphy);
4857 return NULL; 4916 return NULL;
4858} 4917}
4859 4918
@@ -4865,7 +4924,7 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg)
4865 wl_deinit_priv(cfg); 4924 wl_deinit_priv(cfg);
4866 brcmf_btcoex_detach(cfg); 4925 brcmf_btcoex_detach(cfg);
4867 list_for_each_entry_safe(vif, tmp, &cfg->vif_list, list) { 4926 list_for_each_entry_safe(vif, tmp, &cfg->vif_list, list) {
4868 brcmf_free_vif(vif); 4927 brcmf_free_vif(cfg, vif);
4869 } 4928 }
4870} 4929}
4871 4930
@@ -5229,6 +5288,8 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
5229 if (err) 5288 if (err)
5230 goto default_conf_out; 5289 goto default_conf_out;
5231 5290
5291 brcmf_configure_arp_offload(ifp, true);
5292
5232 cfg->dongle_up = true; 5293 cfg->dongle_up = true;
5233default_conf_out: 5294default_conf_out:
5234 5295
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
index a71cff84cdcf..d9bdaf9a72d0 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
@@ -487,7 +487,8 @@ enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
487struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, 487struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
488 enum nl80211_iftype type, 488 enum nl80211_iftype type,
489 bool pm_block); 489 bool pm_block);
490void brcmf_free_vif(struct brcmf_cfg80211_vif *vif); 490void brcmf_free_vif(struct brcmf_cfg80211_info *cfg,
491 struct brcmf_cfg80211_vif *vif);
491 492
492s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, 493s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
493 const u8 *vndr_ie_buf, u32 vndr_ie_len); 494 const u8 *vndr_ie_buf, u32 vndr_ie_len);
diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c
index db183b44e038..c3c13ce96eb0 100644
--- a/drivers/net/wireless/iwlwifi/dvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/dvm/sta.c
@@ -735,7 +735,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
735 memcpy(&lq, priv->stations[i].lq, 735 memcpy(&lq, priv->stations[i].lq,
736 sizeof(struct iwl_link_quality_cmd)); 736 sizeof(struct iwl_link_quality_cmd));
737 737
738 if (!memcmp(&lq, &zero_lq, sizeof(lq))) 738 if (memcmp(&lq, &zero_lq, sizeof(lq)))
739 send_lq = true; 739 send_lq = true;
740 } 740 }
741 spin_unlock_bh(&priv->sta_lock); 741 spin_unlock_bh(&priv->sta_lock);
diff --git a/drivers/nfc/Kconfig b/drivers/nfc/Kconfig
index 4775d4e61b88..74a852e4e41f 100644
--- a/drivers/nfc/Kconfig
+++ b/drivers/nfc/Kconfig
@@ -28,7 +28,7 @@ config NFC_WILINK
28 28
29config NFC_MEI_PHY 29config NFC_MEI_PHY
30 tristate "MEI bus NFC device support" 30 tristate "MEI bus NFC device support"
31 depends on INTEL_MEI_BUS_NFC && NFC_HCI 31 depends on INTEL_MEI && NFC_HCI
32 help 32 help
33 This adds support to use an mei bus nfc device. Select this if you 33 This adds support to use an mei bus nfc device. Select this if you
34 will use an HCI NFC driver for an NFC chip connected behind an 34 will use an HCI NFC driver for an NFC chip connected behind an
diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c
index b8f8abc422f0..1201bdbfb791 100644
--- a/drivers/nfc/mei_phy.c
+++ b/drivers/nfc/mei_phy.c
@@ -64,6 +64,15 @@ int nfc_mei_phy_enable(void *phy_id)
64 return r; 64 return r;
65 } 65 }
66 66
67 r = mei_cl_register_event_cb(phy->device, nfc_mei_event_cb, phy);
68 if (r) {
69 pr_err("MEY_PHY: Event cb registration failed\n");
70 mei_cl_disable_device(phy->device);
71 phy->powered = 0;
72
73 return r;
74 }
75
67 phy->powered = 1; 76 phy->powered = 1;
68 77
69 return 0; 78 return 0;
diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c
index 1ad044dce7b6..cdf1bc53b257 100644
--- a/drivers/nfc/microread/mei.c
+++ b/drivers/nfc/microread/mei.c
@@ -43,24 +43,16 @@ static int microread_mei_probe(struct mei_cl_device *device,
43 return -ENOMEM; 43 return -ENOMEM;
44 } 44 }
45 45
46 r = mei_cl_register_event_cb(device, nfc_mei_event_cb, phy);
47 if (r) {
48 pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n");
49 goto err_out;
50 }
51
52 r = microread_probe(phy, &mei_phy_ops, LLC_NOP_NAME, 46 r = microread_probe(phy, &mei_phy_ops, LLC_NOP_NAME,
53 MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, 47 MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD,
54 &phy->hdev); 48 &phy->hdev);
55 if (r < 0) 49 if (r < 0) {
56 goto err_out; 50 nfc_mei_phy_free(phy);
57
58 return 0;
59 51
60err_out: 52 return r;
61 nfc_mei_phy_free(phy); 53 }
62 54
63 return r; 55 return 0;
64} 56}
65 57
66static int microread_mei_remove(struct mei_cl_device *device) 58static int microread_mei_remove(struct mei_cl_device *device)
@@ -71,8 +63,6 @@ static int microread_mei_remove(struct mei_cl_device *device)
71 63
72 microread_remove(phy->hdev); 64 microread_remove(phy->hdev);
73 65
74 nfc_mei_phy_disable(phy);
75
76 nfc_mei_phy_free(phy); 66 nfc_mei_phy_free(phy);
77 67
78 return 0; 68 return 0;
diff --git a/drivers/nfc/pn544/mei.c b/drivers/nfc/pn544/mei.c
index 1eb48848a35a..b5d3d18179eb 100644
--- a/drivers/nfc/pn544/mei.c
+++ b/drivers/nfc/pn544/mei.c
@@ -43,24 +43,16 @@ static int pn544_mei_probe(struct mei_cl_device *device,
43 return -ENOMEM; 43 return -ENOMEM;
44 } 44 }
45 45
46 r = mei_cl_register_event_cb(device, nfc_mei_event_cb, phy);
47 if (r) {
48 pr_err(PN544_DRIVER_NAME ": event cb registration failed\n");
49 goto err_out;
50 }
51
52 r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME, 46 r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME,
53 MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, 47 MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD,
54 &phy->hdev); 48 &phy->hdev);
55 if (r < 0) 49 if (r < 0) {
56 goto err_out; 50 nfc_mei_phy_free(phy);
57
58 return 0;
59 51
60err_out: 52 return r;
61 nfc_mei_phy_free(phy); 53 }
62 54
63 return r; 55 return 0;
64} 56}
65 57
66static int pn544_mei_remove(struct mei_cl_device *device) 58static int pn544_mei_remove(struct mei_cl_device *device)
@@ -71,8 +63,6 @@ static int pn544_mei_remove(struct mei_cl_device *device)
71 63
72 pn544_hci_remove(phy->hdev); 64 pn544_hci_remove(phy->hdev);
73 65
74 nfc_mei_phy_disable(phy);
75
76 nfc_mei_phy_free(phy); 66 nfc_mei_phy_free(phy);
77 67
78 return 0; 68 return 0;
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 60f1ce5e5e52..98d20c0f6fed 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -159,9 +159,10 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
159 return 0; 159 return 0;
160} 160}
161 161
162static int ieee80211_verify_mac(struct ieee80211_local *local, u8 *addr) 162static int ieee80211_verify_mac(struct ieee80211_sub_if_data *sdata, u8 *addr)
163{ 163{
164 struct ieee80211_sub_if_data *sdata; 164 struct ieee80211_local *local = sdata->local;
165 struct ieee80211_sub_if_data *iter;
165 u64 new, mask, tmp; 166 u64 new, mask, tmp;
166 u8 *m; 167 u8 *m;
167 int ret = 0; 168 int ret = 0;
@@ -181,11 +182,14 @@ static int ieee80211_verify_mac(struct ieee80211_local *local, u8 *addr)
181 182
182 183
183 mutex_lock(&local->iflist_mtx); 184 mutex_lock(&local->iflist_mtx);
184 list_for_each_entry(sdata, &local->interfaces, list) { 185 list_for_each_entry(iter, &local->interfaces, list) {
185 if (sdata->vif.type == NL80211_IFTYPE_MONITOR) 186 if (iter == sdata)
187 continue;
188
189 if (iter->vif.type == NL80211_IFTYPE_MONITOR)
186 continue; 190 continue;
187 191
188 m = sdata->vif.addr; 192 m = iter->vif.addr;
189 tmp = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | 193 tmp = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) |
190 ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | 194 ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) |
191 ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); 195 ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8);
@@ -209,7 +213,7 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr)
209 if (ieee80211_sdata_running(sdata)) 213 if (ieee80211_sdata_running(sdata))
210 return -EBUSY; 214 return -EBUSY;
211 215
212 ret = ieee80211_verify_mac(sdata->local, sa->sa_data); 216 ret = ieee80211_verify_mac(sdata, sa->sa_data);
213 if (ret) 217 if (ret)
214 return ret; 218 return ret;
215 219
@@ -474,6 +478,9 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
474 master->control_port_protocol; 478 master->control_port_protocol;
475 sdata->control_port_no_encrypt = 479 sdata->control_port_no_encrypt =
476 master->control_port_no_encrypt; 480 master->control_port_no_encrypt;
481 sdata->vif.cab_queue = master->vif.cab_queue;
482 memcpy(sdata->vif.hw_queue, master->vif.hw_queue,
483 sizeof(sdata->vif.hw_queue));
477 break; 484 break;
478 } 485 }
479 case NL80211_IFTYPE_AP: 486 case NL80211_IFTYPE_AP:
@@ -653,7 +660,11 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
653 660
654 ieee80211_recalc_ps(local, -1); 661 ieee80211_recalc_ps(local, -1);
655 662
656 if (dev) { 663 if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
664 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
665 /* XXX: for AP_VLAN, actually track AP queues */
666 netif_tx_start_all_queues(dev);
667 } else if (dev) {
657 unsigned long flags; 668 unsigned long flags;
658 int n_acs = IEEE80211_NUM_ACS; 669 int n_acs = IEEE80211_NUM_ACS;
659 int ac; 670 int ac;
@@ -1479,7 +1490,17 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
1479 break; 1490 break;
1480 } 1491 }
1481 1492
1493 /*
1494 * Pick address of existing interface in case user changed
1495 * MAC address manually, default to perm_addr.
1496 */
1482 m = local->hw.wiphy->perm_addr; 1497 m = local->hw.wiphy->perm_addr;
1498 list_for_each_entry(sdata, &local->interfaces, list) {
1499 if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
1500 continue;
1501 m = sdata->vif.addr;
1502 break;
1503 }
1483 start = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | 1504 start = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) |
1484 ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | 1505 ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) |
1485 ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); 1506 ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8);
@@ -1696,6 +1717,15 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local)
1696 1717
1697 ASSERT_RTNL(); 1718 ASSERT_RTNL();
1698 1719
1720 /*
1721 * Close all AP_VLAN interfaces first, as otherwise they
1722 * might be closed while the AP interface they belong to
1723 * is closed, causing unregister_netdevice_many() to crash.
1724 */
1725 list_for_each_entry(sdata, &local->interfaces, list)
1726 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
1727 dev_close(sdata->dev);
1728
1699 mutex_lock(&local->iflist_mtx); 1729 mutex_lock(&local->iflist_mtx);
1700 list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { 1730 list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
1701 list_del(&sdata->list); 1731 list_del(&sdata->list);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a46e490f20dd..a8c2130c8ba4 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3321,10 +3321,6 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
3321 if (WARN_ON_ONCE(!auth_data)) 3321 if (WARN_ON_ONCE(!auth_data))
3322 return -EINVAL; 3322 return -EINVAL;
3323 3323
3324 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)
3325 tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
3326 IEEE80211_TX_INTFL_MLME_CONN_TX;
3327
3328 auth_data->tries++; 3324 auth_data->tries++;
3329 3325
3330 if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) { 3326 if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) {
@@ -3358,6 +3354,10 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
3358 auth_data->expected_transaction = trans; 3354 auth_data->expected_transaction = trans;
3359 } 3355 }
3360 3356
3357 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)
3358 tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
3359 IEEE80211_TX_INTFL_MLME_CONN_TX;
3360
3361 ieee80211_send_auth(sdata, trans, auth_data->algorithm, status, 3361 ieee80211_send_auth(sdata, trans, auth_data->algorithm, status,
3362 auth_data->data, auth_data->data_len, 3362 auth_data->data, auth_data->data_len,
3363 auth_data->bss->bssid, 3363 auth_data->bss->bssid,
@@ -3381,12 +3381,12 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
3381 * will not answer to direct packet in unassociated state. 3381 * will not answer to direct packet in unassociated state.
3382 */ 3382 */
3383 ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1], 3383 ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1],
3384 NULL, 0, (u32) -1, true, tx_flags, 3384 NULL, 0, (u32) -1, true, 0,
3385 auth_data->bss->channel, false); 3385 auth_data->bss->channel, false);
3386 rcu_read_unlock(); 3386 rcu_read_unlock();
3387 } 3387 }
3388 3388
3389 if (!(local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) { 3389 if (tx_flags == 0) {
3390 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; 3390 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
3391 ifmgd->auth_data->timeout_started = true; 3391 ifmgd->auth_data->timeout_started = true;
3392 run_again(ifmgd, auth_data->timeout); 3392 run_again(ifmgd, auth_data->timeout);
diff --git a/net/nfc/Makefile b/net/nfc/Makefile
index fb799deaed4f..a76f4533cb6c 100644
--- a/net/nfc/Makefile
+++ b/net/nfc/Makefile
@@ -5,7 +5,6 @@
5obj-$(CONFIG_NFC) += nfc.o 5obj-$(CONFIG_NFC) += nfc.o
6obj-$(CONFIG_NFC_NCI) += nci/ 6obj-$(CONFIG_NFC_NCI) += nci/
7obj-$(CONFIG_NFC_HCI) += hci/ 7obj-$(CONFIG_NFC_HCI) += hci/
8#obj-$(CONFIG_NFC_LLCP) += llcp/
9 8
10nfc-objs := core.o netlink.o af_nfc.o rawsock.o llcp_core.o llcp_commands.o \ 9nfc-objs := core.o netlink.o af_nfc.o rawsock.o llcp_core.o llcp_commands.o \
11 llcp_sock.o 10 llcp_sock.o
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index dfdb5e643211..d5aed3bb3945 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3411,7 +3411,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq,
3411 (u32)sinfo->rx_bytes)) 3411 (u32)sinfo->rx_bytes))
3412 goto nla_put_failure; 3412 goto nla_put_failure;
3413 if ((sinfo->filled & (STATION_INFO_TX_BYTES | 3413 if ((sinfo->filled & (STATION_INFO_TX_BYTES |
3414 NL80211_STA_INFO_TX_BYTES64)) && 3414 STATION_INFO_TX_BYTES64)) &&
3415 nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES, 3415 nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES,
3416 (u32)sinfo->tx_bytes)) 3416 (u32)sinfo->tx_bytes))
3417 goto nla_put_failure; 3417 goto nla_put_failure;
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 8b5eddfba1e5..3ed35c345cae 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -231,6 +231,9 @@ void cfg80211_conn_work(struct work_struct *work)
231 mutex_lock(&rdev->sched_scan_mtx); 231 mutex_lock(&rdev->sched_scan_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)
235 continue;
236
234 wdev_lock(wdev); 237 wdev_lock(wdev);
235 if (!netif_running(wdev->netdev)) { 238 if (!netif_running(wdev->netdev)) {
236 wdev_unlock(wdev); 239 wdev_unlock(wdev);