driver-ops.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  1. #ifndef __MAC80211_DRIVER_OPS
  2. #define __MAC80211_DRIVER_OPS
  3. #include <net/mac80211.h>
  4. #include "ieee80211_i.h"
  5. #include "driver-trace.h"
  6. static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
  7. {
  8. WARN_ON(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER));
  9. }
  10. static inline struct ieee80211_sub_if_data *
  11. get_bss_sdata(struct ieee80211_sub_if_data *sdata)
  12. {
  13. if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
  14. sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  15. u.ap);
  16. return sdata;
  17. }
  18. static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb)
  19. {
  20. local->ops->tx(&local->hw, skb);
  21. }
  22. static inline void drv_tx_frags(struct ieee80211_local *local,
  23. struct ieee80211_vif *vif,
  24. struct ieee80211_sta *sta,
  25. struct sk_buff_head *skbs)
  26. {
  27. local->ops->tx_frags(&local->hw, vif, sta, skbs);
  28. }
  29. static inline int drv_start(struct ieee80211_local *local)
  30. {
  31. int ret;
  32. might_sleep();
  33. trace_drv_start(local);
  34. local->started = true;
  35. smp_mb();
  36. ret = local->ops->start(&local->hw);
  37. trace_drv_return_int(local, ret);
  38. return ret;
  39. }
  40. static inline void drv_stop(struct ieee80211_local *local)
  41. {
  42. might_sleep();
  43. trace_drv_stop(local);
  44. local->ops->stop(&local->hw);
  45. trace_drv_return_void(local);
  46. /* sync away all work on the tasklet before clearing started */
  47. tasklet_disable(&local->tasklet);
  48. tasklet_enable(&local->tasklet);
  49. barrier();
  50. local->started = false;
  51. }
  52. #ifdef CONFIG_PM
  53. static inline int drv_suspend(struct ieee80211_local *local,
  54. struct cfg80211_wowlan *wowlan)
  55. {
  56. int ret;
  57. might_sleep();
  58. trace_drv_suspend(local);
  59. ret = local->ops->suspend(&local->hw, wowlan);
  60. trace_drv_return_int(local, ret);
  61. return ret;
  62. }
  63. static inline int drv_resume(struct ieee80211_local *local)
  64. {
  65. int ret;
  66. might_sleep();
  67. trace_drv_resume(local);
  68. ret = local->ops->resume(&local->hw);
  69. trace_drv_return_int(local, ret);
  70. return ret;
  71. }
  72. #endif
  73. static inline int drv_add_interface(struct ieee80211_local *local,
  74. struct ieee80211_sub_if_data *sdata)
  75. {
  76. int ret;
  77. might_sleep();
  78. if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
  79. sdata->vif.type == NL80211_IFTYPE_MONITOR))
  80. return -EINVAL;
  81. trace_drv_add_interface(local, sdata);
  82. ret = local->ops->add_interface(&local->hw, &sdata->vif);
  83. trace_drv_return_int(local, ret);
  84. if (ret == 0)
  85. sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
  86. return ret;
  87. }
  88. static inline int drv_change_interface(struct ieee80211_local *local,
  89. struct ieee80211_sub_if_data *sdata,
  90. enum nl80211_iftype type, bool p2p)
  91. {
  92. int ret;
  93. might_sleep();
  94. check_sdata_in_driver(sdata);
  95. trace_drv_change_interface(local, sdata, type, p2p);
  96. ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
  97. trace_drv_return_int(local, ret);
  98. return ret;
  99. }
  100. static inline void drv_remove_interface(struct ieee80211_local *local,
  101. struct ieee80211_sub_if_data *sdata)
  102. {
  103. might_sleep();
  104. check_sdata_in_driver(sdata);
  105. trace_drv_remove_interface(local, sdata);
  106. local->ops->remove_interface(&local->hw, &sdata->vif);
  107. sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
  108. trace_drv_return_void(local);
  109. }
  110. static inline int drv_config(struct ieee80211_local *local, u32 changed)
  111. {
  112. int ret;
  113. might_sleep();
  114. trace_drv_config(local, changed);
  115. ret = local->ops->config(&local->hw, changed);
  116. trace_drv_return_int(local, ret);
  117. return ret;
  118. }
  119. static inline void drv_bss_info_changed(struct ieee80211_local *local,
  120. struct ieee80211_sub_if_data *sdata,
  121. struct ieee80211_bss_conf *info,
  122. u32 changed)
  123. {
  124. might_sleep();
  125. check_sdata_in_driver(sdata);
  126. trace_drv_bss_info_changed(local, sdata, info, changed);
  127. if (local->ops->bss_info_changed)
  128. local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
  129. trace_drv_return_void(local);
  130. }
  131. static inline int drv_tx_sync(struct ieee80211_local *local,
  132. struct ieee80211_sub_if_data *sdata,
  133. const u8 *bssid,
  134. enum ieee80211_tx_sync_type type)
  135. {
  136. int ret = 0;
  137. might_sleep();
  138. check_sdata_in_driver(sdata);
  139. trace_drv_tx_sync(local, sdata, bssid, type);
  140. if (local->ops->tx_sync)
  141. ret = local->ops->tx_sync(&local->hw, &sdata->vif,
  142. bssid, type);
  143. trace_drv_return_int(local, ret);
  144. return ret;
  145. }
  146. static inline void drv_finish_tx_sync(struct ieee80211_local *local,
  147. struct ieee80211_sub_if_data *sdata,
  148. const u8 *bssid,
  149. enum ieee80211_tx_sync_type type)
  150. {
  151. might_sleep();
  152. check_sdata_in_driver(sdata);
  153. trace_drv_finish_tx_sync(local, sdata, bssid, type);
  154. if (local->ops->finish_tx_sync)
  155. local->ops->finish_tx_sync(&local->hw, &sdata->vif,
  156. bssid, type);
  157. trace_drv_return_void(local);
  158. }
  159. static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
  160. struct netdev_hw_addr_list *mc_list)
  161. {
  162. u64 ret = 0;
  163. trace_drv_prepare_multicast(local, mc_list->count);
  164. if (local->ops->prepare_multicast)
  165. ret = local->ops->prepare_multicast(&local->hw, mc_list);
  166. trace_drv_return_u64(local, ret);
  167. return ret;
  168. }
  169. static inline void drv_configure_filter(struct ieee80211_local *local,
  170. unsigned int changed_flags,
  171. unsigned int *total_flags,
  172. u64 multicast)
  173. {
  174. might_sleep();
  175. trace_drv_configure_filter(local, changed_flags, total_flags,
  176. multicast);
  177. local->ops->configure_filter(&local->hw, changed_flags, total_flags,
  178. multicast);
  179. trace_drv_return_void(local);
  180. }
  181. static inline int drv_set_tim(struct ieee80211_local *local,
  182. struct ieee80211_sta *sta, bool set)
  183. {
  184. int ret = 0;
  185. trace_drv_set_tim(local, sta, set);
  186. if (local->ops->set_tim)
  187. ret = local->ops->set_tim(&local->hw, sta, set);
  188. trace_drv_return_int(local, ret);
  189. return ret;
  190. }
  191. static inline int drv_set_key(struct ieee80211_local *local,
  192. enum set_key_cmd cmd,
  193. struct ieee80211_sub_if_data *sdata,
  194. struct ieee80211_sta *sta,
  195. struct ieee80211_key_conf *key)
  196. {
  197. int ret;
  198. might_sleep();
  199. check_sdata_in_driver(sdata);
  200. trace_drv_set_key(local, cmd, sdata, sta, key);
  201. ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
  202. trace_drv_return_int(local, ret);
  203. return ret;
  204. }
  205. static inline void drv_update_tkip_key(struct ieee80211_local *local,
  206. struct ieee80211_sub_if_data *sdata,
  207. struct ieee80211_key_conf *conf,
  208. struct sta_info *sta, u32 iv32,
  209. u16 *phase1key)
  210. {
  211. struct ieee80211_sta *ista = NULL;
  212. if (sta)
  213. ista = &sta->sta;
  214. check_sdata_in_driver(sdata);
  215. trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
  216. if (local->ops->update_tkip_key)
  217. local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
  218. ista, iv32, phase1key);
  219. trace_drv_return_void(local);
  220. }
  221. static inline int drv_hw_scan(struct ieee80211_local *local,
  222. struct ieee80211_sub_if_data *sdata,
  223. struct cfg80211_scan_request *req)
  224. {
  225. int ret;
  226. might_sleep();
  227. check_sdata_in_driver(sdata);
  228. trace_drv_hw_scan(local, sdata);
  229. ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
  230. trace_drv_return_int(local, ret);
  231. return ret;
  232. }
  233. static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
  234. struct ieee80211_sub_if_data *sdata)
  235. {
  236. might_sleep();
  237. check_sdata_in_driver(sdata);
  238. trace_drv_cancel_hw_scan(local, sdata);
  239. local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
  240. trace_drv_return_void(local);
  241. }
  242. static inline int
  243. drv_sched_scan_start(struct ieee80211_local *local,
  244. struct ieee80211_sub_if_data *sdata,
  245. struct cfg80211_sched_scan_request *req,
  246. struct ieee80211_sched_scan_ies *ies)
  247. {
  248. int ret;
  249. might_sleep();
  250. check_sdata_in_driver(sdata);
  251. trace_drv_sched_scan_start(local, sdata);
  252. ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
  253. req, ies);
  254. trace_drv_return_int(local, ret);
  255. return ret;
  256. }
  257. static inline void drv_sched_scan_stop(struct ieee80211_local *local,
  258. struct ieee80211_sub_if_data *sdata)
  259. {
  260. might_sleep();
  261. check_sdata_in_driver(sdata);
  262. trace_drv_sched_scan_stop(local, sdata);
  263. local->ops->sched_scan_stop(&local->hw, &sdata->vif);
  264. trace_drv_return_void(local);
  265. }
  266. static inline void drv_sw_scan_start(struct ieee80211_local *local)
  267. {
  268. might_sleep();
  269. trace_drv_sw_scan_start(local);
  270. if (local->ops->sw_scan_start)
  271. local->ops->sw_scan_start(&local->hw);
  272. trace_drv_return_void(local);
  273. }
  274. static inline void drv_sw_scan_complete(struct ieee80211_local *local)
  275. {
  276. might_sleep();
  277. trace_drv_sw_scan_complete(local);
  278. if (local->ops->sw_scan_complete)
  279. local->ops->sw_scan_complete(&local->hw);
  280. trace_drv_return_void(local);
  281. }
  282. static inline int drv_get_stats(struct ieee80211_local *local,
  283. struct ieee80211_low_level_stats *stats)
  284. {
  285. int ret = -EOPNOTSUPP;
  286. might_sleep();
  287. if (local->ops->get_stats)
  288. ret = local->ops->get_stats(&local->hw, stats);
  289. trace_drv_get_stats(local, stats, ret);
  290. return ret;
  291. }
  292. static inline void drv_get_tkip_seq(struct ieee80211_local *local,
  293. u8 hw_key_idx, u32 *iv32, u16 *iv16)
  294. {
  295. if (local->ops->get_tkip_seq)
  296. local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
  297. trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16);
  298. }
  299. static inline int drv_set_frag_threshold(struct ieee80211_local *local,
  300. u32 value)
  301. {
  302. int ret = 0;
  303. might_sleep();
  304. trace_drv_set_frag_threshold(local, value);
  305. if (local->ops->set_frag_threshold)
  306. ret = local->ops->set_frag_threshold(&local->hw, value);
  307. trace_drv_return_int(local, ret);
  308. return ret;
  309. }
  310. static inline int drv_set_rts_threshold(struct ieee80211_local *local,
  311. u32 value)
  312. {
  313. int ret = 0;
  314. might_sleep();
  315. trace_drv_set_rts_threshold(local, value);
  316. if (local->ops->set_rts_threshold)
  317. ret = local->ops->set_rts_threshold(&local->hw, value);
  318. trace_drv_return_int(local, ret);
  319. return ret;
  320. }
  321. static inline int drv_set_coverage_class(struct ieee80211_local *local,
  322. u8 value)
  323. {
  324. int ret = 0;
  325. might_sleep();
  326. trace_drv_set_coverage_class(local, value);
  327. if (local->ops->set_coverage_class)
  328. local->ops->set_coverage_class(&local->hw, value);
  329. else
  330. ret = -EOPNOTSUPP;
  331. trace_drv_return_int(local, ret);
  332. return ret;
  333. }
  334. static inline void drv_sta_notify(struct ieee80211_local *local,
  335. struct ieee80211_sub_if_data *sdata,
  336. enum sta_notify_cmd cmd,
  337. struct ieee80211_sta *sta)
  338. {
  339. sdata = get_bss_sdata(sdata);
  340. check_sdata_in_driver(sdata);
  341. trace_drv_sta_notify(local, sdata, cmd, sta);
  342. if (local->ops->sta_notify)
  343. local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
  344. trace_drv_return_void(local);
  345. }
  346. static inline int drv_sta_add(struct ieee80211_local *local,
  347. struct ieee80211_sub_if_data *sdata,
  348. struct ieee80211_sta *sta)
  349. {
  350. int ret = 0;
  351. might_sleep();
  352. sdata = get_bss_sdata(sdata);
  353. check_sdata_in_driver(sdata);
  354. trace_drv_sta_add(local, sdata, sta);
  355. if (local->ops->sta_add)
  356. ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
  357. trace_drv_return_int(local, ret);
  358. return ret;
  359. }
  360. static inline void drv_sta_remove(struct ieee80211_local *local,
  361. struct ieee80211_sub_if_data *sdata,
  362. struct ieee80211_sta *sta)
  363. {
  364. might_sleep();
  365. sdata = get_bss_sdata(sdata);
  366. check_sdata_in_driver(sdata);
  367. trace_drv_sta_remove(local, sdata, sta);
  368. if (local->ops->sta_remove)
  369. local->ops->sta_remove(&local->hw, &sdata->vif, sta);
  370. trace_drv_return_void(local);
  371. }
  372. static inline int drv_conf_tx(struct ieee80211_local *local,
  373. struct ieee80211_sub_if_data *sdata, u16 queue,
  374. const struct ieee80211_tx_queue_params *params)
  375. {
  376. int ret = -EOPNOTSUPP;
  377. might_sleep();
  378. check_sdata_in_driver(sdata);
  379. trace_drv_conf_tx(local, sdata, queue, params);
  380. if (local->ops->conf_tx)
  381. ret = local->ops->conf_tx(&local->hw, &sdata->vif,
  382. queue, params);
  383. trace_drv_return_int(local, ret);
  384. return ret;
  385. }
  386. static inline u64 drv_get_tsf(struct ieee80211_local *local,
  387. struct ieee80211_sub_if_data *sdata)
  388. {
  389. u64 ret = -1ULL;
  390. might_sleep();
  391. check_sdata_in_driver(sdata);
  392. trace_drv_get_tsf(local, sdata);
  393. if (local->ops->get_tsf)
  394. ret = local->ops->get_tsf(&local->hw, &sdata->vif);
  395. trace_drv_return_u64(local, ret);
  396. return ret;
  397. }
  398. static inline void drv_set_tsf(struct ieee80211_local *local,
  399. struct ieee80211_sub_if_data *sdata,
  400. u64 tsf)
  401. {
  402. might_sleep();
  403. check_sdata_in_driver(sdata);
  404. trace_drv_set_tsf(local, sdata, tsf);
  405. if (local->ops->set_tsf)
  406. local->ops->set_tsf(&local->hw, &sdata->vif, tsf);
  407. trace_drv_return_void(local);
  408. }
  409. static inline void drv_reset_tsf(struct ieee80211_local *local,
  410. struct ieee80211_sub_if_data *sdata)
  411. {
  412. might_sleep();
  413. check_sdata_in_driver(sdata);
  414. trace_drv_reset_tsf(local, sdata);
  415. if (local->ops->reset_tsf)
  416. local->ops->reset_tsf(&local->hw, &sdata->vif);
  417. trace_drv_return_void(local);
  418. }
  419. static inline int drv_tx_last_beacon(struct ieee80211_local *local)
  420. {
  421. int ret = 0; /* default unsuported op for less congestion */
  422. might_sleep();
  423. trace_drv_tx_last_beacon(local);
  424. if (local->ops->tx_last_beacon)
  425. ret = local->ops->tx_last_beacon(&local->hw);
  426. trace_drv_return_int(local, ret);
  427. return ret;
  428. }
  429. static inline int drv_ampdu_action(struct ieee80211_local *local,
  430. struct ieee80211_sub_if_data *sdata,
  431. enum ieee80211_ampdu_mlme_action action,
  432. struct ieee80211_sta *sta, u16 tid,
  433. u16 *ssn, u8 buf_size)
  434. {
  435. int ret = -EOPNOTSUPP;
  436. might_sleep();
  437. sdata = get_bss_sdata(sdata);
  438. check_sdata_in_driver(sdata);
  439. trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
  440. if (local->ops->ampdu_action)
  441. ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action,
  442. sta, tid, ssn, buf_size);
  443. trace_drv_return_int(local, ret);
  444. return ret;
  445. }
  446. static inline int drv_get_survey(struct ieee80211_local *local, int idx,
  447. struct survey_info *survey)
  448. {
  449. int ret = -EOPNOTSUPP;
  450. trace_drv_get_survey(local, idx, survey);
  451. if (local->ops->get_survey)
  452. ret = local->ops->get_survey(&local->hw, idx, survey);
  453. trace_drv_return_int(local, ret);
  454. return ret;
  455. }
  456. static inline void drv_rfkill_poll(struct ieee80211_local *local)
  457. {
  458. might_sleep();
  459. if (local->ops->rfkill_poll)
  460. local->ops->rfkill_poll(&local->hw);
  461. }
  462. static inline void drv_flush(struct ieee80211_local *local, bool drop)
  463. {
  464. might_sleep();
  465. trace_drv_flush(local, drop);
  466. if (local->ops->flush)
  467. local->ops->flush(&local->hw, drop);
  468. trace_drv_return_void(local);
  469. }
  470. static inline void drv_channel_switch(struct ieee80211_local *local,
  471. struct ieee80211_channel_switch *ch_switch)
  472. {
  473. might_sleep();
  474. trace_drv_channel_switch(local, ch_switch);
  475. local->ops->channel_switch(&local->hw, ch_switch);
  476. trace_drv_return_void(local);
  477. }
  478. static inline int drv_set_antenna(struct ieee80211_local *local,
  479. u32 tx_ant, u32 rx_ant)
  480. {
  481. int ret = -EOPNOTSUPP;
  482. might_sleep();
  483. if (local->ops->set_antenna)
  484. ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
  485. trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
  486. return ret;
  487. }
  488. static inline int drv_get_antenna(struct ieee80211_local *local,
  489. u32 *tx_ant, u32 *rx_ant)
  490. {
  491. int ret = -EOPNOTSUPP;
  492. might_sleep();
  493. if (local->ops->get_antenna)
  494. ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
  495. trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
  496. return ret;
  497. }
  498. static inline int drv_remain_on_channel(struct ieee80211_local *local,
  499. struct ieee80211_channel *chan,
  500. enum nl80211_channel_type chantype,
  501. unsigned int duration)
  502. {
  503. int ret;
  504. might_sleep();
  505. trace_drv_remain_on_channel(local, chan, chantype, duration);
  506. ret = local->ops->remain_on_channel(&local->hw, chan, chantype,
  507. duration);
  508. trace_drv_return_int(local, ret);
  509. return ret;
  510. }
  511. static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
  512. {
  513. int ret;
  514. might_sleep();
  515. trace_drv_cancel_remain_on_channel(local);
  516. ret = local->ops->cancel_remain_on_channel(&local->hw);
  517. trace_drv_return_int(local, ret);
  518. return ret;
  519. }
  520. static inline int drv_set_ringparam(struct ieee80211_local *local,
  521. u32 tx, u32 rx)
  522. {
  523. int ret = -ENOTSUPP;
  524. might_sleep();
  525. trace_drv_set_ringparam(local, tx, rx);
  526. if (local->ops->set_ringparam)
  527. ret = local->ops->set_ringparam(&local->hw, tx, rx);
  528. trace_drv_return_int(local, ret);
  529. return ret;
  530. }
  531. static inline void drv_get_ringparam(struct ieee80211_local *local,
  532. u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
  533. {
  534. might_sleep();
  535. trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
  536. if (local->ops->get_ringparam)
  537. local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
  538. trace_drv_return_void(local);
  539. }
  540. static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
  541. {
  542. bool ret = false;
  543. might_sleep();
  544. trace_drv_tx_frames_pending(local);
  545. if (local->ops->tx_frames_pending)
  546. ret = local->ops->tx_frames_pending(&local->hw);
  547. trace_drv_return_bool(local, ret);
  548. return ret;
  549. }
  550. static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
  551. struct ieee80211_sub_if_data *sdata,
  552. const struct cfg80211_bitrate_mask *mask)
  553. {
  554. int ret = -EOPNOTSUPP;
  555. might_sleep();
  556. check_sdata_in_driver(sdata);
  557. trace_drv_set_bitrate_mask(local, sdata, mask);
  558. if (local->ops->set_bitrate_mask)
  559. ret = local->ops->set_bitrate_mask(&local->hw,
  560. &sdata->vif, mask);
  561. trace_drv_return_int(local, ret);
  562. return ret;
  563. }
  564. static inline void drv_set_rekey_data(struct ieee80211_local *local,
  565. struct ieee80211_sub_if_data *sdata,
  566. struct cfg80211_gtk_rekey_data *data)
  567. {
  568. check_sdata_in_driver(sdata);
  569. trace_drv_set_rekey_data(local, sdata, data);
  570. if (local->ops->set_rekey_data)
  571. local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
  572. trace_drv_return_void(local);
  573. }
  574. static inline void drv_rssi_callback(struct ieee80211_local *local,
  575. const enum ieee80211_rssi_event event)
  576. {
  577. trace_drv_rssi_callback(local, event);
  578. if (local->ops->rssi_callback)
  579. local->ops->rssi_callback(&local->hw, event);
  580. trace_drv_return_void(local);
  581. }
  582. static inline void
  583. drv_release_buffered_frames(struct ieee80211_local *local,
  584. struct sta_info *sta, u16 tids, int num_frames,
  585. enum ieee80211_frame_release_type reason,
  586. bool more_data)
  587. {
  588. trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
  589. reason, more_data);
  590. if (local->ops->release_buffered_frames)
  591. local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
  592. num_frames, reason,
  593. more_data);
  594. trace_drv_return_void(local);
  595. }
  596. static inline void
  597. drv_allow_buffered_frames(struct ieee80211_local *local,
  598. struct sta_info *sta, u16 tids, int num_frames,
  599. enum ieee80211_frame_release_type reason,
  600. bool more_data)
  601. {
  602. trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
  603. reason, more_data);
  604. if (local->ops->allow_buffered_frames)
  605. local->ops->allow_buffered_frames(&local->hw, &sta->sta,
  606. tids, num_frames, reason,
  607. more_data);
  608. trace_drv_return_void(local);
  609. }
  610. #endif /* __MAC80211_DRIVER_OPS */