aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00lib.h')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h107
1 files changed, 45 insertions, 62 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index dc5c6574aaf4..322cc4f3de5d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -32,6 +32,7 @@
32 */ 32 */
33#define WATCHDOG_INTERVAL round_jiffies_relative(HZ) 33#define WATCHDOG_INTERVAL round_jiffies_relative(HZ)
34#define LINK_TUNE_INTERVAL round_jiffies_relative(HZ) 34#define LINK_TUNE_INTERVAL round_jiffies_relative(HZ)
35#define AGC_INTERVAL round_jiffies_relative(4 * HZ)
35 36
36/* 37/*
37 * rt2x00_rate: Per rate device information 38 * rt2x00_rate: Per rate device information
@@ -57,7 +58,7 @@ static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value)
57} 58}
58 59
59#define RATE_MCS(__mode, __mcs) \ 60#define RATE_MCS(__mode, __mcs) \
60 ( (((__mode) & 0x00ff) << 8) | ((__mcs) & 0x00ff) ) 61 ((((__mode) & 0x00ff) << 8) | ((__mcs) & 0x00ff))
61 62
62static inline int rt2x00_get_rate_mcs(const u16 mcs_value) 63static inline int rt2x00_get_rate_mcs(const u16 mcs_value)
63{ 64{
@@ -69,7 +70,6 @@ static inline int rt2x00_get_rate_mcs(const u16 mcs_value)
69 */ 70 */
70int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev); 71int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev);
71void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev); 72void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev);
72void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, enum dev_state state);
73 73
74/* 74/*
75 * Initialization handlers. 75 * Initialization handlers.
@@ -86,7 +86,8 @@ void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev,
86 const u8 *mac, const u8 *bssid); 86 const u8 *mac, const u8 *bssid);
87void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev, 87void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
88 struct rt2x00_intf *intf, 88 struct rt2x00_intf *intf,
89 struct ieee80211_bss_conf *conf); 89 struct ieee80211_bss_conf *conf,
90 u32 changed);
90void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, 91void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
91 struct antenna_setup ant); 92 struct antenna_setup ant);
92void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, 93void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
@@ -99,18 +100,15 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
99 100
100/** 101/**
101 * rt2x00queue_alloc_rxskb - allocate a skb for RX purposes. 102 * rt2x00queue_alloc_rxskb - allocate a skb for RX purposes.
102 * @rt2x00dev: Pointer to &struct rt2x00_dev. 103 * @entry: The entry for which the skb will be applicable.
103 * @queue: The queue for which the skb will be applicable.
104 */ 104 */
105struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev, 105struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry);
106 struct queue_entry *entry);
107 106
108/** 107/**
109 * rt2x00queue_free_skb - free a skb 108 * rt2x00queue_free_skb - free a skb
110 * @rt2x00dev: Pointer to &struct rt2x00_dev. 109 * @entry: The entry for which the skb will be applicable.
111 * @skb: The skb to free.
112 */ 110 */
113void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); 111void rt2x00queue_free_skb(struct queue_entry *entry);
114 112
115/** 113/**
116 * rt2x00queue_align_frame - Align 802.11 frame to 4-byte boundary 114 * rt2x00queue_align_frame - Align 802.11 frame to 4-byte boundary
@@ -122,16 +120,6 @@ void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
122void rt2x00queue_align_frame(struct sk_buff *skb); 120void rt2x00queue_align_frame(struct sk_buff *skb);
123 121
124/** 122/**
125 * rt2x00queue_align_payload - Align 802.11 payload to 4-byte boundary
126 * @skb: The skb to align
127 * @header_length: Length of 802.11 header
128 *
129 * Align the 802.11 payload to a 4-byte boundary, this could
130 * mean the header is not aligned properly though.
131 */
132void rt2x00queue_align_payload(struct sk_buff *skb, unsigned int header_length);
133
134/**
135 * rt2x00queue_insert_l2pad - Align 802.11 header & payload to 4-byte boundary 123 * rt2x00queue_insert_l2pad - Align 802.11 header & payload to 4-byte boundary
136 * @skb: The skb to align 124 * @skb: The skb to align
137 * @header_length: Length of 802.11 header 125 * @header_length: Length of 802.11 header
@@ -160,34 +148,41 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
160 bool local); 148 bool local);
161 149
162/** 150/**
163 * rt2x00queue_update_beacon - Send new beacon from mac80211 to hardware 151 * rt2x00queue_update_beacon - Send new beacon from mac80211
152 * to hardware. Handles locking by itself (mutex).
164 * @rt2x00dev: Pointer to &struct rt2x00_dev. 153 * @rt2x00dev: Pointer to &struct rt2x00_dev.
165 * @vif: Interface for which the beacon should be updated. 154 * @vif: Interface for which the beacon should be updated.
166 * @enable_beacon: Enable beaconing
167 */ 155 */
168int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, 156int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
169 struct ieee80211_vif *vif, 157 struct ieee80211_vif *vif);
170 const bool enable_beacon);
171 158
172/** 159/**
173 * rt2x00queue_index_inc - Index incrementation function 160 * rt2x00queue_update_beacon_locked - Send new beacon from mac80211
174 * @queue: Queue (&struct data_queue) to perform the action on. 161 * to hardware. Caller needs to ensure locking.
175 * @index: Index type (&enum queue_index) to perform the action on. 162 * @rt2x00dev: Pointer to &struct rt2x00_dev.
176 * 163 * @vif: Interface for which the beacon should be updated.
177 * This function will increase the requested index on the queue,
178 * it will grab the appropriate locks and handle queue overflow events by
179 * resetting the index to the start of the queue.
180 */ 164 */
181void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index); 165int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
166 struct ieee80211_vif *vif);
182 167
183/** 168/**
184 * rt2x00queue_stop_queues - Halt all data queues 169 * rt2x00queue_clear_beacon - Clear beacon in hardware
185 * @rt2x00dev: Pointer to &struct rt2x00_dev. 170 * @rt2x00dev: Pointer to &struct rt2x00_dev.
171 * @vif: Interface for which the beacon should be updated.
172 */
173int rt2x00queue_clear_beacon(struct rt2x00_dev *rt2x00dev,
174 struct ieee80211_vif *vif);
175
176/**
177 * rt2x00queue_index_inc - Index incrementation function
178 * @entry: Queue entry (&struct queue_entry) to perform the action on.
179 * @index: Index type (&enum queue_index) to perform the action on.
186 * 180 *
187 * This function will loop through all available queues to stop 181 * This function will increase the requested index on the entry's queue,
188 * any pending outgoing frames. 182 * it will grab the appropriate locks and handle queue overflow events by
183 * resetting the index to the start of the queue.
189 */ 184 */
190void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev); 185void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index);
191 186
192/** 187/**
193 * rt2x00queue_init_queues - Initialize all data queues 188 * rt2x00queue_init_queues - Initialize all data queues
@@ -277,6 +272,18 @@ void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev);
277void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev); 272void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev);
278 273
279/** 274/**
275 * rt2x00link_start_agc - Start periodic gain calibration
276 * @rt2x00dev: Pointer to &struct rt2x00_dev.
277 */
278void rt2x00link_start_agc(struct rt2x00_dev *rt2x00dev);
279
280/**
281 * rt2x00link_stop_agc - Stop periodic gain calibration
282 * @rt2x00dev: Pointer to &struct rt2x00_dev.
283 */
284void rt2x00link_stop_agc(struct rt2x00_dev *rt2x00dev);
285
286/**
280 * rt2x00link_register - Initialize link tuning & watchdog functionality 287 * rt2x00link_register - Initialize link tuning & watchdog functionality
281 * @rt2x00dev: Pointer to &struct rt2x00_dev. 288 * @rt2x00dev: Pointer to &struct rt2x00_dev.
282 * 289 *
@@ -381,41 +388,17 @@ static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
381#endif /* CONFIG_RT2X00_LIB_CRYPTO */ 388#endif /* CONFIG_RT2X00_LIB_CRYPTO */
382 389
383/* 390/*
384 * HT handlers.
385 */
386#ifdef CONFIG_RT2X00_LIB_HT
387void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
388 struct txentry_desc *txdesc,
389 const struct rt2x00_rate *hwrate);
390
391u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
392 struct ieee80211_conf *conf);
393#else
394static inline void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
395 struct txentry_desc *txdesc,
396 const struct rt2x00_rate *hwrate)
397{
398}
399
400static inline u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
401 struct ieee80211_conf *conf)
402{
403 return conf->channel->hw_value;
404}
405#endif /* CONFIG_RT2X00_LIB_HT */
406
407/*
408 * RFkill handlers. 391 * RFkill handlers.
409 */ 392 */
410static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) 393static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
411{ 394{
412 if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 395 if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags))
413 wiphy_rfkill_start_polling(rt2x00dev->hw->wiphy); 396 wiphy_rfkill_start_polling(rt2x00dev->hw->wiphy);
414} 397}
415 398
416static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) 399static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
417{ 400{
418 if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 401 if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags))
419 wiphy_rfkill_stop_polling(rt2x00dev->hw->wiphy); 402 wiphy_rfkill_stop_polling(rt2x00dev->hw->wiphy);
420} 403}
421 404