driver-ops.h 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384
  1. #ifndef __MAC80211_DRIVER_OPS
  2. #define __MAC80211_DRIVER_OPS
  3. #include <net/mac80211.h>
  4. #include "ieee80211_i.h"
  5. #include "trace.h"
  6. static inline bool check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
  7. {
  8. return !WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER),
  9. "%s: Failed check-sdata-in-driver check, flags: 0x%x\n",
  10. sdata->dev ? sdata->dev->name : sdata->name, sdata->flags);
  11. }
  12. static inline struct ieee80211_sub_if_data *
  13. get_bss_sdata(struct ieee80211_sub_if_data *sdata)
  14. {
  15. if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
  16. sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  17. u.ap);
  18. return sdata;
  19. }
  20. static inline void drv_tx(struct ieee80211_local *local,
  21. struct ieee80211_tx_control *control,
  22. struct sk_buff *skb)
  23. {
  24. local->ops->tx(&local->hw, control, skb);
  25. }
  26. static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata,
  27. u32 sset, u8 *data)
  28. {
  29. struct ieee80211_local *local = sdata->local;
  30. if (local->ops->get_et_strings) {
  31. trace_drv_get_et_strings(local, sset);
  32. local->ops->get_et_strings(&local->hw, &sdata->vif, sset, data);
  33. trace_drv_return_void(local);
  34. }
  35. }
  36. static inline void drv_get_et_stats(struct ieee80211_sub_if_data *sdata,
  37. struct ethtool_stats *stats,
  38. u64 *data)
  39. {
  40. struct ieee80211_local *local = sdata->local;
  41. if (local->ops->get_et_stats) {
  42. trace_drv_get_et_stats(local);
  43. local->ops->get_et_stats(&local->hw, &sdata->vif, stats, data);
  44. trace_drv_return_void(local);
  45. }
  46. }
  47. static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data *sdata,
  48. int sset)
  49. {
  50. struct ieee80211_local *local = sdata->local;
  51. int rv = 0;
  52. if (local->ops->get_et_sset_count) {
  53. trace_drv_get_et_sset_count(local, sset);
  54. rv = local->ops->get_et_sset_count(&local->hw, &sdata->vif,
  55. sset);
  56. trace_drv_return_int(local, rv);
  57. }
  58. return rv;
  59. }
  60. static inline int drv_start(struct ieee80211_local *local)
  61. {
  62. int ret;
  63. might_sleep();
  64. trace_drv_start(local);
  65. local->started = true;
  66. smp_mb();
  67. ret = local->ops->start(&local->hw);
  68. trace_drv_return_int(local, ret);
  69. return ret;
  70. }
  71. static inline void drv_stop(struct ieee80211_local *local)
  72. {
  73. might_sleep();
  74. trace_drv_stop(local);
  75. local->ops->stop(&local->hw);
  76. trace_drv_return_void(local);
  77. /* sync away all work on the tasklet before clearing started */
  78. tasklet_disable(&local->tasklet);
  79. tasklet_enable(&local->tasklet);
  80. barrier();
  81. local->started = false;
  82. }
  83. #ifdef CONFIG_PM
  84. static inline int drv_suspend(struct ieee80211_local *local,
  85. struct cfg80211_wowlan *wowlan)
  86. {
  87. int ret;
  88. might_sleep();
  89. trace_drv_suspend(local);
  90. ret = local->ops->suspend(&local->hw, wowlan);
  91. trace_drv_return_int(local, ret);
  92. return ret;
  93. }
  94. static inline int drv_resume(struct ieee80211_local *local)
  95. {
  96. int ret;
  97. might_sleep();
  98. trace_drv_resume(local);
  99. ret = local->ops->resume(&local->hw);
  100. trace_drv_return_int(local, ret);
  101. return ret;
  102. }
  103. static inline void drv_set_wakeup(struct ieee80211_local *local,
  104. bool enabled)
  105. {
  106. might_sleep();
  107. if (!local->ops->set_wakeup)
  108. return;
  109. trace_drv_set_wakeup(local, enabled);
  110. local->ops->set_wakeup(&local->hw, enabled);
  111. trace_drv_return_void(local);
  112. }
  113. #endif
  114. static inline int drv_add_interface(struct ieee80211_local *local,
  115. struct ieee80211_sub_if_data *sdata)
  116. {
  117. int ret;
  118. might_sleep();
  119. if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
  120. (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
  121. !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF) &&
  122. !(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE))))
  123. return -EINVAL;
  124. trace_drv_add_interface(local, sdata);
  125. ret = local->ops->add_interface(&local->hw, &sdata->vif);
  126. trace_drv_return_int(local, ret);
  127. if (ret == 0)
  128. sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
  129. return ret;
  130. }
  131. static inline int drv_change_interface(struct ieee80211_local *local,
  132. struct ieee80211_sub_if_data *sdata,
  133. enum nl80211_iftype type, bool p2p)
  134. {
  135. int ret;
  136. might_sleep();
  137. if (!check_sdata_in_driver(sdata))
  138. return -EIO;
  139. trace_drv_change_interface(local, sdata, type, p2p);
  140. ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
  141. trace_drv_return_int(local, ret);
  142. return ret;
  143. }
  144. static inline void drv_remove_interface(struct ieee80211_local *local,
  145. struct ieee80211_sub_if_data *sdata)
  146. {
  147. might_sleep();
  148. if (!check_sdata_in_driver(sdata))
  149. return;
  150. trace_drv_remove_interface(local, sdata);
  151. local->ops->remove_interface(&local->hw, &sdata->vif);
  152. sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
  153. trace_drv_return_void(local);
  154. }
  155. static inline int drv_config(struct ieee80211_local *local, u32 changed)
  156. {
  157. int ret;
  158. might_sleep();
  159. trace_drv_config(local, changed);
  160. ret = local->ops->config(&local->hw, changed);
  161. trace_drv_return_int(local, ret);
  162. return ret;
  163. }
  164. static inline void drv_bss_info_changed(struct ieee80211_local *local,
  165. struct ieee80211_sub_if_data *sdata,
  166. struct ieee80211_bss_conf *info,
  167. u32 changed)
  168. {
  169. might_sleep();
  170. if (WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON |
  171. BSS_CHANGED_BEACON_ENABLED) &&
  172. sdata->vif.type != NL80211_IFTYPE_AP &&
  173. sdata->vif.type != NL80211_IFTYPE_ADHOC &&
  174. sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
  175. sdata->vif.type != NL80211_IFTYPE_OCB))
  176. return;
  177. if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE ||
  178. sdata->vif.type == NL80211_IFTYPE_MONITOR))
  179. return;
  180. if (!check_sdata_in_driver(sdata))
  181. return;
  182. trace_drv_bss_info_changed(local, sdata, info, changed);
  183. if (local->ops->bss_info_changed)
  184. local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
  185. trace_drv_return_void(local);
  186. }
  187. static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
  188. struct netdev_hw_addr_list *mc_list)
  189. {
  190. u64 ret = 0;
  191. trace_drv_prepare_multicast(local, mc_list->count);
  192. if (local->ops->prepare_multicast)
  193. ret = local->ops->prepare_multicast(&local->hw, mc_list);
  194. trace_drv_return_u64(local, ret);
  195. return ret;
  196. }
  197. static inline void drv_configure_filter(struct ieee80211_local *local,
  198. unsigned int changed_flags,
  199. unsigned int *total_flags,
  200. u64 multicast)
  201. {
  202. might_sleep();
  203. trace_drv_configure_filter(local, changed_flags, total_flags,
  204. multicast);
  205. local->ops->configure_filter(&local->hw, changed_flags, total_flags,
  206. multicast);
  207. trace_drv_return_void(local);
  208. }
  209. static inline int drv_set_tim(struct ieee80211_local *local,
  210. struct ieee80211_sta *sta, bool set)
  211. {
  212. int ret = 0;
  213. trace_drv_set_tim(local, sta, set);
  214. if (local->ops->set_tim)
  215. ret = local->ops->set_tim(&local->hw, sta, set);
  216. trace_drv_return_int(local, ret);
  217. return ret;
  218. }
  219. static inline int drv_set_key(struct ieee80211_local *local,
  220. enum set_key_cmd cmd,
  221. struct ieee80211_sub_if_data *sdata,
  222. struct ieee80211_sta *sta,
  223. struct ieee80211_key_conf *key)
  224. {
  225. int ret;
  226. might_sleep();
  227. sdata = get_bss_sdata(sdata);
  228. if (!check_sdata_in_driver(sdata))
  229. return -EIO;
  230. trace_drv_set_key(local, cmd, sdata, sta, key);
  231. ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
  232. trace_drv_return_int(local, ret);
  233. return ret;
  234. }
  235. static inline void drv_update_tkip_key(struct ieee80211_local *local,
  236. struct ieee80211_sub_if_data *sdata,
  237. struct ieee80211_key_conf *conf,
  238. struct sta_info *sta, u32 iv32,
  239. u16 *phase1key)
  240. {
  241. struct ieee80211_sta *ista = NULL;
  242. if (sta)
  243. ista = &sta->sta;
  244. sdata = get_bss_sdata(sdata);
  245. if (!check_sdata_in_driver(sdata))
  246. return;
  247. trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
  248. if (local->ops->update_tkip_key)
  249. local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
  250. ista, iv32, phase1key);
  251. trace_drv_return_void(local);
  252. }
  253. static inline int drv_hw_scan(struct ieee80211_local *local,
  254. struct ieee80211_sub_if_data *sdata,
  255. struct ieee80211_scan_request *req)
  256. {
  257. int ret;
  258. might_sleep();
  259. if (!check_sdata_in_driver(sdata))
  260. return -EIO;
  261. trace_drv_hw_scan(local, sdata);
  262. ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
  263. trace_drv_return_int(local, ret);
  264. return ret;
  265. }
  266. static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
  267. struct ieee80211_sub_if_data *sdata)
  268. {
  269. might_sleep();
  270. if (!check_sdata_in_driver(sdata))
  271. return;
  272. trace_drv_cancel_hw_scan(local, sdata);
  273. local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
  274. trace_drv_return_void(local);
  275. }
  276. static inline int
  277. drv_sched_scan_start(struct ieee80211_local *local,
  278. struct ieee80211_sub_if_data *sdata,
  279. struct cfg80211_sched_scan_request *req,
  280. struct ieee80211_scan_ies *ies)
  281. {
  282. int ret;
  283. might_sleep();
  284. if (!check_sdata_in_driver(sdata))
  285. return -EIO;
  286. trace_drv_sched_scan_start(local, sdata);
  287. ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
  288. req, ies);
  289. trace_drv_return_int(local, ret);
  290. return ret;
  291. }
  292. static inline int drv_sched_scan_stop(struct ieee80211_local *local,
  293. struct ieee80211_sub_if_data *sdata)
  294. {
  295. int ret;
  296. might_sleep();
  297. if (!check_sdata_in_driver(sdata))
  298. return -EIO;
  299. trace_drv_sched_scan_stop(local, sdata);
  300. ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif);
  301. trace_drv_return_int(local, ret);
  302. return ret;
  303. }
  304. static inline void drv_sw_scan_start(struct ieee80211_local *local,
  305. struct ieee80211_sub_if_data *sdata,
  306. const u8 *mac_addr)
  307. {
  308. might_sleep();
  309. trace_drv_sw_scan_start(local, sdata, mac_addr);
  310. if (local->ops->sw_scan_start)
  311. local->ops->sw_scan_start(&local->hw, &sdata->vif, mac_addr);
  312. trace_drv_return_void(local);
  313. }
  314. static inline void drv_sw_scan_complete(struct ieee80211_local *local,
  315. struct ieee80211_sub_if_data *sdata)
  316. {
  317. might_sleep();
  318. trace_drv_sw_scan_complete(local, sdata);
  319. if (local->ops->sw_scan_complete)
  320. local->ops->sw_scan_complete(&local->hw, &sdata->vif);
  321. trace_drv_return_void(local);
  322. }
  323. static inline int drv_get_stats(struct ieee80211_local *local,
  324. struct ieee80211_low_level_stats *stats)
  325. {
  326. int ret = -EOPNOTSUPP;
  327. might_sleep();
  328. if (local->ops->get_stats)
  329. ret = local->ops->get_stats(&local->hw, stats);
  330. trace_drv_get_stats(local, stats, ret);
  331. return ret;
  332. }
  333. static inline void drv_get_key_seq(struct ieee80211_local *local,
  334. struct ieee80211_key *key,
  335. struct ieee80211_key_seq *seq)
  336. {
  337. if (local->ops->get_key_seq)
  338. local->ops->get_key_seq(&local->hw, &key->conf, seq);
  339. trace_drv_get_key_seq(local, &key->conf);
  340. }
  341. static inline int drv_set_frag_threshold(struct ieee80211_local *local,
  342. u32 value)
  343. {
  344. int ret = 0;
  345. might_sleep();
  346. trace_drv_set_frag_threshold(local, value);
  347. if (local->ops->set_frag_threshold)
  348. ret = local->ops->set_frag_threshold(&local->hw, value);
  349. trace_drv_return_int(local, ret);
  350. return ret;
  351. }
  352. static inline int drv_set_rts_threshold(struct ieee80211_local *local,
  353. u32 value)
  354. {
  355. int ret = 0;
  356. might_sleep();
  357. trace_drv_set_rts_threshold(local, value);
  358. if (local->ops->set_rts_threshold)
  359. ret = local->ops->set_rts_threshold(&local->hw, value);
  360. trace_drv_return_int(local, ret);
  361. return ret;
  362. }
  363. static inline int drv_set_coverage_class(struct ieee80211_local *local,
  364. s16 value)
  365. {
  366. int ret = 0;
  367. might_sleep();
  368. trace_drv_set_coverage_class(local, value);
  369. if (local->ops->set_coverage_class)
  370. local->ops->set_coverage_class(&local->hw, value);
  371. else
  372. ret = -EOPNOTSUPP;
  373. trace_drv_return_int(local, ret);
  374. return ret;
  375. }
  376. static inline void drv_sta_notify(struct ieee80211_local *local,
  377. struct ieee80211_sub_if_data *sdata,
  378. enum sta_notify_cmd cmd,
  379. struct ieee80211_sta *sta)
  380. {
  381. sdata = get_bss_sdata(sdata);
  382. if (!check_sdata_in_driver(sdata))
  383. return;
  384. trace_drv_sta_notify(local, sdata, cmd, sta);
  385. if (local->ops->sta_notify)
  386. local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
  387. trace_drv_return_void(local);
  388. }
  389. static inline int drv_sta_add(struct ieee80211_local *local,
  390. struct ieee80211_sub_if_data *sdata,
  391. struct ieee80211_sta *sta)
  392. {
  393. int ret = 0;
  394. might_sleep();
  395. sdata = get_bss_sdata(sdata);
  396. if (!check_sdata_in_driver(sdata))
  397. return -EIO;
  398. trace_drv_sta_add(local, sdata, sta);
  399. if (local->ops->sta_add)
  400. ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
  401. trace_drv_return_int(local, ret);
  402. return ret;
  403. }
  404. static inline void drv_sta_remove(struct ieee80211_local *local,
  405. struct ieee80211_sub_if_data *sdata,
  406. struct ieee80211_sta *sta)
  407. {
  408. might_sleep();
  409. sdata = get_bss_sdata(sdata);
  410. if (!check_sdata_in_driver(sdata))
  411. return;
  412. trace_drv_sta_remove(local, sdata, sta);
  413. if (local->ops->sta_remove)
  414. local->ops->sta_remove(&local->hw, &sdata->vif, sta);
  415. trace_drv_return_void(local);
  416. }
  417. #ifdef CONFIG_MAC80211_DEBUGFS
  418. static inline void drv_sta_add_debugfs(struct ieee80211_local *local,
  419. struct ieee80211_sub_if_data *sdata,
  420. struct ieee80211_sta *sta,
  421. struct dentry *dir)
  422. {
  423. might_sleep();
  424. sdata = get_bss_sdata(sdata);
  425. if (!check_sdata_in_driver(sdata))
  426. return;
  427. if (local->ops->sta_add_debugfs)
  428. local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
  429. sta, dir);
  430. }
  431. static inline void drv_sta_remove_debugfs(struct ieee80211_local *local,
  432. struct ieee80211_sub_if_data *sdata,
  433. struct ieee80211_sta *sta,
  434. struct dentry *dir)
  435. {
  436. might_sleep();
  437. sdata = get_bss_sdata(sdata);
  438. check_sdata_in_driver(sdata);
  439. if (local->ops->sta_remove_debugfs)
  440. local->ops->sta_remove_debugfs(&local->hw, &sdata->vif,
  441. sta, dir);
  442. }
  443. #endif
  444. static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local,
  445. struct ieee80211_sub_if_data *sdata,
  446. struct sta_info *sta)
  447. {
  448. might_sleep();
  449. sdata = get_bss_sdata(sdata);
  450. if (!check_sdata_in_driver(sdata))
  451. return;
  452. trace_drv_sta_pre_rcu_remove(local, sdata, &sta->sta);
  453. if (local->ops->sta_pre_rcu_remove)
  454. local->ops->sta_pre_rcu_remove(&local->hw, &sdata->vif,
  455. &sta->sta);
  456. trace_drv_return_void(local);
  457. }
  458. static inline __must_check
  459. int drv_sta_state(struct ieee80211_local *local,
  460. struct ieee80211_sub_if_data *sdata,
  461. struct sta_info *sta,
  462. enum ieee80211_sta_state old_state,
  463. enum ieee80211_sta_state new_state)
  464. {
  465. int ret = 0;
  466. might_sleep();
  467. sdata = get_bss_sdata(sdata);
  468. if (!check_sdata_in_driver(sdata))
  469. return -EIO;
  470. trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
  471. if (local->ops->sta_state) {
  472. ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
  473. old_state, new_state);
  474. } else if (old_state == IEEE80211_STA_AUTH &&
  475. new_state == IEEE80211_STA_ASSOC) {
  476. ret = drv_sta_add(local, sdata, &sta->sta);
  477. if (ret == 0)
  478. sta->uploaded = true;
  479. } else if (old_state == IEEE80211_STA_ASSOC &&
  480. new_state == IEEE80211_STA_AUTH) {
  481. drv_sta_remove(local, sdata, &sta->sta);
  482. }
  483. trace_drv_return_int(local, ret);
  484. return ret;
  485. }
  486. static inline void drv_sta_rc_update(struct ieee80211_local *local,
  487. struct ieee80211_sub_if_data *sdata,
  488. struct ieee80211_sta *sta, u32 changed)
  489. {
  490. sdata = get_bss_sdata(sdata);
  491. if (!check_sdata_in_driver(sdata))
  492. return;
  493. WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED &&
  494. (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
  495. sdata->vif.type != NL80211_IFTYPE_MESH_POINT));
  496. trace_drv_sta_rc_update(local, sdata, sta, changed);
  497. if (local->ops->sta_rc_update)
  498. local->ops->sta_rc_update(&local->hw, &sdata->vif,
  499. sta, changed);
  500. trace_drv_return_void(local);
  501. }
  502. static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local,
  503. struct ieee80211_sub_if_data *sdata,
  504. struct ieee80211_sta *sta)
  505. {
  506. sdata = get_bss_sdata(sdata);
  507. if (!check_sdata_in_driver(sdata))
  508. return;
  509. trace_drv_sta_rate_tbl_update(local, sdata, sta);
  510. if (local->ops->sta_rate_tbl_update)
  511. local->ops->sta_rate_tbl_update(&local->hw, &sdata->vif, sta);
  512. trace_drv_return_void(local);
  513. }
  514. static inline void drv_sta_statistics(struct ieee80211_local *local,
  515. struct ieee80211_sub_if_data *sdata,
  516. struct ieee80211_sta *sta,
  517. struct station_info *sinfo)
  518. {
  519. sdata = get_bss_sdata(sdata);
  520. if (!check_sdata_in_driver(sdata))
  521. return;
  522. trace_drv_sta_statistics(local, sdata, sta);
  523. if (local->ops->sta_statistics)
  524. local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo);
  525. trace_drv_return_void(local);
  526. }
  527. static inline int drv_conf_tx(struct ieee80211_local *local,
  528. struct ieee80211_sub_if_data *sdata, u16 ac,
  529. const struct ieee80211_tx_queue_params *params)
  530. {
  531. int ret = -EOPNOTSUPP;
  532. might_sleep();
  533. if (!check_sdata_in_driver(sdata))
  534. return -EIO;
  535. if (WARN_ONCE(params->cw_min == 0 ||
  536. params->cw_min > params->cw_max,
  537. "%s: invalid CW_min/CW_max: %d/%d\n",
  538. sdata->name, params->cw_min, params->cw_max))
  539. return -EINVAL;
  540. trace_drv_conf_tx(local, sdata, ac, params);
  541. if (local->ops->conf_tx)
  542. ret = local->ops->conf_tx(&local->hw, &sdata->vif,
  543. ac, params);
  544. trace_drv_return_int(local, ret);
  545. return ret;
  546. }
  547. static inline u64 drv_get_tsf(struct ieee80211_local *local,
  548. struct ieee80211_sub_if_data *sdata)
  549. {
  550. u64 ret = -1ULL;
  551. might_sleep();
  552. if (!check_sdata_in_driver(sdata))
  553. return ret;
  554. trace_drv_get_tsf(local, sdata);
  555. if (local->ops->get_tsf)
  556. ret = local->ops->get_tsf(&local->hw, &sdata->vif);
  557. trace_drv_return_u64(local, ret);
  558. return ret;
  559. }
  560. static inline void drv_set_tsf(struct ieee80211_local *local,
  561. struct ieee80211_sub_if_data *sdata,
  562. u64 tsf)
  563. {
  564. might_sleep();
  565. if (!check_sdata_in_driver(sdata))
  566. return;
  567. trace_drv_set_tsf(local, sdata, tsf);
  568. if (local->ops->set_tsf)
  569. local->ops->set_tsf(&local->hw, &sdata->vif, tsf);
  570. trace_drv_return_void(local);
  571. }
  572. static inline void drv_reset_tsf(struct ieee80211_local *local,
  573. struct ieee80211_sub_if_data *sdata)
  574. {
  575. might_sleep();
  576. if (!check_sdata_in_driver(sdata))
  577. return;
  578. trace_drv_reset_tsf(local, sdata);
  579. if (local->ops->reset_tsf)
  580. local->ops->reset_tsf(&local->hw, &sdata->vif);
  581. trace_drv_return_void(local);
  582. }
  583. static inline int drv_tx_last_beacon(struct ieee80211_local *local)
  584. {
  585. int ret = 0; /* default unsupported op for less congestion */
  586. might_sleep();
  587. trace_drv_tx_last_beacon(local);
  588. if (local->ops->tx_last_beacon)
  589. ret = local->ops->tx_last_beacon(&local->hw);
  590. trace_drv_return_int(local, ret);
  591. return ret;
  592. }
  593. static inline int drv_ampdu_action(struct ieee80211_local *local,
  594. struct ieee80211_sub_if_data *sdata,
  595. enum ieee80211_ampdu_mlme_action action,
  596. struct ieee80211_sta *sta, u16 tid,
  597. u16 *ssn, u8 buf_size)
  598. {
  599. int ret = -EOPNOTSUPP;
  600. might_sleep();
  601. sdata = get_bss_sdata(sdata);
  602. if (!check_sdata_in_driver(sdata))
  603. return -EIO;
  604. trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
  605. if (local->ops->ampdu_action)
  606. ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action,
  607. sta, tid, ssn, buf_size);
  608. trace_drv_return_int(local, ret);
  609. return ret;
  610. }
  611. static inline int drv_get_survey(struct ieee80211_local *local, int idx,
  612. struct survey_info *survey)
  613. {
  614. int ret = -EOPNOTSUPP;
  615. trace_drv_get_survey(local, idx, survey);
  616. if (local->ops->get_survey)
  617. ret = local->ops->get_survey(&local->hw, idx, survey);
  618. trace_drv_return_int(local, ret);
  619. return ret;
  620. }
  621. static inline void drv_rfkill_poll(struct ieee80211_local *local)
  622. {
  623. might_sleep();
  624. if (local->ops->rfkill_poll)
  625. local->ops->rfkill_poll(&local->hw);
  626. }
  627. static inline void drv_flush(struct ieee80211_local *local,
  628. struct ieee80211_sub_if_data *sdata,
  629. u32 queues, bool drop)
  630. {
  631. struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL;
  632. might_sleep();
  633. if (sdata && !check_sdata_in_driver(sdata))
  634. return;
  635. trace_drv_flush(local, queues, drop);
  636. if (local->ops->flush)
  637. local->ops->flush(&local->hw, vif, queues, drop);
  638. trace_drv_return_void(local);
  639. }
  640. static inline void drv_channel_switch(struct ieee80211_local *local,
  641. struct ieee80211_sub_if_data *sdata,
  642. struct ieee80211_channel_switch *ch_switch)
  643. {
  644. might_sleep();
  645. trace_drv_channel_switch(local, sdata, ch_switch);
  646. local->ops->channel_switch(&local->hw, &sdata->vif, ch_switch);
  647. trace_drv_return_void(local);
  648. }
  649. static inline int drv_set_antenna(struct ieee80211_local *local,
  650. u32 tx_ant, u32 rx_ant)
  651. {
  652. int ret = -EOPNOTSUPP;
  653. might_sleep();
  654. if (local->ops->set_antenna)
  655. ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
  656. trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
  657. return ret;
  658. }
  659. static inline int drv_get_antenna(struct ieee80211_local *local,
  660. u32 *tx_ant, u32 *rx_ant)
  661. {
  662. int ret = -EOPNOTSUPP;
  663. might_sleep();
  664. if (local->ops->get_antenna)
  665. ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
  666. trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
  667. return ret;
  668. }
  669. static inline int drv_remain_on_channel(struct ieee80211_local *local,
  670. struct ieee80211_sub_if_data *sdata,
  671. struct ieee80211_channel *chan,
  672. unsigned int duration,
  673. enum ieee80211_roc_type type)
  674. {
  675. int ret;
  676. might_sleep();
  677. trace_drv_remain_on_channel(local, sdata, chan, duration, type);
  678. ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
  679. chan, duration, type);
  680. trace_drv_return_int(local, ret);
  681. return ret;
  682. }
  683. static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
  684. {
  685. int ret;
  686. might_sleep();
  687. trace_drv_cancel_remain_on_channel(local);
  688. ret = local->ops->cancel_remain_on_channel(&local->hw);
  689. trace_drv_return_int(local, ret);
  690. return ret;
  691. }
  692. static inline int drv_set_ringparam(struct ieee80211_local *local,
  693. u32 tx, u32 rx)
  694. {
  695. int ret = -ENOTSUPP;
  696. might_sleep();
  697. trace_drv_set_ringparam(local, tx, rx);
  698. if (local->ops->set_ringparam)
  699. ret = local->ops->set_ringparam(&local->hw, tx, rx);
  700. trace_drv_return_int(local, ret);
  701. return ret;
  702. }
  703. static inline void drv_get_ringparam(struct ieee80211_local *local,
  704. u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
  705. {
  706. might_sleep();
  707. trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
  708. if (local->ops->get_ringparam)
  709. local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
  710. trace_drv_return_void(local);
  711. }
  712. static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
  713. {
  714. bool ret = false;
  715. might_sleep();
  716. trace_drv_tx_frames_pending(local);
  717. if (local->ops->tx_frames_pending)
  718. ret = local->ops->tx_frames_pending(&local->hw);
  719. trace_drv_return_bool(local, ret);
  720. return ret;
  721. }
  722. static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
  723. struct ieee80211_sub_if_data *sdata,
  724. const struct cfg80211_bitrate_mask *mask)
  725. {
  726. int ret = -EOPNOTSUPP;
  727. might_sleep();
  728. if (!check_sdata_in_driver(sdata))
  729. return -EIO;
  730. trace_drv_set_bitrate_mask(local, sdata, mask);
  731. if (local->ops->set_bitrate_mask)
  732. ret = local->ops->set_bitrate_mask(&local->hw,
  733. &sdata->vif, mask);
  734. trace_drv_return_int(local, ret);
  735. return ret;
  736. }
  737. static inline void drv_set_rekey_data(struct ieee80211_local *local,
  738. struct ieee80211_sub_if_data *sdata,
  739. struct cfg80211_gtk_rekey_data *data)
  740. {
  741. if (!check_sdata_in_driver(sdata))
  742. return;
  743. trace_drv_set_rekey_data(local, sdata, data);
  744. if (local->ops->set_rekey_data)
  745. local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
  746. trace_drv_return_void(local);
  747. }
  748. static inline void drv_event_callback(struct ieee80211_local *local,
  749. struct ieee80211_sub_if_data *sdata,
  750. const struct ieee80211_event *event)
  751. {
  752. trace_drv_event_callback(local, sdata, event);
  753. if (local->ops->event_callback)
  754. local->ops->event_callback(&local->hw, &sdata->vif, event);
  755. trace_drv_return_void(local);
  756. }
  757. static inline void
  758. drv_release_buffered_frames(struct ieee80211_local *local,
  759. struct sta_info *sta, u16 tids, int num_frames,
  760. enum ieee80211_frame_release_type reason,
  761. bool more_data)
  762. {
  763. trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
  764. reason, more_data);
  765. if (local->ops->release_buffered_frames)
  766. local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
  767. num_frames, reason,
  768. more_data);
  769. trace_drv_return_void(local);
  770. }
  771. static inline void
  772. drv_allow_buffered_frames(struct ieee80211_local *local,
  773. struct sta_info *sta, u16 tids, int num_frames,
  774. enum ieee80211_frame_release_type reason,
  775. bool more_data)
  776. {
  777. trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
  778. reason, more_data);
  779. if (local->ops->allow_buffered_frames)
  780. local->ops->allow_buffered_frames(&local->hw, &sta->sta,
  781. tids, num_frames, reason,
  782. more_data);
  783. trace_drv_return_void(local);
  784. }
  785. static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
  786. struct ieee80211_sub_if_data *sdata)
  787. {
  788. might_sleep();
  789. if (!check_sdata_in_driver(sdata))
  790. return;
  791. WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
  792. trace_drv_mgd_prepare_tx(local, sdata);
  793. if (local->ops->mgd_prepare_tx)
  794. local->ops->mgd_prepare_tx(&local->hw, &sdata->vif);
  795. trace_drv_return_void(local);
  796. }
  797. static inline void
  798. drv_mgd_protect_tdls_discover(struct ieee80211_local *local,
  799. struct ieee80211_sub_if_data *sdata)
  800. {
  801. might_sleep();
  802. if (!check_sdata_in_driver(sdata))
  803. return;
  804. WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
  805. trace_drv_mgd_protect_tdls_discover(local, sdata);
  806. if (local->ops->mgd_protect_tdls_discover)
  807. local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif);
  808. trace_drv_return_void(local);
  809. }
  810. static inline int drv_add_chanctx(struct ieee80211_local *local,
  811. struct ieee80211_chanctx *ctx)
  812. {
  813. int ret = -EOPNOTSUPP;
  814. trace_drv_add_chanctx(local, ctx);
  815. if (local->ops->add_chanctx)
  816. ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
  817. trace_drv_return_int(local, ret);
  818. if (!ret)
  819. ctx->driver_present = true;
  820. return ret;
  821. }
  822. static inline void drv_remove_chanctx(struct ieee80211_local *local,
  823. struct ieee80211_chanctx *ctx)
  824. {
  825. if (WARN_ON(!ctx->driver_present))
  826. return;
  827. trace_drv_remove_chanctx(local, ctx);
  828. if (local->ops->remove_chanctx)
  829. local->ops->remove_chanctx(&local->hw, &ctx->conf);
  830. trace_drv_return_void(local);
  831. ctx->driver_present = false;
  832. }
  833. static inline void drv_change_chanctx(struct ieee80211_local *local,
  834. struct ieee80211_chanctx *ctx,
  835. u32 changed)
  836. {
  837. trace_drv_change_chanctx(local, ctx, changed);
  838. if (local->ops->change_chanctx) {
  839. WARN_ON_ONCE(!ctx->driver_present);
  840. local->ops->change_chanctx(&local->hw, &ctx->conf, changed);
  841. }
  842. trace_drv_return_void(local);
  843. }
  844. static inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
  845. struct ieee80211_sub_if_data *sdata,
  846. struct ieee80211_chanctx *ctx)
  847. {
  848. int ret = 0;
  849. if (!check_sdata_in_driver(sdata))
  850. return -EIO;
  851. trace_drv_assign_vif_chanctx(local, sdata, ctx);
  852. if (local->ops->assign_vif_chanctx) {
  853. WARN_ON_ONCE(!ctx->driver_present);
  854. ret = local->ops->assign_vif_chanctx(&local->hw,
  855. &sdata->vif,
  856. &ctx->conf);
  857. }
  858. trace_drv_return_int(local, ret);
  859. return ret;
  860. }
  861. static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
  862. struct ieee80211_sub_if_data *sdata,
  863. struct ieee80211_chanctx *ctx)
  864. {
  865. if (!check_sdata_in_driver(sdata))
  866. return;
  867. trace_drv_unassign_vif_chanctx(local, sdata, ctx);
  868. if (local->ops->unassign_vif_chanctx) {
  869. WARN_ON_ONCE(!ctx->driver_present);
  870. local->ops->unassign_vif_chanctx(&local->hw,
  871. &sdata->vif,
  872. &ctx->conf);
  873. }
  874. trace_drv_return_void(local);
  875. }
  876. static inline int
  877. drv_switch_vif_chanctx(struct ieee80211_local *local,
  878. struct ieee80211_vif_chanctx_switch *vifs,
  879. int n_vifs,
  880. enum ieee80211_chanctx_switch_mode mode)
  881. {
  882. int ret = 0;
  883. int i;
  884. if (!local->ops->switch_vif_chanctx)
  885. return -EOPNOTSUPP;
  886. for (i = 0; i < n_vifs; i++) {
  887. struct ieee80211_chanctx *new_ctx =
  888. container_of(vifs[i].new_ctx,
  889. struct ieee80211_chanctx,
  890. conf);
  891. struct ieee80211_chanctx *old_ctx =
  892. container_of(vifs[i].old_ctx,
  893. struct ieee80211_chanctx,
  894. conf);
  895. WARN_ON_ONCE(!old_ctx->driver_present);
  896. WARN_ON_ONCE((mode == CHANCTX_SWMODE_SWAP_CONTEXTS &&
  897. new_ctx->driver_present) ||
  898. (mode == CHANCTX_SWMODE_REASSIGN_VIF &&
  899. !new_ctx->driver_present));
  900. }
  901. trace_drv_switch_vif_chanctx(local, vifs, n_vifs, mode);
  902. ret = local->ops->switch_vif_chanctx(&local->hw,
  903. vifs, n_vifs, mode);
  904. trace_drv_return_int(local, ret);
  905. if (!ret && mode == CHANCTX_SWMODE_SWAP_CONTEXTS) {
  906. for (i = 0; i < n_vifs; i++) {
  907. struct ieee80211_chanctx *new_ctx =
  908. container_of(vifs[i].new_ctx,
  909. struct ieee80211_chanctx,
  910. conf);
  911. struct ieee80211_chanctx *old_ctx =
  912. container_of(vifs[i].old_ctx,
  913. struct ieee80211_chanctx,
  914. conf);
  915. new_ctx->driver_present = true;
  916. old_ctx->driver_present = false;
  917. }
  918. }
  919. return ret;
  920. }
  921. static inline int drv_start_ap(struct ieee80211_local *local,
  922. struct ieee80211_sub_if_data *sdata)
  923. {
  924. int ret = 0;
  925. if (!check_sdata_in_driver(sdata))
  926. return -EIO;
  927. trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf);
  928. if (local->ops->start_ap)
  929. ret = local->ops->start_ap(&local->hw, &sdata->vif);
  930. trace_drv_return_int(local, ret);
  931. return ret;
  932. }
  933. static inline void drv_stop_ap(struct ieee80211_local *local,
  934. struct ieee80211_sub_if_data *sdata)
  935. {
  936. if (!check_sdata_in_driver(sdata))
  937. return;
  938. trace_drv_stop_ap(local, sdata);
  939. if (local->ops->stop_ap)
  940. local->ops->stop_ap(&local->hw, &sdata->vif);
  941. trace_drv_return_void(local);
  942. }
  943. static inline void
  944. drv_reconfig_complete(struct ieee80211_local *local,
  945. enum ieee80211_reconfig_type reconfig_type)
  946. {
  947. might_sleep();
  948. trace_drv_reconfig_complete(local, reconfig_type);
  949. if (local->ops->reconfig_complete)
  950. local->ops->reconfig_complete(&local->hw, reconfig_type);
  951. trace_drv_return_void(local);
  952. }
  953. static inline void
  954. drv_set_default_unicast_key(struct ieee80211_local *local,
  955. struct ieee80211_sub_if_data *sdata,
  956. int key_idx)
  957. {
  958. if (!check_sdata_in_driver(sdata))
  959. return;
  960. WARN_ON_ONCE(key_idx < -1 || key_idx > 3);
  961. trace_drv_set_default_unicast_key(local, sdata, key_idx);
  962. if (local->ops->set_default_unicast_key)
  963. local->ops->set_default_unicast_key(&local->hw, &sdata->vif,
  964. key_idx);
  965. trace_drv_return_void(local);
  966. }
  967. #if IS_ENABLED(CONFIG_IPV6)
  968. static inline void drv_ipv6_addr_change(struct ieee80211_local *local,
  969. struct ieee80211_sub_if_data *sdata,
  970. struct inet6_dev *idev)
  971. {
  972. trace_drv_ipv6_addr_change(local, sdata);
  973. if (local->ops->ipv6_addr_change)
  974. local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev);
  975. trace_drv_return_void(local);
  976. }
  977. #endif
  978. static inline void
  979. drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata,
  980. struct cfg80211_chan_def *chandef)
  981. {
  982. struct ieee80211_local *local = sdata->local;
  983. if (local->ops->channel_switch_beacon) {
  984. trace_drv_channel_switch_beacon(local, sdata, chandef);
  985. local->ops->channel_switch_beacon(&local->hw, &sdata->vif,
  986. chandef);
  987. }
  988. }
  989. static inline int
  990. drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata,
  991. struct ieee80211_channel_switch *ch_switch)
  992. {
  993. struct ieee80211_local *local = sdata->local;
  994. int ret = 0;
  995. if (!check_sdata_in_driver(sdata))
  996. return -EIO;
  997. trace_drv_pre_channel_switch(local, sdata, ch_switch);
  998. if (local->ops->pre_channel_switch)
  999. ret = local->ops->pre_channel_switch(&local->hw, &sdata->vif,
  1000. ch_switch);
  1001. trace_drv_return_int(local, ret);
  1002. return ret;
  1003. }
  1004. static inline int
  1005. drv_post_channel_switch(struct ieee80211_sub_if_data *sdata)
  1006. {
  1007. struct ieee80211_local *local = sdata->local;
  1008. int ret = 0;
  1009. if (!check_sdata_in_driver(sdata))
  1010. return -EIO;
  1011. trace_drv_post_channel_switch(local, sdata);
  1012. if (local->ops->post_channel_switch)
  1013. ret = local->ops->post_channel_switch(&local->hw, &sdata->vif);
  1014. trace_drv_return_int(local, ret);
  1015. return ret;
  1016. }
  1017. static inline int drv_join_ibss(struct ieee80211_local *local,
  1018. struct ieee80211_sub_if_data *sdata)
  1019. {
  1020. int ret = 0;
  1021. might_sleep();
  1022. if (!check_sdata_in_driver(sdata))
  1023. return -EIO;
  1024. trace_drv_join_ibss(local, sdata, &sdata->vif.bss_conf);
  1025. if (local->ops->join_ibss)
  1026. ret = local->ops->join_ibss(&local->hw, &sdata->vif);
  1027. trace_drv_return_int(local, ret);
  1028. return ret;
  1029. }
  1030. static inline void drv_leave_ibss(struct ieee80211_local *local,
  1031. struct ieee80211_sub_if_data *sdata)
  1032. {
  1033. might_sleep();
  1034. if (!check_sdata_in_driver(sdata))
  1035. return;
  1036. trace_drv_leave_ibss(local, sdata);
  1037. if (local->ops->leave_ibss)
  1038. local->ops->leave_ibss(&local->hw, &sdata->vif);
  1039. trace_drv_return_void(local);
  1040. }
  1041. static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
  1042. struct ieee80211_sta *sta)
  1043. {
  1044. u32 ret = 0;
  1045. trace_drv_get_expected_throughput(sta);
  1046. if (local->ops->get_expected_throughput)
  1047. ret = local->ops->get_expected_throughput(sta);
  1048. trace_drv_return_u32(local, ret);
  1049. return ret;
  1050. }
  1051. static inline int drv_get_txpower(struct ieee80211_local *local,
  1052. struct ieee80211_sub_if_data *sdata, int *dbm)
  1053. {
  1054. int ret;
  1055. if (!local->ops->get_txpower)
  1056. return -EOPNOTSUPP;
  1057. ret = local->ops->get_txpower(&local->hw, &sdata->vif, dbm);
  1058. trace_drv_get_txpower(local, sdata, *dbm, ret);
  1059. return ret;
  1060. }
  1061. static inline int
  1062. drv_tdls_channel_switch(struct ieee80211_local *local,
  1063. struct ieee80211_sub_if_data *sdata,
  1064. struct ieee80211_sta *sta, u8 oper_class,
  1065. struct cfg80211_chan_def *chandef,
  1066. struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie)
  1067. {
  1068. int ret;
  1069. might_sleep();
  1070. if (!check_sdata_in_driver(sdata))
  1071. return -EIO;
  1072. if (!local->ops->tdls_channel_switch)
  1073. return -EOPNOTSUPP;
  1074. trace_drv_tdls_channel_switch(local, sdata, sta, oper_class, chandef);
  1075. ret = local->ops->tdls_channel_switch(&local->hw, &sdata->vif, sta,
  1076. oper_class, chandef, tmpl_skb,
  1077. ch_sw_tm_ie);
  1078. trace_drv_return_int(local, ret);
  1079. return ret;
  1080. }
  1081. static inline void
  1082. drv_tdls_cancel_channel_switch(struct ieee80211_local *local,
  1083. struct ieee80211_sub_if_data *sdata,
  1084. struct ieee80211_sta *sta)
  1085. {
  1086. might_sleep();
  1087. if (!check_sdata_in_driver(sdata))
  1088. return;
  1089. if (!local->ops->tdls_cancel_channel_switch)
  1090. return;
  1091. trace_drv_tdls_cancel_channel_switch(local, sdata, sta);
  1092. local->ops->tdls_cancel_channel_switch(&local->hw, &sdata->vif, sta);
  1093. trace_drv_return_void(local);
  1094. }
  1095. static inline void
  1096. drv_tdls_recv_channel_switch(struct ieee80211_local *local,
  1097. struct ieee80211_sub_if_data *sdata,
  1098. struct ieee80211_tdls_ch_sw_params *params)
  1099. {
  1100. trace_drv_tdls_recv_channel_switch(local, sdata, params);
  1101. if (local->ops->tdls_recv_channel_switch)
  1102. local->ops->tdls_recv_channel_switch(&local->hw, &sdata->vif,
  1103. params);
  1104. trace_drv_return_void(local);
  1105. }
  1106. static inline void drv_wake_tx_queue(struct ieee80211_local *local,
  1107. struct txq_info *txq)
  1108. {
  1109. struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
  1110. if (!check_sdata_in_driver(sdata))
  1111. return;
  1112. trace_drv_wake_tx_queue(local, sdata, txq);
  1113. local->ops->wake_tx_queue(&local->hw, &txq->txq);
  1114. }
  1115. #endif /* __MAC80211_DRIVER_OPS */