aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/mac80211.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/mac80211.h')
-rw-r--r--include/net/mac80211.h474
1 files changed, 247 insertions, 227 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index dae3f9ec1154..7ab4ff6159a2 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -98,6 +98,18 @@ struct ieee80211_ht_bss_info {
98}; 98};
99 99
100/** 100/**
101 * enum ieee80211_max_queues - maximum number of queues
102 *
103 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
104 * @IEEE80211_MAX_AMPDU_QUEUES: Maximum number of queues usable
105 * for A-MPDU operation.
106 */
107enum ieee80211_max_queues {
108 IEEE80211_MAX_QUEUES = 16,
109 IEEE80211_MAX_AMPDU_QUEUES = 16,
110};
111
112/**
101 * struct ieee80211_tx_queue_params - transmit queue configuration 113 * struct ieee80211_tx_queue_params - transmit queue configuration
102 * 114 *
103 * The information provided in this structure is required for QoS 115 * The information provided in this structure is required for QoS
@@ -117,58 +129,18 @@ struct ieee80211_tx_queue_params {
117}; 129};
118 130
119/** 131/**
120 * struct ieee80211_tx_queue_stats_data - transmit queue statistics 132 * struct ieee80211_tx_queue_stats - transmit queue statistics
121 * 133 *
122 * @len: number of packets in queue 134 * @len: number of packets in queue
123 * @limit: queue length limit 135 * @limit: queue length limit
124 * @count: number of frames sent 136 * @count: number of frames sent
125 */ 137 */
126struct ieee80211_tx_queue_stats_data { 138struct ieee80211_tx_queue_stats {
127 unsigned int len; 139 unsigned int len;
128 unsigned int limit; 140 unsigned int limit;
129 unsigned int count; 141 unsigned int count;
130}; 142};
131 143
132/**
133 * enum ieee80211_tx_queue - transmit queue number
134 *
135 * These constants are used with some callbacks that take a
136 * queue number to set parameters for a queue.
137 *
138 * @IEEE80211_TX_QUEUE_DATA0: data queue 0
139 * @IEEE80211_TX_QUEUE_DATA1: data queue 1
140 * @IEEE80211_TX_QUEUE_DATA2: data queue 2
141 * @IEEE80211_TX_QUEUE_DATA3: data queue 3
142 * @IEEE80211_TX_QUEUE_DATA4: data queue 4
143 * @IEEE80211_TX_QUEUE_SVP: ??
144 * @NUM_TX_DATA_QUEUES: number of data queues
145 * @IEEE80211_TX_QUEUE_AFTER_BEACON: transmit queue for frames to be
146 * sent after a beacon
147 * @IEEE80211_TX_QUEUE_BEACON: transmit queue for beacon frames
148 * @NUM_TX_DATA_QUEUES_AMPDU: adding more queues for A-MPDU
149 */
150enum ieee80211_tx_queue {
151 IEEE80211_TX_QUEUE_DATA0,
152 IEEE80211_TX_QUEUE_DATA1,
153 IEEE80211_TX_QUEUE_DATA2,
154 IEEE80211_TX_QUEUE_DATA3,
155 IEEE80211_TX_QUEUE_DATA4,
156 IEEE80211_TX_QUEUE_SVP,
157
158 NUM_TX_DATA_QUEUES,
159
160/* due to stupidity in the sub-ioctl userspace interface, the items in
161 * this struct need to have fixed values. As soon as it is removed, we can
162 * fix these entries. */
163 IEEE80211_TX_QUEUE_AFTER_BEACON = 6,
164 IEEE80211_TX_QUEUE_BEACON = 7,
165 NUM_TX_DATA_QUEUES_AMPDU = 16
166};
167
168struct ieee80211_tx_queue_stats {
169 struct ieee80211_tx_queue_stats_data data[NUM_TX_DATA_QUEUES_AMPDU];
170};
171
172struct ieee80211_low_level_stats { 144struct ieee80211_low_level_stats {
173 unsigned int dot11ACKFailureCount; 145 unsigned int dot11ACKFailureCount;
174 unsigned int dot11RTSFailureCount; 146 unsigned int dot11RTSFailureCount;
@@ -229,91 +201,128 @@ struct ieee80211_bss_conf {
229}; 201};
230 202
231/** 203/**
232 * enum mac80211_tx_control_flags - flags to describe Tx configuration for 204 * enum mac80211_tx_flags - flags to transmission information/status
233 * the Tx frame 205 *
234 * 206 * These flags are used with the @flags member of &ieee80211_tx_info
235 * These flags are used with the @flags member of &ieee80211_tx_control 207 *
236 * 208 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame.
237 * @IEEE80211_TXCTL_REQ_TX_STATUS: request TX status callback for this frame. 209 * @IEEE80211_TX_CTL_DO_NOT_ENCRYPT: send this frame without encryption;
238 * @IEEE80211_TXCTL_DO_NOT_ENCRYPT: send this frame without encryption; 210 * e.g., for EAPOL frame
239 * e.g., for EAPOL frame 211 * @IEEE80211_TX_CTL_USE_RTS_CTS: use RTS-CTS before sending frame
240 * @IEEE80211_TXCTL_USE_RTS_CTS: use RTS-CTS before sending frame 212 * @IEEE80211_TX_CTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g.,
241 * @IEEE80211_TXCTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g., 213 * for combined 802.11g / 802.11b networks)
242 * for combined 802.11g / 802.11b networks) 214 * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack
243 * @IEEE80211_TXCTL_NO_ACK: tell the low level not to wait for an ack 215 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE
244 * @IEEE80211_TXCTL_RATE_CTRL_PROBE 216 * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination
245 * @EEE80211_TXCTL_CLEAR_PS_FILT: clear powersave filter 217 * station
246 * for destination station 218 * @IEEE80211_TX_CTL_REQUEUE:
247 * @IEEE80211_TXCTL_REQUEUE: 219 * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame
248 * @IEEE80211_TXCTL_FIRST_FRAGMENT: this is a first fragment of the frame 220 * @IEEE80211_TX_CTL_LONG_RETRY_LIMIT: this frame should be send using the
249 * @IEEE80211_TXCTL_LONG_RETRY_LIMIT: this frame should be send using the 221 * through set_retry_limit configured long retry value
250 * through set_retry_limit configured long 222 * @IEEE80211_TX_CTL_EAPOL_FRAME: internal to mac80211
251 * retry value 223 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
252 * @IEEE80211_TXCTL_EAPOL_FRAME: internal to mac80211 224 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
253 * @IEEE80211_TXCTL_SEND_AFTER_DTIM: send this frame after DTIM beacon 225 * @IEEE80211_TX_CTL_OFDM_HT: this frame can be sent in HT OFDM rates. number
254 * @IEEE80211_TXCTL_AMPDU: this frame should be sent as part of an A-MPDU 226 * of streams when this flag is on can be extracted from antenna_sel_tx,
255 * @IEEE80211_TXCTL_OFDM_HT: this frame can be sent in HT OFDM rates. number 227 * so if 1 antenna is marked use SISO, 2 antennas marked use MIMO, n
256 * of streams when this flag is on can be extracted 228 * antennas marked use MIMO_n.
257 * from antenna_sel_tx, so if 1 antenna is marked 229 * @IEEE80211_TX_CTL_GREEN_FIELD: use green field protection for this frame
258 * use SISO, 2 antennas marked use MIMO, n antennas 230 * @IEEE80211_TX_CTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width
259 * marked use MIMO_n. 231 * @IEEE80211_TX_CTL_DUP_DATA: duplicate data frame on both 20 Mhz channels
260 * @IEEE80211_TXCTL_GREEN_FIELD: use green field protection for this frame 232 * @IEEE80211_TX_CTL_SHORT_GI: send this frame using short guard interval
261 * @IEEE80211_TXCTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width 233 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
262 * @IEEE80211_TXCTL_DUP_DATA: duplicate data frame on both 20 Mhz channels 234 * because the destination STA was in powersave mode.
263 * @IEEE80211_TXCTL_SHORT_GI: send this frame using short guard interval 235 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
236 * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status
237 * is for the whole aggregation.
264 */ 238 */
265enum mac80211_tx_control_flags { 239enum mac80211_tx_control_flags {
266 IEEE80211_TXCTL_REQ_TX_STATUS = (1<<0), 240 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
267 IEEE80211_TXCTL_DO_NOT_ENCRYPT = (1<<1), 241 IEEE80211_TX_CTL_DO_NOT_ENCRYPT = BIT(1),
268 IEEE80211_TXCTL_USE_RTS_CTS = (1<<2), 242 IEEE80211_TX_CTL_USE_RTS_CTS = BIT(2),
269 IEEE80211_TXCTL_USE_CTS_PROTECT = (1<<3), 243 IEEE80211_TX_CTL_USE_CTS_PROTECT = BIT(3),
270 IEEE80211_TXCTL_NO_ACK = (1<<4), 244 IEEE80211_TX_CTL_NO_ACK = BIT(4),
271 IEEE80211_TXCTL_RATE_CTRL_PROBE = (1<<5), 245 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(5),
272 IEEE80211_TXCTL_CLEAR_PS_FILT = (1<<6), 246 IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(6),
273 IEEE80211_TXCTL_REQUEUE = (1<<7), 247 IEEE80211_TX_CTL_REQUEUE = BIT(7),
274 IEEE80211_TXCTL_FIRST_FRAGMENT = (1<<8), 248 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(8),
275 IEEE80211_TXCTL_SHORT_PREAMBLE = (1<<9), 249 IEEE80211_TX_CTL_SHORT_PREAMBLE = BIT(9),
276 IEEE80211_TXCTL_LONG_RETRY_LIMIT = (1<<10), 250 IEEE80211_TX_CTL_LONG_RETRY_LIMIT = BIT(10),
277 IEEE80211_TXCTL_EAPOL_FRAME = (1<<11), 251 IEEE80211_TX_CTL_EAPOL_FRAME = BIT(11),
278 IEEE80211_TXCTL_SEND_AFTER_DTIM = (1<<12), 252 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(12),
279 IEEE80211_TXCTL_AMPDU = (1<<13), 253 IEEE80211_TX_CTL_AMPDU = BIT(13),
280 IEEE80211_TXCTL_OFDM_HT = (1<<14), 254 IEEE80211_TX_CTL_OFDM_HT = BIT(14),
281 IEEE80211_TXCTL_GREEN_FIELD = (1<<15), 255 IEEE80211_TX_CTL_GREEN_FIELD = BIT(15),
282 IEEE80211_TXCTL_40_MHZ_WIDTH = (1<<16), 256 IEEE80211_TX_CTL_40_MHZ_WIDTH = BIT(16),
283 IEEE80211_TXCTL_DUP_DATA = (1<<17), 257 IEEE80211_TX_CTL_DUP_DATA = BIT(17),
284 IEEE80211_TXCTL_SHORT_GI = (1<<18), 258 IEEE80211_TX_CTL_SHORT_GI = BIT(18),
259 IEEE80211_TX_CTL_INJECTED = BIT(19),
260 IEEE80211_TX_STAT_TX_FILTERED = BIT(20),
261 IEEE80211_TX_STAT_ACK = BIT(21),
262 IEEE80211_TX_STAT_AMPDU = BIT(22),
285}; 263};
286 264
287/* Transmit control fields. This data structure is passed to low-level driver
288 * with each TX frame. The low-level driver is responsible for configuring
289 * the hardware to use given values (depending on what is supported). */
290 265
291struct ieee80211_tx_control { 266#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE \
292 struct ieee80211_vif *vif; 267 (sizeof(((struct sk_buff *)0)->cb) - 8)
293 struct ieee80211_rate *tx_rate; 268#define IEEE80211_TX_INFO_DRIVER_DATA_PTRS \
294 269 (IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *))
295 /* Transmit rate for RTS/CTS frame */ 270
296 struct ieee80211_rate *rts_cts_rate; 271/**
297 272 * struct ieee80211_tx_info - skb transmit information
298 /* retry rate for the last retries */ 273 *
299 struct ieee80211_rate *alt_retry_rate; 274 * This structure is placed in skb->cb for three uses:
300 275 * (1) mac80211 TX control - mac80211 tells the driver what to do
301 u32 flags; /* tx control flags defined above */ 276 * (2) driver internal use (if applicable)
302 u8 key_idx; /* keyidx from hw->set_key(), undefined if 277 * (3) TX status information - driver tells mac80211 what happened
303 * IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */ 278 *
304 u8 retry_limit; /* 1 = only first attempt, 2 = one retry, .. 279 * @flags: transmit info flags, defined above
305 * This could be used when set_retry_limit 280 * @retry_count: number of retries
306 * is not implemented by the driver */ 281 * @excessive_retries: set to 1 if the frame was retried many times
307 u8 antenna_sel_tx; /* 0 = default/diversity, otherwise bit 282 * but not acknowledged
308 * position represents antenna number used */ 283 * @ampdu_ack_len: number of aggregated frames.
309 u8 icv_len; /* length of the ICV/MIC field in octets */ 284 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
310 u8 iv_len; /* length of the IV field in octets */ 285 * @ampdu_ack_map: block ack bit map for the aggregation.
311 u8 queue; /* hardware queue to use for this frame; 286 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
312 * 0 = highest, hw->queues-1 = lowest */ 287 * @ack_signal: signal strength of the ACK frame
313 u16 aid; /* Station AID */ 288 */
314 int type; /* internal */ 289struct ieee80211_tx_info {
290 /* common information */
291 u32 flags;
292 u8 band;
293 s8 tx_rate_idx;
294 u8 antenna_sel_tx;
295
296 /* 1 byte hole */
297
298 union {
299 struct {
300 struct ieee80211_vif *vif;
301 struct ieee80211_key_conf *hw_key;
302 unsigned long jiffies;
303 int ifindex;
304 u16 aid;
305 s8 rts_cts_rate_idx, alt_retry_rate_idx;
306 u8 retry_limit;
307 u8 icv_len;
308 u8 iv_len;
309 } control;
310 struct {
311 u64 ampdu_ack_map;
312 int ack_signal;
313 u8 retry_count;
314 bool excessive_retries;
315 u8 ampdu_ack_len;
316 } status;
317 void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_PTRS];
318 };
315}; 319};
316 320
321static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
322{
323 return (struct ieee80211_tx_info *)skb->cb;
324}
325
317 326
318/** 327/**
319 * enum mac80211_rx_flags - receive flags 328 * enum mac80211_rx_flags - receive flags
@@ -353,13 +362,16 @@ enum mac80211_rx_flags {
353 * The low-level driver should provide this information (the subset 362 * The low-level driver should provide this information (the subset
354 * supported by hardware) to the 802.11 code with each received 363 * supported by hardware) to the 802.11 code with each received
355 * frame. 364 * frame.
365 *
356 * @mactime: value in microseconds of the 64-bit Time Synchronization Function 366 * @mactime: value in microseconds of the 64-bit Time Synchronization Function
357 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware. 367 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware.
358 * @band: the active band when this frame was received 368 * @band: the active band when this frame was received
359 * @freq: frequency the radio was tuned to when receiving this frame, in MHz 369 * @freq: frequency the radio was tuned to when receiving this frame, in MHz
360 * @ssi: signal strength when receiving this frame 370 * @signal: signal strength when receiving this frame, either in dBm, in dB or
361 * @signal: used as 'qual' in statistics reporting 371 * unspecified depending on the hardware capabilities flags
362 * @noise: PHY noise when receiving this frame 372 * @IEEE80211_HW_SIGNAL_*
373 * @noise: noise when receiving this frame, in dBm.
374 * @qual: overall signal quality indication, in percent (0-100).
363 * @antenna: antenna used 375 * @antenna: antenna used
364 * @rate_idx: index of data rate into band's supported rates 376 * @rate_idx: index of data rate into band's supported rates
365 * @flag: %RX_FLAG_* 377 * @flag: %RX_FLAG_*
@@ -368,64 +380,15 @@ struct ieee80211_rx_status {
368 u64 mactime; 380 u64 mactime;
369 enum ieee80211_band band; 381 enum ieee80211_band band;
370 int freq; 382 int freq;
371 int ssi;
372 int signal; 383 int signal;
373 int noise; 384 int noise;
385 int qual;
374 int antenna; 386 int antenna;
375 int rate_idx; 387 int rate_idx;
376 int flag; 388 int flag;
377}; 389};
378 390
379/** 391/**
380 * enum ieee80211_tx_status_flags - transmit status flags
381 *
382 * Status flags to indicate various transmit conditions.
383 *
384 * @IEEE80211_TX_STATUS_TX_FILTERED: The frame was not transmitted
385 * because the destination STA was in powersave mode.
386 * @IEEE80211_TX_STATUS_ACK: Frame was acknowledged
387 * @IEEE80211_TX_STATUS_AMPDU: The frame was aggregated, so status
388 * is for the whole aggregation.
389 */
390enum ieee80211_tx_status_flags {
391 IEEE80211_TX_STATUS_TX_FILTERED = 1<<0,
392 IEEE80211_TX_STATUS_ACK = 1<<1,
393 IEEE80211_TX_STATUS_AMPDU = 1<<2,
394};
395
396/**
397 * struct ieee80211_tx_status - transmit status
398 *
399 * As much information as possible should be provided for each transmitted
400 * frame with ieee80211_tx_status().
401 *
402 * @control: a copy of the &struct ieee80211_tx_control passed to the driver
403 * in the tx() callback.
404 * @flags: transmit status flags, defined above
405 * @retry_count: number of retries
406 * @excessive_retries: set to 1 if the frame was retried many times
407 * but not acknowledged
408 * @ampdu_ack_len: number of aggregated frames.
409 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
410 * @ampdu_ack_map: block ack bit map for the aggregation.
411 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
412 * @ack_signal: signal strength of the ACK frame
413 * @queue_length: ?? REMOVE
414 * @queue_number: ?? REMOVE
415 */
416struct ieee80211_tx_status {
417 struct ieee80211_tx_control control;
418 u8 flags;
419 u8 retry_count;
420 bool excessive_retries;
421 u8 ampdu_ack_len;
422 u64 ampdu_ack_map;
423 int ack_signal;
424 int queue_length;
425 int queue_number;
426};
427
428/**
429 * enum ieee80211_conf_flags - configuration flags 392 * enum ieee80211_conf_flags - configuration flags
430 * 393 *
431 * Flags to define PHY configuration options 394 * Flags to define PHY configuration options
@@ -580,7 +543,6 @@ struct ieee80211_if_conf {
580 u8 *ssid; 543 u8 *ssid;
581 size_t ssid_len; 544 size_t ssid_len;
582 struct sk_buff *beacon; 545 struct sk_buff *beacon;
583 struct ieee80211_tx_control *beacon_control;
584}; 546};
585 547
586/** 548/**
@@ -610,11 +572,14 @@ enum ieee80211_key_alg {
610 * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by 572 * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by
611 * the driver for a TKIP key if it requires Michael MIC 573 * the driver for a TKIP key if it requires Michael MIC
612 * generation in software. 574 * generation in software.
575 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
576 * that the key is pairwise rather then a shared key.
613 */ 577 */
614enum ieee80211_key_flags { 578enum ieee80211_key_flags {
615 IEEE80211_KEY_FLAG_WMM_STA = 1<<0, 579 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
616 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, 580 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1,
617 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 581 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
582 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,
618}; 583};
619 584
620/** 585/**
@@ -721,6 +686,25 @@ enum ieee80211_tkip_key_type {
721 * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE: 686 * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE:
722 * Hardware is not capable of receiving frames with short preamble on 687 * Hardware is not capable of receiving frames with short preamble on
723 * the 2.4 GHz band. 688 * the 2.4 GHz band.
689 *
690 * @IEEE80211_HW_SIGNAL_UNSPEC:
691 * Hardware can provide signal values but we don't know its units. We
692 * expect values between 0 and @max_signal.
693 * If possible please provide dB or dBm instead.
694 *
695 * @IEEE80211_HW_SIGNAL_DB:
696 * Hardware gives signal values in dB, decibel difference from an
697 * arbitrary, fixed reference. We expect values between 0 and @max_signal.
698 * If possible please provide dBm instead.
699 *
700 * @IEEE80211_HW_SIGNAL_DBM:
701 * Hardware gives signal values in dBm, decibel difference from
702 * one milliwatt. This is the preferred method since it is standardized
703 * between different devices. @max_signal does not need to be set.
704 *
705 * @IEEE80211_HW_NOISE_DBM:
706 * Hardware can provide noise (radio interference) values in units dBm,
707 * decibel difference from one milliwatt.
724 */ 708 */
725enum ieee80211_hw_flags { 709enum ieee80211_hw_flags {
726 IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE = 1<<0, 710 IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE = 1<<0,
@@ -728,6 +712,10 @@ enum ieee80211_hw_flags {
728 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, 712 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2,
729 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, 713 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3,
730 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, 714 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
715 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,
716 IEEE80211_HW_SIGNAL_DB = 1<<6,
717 IEEE80211_HW_SIGNAL_DBM = 1<<7,
718 IEEE80211_HW_NOISE_DBM = 1<<8,
731}; 719};
732 720
733/** 721/**
@@ -758,15 +746,18 @@ enum ieee80211_hw_flags {
758 * 746 *
759 * @channel_change_time: time (in microseconds) it takes to change channels. 747 * @channel_change_time: time (in microseconds) it takes to change channels.
760 * 748 *
761 * @max_rssi: Maximum value for ssi in RX information, use 749 * @max_signal: Maximum value for signal (rssi) in RX information, used
762 * negative numbers for dBm and 0 to indicate no support. 750 * only when @IEEE80211_HW_SIGNAL_UNSPEC or @IEEE80211_HW_SIGNAL_DB
763 *
764 * @max_signal: like @max_rssi, but for the signal value.
765 *
766 * @max_noise: like @max_rssi, but for the noise value.
767 * 751 *
768 * @queues: number of available hardware transmit queues for 752 * @queues: number of available hardware transmit queues for
769 * data packets. WMM/QoS requires at least four. 753 * data packets. WMM/QoS requires at least four, these
754 * queues need to have configurable access parameters.
755 *
756 * @ampdu_queues: number of available hardware transmit queues
757 * for A-MPDU packets, these have no access parameters
758 * because they're used only for A-MPDU frames. Note that
759 * mac80211 will not currently use any of the regular queues
760 * for aggregation.
770 * 761 *
771 * @rate_control_algorithm: rate control algorithm for this hardware. 762 * @rate_control_algorithm: rate control algorithm for this hardware.
772 * If unset (NULL), the default algorithm will be used. Must be 763 * If unset (NULL), the default algorithm will be used. Must be
@@ -785,10 +776,8 @@ struct ieee80211_hw {
785 unsigned int extra_tx_headroom; 776 unsigned int extra_tx_headroom;
786 int channel_change_time; 777 int channel_change_time;
787 int vif_data_size; 778 int vif_data_size;
788 u8 queues; 779 u16 queues, ampdu_queues;
789 s8 max_rssi;
790 s8 max_signal; 780 s8 max_signal;
791 s8 max_noise;
792}; 781};
793 782
794/** 783/**
@@ -813,6 +802,51 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
813 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); 802 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
814} 803}
815 804
805static inline int ieee80211_num_regular_queues(struct ieee80211_hw *hw)
806{
807#ifdef CONFIG_MAC80211_QOS
808 return hw->queues;
809#else
810 return 1;
811#endif
812}
813
814static inline int ieee80211_num_queues(struct ieee80211_hw *hw)
815{
816#ifdef CONFIG_MAC80211_QOS
817 return hw->queues + hw->ampdu_queues;
818#else
819 return 1;
820#endif
821}
822
823static inline struct ieee80211_rate *
824ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
825 const struct ieee80211_tx_info *c)
826{
827 if (WARN_ON(c->tx_rate_idx < 0))
828 return NULL;
829 return &hw->wiphy->bands[c->band]->bitrates[c->tx_rate_idx];
830}
831
832static inline struct ieee80211_rate *
833ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw,
834 const struct ieee80211_tx_info *c)
835{
836 if (c->control.rts_cts_rate_idx < 0)
837 return NULL;
838 return &hw->wiphy->bands[c->band]->bitrates[c->control.rts_cts_rate_idx];
839}
840
841static inline struct ieee80211_rate *
842ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
843 const struct ieee80211_tx_info *c)
844{
845 if (c->control.alt_retry_rate_idx < 0)
846 return NULL;
847 return &hw->wiphy->bands[c->band]->bitrates[c->control.alt_retry_rate_idx];
848}
849
816/** 850/**
817 * DOC: Hardware crypto acceleration 851 * DOC: Hardware crypto acceleration
818 * 852 *
@@ -970,8 +1004,10 @@ enum ieee80211_ampdu_mlme_action {
970 * @tx: Handler that 802.11 module calls for each transmitted frame. 1004 * @tx: Handler that 802.11 module calls for each transmitted frame.
971 * skb contains the buffer starting from the IEEE 802.11 header. 1005 * skb contains the buffer starting from the IEEE 802.11 header.
972 * The low-level driver should send the frame out based on 1006 * The low-level driver should send the frame out based on
973 * configuration in the TX control data. Must be implemented and 1007 * configuration in the TX control data. This handler should,
974 * atomic. 1008 * preferably, never fail and stop queues appropriately, more
1009 * importantly, however, it must never fail for A-MPDU-queues.
1010 * Must be implemented and atomic.
975 * 1011 *
976 * @start: Called before the first netdevice attached to the hardware 1012 * @start: Called before the first netdevice attached to the hardware
977 * is enabled. This should turn on the hardware and must turn on 1013 * is enabled. This should turn on the hardware and must turn on
@@ -1063,15 +1099,13 @@ enum ieee80211_ampdu_mlme_action {
1063 * of assocaited station or AP. 1099 * of assocaited station or AP.
1064 * 1100 *
1065 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1101 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1066 * bursting) for a hardware TX queue. The @queue parameter uses the 1102 * bursting) for a hardware TX queue. Must be atomic.
1067 * %IEEE80211_TX_QUEUE_* constants. Must be atomic.
1068 * 1103 *
1069 * @get_tx_stats: Get statistics of the current TX queue status. This is used 1104 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1070 * to get number of currently queued packets (queue length), maximum queue 1105 * to get number of currently queued packets (queue length), maximum queue
1071 * size (limit), and total number of packets sent using each TX queue 1106 * size (limit), and total number of packets sent using each TX queue
1072 * (count). This information is used for WMM to find out which TX 1107 * (count). The 'stats' pointer points to an array that has hw->queues +
1073 * queues have room for more packets and by hostapd to provide 1108 * hw->ampdu_queues items.
1074 * statistics about the current queueing state to external programs.
1075 * 1109 *
1076 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, 1110 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
1077 * this is only used for IBSS mode debugging and, as such, is not a 1111 * this is only used for IBSS mode debugging and, as such, is not a
@@ -1107,8 +1141,7 @@ enum ieee80211_ampdu_mlme_action {
1107 * that TX/RX_STOP can pass NULL for this parameter. 1141 * that TX/RX_STOP can pass NULL for this parameter.
1108 */ 1142 */
1109struct ieee80211_ops { 1143struct ieee80211_ops {
1110 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, 1144 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
1111 struct ieee80211_tx_control *control);
1112 int (*start)(struct ieee80211_hw *hw); 1145 int (*start)(struct ieee80211_hw *hw);
1113 void (*stop)(struct ieee80211_hw *hw); 1146 void (*stop)(struct ieee80211_hw *hw);
1114 int (*add_interface)(struct ieee80211_hw *hw, 1147 int (*add_interface)(struct ieee80211_hw *hw,
@@ -1145,15 +1178,14 @@ struct ieee80211_ops {
1145 u32 short_retry, u32 long_retr); 1178 u32 short_retry, u32 long_retr);
1146 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1179 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1147 enum sta_notify_cmd, const u8 *addr); 1180 enum sta_notify_cmd, const u8 *addr);
1148 int (*conf_tx)(struct ieee80211_hw *hw, int queue, 1181 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
1149 const struct ieee80211_tx_queue_params *params); 1182 const struct ieee80211_tx_queue_params *params);
1150 int (*get_tx_stats)(struct ieee80211_hw *hw, 1183 int (*get_tx_stats)(struct ieee80211_hw *hw,
1151 struct ieee80211_tx_queue_stats *stats); 1184 struct ieee80211_tx_queue_stats *stats);
1152 u64 (*get_tsf)(struct ieee80211_hw *hw); 1185 u64 (*get_tsf)(struct ieee80211_hw *hw);
1153 void (*reset_tsf)(struct ieee80211_hw *hw); 1186 void (*reset_tsf)(struct ieee80211_hw *hw);
1154 int (*beacon_update)(struct ieee80211_hw *hw, 1187 int (*beacon_update)(struct ieee80211_hw *hw,
1155 struct sk_buff *skb, 1188 struct sk_buff *skb);
1156 struct ieee80211_tx_control *control);
1157 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1189 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1158 int (*ampdu_action)(struct ieee80211_hw *hw, 1190 int (*ampdu_action)(struct ieee80211_hw *hw,
1159 enum ieee80211_ampdu_mlme_action action, 1191 enum ieee80211_ampdu_mlme_action action,
@@ -1349,13 +1381,9 @@ void ieee80211_rx_irqsafe(struct ieee80211_hw *hw,
1349 * 1381 *
1350 * @hw: the hardware the frame was transmitted by 1382 * @hw: the hardware the frame was transmitted by
1351 * @skb: the frame that was transmitted, owned by mac80211 after this call 1383 * @skb: the frame that was transmitted, owned by mac80211 after this call
1352 * @status: status information for this frame; the status pointer need not
1353 * be valid after this function returns and is not freed by mac80211,
1354 * it is recommended that it points to a stack area
1355 */ 1384 */
1356void ieee80211_tx_status(struct ieee80211_hw *hw, 1385void ieee80211_tx_status(struct ieee80211_hw *hw,
1357 struct sk_buff *skb, 1386 struct sk_buff *skb);
1358 struct ieee80211_tx_status *status);
1359 1387
1360/** 1388/**
1361 * ieee80211_tx_status_irqsafe - irq-safe transmit status callback 1389 * ieee80211_tx_status_irqsafe - irq-safe transmit status callback
@@ -1368,13 +1396,9 @@ void ieee80211_tx_status(struct ieee80211_hw *hw,
1368 * 1396 *
1369 * @hw: the hardware the frame was transmitted by 1397 * @hw: the hardware the frame was transmitted by
1370 * @skb: the frame that was transmitted, owned by mac80211 after this call 1398 * @skb: the frame that was transmitted, owned by mac80211 after this call
1371 * @status: status information for this frame; the status pointer need not
1372 * be valid after this function returns and is not freed by mac80211,
1373 * it is recommended that it points to a stack area
1374 */ 1399 */
1375void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, 1400void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1376 struct sk_buff *skb, 1401 struct sk_buff *skb);
1377 struct ieee80211_tx_status *status);
1378 1402
1379/** 1403/**
1380 * ieee80211_beacon_get - beacon generation function 1404 * ieee80211_beacon_get - beacon generation function
@@ -1390,8 +1414,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1390 * is responsible of freeing it. 1414 * is responsible of freeing it.
1391 */ 1415 */
1392struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, 1416struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1393 struct ieee80211_vif *vif, 1417 struct ieee80211_vif *vif);
1394 struct ieee80211_tx_control *control);
1395 1418
1396/** 1419/**
1397 * ieee80211_rts_get - RTS frame generation function 1420 * ieee80211_rts_get - RTS frame generation function
@@ -1399,7 +1422,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1399 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1422 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1400 * @frame: pointer to the frame that is going to be protected by the RTS. 1423 * @frame: pointer to the frame that is going to be protected by the RTS.
1401 * @frame_len: the frame length (in octets). 1424 * @frame_len: the frame length (in octets).
1402 * @frame_txctl: &struct ieee80211_tx_control of the frame. 1425 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1403 * @rts: The buffer where to store the RTS frame. 1426 * @rts: The buffer where to store the RTS frame.
1404 * 1427 *
1405 * If the RTS frames are generated by the host system (i.e., not in 1428 * If the RTS frames are generated by the host system (i.e., not in
@@ -1409,7 +1432,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1409 */ 1432 */
1410void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1433void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1411 const void *frame, size_t frame_len, 1434 const void *frame, size_t frame_len,
1412 const struct ieee80211_tx_control *frame_txctl, 1435 const struct ieee80211_tx_info *frame_txctl,
1413 struct ieee80211_rts *rts); 1436 struct ieee80211_rts *rts);
1414 1437
1415/** 1438/**
@@ -1417,7 +1440,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1417 * @hw: pointer obtained from ieee80211_alloc_hw(). 1440 * @hw: pointer obtained from ieee80211_alloc_hw().
1418 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1441 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1419 * @frame_len: the length of the frame that is going to be protected by the RTS. 1442 * @frame_len: the length of the frame that is going to be protected by the RTS.
1420 * @frame_txctl: &struct ieee80211_tx_control of the frame. 1443 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1421 * 1444 *
1422 * If the RTS is generated in firmware, but the host system must provide 1445 * If the RTS is generated in firmware, but the host system must provide
1423 * the duration field, the low-level driver uses this function to receive 1446 * the duration field, the low-level driver uses this function to receive
@@ -1425,7 +1448,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1425 */ 1448 */
1426__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, 1449__le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
1427 struct ieee80211_vif *vif, size_t frame_len, 1450 struct ieee80211_vif *vif, size_t frame_len,
1428 const struct ieee80211_tx_control *frame_txctl); 1451 const struct ieee80211_tx_info *frame_txctl);
1429 1452
1430/** 1453/**
1431 * ieee80211_ctstoself_get - CTS-to-self frame generation function 1454 * ieee80211_ctstoself_get - CTS-to-self frame generation function
@@ -1433,7 +1456,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
1433 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1456 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1434 * @frame: pointer to the frame that is going to be protected by the CTS-to-self. 1457 * @frame: pointer to the frame that is going to be protected by the CTS-to-self.
1435 * @frame_len: the frame length (in octets). 1458 * @frame_len: the frame length (in octets).
1436 * @frame_txctl: &struct ieee80211_tx_control of the frame. 1459 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1437 * @cts: The buffer where to store the CTS-to-self frame. 1460 * @cts: The buffer where to store the CTS-to-self frame.
1438 * 1461 *
1439 * If the CTS-to-self frames are generated by the host system (i.e., not in 1462 * If the CTS-to-self frames are generated by the host system (i.e., not in
@@ -1444,7 +1467,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
1444void ieee80211_ctstoself_get(struct ieee80211_hw *hw, 1467void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
1445 struct ieee80211_vif *vif, 1468 struct ieee80211_vif *vif,
1446 const void *frame, size_t frame_len, 1469 const void *frame, size_t frame_len,
1447 const struct ieee80211_tx_control *frame_txctl, 1470 const struct ieee80211_tx_info *frame_txctl,
1448 struct ieee80211_cts *cts); 1471 struct ieee80211_cts *cts);
1449 1472
1450/** 1473/**
@@ -1452,7 +1475,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
1452 * @hw: pointer obtained from ieee80211_alloc_hw(). 1475 * @hw: pointer obtained from ieee80211_alloc_hw().
1453 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1476 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1454 * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. 1477 * @frame_len: the length of the frame that is going to be protected by the CTS-to-self.
1455 * @frame_txctl: &struct ieee80211_tx_control of the frame. 1478 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1456 * 1479 *
1457 * If the CTS-to-self is generated in firmware, but the host system must provide 1480 * If the CTS-to-self is generated in firmware, but the host system must provide
1458 * the duration field, the low-level driver uses this function to receive 1481 * the duration field, the low-level driver uses this function to receive
@@ -1461,7 +1484,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
1461__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, 1484__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
1462 struct ieee80211_vif *vif, 1485 struct ieee80211_vif *vif,
1463 size_t frame_len, 1486 size_t frame_len,
1464 const struct ieee80211_tx_control *frame_txctl); 1487 const struct ieee80211_tx_info *frame_txctl);
1465 1488
1466/** 1489/**
1467 * ieee80211_generic_frame_duration - Calculate the duration field for a frame 1490 * ieee80211_generic_frame_duration - Calculate the duration field for a frame
@@ -1500,8 +1523,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
1500 * use common code for all beacons. 1523 * use common code for all beacons.
1501 */ 1524 */
1502struct sk_buff * 1525struct sk_buff *
1503ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1526ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
1504 struct ieee80211_tx_control *control);
1505 1527
1506/** 1528/**
1507 * ieee80211_get_hdrlen_from_skb - get header length from data 1529 * ieee80211_get_hdrlen_from_skb - get header length from data
@@ -1513,7 +1535,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1513 * 1535 *
1514 * @skb: the frame 1536 * @skb: the frame
1515 */ 1537 */
1516int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 1538unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
1517 1539
1518/** 1540/**
1519 * ieee80211_get_hdrlen - get header length from frame control 1541 * ieee80211_get_hdrlen - get header length from frame control
@@ -1526,6 +1548,12 @@ int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
1526int ieee80211_get_hdrlen(u16 fc); 1548int ieee80211_get_hdrlen(u16 fc);
1527 1549
1528/** 1550/**
1551 * ieee80211_hdrlen - get header length in bytes from frame control
1552 * @fc: frame control field in little-endian format
1553 */
1554unsigned int ieee80211_hdrlen(__le16 fc);
1555
1556/**
1529 * ieee80211_get_tkip_key - get a TKIP rc4 for skb 1557 * ieee80211_get_tkip_key - get a TKIP rc4 for skb
1530 * 1558 *
1531 * This function computes a TKIP rc4 key for an skb. It computes 1559 * This function computes a TKIP rc4 key for an skb. It computes
@@ -1559,14 +1587,6 @@ void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue);
1559void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); 1587void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
1560 1588
1561/** 1589/**
1562 * ieee80211_start_queues - start all queues
1563 * @hw: pointer to as obtained from ieee80211_alloc_hw().
1564 *
1565 * Drivers should use this function instead of netif_start_queue.
1566 */
1567void ieee80211_start_queues(struct ieee80211_hw *hw);
1568
1569/**
1570 * ieee80211_stop_queues - stop all queues 1590 * ieee80211_stop_queues - stop all queues
1571 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1591 * @hw: pointer as obtained from ieee80211_alloc_hw().
1572 * 1592 *