300-pending_work.patch 88 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752
  1. commit d3a58df87a2e4c2301ac843604202d290a48440b
  2. Author: Avraham Stern <[email protected]>
  3. Date: Thu May 22 12:17:47 2014 +0300
  4. mac80211: set new interfaces as idle upon init
  5. Mark new interfaces as idle to allow operations that require that
  6. interfaces are idle to take place. Interface types that are always
  7. not idle (like AP interfaces) will be set as not idle when they are
  8. assigned a channel context.
  9. Signed-off-by: Avraham Stern <[email protected]>
  10. Signed-off-by: Emmanuel Grumbach<[email protected]>
  11. Signed-off-by: Johannes Berg <[email protected]>
  12. commit 923eaf367206e01f22c97aee22300e332d071916
  13. Author: Arik Nemtsov <[email protected]>
  14. Date: Mon May 26 14:40:51 2014 +0300
  15. mac80211: don't check netdev state for debugfs read/write
  16. Doing so will lead to an oops for a p2p-dev interface, since it has
  17. no netdev.
  18. Cc: [email protected]
  19. Signed-off-by: Arik Nemtsov <[email protected]>
  20. Signed-off-by: Emmanuel Grumbach <[email protected]>
  21. Signed-off-by: Johannes Berg <[email protected]>
  22. commit a9fb54169b197f31aff24c8d6270dd1e56cde395
  23. Author: [email protected] <[email protected]>
  24. Date: Mon May 26 18:01:44 2014 +0530
  25. regdb: Generalize the mW to dBm power conversion
  26. Generalize the power conversion from mW to dBm
  27. using log. This should fix the below compilation
  28. error for country NO which adds a new power value
  29. 2000mW which is not handled earlier.
  30. CC [M] net/wireless/wext-sme.o
  31. CC [M] net/wireless/regdb.o
  32. net/wireless/regdb.c:1130:1: error: Unknown undeclared here (not in
  33. a function)
  34. net/wireless/regdb.c:1130:9: error: expected } before power
  35. make[2]: *** [net/wireless/regdb.o] Error 1
  36. make[1]: *** [net/wireless] Error 2
  37. make: *** [net] Error 2
  38. Reported-By: John Walker <[email protected]>
  39. Signed-off-by: Chaitanya T K <[email protected]>
  40. Acked-by: John W. Linville <[email protected]>
  41. [remove unneeded parentheses, fix rounding by using %.0f]
  42. Signed-off-by: Johannes Berg <[email protected]>
  43. commit c7d37a66e345df2fdf1aa7b2c9a6d3d53846ca5b
  44. Author: Krzysztof Hałasa <[email protected]>
  45. Date: Mon May 26 14:14:46 2014 +0200
  46. mac80211: fix IBSS join by initializing last_scan_completed
  47. Without this fix, freshly rebooted Linux creates a new IBSS
  48. instead of joining an existing one. Only when jiffies counter
  49. overflows after 5 minutes the IBSS can be successfully joined.
  50. Signed-off-by: Krzysztof Hałasa <[email protected]>
  51. [edit commit message slightly]
  52. Cc: [email protected]
  53. Signed-off-by: Johannes Berg <[email protected]>
  54. commit 34171dc0d623be2c1032416bf7d3819f388ed70d
  55. Author: Emmanuel Grumbach <[email protected]>
  56. Date: Sun May 25 15:35:41 2014 +0300
  57. mac80211: fix virtual monitor interface addition
  58. Since the commit below, cfg80211_chandef_dfs_required()
  59. will warn if it gets a an NL80211_IFTYPE_UNSPECIFIED iftype
  60. as explicitely written in the commit log.
  61. When an virtual monitor interface is added, its type is set
  62. in ieee80211_sub_if_data.vif.type, but not in
  63. ieee80211_sub_if_data.wdev.iftype which is passed to
  64. cfg80211_chandef_dfs_required() hence resulting in the
  65. following warning:
  66. WARNING: CPU: 1 PID: 21265 at net/wireless/chan.c:376 cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]()
  67. Modules linked in: [...]
  68. CPU: 1 PID: 21265 Comm: ifconfig Tainted: G W O 3.13.11+ #12
  69. Hardware name: Dell Inc. Latitude E6410/0667CC, BIOS A01 03/05/2010
  70. 0000000000000009 ffff88008f5fdb08 ffffffff817d4219 ffff88008f5fdb50
  71. ffff88008f5fdb40 ffffffff8106f57d 0000000000000000 0000000000000000
  72. ffff880081062fb8 ffff8800810604e0 0000000000000001 ffff88008f5fdba0
  73. Call Trace:
  74. [<ffffffff817d4219>] dump_stack+0x4d/0x66
  75. [<ffffffff8106f57d>] warn_slowpath_common+0x7d/0xa0
  76. [<ffffffff8106f5ec>] warn_slowpath_fmt+0x4c/0x50
  77. [<ffffffffa04ea4ec>] cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]
  78. [<ffffffffa06b1024>] ieee80211_vif_use_channel+0x94/0x500 [mac80211]
  79. [<ffffffffa0684e6b>] ieee80211_add_virtual_monitor+0x1ab/0x5c0 [mac80211]
  80. [<ffffffffa0686ae5>] ieee80211_do_open+0xe75/0x1580 [mac80211]
  81. [<ffffffffa0687259>] ieee80211_open+0x69/0x70 [mac80211]
  82. [snip]
  83. Fixes: 00ec75fc5a64 ("cfg80211: pass the actual iftype when calling cfg80211_chandef_dfs_required()")
  84. Signed-off-by: Emmanuel Grumbach <[email protected]>
  85. Acked-by: Luciano Coelho <[email protected]>
  86. Signed-off-by: Johannes Berg <[email protected]>
  87. commit d93cc72b37b4e2c314e1c499e80e8801907c2fea
  88. Author: Michal Kazior <[email protected]>
  89. Date: Thu Jun 5 14:21:37 2014 +0200
  90. mac80211: use csa counter offsets instead of csa_active
  91. vif->csa_active is protected by mutexes only. This
  92. means it is unreliable to depend on it on codeflow
  93. in non-sleepable beacon and CSA code. There was no
  94. guarantee to have vif->csa_active update be
  95. visible before beacons are updated on SMP systems.
  96. Using csa counter offsets which are embedded in
  97. beacon struct (and thus are protected with single
  98. RCU assignment) is much safer.
  99. Signed-off-by: Michal Kazior <[email protected]>
  100. Signed-off-by: Johannes Berg <[email protected]>
  101. commit d2746694fcdef24e0a7a1947d8c70082cde81a26
  102. Author: Michal Kazior <[email protected]>
  103. Date: Thu Jun 5 14:21:36 2014 +0200
  104. mac80211: move csa counters from sdata to beacon/presp
  105. Having csa counters part of beacon and probe_resp
  106. structures makes it easier to get rid of possible
  107. races between setting a beacon and updating
  108. counters on SMP systems by guaranteeing counters
  109. are always consistent against given beacon struct.
  110. While at it relax WARN_ON into WARN_ON_ONCE to
  111. prevent spamming logs and racing.
  112. Signed-off-by: Michal Kazior <[email protected]>
  113. Signed-off-by: Johannes Berg <[email protected]>
  114. commit 5dcb54f3a1a8cd7e0331e773487574f9743615db
  115. Author: Janusz Dziedzic <[email protected]>
  116. Date: Thu Jun 5 08:12:57 2014 +0200
  117. mac80211: allow tx via monitor iface when DFS
  118. Allow send frames using monitor interface
  119. when DFS chandef and we pass CAC (beaconing
  120. allowed).
  121. This fix problem when old kernel and new backports used,
  122. in such case hostapd create/use also monitor interface.
  123. Before this patch all frames hostapd send using monitor
  124. iface were dropped when AP was configured on DFS channel.
  125. Signed-off-by: Janusz Dziedzic <[email protected]>
  126. Signed-off-by: Johannes Berg <[email protected]>
  127. commit 6f09a1beb0d2007572248c986780562219bd206f
  128. Author: Johannes Berg <[email protected]>
  129. Date: Wed Jun 4 17:31:56 2014 +0200
  130. cfg80211: make ethtool the driver's responsibility
  131. Currently, cfg80211 tries to implement ethtool, but that doesn't
  132. really scale well, with all the different operations. Make the
  133. lower-level driver responsible for it, which currently only has
  134. an effect on mac80211. It will similarly not scale well at that
  135. level though, since mac80211 also has many drivers.
  136. To cleanly implement this in mac80211, introduce a new file and
  137. move some code to appropriate places.
  138. Signed-off-by: Johannes Berg <[email protected]>
  139. commit 6b0c6f133de8f90caeb1c4a902e6140567c5bf96
  140. Author: Johannes Berg <[email protected]>
  141. Date: Wed Jun 4 17:06:23 2014 +0200
  142. mac80211: remove weak WEP IV accounting
  143. Since WEP is practically dead, there seems very little
  144. point in keeping WEP weak IV accounting.
  145. Signed-off-by: Johannes Berg <[email protected]>
  146. commit aecdc89fb4664c76baa4bbd46008f220532309ff
  147. Author: Luciano Coelho <[email protected]>
  148. Date: Fri May 23 11:04:50 2014 +0300
  149. ath9k/ath10k: remove unnecessary channel_switch_beacon callbacks
  150. The channel_switch_beacon callback is optional, so it doesn't have to
  151. be defined if it's not going to do anything useful with it. Both
  152. ath9k and ath10k define the callback and just returns. This commit
  153. removes them.
  154. Cc: Michal Kazior <[email protected]>
  155. Signed-off-by: Luciano Coelho <[email protected]>
  156. Signed-off-by: Kalle Valo <[email protected]>
  157. commit 60ccc107c9b9fb732fdee1f76bb2dad44f0e1798
  158. Author: Rajkumar Manoharan <[email protected]>
  159. Date: Tue May 27 16:58:02 2014 +0530
  160. ath9k: Fix deadlock while updating p2p beacon timer
  161. pm_lock is taken twice while syncing HW TSF of p2p vif.
  162. Fix this by taking the lock at caller side.
  163. Cc: Felix Fietkau <[email protected]>
  164. Signed-off-by: Rajkumar Manoharan <[email protected]>
  165. Signed-off-by: John W. Linville <[email protected]>
  166. commit f3831a4e3903dbc1a57d5df56deb6a143fd001bc
  167. Author: Stanislaw Gruszka <[email protected]>
  168. Date: Thu Jun 5 13:52:27 2014 +0200
  169. rt2x00: do not initialize BCN_OFFSET registers
  170. We setup BCN_OFFSET{0,1} registers dynamically, don't have to
  171. initialize them.
  172. Signed-off-by: Stanislaw Gruszka <[email protected]>
  173. commit e5c58ca7a48d4c82f282749a978052c47fd95998
  174. Author: Stanislaw Gruszka <[email protected]>
  175. Date: Thu Jun 5 13:52:26 2014 +0200
  176. rt2x00: change order when stop beaconing
  177. When no beaconing is needed, first stop beacon queue (disable beaconing
  178. globally) to avoid possible sending of not prepared beacon on short
  179. period after clearing beacon and before stop of BCN queue.
  180. Signed-off-by: Stanislaw Gruszka <[email protected]>
  181. commit 382c1b9e03f52d0cd741ef1d942cad0f649f0744
  182. Author: Stanislaw Gruszka <[email protected]>
  183. Date: Thu Jun 5 13:52:25 2014 +0200
  184. rt2x00: change default MAC_BSSID_DW1_BSS_BCN_NUM
  185. We setup MAC_BSSID_DW1_BSS_BCN_NUM dynamically when numbers of active
  186. beacons increase. Change default to 0 to tell hardware that we want to
  187. send only one beacon as default.
  188. Signed-off-by: Stanislaw Gruszka <[email protected]>
  189. commit 3b400571dd033e46fa7e76c5bb92a3ce8198afa9
  190. Author: Stanislaw Gruszka <[email protected]>
  191. Date: Thu Jun 5 13:52:24 2014 +0200
  192. rt2x00: change beaconing setup on RT2800
  193. As reported by Matthias, on 5572 chip, even if we clear up TXWI
  194. of corresponding beacon, hardware still try to send it or do other
  195. action that increase power consumption peak up to 1A.
  196. To avoid the issue, setup beaconing dynamically by configuring offsets
  197. of currently active beacons and MAC_BSSID_DW1_BSS_BCN_NUM variable,
  198. which limit number of beacons that hardware will try to send.
  199. Reported-by: Matthias Fend <[email protected]>
  200. Signed-off-by: Stanislaw Gruszka <[email protected]>
  201. commit 916e591b2cc41f7e572992175ca56d866d7bc958
  202. Author: Stanislaw Gruszka <[email protected]>
  203. Date: Thu Jun 5 13:52:23 2014 +0200
  204. rt2x00: change beaconing locking
  205. This patch is needed for further changes to keep global variables
  206. consistent when changing beaconing on diffrent vif's.
  207. Signed-off-by: Stanislaw Gruszka <[email protected]>
  208. commit 930b0dffd1731f3f418f9132faea720a23b7af61
  209. Author: Johannes Berg <[email protected]>
  210. Date: Tue Jun 3 11:18:47 2014 +0200
  211. mac80211: fix station/driver powersave race
  212. It is currently possible to have a race due to the station PS
  213. unblock work like this:
  214. * station goes to sleep with frames buffered in the driver
  215. * driver blocks wakeup
  216. * station wakes up again
  217. * driver flushes/returns frames, and unblocks, which schedules
  218. the unblock work
  219. * unblock work starts to run, and checks that the station is
  220. awake (i.e. that the WLAN_STA_PS_STA flag isn't set)
  221. * we process a received frame with PM=1, setting the flag again
  222. * ieee80211_sta_ps_deliver_wakeup() runs, delivering all frames
  223. to the driver, and then clearing the WLAN_STA_PS_DRIVER and
  224. WLAN_STA_PS_STA flags
  225. In this scenario, mac80211 will think that the station is awake,
  226. while it really is asleep, and any TX'ed frames should be filtered
  227. by the device (it will know that the station is sleeping) but then
  228. passed to mac80211 again, which will not buffer it either as it
  229. thinks the station is awake, and eventually the packets will be
  230. dropped.
  231. Fix this by moving the clearing of the flags to exactly where we
  232. learn about the situation. This creates a problem of reordering,
  233. so introduce another flag indicating that delivery is being done,
  234. this new flag also queues frames and is cleared only while the
  235. spinlock is held (which the queuing code also holds) so that any
  236. concurrent delivery/TX is handled correctly.
  237. Reported-by: Andrei Otcheretianski <[email protected]>
  238. Signed-off-by: Johannes Berg <[email protected]>
  239. commit 6df35206bc6c1c6aad1d8077df5786b4a7f77873
  240. Author: Felix Fietkau <[email protected]>
  241. Date: Fri May 23 19:58:14 2014 +0200
  242. mac80211: reduce packet loss notifications under load
  243. During strong signal fluctuations under high throughput, few consecutive
  244. failed A-MPDU transmissions can easily trigger packet loss notification,
  245. and thus (in AP mode) client disconnection.
  246. Reduce the number of false positives by checking the A-MPDU status flag
  247. and treating a failed A-MPDU as a single packet.
  248. Signed-off-by: Felix Fietkau <[email protected]>
  249. commit 7b7843a36fbcc568834404c7430ff895d8502131
  250. Author: Felix Fietkau <[email protected]>
  251. Date: Fri May 23 19:26:32 2014 +0200
  252. mac80211: fix a memory leak on sta rate selection table
  253. Cc: [email protected]
  254. Reported-by: Christophe Prévotaux <[email protected]>
  255. Signed-off-by: Felix Fietkau <[email protected]>
  256. commit 96892d6aa0a153423070addf3070bc79578b3897
  257. Author: Felix Fietkau <[email protected]>
  258. Date: Mon May 19 21:20:49 2014 +0200
  259. ath9k: avoid passing buffers to the hardware during flush
  260. The commit "ath9k: fix possible hang on flush" changed the receive code
  261. to always link rx descriptors of processed frames, even when flushing.
  262. In some cases, this leads to flushed rx buffers being passed to the
  263. hardware while rx is already stopped.
  264. Signed-off-by: Felix Fietkau <[email protected]>
  265. --- a/drivers/net/wireless/ath/ath9k/recv.c
  266. +++ b/drivers/net/wireless/ath/ath9k/recv.c
  267. @@ -34,7 +34,8 @@ static inline bool ath9k_check_auto_slee
  268. * buffer (or rx fifo). This can incorrectly acknowledge packets
  269. * to a sender if last desc is self-linked.
  270. */
  271. -static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf)
  272. +static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf,
  273. + bool flush)
  274. {
  275. struct ath_hw *ah = sc->sc_ah;
  276. struct ath_common *common = ath9k_hw_common(ah);
  277. @@ -59,18 +60,19 @@ static void ath_rx_buf_link(struct ath_s
  278. common->rx_bufsize,
  279. 0);
  280. - if (sc->rx.rxlink == NULL)
  281. - ath9k_hw_putrxbuf(ah, bf->bf_daddr);
  282. - else
  283. + if (sc->rx.rxlink)
  284. *sc->rx.rxlink = bf->bf_daddr;
  285. + else if (!flush)
  286. + ath9k_hw_putrxbuf(ah, bf->bf_daddr);
  287. sc->rx.rxlink = &ds->ds_link;
  288. }
  289. -static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf)
  290. +static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf,
  291. + bool flush)
  292. {
  293. if (sc->rx.buf_hold)
  294. - ath_rx_buf_link(sc, sc->rx.buf_hold);
  295. + ath_rx_buf_link(sc, sc->rx.buf_hold, flush);
  296. sc->rx.buf_hold = bf;
  297. }
  298. @@ -442,7 +444,7 @@ int ath_startrecv(struct ath_softc *sc)
  299. sc->rx.buf_hold = NULL;
  300. sc->rx.rxlink = NULL;
  301. list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) {
  302. - ath_rx_buf_link(sc, bf);
  303. + ath_rx_buf_link(sc, bf, false);
  304. }
  305. /* We could have deleted elements so the list may be empty now */
  306. @@ -1118,12 +1120,12 @@ requeue_drop_frag:
  307. requeue:
  308. list_add_tail(&bf->list, &sc->rx.rxbuf);
  309. - if (edma) {
  310. - ath_rx_edma_buf_link(sc, qtype);
  311. - } else {
  312. - ath_rx_buf_relink(sc, bf);
  313. + if (!edma) {
  314. + ath_rx_buf_relink(sc, bf, flush);
  315. if (!flush)
  316. ath9k_hw_rxena(ah);
  317. + } else if (!flush) {
  318. + ath_rx_edma_buf_link(sc, qtype);
  319. }
  320. if (!budget--)
  321. --- a/net/mac80211/sta_info.c
  322. +++ b/net/mac80211/sta_info.c
  323. @@ -100,7 +100,8 @@ static void __cleanup_single_sta(struct
  324. struct ps_data *ps;
  325. if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
  326. - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
  327. + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
  328. + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
  329. if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
  330. sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
  331. ps = &sdata->bss->ps;
  332. @@ -111,6 +112,7 @@ static void __cleanup_single_sta(struct
  333. clear_sta_flag(sta, WLAN_STA_PS_STA);
  334. clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
  335. + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
  336. atomic_dec(&ps->num_sta_ps);
  337. sta_info_recalc_tim(sta);
  338. @@ -125,7 +127,7 @@ static void __cleanup_single_sta(struct
  339. if (ieee80211_vif_is_mesh(&sdata->vif))
  340. mesh_sta_cleanup(sta);
  341. - cancel_work_sync(&sta->drv_unblock_wk);
  342. + cancel_work_sync(&sta->drv_deliver_wk);
  343. /*
  344. * Destroy aggregation state here. It would be nice to wait for the
  345. @@ -227,6 +229,7 @@ struct sta_info *sta_info_get_by_idx(str
  346. */
  347. void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
  348. {
  349. + struct ieee80211_sta_rates *rates;
  350. int i;
  351. if (sta->rate_ctrl)
  352. @@ -238,6 +241,10 @@ void sta_info_free(struct ieee80211_loca
  353. kfree(sta->tx_lat);
  354. }
  355. + rates = rcu_dereference_protected(sta->sta.rates, true);
  356. + if (rates)
  357. + kfree(rates);
  358. +
  359. sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
  360. kfree(sta);
  361. @@ -252,33 +259,23 @@ static void sta_info_hash_add(struct iee
  362. rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], sta);
  363. }
  364. -static void sta_unblock(struct work_struct *wk)
  365. +static void sta_deliver_ps_frames(struct work_struct *wk)
  366. {
  367. struct sta_info *sta;
  368. - sta = container_of(wk, struct sta_info, drv_unblock_wk);
  369. + sta = container_of(wk, struct sta_info, drv_deliver_wk);
  370. if (sta->dead)
  371. return;
  372. - if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
  373. - local_bh_disable();
  374. + local_bh_disable();
  375. + if (!test_sta_flag(sta, WLAN_STA_PS_STA))
  376. ieee80211_sta_ps_deliver_wakeup(sta);
  377. - local_bh_enable();
  378. - } else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL)) {
  379. - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
  380. -
  381. - local_bh_disable();
  382. + else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL))
  383. ieee80211_sta_ps_deliver_poll_response(sta);
  384. - local_bh_enable();
  385. - } else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD)) {
  386. - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
  387. -
  388. - local_bh_disable();
  389. + else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD))
  390. ieee80211_sta_ps_deliver_uapsd(sta);
  391. - local_bh_enable();
  392. - } else
  393. - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
  394. + local_bh_enable();
  395. }
  396. static int sta_prepare_rate_control(struct ieee80211_local *local,
  397. @@ -340,7 +337,7 @@ struct sta_info *sta_info_alloc(struct i
  398. spin_lock_init(&sta->lock);
  399. spin_lock_init(&sta->ps_lock);
  400. - INIT_WORK(&sta->drv_unblock_wk, sta_unblock);
  401. + INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames);
  402. INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
  403. mutex_init(&sta->ampdu_mlme.mtx);
  404. #ifdef CPTCFG_MAC80211_MESH
  405. @@ -1140,8 +1137,15 @@ void ieee80211_sta_ps_deliver_wakeup(str
  406. }
  407. ieee80211_add_pending_skbs(local, &pending);
  408. - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
  409. - clear_sta_flag(sta, WLAN_STA_PS_STA);
  410. +
  411. + /* now we're no longer in the deliver code */
  412. + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
  413. +
  414. + /* The station might have polled and then woken up before we responded,
  415. + * so clear these flags now to avoid them sticking around.
  416. + */
  417. + clear_sta_flag(sta, WLAN_STA_PSPOLL);
  418. + clear_sta_flag(sta, WLAN_STA_UAPSD);
  419. spin_unlock(&sta->ps_lock);
  420. atomic_dec(&ps->num_sta_ps);
  421. @@ -1542,10 +1546,26 @@ void ieee80211_sta_block_awake(struct ie
  422. trace_api_sta_block_awake(sta->local, pubsta, block);
  423. - if (block)
  424. + if (block) {
  425. set_sta_flag(sta, WLAN_STA_PS_DRIVER);
  426. - else if (test_sta_flag(sta, WLAN_STA_PS_DRIVER))
  427. - ieee80211_queue_work(hw, &sta->drv_unblock_wk);
  428. + return;
  429. + }
  430. +
  431. + if (!test_sta_flag(sta, WLAN_STA_PS_DRIVER))
  432. + return;
  433. +
  434. + if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
  435. + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
  436. + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
  437. + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
  438. + } else if (test_sta_flag(sta, WLAN_STA_PSPOLL) ||
  439. + test_sta_flag(sta, WLAN_STA_UAPSD)) {
  440. + /* must be asleep in this case */
  441. + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
  442. + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
  443. + } else {
  444. + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
  445. + }
  446. }
  447. EXPORT_SYMBOL(ieee80211_sta_block_awake);
  448. @@ -1703,3 +1723,137 @@ u8 sta_info_tx_streams(struct sta_info *
  449. return ((ht_cap->mcs.tx_params & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
  450. >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1;
  451. }
  452. +
  453. +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
  454. +{
  455. + struct ieee80211_sub_if_data *sdata = sta->sdata;
  456. + struct ieee80211_local *local = sdata->local;
  457. + struct rate_control_ref *ref = local->rate_ctrl;
  458. + struct timespec uptime;
  459. + u64 packets = 0;
  460. + u32 thr = 0;
  461. + int i, ac;
  462. +
  463. + sinfo->generation = sdata->local->sta_generation;
  464. +
  465. + sinfo->filled = STATION_INFO_INACTIVE_TIME |
  466. + STATION_INFO_RX_BYTES64 |
  467. + STATION_INFO_TX_BYTES64 |
  468. + STATION_INFO_RX_PACKETS |
  469. + STATION_INFO_TX_PACKETS |
  470. + STATION_INFO_TX_RETRIES |
  471. + STATION_INFO_TX_FAILED |
  472. + STATION_INFO_TX_BITRATE |
  473. + STATION_INFO_RX_BITRATE |
  474. + STATION_INFO_RX_DROP_MISC |
  475. + STATION_INFO_BSS_PARAM |
  476. + STATION_INFO_CONNECTED_TIME |
  477. + STATION_INFO_STA_FLAGS |
  478. + STATION_INFO_BEACON_LOSS_COUNT;
  479. +
  480. + do_posix_clock_monotonic_gettime(&uptime);
  481. + sinfo->connected_time = uptime.tv_sec - sta->last_connected;
  482. +
  483. + sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
  484. + sinfo->tx_bytes = 0;
  485. + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
  486. + sinfo->tx_bytes += sta->tx_bytes[ac];
  487. + packets += sta->tx_packets[ac];
  488. + }
  489. + sinfo->tx_packets = packets;
  490. + sinfo->rx_bytes = sta->rx_bytes;
  491. + sinfo->rx_packets = sta->rx_packets;
  492. + sinfo->tx_retries = sta->tx_retry_count;
  493. + sinfo->tx_failed = sta->tx_retry_failed;
  494. + sinfo->rx_dropped_misc = sta->rx_dropped;
  495. + sinfo->beacon_loss_count = sta->beacon_loss_count;
  496. +
  497. + if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
  498. + (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
  499. + sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
  500. + if (!local->ops->get_rssi ||
  501. + drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
  502. + sinfo->signal = (s8)sta->last_signal;
  503. + sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
  504. + }
  505. + if (sta->chains) {
  506. + sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
  507. + STATION_INFO_CHAIN_SIGNAL_AVG;
  508. +
  509. + sinfo->chains = sta->chains;
  510. + for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
  511. + sinfo->chain_signal[i] = sta->chain_signal_last[i];
  512. + sinfo->chain_signal_avg[i] =
  513. + (s8) -ewma_read(&sta->chain_signal_avg[i]);
  514. + }
  515. + }
  516. +
  517. + sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
  518. + sta_set_rate_info_rx(sta, &sinfo->rxrate);
  519. +
  520. + if (ieee80211_vif_is_mesh(&sdata->vif)) {
  521. +#ifdef CPTCFG_MAC80211_MESH
  522. + sinfo->filled |= STATION_INFO_LLID |
  523. + STATION_INFO_PLID |
  524. + STATION_INFO_PLINK_STATE |
  525. + STATION_INFO_LOCAL_PM |
  526. + STATION_INFO_PEER_PM |
  527. + STATION_INFO_NONPEER_PM;
  528. +
  529. + sinfo->llid = sta->llid;
  530. + sinfo->plid = sta->plid;
  531. + sinfo->plink_state = sta->plink_state;
  532. + if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
  533. + sinfo->filled |= STATION_INFO_T_OFFSET;
  534. + sinfo->t_offset = sta->t_offset;
  535. + }
  536. + sinfo->local_pm = sta->local_pm;
  537. + sinfo->peer_pm = sta->peer_pm;
  538. + sinfo->nonpeer_pm = sta->nonpeer_pm;
  539. +#endif
  540. + }
  541. +
  542. + sinfo->bss_param.flags = 0;
  543. + if (sdata->vif.bss_conf.use_cts_prot)
  544. + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
  545. + if (sdata->vif.bss_conf.use_short_preamble)
  546. + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
  547. + if (sdata->vif.bss_conf.use_short_slot)
  548. + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
  549. + sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
  550. + sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
  551. +
  552. + sinfo->sta_flags.set = 0;
  553. + sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
  554. + BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
  555. + BIT(NL80211_STA_FLAG_WME) |
  556. + BIT(NL80211_STA_FLAG_MFP) |
  557. + BIT(NL80211_STA_FLAG_AUTHENTICATED) |
  558. + BIT(NL80211_STA_FLAG_ASSOCIATED) |
  559. + BIT(NL80211_STA_FLAG_TDLS_PEER);
  560. + if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
  561. + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
  562. + if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
  563. + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
  564. + if (test_sta_flag(sta, WLAN_STA_WME))
  565. + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
  566. + if (test_sta_flag(sta, WLAN_STA_MFP))
  567. + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
  568. + if (test_sta_flag(sta, WLAN_STA_AUTH))
  569. + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
  570. + if (test_sta_flag(sta, WLAN_STA_ASSOC))
  571. + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
  572. + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
  573. + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  574. +
  575. + /* check if the driver has a SW RC implementation */
  576. + if (ref && ref->ops->get_expected_throughput)
  577. + thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
  578. + else
  579. + thr = drv_get_expected_throughput(local, &sta->sta);
  580. +
  581. + if (thr != 0) {
  582. + sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
  583. + sinfo->expected_throughput = thr;
  584. + }
  585. +}
  586. --- a/net/mac80211/status.c
  587. +++ b/net/mac80211/status.c
  588. @@ -541,6 +541,23 @@ static void ieee80211_tx_latency_end_msr
  589. */
  590. #define STA_LOST_PKT_THRESHOLD 50
  591. +static void ieee80211_lost_packet(struct sta_info *sta, struct sk_buff *skb)
  592. +{
  593. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  594. +
  595. + /* This packet was aggregated but doesn't carry status info */
  596. + if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
  597. + !(info->flags & IEEE80211_TX_STAT_AMPDU))
  598. + return;
  599. +
  600. + if (++sta->lost_packets < STA_LOST_PKT_THRESHOLD)
  601. + return;
  602. +
  603. + cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr,
  604. + sta->lost_packets, GFP_ATOMIC);
  605. + sta->lost_packets = 0;
  606. +}
  607. +
  608. void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
  609. {
  610. struct sk_buff *skb2;
  611. @@ -680,12 +697,8 @@ void ieee80211_tx_status(struct ieee8021
  612. if (info->flags & IEEE80211_TX_STAT_ACK) {
  613. if (sta->lost_packets)
  614. sta->lost_packets = 0;
  615. - } else if (++sta->lost_packets >= STA_LOST_PKT_THRESHOLD) {
  616. - cfg80211_cqm_pktloss_notify(sta->sdata->dev,
  617. - sta->sta.addr,
  618. - sta->lost_packets,
  619. - GFP_ATOMIC);
  620. - sta->lost_packets = 0;
  621. + } else {
  622. + ieee80211_lost_packet(sta, skb);
  623. }
  624. }
  625. --- a/net/mac80211/rx.c
  626. +++ b/net/mac80211/rx.c
  627. @@ -1107,6 +1107,8 @@ static void sta_ps_end(struct sta_info *
  628. return;
  629. }
  630. + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
  631. + clear_sta_flag(sta, WLAN_STA_PS_STA);
  632. ieee80211_sta_ps_deliver_wakeup(sta);
  633. }
  634. --- a/net/mac80211/sta_info.h
  635. +++ b/net/mac80211/sta_info.h
  636. @@ -82,6 +82,7 @@ enum ieee80211_sta_info_flags {
  637. WLAN_STA_TOFFSET_KNOWN,
  638. WLAN_STA_MPSP_OWNER,
  639. WLAN_STA_MPSP_RECIPIENT,
  640. + WLAN_STA_PS_DELIVER,
  641. };
  642. #define ADDBA_RESP_INTERVAL HZ
  643. @@ -265,7 +266,7 @@ struct ieee80211_tx_latency_stat {
  644. * @last_rx_rate_vht_nss: rx status nss of last data packet
  645. * @lock: used for locking all fields that require locking, see comments
  646. * in the header file.
  647. - * @drv_unblock_wk: used for driver PS unblocking
  648. + * @drv_deliver_wk: used for delivering frames after driver PS unblocking
  649. * @listen_interval: listen interval of this station, when we're acting as AP
  650. * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly
  651. * @ps_lock: used for powersave (when mac80211 is the AP) related locking
  652. @@ -278,7 +279,6 @@ struct ieee80211_tx_latency_stat {
  653. * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
  654. * @rx_packets: Number of MSDUs received from this STA
  655. * @rx_bytes: Number of bytes received from this STA
  656. - * @wep_weak_iv_count: number of weak WEP IVs received from this station
  657. * @last_rx: time (in jiffies) when last frame was received from this STA
  658. * @last_connected: time (in seconds) when a station got connected
  659. * @num_duplicates: number of duplicate frames received from this STA
  660. @@ -345,7 +345,7 @@ struct sta_info {
  661. void *rate_ctrl_priv;
  662. spinlock_t lock;
  663. - struct work_struct drv_unblock_wk;
  664. + struct work_struct drv_deliver_wk;
  665. u16 listen_interval;
  666. @@ -367,7 +367,6 @@ struct sta_info {
  667. /* Updated from RX path only, no locking requirements */
  668. unsigned long rx_packets;
  669. u64 rx_bytes;
  670. - unsigned long wep_weak_iv_count;
  671. unsigned long last_rx;
  672. long last_connected;
  673. unsigned long num_duplicates;
  674. @@ -628,6 +627,8 @@ void sta_set_rate_info_tx(struct sta_inf
  675. struct rate_info *rinfo);
  676. void sta_set_rate_info_rx(struct sta_info *sta,
  677. struct rate_info *rinfo);
  678. +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo);
  679. +
  680. void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
  681. unsigned long exp_time);
  682. u8 sta_info_tx_streams(struct sta_info *sta);
  683. --- a/net/mac80211/tx.c
  684. +++ b/net/mac80211/tx.c
  685. @@ -469,7 +469,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
  686. return TX_CONTINUE;
  687. if (unlikely((test_sta_flag(sta, WLAN_STA_PS_STA) ||
  688. - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) &&
  689. + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
  690. + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) &&
  691. !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {
  692. int ac = skb_get_queue_mapping(tx->skb);
  693. @@ -486,7 +487,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
  694. * ahead and Tx the packet.
  695. */
  696. if (!test_sta_flag(sta, WLAN_STA_PS_STA) &&
  697. - !test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
  698. + !test_sta_flag(sta, WLAN_STA_PS_DRIVER) &&
  699. + !test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
  700. spin_unlock(&sta->ps_lock);
  701. return TX_CONTINUE;
  702. }
  703. @@ -1618,12 +1620,12 @@ netdev_tx_t ieee80211_monitor_start_xmit
  704. {
  705. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  706. struct ieee80211_chanctx_conf *chanctx_conf;
  707. - struct ieee80211_channel *chan;
  708. struct ieee80211_radiotap_header *prthdr =
  709. (struct ieee80211_radiotap_header *)skb->data;
  710. struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  711. struct ieee80211_hdr *hdr;
  712. struct ieee80211_sub_if_data *tmp_sdata, *sdata;
  713. + struct cfg80211_chan_def *chandef;
  714. u16 len_rthdr;
  715. int hdrlen;
  716. @@ -1721,9 +1723,9 @@ netdev_tx_t ieee80211_monitor_start_xmit
  717. }
  718. if (chanctx_conf)
  719. - chan = chanctx_conf->def.chan;
  720. + chandef = &chanctx_conf->def;
  721. else if (!local->use_chanctx)
  722. - chan = local->_oper_chandef.chan;
  723. + chandef = &local->_oper_chandef;
  724. else
  725. goto fail_rcu;
  726. @@ -1743,10 +1745,11 @@ netdev_tx_t ieee80211_monitor_start_xmit
  727. * radar detection by itself. We can do that later by adding a
  728. * monitor flag interfaces used for AP support.
  729. */
  730. - if ((chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR)))
  731. + if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
  732. + sdata->vif.type))
  733. goto fail_rcu;
  734. - ieee80211_xmit(sdata, skb, chan->band);
  735. + ieee80211_xmit(sdata, skb, chandef->chan->band);
  736. rcu_read_unlock();
  737. return NETDEV_TX_OK;
  738. @@ -2425,7 +2428,7 @@ static void ieee80211_set_csa(struct iee
  739. u8 *beacon_data;
  740. size_t beacon_data_len;
  741. int i;
  742. - u8 count = sdata->csa_current_counter;
  743. + u8 count = beacon->csa_current_counter;
  744. switch (sdata->vif.type) {
  745. case NL80211_IFTYPE_AP:
  746. @@ -2444,46 +2447,54 @@ static void ieee80211_set_csa(struct iee
  747. return;
  748. }
  749. + rcu_read_lock();
  750. for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; ++i) {
  751. - u16 counter_offset_beacon =
  752. - sdata->csa_counter_offset_beacon[i];
  753. - u16 counter_offset_presp = sdata->csa_counter_offset_presp[i];
  754. -
  755. - if (counter_offset_beacon) {
  756. - if (WARN_ON(counter_offset_beacon >= beacon_data_len))
  757. - return;
  758. -
  759. - beacon_data[counter_offset_beacon] = count;
  760. - }
  761. -
  762. - if (sdata->vif.type == NL80211_IFTYPE_AP &&
  763. - counter_offset_presp) {
  764. - rcu_read_lock();
  765. - resp = rcu_dereference(sdata->u.ap.probe_resp);
  766. + resp = rcu_dereference(sdata->u.ap.probe_resp);
  767. - /* If nl80211 accepted the offset, this should
  768. - * not happen.
  769. - */
  770. - if (WARN_ON(!resp)) {
  771. + if (beacon->csa_counter_offsets[i]) {
  772. + if (WARN_ON_ONCE(beacon->csa_counter_offsets[i] >=
  773. + beacon_data_len)) {
  774. rcu_read_unlock();
  775. return;
  776. }
  777. - resp->data[counter_offset_presp] = count;
  778. - rcu_read_unlock();
  779. +
  780. + beacon_data[beacon->csa_counter_offsets[i]] = count;
  781. }
  782. +
  783. + if (sdata->vif.type == NL80211_IFTYPE_AP && resp &&
  784. + resp->csa_counter_offsets)
  785. + resp->data[resp->csa_counter_offsets[i]] = count;
  786. }
  787. + rcu_read_unlock();
  788. }
  789. u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
  790. {
  791. struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
  792. + struct beacon_data *beacon = NULL;
  793. + u8 count = 0;
  794. +
  795. + rcu_read_lock();
  796. +
  797. + if (sdata->vif.type == NL80211_IFTYPE_AP)
  798. + beacon = rcu_dereference(sdata->u.ap.beacon);
  799. + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
  800. + beacon = rcu_dereference(sdata->u.ibss.presp);
  801. + else if (ieee80211_vif_is_mesh(&sdata->vif))
  802. + beacon = rcu_dereference(sdata->u.mesh.beacon);
  803. +
  804. + if (!beacon)
  805. + goto unlock;
  806. - sdata->csa_current_counter--;
  807. + beacon->csa_current_counter--;
  808. /* the counter should never reach 0 */
  809. - WARN_ON(!sdata->csa_current_counter);
  810. + WARN_ON_ONCE(!beacon->csa_current_counter);
  811. + count = beacon->csa_current_counter;
  812. - return sdata->csa_current_counter;
  813. +unlock:
  814. + rcu_read_unlock();
  815. + return count;
  816. }
  817. EXPORT_SYMBOL(ieee80211_csa_update_counter);
  818. @@ -2493,7 +2504,6 @@ bool ieee80211_csa_is_complete(struct ie
  819. struct beacon_data *beacon = NULL;
  820. u8 *beacon_data;
  821. size_t beacon_data_len;
  822. - int counter_beacon = sdata->csa_counter_offset_beacon[0];
  823. int ret = false;
  824. if (!ieee80211_sdata_running(sdata))
  825. @@ -2531,10 +2541,13 @@ bool ieee80211_csa_is_complete(struct ie
  826. goto out;
  827. }
  828. - if (WARN_ON(counter_beacon > beacon_data_len))
  829. + if (!beacon->csa_counter_offsets[0])
  830. + goto out;
  831. +
  832. + if (WARN_ON_ONCE(beacon->csa_counter_offsets[0] > beacon_data_len))
  833. goto out;
  834. - if (beacon_data[counter_beacon] == 1)
  835. + if (beacon_data[beacon->csa_counter_offsets[0]] == 1)
  836. ret = true;
  837. out:
  838. rcu_read_unlock();
  839. @@ -2550,6 +2563,7 @@ __ieee80211_beacon_get(struct ieee80211_
  840. bool is_template)
  841. {
  842. struct ieee80211_local *local = hw_to_local(hw);
  843. + struct beacon_data *beacon = NULL;
  844. struct sk_buff *skb = NULL;
  845. struct ieee80211_tx_info *info;
  846. struct ieee80211_sub_if_data *sdata = NULL;
  847. @@ -2571,10 +2585,10 @@ __ieee80211_beacon_get(struct ieee80211_
  848. if (sdata->vif.type == NL80211_IFTYPE_AP) {
  849. struct ieee80211_if_ap *ap = &sdata->u.ap;
  850. - struct beacon_data *beacon = rcu_dereference(ap->beacon);
  851. + beacon = rcu_dereference(ap->beacon);
  852. if (beacon) {
  853. - if (sdata->vif.csa_active) {
  854. + if (beacon->csa_counter_offsets[0]) {
  855. if (!is_template)
  856. ieee80211_csa_update_counter(vif);
  857. @@ -2615,37 +2629,37 @@ __ieee80211_beacon_get(struct ieee80211_
  858. } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
  859. struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
  860. struct ieee80211_hdr *hdr;
  861. - struct beacon_data *presp = rcu_dereference(ifibss->presp);
  862. - if (!presp)
  863. + beacon = rcu_dereference(ifibss->presp);
  864. + if (!beacon)
  865. goto out;
  866. - if (sdata->vif.csa_active) {
  867. + if (beacon->csa_counter_offsets[0]) {
  868. if (!is_template)
  869. ieee80211_csa_update_counter(vif);
  870. - ieee80211_set_csa(sdata, presp);
  871. + ieee80211_set_csa(sdata, beacon);
  872. }
  873. - skb = dev_alloc_skb(local->tx_headroom + presp->head_len +
  874. + skb = dev_alloc_skb(local->tx_headroom + beacon->head_len +
  875. local->hw.extra_beacon_tailroom);
  876. if (!skb)
  877. goto out;
  878. skb_reserve(skb, local->tx_headroom);
  879. - memcpy(skb_put(skb, presp->head_len), presp->head,
  880. - presp->head_len);
  881. + memcpy(skb_put(skb, beacon->head_len), beacon->head,
  882. + beacon->head_len);
  883. hdr = (struct ieee80211_hdr *) skb->data;
  884. hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
  885. IEEE80211_STYPE_BEACON);
  886. } else if (ieee80211_vif_is_mesh(&sdata->vif)) {
  887. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  888. - struct beacon_data *bcn = rcu_dereference(ifmsh->beacon);
  889. - if (!bcn)
  890. + beacon = rcu_dereference(ifmsh->beacon);
  891. + if (!beacon)
  892. goto out;
  893. - if (sdata->vif.csa_active) {
  894. + if (beacon->csa_counter_offsets[0]) {
  895. if (!is_template)
  896. /* TODO: For mesh csa_counter is in TU, so
  897. * decrementing it by one isn't correct, but
  898. @@ -2654,40 +2668,42 @@ __ieee80211_beacon_get(struct ieee80211_
  899. */
  900. ieee80211_csa_update_counter(vif);
  901. - ieee80211_set_csa(sdata, bcn);
  902. + ieee80211_set_csa(sdata, beacon);
  903. }
  904. if (ifmsh->sync_ops)
  905. - ifmsh->sync_ops->adjust_tbtt(sdata, bcn);
  906. + ifmsh->sync_ops->adjust_tbtt(sdata, beacon);
  907. skb = dev_alloc_skb(local->tx_headroom +
  908. - bcn->head_len +
  909. + beacon->head_len +
  910. 256 + /* TIM IE */
  911. - bcn->tail_len +
  912. + beacon->tail_len +
  913. local->hw.extra_beacon_tailroom);
  914. if (!skb)
  915. goto out;
  916. skb_reserve(skb, local->tx_headroom);
  917. - memcpy(skb_put(skb, bcn->head_len), bcn->head, bcn->head_len);
  918. + memcpy(skb_put(skb, beacon->head_len), beacon->head,
  919. + beacon->head_len);
  920. ieee80211_beacon_add_tim(sdata, &ifmsh->ps, skb, is_template);
  921. if (offs) {
  922. - offs->tim_offset = bcn->head_len;
  923. - offs->tim_length = skb->len - bcn->head_len;
  924. + offs->tim_offset = beacon->head_len;
  925. + offs->tim_length = skb->len - beacon->head_len;
  926. }
  927. - memcpy(skb_put(skb, bcn->tail_len), bcn->tail, bcn->tail_len);
  928. + memcpy(skb_put(skb, beacon->tail_len), beacon->tail,
  929. + beacon->tail_len);
  930. } else {
  931. WARN_ON(1);
  932. goto out;
  933. }
  934. /* CSA offsets */
  935. - if (offs) {
  936. + if (offs && beacon) {
  937. int i;
  938. for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; i++) {
  939. - u16 csa_off = sdata->csa_counter_offset_beacon[i];
  940. + u16 csa_off = beacon->csa_counter_offsets[i];
  941. if (!csa_off)
  942. continue;
  943. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  944. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  945. @@ -947,6 +947,40 @@ static inline u8 rt2800_get_beacon_offse
  946. return BEACON_BASE_TO_OFFSET(rt2800_hw_beacon_base(rt2x00dev, index));
  947. }
  948. +static void rt2800_update_beacons_setup(struct rt2x00_dev *rt2x00dev)
  949. +{
  950. + struct data_queue *queue = rt2x00dev->bcn;
  951. + struct queue_entry *entry;
  952. + int i, bcn_num = 0;
  953. + u64 off, reg = 0;
  954. + u32 bssid_dw1;
  955. +
  956. + /*
  957. + * Setup offsets of all active beacons in BCN_OFFSET{0,1} registers.
  958. + */
  959. + for (i = 0; i < queue->limit; i++) {
  960. + entry = &queue->entries[i];
  961. + if (!test_bit(ENTRY_BCN_ENABLED, &entry->flags))
  962. + continue;
  963. + off = rt2800_get_beacon_offset(rt2x00dev, entry->entry_idx);
  964. + reg |= off << (8 * bcn_num);
  965. + bcn_num++;
  966. + }
  967. +
  968. + WARN_ON_ONCE(bcn_num != rt2x00dev->intf_beaconing);
  969. +
  970. + rt2800_register_write(rt2x00dev, BCN_OFFSET0, (u32) reg);
  971. + rt2800_register_write(rt2x00dev, BCN_OFFSET1, (u32) (reg >> 32));
  972. +
  973. + /*
  974. + * H/W sends up to MAC_BSSID_DW1_BSS_BCN_NUM + 1 consecutive beacons.
  975. + */
  976. + rt2800_register_read(rt2x00dev, MAC_BSSID_DW1, &bssid_dw1);
  977. + rt2x00_set_field32(&bssid_dw1, MAC_BSSID_DW1_BSS_BCN_NUM,
  978. + bcn_num > 0 ? bcn_num - 1 : 0);
  979. + rt2800_register_write(rt2x00dev, MAC_BSSID_DW1, bssid_dw1);
  980. +}
  981. +
  982. void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)
  983. {
  984. struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
  985. @@ -1003,6 +1037,12 @@ void rt2800_write_beacon(struct queue_en
  986. rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data,
  987. entry->skb->len + padding_len);
  988. + __set_bit(ENTRY_BCN_ENABLED, &entry->flags);
  989. +
  990. + /*
  991. + * Change global beacons settings.
  992. + */
  993. + rt2800_update_beacons_setup(rt2x00dev);
  994. /*
  995. * Restore beaconing state.
  996. @@ -1053,8 +1093,13 @@ void rt2800_clear_beacon(struct queue_en
  997. * Clear beacon.
  998. */
  999. rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx);
  1000. + __clear_bit(ENTRY_BCN_ENABLED, &entry->flags);
  1001. /*
  1002. + * Change global beacons settings.
  1003. + */
  1004. + rt2800_update_beacons_setup(rt2x00dev);
  1005. + /*
  1006. * Restore beaconing state.
  1007. */
  1008. rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg);
  1009. @@ -1556,7 +1601,7 @@ void rt2800_config_intf(struct rt2x00_de
  1010. if (!is_zero_ether_addr((const u8 *)conf->bssid)) {
  1011. reg = le32_to_cpu(conf->bssid[1]);
  1012. rt2x00_set_field32(&reg, MAC_BSSID_DW1_BSS_ID_MASK, 3);
  1013. - rt2x00_set_field32(&reg, MAC_BSSID_DW1_BSS_BCN_NUM, 7);
  1014. + rt2x00_set_field32(&reg, MAC_BSSID_DW1_BSS_BCN_NUM, 0);
  1015. conf->bssid[1] = cpu_to_le32(reg);
  1016. }
  1017. @@ -4517,28 +4562,6 @@ static int rt2800_init_registers(struct
  1018. if (ret)
  1019. return ret;
  1020. - rt2800_register_read(rt2x00dev, BCN_OFFSET0, &reg);
  1021. - rt2x00_set_field32(&reg, BCN_OFFSET0_BCN0,
  1022. - rt2800_get_beacon_offset(rt2x00dev, 0));
  1023. - rt2x00_set_field32(&reg, BCN_OFFSET0_BCN1,
  1024. - rt2800_get_beacon_offset(rt2x00dev, 1));
  1025. - rt2x00_set_field32(&reg, BCN_OFFSET0_BCN2,
  1026. - rt2800_get_beacon_offset(rt2x00dev, 2));
  1027. - rt2x00_set_field32(&reg, BCN_OFFSET0_BCN3,
  1028. - rt2800_get_beacon_offset(rt2x00dev, 3));
  1029. - rt2800_register_write(rt2x00dev, BCN_OFFSET0, reg);
  1030. -
  1031. - rt2800_register_read(rt2x00dev, BCN_OFFSET1, &reg);
  1032. - rt2x00_set_field32(&reg, BCN_OFFSET1_BCN4,
  1033. - rt2800_get_beacon_offset(rt2x00dev, 4));
  1034. - rt2x00_set_field32(&reg, BCN_OFFSET1_BCN5,
  1035. - rt2800_get_beacon_offset(rt2x00dev, 5));
  1036. - rt2x00_set_field32(&reg, BCN_OFFSET1_BCN6,
  1037. - rt2800_get_beacon_offset(rt2x00dev, 6));
  1038. - rt2x00_set_field32(&reg, BCN_OFFSET1_BCN7,
  1039. - rt2800_get_beacon_offset(rt2x00dev, 7));
  1040. - rt2800_register_write(rt2x00dev, BCN_OFFSET1, reg);
  1041. -
  1042. rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f);
  1043. rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003);
  1044. --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  1045. +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  1046. @@ -141,8 +141,11 @@ static void rt2x00lib_intf_scheduled_ite
  1047. if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
  1048. return;
  1049. - if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags))
  1050. + if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags)) {
  1051. + mutex_lock(&intf->beacon_skb_mutex);
  1052. rt2x00queue_update_beacon(rt2x00dev, vif);
  1053. + mutex_unlock(&intf->beacon_skb_mutex);
  1054. + }
  1055. }
  1056. static void rt2x00lib_intf_scheduled(struct work_struct *work)
  1057. @@ -216,7 +219,7 @@ static void rt2x00lib_beaconupdate_iter(
  1058. * never be called for USB devices.
  1059. */
  1060. WARN_ON(rt2x00_is_usb(rt2x00dev));
  1061. - rt2x00queue_update_beacon_locked(rt2x00dev, vif);
  1062. + rt2x00queue_update_beacon(rt2x00dev, vif);
  1063. }
  1064. void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
  1065. --- a/drivers/net/wireless/rt2x00/rt2x00mac.c
  1066. +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
  1067. @@ -624,25 +624,24 @@ void rt2x00mac_bss_info_changed(struct i
  1068. * Start/stop beaconing.
  1069. */
  1070. if (changes & BSS_CHANGED_BEACON_ENABLED) {
  1071. + mutex_lock(&intf->beacon_skb_mutex);
  1072. if (!bss_conf->enable_beacon && intf->enable_beacon) {
  1073. rt2x00dev->intf_beaconing--;
  1074. intf->enable_beacon = false;
  1075. - /*
  1076. - * Clear beacon in the H/W for this vif. This is needed
  1077. - * to disable beaconing on this particular interface
  1078. - * and keep it running on other interfaces.
  1079. - */
  1080. - rt2x00queue_clear_beacon(rt2x00dev, vif);
  1081. if (rt2x00dev->intf_beaconing == 0) {
  1082. /*
  1083. * Last beaconing interface disabled
  1084. * -> stop beacon queue.
  1085. */
  1086. - mutex_lock(&intf->beacon_skb_mutex);
  1087. rt2x00queue_stop_queue(rt2x00dev->bcn);
  1088. - mutex_unlock(&intf->beacon_skb_mutex);
  1089. }
  1090. + /*
  1091. + * Clear beacon in the H/W for this vif. This is needed
  1092. + * to disable beaconing on this particular interface
  1093. + * and keep it running on other interfaces.
  1094. + */
  1095. + rt2x00queue_clear_beacon(rt2x00dev, vif);
  1096. } else if (bss_conf->enable_beacon && !intf->enable_beacon) {
  1097. rt2x00dev->intf_beaconing++;
  1098. intf->enable_beacon = true;
  1099. @@ -658,11 +657,10 @@ void rt2x00mac_bss_info_changed(struct i
  1100. * First beaconing interface enabled
  1101. * -> start beacon queue.
  1102. */
  1103. - mutex_lock(&intf->beacon_skb_mutex);
  1104. rt2x00queue_start_queue(rt2x00dev->bcn);
  1105. - mutex_unlock(&intf->beacon_skb_mutex);
  1106. }
  1107. }
  1108. + mutex_unlock(&intf->beacon_skb_mutex);
  1109. }
  1110. /*
  1111. --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
  1112. +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
  1113. @@ -754,8 +754,6 @@ int rt2x00queue_clear_beacon(struct rt2x
  1114. if (unlikely(!intf->beacon))
  1115. return -ENOBUFS;
  1116. - mutex_lock(&intf->beacon_skb_mutex);
  1117. -
  1118. /*
  1119. * Clean up the beacon skb.
  1120. */
  1121. @@ -768,13 +766,11 @@ int rt2x00queue_clear_beacon(struct rt2x
  1122. if (rt2x00dev->ops->lib->clear_beacon)
  1123. rt2x00dev->ops->lib->clear_beacon(intf->beacon);
  1124. - mutex_unlock(&intf->beacon_skb_mutex);
  1125. -
  1126. return 0;
  1127. }
  1128. -int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
  1129. - struct ieee80211_vif *vif)
  1130. +int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
  1131. + struct ieee80211_vif *vif)
  1132. {
  1133. struct rt2x00_intf *intf = vif_to_intf(vif);
  1134. struct skb_frame_desc *skbdesc;
  1135. @@ -815,19 +811,6 @@ int rt2x00queue_update_beacon_locked(str
  1136. }
  1137. -int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
  1138. - struct ieee80211_vif *vif)
  1139. -{
  1140. - struct rt2x00_intf *intf = vif_to_intf(vif);
  1141. - int ret;
  1142. -
  1143. - mutex_lock(&intf->beacon_skb_mutex);
  1144. - ret = rt2x00queue_update_beacon_locked(rt2x00dev, vif);
  1145. - mutex_unlock(&intf->beacon_skb_mutex);
  1146. -
  1147. - return ret;
  1148. -}
  1149. -
  1150. bool rt2x00queue_for_each_entry(struct data_queue *queue,
  1151. enum queue_index start,
  1152. enum queue_index end,
  1153. --- a/drivers/net/wireless/rt2x00/rt2x00queue.h
  1154. +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
  1155. @@ -353,6 +353,7 @@ struct txentry_desc {
  1156. */
  1157. enum queue_entry_flags {
  1158. ENTRY_BCN_ASSIGNED,
  1159. + ENTRY_BCN_ENABLED,
  1160. ENTRY_OWNER_DEVICE_DATA,
  1161. ENTRY_DATA_PENDING,
  1162. ENTRY_DATA_IO_FAILED,
  1163. --- a/drivers/net/wireless/ath/ath9k/main.c
  1164. +++ b/drivers/net/wireless/ath/ath9k/main.c
  1165. @@ -1757,7 +1757,6 @@ out:
  1166. void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
  1167. {
  1168. struct ath_vif *avp = (void *)vif->drv_priv;
  1169. - unsigned long flags;
  1170. u32 tsf;
  1171. if (!sc->p2p_ps_timer)
  1172. @@ -1767,14 +1766,9 @@ void ath9k_update_p2p_ps(struct ath_soft
  1173. return;
  1174. sc->p2p_ps_vif = avp;
  1175. -
  1176. - spin_lock_irqsave(&sc->sc_pm_lock, flags);
  1177. - if (!(sc->ps_flags & PS_BEACON_SYNC)) {
  1178. - tsf = ath9k_hw_gettsf32(sc->sc_ah);
  1179. - ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
  1180. - ath9k_update_p2p_ps_timer(sc, avp);
  1181. - }
  1182. - spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  1183. + tsf = ath9k_hw_gettsf32(sc->sc_ah);
  1184. + ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
  1185. + ath9k_update_p2p_ps_timer(sc, avp);
  1186. }
  1187. static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
  1188. @@ -1791,6 +1785,7 @@ static void ath9k_bss_info_changed(struc
  1189. struct ath_hw *ah = sc->sc_ah;
  1190. struct ath_common *common = ath9k_hw_common(ah);
  1191. struct ath_vif *avp = (void *)vif->drv_priv;
  1192. + unsigned long flags;
  1193. int slottime;
  1194. ath9k_ps_wakeup(sc);
  1195. @@ -1853,7 +1848,10 @@ static void ath9k_bss_info_changed(struc
  1196. if (changed & BSS_CHANGED_P2P_PS) {
  1197. spin_lock_bh(&sc->sc_pcu_lock);
  1198. - ath9k_update_p2p_ps(sc, vif);
  1199. + spin_lock_irqsave(&sc->sc_pm_lock, flags);
  1200. + if (!(sc->ps_flags & PS_BEACON_SYNC))
  1201. + ath9k_update_p2p_ps(sc, vif);
  1202. + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  1203. spin_unlock_bh(&sc->sc_pcu_lock);
  1204. }
  1205. @@ -2232,14 +2230,6 @@ static void ath9k_sw_scan_complete(struc
  1206. clear_bit(ATH_OP_SCANNING, &common->op_flags);
  1207. }
  1208. -static void ath9k_channel_switch_beacon(struct ieee80211_hw *hw,
  1209. - struct ieee80211_vif *vif,
  1210. - struct cfg80211_chan_def *chandef)
  1211. -{
  1212. - /* depend on vif->csa_active only */
  1213. - return;
  1214. -}
  1215. -
  1216. struct ieee80211_ops ath9k_ops = {
  1217. .tx = ath9k_tx,
  1218. .start = ath9k_start,
  1219. @@ -2287,5 +2277,4 @@ struct ieee80211_ops ath9k_ops = {
  1220. #endif
  1221. .sw_scan_start = ath9k_sw_scan_start,
  1222. .sw_scan_complete = ath9k_sw_scan_complete,
  1223. - .channel_switch_beacon = ath9k_channel_switch_beacon,
  1224. };
  1225. --- a/drivers/net/wireless/ath/ath10k/mac.c
  1226. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  1227. @@ -4142,14 +4142,6 @@ static int ath10k_set_bitrate_mask(struc
  1228. fixed_nss, force_sgi);
  1229. }
  1230. -static void ath10k_channel_switch_beacon(struct ieee80211_hw *hw,
  1231. - struct ieee80211_vif *vif,
  1232. - struct cfg80211_chan_def *chandef)
  1233. -{
  1234. - /* there's no need to do anything here. vif->csa_active is enough */
  1235. - return;
  1236. -}
  1237. -
  1238. static void ath10k_sta_rc_update(struct ieee80211_hw *hw,
  1239. struct ieee80211_vif *vif,
  1240. struct ieee80211_sta *sta,
  1241. @@ -4256,7 +4248,6 @@ static const struct ieee80211_ops ath10k
  1242. .restart_complete = ath10k_restart_complete,
  1243. .get_survey = ath10k_get_survey,
  1244. .set_bitrate_mask = ath10k_set_bitrate_mask,
  1245. - .channel_switch_beacon = ath10k_channel_switch_beacon,
  1246. .sta_rc_update = ath10k_sta_rc_update,
  1247. .get_tsf = ath10k_get_tsf,
  1248. #ifdef CONFIG_PM
  1249. --- a/net/mac80211/cfg.c
  1250. +++ b/net/mac80211/cfg.c
  1251. @@ -468,327 +468,6 @@ void sta_set_rate_info_rx(struct sta_inf
  1252. rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH;
  1253. }
  1254. -static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
  1255. -{
  1256. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  1257. - struct ieee80211_local *local = sdata->local;
  1258. - struct rate_control_ref *ref = local->rate_ctrl;
  1259. - struct timespec uptime;
  1260. - u64 packets = 0;
  1261. - u32 thr = 0;
  1262. - int i, ac;
  1263. -
  1264. - sinfo->generation = sdata->local->sta_generation;
  1265. -
  1266. - sinfo->filled = STATION_INFO_INACTIVE_TIME |
  1267. - STATION_INFO_RX_BYTES64 |
  1268. - STATION_INFO_TX_BYTES64 |
  1269. - STATION_INFO_RX_PACKETS |
  1270. - STATION_INFO_TX_PACKETS |
  1271. - STATION_INFO_TX_RETRIES |
  1272. - STATION_INFO_TX_FAILED |
  1273. - STATION_INFO_TX_BITRATE |
  1274. - STATION_INFO_RX_BITRATE |
  1275. - STATION_INFO_RX_DROP_MISC |
  1276. - STATION_INFO_BSS_PARAM |
  1277. - STATION_INFO_CONNECTED_TIME |
  1278. - STATION_INFO_STA_FLAGS |
  1279. - STATION_INFO_BEACON_LOSS_COUNT;
  1280. -
  1281. - do_posix_clock_monotonic_gettime(&uptime);
  1282. - sinfo->connected_time = uptime.tv_sec - sta->last_connected;
  1283. -
  1284. - sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
  1285. - sinfo->tx_bytes = 0;
  1286. - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
  1287. - sinfo->tx_bytes += sta->tx_bytes[ac];
  1288. - packets += sta->tx_packets[ac];
  1289. - }
  1290. - sinfo->tx_packets = packets;
  1291. - sinfo->rx_bytes = sta->rx_bytes;
  1292. - sinfo->rx_packets = sta->rx_packets;
  1293. - sinfo->tx_retries = sta->tx_retry_count;
  1294. - sinfo->tx_failed = sta->tx_retry_failed;
  1295. - sinfo->rx_dropped_misc = sta->rx_dropped;
  1296. - sinfo->beacon_loss_count = sta->beacon_loss_count;
  1297. -
  1298. - if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
  1299. - (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
  1300. - sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
  1301. - if (!local->ops->get_rssi ||
  1302. - drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
  1303. - sinfo->signal = (s8)sta->last_signal;
  1304. - sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
  1305. - }
  1306. - if (sta->chains) {
  1307. - sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
  1308. - STATION_INFO_CHAIN_SIGNAL_AVG;
  1309. -
  1310. - sinfo->chains = sta->chains;
  1311. - for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
  1312. - sinfo->chain_signal[i] = sta->chain_signal_last[i];
  1313. - sinfo->chain_signal_avg[i] =
  1314. - (s8) -ewma_read(&sta->chain_signal_avg[i]);
  1315. - }
  1316. - }
  1317. -
  1318. - sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
  1319. - sta_set_rate_info_rx(sta, &sinfo->rxrate);
  1320. -
  1321. - if (ieee80211_vif_is_mesh(&sdata->vif)) {
  1322. -#ifdef CPTCFG_MAC80211_MESH
  1323. - sinfo->filled |= STATION_INFO_LLID |
  1324. - STATION_INFO_PLID |
  1325. - STATION_INFO_PLINK_STATE |
  1326. - STATION_INFO_LOCAL_PM |
  1327. - STATION_INFO_PEER_PM |
  1328. - STATION_INFO_NONPEER_PM;
  1329. -
  1330. - sinfo->llid = sta->llid;
  1331. - sinfo->plid = sta->plid;
  1332. - sinfo->plink_state = sta->plink_state;
  1333. - if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
  1334. - sinfo->filled |= STATION_INFO_T_OFFSET;
  1335. - sinfo->t_offset = sta->t_offset;
  1336. - }
  1337. - sinfo->local_pm = sta->local_pm;
  1338. - sinfo->peer_pm = sta->peer_pm;
  1339. - sinfo->nonpeer_pm = sta->nonpeer_pm;
  1340. -#endif
  1341. - }
  1342. -
  1343. - sinfo->bss_param.flags = 0;
  1344. - if (sdata->vif.bss_conf.use_cts_prot)
  1345. - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
  1346. - if (sdata->vif.bss_conf.use_short_preamble)
  1347. - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
  1348. - if (sdata->vif.bss_conf.use_short_slot)
  1349. - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
  1350. - sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
  1351. - sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
  1352. -
  1353. - sinfo->sta_flags.set = 0;
  1354. - sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
  1355. - BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
  1356. - BIT(NL80211_STA_FLAG_WME) |
  1357. - BIT(NL80211_STA_FLAG_MFP) |
  1358. - BIT(NL80211_STA_FLAG_AUTHENTICATED) |
  1359. - BIT(NL80211_STA_FLAG_ASSOCIATED) |
  1360. - BIT(NL80211_STA_FLAG_TDLS_PEER);
  1361. - if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
  1362. - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
  1363. - if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
  1364. - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
  1365. - if (test_sta_flag(sta, WLAN_STA_WME))
  1366. - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
  1367. - if (test_sta_flag(sta, WLAN_STA_MFP))
  1368. - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
  1369. - if (test_sta_flag(sta, WLAN_STA_AUTH))
  1370. - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
  1371. - if (test_sta_flag(sta, WLAN_STA_ASSOC))
  1372. - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
  1373. - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
  1374. - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  1375. -
  1376. - /* check if the driver has a SW RC implementation */
  1377. - if (ref && ref->ops->get_expected_throughput)
  1378. - thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
  1379. - else
  1380. - thr = drv_get_expected_throughput(local, &sta->sta);
  1381. -
  1382. - if (thr != 0) {
  1383. - sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
  1384. - sinfo->expected_throughput = thr;
  1385. - }
  1386. -}
  1387. -
  1388. -static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
  1389. - "rx_packets", "rx_bytes", "wep_weak_iv_count",
  1390. - "rx_duplicates", "rx_fragments", "rx_dropped",
  1391. - "tx_packets", "tx_bytes", "tx_fragments",
  1392. - "tx_filtered", "tx_retry_failed", "tx_retries",
  1393. - "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
  1394. - "channel", "noise", "ch_time", "ch_time_busy",
  1395. - "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
  1396. -};
  1397. -#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
  1398. -
  1399. -static int ieee80211_get_et_sset_count(struct wiphy *wiphy,
  1400. - struct net_device *dev,
  1401. - int sset)
  1402. -{
  1403. - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  1404. - int rv = 0;
  1405. -
  1406. - if (sset == ETH_SS_STATS)
  1407. - rv += STA_STATS_LEN;
  1408. -
  1409. - rv += drv_get_et_sset_count(sdata, sset);
  1410. -
  1411. - if (rv == 0)
  1412. - return -EOPNOTSUPP;
  1413. - return rv;
  1414. -}
  1415. -
  1416. -static void ieee80211_get_et_stats(struct wiphy *wiphy,
  1417. - struct net_device *dev,
  1418. - struct ethtool_stats *stats,
  1419. - u64 *data)
  1420. -{
  1421. - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  1422. - struct ieee80211_chanctx_conf *chanctx_conf;
  1423. - struct ieee80211_channel *channel;
  1424. - struct sta_info *sta;
  1425. - struct ieee80211_local *local = sdata->local;
  1426. - struct station_info sinfo;
  1427. - struct survey_info survey;
  1428. - int i, q;
  1429. -#define STA_STATS_SURVEY_LEN 7
  1430. -
  1431. - memset(data, 0, sizeof(u64) * STA_STATS_LEN);
  1432. -
  1433. -#define ADD_STA_STATS(sta) \
  1434. - do { \
  1435. - data[i++] += sta->rx_packets; \
  1436. - data[i++] += sta->rx_bytes; \
  1437. - data[i++] += sta->wep_weak_iv_count; \
  1438. - data[i++] += sta->num_duplicates; \
  1439. - data[i++] += sta->rx_fragments; \
  1440. - data[i++] += sta->rx_dropped; \
  1441. - \
  1442. - data[i++] += sinfo.tx_packets; \
  1443. - data[i++] += sinfo.tx_bytes; \
  1444. - data[i++] += sta->tx_fragments; \
  1445. - data[i++] += sta->tx_filtered_count; \
  1446. - data[i++] += sta->tx_retry_failed; \
  1447. - data[i++] += sta->tx_retry_count; \
  1448. - data[i++] += sta->beacon_loss_count; \
  1449. - } while (0)
  1450. -
  1451. - /* For Managed stations, find the single station based on BSSID
  1452. - * and use that. For interface types, iterate through all available
  1453. - * stations and add stats for any station that is assigned to this
  1454. - * network device.
  1455. - */
  1456. -
  1457. - mutex_lock(&local->sta_mtx);
  1458. -
  1459. - if (sdata->vif.type == NL80211_IFTYPE_STATION) {
  1460. - sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
  1461. -
  1462. - if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
  1463. - goto do_survey;
  1464. -
  1465. - sinfo.filled = 0;
  1466. - sta_set_sinfo(sta, &sinfo);
  1467. -
  1468. - i = 0;
  1469. - ADD_STA_STATS(sta);
  1470. -
  1471. - data[i++] = sta->sta_state;
  1472. -
  1473. -
  1474. - if (sinfo.filled & STATION_INFO_TX_BITRATE)
  1475. - data[i] = 100000 *
  1476. - cfg80211_calculate_bitrate(&sinfo.txrate);
  1477. - i++;
  1478. - if (sinfo.filled & STATION_INFO_RX_BITRATE)
  1479. - data[i] = 100000 *
  1480. - cfg80211_calculate_bitrate(&sinfo.rxrate);
  1481. - i++;
  1482. -
  1483. - if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
  1484. - data[i] = (u8)sinfo.signal_avg;
  1485. - i++;
  1486. - } else {
  1487. - list_for_each_entry(sta, &local->sta_list, list) {
  1488. - /* Make sure this station belongs to the proper dev */
  1489. - if (sta->sdata->dev != dev)
  1490. - continue;
  1491. -
  1492. - sinfo.filled = 0;
  1493. - sta_set_sinfo(sta, &sinfo);
  1494. - i = 0;
  1495. - ADD_STA_STATS(sta);
  1496. - }
  1497. - }
  1498. -
  1499. -do_survey:
  1500. - i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
  1501. - /* Get survey stats for current channel */
  1502. - survey.filled = 0;
  1503. -
  1504. - rcu_read_lock();
  1505. - chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
  1506. - if (chanctx_conf)
  1507. - channel = chanctx_conf->def.chan;
  1508. - else
  1509. - channel = NULL;
  1510. - rcu_read_unlock();
  1511. -
  1512. - if (channel) {
  1513. - q = 0;
  1514. - do {
  1515. - survey.filled = 0;
  1516. - if (drv_get_survey(local, q, &survey) != 0) {
  1517. - survey.filled = 0;
  1518. - break;
  1519. - }
  1520. - q++;
  1521. - } while (channel != survey.channel);
  1522. - }
  1523. -
  1524. - if (survey.filled)
  1525. - data[i++] = survey.channel->center_freq;
  1526. - else
  1527. - data[i++] = 0;
  1528. - if (survey.filled & SURVEY_INFO_NOISE_DBM)
  1529. - data[i++] = (u8)survey.noise;
  1530. - else
  1531. - data[i++] = -1LL;
  1532. - if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
  1533. - data[i++] = survey.channel_time;
  1534. - else
  1535. - data[i++] = -1LL;
  1536. - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
  1537. - data[i++] = survey.channel_time_busy;
  1538. - else
  1539. - data[i++] = -1LL;
  1540. - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
  1541. - data[i++] = survey.channel_time_ext_busy;
  1542. - else
  1543. - data[i++] = -1LL;
  1544. - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
  1545. - data[i++] = survey.channel_time_rx;
  1546. - else
  1547. - data[i++] = -1LL;
  1548. - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
  1549. - data[i++] = survey.channel_time_tx;
  1550. - else
  1551. - data[i++] = -1LL;
  1552. -
  1553. - mutex_unlock(&local->sta_mtx);
  1554. -
  1555. - if (WARN_ON(i != STA_STATS_LEN))
  1556. - return;
  1557. -
  1558. - drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
  1559. -}
  1560. -
  1561. -static void ieee80211_get_et_strings(struct wiphy *wiphy,
  1562. - struct net_device *dev,
  1563. - u32 sset, u8 *data)
  1564. -{
  1565. - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  1566. - int sz_sta_stats = 0;
  1567. -
  1568. - if (sset == ETH_SS_STATS) {
  1569. - sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
  1570. - memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
  1571. - }
  1572. - drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
  1573. -}
  1574. -
  1575. static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
  1576. int idx, u8 *mac, struct station_info *sinfo)
  1577. {
  1578. @@ -875,7 +554,8 @@ static int ieee80211_set_monitor_channel
  1579. }
  1580. static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
  1581. - const u8 *resp, size_t resp_len)
  1582. + const u8 *resp, size_t resp_len,
  1583. + const struct ieee80211_csa_settings *csa)
  1584. {
  1585. struct probe_resp *new, *old;
  1586. @@ -891,6 +571,11 @@ static int ieee80211_set_probe_resp(stru
  1587. new->len = resp_len;
  1588. memcpy(new->data, resp, resp_len);
  1589. + if (csa)
  1590. + memcpy(new->csa_counter_offsets, csa->counter_offsets_presp,
  1591. + csa->n_counter_offsets_presp *
  1592. + sizeof(new->csa_counter_offsets[0]));
  1593. +
  1594. rcu_assign_pointer(sdata->u.ap.probe_resp, new);
  1595. if (old)
  1596. kfree_rcu(old, rcu_head);
  1597. @@ -899,7 +584,8 @@ static int ieee80211_set_probe_resp(stru
  1598. }
  1599. static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
  1600. - struct cfg80211_beacon_data *params)
  1601. + struct cfg80211_beacon_data *params,
  1602. + const struct ieee80211_csa_settings *csa)
  1603. {
  1604. struct beacon_data *new, *old;
  1605. int new_head_len, new_tail_len;
  1606. @@ -943,6 +629,13 @@ static int ieee80211_assign_beacon(struc
  1607. new->head_len = new_head_len;
  1608. new->tail_len = new_tail_len;
  1609. + if (csa) {
  1610. + new->csa_current_counter = csa->count;
  1611. + memcpy(new->csa_counter_offsets, csa->counter_offsets_beacon,
  1612. + csa->n_counter_offsets_beacon *
  1613. + sizeof(new->csa_counter_offsets[0]));
  1614. + }
  1615. +
  1616. /* copy in head */
  1617. if (params->head)
  1618. memcpy(new->head, params->head, new_head_len);
  1619. @@ -957,7 +650,7 @@ static int ieee80211_assign_beacon(struc
  1620. memcpy(new->tail, old->tail, new_tail_len);
  1621. err = ieee80211_set_probe_resp(sdata, params->probe_resp,
  1622. - params->probe_resp_len);
  1623. + params->probe_resp_len, csa);
  1624. if (err < 0)
  1625. return err;
  1626. if (err == 0)
  1627. @@ -1042,7 +735,7 @@ static int ieee80211_start_ap(struct wip
  1628. sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |=
  1629. IEEE80211_P2P_OPPPS_ENABLE_BIT;
  1630. - err = ieee80211_assign_beacon(sdata, &params->beacon);
  1631. + err = ieee80211_assign_beacon(sdata, &params->beacon, NULL);
  1632. if (err < 0) {
  1633. ieee80211_vif_release_channel(sdata);
  1634. return err;
  1635. @@ -1090,7 +783,7 @@ static int ieee80211_change_beacon(struc
  1636. if (!old)
  1637. return -ENOENT;
  1638. - err = ieee80211_assign_beacon(sdata, params);
  1639. + err = ieee80211_assign_beacon(sdata, params, NULL);
  1640. if (err < 0)
  1641. return err;
  1642. ieee80211_bss_info_change_notify(sdata, err);
  1643. @@ -3073,7 +2766,8 @@ static int ieee80211_set_after_csa_beaco
  1644. switch (sdata->vif.type) {
  1645. case NL80211_IFTYPE_AP:
  1646. - err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon);
  1647. + err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon,
  1648. + NULL);
  1649. kfree(sdata->u.ap.next_beacon);
  1650. sdata->u.ap.next_beacon = NULL;
  1651. @@ -3176,6 +2870,7 @@ static int ieee80211_set_csa_beacon(stru
  1652. struct cfg80211_csa_settings *params,
  1653. u32 *changed)
  1654. {
  1655. + struct ieee80211_csa_settings csa = {};
  1656. int err;
  1657. switch (sdata->vif.type) {
  1658. @@ -3210,20 +2905,13 @@ static int ieee80211_set_csa_beacon(stru
  1659. IEEE80211_MAX_CSA_COUNTERS_NUM))
  1660. return -EINVAL;
  1661. - /* make sure we don't have garbage in other counters */
  1662. - memset(sdata->csa_counter_offset_beacon, 0,
  1663. - sizeof(sdata->csa_counter_offset_beacon));
  1664. - memset(sdata->csa_counter_offset_presp, 0,
  1665. - sizeof(sdata->csa_counter_offset_presp));
  1666. -
  1667. - memcpy(sdata->csa_counter_offset_beacon,
  1668. - params->counter_offsets_beacon,
  1669. - params->n_counter_offsets_beacon * sizeof(u16));
  1670. - memcpy(sdata->csa_counter_offset_presp,
  1671. - params->counter_offsets_presp,
  1672. - params->n_counter_offsets_presp * sizeof(u16));
  1673. + csa.counter_offsets_beacon = params->counter_offsets_beacon;
  1674. + csa.counter_offsets_presp = params->counter_offsets_presp;
  1675. + csa.n_counter_offsets_beacon = params->n_counter_offsets_beacon;
  1676. + csa.n_counter_offsets_presp = params->n_counter_offsets_presp;
  1677. + csa.count = params->count;
  1678. - err = ieee80211_assign_beacon(sdata, &params->beacon_csa);
  1679. + err = ieee80211_assign_beacon(sdata, &params->beacon_csa, &csa);
  1680. if (err < 0) {
  1681. kfree(sdata->u.ap.next_beacon);
  1682. return err;
  1683. @@ -3367,7 +3055,6 @@ __ieee80211_channel_switch(struct wiphy
  1684. sdata->csa_radar_required = params->radar_required;
  1685. sdata->csa_chandef = params->chandef;
  1686. sdata->csa_block_tx = params->block_tx;
  1687. - sdata->csa_current_counter = params->count;
  1688. sdata->vif.csa_active = true;
  1689. if (sdata->csa_block_tx)
  1690. @@ -3515,10 +3202,23 @@ static int ieee80211_mgmt_tx(struct wiph
  1691. sdata->vif.type == NL80211_IFTYPE_ADHOC) &&
  1692. params->n_csa_offsets) {
  1693. int i;
  1694. - u8 c = sdata->csa_current_counter;
  1695. + struct beacon_data *beacon = NULL;
  1696. +
  1697. + rcu_read_lock();
  1698. - for (i = 0; i < params->n_csa_offsets; i++)
  1699. - data[params->csa_offsets[i]] = c;
  1700. + if (sdata->vif.type == NL80211_IFTYPE_AP)
  1701. + beacon = rcu_dereference(sdata->u.ap.beacon);
  1702. + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
  1703. + beacon = rcu_dereference(sdata->u.ibss.presp);
  1704. + else if (ieee80211_vif_is_mesh(&sdata->vif))
  1705. + beacon = rcu_dereference(sdata->u.mesh.beacon);
  1706. +
  1707. + if (beacon)
  1708. + for (i = 0; i < params->n_csa_offsets; i++)
  1709. + data[params->csa_offsets[i]] =
  1710. + beacon->csa_current_counter;
  1711. +
  1712. + rcu_read_unlock();
  1713. }
  1714. IEEE80211_SKB_CB(skb)->flags = flags;
  1715. @@ -3598,21 +3298,6 @@ static int ieee80211_get_antenna(struct
  1716. return drv_get_antenna(local, tx_ant, rx_ant);
  1717. }
  1718. -static int ieee80211_set_ringparam(struct wiphy *wiphy, u32 tx, u32 rx)
  1719. -{
  1720. - struct ieee80211_local *local = wiphy_priv(wiphy);
  1721. -
  1722. - return drv_set_ringparam(local, tx, rx);
  1723. -}
  1724. -
  1725. -static void ieee80211_get_ringparam(struct wiphy *wiphy,
  1726. - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
  1727. -{
  1728. - struct ieee80211_local *local = wiphy_priv(wiphy);
  1729. -
  1730. - drv_get_ringparam(local, tx, tx_max, rx, rx_max);
  1731. -}
  1732. -
  1733. static int ieee80211_set_rekey_data(struct wiphy *wiphy,
  1734. struct net_device *dev,
  1735. struct cfg80211_gtk_rekey_data *data)
  1736. @@ -3844,8 +3529,6 @@ const struct cfg80211_ops mac80211_confi
  1737. .mgmt_frame_register = ieee80211_mgmt_frame_register,
  1738. .set_antenna = ieee80211_set_antenna,
  1739. .get_antenna = ieee80211_get_antenna,
  1740. - .set_ringparam = ieee80211_set_ringparam,
  1741. - .get_ringparam = ieee80211_get_ringparam,
  1742. .set_rekey_data = ieee80211_set_rekey_data,
  1743. .tdls_oper = ieee80211_tdls_oper,
  1744. .tdls_mgmt = ieee80211_tdls_mgmt,
  1745. @@ -3854,9 +3537,6 @@ const struct cfg80211_ops mac80211_confi
  1746. #ifdef CONFIG_PM
  1747. .set_wakeup = ieee80211_set_wakeup,
  1748. #endif
  1749. - .get_et_sset_count = ieee80211_get_et_sset_count,
  1750. - .get_et_stats = ieee80211_get_et_stats,
  1751. - .get_et_strings = ieee80211_get_et_strings,
  1752. .get_channel = ieee80211_cfg_get_channel,
  1753. .start_radar_detection = ieee80211_start_radar_detection,
  1754. .channel_switch = ieee80211_channel_switch,
  1755. --- a/net/mac80211/debugfs_sta.c
  1756. +++ b/net/mac80211/debugfs_sta.c
  1757. @@ -587,7 +587,6 @@ void ieee80211_sta_debugfs_add(struct st
  1758. DEBUGFS_ADD_COUNTER(tx_filtered, tx_filtered_count);
  1759. DEBUGFS_ADD_COUNTER(tx_retry_failed, tx_retry_failed);
  1760. DEBUGFS_ADD_COUNTER(tx_retry_count, tx_retry_count);
  1761. - DEBUGFS_ADD_COUNTER(wep_weak_iv_count, wep_weak_iv_count);
  1762. if (sizeof(sta->driver_buffered_tids) == sizeof(u32))
  1763. debugfs_create_x32("driver_buffered_tids", 0400,
  1764. --- a/net/mac80211/wep.c
  1765. +++ b/net/mac80211/wep.c
  1766. @@ -271,22 +271,6 @@ static int ieee80211_wep_decrypt(struct
  1767. return ret;
  1768. }
  1769. -
  1770. -static bool ieee80211_wep_is_weak_iv(struct sk_buff *skb,
  1771. - struct ieee80211_key *key)
  1772. -{
  1773. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  1774. - unsigned int hdrlen;
  1775. - u8 *ivpos;
  1776. - u32 iv;
  1777. -
  1778. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  1779. - ivpos = skb->data + hdrlen;
  1780. - iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2];
  1781. -
  1782. - return ieee80211_wep_weak_iv(iv, key->conf.keylen);
  1783. -}
  1784. -
  1785. ieee80211_rx_result
  1786. ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
  1787. {
  1788. @@ -301,16 +285,12 @@ ieee80211_crypto_wep_decrypt(struct ieee
  1789. if (!(status->flag & RX_FLAG_DECRYPTED)) {
  1790. if (skb_linearize(rx->skb))
  1791. return RX_DROP_UNUSABLE;
  1792. - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
  1793. - rx->sta->wep_weak_iv_count++;
  1794. if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key))
  1795. return RX_DROP_UNUSABLE;
  1796. } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) {
  1797. if (!pskb_may_pull(rx->skb, ieee80211_hdrlen(fc) +
  1798. IEEE80211_WEP_IV_LEN))
  1799. return RX_DROP_UNUSABLE;
  1800. - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
  1801. - rx->sta->wep_weak_iv_count++;
  1802. ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
  1803. /* remove ICV */
  1804. if (pskb_trim(rx->skb, rx->skb->len - IEEE80211_WEP_ICV_LEN))
  1805. --- a/include/net/cfg80211.h
  1806. +++ b/include/net/cfg80211.h
  1807. @@ -2278,16 +2278,6 @@ struct cfg80211_qos_map {
  1808. *
  1809. * @set_noack_map: Set the NoAck Map for the TIDs.
  1810. *
  1811. - * @get_et_sset_count: Ethtool API to get string-set count.
  1812. - * See @ethtool_ops.get_sset_count
  1813. - *
  1814. - * @get_et_stats: Ethtool API to get a set of u64 stats.
  1815. - * See @ethtool_ops.get_ethtool_stats
  1816. - *
  1817. - * @get_et_strings: Ethtool API to get a set of strings to describe stats
  1818. - * and perhaps other supported types of ethtool data-sets.
  1819. - * See @ethtool_ops.get_strings
  1820. - *
  1821. * @get_channel: Get the current operating channel for the virtual interface.
  1822. * For monitor interfaces, it should return %NULL unless there's a single
  1823. * current monitoring channel.
  1824. @@ -2529,13 +2519,6 @@ struct cfg80211_ops {
  1825. struct net_device *dev,
  1826. u16 noack_map);
  1827. - int (*get_et_sset_count)(struct wiphy *wiphy,
  1828. - struct net_device *dev, int sset);
  1829. - void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
  1830. - struct ethtool_stats *stats, u64 *data);
  1831. - void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
  1832. - u32 sset, u8 *data);
  1833. -
  1834. int (*get_channel)(struct wiphy *wiphy,
  1835. struct wireless_dev *wdev,
  1836. struct cfg80211_chan_def *chandef);
  1837. @@ -4846,6 +4829,10 @@ void cfg80211_stop_iface(struct wiphy *w
  1838. */
  1839. void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
  1840. +
  1841. +/* ethtool helper */
  1842. +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
  1843. +
  1844. /* Logging, debugging and troubleshooting/diagnostic helpers. */
  1845. /* wiphy_printk helpers, similar to dev_printk */
  1846. --- a/net/mac80211/Makefile
  1847. +++ b/net/mac80211/Makefile
  1848. @@ -17,6 +17,7 @@ mac80211-y := \
  1849. aes_ccm.o \
  1850. aes_cmac.o \
  1851. cfg.o \
  1852. + ethtool.o \
  1853. rx.o \
  1854. spectmgmt.o \
  1855. tx.o \
  1856. --- a/net/mac80211/ieee80211_i.h
  1857. +++ b/net/mac80211/ieee80211_i.h
  1858. @@ -229,16 +229,29 @@ struct ieee80211_rx_data {
  1859. u16 tkip_iv16;
  1860. };
  1861. +struct ieee80211_csa_settings {
  1862. + const u16 *counter_offsets_beacon;
  1863. + const u16 *counter_offsets_presp;
  1864. +
  1865. + int n_counter_offsets_beacon;
  1866. + int n_counter_offsets_presp;
  1867. +
  1868. + u8 count;
  1869. +};
  1870. +
  1871. struct beacon_data {
  1872. u8 *head, *tail;
  1873. int head_len, tail_len;
  1874. struct ieee80211_meshconf_ie *meshconf;
  1875. + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
  1876. + u8 csa_current_counter;
  1877. struct rcu_head rcu_head;
  1878. };
  1879. struct probe_resp {
  1880. struct rcu_head rcu_head;
  1881. int len;
  1882. + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
  1883. u8 data[0];
  1884. };
  1885. @@ -754,8 +767,6 @@ struct ieee80211_sub_if_data {
  1886. struct mac80211_qos_map __rcu *qos_map;
  1887. struct work_struct csa_finalize_work;
  1888. - u16 csa_counter_offset_beacon[IEEE80211_MAX_CSA_COUNTERS_NUM];
  1889. - u16 csa_counter_offset_presp[IEEE80211_MAX_CSA_COUNTERS_NUM];
  1890. bool csa_radar_required;
  1891. bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
  1892. struct cfg80211_chan_def csa_chandef;
  1893. @@ -767,7 +778,6 @@ struct ieee80211_sub_if_data {
  1894. struct ieee80211_chanctx *reserved_chanctx;
  1895. struct cfg80211_chan_def reserved_chandef;
  1896. bool reserved_radar_required;
  1897. - u8 csa_current_counter;
  1898. /* used to reconfigure hardware SM PS */
  1899. struct work_struct recalc_smps;
  1900. @@ -1850,6 +1860,8 @@ int ieee80211_tdls_oper(struct wiphy *wi
  1901. const u8 *peer, enum nl80211_tdls_operation oper);
  1902. +extern const struct ethtool_ops ieee80211_ethtool_ops;
  1903. +
  1904. #ifdef CPTCFG_MAC80211_NOINLINE
  1905. #define debug_noinline noinline
  1906. #else
  1907. --- a/net/mac80211/iface.c
  1908. +++ b/net/mac80211/iface.c
  1909. @@ -399,6 +399,7 @@ int ieee80211_add_virtual_monitor(struct
  1910. sdata->vif.type = NL80211_IFTYPE_MONITOR;
  1911. snprintf(sdata->name, IFNAMSIZ, "%s-monitor",
  1912. wiphy_name(local->hw.wiphy));
  1913. + sdata->wdev.iftype = NL80211_IFTYPE_MONITOR;
  1914. sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
  1915. @@ -1303,6 +1304,7 @@ static void ieee80211_setup_sdata(struct
  1916. sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE);
  1917. sdata->control_port_no_encrypt = false;
  1918. sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
  1919. + sdata->vif.bss_conf.idle = true;
  1920. sdata->noack_map = 0;
  1921. @@ -1721,6 +1723,8 @@ int ieee80211_if_add(struct ieee80211_lo
  1922. ndev->features |= local->hw.netdev_features;
  1923. + netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
  1924. +
  1925. ret = register_netdevice(ndev);
  1926. if (ret) {
  1927. free_netdev(ndev);
  1928. --- a/net/wireless/core.c
  1929. +++ b/net/wireless/core.c
  1930. @@ -25,7 +25,6 @@
  1931. #include "sysfs.h"
  1932. #include "debugfs.h"
  1933. #include "wext-compat.h"
  1934. -#include "ethtool.h"
  1935. #include "rdev-ops.h"
  1936. /* name for sysfs, %d is appended */
  1937. @@ -940,8 +939,6 @@ static int cfg80211_netdev_notifier_call
  1938. /* allow mac80211 to determine the timeout */
  1939. wdev->ps_timeout = -1;
  1940. - netdev_set_default_ethtool_ops(dev, &cfg80211_ethtool_ops);
  1941. -
  1942. if ((wdev->iftype == NL80211_IFTYPE_STATION ||
  1943. wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
  1944. wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
  1945. --- a/net/wireless/ethtool.c
  1946. +++ b/net/wireless/ethtool.c
  1947. @@ -1,11 +1,9 @@
  1948. #include <linux/utsname.h>
  1949. #include <net/cfg80211.h>
  1950. #include "core.h"
  1951. -#include "ethtool.h"
  1952. #include "rdev-ops.h"
  1953. -static void cfg80211_get_drvinfo(struct net_device *dev,
  1954. - struct ethtool_drvinfo *info)
  1955. +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
  1956. {
  1957. struct wireless_dev *wdev = dev->ieee80211_ptr;
  1958. @@ -23,84 +21,4 @@ static void cfg80211_get_drvinfo(struct
  1959. strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
  1960. sizeof(info->bus_info));
  1961. }
  1962. -
  1963. -static int cfg80211_get_regs_len(struct net_device *dev)
  1964. -{
  1965. - /* For now, return 0... */
  1966. - return 0;
  1967. -}
  1968. -
  1969. -static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs,
  1970. - void *data)
  1971. -{
  1972. - struct wireless_dev *wdev = dev->ieee80211_ptr;
  1973. -
  1974. - regs->version = wdev->wiphy->hw_version;
  1975. - regs->len = 0;
  1976. -}
  1977. -
  1978. -static void cfg80211_get_ringparam(struct net_device *dev,
  1979. - struct ethtool_ringparam *rp)
  1980. -{
  1981. - struct wireless_dev *wdev = dev->ieee80211_ptr;
  1982. - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
  1983. -
  1984. - memset(rp, 0, sizeof(*rp));
  1985. -
  1986. - if (rdev->ops->get_ringparam)
  1987. - rdev_get_ringparam(rdev, &rp->tx_pending, &rp->tx_max_pending,
  1988. - &rp->rx_pending, &rp->rx_max_pending);
  1989. -}
  1990. -
  1991. -static int cfg80211_set_ringparam(struct net_device *dev,
  1992. - struct ethtool_ringparam *rp)
  1993. -{
  1994. - struct wireless_dev *wdev = dev->ieee80211_ptr;
  1995. - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
  1996. -
  1997. - if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
  1998. - return -EINVAL;
  1999. -
  2000. - if (rdev->ops->set_ringparam)
  2001. - return rdev_set_ringparam(rdev, rp->tx_pending, rp->rx_pending);
  2002. -
  2003. - return -ENOTSUPP;
  2004. -}
  2005. -
  2006. -static int cfg80211_get_sset_count(struct net_device *dev, int sset)
  2007. -{
  2008. - struct wireless_dev *wdev = dev->ieee80211_ptr;
  2009. - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
  2010. - if (rdev->ops->get_et_sset_count)
  2011. - return rdev_get_et_sset_count(rdev, dev, sset);
  2012. - return -EOPNOTSUPP;
  2013. -}
  2014. -
  2015. -static void cfg80211_get_stats(struct net_device *dev,
  2016. - struct ethtool_stats *stats, u64 *data)
  2017. -{
  2018. - struct wireless_dev *wdev = dev->ieee80211_ptr;
  2019. - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
  2020. - if (rdev->ops->get_et_stats)
  2021. - rdev_get_et_stats(rdev, dev, stats, data);
  2022. -}
  2023. -
  2024. -static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
  2025. -{
  2026. - struct wireless_dev *wdev = dev->ieee80211_ptr;
  2027. - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
  2028. - if (rdev->ops->get_et_strings)
  2029. - rdev_get_et_strings(rdev, dev, sset, data);
  2030. -}
  2031. -
  2032. -const struct ethtool_ops cfg80211_ethtool_ops = {
  2033. - .get_drvinfo = cfg80211_get_drvinfo,
  2034. - .get_regs_len = cfg80211_get_regs_len,
  2035. - .get_regs = cfg80211_get_regs,
  2036. - .get_link = ethtool_op_get_link,
  2037. - .get_ringparam = cfg80211_get_ringparam,
  2038. - .set_ringparam = cfg80211_set_ringparam,
  2039. - .get_strings = cfg80211_get_strings,
  2040. - .get_ethtool_stats = cfg80211_get_stats,
  2041. - .get_sset_count = cfg80211_get_sset_count,
  2042. -};
  2043. +EXPORT_SYMBOL(cfg80211_get_drvinfo);
  2044. --- a/net/wireless/ethtool.h
  2045. +++ /dev/null
  2046. @@ -1,6 +0,0 @@
  2047. -#ifndef __CFG80211_ETHTOOL__
  2048. -#define __CFG80211_ETHTOOL__
  2049. -
  2050. -extern const struct ethtool_ops cfg80211_ethtool_ops;
  2051. -
  2052. -#endif /* __CFG80211_ETHTOOL__ */
  2053. --- a/net/wireless/rdev-ops.h
  2054. +++ b/net/wireless/rdev-ops.h
  2055. @@ -714,25 +714,6 @@ static inline int rdev_get_antenna(struc
  2056. return ret;
  2057. }
  2058. -static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
  2059. - u32 tx, u32 rx)
  2060. -{
  2061. - int ret;
  2062. - trace_rdev_set_ringparam(&rdev->wiphy, tx, rx);
  2063. - ret = rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
  2064. - trace_rdev_return_int(&rdev->wiphy, ret);
  2065. - return ret;
  2066. -}
  2067. -
  2068. -static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
  2069. - u32 *tx, u32 *tx_max, u32 *rx,
  2070. - u32 *rx_max)
  2071. -{
  2072. - trace_rdev_get_ringparam(&rdev->wiphy);
  2073. - rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
  2074. - trace_rdev_return_void_tx_rx(&rdev->wiphy, *tx, *tx_max, *rx, *rx_max);
  2075. -}
  2076. -
  2077. static inline int
  2078. rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
  2079. struct net_device *dev,
  2080. @@ -816,35 +797,6 @@ static inline int rdev_set_noack_map(str
  2081. }
  2082. static inline int
  2083. -rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
  2084. - struct net_device *dev, int sset)
  2085. -{
  2086. - int ret;
  2087. - trace_rdev_get_et_sset_count(&rdev->wiphy, dev, sset);
  2088. - ret = rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
  2089. - trace_rdev_return_int(&rdev->wiphy, ret);
  2090. - return ret;
  2091. -}
  2092. -
  2093. -static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
  2094. - struct net_device *dev,
  2095. - struct ethtool_stats *stats, u64 *data)
  2096. -{
  2097. - trace_rdev_get_et_stats(&rdev->wiphy, dev);
  2098. - rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
  2099. - trace_rdev_return_void(&rdev->wiphy);
  2100. -}
  2101. -
  2102. -static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
  2103. - struct net_device *dev, u32 sset,
  2104. - u8 *data)
  2105. -{
  2106. - trace_rdev_get_et_strings(&rdev->wiphy, dev, sset);
  2107. - rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
  2108. - trace_rdev_return_void(&rdev->wiphy);
  2109. -}
  2110. -
  2111. -static inline int
  2112. rdev_get_channel(struct cfg80211_registered_device *rdev,
  2113. struct wireless_dev *wdev,
  2114. struct cfg80211_chan_def *chandef)
  2115. --- a/net/wireless/trace.h
  2116. +++ b/net/wireless/trace.h
  2117. @@ -298,11 +298,6 @@ DEFINE_EVENT(wiphy_only_evt, rdev_return
  2118. TP_ARGS(wiphy)
  2119. );
  2120. -DEFINE_EVENT(wiphy_only_evt, rdev_get_ringparam,
  2121. - TP_PROTO(struct wiphy *wiphy),
  2122. - TP_ARGS(wiphy)
  2123. -);
  2124. -
  2125. DEFINE_EVENT(wiphy_only_evt, rdev_get_antenna,
  2126. TP_PROTO(struct wiphy *wiphy),
  2127. TP_ARGS(wiphy)
  2128. @@ -580,11 +575,6 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_stop
  2129. TP_ARGS(wiphy, netdev)
  2130. );
  2131. -DEFINE_EVENT(wiphy_netdev_evt, rdev_get_et_stats,
  2132. - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
  2133. - TP_ARGS(wiphy, netdev)
  2134. -);
  2135. -
  2136. DEFINE_EVENT(wiphy_netdev_evt, rdev_sched_scan_stop,
  2137. TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
  2138. TP_ARGS(wiphy, netdev)
  2139. @@ -1439,11 +1429,6 @@ DECLARE_EVENT_CLASS(tx_rx_evt,
  2140. WIPHY_PR_ARG, __entry->tx, __entry->rx)
  2141. );
  2142. -DEFINE_EVENT(tx_rx_evt, rdev_set_ringparam,
  2143. - TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
  2144. - TP_ARGS(wiphy, rx, tx)
  2145. -);
  2146. -
  2147. DEFINE_EVENT(tx_rx_evt, rdev_set_antenna,
  2148. TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
  2149. TP_ARGS(wiphy, rx, tx)
  2150. @@ -1725,40 +1710,6 @@ TRACE_EVENT(rdev_set_noack_map,
  2151. WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map)
  2152. );
  2153. -TRACE_EVENT(rdev_get_et_sset_count,
  2154. - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int sset),
  2155. - TP_ARGS(wiphy, netdev, sset),
  2156. - TP_STRUCT__entry(
  2157. - WIPHY_ENTRY
  2158. - NETDEV_ENTRY
  2159. - __field(int, sset)
  2160. - ),
  2161. - TP_fast_assign(
  2162. - WIPHY_ASSIGN;
  2163. - NETDEV_ASSIGN;
  2164. - __entry->sset = sset;
  2165. - ),
  2166. - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %d",
  2167. - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
  2168. -);
  2169. -
  2170. -TRACE_EVENT(rdev_get_et_strings,
  2171. - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u32 sset),
  2172. - TP_ARGS(wiphy, netdev, sset),
  2173. - TP_STRUCT__entry(
  2174. - WIPHY_ENTRY
  2175. - NETDEV_ENTRY
  2176. - __field(u32, sset)
  2177. - ),
  2178. - TP_fast_assign(
  2179. - WIPHY_ASSIGN;
  2180. - NETDEV_ASSIGN;
  2181. - __entry->sset = sset;
  2182. - ),
  2183. - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %u",
  2184. - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
  2185. -);
  2186. -
  2187. DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,
  2188. TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
  2189. TP_ARGS(wiphy, wdev)
  2190. --- /dev/null
  2191. +++ b/net/mac80211/ethtool.c
  2192. @@ -0,0 +1,244 @@
  2193. +/*
  2194. + * mac80211 ethtool hooks for cfg80211
  2195. + *
  2196. + * Copied from cfg.c - originally
  2197. + * Copyright 2006-2010 Johannes Berg <[email protected]>
  2198. + * Copyright 2014 Intel Corporation (Author: Johannes Berg)
  2199. + *
  2200. + * This file is GPLv2 as found in COPYING.
  2201. + */
  2202. +#include <linux/types.h>
  2203. +#include <net/cfg80211.h>
  2204. +#include "ieee80211_i.h"
  2205. +#include "sta_info.h"
  2206. +#include "driver-ops.h"
  2207. +
  2208. +static int ieee80211_set_ringparam(struct net_device *dev,
  2209. + struct ethtool_ringparam *rp)
  2210. +{
  2211. + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
  2212. +
  2213. + if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
  2214. + return -EINVAL;
  2215. +
  2216. + return drv_set_ringparam(local, rp->tx_pending, rp->rx_pending);
  2217. +}
  2218. +
  2219. +static void ieee80211_get_ringparam(struct net_device *dev,
  2220. + struct ethtool_ringparam *rp)
  2221. +{
  2222. + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
  2223. +
  2224. + memset(rp, 0, sizeof(*rp));
  2225. +
  2226. + drv_get_ringparam(local, &rp->tx_pending, &rp->tx_max_pending,
  2227. + &rp->rx_pending, &rp->rx_max_pending);
  2228. +}
  2229. +
  2230. +static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
  2231. + "rx_packets", "rx_bytes",
  2232. + "rx_duplicates", "rx_fragments", "rx_dropped",
  2233. + "tx_packets", "tx_bytes", "tx_fragments",
  2234. + "tx_filtered", "tx_retry_failed", "tx_retries",
  2235. + "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
  2236. + "channel", "noise", "ch_time", "ch_time_busy",
  2237. + "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
  2238. +};
  2239. +#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
  2240. +
  2241. +static int ieee80211_get_sset_count(struct net_device *dev, int sset)
  2242. +{
  2243. + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  2244. + int rv = 0;
  2245. +
  2246. + if (sset == ETH_SS_STATS)
  2247. + rv += STA_STATS_LEN;
  2248. +
  2249. + rv += drv_get_et_sset_count(sdata, sset);
  2250. +
  2251. + if (rv == 0)
  2252. + return -EOPNOTSUPP;
  2253. + return rv;
  2254. +}
  2255. +
  2256. +static void ieee80211_get_stats(struct net_device *dev,
  2257. + struct ethtool_stats *stats,
  2258. + u64 *data)
  2259. +{
  2260. + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  2261. + struct ieee80211_chanctx_conf *chanctx_conf;
  2262. + struct ieee80211_channel *channel;
  2263. + struct sta_info *sta;
  2264. + struct ieee80211_local *local = sdata->local;
  2265. + struct station_info sinfo;
  2266. + struct survey_info survey;
  2267. + int i, q;
  2268. +#define STA_STATS_SURVEY_LEN 7
  2269. +
  2270. + memset(data, 0, sizeof(u64) * STA_STATS_LEN);
  2271. +
  2272. +#define ADD_STA_STATS(sta) \
  2273. + do { \
  2274. + data[i++] += sta->rx_packets; \
  2275. + data[i++] += sta->rx_bytes; \
  2276. + data[i++] += sta->num_duplicates; \
  2277. + data[i++] += sta->rx_fragments; \
  2278. + data[i++] += sta->rx_dropped; \
  2279. + \
  2280. + data[i++] += sinfo.tx_packets; \
  2281. + data[i++] += sinfo.tx_bytes; \
  2282. + data[i++] += sta->tx_fragments; \
  2283. + data[i++] += sta->tx_filtered_count; \
  2284. + data[i++] += sta->tx_retry_failed; \
  2285. + data[i++] += sta->tx_retry_count; \
  2286. + data[i++] += sta->beacon_loss_count; \
  2287. + } while (0)
  2288. +
  2289. + /* For Managed stations, find the single station based on BSSID
  2290. + * and use that. For interface types, iterate through all available
  2291. + * stations and add stats for any station that is assigned to this
  2292. + * network device.
  2293. + */
  2294. +
  2295. + mutex_lock(&local->sta_mtx);
  2296. +
  2297. + if (sdata->vif.type == NL80211_IFTYPE_STATION) {
  2298. + sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
  2299. +
  2300. + if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
  2301. + goto do_survey;
  2302. +
  2303. + sinfo.filled = 0;
  2304. + sta_set_sinfo(sta, &sinfo);
  2305. +
  2306. + i = 0;
  2307. + ADD_STA_STATS(sta);
  2308. +
  2309. + data[i++] = sta->sta_state;
  2310. +
  2311. +
  2312. + if (sinfo.filled & STATION_INFO_TX_BITRATE)
  2313. + data[i] = 100000 *
  2314. + cfg80211_calculate_bitrate(&sinfo.txrate);
  2315. + i++;
  2316. + if (sinfo.filled & STATION_INFO_RX_BITRATE)
  2317. + data[i] = 100000 *
  2318. + cfg80211_calculate_bitrate(&sinfo.rxrate);
  2319. + i++;
  2320. +
  2321. + if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
  2322. + data[i] = (u8)sinfo.signal_avg;
  2323. + i++;
  2324. + } else {
  2325. + list_for_each_entry(sta, &local->sta_list, list) {
  2326. + /* Make sure this station belongs to the proper dev */
  2327. + if (sta->sdata->dev != dev)
  2328. + continue;
  2329. +
  2330. + sinfo.filled = 0;
  2331. + sta_set_sinfo(sta, &sinfo);
  2332. + i = 0;
  2333. + ADD_STA_STATS(sta);
  2334. + }
  2335. + }
  2336. +
  2337. +do_survey:
  2338. + i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
  2339. + /* Get survey stats for current channel */
  2340. + survey.filled = 0;
  2341. +
  2342. + rcu_read_lock();
  2343. + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
  2344. + if (chanctx_conf)
  2345. + channel = chanctx_conf->def.chan;
  2346. + else
  2347. + channel = NULL;
  2348. + rcu_read_unlock();
  2349. +
  2350. + if (channel) {
  2351. + q = 0;
  2352. + do {
  2353. + survey.filled = 0;
  2354. + if (drv_get_survey(local, q, &survey) != 0) {
  2355. + survey.filled = 0;
  2356. + break;
  2357. + }
  2358. + q++;
  2359. + } while (channel != survey.channel);
  2360. + }
  2361. +
  2362. + if (survey.filled)
  2363. + data[i++] = survey.channel->center_freq;
  2364. + else
  2365. + data[i++] = 0;
  2366. + if (survey.filled & SURVEY_INFO_NOISE_DBM)
  2367. + data[i++] = (u8)survey.noise;
  2368. + else
  2369. + data[i++] = -1LL;
  2370. + if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
  2371. + data[i++] = survey.channel_time;
  2372. + else
  2373. + data[i++] = -1LL;
  2374. + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
  2375. + data[i++] = survey.channel_time_busy;
  2376. + else
  2377. + data[i++] = -1LL;
  2378. + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
  2379. + data[i++] = survey.channel_time_ext_busy;
  2380. + else
  2381. + data[i++] = -1LL;
  2382. + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
  2383. + data[i++] = survey.channel_time_rx;
  2384. + else
  2385. + data[i++] = -1LL;
  2386. + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
  2387. + data[i++] = survey.channel_time_tx;
  2388. + else
  2389. + data[i++] = -1LL;
  2390. +
  2391. + mutex_unlock(&local->sta_mtx);
  2392. +
  2393. + if (WARN_ON(i != STA_STATS_LEN))
  2394. + return;
  2395. +
  2396. + drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
  2397. +}
  2398. +
  2399. +static void ieee80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
  2400. +{
  2401. + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  2402. + int sz_sta_stats = 0;
  2403. +
  2404. + if (sset == ETH_SS_STATS) {
  2405. + sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
  2406. + memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
  2407. + }
  2408. + drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
  2409. +}
  2410. +
  2411. +static int ieee80211_get_regs_len(struct net_device *dev)
  2412. +{
  2413. + return 0;
  2414. +}
  2415. +
  2416. +static void ieee80211_get_regs(struct net_device *dev,
  2417. + struct ethtool_regs *regs,
  2418. + void *data)
  2419. +{
  2420. + struct wireless_dev *wdev = dev->ieee80211_ptr;
  2421. +
  2422. + regs->version = wdev->wiphy->hw_version;
  2423. + regs->len = 0;
  2424. +}
  2425. +
  2426. +const struct ethtool_ops ieee80211_ethtool_ops = {
  2427. + .get_drvinfo = cfg80211_get_drvinfo,
  2428. + .get_regs_len = ieee80211_get_regs_len,
  2429. + .get_regs = ieee80211_get_regs,
  2430. + .get_link = ethtool_op_get_link,
  2431. + .get_ringparam = ieee80211_get_ringparam,
  2432. + .set_ringparam = ieee80211_set_ringparam,
  2433. + .get_strings = ieee80211_get_strings,
  2434. + .get_ethtool_stats = ieee80211_get_stats,
  2435. + .get_sset_count = ieee80211_get_sset_count,
  2436. +};
  2437. --- a/net/mac80211/ibss.c
  2438. +++ b/net/mac80211/ibss.c
  2439. @@ -143,7 +143,7 @@ ieee80211_ibss_build_presp(struct ieee80
  2440. *pos++ = csa_settings->block_tx ? 1 : 0;
  2441. *pos++ = ieee80211_frequency_to_channel(
  2442. csa_settings->chandef.chan->center_freq);
  2443. - sdata->csa_counter_offset_beacon[0] = (pos - presp->head);
  2444. + presp->csa_counter_offsets[0] = (pos - presp->head);
  2445. *pos++ = csa_settings->count;
  2446. }
  2447. @@ -1677,6 +1677,7 @@ int ieee80211_ibss_join(struct ieee80211
  2448. sdata->u.ibss.control_port = params->control_port;
  2449. sdata->u.ibss.userspace_handles_dfs = params->userspace_handles_dfs;
  2450. sdata->u.ibss.basic_rates = params->basic_rates;
  2451. + sdata->u.ibss.last_scan_completed = jiffies;
  2452. /* fix basic_rates if channel does not support these rates */
  2453. rate_flags = ieee80211_chandef_rate_flags(&params->chandef);
  2454. --- a/net/mac80211/mesh.c
  2455. +++ b/net/mac80211/mesh.c
  2456. @@ -679,7 +679,7 @@ ieee80211_mesh_build_beacon(struct ieee8
  2457. *pos++ = 0x0;
  2458. *pos++ = ieee80211_frequency_to_channel(
  2459. csa->settings.chandef.chan->center_freq);
  2460. - sdata->csa_counter_offset_beacon[0] = hdr_len + 6;
  2461. + bcn->csa_counter_offsets[0] = hdr_len + 6;
  2462. *pos++ = csa->settings.count;
  2463. *pos++ = WLAN_EID_CHAN_SWITCH_PARAM;
  2464. *pos++ = 6;
  2465. --- a/net/wireless/genregdb.awk
  2466. +++ b/net/wireless/genregdb.awk
  2467. @@ -65,17 +65,7 @@ function parse_reg_rule()
  2468. sub(/,/, "", units)
  2469. dfs_cac = $9
  2470. if (units == "mW") {
  2471. - if (power == 100) {
  2472. - power = 20
  2473. - } else if (power == 200) {
  2474. - power = 23
  2475. - } else if (power == 500) {
  2476. - power = 27
  2477. - } else if (power == 1000) {
  2478. - power = 30
  2479. - } else {
  2480. - print "Unknown power value in database!"
  2481. - }
  2482. + power = 10 * log(power)/log(10)
  2483. } else {
  2484. dfs_cac = $8
  2485. }
  2486. @@ -114,7 +104,7 @@ function parse_reg_rule()
  2487. }
  2488. flags = flags "0"
  2489. - printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %d, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
  2490. + printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %.0f, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
  2491. rules++
  2492. }
  2493. --- a/net/mac80211/debugfs_netdev.c
  2494. +++ b/net/mac80211/debugfs_netdev.c
  2495. @@ -34,8 +34,7 @@ static ssize_t ieee80211_if_read(
  2496. ssize_t ret = -EINVAL;
  2497. read_lock(&dev_base_lock);
  2498. - if (sdata->dev->reg_state == NETREG_REGISTERED)
  2499. - ret = (*format)(sdata, buf, sizeof(buf));
  2500. + ret = (*format)(sdata, buf, sizeof(buf));
  2501. read_unlock(&dev_base_lock);
  2502. if (ret >= 0)
  2503. @@ -62,8 +61,7 @@ static ssize_t ieee80211_if_write(
  2504. ret = -ENODEV;
  2505. rtnl_lock();
  2506. - if (sdata->dev->reg_state == NETREG_REGISTERED)
  2507. - ret = (*write)(sdata, buf, count);
  2508. + ret = (*write)(sdata, buf, count);
  2509. rtnl_unlock();
  2510. return ret;