300-pending_work.patch 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978
  1. --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
  2. +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
  3. @@ -326,7 +326,6 @@ static bool ar9003_hw_get_isr(struct ath
  4. static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds,
  5. struct ath_tx_status *ts)
  6. {
  7. - struct ar9003_txc *txc = (struct ar9003_txc *) ds;
  8. struct ar9003_txs *ads;
  9. u32 status;
  10. @@ -336,11 +335,7 @@ static int ar9003_hw_proc_txdesc(struct
  11. if ((status & AR_TxDone) == 0)
  12. return -EINPROGRESS;
  13. - ts->qid = MS(ads->ds_info, AR_TxQcuNum);
  14. - if (!txc || (MS(txc->info, AR_TxQcuNum) == ts->qid))
  15. - ah->ts_tail = (ah->ts_tail + 1) % ah->ts_size;
  16. - else
  17. - return -ENOENT;
  18. + ah->ts_tail = (ah->ts_tail + 1) % ah->ts_size;
  19. if ((MS(ads->ds_info, AR_DescId) != ATHEROS_VENDOR_ID) ||
  20. (MS(ads->ds_info, AR_TxRxDesc) != 1)) {
  21. @@ -354,6 +349,7 @@ static int ar9003_hw_proc_txdesc(struct
  22. ts->ts_seqnum = MS(status, AR_SeqNum);
  23. ts->tid = MS(status, AR_TxTid);
  24. + ts->qid = MS(ads->ds_info, AR_TxQcuNum);
  25. ts->desc_id = MS(ads->status1, AR_TxDescId);
  26. ts->ts_tstamp = ads->status4;
  27. ts->ts_status = 0;
  28. @@ -440,20 +436,14 @@ int ath9k_hw_process_rxdesc_edma(struct
  29. struct ar9003_rxs *rxsp = (struct ar9003_rxs *) buf_addr;
  30. unsigned int phyerr;
  31. - /* TODO: byte swap on big endian for ar9300_10 */
  32. -
  33. - if (!rxs) {
  34. - if ((rxsp->status11 & AR_RxDone) == 0)
  35. - return -EINPROGRESS;
  36. -
  37. - if (MS(rxsp->ds_info, AR_DescId) != 0x168c)
  38. - return -EINVAL;
  39. + if ((rxsp->status11 & AR_RxDone) == 0)
  40. + return -EINPROGRESS;
  41. - if ((rxsp->ds_info & (AR_TxRxDesc | AR_CtrlStat)) != 0)
  42. - return -EINPROGRESS;
  43. + if (MS(rxsp->ds_info, AR_DescId) != 0x168c)
  44. + return -EINVAL;
  45. - return 0;
  46. - }
  47. + if ((rxsp->ds_info & (AR_TxRxDesc | AR_CtrlStat)) != 0)
  48. + return -EINPROGRESS;
  49. rxs->rs_status = 0;
  50. rxs->rs_flags = 0;
  51. @@ -510,7 +500,11 @@ int ath9k_hw_process_rxdesc_edma(struct
  52. */
  53. if (rxsp->status11 & AR_CRCErr)
  54. rxs->rs_status |= ATH9K_RXERR_CRC;
  55. - else if (rxsp->status11 & AR_PHYErr) {
  56. + else if (rxsp->status11 & AR_DecryptCRCErr)
  57. + rxs->rs_status |= ATH9K_RXERR_DECRYPT;
  58. + else if (rxsp->status11 & AR_MichaelErr)
  59. + rxs->rs_status |= ATH9K_RXERR_MIC;
  60. + if (rxsp->status11 & AR_PHYErr) {
  61. phyerr = MS(rxsp->status11, AR_PHYErrCode);
  62. /*
  63. * If we reach a point here where AR_PostDelimCRCErr is
  64. @@ -532,11 +526,7 @@ int ath9k_hw_process_rxdesc_edma(struct
  65. rxs->rs_status |= ATH9K_RXERR_PHY;
  66. rxs->rs_phyerr = phyerr;
  67. }
  68. -
  69. - } else if (rxsp->status11 & AR_DecryptCRCErr)
  70. - rxs->rs_status |= ATH9K_RXERR_DECRYPT;
  71. - else if (rxsp->status11 & AR_MichaelErr)
  72. - rxs->rs_status |= ATH9K_RXERR_MIC;
  73. + };
  74. }
  75. if (rxsp->status11 & AR_KeyMiss)
  76. --- a/drivers/net/wireless/ath/carl9170/tx.c
  77. +++ b/drivers/net/wireless/ath/carl9170/tx.c
  78. @@ -1236,6 +1236,7 @@ static bool carl9170_tx_ps_drop(struct a
  79. {
  80. struct ieee80211_sta *sta;
  81. struct carl9170_sta_info *sta_info;
  82. + struct ieee80211_tx_info *tx_info;
  83. rcu_read_lock();
  84. sta = __carl9170_get_tx_sta(ar, skb);
  85. @@ -1243,12 +1244,13 @@ static bool carl9170_tx_ps_drop(struct a
  86. goto out_rcu;
  87. sta_info = (void *) sta->drv_priv;
  88. - if (unlikely(sta_info->sleeping)) {
  89. - struct ieee80211_tx_info *tx_info;
  90. + tx_info = IEEE80211_SKB_CB(skb);
  91. + if (unlikely(sta_info->sleeping) &&
  92. + !(tx_info->flags & (IEEE80211_TX_CTL_NO_PS_BUFFER |
  93. + IEEE80211_TX_CTL_CLEAR_PS_FILT))) {
  94. rcu_read_unlock();
  95. - tx_info = IEEE80211_SKB_CB(skb);
  96. if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
  97. atomic_dec(&ar->tx_ampdu_upload);
  98. --- a/drivers/net/wireless/iwlegacy/4965-mac.c
  99. +++ b/drivers/net/wireless/iwlegacy/4965-mac.c
  100. @@ -1694,7 +1694,7 @@ il4965_tx_skb(struct il_priv *il, struct
  101. sta_priv = (void *)sta->drv_priv;
  102. if (sta_priv && sta_priv->asleep &&
  103. - (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)) {
  104. + (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) {
  105. /*
  106. * This sends an asynchronous command to the device,
  107. * but we can rely on it being processed before the
  108. --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
  109. +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
  110. @@ -322,7 +322,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
  111. sta_priv = (void *)info->control.sta->drv_priv;
  112. if (sta_priv && sta_priv->asleep &&
  113. - (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)) {
  114. + (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) {
  115. /*
  116. * This sends an asynchronous command to the device,
  117. * but we can rely on it being processed before the
  118. @@ -331,6 +331,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
  119. * counter.
  120. * For now set the counter to just 1 since we do not
  121. * support uAPSD yet.
  122. + *
  123. + * FIXME: If we get two non-bufferable frames one
  124. + * after the other, we might only send out one of
  125. + * them because this is racy.
  126. */
  127. iwl_sta_modify_sleep_tx_count(priv, sta_id, 1);
  128. }
  129. --- a/drivers/net/wireless/p54/txrx.c
  130. +++ b/drivers/net/wireless/p54/txrx.c
  131. @@ -690,7 +690,7 @@ static void p54_tx_80211_header(struct p
  132. if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ))
  133. *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR;
  134. - if (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)
  135. + if (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)
  136. *flags |= P54_HDR_FLAG_DATA_OUT_NOCANCEL;
  137. if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
  138. --- a/include/net/mac80211.h
  139. +++ b/include/net/mac80211.h
  140. @@ -341,9 +341,9 @@ struct ieee80211_bss_conf {
  141. * used to indicate that a frame was already retried due to PS
  142. * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
  143. * used to indicate frame should not be encrypted
  144. - * @IEEE80211_TX_CTL_POLL_RESPONSE: This frame is a response to a poll
  145. - * frame (PS-Poll or uAPSD) and should be sent although the station
  146. - * is in powersave mode.
  147. + * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll
  148. + * frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must
  149. + * be sent although the station is in powersave mode.
  150. * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
  151. * transmit function after the current frame, this can be used
  152. * by drivers to kick the DMA queue only if unset or when the
  153. @@ -399,7 +399,7 @@ enum mac80211_tx_control_flags {
  154. IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
  155. IEEE80211_TX_INTFL_RETRIED = BIT(15),
  156. IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
  157. - IEEE80211_TX_CTL_POLL_RESPONSE = BIT(17),
  158. + IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17),
  159. IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
  160. IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
  161. /* hole at 20, use later */
  162. @@ -425,7 +425,7 @@ enum mac80211_tx_control_flags {
  163. IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \
  164. IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \
  165. IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \
  166. - IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_POLL_RESPONSE | \
  167. + IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \
  168. IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \
  169. IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
  170. @@ -659,6 +659,8 @@ ieee80211_tx_info_clear_status(struct ie
  171. * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
  172. * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
  173. * @RX_FLAG_SHORT_GI: Short guard interval was used
  174. + * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
  175. + * Valid only for data frames (mainly A-MPDU)
  176. */
  177. enum mac80211_rx_flags {
  178. RX_FLAG_MMIC_ERROR = 1<<0,
  179. @@ -672,6 +674,7 @@ enum mac80211_rx_flags {
  180. RX_FLAG_HT = 1<<9,
  181. RX_FLAG_40MHZ = 1<<10,
  182. RX_FLAG_SHORT_GI = 1<<11,
  183. + RX_FLAG_NO_SIGNAL_VAL = 1<<12,
  184. };
  185. /**
  186. @@ -1634,7 +1637,7 @@ void ieee80211_free_txskb(struct ieee802
  187. * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
  188. * will inform the driver of this with the @allow_buffered_frames
  189. * callback; this callback is optional. mac80211 will then transmit
  190. - * the frames as usual and set the %IEEE80211_TX_CTL_POLL_RESPONSE
  191. + * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER
  192. * on each frame. The last frame in the service period (or the only
  193. * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
  194. * indicate that it ends the service period; as this frame must have
  195. @@ -1642,6 +1645,9 @@ void ieee80211_free_txskb(struct ieee802
  196. * When TX status is reported for this frame, the service period is
  197. * marked has having ended and a new one can be started by the peer.
  198. *
  199. + * Additionally, non-bufferable MMPDUs can also be transmitted by
  200. + * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
  201. + *
  202. * Another race condition can happen on some devices like iwlwifi
  203. * when there are frames queued for the station and it wakes up
  204. * or polls; the frames that are already queued could end up being
  205. @@ -2140,7 +2146,7 @@ enum ieee80211_frame_release_type {
  206. * @allow_buffered_frames: Prepare device to allow the given number of frames
  207. * to go out to the given station. The frames will be sent by mac80211
  208. * via the usual TX path after this call. The TX information for frames
  209. - * released will also have the %IEEE80211_TX_CTL_POLL_RESPONSE flag set
  210. + * released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set
  211. * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case
  212. * frames from multiple TIDs are released and the driver might reorder
  213. * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
  214. --- a/net/mac80211/agg-rx.c
  215. +++ b/net/mac80211/agg-rx.c
  216. @@ -187,6 +187,8 @@ static void ieee80211_send_addba_resp(st
  217. memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
  218. else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
  219. memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
  220. + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
  221. + memcpy(mgmt->bssid, da, ETH_ALEN);
  222. mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
  223. IEEE80211_STYPE_ACTION);
  224. --- a/net/mac80211/agg-tx.c
  225. +++ b/net/mac80211/agg-tx.c
  226. @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
  227. memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
  228. if (sdata->vif.type == NL80211_IFTYPE_AP ||
  229. sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
  230. - sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
  231. + sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
  232. + sdata->vif.type == NL80211_IFTYPE_WDS)
  233. memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
  234. else if (sdata->vif.type == NL80211_IFTYPE_STATION)
  235. memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
  236. @@ -471,6 +472,7 @@ int ieee80211_start_tx_ba_session(struct
  237. sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
  238. sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
  239. sdata->vif.type != NL80211_IFTYPE_AP &&
  240. + sdata->vif.type != NL80211_IFTYPE_WDS &&
  241. sdata->vif.type != NL80211_IFTYPE_ADHOC)
  242. return -EINVAL;
  243. --- a/net/mac80211/debugfs_sta.c
  244. +++ b/net/mac80211/debugfs_sta.c
  245. @@ -63,11 +63,11 @@ static ssize_t sta_flags_read(struct fil
  246. test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
  247. int res = scnprintf(buf, sizeof(buf),
  248. - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
  249. + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
  250. TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
  251. TEST(PS_DRIVER), TEST(AUTHORIZED),
  252. TEST(SHORT_PREAMBLE),
  253. - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
  254. + TEST(WME), TEST(CLEAR_PS_FILT),
  255. TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
  256. TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
  257. TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
  258. --- a/net/mac80211/iface.c
  259. +++ b/net/mac80211/iface.c
  260. @@ -178,7 +178,6 @@ static int ieee80211_do_open(struct net_
  261. {
  262. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  263. struct ieee80211_local *local = sdata->local;
  264. - struct sta_info *sta;
  265. u32 changed = 0;
  266. int res;
  267. u32 hw_reconf_flags = 0;
  268. @@ -309,28 +308,6 @@ static int ieee80211_do_open(struct net_
  269. set_bit(SDATA_STATE_RUNNING, &sdata->state);
  270. - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
  271. - /* Create STA entry for the WDS peer */
  272. - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
  273. - GFP_KERNEL);
  274. - if (!sta) {
  275. - res = -ENOMEM;
  276. - goto err_del_interface;
  277. - }
  278. -
  279. - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
  280. - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
  281. - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
  282. -
  283. - res = sta_info_insert(sta);
  284. - if (res) {
  285. - /* STA has been freed */
  286. - goto err_del_interface;
  287. - }
  288. -
  289. - rate_control_rate_init(sta);
  290. - }
  291. -
  292. /*
  293. * set_multicast_list will be invoked by the networking core
  294. * which will check whether any increments here were done in
  295. @@ -357,8 +334,7 @@ static int ieee80211_do_open(struct net_
  296. netif_tx_start_all_queues(dev);
  297. return 0;
  298. - err_del_interface:
  299. - drv_remove_interface(local, sdata);
  300. +
  301. err_stop:
  302. if (!local->open_count)
  303. drv_stop(local);
  304. @@ -722,6 +698,70 @@ static void ieee80211_if_setup(struct ne
  305. dev->destructor = free_netdev;
  306. }
  307. +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
  308. + struct sk_buff *skb)
  309. +{
  310. + struct ieee80211_local *local = sdata->local;
  311. + struct ieee80211_rx_status *rx_status;
  312. + struct ieee802_11_elems elems;
  313. + struct ieee80211_mgmt *mgmt;
  314. + struct sta_info *sta;
  315. + size_t baselen;
  316. + u32 rates = 0;
  317. + u16 stype;
  318. + bool new = false;
  319. + enum ieee80211_band band = local->hw.conf.channel->band;
  320. + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
  321. +
  322. + rx_status = IEEE80211_SKB_RXCB(skb);
  323. + mgmt = (struct ieee80211_mgmt *) skb->data;
  324. + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
  325. +
  326. + if (stype != IEEE80211_STYPE_BEACON)
  327. + return;
  328. +
  329. + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
  330. + if (baselen > skb->len)
  331. + return;
  332. +
  333. + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
  334. + skb->len - baselen, &elems);
  335. +
  336. + rates = ieee80211_sta_get_rates(local, &elems, band);
  337. +
  338. + rcu_read_lock();
  339. +
  340. + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
  341. +
  342. + if (!sta) {
  343. + rcu_read_unlock();
  344. + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
  345. + GFP_KERNEL);
  346. + if (!sta)
  347. + return;
  348. +
  349. + new = true;
  350. + }
  351. +
  352. + sta->last_rx = jiffies;
  353. + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
  354. +
  355. + if (elems.ht_cap_elem)
  356. + ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
  357. + elems.ht_cap_elem, &sta->sta.ht_cap);
  358. +
  359. + if (elems.wmm_param)
  360. + set_sta_flag(sta, WLAN_STA_WME);
  361. +
  362. + if (new) {
  363. + set_sta_flag(sta, WLAN_STA_AUTHORIZED);
  364. + rate_control_rate_init(sta);
  365. + sta_info_insert_rcu(sta);
  366. + }
  367. +
  368. + rcu_read_unlock();
  369. +}
  370. +
  371. static void ieee80211_iface_work(struct work_struct *work)
  372. {
  373. struct ieee80211_sub_if_data *sdata =
  374. @@ -826,6 +866,9 @@ static void ieee80211_iface_work(struct
  375. break;
  376. ieee80211_mesh_rx_queued_mgmt(sdata, skb);
  377. break;
  378. + case NL80211_IFTYPE_WDS:
  379. + ieee80211_wds_rx_queued_mgmt(sdata, skb);
  380. + break;
  381. default:
  382. WARN(1, "frame for unexpected interface type");
  383. break;
  384. --- a/net/mac80211/rx.c
  385. +++ b/net/mac80211/rx.c
  386. @@ -177,7 +177,8 @@ ieee80211_add_rx_radiotap_header(struct
  387. pos += 2;
  388. /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
  389. - if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
  390. + if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM &&
  391. + !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
  392. *pos = status->signal;
  393. rthdr->it_present |=
  394. cpu_to_le32(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL);
  395. @@ -489,12 +490,12 @@ ieee80211_rx_mesh_check(struct ieee80211
  396. if (ieee80211_has_tods(hdr->frame_control) ||
  397. !ieee80211_has_fromds(hdr->frame_control))
  398. return RX_DROP_MONITOR;
  399. - if (memcmp(hdr->addr3, dev_addr, ETH_ALEN) == 0)
  400. + if (compare_ether_addr(hdr->addr3, dev_addr) == 0)
  401. return RX_DROP_MONITOR;
  402. } else {
  403. if (!ieee80211_has_a4(hdr->frame_control))
  404. return RX_DROP_MONITOR;
  405. - if (memcmp(hdr->addr4, dev_addr, ETH_ALEN) == 0)
  406. + if (compare_ether_addr(hdr->addr4, dev_addr) == 0)
  407. return RX_DROP_MONITOR;
  408. }
  409. }
  410. @@ -1309,8 +1310,10 @@ ieee80211_rx_h_sta_process(struct ieee80
  411. sta->rx_fragments++;
  412. sta->rx_bytes += rx->skb->len;
  413. - sta->last_signal = status->signal;
  414. - ewma_add(&sta->avg_signal, -status->signal);
  415. + if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
  416. + sta->last_signal = status->signal;
  417. + ewma_add(&sta->avg_signal, -status->signal);
  418. + }
  419. /*
  420. * Change STA power saving mode only at the end of a frame
  421. @@ -2282,6 +2285,7 @@ ieee80211_rx_h_action(struct ieee80211_r
  422. sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
  423. sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
  424. sdata->vif.type != NL80211_IFTYPE_AP &&
  425. + sdata->vif.type != NL80211_IFTYPE_WDS &&
  426. sdata->vif.type != NL80211_IFTYPE_ADHOC)
  427. break;
  428. @@ -2336,7 +2340,7 @@ ieee80211_rx_h_action(struct ieee80211_r
  429. if (sdata->vif.type != NL80211_IFTYPE_STATION)
  430. break;
  431. - if (memcmp(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN))
  432. + if (compare_ether_addr(mgmt->bssid, sdata->u.mgd.bssid))
  433. break;
  434. goto queue;
  435. @@ -2492,14 +2496,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
  436. if (!ieee80211_vif_is_mesh(&sdata->vif) &&
  437. sdata->vif.type != NL80211_IFTYPE_ADHOC &&
  438. - sdata->vif.type != NL80211_IFTYPE_STATION)
  439. + sdata->vif.type != NL80211_IFTYPE_STATION &&
  440. + sdata->vif.type != NL80211_IFTYPE_WDS)
  441. return RX_DROP_MONITOR;
  442. switch (stype) {
  443. case cpu_to_le16(IEEE80211_STYPE_AUTH):
  444. case cpu_to_le16(IEEE80211_STYPE_BEACON):
  445. case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
  446. - /* process for all: mesh, mlme, ibss */
  447. + /* process for all: mesh, mlme, ibss, wds */
  448. break;
  449. case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
  450. case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
  451. @@ -2853,10 +2858,16 @@ static int prepare_for_handlers(struct i
  452. }
  453. break;
  454. case NL80211_IFTYPE_WDS:
  455. - if (bssid || !ieee80211_is_data(hdr->frame_control))
  456. - return 0;
  457. if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
  458. return 0;
  459. +
  460. + if (ieee80211_is_data(hdr->frame_control) ||
  461. + ieee80211_is_action(hdr->frame_control)) {
  462. + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
  463. + return 0;
  464. + } else if (!ieee80211_is_beacon(hdr->frame_control))
  465. + return 0;
  466. +
  467. break;
  468. default:
  469. /* should never get here */
  470. --- a/net/mac80211/sta_info.c
  471. +++ b/net/mac80211/sta_info.c
  472. @@ -9,6 +9,7 @@
  473. #include <linux/module.h>
  474. #include <linux/init.h>
  475. +#include <linux/etherdevice.h>
  476. #include <linux/netdevice.h>
  477. #include <linux/types.h>
  478. #include <linux/slab.h>
  479. @@ -101,7 +102,7 @@ struct sta_info *sta_info_get(struct iee
  480. lockdep_is_held(&local->sta_mtx));
  481. while (sta) {
  482. if (sta->sdata == sdata &&
  483. - memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
  484. + compare_ether_addr(sta->sta.addr, addr) == 0)
  485. break;
  486. sta = rcu_dereference_check(sta->hnext,
  487. lockdep_is_held(&local->sta_mtx));
  488. @@ -124,7 +125,7 @@ struct sta_info *sta_info_get_bss(struct
  489. while (sta) {
  490. if ((sta->sdata == sdata ||
  491. (sta->sdata->bss && sta->sdata->bss == sdata->bss)) &&
  492. - memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
  493. + compare_ether_addr(sta->sta.addr, addr) == 0)
  494. break;
  495. sta = rcu_dereference_check(sta->hnext,
  496. lockdep_is_held(&local->sta_mtx));
  497. @@ -1050,7 +1051,7 @@ static void ieee80211_send_null_response
  498. * exchange. Also set EOSP to indicate this packet
  499. * ends the poll/service period.
  500. */
  501. - info->flags |= IEEE80211_TX_CTL_POLL_RESPONSE |
  502. + info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER |
  503. IEEE80211_TX_STATUS_EOSP |
  504. IEEE80211_TX_CTL_REQ_TX_STATUS;
  505. @@ -1177,7 +1178,7 @@ ieee80211_sta_ps_deliver_response(struct
  506. * STA may still remain is PS mode after this frame
  507. * exchange.
  508. */
  509. - info->flags |= IEEE80211_TX_CTL_POLL_RESPONSE;
  510. + info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
  511. /*
  512. * Use MoreData flag to indicate whether there are
  513. --- a/net/mac80211/sta_info.h
  514. +++ b/net/mac80211/sta_info.h
  515. @@ -14,6 +14,7 @@
  516. #include <linux/if_ether.h>
  517. #include <linux/workqueue.h>
  518. #include <linux/average.h>
  519. +#include <linux/etherdevice.h>
  520. #include "key.h"
  521. /**
  522. @@ -31,7 +32,6 @@
  523. * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
  524. * frames.
  525. * @WLAN_STA_WME: Station is a QoS-STA.
  526. - * @WLAN_STA_WDS: Station is one of our WDS peers.
  527. * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
  528. * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
  529. * frame to this station is transmitted.
  530. @@ -62,7 +62,6 @@ enum ieee80211_sta_info_flags {
  531. WLAN_STA_AUTHORIZED,
  532. WLAN_STA_SHORT_PREAMBLE,
  533. WLAN_STA_WME,
  534. - WLAN_STA_WDS,
  535. WLAN_STA_CLEAR_PS_FILT,
  536. WLAN_STA_MFP,
  537. WLAN_STA_BLOCK_BA,
  538. @@ -489,7 +488,7 @@ void for_each_sta_info_type_check(struct
  539. nxt = _sta ? rcu_dereference(_sta->hnext) : NULL \
  540. ) \
  541. /* compare address and run code only if it matches */ \
  542. - if (memcmp(_sta->sta.addr, (_addr), ETH_ALEN) == 0)
  543. + if (compare_ether_addr(_sta->sta.addr, (_addr)) == 0)
  544. /*
  545. * Get STA info by index, BROKEN!
  546. --- a/net/mac80211/tx.c
  547. +++ b/net/mac80211/tx.c
  548. @@ -448,18 +448,23 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
  549. struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
  550. struct ieee80211_local *local = tx->local;
  551. - if (unlikely(!sta ||
  552. - ieee80211_is_probe_resp(hdr->frame_control) ||
  553. - ieee80211_is_auth(hdr->frame_control) ||
  554. - ieee80211_is_assoc_resp(hdr->frame_control) ||
  555. - ieee80211_is_reassoc_resp(hdr->frame_control)))
  556. + if (unlikely(!sta))
  557. return TX_CONTINUE;
  558. if (unlikely((test_sta_flag(sta, WLAN_STA_PS_STA) ||
  559. test_sta_flag(sta, WLAN_STA_PS_DRIVER)) &&
  560. - !(info->flags & IEEE80211_TX_CTL_POLL_RESPONSE))) {
  561. + !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {
  562. int ac = skb_get_queue_mapping(tx->skb);
  563. + /* only deauth, disassoc and action are bufferable MMPDUs */
  564. + if (ieee80211_is_mgmt(hdr->frame_control) &&
  565. + !ieee80211_is_deauth(hdr->frame_control) &&
  566. + !ieee80211_is_disassoc(hdr->frame_control) &&
  567. + !ieee80211_is_action(hdr->frame_control)) {
  568. + info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
  569. + return TX_CONTINUE;
  570. + }
  571. +
  572. #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
  573. printk(KERN_DEBUG "STA %pM aid %d: PS buffer for AC %d\n",
  574. sta->sta.addr, sta->sta.aid, ac);
  575. @@ -1060,6 +1065,7 @@ static bool ieee80211_tx_prep_agg(struct
  576. {
  577. bool queued = false;
  578. bool reset_agg_timer = false;
  579. + struct sk_buff *purge_skb = NULL;
  580. if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
  581. info->flags |= IEEE80211_TX_CTL_AMPDU;
  582. @@ -1101,8 +1107,13 @@ static bool ieee80211_tx_prep_agg(struct
  583. info->control.vif = &tx->sdata->vif;
  584. info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
  585. __skb_queue_tail(&tid_tx->pending, skb);
  586. + if (skb_queue_len(&tid_tx->pending) > STA_MAX_TX_BUFFER)
  587. + purge_skb = __skb_dequeue(&tid_tx->pending);
  588. }
  589. spin_unlock(&tx->sta->lock);
  590. +
  591. + if (purge_skb)
  592. + dev_kfree_skb(purge_skb);
  593. }
  594. /* reset session timer */
  595. --- a/net/mac80211/ieee80211_i.h
  596. +++ b/net/mac80211/ieee80211_i.h
  597. @@ -480,7 +480,7 @@ struct ieee80211_if_ibss {
  598. bool control_port;
  599. - u8 bssid[ETH_ALEN];
  600. + u8 bssid[ETH_ALEN] __aligned(2);
  601. u8 ssid[IEEE80211_MAX_SSID_LEN];
  602. u8 ssid_len, ie_len;
  603. u8 *ie;
  604. --- a/net/mac80211/ibss.c
  605. +++ b/net/mac80211/ibss.c
  606. @@ -66,7 +66,7 @@ static void __ieee80211_sta_join_ibss(st
  607. skb_reset_tail_pointer(skb);
  608. skb_reserve(skb, sdata->local->hw.extra_tx_headroom);
  609. - if (memcmp(ifibss->bssid, bssid, ETH_ALEN))
  610. + if (compare_ether_addr(ifibss->bssid, bssid))
  611. sta_info_flush(sdata->local, sdata);
  612. /* if merging, indicate to driver that we leave the old IBSS */
  613. @@ -403,7 +403,7 @@ static void ieee80211_rx_bss_info(struct
  614. return;
  615. if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
  616. - memcmp(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0) {
  617. + compare_ether_addr(mgmt->bssid, sdata->u.ibss.bssid) == 0) {
  618. rcu_read_lock();
  619. sta = sta_info_get(sdata, mgmt->sa);
  620. @@ -508,7 +508,7 @@ static void ieee80211_rx_bss_info(struct
  621. goto put_bss;
  622. /* same BSSID */
  623. - if (memcmp(cbss->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0)
  624. + if (compare_ether_addr(cbss->bssid, sdata->u.ibss.bssid) == 0)
  625. goto put_bss;
  626. if (rx_status->flag & RX_FLAG_MACTIME_MPDU) {
  627. @@ -831,8 +831,8 @@ static void ieee80211_rx_mgmt_probe_req(
  628. if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
  629. return;
  630. - if (memcmp(mgmt->bssid, ifibss->bssid, ETH_ALEN) != 0 &&
  631. - memcmp(mgmt->bssid, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) != 0)
  632. + if (compare_ether_addr(mgmt->bssid, ifibss->bssid) != 0 &&
  633. + !is_broadcast_ether_addr(mgmt->bssid))
  634. return;
  635. end = ((u8 *) mgmt) + len;
  636. --- a/net/mac80211/mesh.c
  637. +++ b/net/mac80211/mesh.c
  638. @@ -204,7 +204,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80
  639. kmem_cache_free(rm_cache, p);
  640. --entries;
  641. } else if ((seqnum == p->seqnum) &&
  642. - (memcmp(sa, p->sa, ETH_ALEN) == 0))
  643. + (compare_ether_addr(sa, p->sa) == 0))
  644. return -1;
  645. }
  646. --- a/net/mac80211/mesh_hwmp.c
  647. +++ b/net/mac80211/mesh_hwmp.c
  648. @@ -8,6 +8,7 @@
  649. */
  650. #include <linux/slab.h>
  651. +#include <linux/etherdevice.h>
  652. #include <asm/unaligned.h>
  653. #include "wme.h"
  654. #include "mesh.h"
  655. @@ -419,7 +420,7 @@ static u32 hwmp_route_info_get(struct ie
  656. new_metric = MAX_METRIC;
  657. exp_time = TU_TO_EXP_TIME(orig_lifetime);
  658. - if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0) {
  659. + if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0) {
  660. /* This MP is the originator, we are not interested in this
  661. * frame, except for updating transmitter's path info.
  662. */
  663. @@ -469,7 +470,7 @@ static u32 hwmp_route_info_get(struct ie
  664. /* Update and check transmitter routing info */
  665. ta = mgmt->sa;
  666. - if (memcmp(orig_addr, ta, ETH_ALEN) == 0)
  667. + if (compare_ether_addr(orig_addr, ta) == 0)
  668. fresh_info = false;
  669. else {
  670. fresh_info = true;
  671. @@ -529,7 +530,7 @@ static void hwmp_preq_frame_process(stru
  672. mhwmp_dbg("received PREQ from %pM", orig_addr);
  673. - if (memcmp(target_addr, sdata->vif.addr, ETH_ALEN) == 0) {
  674. + if (compare_ether_addr(target_addr, sdata->vif.addr) == 0) {
  675. mhwmp_dbg("PREQ is for us");
  676. forward = false;
  677. reply = true;
  678. @@ -624,7 +625,7 @@ static void hwmp_prep_frame_process(stru
  679. mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem));
  680. orig_addr = PREP_IE_ORIG_ADDR(prep_elem);
  681. - if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0)
  682. + if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0)
  683. /* destination, no forwarding required */
  684. return;
  685. @@ -694,10 +695,12 @@ static void hwmp_perr_frame_process(stru
  686. rcu_read_lock();
  687. mpath = mesh_path_lookup(target_addr, sdata);
  688. if (mpath) {
  689. + struct sta_info *sta;
  690. +
  691. spin_lock_bh(&mpath->state_lock);
  692. + sta = next_hop_deref_protected(mpath);
  693. if (mpath->flags & MESH_PATH_ACTIVE &&
  694. - memcmp(ta, next_hop_deref_protected(mpath)->sta.addr,
  695. - ETH_ALEN) == 0 &&
  696. + compare_ether_addr(ta, sta->sta.addr) == 0 &&
  697. (!(mpath->flags & MESH_PATH_SN_VALID) ||
  698. SN_GT(target_sn, mpath->sn))) {
  699. mpath->flags &= ~MESH_PATH_ACTIVE;
  700. @@ -739,7 +742,7 @@ static void hwmp_rann_frame_process(stru
  701. metric = rann->rann_metric;
  702. /* Ignore our own RANNs */
  703. - if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0)
  704. + if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0)
  705. return;
  706. mhwmp_dbg("received RANN from %pM (is_gate=%d)", orig_addr,
  707. @@ -1064,7 +1067,7 @@ int mesh_nexthop_lookup(struct sk_buff *
  708. if (time_after(jiffies,
  709. mpath->exp_time -
  710. msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) &&
  711. - !memcmp(sdata->vif.addr, hdr->addr4, ETH_ALEN) &&
  712. + !compare_ether_addr(sdata->vif.addr, hdr->addr4) &&
  713. !(mpath->flags & MESH_PATH_RESOLVING) &&
  714. !(mpath->flags & MESH_PATH_FIXED))
  715. mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
  716. --- a/net/mac80211/mesh_pathtbl.c
  717. +++ b/net/mac80211/mesh_pathtbl.c
  718. @@ -350,7 +350,7 @@ static struct mesh_path *mpath_lookup(st
  719. hlist_for_each_entry_rcu(node, n, bucket, list) {
  720. mpath = node->mpath;
  721. if (mpath->sdata == sdata &&
  722. - memcmp(dst, mpath->dst, ETH_ALEN) == 0) {
  723. + compare_ether_addr(dst, mpath->dst) == 0) {
  724. if (MPATH_EXPIRED(mpath)) {
  725. spin_lock_bh(&mpath->state_lock);
  726. mpath->flags &= ~MESH_PATH_ACTIVE;
  727. @@ -525,7 +525,7 @@ int mesh_path_add(u8 *dst, struct ieee80
  728. int err = 0;
  729. u32 hash_idx;
  730. - if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0)
  731. + if (compare_ether_addr(dst, sdata->vif.addr) == 0)
  732. /* never add ourselves as neighbours */
  733. return -ENOTSUPP;
  734. @@ -566,7 +566,8 @@ int mesh_path_add(u8 *dst, struct ieee80
  735. err = -EEXIST;
  736. hlist_for_each_entry(node, n, bucket, list) {
  737. mpath = node->mpath;
  738. - if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0)
  739. + if (mpath->sdata == sdata &&
  740. + compare_ether_addr(dst, mpath->dst) == 0)
  741. goto err_exists;
  742. }
  743. @@ -657,7 +658,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struc
  744. int err = 0;
  745. u32 hash_idx;
  746. - if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0)
  747. + if (compare_ether_addr(dst, sdata->vif.addr) == 0)
  748. /* never add ourselves as neighbours */
  749. return -ENOTSUPP;
  750. @@ -694,7 +695,8 @@ int mpp_path_add(u8 *dst, u8 *mpp, struc
  751. err = -EEXIST;
  752. hlist_for_each_entry(node, n, bucket, list) {
  753. mpath = node->mpath;
  754. - if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0)
  755. + if (mpath->sdata == sdata &&
  756. + compare_ether_addr(dst, mpath->dst) == 0)
  757. goto err_exists;
  758. }
  759. @@ -887,7 +889,7 @@ int mesh_path_del(u8 *addr, struct ieee8
  760. hlist_for_each_entry(node, n, bucket, list) {
  761. mpath = node->mpath;
  762. if (mpath->sdata == sdata &&
  763. - memcmp(addr, mpath->dst, ETH_ALEN) == 0) {
  764. + compare_ether_addr(addr, mpath->dst) == 0) {
  765. __mesh_path_del(tbl, node);
  766. goto enddel;
  767. }
  768. --- a/net/mac80211/mlme.c
  769. +++ b/net/mac80211/mlme.c
  770. @@ -1812,7 +1812,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_
  771. memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN);
  772. - if (memcmp(bssid, mgmt->bssid, ETH_ALEN))
  773. + if (compare_ether_addr(bssid, mgmt->bssid))
  774. return RX_MGMT_NONE;
  775. auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
  776. @@ -1893,7 +1893,7 @@ ieee80211_rx_mgmt_deauth(struct ieee8021
  777. return RX_MGMT_NONE;
  778. if (!ifmgd->associated ||
  779. - memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN))
  780. + compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
  781. return RX_MGMT_NONE;
  782. bssid = ifmgd->associated->bssid;
  783. @@ -1925,7 +1925,7 @@ ieee80211_rx_mgmt_disassoc(struct ieee80
  784. return RX_MGMT_NONE;
  785. if (!ifmgd->associated ||
  786. - memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN))
  787. + compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
  788. return RX_MGMT_NONE;
  789. reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
  790. @@ -2190,7 +2190,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee
  791. if (!assoc_data)
  792. return RX_MGMT_NONE;
  793. - if (memcmp(assoc_data->bss->bssid, mgmt->bssid, ETH_ALEN))
  794. + if (compare_ether_addr(assoc_data->bss->bssid, mgmt->bssid))
  795. return RX_MGMT_NONE;
  796. /*
  797. @@ -2278,8 +2278,8 @@ static void ieee80211_rx_bss_info(struct
  798. bool need_ps = false;
  799. if (sdata->u.mgd.associated &&
  800. - memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid,
  801. - ETH_ALEN) == 0) {
  802. + compare_ether_addr(mgmt->bssid, sdata->u.mgd.associated->bssid)
  803. + == 0) {
  804. bss = (void *)sdata->u.mgd.associated->priv;
  805. /* not previously set so we may need to recalc */
  806. need_ps = !bss->dtim_period;
  807. @@ -2334,7 +2334,7 @@ static void ieee80211_rx_mgmt_probe_resp
  808. ASSERT_MGD_MTX(ifmgd);
  809. - if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN))
  810. + if (compare_ether_addr(mgmt->da, sdata->vif.addr))
  811. return; /* ignore ProbeResp to foreign address */
  812. baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
  813. @@ -2347,11 +2347,12 @@ static void ieee80211_rx_mgmt_probe_resp
  814. ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false);
  815. if (ifmgd->associated &&
  816. - memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN) == 0)
  817. + compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid) == 0)
  818. ieee80211_reset_ap_probe(sdata);
  819. if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies &&
  820. - memcmp(mgmt->bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN) == 0) {
  821. + compare_ether_addr(mgmt->bssid, ifmgd->auth_data->bss->bssid)
  822. + == 0) {
  823. /* got probe response, continue with auth */
  824. printk(KERN_DEBUG "%s: direct probe responded\n", sdata->name);
  825. ifmgd->auth_data->tries = 0;
  826. @@ -2408,7 +2409,8 @@ static void ieee80211_rx_mgmt_beacon(str
  827. return;
  828. if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon &&
  829. - memcmp(mgmt->bssid, ifmgd->assoc_data->bss->bssid, ETH_ALEN) == 0) {
  830. + compare_ether_addr(mgmt->bssid, ifmgd->assoc_data->bss->bssid)
  831. + == 0) {
  832. ieee802_11_parse_elems(mgmt->u.beacon.variable,
  833. len - baselen, &elems);
  834. @@ -2423,7 +2425,7 @@ static void ieee80211_rx_mgmt_beacon(str
  835. }
  836. if (!ifmgd->associated ||
  837. - memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN))
  838. + compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
  839. return;
  840. bssid = ifmgd->associated->bssid;
  841. @@ -3285,7 +3287,7 @@ int ieee80211_mgd_assoc(struct ieee80211
  842. bool match;
  843. /* keep sta info, bssid if matching */
  844. - match = memcmp(ifmgd->bssid, req->bss->bssid, ETH_ALEN) == 0;
  845. + match = compare_ether_addr(ifmgd->bssid, req->bss->bssid) == 0;
  846. ieee80211_destroy_auth_data(sdata, match);
  847. }
  848. @@ -3407,7 +3409,7 @@ int ieee80211_mgd_assoc(struct ieee80211
  849. goto err_clear;
  850. }
  851. } else
  852. - WARN_ON_ONCE(memcmp(ifmgd->bssid, req->bss->bssid, ETH_ALEN));
  853. + WARN_ON_ONCE(compare_ether_addr(ifmgd->bssid, req->bss->bssid));
  854. if (!bss->dtim_period &&
  855. sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
  856. @@ -3448,7 +3450,7 @@ int ieee80211_mgd_deauth(struct ieee8021
  857. mutex_lock(&ifmgd->mtx);
  858. if (ifmgd->associated &&
  859. - memcmp(ifmgd->associated->bssid, req->bssid, ETH_ALEN) == 0) {
  860. + compare_ether_addr(ifmgd->associated->bssid, req->bssid) == 0) {
  861. ieee80211_set_disassoc(sdata, false, true);
  862. assoc_bss = true;
  863. } else if (ifmgd->auth_data) {
  864. --- a/net/mac80211/status.c
  865. +++ b/net/mac80211/status.c
  866. @@ -10,6 +10,7 @@
  867. */
  868. #include <linux/export.h>
  869. +#include <linux/etherdevice.h>
  870. #include <net/mac80211.h>
  871. #include <asm/unaligned.h>
  872. #include "ieee80211_i.h"
  873. @@ -377,7 +378,7 @@ void ieee80211_tx_status(struct ieee8021
  874. for_each_sta_info(local, hdr->addr1, sta, tmp) {
  875. /* skip wrong virtual interface */
  876. - if (memcmp(hdr->addr2, sta->sdata->vif.addr, ETH_ALEN))
  877. + if (compare_ether_addr(hdr->addr2, sta->sdata->vif.addr))
  878. continue;
  879. if (info->flags & IEEE80211_TX_STATUS_EOSP)
  880. --- a/net/wireless/mlme.c
  881. +++ b/net/wireless/mlme.c
  882. @@ -6,6 +6,7 @@
  883. #include <linux/kernel.h>
  884. #include <linux/module.h>
  885. +#include <linux/etherdevice.h>
  886. #include <linux/netdevice.h>
  887. #include <linux/nl80211.h>
  888. #include <linux/slab.h>
  889. @@ -100,7 +101,7 @@ void __cfg80211_send_deauth(struct net_d
  890. ASSERT_WDEV_LOCK(wdev);
  891. if (wdev->current_bss &&
  892. - memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) {
  893. + compare_ether_addr(wdev->current_bss->pub.bssid, bssid) == 0) {
  894. cfg80211_unhold_bss(wdev->current_bss);
  895. cfg80211_put_bss(&wdev->current_bss->pub);
  896. wdev->current_bss = NULL;
  897. @@ -115,7 +116,7 @@ void __cfg80211_send_deauth(struct net_d
  898. reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
  899. - from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0;
  900. + from_ap = compare_ether_addr(mgmt->sa, dev->dev_addr) != 0;
  901. __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
  902. } else if (wdev->sme_state == CFG80211_SME_CONNECTING) {
  903. __cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, NULL, 0,
  904. @@ -154,7 +155,7 @@ void __cfg80211_send_disassoc(struct net
  905. return;
  906. if (wdev->current_bss &&
  907. - memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) {
  908. + compare_ether_addr(wdev->current_bss->pub.bssid, bssid) == 0) {
  909. cfg80211_sme_disassoc(dev, wdev->current_bss);
  910. cfg80211_unhold_bss(wdev->current_bss);
  911. cfg80211_put_bss(&wdev->current_bss->pub);
  912. @@ -165,7 +166,7 @@ void __cfg80211_send_disassoc(struct net
  913. reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
  914. - from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0;
  915. + from_ap = compare_ether_addr(mgmt->sa, dev->dev_addr) != 0;
  916. __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
  917. }
  918. EXPORT_SYMBOL(__cfg80211_send_disassoc);
  919. @@ -285,7 +286,7 @@ int __cfg80211_mlme_auth(struct cfg80211
  920. return -EINVAL;
  921. if (wdev->current_bss &&
  922. - memcmp(bssid, wdev->current_bss->pub.bssid, ETH_ALEN) == 0)
  923. + compare_ether_addr(bssid, wdev->current_bss->pub.bssid) == 0)
  924. return -EALREADY;
  925. memset(&req, 0, sizeof(req));
  926. @@ -362,7 +363,7 @@ int __cfg80211_mlme_assoc(struct cfg8021
  927. memset(&req, 0, sizeof(req));
  928. if (wdev->current_bss && prev_bssid &&
  929. - memcmp(wdev->current_bss->pub.bssid, prev_bssid, ETH_ALEN) == 0) {
  930. + compare_ether_addr(wdev->current_bss->pub.bssid, prev_bssid) == 0) {
  931. /*
  932. * Trying to reassociate: Allow this to proceed and let the old
  933. * association to be dropped when the new one is completed.
  934. @@ -446,7 +447,8 @@ int __cfg80211_mlme_deauth(struct cfg802
  935. if (local_state_change) {
  936. if (wdev->current_bss &&
  937. - memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) {
  938. + compare_ether_addr(wdev->current_bss->pub.bssid, bssid)
  939. + == 0) {
  940. cfg80211_unhold_bss(wdev->current_bss);
  941. cfg80211_put_bss(&wdev->current_bss->pub);
  942. wdev->current_bss = NULL;
  943. @@ -495,7 +497,7 @@ static int __cfg80211_mlme_disassoc(stru
  944. req.local_state_change = local_state_change;
  945. req.ie = ie;
  946. req.ie_len = ie_len;
  947. - if (memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0)
  948. + if (compare_ether_addr(wdev->current_bss->pub.bssid, bssid) == 0)
  949. req.bss = &wdev->current_bss->pub;
  950. else
  951. return -ENOTCONN;
  952. @@ -758,8 +760,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
  953. break;
  954. }
  955. - if (memcmp(wdev->current_bss->pub.bssid,
  956. - mgmt->bssid, ETH_ALEN)) {
  957. + if (compare_ether_addr(wdev->current_bss->pub.bssid,
  958. + mgmt->bssid)) {
  959. err = -ENOTCONN;
  960. break;
  961. }
  962. @@ -772,8 +774,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
  963. break;
  964. /* for station, check that DA is the AP */
  965. - if (memcmp(wdev->current_bss->pub.bssid,
  966. - mgmt->da, ETH_ALEN)) {
  967. + if (compare_ether_addr(wdev->current_bss->pub.bssid,
  968. + mgmt->da)) {
  969. err = -ENOTCONN;
  970. break;
  971. }
  972. @@ -781,11 +783,11 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
  973. case NL80211_IFTYPE_AP:
  974. case NL80211_IFTYPE_P2P_GO:
  975. case NL80211_IFTYPE_AP_VLAN:
  976. - if (memcmp(mgmt->bssid, dev->dev_addr, ETH_ALEN))
  977. + if (compare_ether_addr(mgmt->bssid, dev->dev_addr))
  978. err = -EINVAL;
  979. break;
  980. case NL80211_IFTYPE_MESH_POINT:
  981. - if (memcmp(mgmt->sa, mgmt->bssid, ETH_ALEN)) {
  982. + if (compare_ether_addr(mgmt->sa, mgmt->bssid)) {
  983. err = -EINVAL;
  984. break;
  985. }
  986. @@ -804,7 +806,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
  987. return err;
  988. }
  989. - if (memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0)
  990. + if (compare_ether_addr(mgmt->sa, dev->dev_addr) != 0)
  991. return -EINVAL;
  992. /* Transmit the Action frame as requested by user space */
  993. --- a/net/wireless/scan.c
  994. +++ b/net/wireless/scan.c
  995. @@ -378,7 +378,7 @@ static int cmp_bss_core(struct cfg80211_
  996. b->len_information_elements);
  997. }
  998. - return memcmp(a->bssid, b->bssid, ETH_ALEN);
  999. + return compare_ether_addr(a->bssid, b->bssid);
  1000. }
  1001. static int cmp_bss(struct cfg80211_bss *a,
  1002. --- a/drivers/net/wireless/ath/ath9k/Kconfig
  1003. +++ b/drivers/net/wireless/ath/ath9k/Kconfig
  1004. @@ -81,6 +81,14 @@ config ATH9K_DFS_CERTIFIED
  1005. developed. At this point enabling this option won't do anything
  1006. except increase code size.
  1007. +config ATH9K_MAC_DEBUG
  1008. + bool "Atheros MAC statistics"
  1009. + depends on ATH9K_DEBUGFS
  1010. + default y
  1011. + ---help---
  1012. + This option enables collection of statistics for Rx/Tx status
  1013. + data and some other MAC related statistics
  1014. +
  1015. config ATH9K_RATE_CONTROL
  1016. bool "Atheros ath9k rate control"
  1017. depends on ATH9K
  1018. --- a/drivers/net/wireless/ath/ath9k/debug.c
  1019. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  1020. @@ -818,6 +818,7 @@ void ath_debug_stat_tx(struct ath_softc
  1021. if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
  1022. TX_STAT_INC(qnum, delim_underrun);
  1023. +#ifdef CONFIG_ATH9K_MAC_DEBUG
  1024. spin_lock(&sc->debug.samp_lock);
  1025. TX_SAMP_DBG(jiffies) = jiffies;
  1026. TX_SAMP_DBG(rssi_ctl0) = ts->ts_rssi_ctl0;
  1027. @@ -844,6 +845,7 @@ void ath_debug_stat_tx(struct ath_softc
  1028. sc->debug.tsidx = (sc->debug.tsidx + 1) % ATH_DBG_MAX_SAMPLES;
  1029. spin_unlock(&sc->debug.samp_lock);
  1030. +#endif
  1031. #undef TX_SAMP_DBG
  1032. }
  1033. @@ -942,27 +944,6 @@ static ssize_t read_file_recv(struct fil
  1034. PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL);
  1035. len += snprintf(buf + len, size - len,
  1036. - "%22s : %10d\n", "RSSI-CTL0",
  1037. - sc->debug.stats.rxstats.rs_rssi_ctl0);
  1038. - len += snprintf(buf + len, size - len,
  1039. - "%22s : %10d\n", "RSSI-CTL1",
  1040. - sc->debug.stats.rxstats.rs_rssi_ctl1);
  1041. - len += snprintf(buf + len, size - len,
  1042. - "%22s : %10d\n", "RSSI-CTL2",
  1043. - sc->debug.stats.rxstats.rs_rssi_ctl2);
  1044. - len += snprintf(buf + len, size - len,
  1045. - "%22s : %10d\n", "RSSI-EXT0",
  1046. - sc->debug.stats.rxstats.rs_rssi_ext0);
  1047. - len += snprintf(buf + len, size - len,
  1048. - "%22s : %10d\n", "RSSI-EXT1",
  1049. - sc->debug.stats.rxstats.rs_rssi_ext1);
  1050. - len += snprintf(buf + len, size - len,
  1051. - "%22s : %10d\n", "RSSI-EXT2",
  1052. - sc->debug.stats.rxstats.rs_rssi_ext2);
  1053. - len += snprintf(buf + len, size - len,
  1054. - "%22s : %10d\n", "Rx Antenna",
  1055. - sc->debug.stats.rxstats.rs_antenna);
  1056. - len += snprintf(buf + len, size - len,
  1057. "%22s : %10u\n", "RX-Pkts-All",
  1058. sc->debug.stats.rxstats.rx_pkts_all);
  1059. len += snprintf(buf + len, size - len,
  1060. @@ -1009,16 +990,7 @@ void ath_debug_stat_rx(struct ath_softc
  1061. RX_PHY_ERR_INC(rs->rs_phyerr);
  1062. }
  1063. - sc->debug.stats.rxstats.rs_rssi_ctl0 = rs->rs_rssi_ctl0;
  1064. - sc->debug.stats.rxstats.rs_rssi_ctl1 = rs->rs_rssi_ctl1;
  1065. - sc->debug.stats.rxstats.rs_rssi_ctl2 = rs->rs_rssi_ctl2;
  1066. -
  1067. - sc->debug.stats.rxstats.rs_rssi_ext0 = rs->rs_rssi_ext0;
  1068. - sc->debug.stats.rxstats.rs_rssi_ext1 = rs->rs_rssi_ext1;
  1069. - sc->debug.stats.rxstats.rs_rssi_ext2 = rs->rs_rssi_ext2;
  1070. -
  1071. - sc->debug.stats.rxstats.rs_antenna = rs->rs_antenna;
  1072. -
  1073. +#ifdef CONFIG_ATH9K_MAC_DEBUG
  1074. spin_lock(&sc->debug.samp_lock);
  1075. RX_SAMP_DBG(jiffies) = jiffies;
  1076. RX_SAMP_DBG(rssi_ctl0) = rs->rs_rssi_ctl0;
  1077. @@ -1035,6 +1007,8 @@ void ath_debug_stat_rx(struct ath_softc
  1078. sc->debug.rsidx = (sc->debug.rsidx + 1) % ATH_DBG_MAX_SAMPLES;
  1079. spin_unlock(&sc->debug.samp_lock);
  1080. +#endif
  1081. +
  1082. #undef RX_STAT_INC
  1083. #undef RX_PHY_ERR_INC
  1084. #undef RX_SAMP_DBG
  1085. @@ -1278,6 +1252,8 @@ static const struct file_operations fops
  1086. .llseek = default_llseek,
  1087. };
  1088. +#ifdef CONFIG_ATH9K_MAC_DEBUG
  1089. +
  1090. void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
  1091. {
  1092. #define ATH_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].c)
  1093. @@ -1551,6 +1527,7 @@ static const struct file_operations fops
  1094. .llseek = default_llseek,
  1095. };
  1096. +#endif
  1097. int ath9k_init_debug(struct ath_hw *ah)
  1098. {
  1099. @@ -1604,8 +1581,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  1100. &fops_base_eeprom);
  1101. debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
  1102. &fops_modal_eeprom);
  1103. +#ifdef CONFIG_ATH9K_MAC_DEBUG
  1104. debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc,
  1105. &fops_samps);
  1106. +#endif
  1107. debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
  1108. sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
  1109. --- a/drivers/net/wireless/ath/ath9k/debug.h
  1110. +++ b/drivers/net/wireless/ath/ath9k/debug.h
  1111. @@ -165,13 +165,6 @@ struct ath_rx_stats {
  1112. u32 post_delim_crc_err;
  1113. u32 decrypt_busy_err;
  1114. u32 phy_err_stats[ATH9K_PHYERR_MAX];
  1115. - int8_t rs_rssi_ctl0;
  1116. - int8_t rs_rssi_ctl1;
  1117. - int8_t rs_rssi_ctl2;
  1118. - int8_t rs_rssi_ext0;
  1119. - int8_t rs_rssi_ext1;
  1120. - int8_t rs_rssi_ext2;
  1121. - u8 rs_antenna;
  1122. };
  1123. enum ath_reset_type {
  1124. @@ -235,16 +228,17 @@ struct ath9k_debug {
  1125. struct dentry *debugfs_phy;
  1126. u32 regidx;
  1127. struct ath_stats stats;
  1128. +#ifdef CONFIG_ATH9K_MAC_DEBUG
  1129. spinlock_t samp_lock;
  1130. struct ath_dbg_bb_mac_samp bb_mac_samp[ATH_DBG_MAX_SAMPLES];
  1131. u8 sampidx;
  1132. u8 tsidx;
  1133. u8 rsidx;
  1134. +#endif
  1135. };
  1136. int ath9k_init_debug(struct ath_hw *ah);
  1137. -void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
  1138. void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
  1139. void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
  1140. struct ath_tx_status *ts, struct ath_txq *txq,
  1141. @@ -258,10 +252,6 @@ static inline int ath9k_init_debug(struc
  1142. return 0;
  1143. }
  1144. -static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
  1145. -{
  1146. -}
  1147. -
  1148. static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
  1149. enum ath9k_int status)
  1150. {
  1151. @@ -282,4 +272,17 @@ static inline void ath_debug_stat_rx(str
  1152. #endif /* CONFIG_ATH9K_DEBUGFS */
  1153. +#ifdef CONFIG_ATH9K_MAC_DEBUG
  1154. +
  1155. +void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
  1156. +
  1157. +#else
  1158. +
  1159. +static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
  1160. +{
  1161. +}
  1162. +
  1163. +#endif
  1164. +
  1165. +
  1166. #endif /* DEBUG_H */
  1167. --- a/drivers/net/wireless/ath/ath9k/init.c
  1168. +++ b/drivers/net/wireless/ath/ath9k/init.c
  1169. @@ -555,9 +555,11 @@ static int ath9k_init_softc(u16 devid, s
  1170. mutex_init(&sc->mutex);
  1171. #ifdef CONFIG_ATH9K_DEBUGFS
  1172. spin_lock_init(&sc->nodes_lock);
  1173. - spin_lock_init(&sc->debug.samp_lock);
  1174. INIT_LIST_HEAD(&sc->nodes);
  1175. #endif
  1176. +#ifdef CONFIG_ATH9K_MAC_DEBUG
  1177. + spin_lock_init(&sc->debug.samp_lock);
  1178. +#endif
  1179. tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
  1180. tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet,
  1181. (unsigned long)sc);
  1182. --- a/drivers/net/wireless/ath/ath9k/hw.c
  1183. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  1184. @@ -1386,10 +1386,16 @@ static bool ath9k_hw_set_reset_reg(struc
  1185. static bool ath9k_hw_chip_reset(struct ath_hw *ah,
  1186. struct ath9k_channel *chan)
  1187. {
  1188. - if (AR_SREV_9280(ah) && ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) {
  1189. - if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON))
  1190. - return false;
  1191. - } else if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_WARM))
  1192. + int reset_type = ATH9K_RESET_WARM;
  1193. +
  1194. + if (AR_SREV_9280(ah)) {
  1195. + if (ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL))
  1196. + reset_type = ATH9K_RESET_POWER_ON;
  1197. + else
  1198. + reset_type = ATH9K_RESET_COLD;
  1199. + }
  1200. +
  1201. + if (!ath9k_hw_set_reset_reg(ah, reset_type))
  1202. return false;
  1203. if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
  1204. --- a/drivers/net/wireless/ath/ath5k/base.c
  1205. +++ b/drivers/net/wireless/ath/ath5k/base.c
  1206. @@ -2330,15 +2330,6 @@ ath5k_calibrate_work(struct work_struct
  1207. "got new rfgain, resetting\n");
  1208. ieee80211_queue_work(ah->hw, &ah->reset_work);
  1209. }
  1210. -
  1211. - /* TODO: On full calibration we should stop TX here,
  1212. - * so that it doesn't interfere (mostly due to gain_f
  1213. - * calibration that messes with tx packets -see phy.c).
  1214. - *
  1215. - * NOTE: Stopping the queues from above is not enough
  1216. - * to stop TX but saves us from disconecting (at least
  1217. - * we don't lose packets). */
  1218. - ieee80211_stop_queues(ah->hw);
  1219. } else
  1220. ah->ah_cal_mask |= AR5K_CALIBRATION_SHORT;
  1221. @@ -2353,10 +2344,9 @@ ath5k_calibrate_work(struct work_struct
  1222. ah->curchan->center_freq));
  1223. /* Clear calibration flags */
  1224. - if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL) {
  1225. - ieee80211_wake_queues(ah->hw);
  1226. + if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL)
  1227. ah->ah_cal_mask &= ~AR5K_CALIBRATION_FULL;
  1228. - } else if (ah->ah_cal_mask & AR5K_CALIBRATION_SHORT)
  1229. + else if (ah->ah_cal_mask & AR5K_CALIBRATION_SHORT)
  1230. ah->ah_cal_mask &= ~AR5K_CALIBRATION_SHORT;
  1231. }
  1232. --- a/drivers/net/wireless/ath/ath5k/phy.c
  1233. +++ b/drivers/net/wireless/ath/ath5k/phy.c
  1234. @@ -1871,31 +1871,15 @@ ath5k_hw_phy_calibrate(struct ath5k_hw *
  1235. ret = 0;
  1236. }
  1237. - /* On full calibration do an AGC calibration and
  1238. - * request a PAPD probe for gainf calibration if
  1239. - * needed */
  1240. - if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL) {
  1241. + /* On full calibration request a PAPD probe for
  1242. + * gainf calibration if needed */
  1243. + if ((ah->ah_cal_mask & AR5K_CALIBRATION_FULL) &&
  1244. + (ah->ah_radio == AR5K_RF5111 ||
  1245. + ah->ah_radio == AR5K_RF5112) &&
  1246. + channel->hw_value != AR5K_MODE_11B)
  1247. + ath5k_hw_request_rfgain_probe(ah);
  1248. - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL,
  1249. - AR5K_PHY_AGCCTL_CAL);
  1250. -
  1251. - ret = ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL,
  1252. - AR5K_PHY_AGCCTL_CAL | AR5K_PHY_AGCCTL_NF,
  1253. - 0, false);
  1254. - if (ret) {
  1255. - ATH5K_ERR(ah,
  1256. - "gain calibration timeout (%uMHz)\n",
  1257. - channel->center_freq);
  1258. - }
  1259. -
  1260. - if ((ah->ah_radio == AR5K_RF5111 ||
  1261. - ah->ah_radio == AR5K_RF5112)
  1262. - && (channel->hw_value != AR5K_MODE_11B))
  1263. - ath5k_hw_request_rfgain_probe(ah);
  1264. - }
  1265. -
  1266. - /* Update noise floor
  1267. - * XXX: Only do this after AGC calibration */
  1268. + /* Update noise floor */
  1269. if (!(ah->ah_cal_mask & AR5K_CALIBRATION_NF))
  1270. ath5k_hw_update_noise_floor(ah);
  1271. --- a/drivers/net/wireless/ath/ath9k/recv.c
  1272. +++ b/drivers/net/wireless/ath/ath9k/recv.c
  1273. @@ -232,7 +232,6 @@ static void ath_rx_edma_cleanup(struct a
  1274. static void ath_rx_edma_init_queue(struct ath_rx_edma *rx_edma, int size)
  1275. {
  1276. skb_queue_head_init(&rx_edma->rx_fifo);
  1277. - skb_queue_head_init(&rx_edma->rx_buffers);
  1278. rx_edma->rx_fifo_hwsize = size;
  1279. }
  1280. @@ -658,7 +657,9 @@ static void ath_rx_ps(struct ath_softc *
  1281. }
  1282. static bool ath_edma_get_buffers(struct ath_softc *sc,
  1283. - enum ath9k_rx_qtype qtype)
  1284. + enum ath9k_rx_qtype qtype,
  1285. + struct ath_rx_status *rs,
  1286. + struct ath_buf **dest)
  1287. {
  1288. struct ath_rx_edma *rx_edma = &sc->rx.rx_edma[qtype];
  1289. struct ath_hw *ah = sc->sc_ah;
  1290. @@ -677,7 +678,7 @@ static bool ath_edma_get_buffers(struct
  1291. dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr,
  1292. common->rx_bufsize, DMA_FROM_DEVICE);
  1293. - ret = ath9k_hw_process_rxdesc_edma(ah, NULL, skb->data);
  1294. + ret = ath9k_hw_process_rxdesc_edma(ah, rs, skb->data);
  1295. if (ret == -EINPROGRESS) {
  1296. /*let device gain the buffer again*/
  1297. dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
  1298. @@ -690,20 +691,21 @@ static bool ath_edma_get_buffers(struct
  1299. /* corrupt descriptor, skip this one and the following one */
  1300. list_add_tail(&bf->list, &sc->rx.rxbuf);
  1301. ath_rx_edma_buf_link(sc, qtype);
  1302. - skb = skb_peek(&rx_edma->rx_fifo);
  1303. - if (!skb)
  1304. - return true;
  1305. - bf = SKB_CB_ATHBUF(skb);
  1306. - BUG_ON(!bf);
  1307. + skb = skb_peek(&rx_edma->rx_fifo);
  1308. + if (skb) {
  1309. + bf = SKB_CB_ATHBUF(skb);
  1310. + BUG_ON(!bf);
  1311. - __skb_unlink(skb, &rx_edma->rx_fifo);
  1312. - list_add_tail(&bf->list, &sc->rx.rxbuf);
  1313. - ath_rx_edma_buf_link(sc, qtype);
  1314. - return true;
  1315. + __skb_unlink(skb, &rx_edma->rx_fifo);
  1316. + list_add_tail(&bf->list, &sc->rx.rxbuf);
  1317. + ath_rx_edma_buf_link(sc, qtype);
  1318. + } else {
  1319. + bf = NULL;
  1320. + }
  1321. }
  1322. - skb_queue_tail(&rx_edma->rx_buffers, skb);
  1323. + *dest = bf;
  1324. return true;
  1325. }
  1326. @@ -711,18 +713,15 @@ static struct ath_buf *ath_edma_get_next
  1327. struct ath_rx_status *rs,
  1328. enum ath9k_rx_qtype qtype)
  1329. {
  1330. - struct ath_rx_edma *rx_edma = &sc->rx.rx_edma[qtype];
  1331. - struct sk_buff *skb;
  1332. - struct ath_buf *bf;
  1333. + struct ath_buf *bf = NULL;
  1334. - while (ath_edma_get_buffers(sc, qtype));
  1335. - skb = __skb_dequeue(&rx_edma->rx_buffers);
  1336. - if (!skb)
  1337. - return NULL;
  1338. + while (ath_edma_get_buffers(sc, qtype, rs, &bf)) {
  1339. + if (!bf)
  1340. + continue;
  1341. - bf = SKB_CB_ATHBUF(skb);
  1342. - ath9k_hw_process_rxdesc_edma(sc->sc_ah, rs, skb->data);
  1343. - return bf;
  1344. + return bf;
  1345. + }
  1346. + return NULL;
  1347. }
  1348. static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc,
  1349. @@ -954,6 +953,7 @@ static void ath9k_process_rssi(struct at
  1350. struct ath_softc *sc = hw->priv;
  1351. struct ath_hw *ah = common->ah;
  1352. int last_rssi;
  1353. + int rssi = rx_stats->rs_rssi;
  1354. if (!rx_stats->is_mybeacon ||
  1355. ((ah->opmode != NL80211_IFTYPE_STATION) &&
  1356. @@ -965,13 +965,12 @@ static void ath9k_process_rssi(struct at
  1357. last_rssi = sc->last_rssi;
  1358. if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
  1359. - rx_stats->rs_rssi = ATH_EP_RND(last_rssi,
  1360. - ATH_RSSI_EP_MULTIPLIER);
  1361. - if (rx_stats->rs_rssi < 0)
  1362. - rx_stats->rs_rssi = 0;
  1363. + rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER);
  1364. + if (rssi < 0)
  1365. + rssi = 0;
  1366. /* Update Beacon RSSI, this is used by ANI. */
  1367. - ah->stats.avgbrssi = rx_stats->rs_rssi;
  1368. + ah->stats.avgbrssi = rssi;
  1369. }
  1370. /*
  1371. @@ -988,8 +987,6 @@ static int ath9k_rx_skb_preprocess(struc
  1372. {
  1373. struct ath_hw *ah = common->ah;
  1374. - memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
  1375. -
  1376. /*
  1377. * everything but the rate is checked here, the rate check is done
  1378. * separately to avoid doing two lookups for a rate for each frame.
  1379. @@ -1011,6 +1008,8 @@ static int ath9k_rx_skb_preprocess(struc
  1380. rx_status->signal = ah->noise + rx_stats->rs_rssi;
  1381. rx_status->antenna = rx_stats->rs_antenna;
  1382. rx_status->flag |= RX_FLAG_MACTIME_MPDU;
  1383. + if (rx_stats->rs_moreaggr)
  1384. + rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
  1385. return 0;
  1386. }
  1387. @@ -1845,6 +1844,8 @@ int ath_rx_tasklet(struct ath_softc *sc,
  1388. if (sc->sc_flags & SC_OP_RXFLUSH)
  1389. goto requeue_drop_frag;
  1390. + memset(rxs, 0, sizeof(struct ieee80211_rx_status));
  1391. +
  1392. rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp;
  1393. if (rs.rs_tstamp > tsf_lower &&
  1394. unlikely(rs.rs_tstamp - tsf_lower > 0x10000000))
  1395. --- a/drivers/net/wireless/ath/ath9k/beacon.c
  1396. +++ b/drivers/net/wireless/ath/ath9k/beacon.c
  1397. @@ -91,7 +91,7 @@ static void ath_beacon_setup(struct ath_
  1398. info.txpower = MAX_RATE_POWER;
  1399. info.keyix = ATH9K_TXKEYIX_INVALID;
  1400. info.keytype = ATH9K_KEY_TYPE_CLEAR;
  1401. - info.flags = ATH9K_TXDESC_NOACK;
  1402. + info.flags = ATH9K_TXDESC_NOACK | ATH9K_TXDESC_INTREQ;
  1403. info.buf_addr[0] = bf->bf_buf_addr;
  1404. info.buf_len[0] = roundup(skb->len, 4);
  1405. @@ -355,7 +355,6 @@ void ath_beacon_tasklet(unsigned long da
  1406. struct ath_common *common = ath9k_hw_common(ah);
  1407. struct ath_buf *bf = NULL;
  1408. struct ieee80211_vif *vif;
  1409. - struct ath_tx_status ts;
  1410. bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
  1411. int slot;
  1412. u32 bfaddr, bc = 0;
  1413. @@ -462,11 +461,6 @@ void ath_beacon_tasklet(unsigned long da
  1414. ath9k_hw_txstart(ah, sc->beacon.beaconq);
  1415. sc->beacon.ast_be_xmit += bc; /* XXX per-vif? */
  1416. - if (edma) {
  1417. - spin_lock_bh(&sc->sc_pcu_lock);
  1418. - ath9k_hw_txprocdesc(ah, bf->bf_desc, (void *)&ts);
  1419. - spin_unlock_bh(&sc->sc_pcu_lock);
  1420. - }
  1421. }
  1422. }
  1423. --- a/drivers/net/wireless/ath/ath9k/mac.c
  1424. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  1425. @@ -745,7 +745,11 @@ int ath9k_hw_beaconq_setup(struct ath_hw
  1426. qi.tqi_aifs = 1;
  1427. qi.tqi_cwmin = 0;
  1428. qi.tqi_cwmax = 0;
  1429. - /* NB: don't enable any interrupts */
  1430. +
  1431. + if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
  1432. + qi.tqi_qflags = TXQ_FLAG_TXOKINT_ENABLE |
  1433. + TXQ_FLAG_TXERRINT_ENABLE;
  1434. +
  1435. return ath9k_hw_setuptxqueue(ah, ATH9K_TX_QUEUE_BEACON, &qi);
  1436. }
  1437. EXPORT_SYMBOL(ath9k_hw_beaconq_setup);
  1438. --- a/drivers/net/wireless/ath/ath9k/main.c
  1439. +++ b/drivers/net/wireless/ath/ath9k/main.c
  1440. @@ -118,13 +118,15 @@ void ath9k_ps_restore(struct ath_softc *
  1441. if (--sc->ps_usecount != 0)
  1442. goto unlock;
  1443. - if (sc->ps_idle && (sc->ps_flags & PS_WAIT_FOR_TX_ACK))
  1444. + if (sc->ps_flags & PS_WAIT_FOR_TX_ACK)
  1445. + goto unlock;
  1446. +
  1447. + if (sc->ps_idle)
  1448. mode = ATH9K_PM_FULL_SLEEP;
  1449. else if (sc->ps_enabled &&
  1450. !(sc->ps_flags & (PS_WAIT_FOR_BEACON |
  1451. PS_WAIT_FOR_CAB |
  1452. - PS_WAIT_FOR_PSPOLL_DATA |
  1453. - PS_WAIT_FOR_TX_ACK)))
  1454. + PS_WAIT_FOR_PSPOLL_DATA)))
  1455. mode = ATH9K_PM_NETWORK_SLEEP;
  1456. else
  1457. goto unlock;
  1458. @@ -1559,6 +1561,7 @@ static int ath9k_config(struct ieee80211
  1459. struct ath_hw *ah = sc->sc_ah;
  1460. struct ath_common *common = ath9k_hw_common(ah);
  1461. struct ieee80211_conf *conf = &hw->conf;
  1462. + bool reset_channel = false;
  1463. ath9k_ps_wakeup(sc);
  1464. mutex_lock(&sc->mutex);
  1465. @@ -1567,6 +1570,12 @@ static int ath9k_config(struct ieee80211
  1466. sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE);
  1467. if (sc->ps_idle)
  1468. ath_cancel_work(sc);
  1469. + else
  1470. + /*
  1471. + * The chip needs a reset to properly wake up from
  1472. + * full sleep
  1473. + */
  1474. + reset_channel = ah->chip_fullsleep;
  1475. }
  1476. /*
  1477. @@ -1595,7 +1604,7 @@ static int ath9k_config(struct ieee80211
  1478. }
  1479. }
  1480. - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  1481. + if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) {
  1482. struct ieee80211_channel *curchan = hw->conf.channel;
  1483. int pos = curchan->hw_value;
  1484. int old_pos = -1;
  1485. @@ -1955,6 +1964,7 @@ static void ath9k_config_bss(struct ath_
  1486. sc->sc_flags &= ~SC_OP_ANI_RUN;
  1487. del_timer_sync(&common->ani.timer);
  1488. memset(&sc->caldata, 0, sizeof(sc->caldata));
  1489. + ath9k_hw_ani_init(sc->sc_ah);
  1490. }
  1491. }
  1492. @@ -2300,6 +2310,7 @@ static int ath9k_tx_last_beacon(struct i
  1493. struct ath_vif *avp;
  1494. struct ath_buf *bf;
  1495. struct ath_tx_status ts;
  1496. + bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
  1497. int status;
  1498. vif = sc->beacon.bslot[0];
  1499. @@ -2310,7 +2321,7 @@ static int ath9k_tx_last_beacon(struct i
  1500. if (!avp->is_bslot_active)
  1501. return 0;
  1502. - if (!sc->beacon.tx_processed) {
  1503. + if (!sc->beacon.tx_processed && !edma) {
  1504. tasklet_disable(&sc->bcon_tasklet);
  1505. bf = avp->av_bcbuf;
  1506. --- a/drivers/net/wireless/ath/ath9k/xmit.c
  1507. +++ b/drivers/net/wireless/ath/ath9k/xmit.c
  1508. @@ -2296,9 +2296,12 @@ void ath_tx_edma_tasklet(struct ath_soft
  1509. break;
  1510. }
  1511. - /* Skip beacon completions */
  1512. - if (ts.qid == sc->beacon.beaconq)
  1513. + /* Process beacon completions separately */
  1514. + if (ts.qid == sc->beacon.beaconq) {
  1515. + sc->beacon.tx_processed = true;
  1516. + sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK);
  1517. continue;
  1518. + }
  1519. txq = &sc->tx.txq[ts.qid];
  1520. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  1521. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  1522. @@ -299,7 +299,6 @@ struct ath_tx {
  1523. struct ath_rx_edma {
  1524. struct sk_buff_head rx_fifo;
  1525. - struct sk_buff_head rx_buffers;
  1526. u32 rx_fifo_hwsize;
  1527. };
  1528. --- a/drivers/net/wireless/ath/ath9k/ani.c
  1529. +++ b/drivers/net/wireless/ath/ath9k/ani.c
  1530. @@ -46,8 +46,8 @@ static const struct ani_ofdm_level_entry
  1531. { 5, 4, 1 }, /* lvl 5 */
  1532. { 6, 5, 1 }, /* lvl 6 */
  1533. { 7, 6, 1 }, /* lvl 7 */
  1534. - { 7, 7, 1 }, /* lvl 8 */
  1535. - { 7, 8, 0 } /* lvl 9 */
  1536. + { 7, 6, 0 }, /* lvl 8 */
  1537. + { 7, 7, 0 } /* lvl 9 */
  1538. };
  1539. #define ATH9K_ANI_OFDM_NUM_LEVEL \
  1540. ARRAY_SIZE(ofdm_level_table)
  1541. @@ -91,8 +91,8 @@ static const struct ani_cck_level_entry
  1542. { 4, 0 }, /* lvl 4 */
  1543. { 5, 0 }, /* lvl 5 */
  1544. { 6, 0 }, /* lvl 6 */
  1545. - { 7, 0 }, /* lvl 7 (only for high rssi) */
  1546. - { 8, 0 } /* lvl 8 (only for high rssi) */
  1547. + { 6, 0 }, /* lvl 7 (only for high rssi) */
  1548. + { 7, 0 } /* lvl 8 (only for high rssi) */
  1549. };
  1550. #define ATH9K_ANI_CCK_NUM_LEVEL \
  1551. @@ -290,16 +290,9 @@ static void ath9k_hw_set_ofdm_nil(struct
  1552. ATH9K_ANI_FIRSTEP_LEVEL,
  1553. entry_ofdm->fir_step_level);
  1554. - if ((ah->opmode != NL80211_IFTYPE_STATION &&
  1555. - ah->opmode != NL80211_IFTYPE_ADHOC) ||
  1556. - aniState->noiseFloor <= aniState->rssiThrHigh) {
  1557. - if (aniState->ofdmWeakSigDetectOff)
  1558. - /* force on ofdm weak sig detect */
  1559. - ath9k_hw_ani_control(ah,
  1560. - ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
  1561. - true);
  1562. - else if (aniState->ofdmWeakSigDetectOff ==
  1563. - entry_ofdm->ofdm_weak_signal_on)
  1564. + if ((aniState->noiseFloor >= aniState->rssiThrHigh) &&
  1565. + (aniState->ofdmWeakSigDetectOff !=
  1566. + entry_ofdm->ofdm_weak_signal_on)) {
  1567. ath9k_hw_ani_control(ah,
  1568. ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
  1569. entry_ofdm->ofdm_weak_signal_on);
  1570. @@ -717,26 +710,30 @@ void ath9k_hw_ani_monitor(struct ath_hw
  1571. ofdmPhyErrRate, aniState->cckNoiseImmunityLevel,
  1572. cckPhyErrRate, aniState->ofdmsTurn);
  1573. - if (aniState->listenTime > 5 * ah->aniperiod) {
  1574. - if (ofdmPhyErrRate <= ah->config.ofdm_trig_low &&
  1575. - cckPhyErrRate <= ah->config.cck_trig_low) {
  1576. + if (aniState->listenTime > ah->aniperiod) {
  1577. + if (cckPhyErrRate < ah->config.cck_trig_low &&
  1578. + ((ofdmPhyErrRate < ah->config.ofdm_trig_low &&
  1579. + aniState->ofdmNoiseImmunityLevel <
  1580. + ATH9K_ANI_OFDM_DEF_LEVEL) ||
  1581. + (ofdmPhyErrRate < ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI &&
  1582. + aniState->ofdmNoiseImmunityLevel >=
  1583. + ATH9K_ANI_OFDM_DEF_LEVEL))) {
  1584. ath9k_hw_ani_lower_immunity(ah);
  1585. aniState->ofdmsTurn = !aniState->ofdmsTurn;
  1586. - }
  1587. - ath9k_ani_restart(ah);
  1588. - } else if (aniState->listenTime > ah->aniperiod) {
  1589. - /* check to see if need to raise immunity */
  1590. - if (ofdmPhyErrRate > ah->config.ofdm_trig_high &&
  1591. - (cckPhyErrRate <= ah->config.cck_trig_high ||
  1592. - aniState->ofdmsTurn)) {
  1593. + } else if ((ofdmPhyErrRate > ah->config.ofdm_trig_high &&
  1594. + aniState->ofdmNoiseImmunityLevel >=
  1595. + ATH9K_ANI_OFDM_DEF_LEVEL) ||
  1596. + (ofdmPhyErrRate >
  1597. + ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI &&
  1598. + aniState->ofdmNoiseImmunityLevel <
  1599. + ATH9K_ANI_OFDM_DEF_LEVEL)) {
  1600. ath9k_hw_ani_ofdm_err_trigger(ah);
  1601. - ath9k_ani_restart(ah);
  1602. aniState->ofdmsTurn = false;
  1603. } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  1604. ath9k_hw_ani_cck_err_trigger(ah);
  1605. - ath9k_ani_restart(ah);
  1606. aniState->ofdmsTurn = true;
  1607. }
  1608. + ath9k_ani_restart(ah);
  1609. }
  1610. }
  1611. EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  1612. @@ -911,3 +908,4 @@ void ath9k_hw_ani_init(struct ath_hw *ah
  1613. ath9k_ani_restart(ah);
  1614. ath9k_enable_mib_counters(ah);
  1615. }
  1616. +EXPORT_SYMBOL(ath9k_hw_ani_init);
  1617. --- a/drivers/net/wireless/ath/ath9k/ani.h
  1618. +++ b/drivers/net/wireless/ath/ath9k/ani.h
  1619. @@ -25,11 +25,13 @@
  1620. /* units are errors per second */
  1621. #define ATH9K_ANI_OFDM_TRIG_HIGH_OLD 500
  1622. -#define ATH9K_ANI_OFDM_TRIG_HIGH_NEW 1000
  1623. +#define ATH9K_ANI_OFDM_TRIG_HIGH_NEW 3500
  1624. +#define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000
  1625. /* units are errors per second */
  1626. #define ATH9K_ANI_OFDM_TRIG_LOW_OLD 200
  1627. #define ATH9K_ANI_OFDM_TRIG_LOW_NEW 400
  1628. +#define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900
  1629. /* units are errors per second */
  1630. #define ATH9K_ANI_CCK_TRIG_HIGH_OLD 200
  1631. @@ -53,7 +55,7 @@
  1632. #define ATH9K_ANI_RSSI_THR_LOW 7
  1633. #define ATH9K_ANI_PERIOD_OLD 100
  1634. -#define ATH9K_ANI_PERIOD_NEW 1000
  1635. +#define ATH9K_ANI_PERIOD_NEW 300
  1636. /* in ms */
  1637. #define ATH9K_ANI_POLLINTERVAL_OLD 100
  1638. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  1639. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  1640. @@ -1056,46 +1056,8 @@ static bool ar5008_hw_ani_control_old(st
  1641. break;
  1642. }
  1643. case ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION:{
  1644. - static const int m1ThreshLow[] = { 127, 50 };
  1645. - static const int m2ThreshLow[] = { 127, 40 };
  1646. - static const int m1Thresh[] = { 127, 0x4d };
  1647. - static const int m2Thresh[] = { 127, 0x40 };
  1648. - static const int m2CountThr[] = { 31, 16 };
  1649. - static const int m2CountThrLow[] = { 63, 48 };
  1650. u32 on = param ? 1 : 0;
  1651. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
  1652. - AR_PHY_SFCORR_LOW_M1_THRESH_LOW,
  1653. - m1ThreshLow[on]);
  1654. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
  1655. - AR_PHY_SFCORR_LOW_M2_THRESH_LOW,
  1656. - m2ThreshLow[on]);
  1657. - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
  1658. - AR_PHY_SFCORR_M1_THRESH,
  1659. - m1Thresh[on]);
  1660. - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
  1661. - AR_PHY_SFCORR_M2_THRESH,
  1662. - m2Thresh[on]);
  1663. - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
  1664. - AR_PHY_SFCORR_M2COUNT_THR,
  1665. - m2CountThr[on]);
  1666. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
  1667. - AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW,
  1668. - m2CountThrLow[on]);
  1669. -
  1670. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
  1671. - AR_PHY_SFCORR_EXT_M1_THRESH_LOW,
  1672. - m1ThreshLow[on]);
  1673. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
  1674. - AR_PHY_SFCORR_EXT_M2_THRESH_LOW,
  1675. - m2ThreshLow[on]);
  1676. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
  1677. - AR_PHY_SFCORR_EXT_M1_THRESH,
  1678. - m1Thresh[on]);
  1679. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
  1680. - AR_PHY_SFCORR_EXT_M2_THRESH,
  1681. - m2Thresh[on]);
  1682. -
  1683. if (on)
  1684. REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
  1685. AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
  1686. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  1687. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  1688. @@ -824,55 +824,6 @@ static bool ar9003_hw_ani_control(struct
  1689. * on == 0 means more noise imm
  1690. */
  1691. u32 on = param ? 1 : 0;
  1692. - /*
  1693. - * make register setting for default
  1694. - * (weak sig detect ON) come from INI file
  1695. - */
  1696. - int m1ThreshLow = on ?
  1697. - aniState->iniDef.m1ThreshLow : m1ThreshLow_off;
  1698. - int m2ThreshLow = on ?
  1699. - aniState->iniDef.m2ThreshLow : m2ThreshLow_off;
  1700. - int m1Thresh = on ?
  1701. - aniState->iniDef.m1Thresh : m1Thresh_off;
  1702. - int m2Thresh = on ?
  1703. - aniState->iniDef.m2Thresh : m2Thresh_off;
  1704. - int m2CountThr = on ?
  1705. - aniState->iniDef.m2CountThr : m2CountThr_off;
  1706. - int m2CountThrLow = on ?
  1707. - aniState->iniDef.m2CountThrLow : m2CountThrLow_off;
  1708. - int m1ThreshLowExt = on ?
  1709. - aniState->iniDef.m1ThreshLowExt : m1ThreshLowExt_off;
  1710. - int m2ThreshLowExt = on ?
  1711. - aniState->iniDef.m2ThreshLowExt : m2ThreshLowExt_off;
  1712. - int m1ThreshExt = on ?
  1713. - aniState->iniDef.m1ThreshExt : m1ThreshExt_off;
  1714. - int m2ThreshExt = on ?
  1715. - aniState->iniDef.m2ThreshExt : m2ThreshExt_off;
  1716. -
  1717. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
  1718. - AR_PHY_SFCORR_LOW_M1_THRESH_LOW,
  1719. - m1ThreshLow);
  1720. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
  1721. - AR_PHY_SFCORR_LOW_M2_THRESH_LOW,
  1722. - m2ThreshLow);
  1723. - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
  1724. - AR_PHY_SFCORR_M1_THRESH, m1Thresh);
  1725. - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
  1726. - AR_PHY_SFCORR_M2_THRESH, m2Thresh);
  1727. - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
  1728. - AR_PHY_SFCORR_M2COUNT_THR, m2CountThr);
  1729. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
  1730. - AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW,
  1731. - m2CountThrLow);
  1732. -
  1733. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
  1734. - AR_PHY_SFCORR_EXT_M1_THRESH_LOW, m1ThreshLowExt);
  1735. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
  1736. - AR_PHY_SFCORR_EXT_M2_THRESH_LOW, m2ThreshLowExt);
  1737. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
  1738. - AR_PHY_SFCORR_EXT_M1_THRESH, m1ThreshExt);
  1739. - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
  1740. - AR_PHY_SFCORR_EXT_M2_THRESH, m2ThreshExt);
  1741. if (on)
  1742. REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
  1743. --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  1744. +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  1745. @@ -430,10 +430,14 @@ void rt2x00lib_txdone(struct queue_entry
  1746. /*
  1747. * If the data queue was below the threshold before the txdone
  1748. * handler we must make sure the packet queue in the mac80211 stack
  1749. - * is reenabled when the txdone handler has finished.
  1750. + * is reenabled when the txdone handler has finished. This has to be
  1751. + * serialized with rt2x00mac_tx(), otherwise we can wake up queue
  1752. + * before it was stopped.
  1753. */
  1754. + spin_lock_bh(&entry->queue->tx_lock);
  1755. if (!rt2x00queue_threshold(entry->queue))
  1756. rt2x00queue_unpause_queue(entry->queue);
  1757. + spin_unlock_bh(&entry->queue->tx_lock);
  1758. }
  1759. EXPORT_SYMBOL_GPL(rt2x00lib_txdone);
  1760. --- a/drivers/net/wireless/rt2x00/rt2x00mac.c
  1761. +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
  1762. @@ -152,13 +152,22 @@ void rt2x00mac_tx(struct ieee80211_hw *h
  1763. if (unlikely(rt2x00queue_write_tx_frame(queue, skb, false)))
  1764. goto exit_fail;
  1765. + /*
  1766. + * Pausing queue has to be serialized with rt2x00lib_txdone(). Note
  1767. + * we should not use spin_lock_bh variant as bottom halve was already
  1768. + * disabled before ieee80211_xmit() call.
  1769. + */
  1770. + spin_lock(&queue->tx_lock);
  1771. if (rt2x00queue_threshold(queue))
  1772. rt2x00queue_pause_queue(queue);
  1773. + spin_unlock(&queue->tx_lock);
  1774. return;
  1775. exit_fail:
  1776. + spin_lock(&queue->tx_lock);
  1777. rt2x00queue_pause_queue(queue);
  1778. + spin_unlock(&queue->tx_lock);
  1779. exit_free_skb:
  1780. ieee80211_free_txskb(hw, skb);
  1781. }
  1782. --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
  1783. +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
  1784. @@ -619,6 +619,9 @@ int rt2x00queue_write_tx_frame(struct da
  1785. else if (test_bit(REQUIRE_DMA, &queue->rt2x00dev->cap_flags))
  1786. rt2x00queue_align_frame(skb);
  1787. + /*
  1788. + * That function must be called with bh disabled.
  1789. + */
  1790. spin_lock(&queue->tx_lock);
  1791. if (unlikely(rt2x00queue_full(queue))) {