/*
* mac80211 <-> driver interface
*
* Copyright 2002-2005, Devicescape Software, Inc.
* Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
*
* 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.
*/
#ifndef MAC80211_H
#define MAC80211_H
#include <linux/kernel.h>
#include <linux/if_ether.h>
#include <linux/skbuff.h>
#include <linux/wireless.h>
#include <linux/device.h>
#include <linux/ieee80211.h>
#include <net/wireless.h>
#include <net/cfg80211.h>
/* Note! Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be
* called in hardware interrupt context. The low-level driver must not call any
* other functions in hardware interrupt context. If there is a need for such
* call, the low-level driver should first ACK the interrupt and perform the
* IEEE 802.11 code call after this, e.g., from a scheduled tasklet (in
* software interrupt context).
*/
/*
* Frame format used when passing frame between low-level hardware drivers
* and IEEE 802.11 driver the same as used in the wireless media, i.e.,
* buffers start with IEEE 802.11 header and include the same octets that
* are sent over air.
*
* If hardware uses IEEE 802.3 headers (and perform 802.3 <-> 802.11
* conversion in firmware), upper layer 802.11 code needs to be changed to
* support this.
*
* If the receive frame format is not the same as the real frame sent
* on the wireless media (e.g., due to padding etc.), upper layer 802.11 code
* could be updated to provide support for such format assuming this would
* optimize the performance, e.g., by removing need to re-allocation and
* copying of the data.
*/
#define IEEE80211_CHAN_W_SCAN 0x00000001
#define IEEE80211_CHAN_W_ACTIVE_SCAN 0x00000002
#define IEEE80211_CHAN_W_IBSS 0x00000004
/* Channel information structure. Low-level driver is expected to fill in chan,
* freq, and val fields. Other fields will be filled in by 80211.o based on
* hostapd information and low-level driver does not need to use them. The
* limits for each channel will be provided in 'struct ieee80211_conf' when
* configuring the low-level driver with hw->config callback. If a device has
* a default regulatory domain, IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED
* can be set to let the driver configure all fields */
struct ieee80211_channel {
short chan; /* channel number (IEEE 802.11) */
short freq; /* frequency in MHz */
int val; /* hw specific value for the channel */
int flag; /* flag for hostapd use (IEEE80211_CHAN_*) */
unsigned char power_level;
unsigned char antenna_max;
};
#define IEEE80211_RATE_ERP 0x00000001
#define IEEE80211_RATE_BASIC 0x00000002
#define IEEE80211_RATE_PREAMBLE2 0x00000004
#define IEEE80211_RATE_SUPPORTED 0x00000010
#define IEEE80211_RATE_OFDM 0x00000020
#define IEEE80211_RATE_CCK 0x00000040
#define IEEE80211_RATE_MANDATORY 0x00000100
#define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2)
#define IEEE80211_RATE_MODULATION(f) \
(f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM))
/* Low-level driver should set PREAMBLE2, OFDM and CCK flags.
* BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the
* configuration. */
struct ieee80211_rate {
int rate; /* rate in 100 kbps */
int val; /* hw specific value for the rate */
int flags; /* IEEE80211_RATE_ flags */
int val2; /* hw specific value for the rate when using short preamble
* (only when IEEE80211_RATE_PREAMBLE2 flag is set, i.e., for
* 2, 5.5, and 11 Mbps) */
signed char min_rssi_ack;
unsigned char min_rssi_ack_delta;
/* following fields are set by 80211.o and need not be filled by the
* low-level driver */
int rate_inv; /* inverse of the rate (LCM(all rates) / rate) for
* optimizing channel utilization estimates */
};
/**
* enum ieee80211_phymode - PHY modes
*
* @MODE_IEEE80211A: 5GHz as defined by 802.11a/802.11h
* @MODE_IEEE80211B: 2.4 GHz as defined by 802.11b
* @MODE_IEEE80211G: 2.4 GHz as defined by 802.11g (with OFDM),
* backwards compatible with 11b mode
* @NUM_IEEE80211_MODES: internal
*/
enum ieee80211_phymode {
MODE_IEEE80211A,
MODE_IEEE80211B,
MODE_IEEE80211G,
/* keep last */
NUM_IEEE80211_MODES
};
/**
* struct ieee80211_hw_mode - PHY mode definition
*
* This structure describes the capabilities supported by the device
* in a single PHY mode.
*
* @mode: the PHY mode for this definition
* @num_channels: number of supported channels
* @channels: pointer to array of supported channels
* @num_rates: number of supported bitrates
* @rates: pointer to array of supported bitrates
* @list: internal
*/
struct ieee80211_hw_mode {
struct list_head list;
struct ieee80211_channel *channels;
struct ieee80211_rate *rates;
enum ieee80211_phymode mode;
int num_channels;
int num_rates;
};
/**
* struct ieee80211_tx_queue_params - transmit queue configuration
*
* The information provided in this structure is required for QoS
* transmit queue configuration.
*
* @aifs: arbitration interface space [0..255, -1: use default]
* @cw_min: minimum contention window [will be a value of the form
* 2^n-1 in the range 1..1023; 0: use default]
* @cw_max: maximum contention window [like @cw_min]
* @burst_time: maximum burst time in units of 0.1ms, 0 meaning disabled
*/
struct ieee80211_tx_queue_params {
int aifs;
int cw_min;
int cw_max;
int burst_time;
};
/**
* struct ieee80211_tx_queue_stats_data - transmit queue statistics
*
* @len: number of packets in queue
* @limit: queue length limit
* @count: number of frames sent
*/
struct ieee80211_tx_queue_stats_data {
unsigned int len;
unsigned int limit;