driver-ops.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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 int drv_tx(struct ieee80211_local *local, struct sk_buff *skb)
  7. {
  8. return local->ops->tx(&local->hw, skb);
  9. }
  10. static inline int drv_start(struct ieee80211_local *local)
  11. {
  12. int ret = local->ops->start(&local->hw);
  13. trace_drv_start(local, ret);
  14. return ret;
  15. }
  16. static inline void drv_stop(struct ieee80211_local *local)
  17. {
  18. local->ops->stop(&local->hw);
  19. trace_drv_stop(local);
  20. }
  21. static inline int drv_add_interface(struct ieee80211_local *local,
  22. struct ieee80211_if_init_conf *conf)
  23. {
  24. int ret = local->ops->add_interface(&local->hw, conf);
  25. trace_drv_add_interface(local, conf->mac_addr, conf->vif, ret);
  26. return ret;
  27. }
  28. static inline void drv_remove_interface(struct ieee80211_local *local,
  29. struct ieee80211_if_init_conf *conf)
  30. {
  31. local->ops->remove_interface(&local->hw, conf);
  32. trace_drv_remove_interface(local, conf->mac_addr, conf->vif);
  33. }
  34. static inline int drv_config(struct ieee80211_local *local, u32 changed)
  35. {
  36. int ret = local->ops->config(&local->hw, changed);
  37. trace_drv_config(local, changed, ret);
  38. return ret;
  39. }
  40. static inline void drv_bss_info_changed(struct ieee80211_local *local,
  41. struct ieee80211_vif *vif,
  42. struct ieee80211_bss_conf *info,
  43. u32 changed)
  44. {
  45. if (local->ops->bss_info_changed)
  46. local->ops->bss_info_changed(&local->hw, vif, info, changed);
  47. trace_drv_bss_info_changed(local, vif, info, changed);
  48. }
  49. static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
  50. int mc_count,
  51. struct dev_addr_list *mc_list)
  52. {
  53. u64 ret = 0;
  54. if (local->ops->prepare_multicast)
  55. ret = local->ops->prepare_multicast(&local->hw, mc_count,
  56. mc_list);
  57. trace_drv_prepare_multicast(local, mc_count, ret);
  58. return ret;
  59. }
  60. static inline void drv_configure_filter(struct ieee80211_local *local,
  61. unsigned int changed_flags,
  62. unsigned int *total_flags,
  63. u64 multicast)
  64. {
  65. might_sleep();
  66. local->ops->configure_filter(&local->hw, changed_flags, total_flags,
  67. multicast);
  68. trace_drv_configure_filter(local, changed_flags, total_flags,
  69. multicast);
  70. }
  71. static inline int drv_set_tim(struct ieee80211_local *local,
  72. struct ieee80211_sta *sta, bool set)
  73. {
  74. int ret = 0;
  75. if (local->ops->set_tim)
  76. ret = local->ops->set_tim(&local->hw, sta, set);
  77. trace_drv_set_tim(local, sta, set, ret);
  78. return ret;
  79. }
  80. static inline int drv_set_key(struct ieee80211_local *local,
  81. enum set_key_cmd cmd, struct ieee80211_vif *vif,
  82. struct ieee80211_sta *sta,
  83. struct ieee80211_key_conf *key)
  84. {
  85. int ret = local->ops->set_key(&local->hw, cmd, vif, sta, key);
  86. trace_drv_set_key(local, cmd, vif, sta, key, ret);
  87. return ret;
  88. }
  89. static inline void drv_update_tkip_key(struct ieee80211_local *local,
  90. struct ieee80211_key_conf *conf,
  91. const u8 *address, u32 iv32,
  92. u16 *phase1key)
  93. {
  94. if (local->ops->update_tkip_key)
  95. local->ops->update_tkip_key(&local->hw, conf, address,
  96. iv32, phase1key);
  97. trace_drv_update_tkip_key(local, conf, address, iv32);
  98. }
  99. static inline int drv_hw_scan(struct ieee80211_local *local,
  100. struct cfg80211_scan_request *req)
  101. {
  102. int ret = local->ops->hw_scan(&local->hw, req);
  103. trace_drv_hw_scan(local, req, ret);
  104. return ret;
  105. }
  106. static inline void drv_sw_scan_start(struct ieee80211_local *local)
  107. {
  108. if (local->ops->sw_scan_start)
  109. local->ops->sw_scan_start(&local->hw);
  110. trace_drv_sw_scan_start(local);
  111. }
  112. static inline void drv_sw_scan_complete(struct ieee80211_local *local)
  113. {
  114. if (local->ops->sw_scan_complete)
  115. local->ops->sw_scan_complete(&local->hw);
  116. trace_drv_sw_scan_complete(local);
  117. }
  118. static inline int drv_get_stats(struct ieee80211_local *local,
  119. struct ieee80211_low_level_stats *stats)
  120. {
  121. int ret = -EOPNOTSUPP;
  122. if (local->ops->get_stats)
  123. ret = local->ops->get_stats(&local->hw, stats);
  124. trace_drv_get_stats(local, stats, ret);
  125. return ret;
  126. }
  127. static inline void drv_get_tkip_seq(struct ieee80211_local *local,
  128. u8 hw_key_idx, u32 *iv32, u16 *iv16)
  129. {
  130. if (local->ops->get_tkip_seq)
  131. local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
  132. trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16);
  133. }
  134. static inline int drv_set_rts_threshold(struct ieee80211_local *local,
  135. u32 value)
  136. {
  137. int ret = 0;
  138. if (local->ops->set_rts_threshold)
  139. ret = local->ops->set_rts_threshold(&local->hw, value);
  140. trace_drv_set_rts_threshold(local, value, ret);
  141. return ret;
  142. }
  143. static inline void drv_sta_notify(struct ieee80211_local *local,
  144. struct ieee80211_vif *vif,
  145. enum sta_notify_cmd cmd,
  146. struct ieee80211_sta *sta)
  147. {
  148. if (local->ops->sta_notify)
  149. local->ops->sta_notify(&local->hw, vif, cmd, sta);
  150. trace_drv_sta_notify(local, vif, cmd, sta);
  151. }
  152. static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue,
  153. const struct ieee80211_tx_queue_params *params)
  154. {
  155. int ret = -EOPNOTSUPP;
  156. if (local->ops->conf_tx)
  157. ret = local->ops->conf_tx(&local->hw, queue, params);
  158. trace_drv_conf_tx(local, queue, params, ret);
  159. return ret;
  160. }
  161. static inline int drv_get_tx_stats(struct ieee80211_local *local,
  162. struct ieee80211_tx_queue_stats *stats)
  163. {
  164. int ret = local->ops->get_tx_stats(&local->hw, stats);
  165. trace_drv_get_tx_stats(local, stats, ret);
  166. return ret;
  167. }
  168. static inline u64 drv_get_tsf(struct ieee80211_local *local)
  169. {
  170. u64 ret = -1ULL;
  171. if (local->ops->get_tsf)
  172. ret = local->ops->get_tsf(&local->hw);
  173. trace_drv_get_tsf(local, ret);
  174. return ret;
  175. }
  176. static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf)
  177. {
  178. if (local->ops->set_tsf)
  179. local->ops->set_tsf(&local->hw, tsf);
  180. trace_drv_set_tsf(local, tsf);
  181. }
  182. static inline void drv_reset_tsf(struct ieee80211_local *local)
  183. {
  184. if (local->ops->reset_tsf)
  185. local->ops->reset_tsf(&local->hw);
  186. trace_drv_reset_tsf(local);
  187. }
  188. static inline int drv_tx_last_beacon(struct ieee80211_local *local)
  189. {
  190. int ret = 1;
  191. if (local->ops->tx_last_beacon)
  192. ret = local->ops->tx_last_beacon(&local->hw);
  193. trace_drv_tx_last_beacon(local, ret);
  194. return ret;
  195. }
  196. static inline int drv_ampdu_action(struct ieee80211_local *local,
  197. enum ieee80211_ampdu_mlme_action action,
  198. struct ieee80211_sta *sta, u16 tid,
  199. u16 *ssn)
  200. {
  201. int ret = -EOPNOTSUPP;
  202. if (local->ops->ampdu_action)
  203. ret = local->ops->ampdu_action(&local->hw, action,
  204. sta, tid, ssn);
  205. trace_drv_ampdu_action(local, action, sta, tid, ssn, ret);
  206. return ret;
  207. }
  208. static inline void drv_rfkill_poll(struct ieee80211_local *local)
  209. {
  210. if (local->ops->rfkill_poll)
  211. local->ops->rfkill_poll(&local->hw);
  212. }
  213. #endif /* __MAC80211_DRIVER_OPS */