300-pending_work.patch 101 KB

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