Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/include/drivers/net/ieee80211.h need to be fixed.

0001 /*                    The Quest Operating System
0002  *  Copyright (C) 2005-2010  Richard West, Boston University
0003  *
0004  *  This program is free software: you can redistribute it and/or modify
0005  *  it under the terms of the GNU General Public License as published by
0006  *  the Free Software Foundation, either version 3 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0016  */
0017 
0018 /* Based on Linux */
0019 
0020 #ifndef _IEEE80211_H_
0021 #define _IEEE80211_H_
0022 
0023 /**
0024  * enum ieee80211_band - supported frequency bands
0025  *
0026  * The bands are assigned this way because the supported
0027  * bitrates differ in these bands.
0028  *
0029  * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
0030  * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
0031  */
0032 enum ieee80211_band {
0033   IEEE80211_BAND_2GHZ,
0034   IEEE80211_BAND_5GHZ,
0035 
0036   /* keep last */
0037   IEEE80211_NUM_BANDS
0038 };
0039 
0040 /**
0041  * enum ieee80211_channel_flags - channel flags
0042  *
0043  * Channel flags set by the regulatory control code.
0044  *
0045  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
0046  * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
0047  *      on this channel.
0048  * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
0049  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
0050  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
0051  *      is not permitted.
0052  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
0053  *      is not permitted.
0054  */
0055 enum ieee80211_channel_flags {
0056   IEEE80211_CHAN_DISABLED               = 1<<0,
0057   IEEE80211_CHAN_PASSIVE_SCAN   = 1<<1,
0058   IEEE80211_CHAN_NO_IBSS                = 1<<2,
0059   IEEE80211_CHAN_RADAR          = 1<<3,
0060   IEEE80211_CHAN_NO_HT40PLUS    = 1<<4,
0061   IEEE80211_CHAN_NO_HT40MINUS   = 1<<5,
0062 };
0063 
0064 #define IEEE80211_CHAN_NO_HT40                                  \
0065   (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
0066 
0067 /**
0068  * struct ieee80211_channel - channel definition
0069  *
0070  * This structure describes a single channel for use
0071  * with cfg80211.
0072  *
0073  * @center_freq: center frequency in MHz
0074  * @hw_value: hardware-specific value for the channel
0075  * @flags: channel flags from &enum ieee80211_channel_flags.
0076  * @orig_flags: channel flags at registration time, used by regulatory
0077  *      code to support devices with additional restrictions
0078  * @band: band this channel belongs to.
0079  * @max_antenna_gain: maximum antenna gain in dBi
0080  * @max_power: maximum transmission power (in dBm)
0081  * @beacon_found: helper to regulatory code to indicate when a beacon
0082  *      has been found on this channel. Use regulatory_hint_found_beacon()
0083  *      to enable this, this is is useful only on 5 GHz band.
0084  * @orig_mag: internal use
0085  * @orig_mpwr: internal use
0086  */
0087 
0088 struct ieee80211_channel {
0089   enum ieee80211_band band;
0090   u16 center_freq;
0091   u16 hw_value;
0092   u32 flags;
0093   int max_antenna_gain;
0094   int max_power;
0095   bool beacon_found;
0096   u32 orig_flags;
0097   int orig_mag, orig_mpwr;
0098 };
0099 
0100 /**
0101  * enum ieee80211_rate_flags - rate flags
0102  *
0103  * Hardware/specification flags for rates. These are structured
0104  * in a way that allows using the same bitrate structure for
0105  * different bands/PHY modes.
0106  *
0107  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
0108  *      preamble on this bitrate; only relevant in 2.4GHz band and
0109  *      with CCK rates.
0110  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
0111  *      when used with 802.11a (on the 5 GHz band); filled by the
0112  *      core code when registering the wiphy.
0113  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
0114  *      when used with 802.11b (on the 2.4 GHz band); filled by the
0115  *      core code when registering the wiphy.
0116  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
0117  *      when used with 802.11g (on the 2.4 GHz band); filled by the
0118  *      core code when registering the wiphy.
0119  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
0120  */
0121 enum ieee80211_rate_flags {
0122   IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
0123   IEEE80211_RATE_MANDATORY_A    = 1<<1,
0124   IEEE80211_RATE_MANDATORY_B    = 1<<2,
0125   IEEE80211_RATE_MANDATORY_G    = 1<<3,
0126   IEEE80211_RATE_ERP_G          = 1<<4,
0127 };
0128 
0129 /**
0130  * struct ieee80211_rate - bitrate definition
0131  *
0132  * This structure describes a bitrate that an 802.11 PHY can
0133  * operate with. The two values @hw_value and @hw_value_short
0134  * are only for driver use when pointers to this structure are
0135  * passed around.
0136  *
0137  * @flags: rate-specific flags
0138  * @bitrate: bitrate in units of 100 Kbps
0139  * @hw_value: driver/hardware value for this rate
0140  * @hw_value_short: driver/hardware value for this rate when
0141  *      short preamble is used
0142  */
0143 struct ieee80211_rate {
0144   u32 flags;
0145   u16 bitrate;
0146   u16 hw_value, hw_value_short;
0147 };
0148 
0149 /**
0150  * enum ieee80211_conf_flags - configuration flags
0151  *
0152  * Flags to define PHY configuration options
0153  *
0154  * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
0155  * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only)
0156  * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
0157  *  the driver should be prepared to handle configuration requests but
0158  *  may turn the device off as much as possible. Typically, this flag will
0159  *  be set when an interface is set UP but not associated or scanning, but
0160  *  it can also be unset in that case when monitor interfaces are active.
0161  */
0162 enum ieee80211_conf_flags {
0163     IEEE80211_CONF_RADIOTAP     = (1<<0),
0164     IEEE80211_CONF_PS       = (1<<1),
0165     IEEE80211_CONF_IDLE     = (1<<2),
0166 };
0167 
0168 
0169 /**
0170  * enum ieee80211_conf_changed - denotes which configuration changed
0171  *
0172  * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
0173  * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
0174  * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
0175  * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
0176  * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
0177  * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
0178  * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
0179  */
0180 enum ieee80211_conf_changed {
0181     IEEE80211_CONF_CHANGE_LISTEN_INTERVAL   = BIT(2),
0182     IEEE80211_CONF_CHANGE_RADIOTAP      = BIT(3),
0183     IEEE80211_CONF_CHANGE_PS        = BIT(4),
0184     IEEE80211_CONF_CHANGE_POWER     = BIT(5),
0185     IEEE80211_CONF_CHANGE_CHANNEL       = BIT(6),
0186     IEEE80211_CONF_CHANGE_RETRY_LIMITS  = BIT(7),
0187     IEEE80211_CONF_CHANGE_IDLE      = BIT(8),
0188 };
0189 
0190 enum nl80211_channel_type {
0191     NL80211_CHAN_NO_HT,
0192     NL80211_CHAN_HT20,
0193     NL80211_CHAN_HT40MINUS,
0194     NL80211_CHAN_HT40PLUS
0195 };
0196 
0197 /**
0198  * struct ieee80211_conf - configuration of the device
0199  *
0200  * This struct indicates how the driver shall configure the hardware.
0201  *
0202  * @flags: configuration flags defined above
0203  *
0204  * @listen_interval: listen interval in units of beacon interval
0205  * @max_sleep_period: the maximum number of beacon intervals to sleep for
0206  *  before checking the beacon for a TIM bit (managed mode only); this
0207  *  value will be only achievable between DTIM frames, the hardware
0208  *  needs to check for the multicast traffic bit in DTIM beacons.
0209  *  This variable is valid only when the CONF_PS flag is set.
0210  * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
0211  *  powersave documentation below. This variable is valid only when
0212  *  the CONF_PS flag is set.
0213  *
0214  * @power_level: requested transmit power (in dBm)
0215  *
0216  * @channel: the channel to tune to
0217  * @channel_type: the channel (HT) type
0218  *
0219  * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
0220  *    (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
0221  *    but actually means the number of transmissions not the number of retries
0222  * @short_frame_max_tx_count: Maximum number of transmissions for a "short"
0223  *    frame, called "dot11ShortRetryLimit" in 802.11, but actually means the
0224  *    number of transmissions not the number of retries
0225  */
0226 struct ieee80211_conf {
0227     u32 flags;
0228     int power_level, dynamic_ps_timeout;
0229     int max_sleep_period;
0230 
0231     u16 listen_interval;
0232 
0233     u8 long_frame_max_tx_count, short_frame_max_tx_count;
0234 
0235     struct ieee80211_channel *channel;
0236     enum nl80211_channel_type channel_type;
0237 };
0238 
0239 /**
0240  * struct ieee80211_tx_queue_params - transmit queue configuration
0241  *
0242  * The information provided in this structure is required for QoS
0243  * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
0244  *
0245  * @aifs: arbitration interframe space [0..255]
0246  * @cw_min: minimum contention window [a value of the form
0247  *  2^n-1 in the range 1..32767]
0248  * @cw_max: maximum contention window [like @cw_min]
0249  * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
0250  */
0251 struct ieee80211_tx_queue_params {
0252     u16 txop;
0253     u16 cw_min;
0254     u16 cw_max;
0255     u8 aifs;
0256 };
0257 
0258 static inline int
0259 ieee80211_frequency_to_channel(int freq)
0260 {
0261   if (freq == 2484)
0262     return 14;
0263 
0264   if (freq < 2484)
0265     return (freq - 2407) / 5;
0266 
0267   /* FIXME: 802.11j 17.3.8.3.2 */
0268   return freq/5 - 1000;
0269 }
0270 
0271 #endif
0272 
0273 /*
0274  * Local Variables:
0275  * indent-tabs-mode: nil
0276  * mode: C
0277  * c-file-style: "gnu"
0278  * c-basic-offset: 2
0279  * End:
0280  */
0281 
0282 /* vi: set et sw=2 sts=2: */