aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/mac80211.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-01-24 13:38:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 15:19:32 -0500
commit8318d78a44d49ac1edf2bdec7299de3617c4232e (patch)
treed434634418edd7399737801615d247be06616fdd /include/net/mac80211.h
parent10b6b80145cc93887dd8aab99bfffa375e9add31 (diff)
cfg80211 API for channels/bitrates, mac80211 and driver conversion
This patch creates new cfg80211 wiphy API for channel and bitrate registration and converts mac80211 and drivers to the new API. The old mac80211 API is completely ripped out. All drivers (except ath5k) are updated to the new API, in many cases I expect that optimisations can be done. Along with the regulatory code I've also ripped out the IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED flag, I believe it to be unnecessary if the hardware simply gives us whatever channels it wants to support and we then enable/disable them as required, which is pretty much required for travelling. Additionally, the patch adds proper "basic" rate handling for STA mode interface, AP mode interface will have to have new API added to allow userspace to set the basic rate set, currently it'll be empty... However, the basic rate handling will need to be moved to the BSS conf stuff. I do expect there to be bugs in this, especially wrt. transmit power handling where I'm basically clueless about how it should work. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/net/mac80211.h')
-rw-r--r--include/net/mac80211.h197
1 files changed, 34 insertions, 163 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 277488176a44..460da54a0019 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -69,95 +69,6 @@
69 * not do so then mac80211 may add this under certain circumstances. 69 * not do so then mac80211 may add this under certain circumstances.
70 */ 70 */
71 71
72#define IEEE80211_CHAN_W_SCAN 0x00000001
73#define IEEE80211_CHAN_W_ACTIVE_SCAN 0x00000002
74#define IEEE80211_CHAN_W_IBSS 0x00000004
75
76/* Channel information structure. Low-level driver is expected to fill in chan,
77 * freq, and val fields. Other fields will be filled in by 80211.o based on
78 * hostapd information and low-level driver does not need to use them. The
79 * limits for each channel will be provided in 'struct ieee80211_conf' when
80 * configuring the low-level driver with hw->config callback. If a device has
81 * a default regulatory domain, IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED
82 * can be set to let the driver configure all fields */
83struct ieee80211_channel {
84 short chan; /* channel number (IEEE 802.11) */
85 short freq; /* frequency in MHz */
86 int val; /* hw specific value for the channel */
87 int flag; /* flag for hostapd use (IEEE80211_CHAN_*) */
88 unsigned char power_level;
89 unsigned char antenna_max;
90};
91
92#define IEEE80211_RATE_ERP 0x00000001
93#define IEEE80211_RATE_BASIC 0x00000002
94#define IEEE80211_RATE_PREAMBLE2 0x00000004
95#define IEEE80211_RATE_SUPPORTED 0x00000010
96#define IEEE80211_RATE_OFDM 0x00000020
97#define IEEE80211_RATE_CCK 0x00000040
98#define IEEE80211_RATE_MANDATORY 0x00000100
99
100#define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2)
101#define IEEE80211_RATE_MODULATION(f) \
102 (f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM))
103
104/* Low-level driver should set PREAMBLE2, OFDM and CCK flags.
105 * BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the
106 * configuration. */
107struct ieee80211_rate {
108 int rate; /* rate in 100 kbps */
109 int val; /* hw specific value for the rate */
110 int flags; /* IEEE80211_RATE_ flags */
111 int val2; /* hw specific value for the rate when using short preamble
112 * (only when IEEE80211_RATE_PREAMBLE2 flag is set, i.e., for
113 * 2, 5.5, and 11 Mbps) */
114 signed char min_rssi_ack;
115 unsigned char min_rssi_ack_delta;
116
117 /* following fields are set by 80211.o and need not be filled by the
118 * low-level driver */
119 int rate_inv; /* inverse of the rate (LCM(all rates) / rate) for
120 * optimizing channel utilization estimates */
121};
122
123/**
124 * enum ieee80211_phymode - PHY modes
125 *
126 * @MODE_IEEE80211A: 5GHz as defined by 802.11a/802.11h
127 * @MODE_IEEE80211B: 2.4 GHz as defined by 802.11b
128 * @MODE_IEEE80211G: 2.4 GHz as defined by 802.11g (with OFDM),
129 * backwards compatible with 11b mode
130 * @NUM_IEEE80211_MODES: internal
131 */
132enum ieee80211_phymode {
133 MODE_IEEE80211A,
134 MODE_IEEE80211B,
135 MODE_IEEE80211G,
136
137 /* keep last */
138 NUM_IEEE80211_MODES
139};
140
141/**
142 * struct ieee80211_ht_info - describing STA's HT capabilities
143 *
144 * This structure describes most essential parameters needed
145 * to describe 802.11n HT capabilities for an STA.
146 *
147 * @ht_supported: is HT supported by STA, 0: no, 1: yes
148 * @cap: HT capabilities map as described in 802.11n spec
149 * @ampdu_factor: Maximum A-MPDU length factor
150 * @ampdu_density: Minimum A-MPDU spacing
151 * @supp_mcs_set: Supported MCS set as described in 802.11n spec
152 */
153struct ieee80211_ht_info {
154 u8 ht_supported;
155 u16 cap; /* use IEEE80211_HT_CAP_ */
156 u8 ampdu_factor;
157 u8 ampdu_density;
158 u8 supp_mcs_set[16];
159};
160
161/** 72/**
162 * struct ieee80211_ht_bss_info - describing BSS's HT characteristics 73 * struct ieee80211_ht_bss_info - describing BSS's HT characteristics
163 * 74 *
@@ -175,30 +86,6 @@ struct ieee80211_ht_bss_info {
175}; 86};
176 87
177/** 88/**
178 * struct ieee80211_hw_mode - PHY mode definition
179 *
180 * This structure describes the capabilities supported by the device
181 * in a single PHY mode.
182 *
183 * @list: internal
184 * @channels: pointer to array of supported channels
185 * @rates: pointer to array of supported bitrates
186 * @mode: the PHY mode for this definition
187 * @num_channels: number of supported channels
188 * @num_rates: number of supported bitrates
189 * @ht_info: PHY's 802.11n HT abilities for this mode
190 */
191struct ieee80211_hw_mode {
192 struct list_head list;
193 struct ieee80211_channel *channels;
194 struct ieee80211_rate *rates;
195 enum ieee80211_phymode mode;
196 int num_channels;
197 int num_rates;
198 struct ieee80211_ht_info ht_info;
199};
200
201/**
202 * struct ieee80211_tx_queue_params - transmit queue configuration 89 * struct ieee80211_tx_queue_params - transmit queue configuration
203 * 90 *
204 * The information provided in this structure is required for QoS 91 * The information provided in this structure is required for QoS
@@ -320,11 +207,13 @@ struct ieee80211_bss_conf {
320 207
321struct ieee80211_tx_control { 208struct ieee80211_tx_control {
322 struct ieee80211_vif *vif; 209 struct ieee80211_vif *vif;
323 int tx_rate; /* Transmit rate, given as the hw specific value for the 210 struct ieee80211_rate *tx_rate;
324 * rate (from struct ieee80211_rate) */ 211
325 int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw 212 /* Transmit rate for RTS/CTS frame */
326 * specific value for the rate (from 213 struct ieee80211_rate *rts_cts_rate;
327 * struct ieee80211_rate) */ 214
215 /* retry rate for the last retries */
216 struct ieee80211_rate *alt_retry_rate;
328 217
329#define IEEE80211_TXCTL_REQ_TX_STATUS (1<<0)/* request TX status callback for 218#define IEEE80211_TXCTL_REQ_TX_STATUS (1<<0)/* request TX status callback for
330 * this frame */ 219 * this frame */
@@ -343,6 +232,7 @@ struct ieee80211_tx_control {
343#define IEEE80211_TXCTL_REQUEUE (1<<7) 232#define IEEE80211_TXCTL_REQUEUE (1<<7)
344#define IEEE80211_TXCTL_FIRST_FRAGMENT (1<<8) /* this is a first fragment of 233#define IEEE80211_TXCTL_FIRST_FRAGMENT (1<<8) /* this is a first fragment of
345 * the frame */ 234 * the frame */
235#define IEEE80211_TXCTL_SHORT_PREAMBLE (1<<9)
346#define IEEE80211_TXCTL_LONG_RETRY_LIMIT (1<<10) /* this frame should be send 236#define IEEE80211_TXCTL_LONG_RETRY_LIMIT (1<<10) /* this frame should be send
347 * using the through 237 * using the through
348 * set_retry_limit configured 238 * set_retry_limit configured
@@ -359,20 +249,11 @@ struct ieee80211_tx_control {
359 u8 retry_limit; /* 1 = only first attempt, 2 = one retry, .. 249 u8 retry_limit; /* 1 = only first attempt, 2 = one retry, ..
360 * This could be used when set_retry_limit 250 * This could be used when set_retry_limit
361 * is not implemented by the driver */ 251 * is not implemented by the driver */
362 u8 power_level; /* per-packet transmit power level, in dBm */
363 u8 antenna_sel_tx; /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */ 252 u8 antenna_sel_tx; /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */
364 u8 icv_len; /* length of the ICV/MIC field in octets */ 253 u8 icv_len; /* length of the ICV/MIC field in octets */
365 u8 iv_len; /* length of the IV field in octets */ 254 u8 iv_len; /* length of the IV field in octets */
366 u8 queue; /* hardware queue to use for this frame; 255 u8 queue; /* hardware queue to use for this frame;
367 * 0 = highest, hw->queues-1 = lowest */ 256 * 0 = highest, hw->queues-1 = lowest */
368 struct ieee80211_rate *rate; /* internal 80211.o rate */
369 struct ieee80211_rate *rts_rate; /* internal 80211.o rate
370 * for RTS/CTS */
371 int alt_retry_rate; /* retry rate for the last retries, given as the
372 * hw specific value for the rate (from
373 * struct ieee80211_rate). To be used to limit
374 * packet dropping when probing higher rates, if hw
375 * supports multiple retry rates. -1 = not used */
376 int type; /* internal */ 257 int type; /* internal */
377}; 258};
378 259
@@ -415,26 +296,24 @@ enum mac80211_rx_flags {
415 * supported by hardware) to the 802.11 code with each received 296 * supported by hardware) to the 802.11 code with each received
416 * frame. 297 * frame.
417 * @mactime: MAC timestamp as defined by 802.11 298 * @mactime: MAC timestamp as defined by 802.11
299 * @band: the active band when this frame was received
418 * @freq: frequency the radio was tuned to when receiving this frame, in MHz 300 * @freq: frequency the radio was tuned to when receiving this frame, in MHz
419 * @channel: channel the radio was tuned to
420 * @phymode: active PHY mode
421 * @ssi: signal strength when receiving this frame 301 * @ssi: signal strength when receiving this frame
422 * @signal: used as 'qual' in statistics reporting 302 * @signal: used as 'qual' in statistics reporting
423 * @noise: PHY noise when receiving this frame 303 * @noise: PHY noise when receiving this frame
424 * @antenna: antenna used 304 * @antenna: antenna used
425 * @rate: data rate 305 * @rate_idx: index of data rate into band's supported rates
426 * @flag: %RX_FLAG_* 306 * @flag: %RX_FLAG_*
427 */ 307 */
428struct ieee80211_rx_status { 308struct ieee80211_rx_status {
429 u64 mactime; 309 u64 mactime;
310 enum ieee80211_band band;
430 int freq; 311 int freq;
431 int channel;
432 enum ieee80211_phymode phymode;
433 int ssi; 312 int ssi;
434 int signal; 313 int signal;
435 int noise; 314 int noise;
436 int antenna; 315 int antenna;
437 int rate; 316 int rate_idx;
438 int flag; 317 int flag;
439}; 318};
440 319
@@ -509,41 +388,30 @@ enum ieee80211_conf_flags {
509 * 388 *
510 * @radio_enabled: when zero, driver is required to switch off the radio. 389 * @radio_enabled: when zero, driver is required to switch off the radio.
511 * TODO make a flag 390 * TODO make a flag
512 * @channel: IEEE 802.11 channel number
513 * @freq: frequency in MHz
514 * @channel_val: hardware specific channel value for the channel
515 * @phymode: PHY mode to activate (REMOVE)
516 * @chan: channel to switch to, pointer to the channel information
517 * @mode: pointer to mode definition
518 * @regulatory_domain: ??
519 * @beacon_int: beacon interval (TODO make interface config) 391 * @beacon_int: beacon interval (TODO make interface config)
520 * @flags: configuration flags defined above 392 * @flags: configuration flags defined above
521 * @power_level: transmit power limit for current regulatory domain in dBm 393 * @power_level: requested transmit power (in dBm)
522 * @antenna_max: maximum antenna gain 394 * @max_antenna_gain: maximum antenna gain (in dBi)
523 * @antenna_sel_tx: transmit antenna selection, 0: default/diversity, 395 * @antenna_sel_tx: transmit antenna selection, 0: default/diversity,
524 * 1/2: antenna 0/1 396 * 1/2: antenna 0/1
525 * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx 397 * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx
526 * @ht_conf: describes current self configuration of 802.11n HT capabilies 398 * @ht_conf: describes current self configuration of 802.11n HT capabilies
527 * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters 399 * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
400 * @channel: the channel to tune to
528 */ 401 */
529struct ieee80211_conf { 402struct ieee80211_conf {
530 int channel; /* IEEE 802.11 channel number */
531 int freq; /* MHz */
532 int channel_val; /* hw specific value for the channel */
533
534 enum ieee80211_phymode phymode;
535 struct ieee80211_channel *chan;
536 struct ieee80211_hw_mode *mode;
537 unsigned int regulatory_domain; 403 unsigned int regulatory_domain;
538 int radio_enabled; 404 int radio_enabled;
539 405
540 int beacon_int; 406 int beacon_int;
541 u32 flags; 407 u32 flags;
542 u8 power_level; 408 int power_level;
543 u8 antenna_max; 409 int max_antenna_gain;
544 u8 antenna_sel_tx; 410 u8 antenna_sel_tx;
545 u8 antenna_sel_rx; 411 u8 antenna_sel_rx;
546 412
413 struct ieee80211_channel *channel;
414
547 struct ieee80211_ht_info ht_conf; 415 struct ieee80211_ht_info ht_conf;
548 struct ieee80211_ht_bss_info ht_bss_conf; 416 struct ieee80211_ht_bss_info ht_bss_conf;
549}; 417};
@@ -764,15 +632,19 @@ enum sta_notify_cmd {
764 * %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is also not set because 632 * %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is also not set because
765 * otherwise the stack will not know when the DTIM beacon was sent. 633 * otherwise the stack will not know when the DTIM beacon was sent.
766 * 634 *
767 * @IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED: 635 * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE:
768 * Channels are already configured to the default regulatory domain 636 * Hardware is not capable of short slot operation on the 2.4 GHz band.
769 * specified in the device's EEPROM 637 *
638 * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE:
639 * Hardware is not capable of receiving frames with short preamble on
640 * the 2.4 GHz band.
770 */ 641 */
771enum ieee80211_hw_flags { 642enum ieee80211_hw_flags {
772 IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE = 1<<0, 643 IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE = 1<<0,
773 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 644 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
774 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, 645 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2,
775 IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED = 1<<3, 646 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3,
647 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
776}; 648};
777 649
778/** 650/**
@@ -784,7 +656,8 @@ enum ieee80211_hw_flags {
784 * @wiphy: This points to the &struct wiphy allocated for this 656 * @wiphy: This points to the &struct wiphy allocated for this
785 * 802.11 PHY. You must fill in the @perm_addr and @dev 657 * 802.11 PHY. You must fill in the @perm_addr and @dev
786 * members of this structure using SET_IEEE80211_DEV() 658 * members of this structure using SET_IEEE80211_DEV()
787 * and SET_IEEE80211_PERM_ADDR(). 659 * and SET_IEEE80211_PERM_ADDR(). Additionally, all supported
660 * bands (with channels, bitrates) are registered here.
788 * 661 *
789 * @conf: &struct ieee80211_conf, device configuration, don't use. 662 * @conf: &struct ieee80211_conf, device configuration, don't use.
790 * 663 *
@@ -1062,7 +935,9 @@ enum ieee80211_ampdu_mlme_action {
1062 * given local_address is enabled. 935 * given local_address is enabled.
1063 * 936 *
1064 * @hw_scan: Ask the hardware to service the scan request, no need to start 937 * @hw_scan: Ask the hardware to service the scan request, no need to start
1065 * the scan state machine in stack. 938 * the scan state machine in stack. The scan must honour the channel
939 * configuration done by the regulatory agent in the wiphy's registered
940 * bands.
1066 * 941 *
1067 * @get_stats: return low-level statistics 942 * @get_stats: return low-level statistics
1068 * 943 *
@@ -1284,10 +1159,6 @@ static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
1284#endif 1159#endif
1285} 1160}
1286 1161
1287/* Register a new hardware PHYMODE capability to the stack. */
1288int ieee80211_register_hwmode(struct ieee80211_hw *hw,
1289 struct ieee80211_hw_mode *mode);
1290
1291/** 1162/**
1292 * ieee80211_unregister_hw - Unregister a hardware device 1163 * ieee80211_unregister_hw - Unregister a hardware device
1293 * 1164 *
@@ -1461,7 +1332,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
1461 * @hw: pointer obtained from ieee80211_alloc_hw(). 1332 * @hw: pointer obtained from ieee80211_alloc_hw().
1462 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1333 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1463 * @frame_len: the length of the frame. 1334 * @frame_len: the length of the frame.
1464 * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. 1335 * @rate: the rate at which the frame is going to be transmitted.
1465 * 1336 *
1466 * Calculate the duration field of some generic frame, given its 1337 * Calculate the duration field of some generic frame, given its
1467 * length and transmission rate (in 100kbps). 1338 * length and transmission rate (in 100kbps).
@@ -1469,7 +1340,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
1469__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, 1340__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
1470 struct ieee80211_vif *vif, 1341 struct ieee80211_vif *vif,
1471 size_t frame_len, 1342 size_t frame_len,
1472 int rate); 1343 struct ieee80211_rate *rate);
1473 1344
1474/** 1345/**
1475 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames 1346 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames