driver-ops.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  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 u64 drv_prepare_multicast(struct ieee80211_local *local,
  132. struct netdev_hw_addr_list *mc_list)
  133. {
  134. u64 ret = 0;
  135. trace_drv_prepare_multicast(local, mc_list->count);
  136. if (local->ops->prepare_multicast)
  137. ret = local->ops->prepare_multicast(&local->hw, mc_list);
  138. trace_drv_return_u64(local, ret);
  139. return ret;
  140. }
  141. static inline void drv_configure_filter(struct ieee80211_local *local,
  142. unsigned int changed_flags,
  143. unsigned int *total_flags,
  144. u64 multicast)
  145. {
  146. might_sleep();
  147. trace_drv_configure_filter(local, changed_flags, total_flags,
  148. multicast);
  149. local->ops->configure_filter(&local->hw, changed_flags, total_flags,
  150. multicast);
  151. trace_drv_return_void(local);
  152. }
  153. static inline int drv_set_tim(struct ieee80211_local *local,
  154. struct ieee80211_sta *sta, bool set)
  155. {
  156. int ret = 0;
  157. trace_drv_set_tim(local, sta, set);
  158. if (local->ops->set_tim)
  159. ret = local->ops->set_tim(&local->hw, sta, set);
  160. trace_drv_return_int(local, ret);
  161. return ret;
  162. }
  163. static inline int drv_set_key(struct ieee80211_local *local,
  164. enum set_key_cmd cmd,
  165. struct ieee80211_sub_if_data *sdata,
  166. struct ieee80211_sta *sta,
  167. struct ieee80211_key_conf *key)
  168. {
  169. int ret;
  170. might_sleep();
  171. sdata = get_bss_sdata(sdata);
  172. check_sdata_in_driver(sdata);
  173. trace_drv_set_key(local, cmd, sdata, sta, key);
  174. ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
  175. trace_drv_return_int(local, ret);
  176. return ret;
  177. }
  178. static inline void drv_update_tkip_key(struct ieee80211_local *local,
  179. struct ieee80211_sub_if_data *sdata,
  180. struct ieee80211_key_conf *conf,
  181. struct sta_info *sta, u32 iv32,
  182. u16 *phase1key)
  183. {
  184. struct ieee80211_sta *ista = NULL;
  185. if (sta)
  186. ista = &sta->sta;
  187. sdata = get_bss_sdata(sdata);
  188. check_sdata_in_driver(sdata);
  189. trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
  190. if (local->ops->update_tkip_key)
  191. local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
  192. ista, iv32, phase1key);
  193. trace_drv_return_void(local);
  194. }
  195. static inline int drv_hw_scan(struct ieee80211_local *local,
  196. struct ieee80211_sub_if_data *sdata,
  197. struct cfg80211_scan_request *req)
  198. {
  199. int ret;
  200. might_sleep();
  201. check_sdata_in_driver(sdata);
  202. trace_drv_hw_scan(local, sdata);
  203. ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
  204. trace_drv_return_int(local, ret);
  205. return ret;
  206. }
  207. static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
  208. struct ieee80211_sub_if_data *sdata)
  209. {
  210. might_sleep();
  211. check_sdata_in_driver(sdata);
  212. trace_drv_cancel_hw_scan(local, sdata);
  213. local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
  214. trace_drv_return_void(local);
  215. }
  216. static inline int
  217. drv_sched_scan_start(struct ieee80211_local *local,
  218. struct ieee80211_sub_if_data *sdata,
  219. struct cfg80211_sched_scan_request *req,
  220. struct ieee80211_sched_scan_ies *ies)
  221. {
  222. int ret;
  223. might_sleep();
  224. check_sdata_in_driver(sdata);
  225. trace_drv_sched_scan_start(local, sdata);
  226. ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
  227. req, ies);
  228. trace_drv_return_int(local, ret);
  229. return ret;
  230. }
  231. static inline void drv_sched_scan_stop(struct ieee80211_local *local,
  232. struct ieee80211_sub_if_data *sdata)
  233. {
  234. might_sleep();
  235. check_sdata_in_driver(sdata);
  236. trace_drv_sched_scan_stop(local, sdata);
  237. local->ops->sched_scan_stop(&local->hw, &sdata->vif);
  238. trace_drv_return_void(local);
  239. }
  240. static inline void drv_sw_scan_start(struct ieee80211_local *local)
  241. {
  242. might_sleep();
  243. trace_drv_sw_scan_start(local);
  244. if (local->ops->sw_scan_start)
  245. local->ops->sw_scan_start(&local->hw);
  246. trace_drv_return_void(local);
  247. }
  248. static inline void drv_sw_scan_complete(struct ieee80211_local *local)
  249. {
  250. might_sleep();
  251. trace_drv_sw_scan_complete(local);
  252. if (local->ops->sw_scan_complete)
  253. local->ops->sw_scan_complete(&local->hw);
  254. trace_drv_return_void(local);
  255. }
  256. static inline int drv_get_stats(struct ieee80211_local *local,
  257. struct ieee80211_low_level_stats *stats)
  258. {
  259. int ret = -EOPNOTSUPP;
  260. might_sleep();
  261. if (local->ops->get_stats)
  262. ret = local->ops->get_stats(&local->hw, stats);
  263. trace_drv_get_stats(local, stats, ret);
  264. return ret;
  265. }
  266. static inline void drv_get_tkip_seq(struct ieee80211_local *local,
  267. u8 hw_key_idx, u32 *iv32, u16 *iv16)
  268. {
  269. if (local->ops->get_tkip_seq)
  270. local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
  271. trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16);
  272. }
  273. static inline int drv_set_frag_threshold(struct ieee80211_local *local,
  274. u32 value)
  275. {
  276. int ret = 0;
  277. might_sleep();
  278. trace_drv_set_frag_threshold(local, value);
  279. if (local->ops->set_frag_threshold)
  280. ret = local->ops->set_frag_threshold(&local->hw, value);
  281. trace_drv_return_int(local, ret);
  282. return ret;
  283. }
  284. static inline int drv_set_rts_threshold(struct ieee80211_local *local,
  285. u32 value)
  286. {
  287. int ret = 0;
  288. might_sleep();
  289. trace_drv_set_rts_threshold(local, value);
  290. if (local->ops->set_rts_threshold)
  291. ret = local->ops->set_rts_threshold(&local->hw, value);
  292. trace_drv_return_int(local, ret);
  293. return ret;
  294. }
  295. static inline int drv_set_coverage_class(struct ieee80211_local *local,
  296. u8 value)
  297. {
  298. int ret = 0;
  299. might_sleep();
  300. trace_drv_set_coverage_class(local, value);
  301. if (local->ops->set_coverage_class)
  302. local->ops->set_coverage_class(&local->hw, value);
  303. else
  304. ret = -EOPNOTSUPP;
  305. trace_drv_return_int(local, ret);
  306. return ret;
  307. }
  308. static inline void drv_sta_notify(struct ieee80211_local *local,
  309. struct ieee80211_sub_if_data *sdata,
  310. enum sta_notify_cmd cmd,
  311. struct ieee80211_sta *sta)
  312. {
  313. sdata = get_bss_sdata(sdata);
  314. check_sdata_in_driver(sdata);
  315. trace_drv_sta_notify(local, sdata, cmd, sta);
  316. if (local->ops->sta_notify)
  317. local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
  318. trace_drv_return_void(local);
  319. }
  320. static inline int drv_sta_add(struct ieee80211_local *local,
  321. struct ieee80211_sub_if_data *sdata,
  322. struct ieee80211_sta *sta)
  323. {
  324. int ret = 0;
  325. might_sleep();
  326. sdata = get_bss_sdata(sdata);
  327. check_sdata_in_driver(sdata);
  328. trace_drv_sta_add(local, sdata, sta);
  329. if (local->ops->sta_add)
  330. ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
  331. trace_drv_return_int(local, ret);
  332. return ret;
  333. }
  334. static inline void drv_sta_remove(struct ieee80211_local *local,
  335. struct ieee80211_sub_if_data *sdata,
  336. struct ieee80211_sta *sta)
  337. {
  338. might_sleep();
  339. sdata = get_bss_sdata(sdata);
  340. check_sdata_in_driver(sdata);
  341. trace_drv_sta_remove(local, sdata, sta);
  342. if (local->ops->sta_remove)
  343. local->ops->sta_remove(&local->hw, &sdata->vif, sta);
  344. trace_drv_return_void(local);
  345. }
  346. static inline __must_check
  347. int drv_sta_state(struct ieee80211_local *local,
  348. struct ieee80211_sub_if_data *sdata,
  349. struct sta_info *sta,
  350. enum ieee80211_sta_state old_state,
  351. enum ieee80211_sta_state new_state)
  352. {
  353. int ret = 0;
  354. might_sleep();
  355. sdata = get_bss_sdata(sdata);
  356. check_sdata_in_driver(sdata);
  357. trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
  358. if (local->ops->sta_state) {
  359. ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
  360. old_state, new_state);
  361. } else if (old_state == IEEE80211_STA_AUTH &&
  362. new_state == IEEE80211_STA_ASSOC) {
  363. ret = drv_sta_add(local, sdata, &sta->sta);
  364. if (ret == 0)
  365. sta->uploaded = true;
  366. } else if (old_state == IEEE80211_STA_ASSOC &&
  367. new_state == IEEE80211_STA_AUTH) {
  368. drv_sta_remove(local, sdata, &sta->sta);
  369. }
  370. trace_drv_return_int(local, ret);
  371. return ret;
  372. }
  373. static inline int drv_conf_tx(struct ieee80211_local *local,
  374. struct ieee80211_sub_if_data *sdata, u16 queue,
  375. const struct ieee80211_tx_queue_params *params)
  376. {
  377. int ret = -EOPNOTSUPP;
  378. might_sleep();
  379. check_sdata_in_driver(sdata);
  380. trace_drv_conf_tx(local, sdata, queue, params);
  381. if (local->ops->conf_tx)
  382. ret = local->ops->conf_tx(&local->hw, &sdata->vif,
  383. queue, params);
  384. trace_drv_return_int(local, ret);
  385. return ret;
  386. }
  387. static inline u64 drv_get_tsf(struct ieee80211_local *local,
  388. struct ieee80211_sub_if_data *sdata)
  389. {
  390. u64 ret = -1ULL;
  391. might_sleep();
  392. check_sdata_in_driver(sdata);
  393. trace_drv_get_tsf(local, sdata);
  394. if (local->ops->get_tsf)
  395. ret = local->ops->get_tsf(&local->hw, &sdata->vif);
  396. trace_drv_return_u64(local, ret);
  397. return ret;
  398. }
  399. static inline void drv_set_tsf(struct ieee80211_local *local,
  400. struct ieee80211_sub_if_data *sdata,
  401. u64 tsf)
  402. {
  403. might_sleep();
  404. check_sdata_in_driver(sdata);
  405. trace_drv_set_tsf(local, sdata, tsf);
  406. if (local->ops->set_tsf)
  407. local->ops->set_tsf(&local->hw, &sdata->vif, tsf);
  408. trace_drv_return_void(local);
  409. }
  410. static inline void drv_reset_tsf(struct ieee80211_local *local,
  411. struct ieee80211_sub_if_data *sdata)
  412. {
  413. might_sleep();
  414. check_sdata_in_driver(sdata);
  415. trace_drv_reset_tsf(local, sdata);
  416. if (local->ops->reset_tsf)
  417. local->ops->reset_tsf(&local->hw, &sdata->vif);
  418. trace_drv_return_void(local);
  419. }
  420. static inline int drv_tx_last_beacon(struct ieee80211_local *local)
  421. {
  422. int ret = 0; /* default unsuported op for less congestion */
  423. might_sleep();
  424. trace_drv_tx_last_beacon(local);
  425. if (local->ops->tx_last_beacon)
  426. ret = local->ops->tx_last_beacon(&local->hw);
  427. trace_drv_return_int(local, ret);
  428. return ret;
  429. }
  430. static inline int drv_ampdu_action(struct ieee80211_local *local,
  431. struct ieee80211_sub_if_data *sdata,
  432. enum ieee80211_ampdu_mlme_action action,
  433. struct ieee80211_sta *sta, u16 tid,
  434. u16 *ssn, u8 buf_size)
  435. {
  436. int ret = -EOPNOTSUPP;
  437. might_sleep();
  438. sdata = get_bss_sdata(sdata);
  439. check_sdata_in_driver(sdata);
  440. trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
  441. if (local->ops->ampdu_action)
  442. ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action,
  443. sta, tid, ssn, buf_size);
  444. trace_drv_return_int(local, ret);
  445. return ret;
  446. }
  447. static inline int drv_get_survey(struct ieee80211_local *local, int idx,
  448. struct survey_info *survey)
  449. {
  450. int ret = -EOPNOTSUPP;
  451. trace_drv_get_survey(local, idx, survey);
  452. if (local->ops->get_survey)
  453. ret = local->ops->get_survey(&local->hw, idx, survey);
  454. trace_drv_return_int(local, ret);
  455. return ret;
  456. }
  457. static inline void drv_rfkill_poll(struct ieee80211_local *local)
  458. {
  459. might_sleep();
  460. if (local->ops->rfkill_poll)
  461. local->ops->rfkill_poll(&local->hw);
  462. }
  463. static inline void drv_flush(struct ieee80211_local *local, bool drop)
  464. {
  465. might_sleep();
  466. trace_drv_flush(local, drop);
  467. if (local->ops->flush)
  468. local->ops->flush(&local->hw, drop);
  469. trace_drv_return_void(local);
  470. }
  471. static inline void drv_channel_switch(struct ieee80211_local *local,
  472. struct ieee80211_channel_switch *ch_switch)
  473. {
  474. might_sleep();
  475. trace_drv_channel_switch(local, ch_switch);
  476. local->ops->channel_switch(&local->hw, ch_switch);
  477. trace_drv_return_void(local);
  478. }
  479. static inline int drv_set_antenna(struct ieee80211_local *local,
  480. u32 tx_ant, u32 rx_ant)
  481. {
  482. int ret = -EOPNOTSUPP;
  483. might_sleep();
  484. if (local->ops->set_antenna)
  485. ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
  486. trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
  487. return ret;
  488. }
  489. static inline int drv_get_antenna(struct ieee80211_local *local,
  490. u32 *tx_ant, u32 *rx_ant)
  491. {
  492. int ret = -EOPNOTSUPP;
  493. might_sleep();
  494. if (local->ops->get_antenna)
  495. ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
  496. trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
  497. return ret;
  498. }
  499. static inline int drv_remain_on_channel(struct ieee80211_local *local,
  500. struct ieee80211_channel *chan,
  501. enum nl80211_channel_type chantype,
  502. unsigned int duration)
  503. {
  504. int ret;
  505. might_sleep();
  506. trace_drv_remain_on_channel(local, chan, chantype, duration);
  507. ret = local->ops->remain_on_channel(&local->hw, chan, chantype,
  508. duration);
  509. trace_drv_return_int(local, ret);
  510. return ret;
  511. }
  512. static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
  513. {
  514. int ret;
  515. might_sleep();
  516. trace_drv_cancel_remain_on_channel(local);
  517. ret = local->ops->cancel_remain_on_channel(&local->hw);
  518. trace_drv_return_int(local, ret);
  519. return ret;
  520. }
  521. static inline int drv_set_ringparam(struct ieee80211_local *local,
  522. u32 tx, u32 rx)
  523. {
  524. int ret = -ENOTSUPP;
  525. might_sleep();
  526. trace_drv_set_ringparam(local, tx, rx);
  527. if (local->ops->set_ringparam)
  528. ret = local->ops->set_ringparam(&local->hw, tx, rx);
  529. trace_drv_return_int(local, ret);
  530. return ret;
  531. }
  532. static inline void drv_get_ringparam(struct ieee80211_local *local,
  533. u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
  534. {
  535. might_sleep();
  536. trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
  537. if (local->ops->get_ringparam)
  538. local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
  539. trace_drv_return_void(local);
  540. }
  541. static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
  542. {
  543. bool ret = false;
  544. might_sleep();
  545. trace_drv_tx_frames_pending(local);
  546. if (local->ops->tx_frames_pending)
  547. ret = local->ops->tx_frames_pending(&local->hw);
  548. trace_drv_return_bool(local, ret);
  549. return ret;
  550. }
  551. static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
  552. struct ieee80211_sub_if_data *sdata,
  553. const struct cfg80211_bitrate_mask *mask)
  554. {
  555. int ret = -EOPNOTSUPP;
  556. might_sleep();
  557. check_sdata_in_driver(sdata);
  558. trace_drv_set_bitrate_mask(local, sdata, mask);
  559. if (local->ops->set_bitrate_mask)
  560. ret = local->ops->set_bitrate_mask(&local->hw,
  561. &sdata->vif, mask);
  562. trace_drv_return_int(local, ret);
  563. return ret;
  564. }
  565. static inline void drv_set_rekey_data(struct ieee80211_local *local,
  566. struct ieee80211_sub_if_data *sdata,
  567. struct cfg80211_gtk_rekey_data *data)
  568. {
  569. check_sdata_in_driver(sdata);
  570. trace_drv_set_rekey_data(local, sdata, data);
  571. if (local->ops->set_rekey_data)
  572. local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
  573. trace_drv_return_void(local);
  574. }
  575. static inline void drv_rssi_callback(struct ieee80211_local *local,
  576. const enum ieee80211_rssi_event event)
  577. {
  578. trace_drv_rssi_callback(local, event);
  579. if (local->ops->rssi_callback)
  580. local->ops->rssi_callback(&local->hw, event);
  581. trace_drv_return_void(local);
  582. }
  583. static inline void
  584. drv_release_buffered_frames(struct ieee80211_local *local,
  585. struct sta_info *sta, u16 tids, int num_frames,
  586. enum ieee80211_frame_release_type reason,
  587. bool more_data)
  588. {
  589. trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
  590. reason, more_data);
  591. if (local->ops->release_buffered_frames)
  592. local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
  593. num_frames, reason,
  594. more_data);
  595. trace_drv_return_void(local);
  596. }
  597. static inline void
  598. drv_allow_buffered_frames(struct ieee80211_local *local,
  599. struct sta_info *sta, u16 tids, int num_frames,
  600. enum ieee80211_frame_release_type reason,
  601. bool more_data)
  602. {
  603. trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
  604. reason, more_data);
  605. if (local->ops->allow_buffered_frames)
  606. local->ops->allow_buffered_frames(&local->hw, &sta->sta,
  607. tids, num_frames, reason,
  608. more_data);
  609. trace_drv_return_void(local);
  610. }
  611. #endif /* __MAC80211_DRIVER_OPS */