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.h254
1 files changed, 156 insertions, 98 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 9801afb62545..3741c0a7978a 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -214,29 +214,24 @@ struct ieee80211_bss_conf {
214 * These flags are used with the @flags member of &ieee80211_tx_info. 214 * These flags are used with the @flags member of &ieee80211_tx_info.
215 * 215 *
216 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame. 216 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame.
217 * @IEEE80211_TX_CTL_USE_RTS_CTS: use RTS-CTS before sending frame 217 * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence
218 * @IEEE80211_TX_CTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g., 218 * number to this frame, taking care of not overwriting the fragment
219 * for combined 802.11g / 802.11b networks) 219 * number and increasing the sequence number only when the
220 * IEEE80211_TX_CTL_FIRST_FRAGMENT flag is set. mac80211 will properly
221 * assign sequence numbers to QoS-data frames but cannot do so correctly
222 * for non-QoS-data and management frames because beacons need them from
223 * that counter as well and mac80211 cannot guarantee proper sequencing.
224 * If this flag is set, the driver should instruct the hardware to
225 * assign a sequence number to the frame or assign one itself. Cf. IEEE
226 * 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
227 * beacons and always be clear for frames without a sequence number field.
220 * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack 228 * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack
221 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: TBD
222 * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination 229 * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination
223 * station 230 * station
224 * @IEEE80211_TX_CTL_REQUEUE: TBD
225 * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame 231 * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame
226 * @IEEE80211_TX_CTL_SHORT_PREAMBLE: TBD
227 * @IEEE80211_TX_CTL_LONG_RETRY_LIMIT: this frame should be send using the
228 * through set_retry_limit configured long retry value
229 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon 232 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
230 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU 233 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
231 * @IEEE80211_TX_CTL_OFDM_HT: this frame can be sent in HT OFDM rates. number 234 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211.
232 * of streams when this flag is on can be extracted from antenna_sel_tx,
233 * so if 1 antenna is marked use SISO, 2 antennas marked use MIMO, n
234 * antennas marked use MIMO_n.
235 * @IEEE80211_TX_CTL_GREEN_FIELD: use green field protection for this frame
236 * @IEEE80211_TX_CTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width
237 * @IEEE80211_TX_CTL_DUP_DATA: duplicate data frame on both 20 Mhz channels
238 * @IEEE80211_TX_CTL_SHORT_GI: send this frame using short guard interval
239 * @IEEE80211_TX_CTL_INJECTED: TBD
240 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted 235 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
241 * because the destination STA was in powersave mode. 236 * because the destination STA was in powersave mode.
242 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged 237 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
@@ -244,62 +239,70 @@ struct ieee80211_bss_conf {
244 * is for the whole aggregation. 239 * is for the whole aggregation.
245 * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned, 240 * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned,
246 * so consider using block ack request (BAR). 241 * so consider using block ack request (BAR).
247 * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence 242 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
248 * number to this frame, taking care of not overwriting the fragment 243 * set by rate control algorithms to indicate probe rate, will
249 * number and increasing the sequence number only when the 244 * be cleared for fragmented frames (except on the last fragment)
250 * IEEE80211_TX_CTL_FIRST_FRAGMENT flags is set. mac80211 will properly 245 * @IEEE80211_TX_CTL_REQUEUE: REMOVE THIS
251 * assign sequence numbers to QoS-data frames but cannot do so correctly
252 * for non-QoS-data and management frames because beacons need them from
253 * that counter as well and mac80211 cannot guarantee proper sequencing.
254 * If this flag is set, the driver should instruct the hardware to
255 * assign a sequence number to the frame or assign one itself. Cf. IEEE
256 * 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
257 * beacons always be clear for frames without a sequence number field.
258 */ 246 */
259enum mac80211_tx_control_flags { 247enum mac80211_tx_control_flags {
260 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 248 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
261 IEEE80211_TX_CTL_USE_RTS_CTS = BIT(2), 249 IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(1),
262 IEEE80211_TX_CTL_USE_CTS_PROTECT = BIT(3), 250 IEEE80211_TX_CTL_NO_ACK = BIT(2),
263 IEEE80211_TX_CTL_NO_ACK = BIT(4), 251 IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(3),
264 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(5), 252 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(4),
265 IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(6), 253 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(5),
266 IEEE80211_TX_CTL_REQUEUE = BIT(7), 254 IEEE80211_TX_CTL_AMPDU = BIT(6),
267 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(8), 255 IEEE80211_TX_CTL_INJECTED = BIT(7),
268 IEEE80211_TX_CTL_SHORT_PREAMBLE = BIT(9), 256 IEEE80211_TX_STAT_TX_FILTERED = BIT(8),
269 IEEE80211_TX_CTL_LONG_RETRY_LIMIT = BIT(10), 257 IEEE80211_TX_STAT_ACK = BIT(9),
270 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(12), 258 IEEE80211_TX_STAT_AMPDU = BIT(10),
271 IEEE80211_TX_CTL_AMPDU = BIT(13), 259 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
272 IEEE80211_TX_CTL_OFDM_HT = BIT(14), 260 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
273 IEEE80211_TX_CTL_GREEN_FIELD = BIT(15), 261
274 IEEE80211_TX_CTL_40_MHZ_WIDTH = BIT(16), 262 /* XXX: remove this */
275 IEEE80211_TX_CTL_DUP_DATA = BIT(17), 263 IEEE80211_TX_CTL_REQUEUE = BIT(13),
276 IEEE80211_TX_CTL_SHORT_GI = BIT(18),
277 IEEE80211_TX_CTL_INJECTED = BIT(19),
278 IEEE80211_TX_STAT_TX_FILTERED = BIT(20),
279 IEEE80211_TX_STAT_ACK = BIT(21),
280 IEEE80211_TX_STAT_AMPDU = BIT(22),
281 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(23),
282 IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(24),
283}; 264};
284 265
266enum mac80211_rate_control_flags {
267 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0),
268 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
269 IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2),
270
271 /* rate index is an MCS rate number instead of an index */
272 IEEE80211_TX_RC_MCS = BIT(3),
273 IEEE80211_TX_RC_GREEN_FIELD = BIT(4),
274 IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5),
275 IEEE80211_TX_RC_DUP_DATA = BIT(6),
276 IEEE80211_TX_RC_SHORT_GI = BIT(7),
277};
278
279
280/* there are 40 bytes if you don't need the rateset to be kept */
281#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40
285 282
286#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE \ 283/* if you do need the rateset, then you have less space */
287 (sizeof(((struct sk_buff *)0)->cb) - 8) 284#define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24
288#define IEEE80211_TX_INFO_DRIVER_DATA_PTRS \
289 (IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *))
290 285
291/* maximum number of alternate rate retry stages */ 286/* maximum number of rate stages */
292#define IEEE80211_TX_MAX_ALTRATE 3 287#define IEEE80211_TX_MAX_RATES 5
293 288
294/** 289/**
295 * struct ieee80211_tx_altrate - alternate rate selection/status 290 * struct ieee80211_tx_rate - rate selection/status
296 * 291 *
297 * @rate_idx: rate index to attempt to send with 292 * @idx: rate index to attempt to send with
293 * @flags: rate control flags (&enum mac80211_rate_control_flags)
298 * @limit: number of retries before fallback 294 * @limit: number of retries before fallback
295 *
296 * A value of -1 for @idx indicates an invalid rate and, if used
297 * in an array of retry rates, that no more rates should be tried.
298 *
299 * When used for transmit status reporting, the driver should
300 * always report the rate along with the flags it used.
299 */ 301 */
300struct ieee80211_tx_altrate { 302struct ieee80211_tx_rate {
301 s8 rate_idx; 303 s8 idx;
302 u8 limit; 304 u8 count;
305 u8 flags;
303}; 306};
304 307
305/** 308/**
@@ -314,15 +317,12 @@ struct ieee80211_tx_altrate {
314 * it may be NULL. 317 * it may be NULL.
315 * 318 *
316 * @flags: transmit info flags, defined above 319 * @flags: transmit info flags, defined above
317 * @band: TBD 320 * @band: the band to transmit on (use for checking for races)
318 * @tx_rate_idx: TBD
319 * @antenna_sel_tx: antenna to use, 0 for automatic diversity 321 * @antenna_sel_tx: antenna to use, 0 for automatic diversity
320 * @control: union for control data 322 * @control: union for control data
321 * @status: union for status data 323 * @status: union for status data
322 * @driver_data: array of driver_data pointers 324 * @driver_data: array of driver_data pointers
323 * @retry_count: number of retries 325 * @retry_count: number of retries
324 * @excessive_retries: set to 1 if the frame was retried many times
325 * but not acknowledged
326 * @ampdu_ack_len: number of aggregated frames. 326 * @ampdu_ack_len: number of aggregated frames.
327 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 327 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
328 * @ampdu_ack_map: block ack bit map for the aggregation. 328 * @ampdu_ack_map: block ack bit map for the aggregation.
@@ -333,31 +333,43 @@ struct ieee80211_tx_info {
333 /* common information */ 333 /* common information */
334 u32 flags; 334 u32 flags;
335 u8 band; 335 u8 band;
336 s8 tx_rate_idx; 336
337 u8 antenna_sel_tx; 337 u8 antenna_sel_tx;
338 338
339 /* 1 byte hole */ 339 /* 2 byte hole */
340 340
341 union { 341 union {
342 struct { 342 struct {
343 union {
344 /* rate control */
345 struct {
346 struct ieee80211_tx_rate rates[
347 IEEE80211_TX_MAX_RATES];
348 s8 rts_cts_rate_idx;
349 };
350 /* only needed before rate control */
351 unsigned long jiffies;
352 };
343 /* NB: vif can be NULL for injected frames */ 353 /* NB: vif can be NULL for injected frames */
344 struct ieee80211_vif *vif; 354 struct ieee80211_vif *vif;
345 struct ieee80211_key_conf *hw_key; 355 struct ieee80211_key_conf *hw_key;
346 struct ieee80211_sta *sta; 356 struct ieee80211_sta *sta;
347 unsigned long jiffies;
348 s8 rts_cts_rate_idx;
349 u8 retry_limit;
350 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE];
351 } control; 357 } control;
352 struct { 358 struct {
359 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
360 u8 ampdu_ack_len;
353 u64 ampdu_ack_map; 361 u64 ampdu_ack_map;
354 int ack_signal; 362 int ack_signal;
355 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE + 1]; 363 /* 8 bytes free */
356 u8 retry_count;
357 bool excessive_retries;
358 u8 ampdu_ack_len;
359 } status; 364 } status;
360 void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_PTRS]; 365 struct {
366 struct ieee80211_tx_rate driver_rates[
367 IEEE80211_TX_MAX_RATES];
368 void *rate_driver_data[
369 IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];
370 };
371 void *driver_data[
372 IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];
361 }; 373 };
362}; 374};
363 375
@@ -366,6 +378,41 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
366 return (struct ieee80211_tx_info *)skb->cb; 378 return (struct ieee80211_tx_info *)skb->cb;
367} 379}
368 380
381/**
382 * ieee80211_tx_info_clear_status - clear TX status
383 *
384 * @info: The &struct ieee80211_tx_info to be cleared.
385 *
386 * When the driver passes an skb back to mac80211, it must report
387 * a number of things in TX status. This function clears everything
388 * in the TX status but the rate control information (it does clear
389 * the count since you need to fill that in anyway).
390 *
391 * NOTE: You can only use this function if you do NOT use
392 * info->driver_data! Use info->rate_driver_data
393 * instead if you need only the less space that allows.
394 */
395static inline void
396ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
397{
398 int i;
399
400 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
401 offsetof(struct ieee80211_tx_info, control.rates));
402 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
403 offsetof(struct ieee80211_tx_info, driver_rates));
404 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != 8);
405 /* clear the rate counts */
406 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++)
407 info->status.rates[i].count = 0;
408
409 BUILD_BUG_ON(
410 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len) != 23);
411 memset(&info->status.ampdu_ack_len, 0,
412 sizeof(struct ieee80211_tx_info) -
413 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len));
414}
415
369 416
370/** 417/**
371 * enum mac80211_rx_flags - receive flags 418 * enum mac80211_rx_flags - receive flags
@@ -869,8 +916,8 @@ enum ieee80211_hw_flags {
869 * @sta_data_size: size (in bytes) of the drv_priv data area 916 * @sta_data_size: size (in bytes) of the drv_priv data area
870 * within &struct ieee80211_sta. 917 * within &struct ieee80211_sta.
871 * 918 *
872 * @max_altrates: maximum number of alternate rate retry stages 919 * @max_rates: maximum number of alternate rate retry stages
873 * @max_altrate_tries: maximum number of tries for each stage 920 * @max_rate_tries: maximum number of tries for each stage
874 */ 921 */
875struct ieee80211_hw { 922struct ieee80211_hw {
876 struct ieee80211_conf conf; 923 struct ieee80211_conf conf;
@@ -887,8 +934,8 @@ struct ieee80211_hw {
887 u16 ampdu_queues; 934 u16 ampdu_queues;
888 u16 max_listen_interval; 935 u16 max_listen_interval;
889 s8 max_signal; 936 s8 max_signal;
890 u8 max_altrates; 937 u8 max_rates;
891 u8 max_altrate_tries; 938 u8 max_rate_tries;
892}; 939};
893 940
894/** 941/**
@@ -927,9 +974,9 @@ static inline struct ieee80211_rate *
927ieee80211_get_tx_rate(const struct ieee80211_hw *hw, 974ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
928 const struct ieee80211_tx_info *c) 975 const struct ieee80211_tx_info *c)
929{ 976{
930 if (WARN_ON(c->tx_rate_idx < 0)) 977 if (WARN_ON(c->control.rates[0].idx < 0))
931 return NULL; 978 return NULL;
932 return &hw->wiphy->bands[c->band]->bitrates[c->tx_rate_idx]; 979 return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
933} 980}
934 981
935static inline struct ieee80211_rate * 982static inline struct ieee80211_rate *
@@ -945,9 +992,9 @@ static inline struct ieee80211_rate *
945ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, 992ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
946 const struct ieee80211_tx_info *c, int idx) 993 const struct ieee80211_tx_info *c, int idx)
947{ 994{
948 if (c->control.retries[idx].rate_idx < 0) 995 if (c->control.rates[idx + 1].idx < 0)
949 return NULL; 996 return NULL;
950 return &hw->wiphy->bands[c->band]->bitrates[c->control.retries[idx].rate_idx]; 997 return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx];
951} 998}
952 999
953/** 1000/**
@@ -1840,17 +1887,30 @@ struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
1840 1887
1841 1888
1842/* Rate control API */ 1889/* Rate control API */
1890
1843/** 1891/**
1844 * struct rate_selection - rate information for/from rate control algorithms 1892 * struct ieee80211_tx_rate_control - rate control information for/from RC algo
1845 * 1893 *
1846 * @rate_idx: selected transmission rate index 1894 * @hw: The hardware the algorithm is invoked for.
1847 * @nonerp_idx: Non-ERP rate to use instead if ERP cannot be used 1895 * @sband: The band this frame is being transmitted on.
1848 * @probe_idx: rate for probing (or -1) 1896 * @bss_conf: the current BSS configuration
1849 * @max_rate_idx: maximum rate index that can be used, this is 1897 * @reported_rate: The rate control algorithm can fill this in to indicate
1850 * input to the algorithm and will be enforced 1898 * which rate should be reported to userspace as the current rate and
1851 */ 1899 * used for rate calculations in the mesh network.
1852struct rate_selection { 1900 * @rts: whether RTS will be used for this frame because it is longer than the
1853 s8 rate_idx, nonerp_idx, probe_idx, max_rate_idx; 1901 * RTS threshold
1902 * @short_preamble: whether mac80211 will request short-preamble transmission
1903 * if the selected rate supports it
1904 * @max_rate_idx: user-requested maximum rate (not MCS for now)
1905 */
1906struct ieee80211_tx_rate_control {
1907 struct ieee80211_hw *hw;
1908 struct ieee80211_supported_band *sband;
1909 struct ieee80211_bss_conf *bss_conf;
1910 struct sk_buff *skb;
1911 struct ieee80211_tx_rate reported_rate;
1912 bool rts, short_preamble;
1913 u8 max_rate_idx;
1854}; 1914};
1855 1915
1856struct rate_control_ops { 1916struct rate_control_ops {
@@ -1869,10 +1929,8 @@ struct rate_control_ops {
1869 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, 1929 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
1870 struct ieee80211_sta *sta, void *priv_sta, 1930 struct ieee80211_sta *sta, void *priv_sta,
1871 struct sk_buff *skb); 1931 struct sk_buff *skb);
1872 void (*get_rate)(void *priv, struct ieee80211_supported_band *sband, 1932 void (*get_rate)(void *priv, struct ieee80211_sta *sta, void *priv_sta,
1873 struct ieee80211_sta *sta, void *priv_sta, 1933 struct ieee80211_tx_rate_control *txrc);
1874 struct sk_buff *skb,
1875 struct rate_selection *sel);
1876 1934
1877 void (*add_sta_debugfs)(void *priv, void *priv_sta, 1935 void (*add_sta_debugfs)(void *priv, void *priv_sta,
1878 struct dentry *dir); 1936 struct dentry *dir);