cfg80211: add rfkill support
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / net / mac80211 / driver-ops.h
blobb13446afd48f51fce60eb79def2db9400109ce48
1 #ifndef __MAC80211_DRIVER_OPS
2 #define __MAC80211_DRIVER_OPS
4 #include <net/mac80211.h>
5 #include "ieee80211_i.h"
7 static inline int drv_tx(struct ieee80211_local *local, struct sk_buff *skb)
9 return local->ops->tx(&local->hw, skb);
12 static inline int drv_start(struct ieee80211_local *local)
14 return local->ops->start(&local->hw);
17 static inline void drv_stop(struct ieee80211_local *local)
19 local->ops->stop(&local->hw);
22 static inline int drv_add_interface(struct ieee80211_local *local,
23 struct ieee80211_if_init_conf *conf)
25 return local->ops->add_interface(&local->hw, conf);
28 static inline void drv_remove_interface(struct ieee80211_local *local,
29 struct ieee80211_if_init_conf *conf)
31 local->ops->remove_interface(&local->hw, conf);
34 static inline int drv_config(struct ieee80211_local *local, u32 changed)
36 return local->ops->config(&local->hw, changed);
39 static inline void drv_bss_info_changed(struct ieee80211_local *local,
40 struct ieee80211_vif *vif,
41 struct ieee80211_bss_conf *info,
42 u32 changed)
44 if (local->ops->bss_info_changed)
45 local->ops->bss_info_changed(&local->hw, vif, info, changed);
48 static inline void drv_configure_filter(struct ieee80211_local *local,
49 unsigned int changed_flags,
50 unsigned int *total_flags,
51 int mc_count,
52 struct dev_addr_list *mc_list)
54 local->ops->configure_filter(&local->hw, changed_flags, total_flags,
55 mc_count, mc_list);
58 static inline int drv_set_tim(struct ieee80211_local *local,
59 struct ieee80211_sta *sta, bool set)
61 if (local->ops->set_tim)
62 return local->ops->set_tim(&local->hw, sta, set);
63 return 0;
66 static inline int drv_set_key(struct ieee80211_local *local,
67 enum set_key_cmd cmd, struct ieee80211_vif *vif,
68 struct ieee80211_sta *sta,
69 struct ieee80211_key_conf *key)
71 return local->ops->set_key(&local->hw, cmd, vif, sta, key);
74 static inline void drv_update_tkip_key(struct ieee80211_local *local,
75 struct ieee80211_key_conf *conf,
76 const u8 *address, u32 iv32,
77 u16 *phase1key)
79 if (local->ops->update_tkip_key)
80 local->ops->update_tkip_key(&local->hw, conf, address,
81 iv32, phase1key);
84 static inline int drv_hw_scan(struct ieee80211_local *local,
85 struct cfg80211_scan_request *req)
87 return local->ops->hw_scan(&local->hw, req);
90 static inline void drv_sw_scan_start(struct ieee80211_local *local)
92 if (local->ops->sw_scan_start)
93 local->ops->sw_scan_start(&local->hw);
96 static inline void drv_sw_scan_complete(struct ieee80211_local *local)
98 if (local->ops->sw_scan_complete)
99 local->ops->sw_scan_complete(&local->hw);
102 static inline int drv_get_stats(struct ieee80211_local *local,
103 struct ieee80211_low_level_stats *stats)
105 if (!local->ops->get_stats)
106 return -EOPNOTSUPP;
107 return local->ops->get_stats(&local->hw, stats);
110 static inline void drv_get_tkip_seq(struct ieee80211_local *local,
111 u8 hw_key_idx, u32 *iv32, u16 *iv16)
113 if (local->ops->get_tkip_seq)
114 local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
117 static inline int drv_set_rts_threshold(struct ieee80211_local *local,
118 u32 value)
120 if (local->ops->set_rts_threshold)
121 return local->ops->set_rts_threshold(&local->hw, value);
122 return 0;
125 static inline void drv_sta_notify(struct ieee80211_local *local,
126 struct ieee80211_vif *vif,
127 enum sta_notify_cmd cmd,
128 struct ieee80211_sta *sta)
130 if (local->ops->sta_notify)
131 local->ops->sta_notify(&local->hw, vif, cmd, sta);
134 static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue,
135 const struct ieee80211_tx_queue_params *params)
137 if (local->ops->conf_tx)
138 return local->ops->conf_tx(&local->hw, queue, params);
139 return -EOPNOTSUPP;
142 static inline int drv_get_tx_stats(struct ieee80211_local *local,
143 struct ieee80211_tx_queue_stats *stats)
145 return local->ops->get_tx_stats(&local->hw, stats);
148 static inline u64 drv_get_tsf(struct ieee80211_local *local)
150 if (local->ops->get_tsf)
151 return local->ops->get_tsf(&local->hw);
152 return -1ULL;
155 static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf)
157 if (local->ops->set_tsf)
158 local->ops->set_tsf(&local->hw, tsf);
161 static inline void drv_reset_tsf(struct ieee80211_local *local)
163 if (local->ops->reset_tsf)
164 local->ops->reset_tsf(&local->hw);
167 static inline int drv_tx_last_beacon(struct ieee80211_local *local)
169 if (local->ops->tx_last_beacon)
170 return local->ops->tx_last_beacon(&local->hw);
171 return 1;
174 static inline int drv_ampdu_action(struct ieee80211_local *local,
175 enum ieee80211_ampdu_mlme_action action,
176 struct ieee80211_sta *sta, u16 tid,
177 u16 *ssn)
179 if (local->ops->ampdu_action)
180 return local->ops->ampdu_action(&local->hw, action,
181 sta, tid, ssn);
182 return -EOPNOTSUPP;
186 static inline void drv_rfkill_poll(struct ieee80211_local *local)
188 if (local->ops->rfkill_poll)
189 local->ops->rfkill_poll(&local->hw);
191 #endif /* __MAC80211_DRIVER_OPS */