Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6

Conflicts:
	net/mac80211/pm.c
This commit is contained in:
David S. Miller
2009-04-25 16:36:46 -07:00
melakukan 495a1b4eff
187 mengubah file dengan 7924 tambahan dan 5614 penghapusan

File diff ditekan karena terlalu besar Load Diff

Melihat File

@@ -19,7 +19,6 @@
#include <linux/wireless.h>
#include <linux/device.h>
#include <linux/ieee80211.h>
#include <net/wireless.h>
#include <net/cfg80211.h>
/**
@@ -518,7 +517,7 @@ struct ieee80211_rx_status {
* Flags to define PHY configuration options
*
* @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
* @IEEE80211_CONF_PS: Enable 802.11 power save mode
* @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only)
*/
enum ieee80211_conf_flags {
IEEE80211_CONF_RADIOTAP = (1<<0),
@@ -533,8 +532,7 @@ enum ieee80211_conf_flags {
* @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed
* @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
* @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
* @IEEE80211_CONF_CHANGE_PS: the PS flag changed
* @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed
* @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
* @IEEE80211_CONF_CHANGE_POWER: the TX power changed
* @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
* @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
@@ -545,10 +543,9 @@ enum ieee80211_conf_changed {
IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
IEEE80211_CONF_CHANGE_PS = BIT(4),
IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT = BIT(5),
IEEE80211_CONF_CHANGE_POWER = BIT(6),
IEEE80211_CONF_CHANGE_CHANNEL = BIT(7),
IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(8),
IEEE80211_CONF_CHANGE_POWER = BIT(5),
IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
};
/**
@@ -556,14 +553,26 @@ enum ieee80211_conf_changed {
*
* This struct indicates how the driver shall configure the hardware.
*
* @flags: configuration flags defined above
*
* @radio_enabled: when zero, driver is required to switch off the radio.
* @beacon_int: beacon interval (TODO make interface config)
*
* @listen_interval: listen interval in units of beacon interval
* @flags: configuration flags defined above
* @max_sleep_interval: the maximum number of beacon intervals to sleep for
* before checking the beacon for a TIM bit (managed mode only); this
* value will be only achievable between DTIM frames, the hardware
* needs to check for the multicast traffic bit in DTIM beacons.
* This variable is valid only when the CONF_PS flag is set.
* @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
* powersave documentation below. This variable is valid only when
* the CONF_PS flag is set.
*
* @power_level: requested transmit power (in dBm)
* @dynamic_ps_timeout: dynamic powersave timeout (in ms)
*
* @channel: the channel to tune to
* @channel_type: the channel (HT) type
*
* @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
* (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
* but actually means the number of transmissions not the number of retries
@@ -575,6 +584,7 @@ struct ieee80211_conf {
int beacon_int;
u32 flags;
int power_level, dynamic_ps_timeout;
int max_sleep_interval;
u16 listen_interval;
bool radio_enabled;
@@ -1109,11 +1119,9 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
* need software support for parsing the TIM bitmap. This is also supported
* by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
* %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
* required to pass up beacons. Additionally, in this case, mac80211 will
* wake up the hardware when multicast traffic is announced in the beacon.
*
* FIXME: I don't think we can be fast enough in software when we want to
* receive multicast traffic?
* required to pass up beacons. The hardware is still required to handle
* waking up for multicast traffic; if it cannot the driver must handle that
* as best as it can, mac80211 is too slow.
*
* Dynamic powersave mode is an extension to normal powersave mode in which
* the hardware stays awake for a user-specified period of time after sending
@@ -1134,11 +1142,53 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
* way the host will only receive beacons where some relevant information
* (for example ERP protection or WMM settings) have changed.
*
* Beacon filter support is informed with %IEEE80211_HW_BEACON_FILTER flag.
* The driver needs to enable beacon filter support whenever power save is
* enabled, that is %IEEE80211_CONF_PS is set. When power save is enabled,
* the stack will not check for beacon miss at all and the driver needs to
* notify about complete loss of beacons with ieee80211_beacon_loss().
* Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER
* hardware capability. The driver needs to enable beacon filter support
* whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When
* power save is enabled, the stack will not check for beacon loss and the
* driver needs to notify about loss of beacons with ieee80211_beacon_loss().
*
* The time (or number of beacons missed) until the firmware notifies the
* driver of a beacon loss event (which in turn causes the driver to call
* ieee80211_beacon_loss()) should be configurable and will be controlled
* by mac80211 and the roaming algorithm in the future.
*
* Since there may be constantly changing information elements that nothing
* in the software stack cares about, we will, in the future, have mac80211
* tell the driver which information elements are interesting in the sense
* that we want to see changes in them. This will include
* - a list of information element IDs
* - a list of OUIs for the vendor information element
*
* Ideally, the hardware would filter out any beacons without changes in the
* requested elements, but if it cannot support that it may, at the expense
* of some efficiency, filter out only a subset. For example, if the device
* doesn't support checking for OUIs it should pass up all changes in all
* vendor information elements.
*
* Note that change, for the sake of simplification, also includes information
* elements appearing or disappearing from the beacon.
*
* Some hardware supports an "ignore list" instead, just make sure nothing
* that was requested is on the ignore list, and include commonly changing
* information element IDs in the ignore list, for example 11 (BSS load) and
* the various vendor-assigned IEs with unknown contents (128, 129, 133-136,
* 149, 150, 155, 156, 173, 176, 178, 179, 219); for forward compatibility
* it could also include some currently unused IDs.
*
*
* In addition to these capabilities, hardware should support notifying the
* host of changes in the beacon RSSI. This is relevant to implement roaming
* when no traffic is flowing (when traffic is flowing we see the RSSI of
* the received data packets). This can consist in notifying the host when
* the RSSI changes significantly or when it drops below or rises above
* configurable thresholds. In the future these thresholds will also be
* configured by mac80211 (which gets them from userspace) to implement
* them as the roaming algorithm requires.
*
* If the hardware cannot implement this, the driver should ask it to
* periodically pass beacon frames to the host so that software can do the
* signal strength threshold checking.
*/
/**
@@ -1330,11 +1380,14 @@ enum ieee80211_ampdu_mlme_action {
* the scan state machine in stack. The scan must honour the channel
* configuration done by the regulatory agent in the wiphy's
* registered bands. The hardware (or the driver) needs to make sure
* that power save is disabled. When the scan finishes,
* ieee80211_scan_completed() must be called; note that it also must
* be called when the scan cannot finish because the hardware is
* turned off! Anything else is a bug! Returns a negative error code
* which will be seen in userspace.
* that power save is disabled.
* The @req ie/ie_len members are rewritten by mac80211 to contain the
* entire IEs after the SSID, so that drivers need not look at these
* at all but just send them after the SSID -- mac80211 includes the
* (extended) supported rates and HT information (where applicable).
* When the scan finishes, ieee80211_scan_completed() must be called;
* note that it also must be called when the scan cannot finish due to
* any error unless this callback returned a negative error code.
*
* @sw_scan_start: Notifier function that is called just before a software scan
* is started. Can be NULL, if the driver doesn't need this notification.
@@ -1572,6 +1625,20 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw);
*/
void ieee80211_free_hw(struct ieee80211_hw *hw);
/**
* ieee80211_restart_hw - restart hardware completely
*
* Call this function when the hardware was restarted for some reason
* (hardware error, ...) and the driver is unable to restore its state
* by itself. mac80211 assumes that at this point the driver/hardware
* is completely uninitialised and stopped, it starts the process by
* calling the ->start() operation. The driver will need to reset all
* internal state that it has prior to calling this function.
*
* @hw: the hardware to restart
*/
void ieee80211_restart_hw(struct ieee80211_hw *hw);
/* trick to avoid symbol clashes with the ieee80211 subsystem */
void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
struct ieee80211_rx_status *status);

101
include/net/regulatory.h Normal file
Melihat File

@@ -0,0 +1,101 @@
#ifndef __NET_REGULATORY_H
#define __NET_REGULATORY_H
/*
* regulatory support structures
*
* Copyright 2008-2009 Luis R. Rodriguez <lrodriguez@atheros.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/**
* enum environment_cap - Environment parsed from country IE
* @ENVIRON_ANY: indicates country IE applies to both indoor and
* outdoor operation.
* @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
* @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
*/
enum environment_cap {
ENVIRON_ANY,
ENVIRON_INDOOR,
ENVIRON_OUTDOOR,
};
/**
* struct regulatory_request - used to keep track of regulatory requests
*
* @wiphy_idx: this is set if this request's initiator is
* %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
* can be used by the wireless core to deal with conflicts
* and potentially inform users of which devices specifically
* cased the conflicts.
* @initiator: indicates who sent this request, could be any of
* of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
* @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
* regulatory domain. We have a few special codes:
* 00 - World regulatory domain
* 99 - built by driver but a specific alpha2 cannot be determined
* 98 - result of an intersection between two regulatory domains
* @intersect: indicates whether the wireless core should intersect
* the requested regulatory domain with the presently set regulatory
* domain.
* @country_ie_checksum: checksum of the last processed and accepted
* country IE
* @country_ie_env: lets us know if the AP is telling us we are outdoor,
* indoor, or if it doesn't matter
* @list: used to insert into the reg_requests_list linked list
*/
struct regulatory_request {
int wiphy_idx;
enum nl80211_reg_initiator initiator;
char alpha2[2];
bool intersect;
u32 country_ie_checksum;
enum environment_cap country_ie_env;
struct list_head list;
};
struct ieee80211_freq_range {
u32 start_freq_khz;
u32 end_freq_khz;
u32 max_bandwidth_khz;
};
struct ieee80211_power_rule {
u32 max_antenna_gain;
u32 max_eirp;
};
struct ieee80211_reg_rule {
struct ieee80211_freq_range freq_range;
struct ieee80211_power_rule power_rule;
u32 flags;
};
struct ieee80211_regdomain {
u32 n_reg_rules;
char alpha2[2];
struct ieee80211_reg_rule reg_rules[];
};
#define MHZ_TO_KHZ(freq) ((freq) * 1000)
#define KHZ_TO_MHZ(freq) ((freq) / 1000)
#define DBI_TO_MBI(gain) ((gain) * 100)
#define MBI_TO_DBI(gain) ((gain) / 100)
#define DBM_TO_MBM(gain) ((gain) * 100)
#define MBM_TO_DBM(gain) ((gain) / 100)
#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
{ \
.freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
.freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
.freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
.power_rule.max_antenna_gain = DBI_TO_MBI(gain),\
.power_rule.max_eirp = DBM_TO_MBM(eirp), \
.flags = reg_flags, \
}
#endif

Melihat File

@@ -1,472 +0,0 @@
#ifndef __NET_WIRELESS_H
#define __NET_WIRELESS_H
/*
* 802.11 device management
*
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
*/
#include <linux/netdevice.h>
#include <linux/debugfs.h>
#include <linux/list.h>
#include <linux/ieee80211.h>
#include <net/cfg80211.h>
/**
* enum ieee80211_band - supported frequency bands
*
* The bands are assigned this way because the supported
* bitrates differ in these bands.
*
* @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
* @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
*/
enum ieee80211_band {
IEEE80211_BAND_2GHZ,
IEEE80211_BAND_5GHZ,
/* keep last */
IEEE80211_NUM_BANDS
};
/**
* enum ieee80211_channel_flags - channel flags
*
* Channel flags set by the regulatory control code.
*
* @IEEE80211_CHAN_DISABLED: This channel is disabled.
* @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
* on this channel.
* @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
* @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
* @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel
* is not permitted.
* @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel
* is not permitted.
*/
enum ieee80211_channel_flags {
IEEE80211_CHAN_DISABLED = 1<<0,
IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
IEEE80211_CHAN_NO_IBSS = 1<<2,
IEEE80211_CHAN_RADAR = 1<<3,
IEEE80211_CHAN_NO_FAT_ABOVE = 1<<4,
IEEE80211_CHAN_NO_FAT_BELOW = 1<<5,
};
/**
* struct ieee80211_channel - channel definition
*
* This structure describes a single channel for use
* with cfg80211.
*
* @center_freq: center frequency in MHz
* @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
* @hw_value: hardware-specific value for the channel
* @flags: channel flags from &enum ieee80211_channel_flags.
* @orig_flags: channel flags at registration time, used by regulatory
* code to support devices with additional restrictions
* @band: band this channel belongs to.
* @max_antenna_gain: maximum antenna gain in dBi
* @max_power: maximum transmission power (in dBm)
* @beacon_found: helper to regulatory code to indicate when a beacon
* has been found on this channel. Use regulatory_hint_found_beacon()
* to enable this, this is is useful only on 5 GHz band.
* @orig_mag: internal use
* @orig_mpwr: internal use
*/
struct ieee80211_channel {
enum ieee80211_band band;
u16 center_freq;
u8 max_bandwidth;
u16 hw_value;
u32 flags;
int max_antenna_gain;
int max_power;
bool beacon_found;
u32 orig_flags;
int orig_mag, orig_mpwr;
};
/**
* enum ieee80211_rate_flags - rate flags
*
* Hardware/specification flags for rates. These are structured
* in a way that allows using the same bitrate structure for
* different bands/PHY modes.
*
* @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
* preamble on this bitrate; only relevant in 2.4GHz band and
* with CCK rates.
* @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
* when used with 802.11a (on the 5 GHz band); filled by the
* core code when registering the wiphy.
* @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
* when used with 802.11b (on the 2.4 GHz band); filled by the
* core code when registering the wiphy.
* @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
* when used with 802.11g (on the 2.4 GHz band); filled by the
* core code when registering the wiphy.
* @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
*/
enum ieee80211_rate_flags {
IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
IEEE80211_RATE_MANDATORY_A = 1<<1,
IEEE80211_RATE_MANDATORY_B = 1<<2,
IEEE80211_RATE_MANDATORY_G = 1<<3,
IEEE80211_RATE_ERP_G = 1<<4,
};
/**
* struct ieee80211_rate - bitrate definition
*
* This structure describes a bitrate that an 802.11 PHY can
* operate with. The two values @hw_value and @hw_value_short
* are only for driver use when pointers to this structure are
* passed around.
*
* @flags: rate-specific flags
* @bitrate: bitrate in units of 100 Kbps
* @hw_value: driver/hardware value for this rate
* @hw_value_short: driver/hardware value for this rate when
* short preamble is used
*/
struct ieee80211_rate {
u32 flags;
u16 bitrate;
u16 hw_value, hw_value_short;
};
/**
* struct ieee80211_sta_ht_cap - STA's HT capabilities
*
* This structure describes most essential parameters needed
* to describe 802.11n HT capabilities for an STA.
*
* @ht_supported: is HT supported by the STA
* @cap: HT capabilities map as described in 802.11n spec
* @ampdu_factor: Maximum A-MPDU length factor
* @ampdu_density: Minimum A-MPDU spacing
* @mcs: Supported MCS rates
*/
struct ieee80211_sta_ht_cap {
u16 cap; /* use IEEE80211_HT_CAP_ */
bool ht_supported;
u8 ampdu_factor;
u8 ampdu_density;
struct ieee80211_mcs_info mcs;
};
/**
* struct ieee80211_supported_band - frequency band definition
*
* This structure describes a frequency band a wiphy
* is able to operate in.
*
* @channels: Array of channels the hardware can operate in
* in this band.
* @band: the band this structure represents
* @n_channels: Number of channels in @channels
* @bitrates: Array of bitrates the hardware can operate with
* in this band. Must be sorted to give a valid "supported
* rates" IE, i.e. CCK rates first, then OFDM.
* @n_bitrates: Number of bitrates in @bitrates
*/
struct ieee80211_supported_band {
struct ieee80211_channel *channels;
struct ieee80211_rate *bitrates;
enum ieee80211_band band;
int n_channels;
int n_bitrates;
struct ieee80211_sta_ht_cap ht_cap;
};
/**
* struct wiphy - wireless hardware description
* @idx: the wiphy index assigned to this item
* @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
* @custom_regulatory: tells us the driver for this device
* has its own custom regulatory domain and cannot identify the
* ISO / IEC 3166 alpha2 it belongs to. When this is enabled
* we will disregard the first regulatory hint (when the
* initiator is %REGDOM_SET_BY_CORE).
* @strict_regulatory: tells us the driver for this device will ignore
* regulatory domain settings until it gets its own regulatory domain
* via its regulatory_hint(). After its gets its own regulatory domain
* it will only allow further regulatory domain settings to further
* enhance compliance. For example if channel 13 and 14 are disabled
* by this regulatory domain no user regulatory domain can enable these
* channels at a later time. This can be used for devices which do not
* have calibration information gauranteed for frequencies or settings
* outside of its regulatory domain.
* @reg_notifier: the driver's regulatory notification callback
* @regd: the driver's regulatory domain, if one was requested via
* the regulatory_hint() API. This can be used by the driver
* on the reg_notifier() if it chooses to ignore future
* regulatory domain changes caused by other drivers.
* @signal_type: signal type reported in &struct cfg80211_bss.
*/
struct wiphy {
/* assign these fields before you register the wiphy */
/* permanent MAC address */
u8 perm_addr[ETH_ALEN];
/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
u16 interface_modes;
bool custom_regulatory;
bool strict_regulatory;
enum cfg80211_signal_type signal_type;
int bss_priv_size;
u8 max_scan_ssids;
/* If multiple wiphys are registered and you're handed e.g.
* a regular netdev with assigned ieee80211_ptr, you won't
* know whether it points to a wiphy your driver has registered
* or not. Assign this to something global to your driver to
* help determine whether you own this wiphy or not. */
void *privid;
struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
/* Lets us get back the wiphy on the callback */
int (*reg_notifier)(struct wiphy *wiphy,
struct regulatory_request *request);
/* fields below are read-only, assigned by cfg80211 */
const struct ieee80211_regdomain *regd;
/* the item in /sys/class/ieee80211/ points to this,
* you need use set_wiphy_dev() (see below) */
struct device dev;
/* dir in debugfs: ieee80211/<wiphyname> */
struct dentry *debugfsdir;
char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
};
/** struct wireless_dev - wireless per-netdev state
*
* This structure must be allocated by the driver/stack
* that uses the ieee80211_ptr field in struct net_device
* (this is intentional so it can be allocated along with
* the netdev.)
*
* @wiphy: pointer to hardware description
* @iftype: interface type
*/
struct wireless_dev {
struct wiphy *wiphy;
enum nl80211_iftype iftype;
/* private to the generic wireless code */
struct list_head list;
struct net_device *netdev;
};
/**
* wiphy_priv - return priv from wiphy
*/
static inline void *wiphy_priv(struct wiphy *wiphy)
{
BUG_ON(!wiphy);
return &wiphy->priv;
}
/**
* set_wiphy_dev - set device pointer for wiphy
*/
static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
{
wiphy->dev.parent = dev;
}
/**
* wiphy_dev - get wiphy dev pointer
*/
static inline struct device *wiphy_dev(struct wiphy *wiphy)
{
return wiphy->dev.parent;
}
/**
* wiphy_name - get wiphy name
*/
static inline const char *wiphy_name(struct wiphy *wiphy)
{
return dev_name(&wiphy->dev);
}
/**
* wdev_priv - return wiphy priv from wireless_dev
*/
static inline void *wdev_priv(struct wireless_dev *wdev)
{
BUG_ON(!wdev);
return wiphy_priv(wdev->wiphy);
}
/**
* wiphy_new - create a new wiphy for use with cfg80211
*
* create a new wiphy and associate the given operations with it.
* @sizeof_priv bytes are allocated for private use.
*
* the returned pointer must be assigned to each netdev's
* ieee80211_ptr for proper operation.
*/
struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);
/**
* wiphy_register - register a wiphy with cfg80211
*
* register the given wiphy
*
* Returns a non-negative wiphy index or a negative error code.
*/
extern int wiphy_register(struct wiphy *wiphy);
/**
* wiphy_unregister - deregister a wiphy from cfg80211
*
* unregister a device with the given priv pointer.
* After this call, no more requests can be made with this priv
* pointer, but the call may sleep to wait for an outstanding
* request that is being handled.
*/
extern void wiphy_unregister(struct wiphy *wiphy);
/**
* wiphy_free - free wiphy
*/
extern void wiphy_free(struct wiphy *wiphy);
/**
* ieee80211_channel_to_frequency - convert channel number to frequency
*/
extern int ieee80211_channel_to_frequency(int chan);
/**
* ieee80211_frequency_to_channel - convert frequency to channel number
*/
extern int ieee80211_frequency_to_channel(int freq);
/*
* Name indirection necessary because the ieee80211 code also has
* a function named "ieee80211_get_channel", so if you include
* cfg80211's header file you get cfg80211's version, if you try
* to include both header files you'll (rightfully!) get a symbol
* clash.
*/
extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
int freq);
/**
* ieee80211_get_channel - get channel struct from wiphy for specified frequency
*/
static inline struct ieee80211_channel *
ieee80211_get_channel(struct wiphy *wiphy, int freq)
{
return __ieee80211_get_channel(wiphy, freq);
}
/**
* ieee80211_get_response_rate - get basic rate for a given rate
*
* @sband: the band to look for rates in
* @basic_rates: bitmap of basic rates
* @bitrate: the bitrate for which to find the basic rate
*
* This function returns the basic rate corresponding to a given
* bitrate, that is the next lower bitrate contained in the basic
* rate map, which is, for this function, given as a bitmap of
* indices of rates in the band's bitrate table.
*/
struct ieee80211_rate *
ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
u32 basic_rates, int bitrate);
/**
* regulatory_hint - driver hint to the wireless core a regulatory domain
* @wiphy: the wireless device giving the hint (used only for reporting
* conflicts)
* @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
* should be in. If @rd is set this should be NULL. Note that if you
* set this to NULL you should still set rd->alpha2 to some accepted
* alpha2.
*
* Wireless drivers can use this function to hint to the wireless core
* what it believes should be the current regulatory domain by
* giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
* domain should be in or by providing a completely build regulatory domain.
* If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
* for a regulatory domain structure for the respective country.
*
* The wiphy must have been registered to cfg80211 prior to this call.
* For cfg80211 drivers this means you must first use wiphy_register(),
* for mac80211 drivers you must first use ieee80211_register_hw().
*
* Drivers should check the return value, its possible you can get
* an -ENOMEM.
*/
extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
/**
* regulatory_hint_11d - hints a country IE as a regulatory domain
* @wiphy: the wireless device giving the hint (used only for reporting
* conflicts)
* @country_ie: pointer to the country IE
* @country_ie_len: length of the country IE
*
* We will intersect the rd with the what CRDA tells us should apply
* for the alpha2 this country IE belongs to, this prevents APs from
* sending us incorrect or outdated information against a country.
*/
extern void regulatory_hint_11d(struct wiphy *wiphy,
u8 *country_ie,
u8 country_ie_len);
/**
* wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
* @wiphy: the wireless device we want to process the regulatory domain on
* @regd: the custom regulatory domain to use for this wiphy
*
* Drivers can sometimes have custom regulatory domains which do not apply
* to a specific country. Drivers can use this to apply such custom regulatory
* domains. This routine must be called prior to wiphy registration. The
* custom regulatory domain will be trusted completely and as such previous
* default channel settings will be disregarded. If no rule is found for a
* channel on the regulatory domain the channel will be disabled.
*/
extern void wiphy_apply_custom_regulatory(
struct wiphy *wiphy,
const struct ieee80211_regdomain *regd);
/**
* freq_reg_info - get regulatory information for the given frequency
* @wiphy: the wiphy for which we want to process this rule for
* @center_freq: Frequency in KHz for which we want regulatory information for
* @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
* you can set this to 0. If this frequency is allowed we then set
* this value to the maximum allowed bandwidth.
* @reg_rule: the regulatory rule which we have for this frequency
*
* Use this function to get the regulatory rule for a specific frequency on
* a given wireless device. If the device has a specific regulatory domain
* it wants to follow we respect that unless a country IE has been received
* and processed already.
*
* Returns 0 if it was able to find a valid regulatory rule which does
* apply to the given center_freq otherwise it returns non-zero. It will
* also return -ERANGE if we determine the given center_freq does not even have
* a regulatory rule for a frequency range in the center_freq's band. See
* freq_in_rule_band() for our current definition of a band -- this is purely
* subjective and right now its 802.11 specific.
*/
extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
const struct ieee80211_reg_rule **reg_rule);
#endif /* __NET_WIRELESS_H */