driver-ops.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #ifndef __MAC80211_DRIVER_OPS
  2. #define __MAC80211_DRIVER_OPS
  3. #include <net/mac80211.h>
  4. #include "ieee80211_i.h"
  5. static inline int drv_tx(struct ieee80211_local *local, struct sk_buff *skb)
  6. {
  7. return local->ops->tx(&local->hw, skb);
  8. }
  9. static inline int drv_start(struct ieee80211_local *local)
  10. {
  11. return local->ops->start(&local->hw);
  12. }
  13. static inline void drv_stop(struct ieee80211_local *local)
  14. {
  15. local->ops->stop(&local->hw);
  16. }
  17. static inline int drv_add_interface(struct ieee80211_local *local,
  18. struct ieee80211_if_init_conf *conf)
  19. {
  20. return local->ops->add_interface(&local->hw, conf);
  21. }
  22. static inline void drv_remove_interface(struct ieee80211_local *local,
  23. struct ieee80211_if_init_conf *conf)
  24. {
  25. local->ops->remove_interface(&local->hw, conf);
  26. }
  27. static inline int drv_config(struct ieee80211_local *local, u32 changed)
  28. {
  29. return local->ops->config(&local->hw, changed);
  30. }
  31. static inline void drv_bss_info_changed(struct ieee80211_local *local,
  32. struct ieee80211_vif *vif,
  33. struct ieee80211_bss_conf *info,
  34. u32 changed)
  35. {
  36. if (local->ops->bss_info_changed)
  37. local->ops->bss_info_changed(&local->hw, vif, info, changed);
  38. }
  39. static inline void drv_configure_filter(struct ieee80211_local *local,
  40. unsigned int changed_flags,
  41. unsigned int *total_flags,
  42. int mc_count,
  43. struct dev_addr_list *mc_list)
  44. {
  45. local->ops->configure_filter(&local->hw, changed_flags, total_flags,
  46. mc_count, mc_list);
  47. }
  48. static inline int drv_set_tim(struct ieee80211_local *local,
  49. struct ieee80211_sta *sta, bool set)
  50. {
  51. if (local->ops->set_tim)
  52. return local->ops->set_tim(&local->hw, sta, set);
  53. return 0;
  54. }
  55. static inline int drv_set_key(struct ieee80211_local *local,
  56. enum set_key_cmd cmd, struct ieee80211_vif *vif,
  57. struct ieee80211_sta *sta,
  58. struct ieee80211_key_conf *key)
  59. {
  60. return local->ops->set_key(&local->hw, cmd, vif, sta, key);
  61. }
  62. static inline void drv_update_tkip_key(struct ieee80211_local *local,
  63. struct ieee80211_key_conf *conf,
  64. const u8 *address, u32 iv32,
  65. u16 *phase1key)
  66. {
  67. if (local->ops->update_tkip_key)
  68. local->ops->update_tkip_key(&local->hw, conf, address,
  69. iv32, phase1key);
  70. }
  71. static inline int drv_hw_scan(struct ieee80211_local *local,
  72. struct cfg80211_scan_request *req)
  73. {
  74. return local->ops->hw_scan(&local->hw, req);
  75. }
  76. static inline void drv_sw_scan_start(struct ieee80211_local *local)
  77. {
  78. if (local->ops->sw_scan_start)
  79. local->ops->sw_scan_start(&local->hw);
  80. }
  81. static inline void drv_sw_scan_complete(struct ieee80211_local *local)
  82. {
  83. if (local->ops->sw_scan_complete)
  84. local->ops->sw_scan_complete(&local->hw);
  85. }
  86. static inline int drv_get_stats(struct ieee80211_local *local,
  87. struct ieee80211_low_level_stats *stats)
  88. {
  89. if (!local->ops->get_stats)
  90. return -EOPNOTSUPP;
  91. return local->ops->get_stats(&local->hw, stats);
  92. }
  93. static inline void drv_get_tkip_seq(struct ieee80211_local *local,
  94. u8 hw_key_idx, u32 *iv32, u16 *iv16)
  95. {
  96. if (local->ops->get_tkip_seq)
  97. local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
  98. }
  99. static inline int drv_set_rts_threshold(struct ieee80211_local *local,
  100. u32 value)
  101. {
  102. if (local->ops->set_rts_threshold)
  103. return local->ops->set_rts_threshold(&local->hw, value);
  104. return 0;
  105. }
  106. static inline void drv_sta_notify(struct ieee80211_local *local,
  107. struct ieee80211_vif *vif,
  108. enum sta_notify_cmd cmd,
  109. struct ieee80211_sta *sta)
  110. {
  111. if (local->ops->sta_notify)
  112. local->ops->sta_notify(&local->hw, vif, cmd, sta);
  113. }
  114. static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue,
  115. const struct ieee80211_tx_queue_params *params)
  116. {
  117. if (local->ops->conf_tx)
  118. return local->ops->conf_tx(&local->hw, queue, params);
  119. return -EOPNOTSUPP;
  120. }
  121. static inline int drv_get_tx_stats(struct ieee80211_local *local,
  122. struct ieee80211_tx_queue_stats *stats)
  123. {
  124. return local->ops->get_tx_stats(&local->hw, stats);
  125. }
  126. static inline u64 drv_get_tsf(struct ieee80211_local *local)
  127. {
  128. if (local->ops->get_tsf)
  129. return local->ops->get_tsf(&local->hw);
  130. return -1ULL;
  131. }
  132. static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf)
  133. {
  134. if (local->ops->set_tsf)
  135. local->ops->set_tsf(&local->hw, tsf);
  136. }
  137. static inline void drv_reset_tsf(struct ieee80211_local *local)
  138. {
  139. if (local->ops->reset_tsf)
  140. local->ops->reset_tsf(&local->hw);
  141. }
  142. static inline int drv_tx_last_beacon(struct ieee80211_local *local)
  143. {
  144. if (local->ops->tx_last_beacon)
  145. return local->ops->tx_last_beacon(&local->hw);
  146. return 1;
  147. }
  148. static inline int drv_ampdu_action(struct ieee80211_local *local,
  149. enum ieee80211_ampdu_mlme_action action,
  150. struct ieee80211_sta *sta, u16 tid,
  151. u16 *ssn)
  152. {
  153. if (local->ops->ampdu_action)
  154. return local->ops->ampdu_action(&local->hw, action,
  155. sta, tid, ssn);
  156. return -EOPNOTSUPP;
  157. }
  158. static inline void drv_rfkill_poll(struct ieee80211_local *local)
  159. {
  160. if (local->ops->rfkill_poll)
  161. local->ops->rfkill_poll(&local->hw);
  162. }
  163. #endif /* __MAC80211_DRIVER_OPS */