📄 wlc.h
字号:
/* * Common (OS-independent) definitions for * Broadcom 802.11abg Networking Device Driver * * Copyright 2005-2006, Broadcom Corporation * All Rights Reserved. * * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. * $Id$ */#ifndef _wlc_h_#define _wlc_h_#include <wl_dbg.h>#include <wlioctl.h>/* forward declare */typedef struct wlc_info wlc_info_t;typedef struct phy_pub wlc_phy_t;typedef struct led_info led_info_t;typedef struct apps_wlc_psinfo apps_wlc_psinfo_t;typedef struct scb_module scb_module_t;typedef struct wlc_frminfo wlc_frminfo_t;#define RXBUFSZ PKTBUFSZ #define MAXJOINPREFS 4 /* max # user-supplied join prefs */#define MAXWPACFGS 16 /* max # wpa configs */#define WLC_MAXBSSCFG 1 /* max # BSS configs */#define MAXMACLIST MAXSCB /* max # source MAC matches */#define MA_WINDOW_SZ 8 /* moving average window size */#define HWRXOFF 30 /* chip rx buffer offset */#define INVCHANNEL 255 /* invalid channel */#define MAXCOREREV 12 /* max # supported core revisions (0 .. MAXCOREREV - 1) */#define NSCBHASH (MAXSCB/8) /* # scb hash buckets */#define AIDMAPSZ (ROUNDUP(MAXSCB, NBBY)/NBBY) /* aid bitmap size in bytes */#define NTXRATE 64 /* # tx MPDUs rate is reported for */#define WLC_MAXFRAG 16 /* max fragments per SDU */#define WLC_WEP_IV_SIZE 4 /* size of WEP1 and WEP128 IV */#define WLC_WEP_ICV_SIZE 4 /* size of WEP ICV */#define WLC_BCN_TIMEOUT 8 /* seconds w/o bcns until loss of connection */#define WLC_FREQTRACK_THRESHOLD 5 /* seconds w/o beacons before we increase the * frequency tracking bandwidth */#define WLC_FREQTRACK_DETECT_TIME 2 /* seconds in which we must detect * beacons after setting the wide * bandwidth */#define WLC_FREQTRACK_MIN_ATTEMPTS 3 /* minimum number of times we should * try to get beacons using the wide freq * tracking b/w */#define WLC_FREQTRACK_TIMEOUT 30 /* give up on wideband frequency tracking after * 30 seconds */#define WLC_MAX_TBTT_OFFSET 20 /* maximum tolerable offset of beacon TS from TBTT in ms */#define WECA_ASSOC_TIMEOUT 300 /* authentication or association timeout in ms */#define WLC_MAXMODULES 10 /* max # wlc_module_register() calls *//* freqtrack_override values */typedef enum _freqtrack_override_t { FREQTRACK_AUTO = 0, FREQTRACK_ON, FREQTRACK_OFF}freqtrack_override_t;#define NUM_UCODE_FRAMES 4 /* Num ucode frames for TSSI estimation */#define MAXCORES 2 /* Maximum cores for rst array */#define MAXBANDS 2 /* Maximum #of bands */#define WLC_CHANNEL_QA_NSAMP 2 /* size of channel_qa_sample array */#define WLC_RM_RPI_INTERVAL 20 /* ms, time between RPI/Noise samples */#define WLC_RATEPROBE_RATE (6 * 2) /* 6Mbps ofdm rateprobe rate *//* Maximum wait time for a MAC suspend */#define WLC_MAX_MAC_SUSPEND 35000 /* uS: 35mS is max packet time (for largest MTU pkt) *//* Probe Response timeout - responses for probe requests older that this are tossed, zero to disable */#define WLC_PRB_RESP_TIMEOUT 0 /* Disable probe repsonse timeout */#define WLC_VLAN_TAG_LEN 4 /* Duplicated to avoid including <proto/vlan.h> *//* transmit buffer max headroom for protocol headers */#define TXOFF (D11_TXH_LEN + D11_PHY_HDR_LEN + DOT11_A4_HDR_LEN + DOT11_QOS_LEN + \ DOT11_IV_MAX_LEN + DOT11_LLC_SNAP_HDR_LEN + WLC_VLAN_TAG_LEN)struct wlcband; /* forward declaration *//* For managing scan result lists */typedef struct { uint count; wlc_bss_info_t* ptrs[MAXBSS];} wlc_bss_list_t;/* wlc_bss_info flag bit values */#define WLC_BSS_54G 0x01 /* BSS is a legacy 54g BSS */#define WLC_BSS_RSSI_ON_CHANNEL 0x02 /* RSSI measurement was from the same channel as BSS */#define WLC_BSS_WME 0x04 /* BSS is WME capable */#define WLC_BSS_BRCM 0x08 /* BSS is BRCM */#define WLC_BSS_WPA 0x10 /* BSS is WPA capable *//* pkt type used to indicate a roaming STA */#define ROAM_PKT_TYPE 0x806 /* currently arp */#define ARP_CMD_OFF 6 /* Unused */#define ARP_RESP 2 /* Unused *//* wlc_BSSinit actions */#define WLC_BSS_JOIN 0 /* join action */#define WLC_BSS_START 1 /* start action *//* scan times in milliseconds */#define WLC_SCAN_MIN_PROBE_TIME 10 /* minimum useful time for an active probe */#define WLC_SCAN_HOME_TIME 45 /* time for home channel processing */#define WLC_SCAN_ASSOC_TIME 20 /* time to listen on a channel for probe resp while associated */#define WLC_SCAN_UNASSOC_TIME 40 /* time to listen on a channel for probe resp while unassociated */#define WLC_SCAN_PASSIVE_TIME 110 /* time to listen on a channel for beacons for passive scanning */#define WLC_SCAN_NPROBES 2 /* do this many probes on each channel for an active scan */#define WLC_SCAN_AWAY_LIMIT 100 /* max time to be away from home channel before returning */#define WLC_SCAN_PS_PREP_TIME 10 /* average time to announce PS mode */#define WLC_SCAN_PS_OVERHEAD 50 /* overhead time to allow for one long PS announce delay */#define WLC_STA_RETRY_MAX_TIME 3600 /* maximum config value for sta_retry_time (1 hour) *//* scan_pass state values */#define WLC_SCAN_ABORT -2 /* Abort the scan */#define WLC_SCAN_START -1 /* Start the scan */#define WLC_SCAN_CHANNEL_PREP 0 /* Prepare the channel for the scan *//* scan state bits */#define SCAN_STATE_SUPPRESS (1 << 0)#define SCAN_STATE_SAVE_PRB (1 << 1)#define SCAN_STATE_PASSIVE (1 << 2)#define SCAN_STATE_WSUSPEND (1 << 3)#define SCAN_STATE_RADAR_CLEAR (1 << 4)#define SCAN_STATE_PSPEND (1 << 5)#define SCAN_STATE_SUSPEND_REQ (1 << 6)#define WLC_2050_ROAM_TRIGGER (-70) /* Roam Trigger for 2050 */#define WLC_2050_ROAM_DELTA (20) /* Roam Delta for 2050 */#define WLC_2050_ENCORE_ROAM_TRIGGER (-75) /* Roam Trigger for 2050-51 radio with encore chip */#define WLC_2051_ROAM_TRIGGER (-70) /* Roam Trigger for 2051 */#define WLC_2051_ROAM_DELTA (20) /* Roam Delta for 2051 */#define WLC_2053_ROAM_TRIGGER (-60) /* Roam Trigger for 2053 */#define WLC_2053_ROAM_DELTA (15) /* Roam Delta for 2053 */#define WLC_2060WW_ROAM_TRIGGER (-75) /* Roam Trigger for 2060ww */#define WLC_2060WW_ROAM_DELTA (15) /* Roam Delta for 2060ww */#define WLC_ROAM_SCAN_PERIOD (10) /* Scan period for roaming *//* Count of packet callback structures. Set to the number of SCBs since a STA * can queue up a rate callback for each IBSS STA it knows about, and an AP can * queue up an "are you there?" Null Data callback for each associated STA */#define MAX_PKT_CB MAXSCB/* Rx Antenna diversity control values */#define ANTDIV_FORCE_0 0 /* Use antenna 0 */#define ANTDIV_FORCE_1 1 /* Use antenna 1 */#define ANTDIV_START_1 2 /* Choose starting with 1 */#define ANTDIV_START_0 3 /* Choose starting with 0 */#define ANTDIV_ENABLE 3 /* APHY bbConfig Enable RX Diversity *//* Tx Antenna control values */#define TXANT_0 0 /* Tx on antenna 1, "Main" */#define TXANT_1 1 /* Tx on antenna 1, "Aux" */#define TXANT_LAST_RX 3 /* Tx on phy's last good Rx antenna */#define TXANT_DEF 3 /* driver's default tx antenna setting */#define WLC_MIN_CNTRY_ELT_SZ 6 /* Min size for 802.11d Country Info Element. */#if CONF_MSK(D11CONF, 0xb) || CONF_GE(D11CONF, MAXCOREREV)#error "Configuration for D11CONF includes unsupported versions."#endif /* Bad versions */#define VALID_COREREV(corerev) CONF_HAS(D11CONF, corerev)/* values for shortslot_override */#define WLC_SHORTSLOT_AUTO -1 /* Driver will manage Shortslot setting */#define WLC_SHORTSLOT_OFF 0 /* Turn off short slot */#define WLC_SHORTSLOT_ON 1 /* Turn on short slot *//* values for barker_preamble */#define WLC_BARKER_SHORT_ALLOWED 0 /* Short pre-amble allowed */#define WLC_BARKER_LONG_ONLY 1 /* No short pre-amble allowed */#define WLC_IBSS_BCN_TIMEOUT 4 /* Timeout to indicate that various types of IBSS beacons have * gone away */#define EHINIT(eh, src, dst, type) \ bcopy((uchar*)dst, (eh)->ether_dhost, ETHER_ADDR_LEN); \ bcopy((uchar*)src, (eh)->ether_shost, ETHER_ADDR_LEN); \ (eh)->ether_type = hton16(type);/* assoc_state values */#define AS_IDLE 0 /* Idle state */#define AS_SCAN 1 /* Scan state */#define AS_SENT_AUTH_1 2 /* Sent Authentication 1 state */#define AS_SENT_AUTH_2 3 /* Sent Authentication 2 state */#define AS_SENT_AUTH_3 4 /* Sent Authentication 3 state */#define AS_SENT_ASSOC 5 /* Sent Association state */#define AS_WAIT_RCV_BCN 6 /* Waiting to receive beacon state */#define AS_SYNC_RCV_BCN 7 /* Waiting Re-sync beacon state */#define AS_WAIT_DISASSOC 8 /* Waiting to disassociate state *//* assoc_type values */#define AS_ASSOCIATION 1 /* Associated */#define AS_ROAM 2 /* Roaming association *//* A fifo is full. Clear precedences related to that FIFO */#define WLC_TX_FIFO_CLEAR(wlc, fifo) ((wlc)->tx_prec_map &= ~(wlc)->fifo2prec_map[fifo])/* Fifo is NOT full. Enable precedences for that FIFO */#define WLC_TX_FIFO_ENAB(wlc, fifo) ((wlc)->tx_prec_map |= (wlc)->fifo2prec_map[fifo])/* TxFrameID *//* seq and frag bits: SEQNUM_SHIFT, FRAGNUM_MASK (802.11.h) *//* rate epoch bits: TXFID_RATE_SHIFT, TXFID_RATE_MASK ((wlc_rate.c) */#define TXFID_QUEUE_MASK 0x0007 /* Bits 0-2 */#define TXFID_SEQ_MASK 0xFFE0 /* Bits 5-15 */#define TXFID_SEQ_SHIFT 5 /* Number of bit shifts *//* promote boardrev */#define BOARDREV_PROMOTABLE 0xFF /* from */#define BOARDREV_PROMOTED 1 /* to *//* power-save mode definitions */#define PSQ_PKTS_BCMC 50 /* max # of enq'd PS bc/mc pkts */#define PSQ_PKTS_LO 5 /* max # PS pkts scb can enq */#define PSQ_PKTS_HI 125 /* if wpa is in use then portopen is true when the group key is plumbed otherwise it is always true */#define WLC_PORTOPEN(wlc) ((wlc->cfg.WPA_auth != WPA_AUTH_DISABLED) ? wlc->wsec_portopen : TRUE)/* conditions under which the PM bit should be set in outgoing frames and the WAKE bit is meaningful */#define PS_ALLOWED(wlc) (wlc->PMenabled && !wlc->PM_override && wlc->pub.BSS && \ wlc->pub.associated && WLC_PORTOPEN(wlc) && wlc->dtim_programmed)/* 802.1D Priority to TX FIFO number for wme */extern uint8 wme_prio2fifo[];/* rm request types */#define WLC_RM_TYPE_NONE 0 /* No Radio measurement type */#define WLC_RM_TYPE_BASIC 1 /* Basic Radio measurement type */#define WLC_RM_TYPE_CCA 2 /* CCA Radio measurement type */#define WLC_RM_TYPE_RPI 3 /* RPI Radio measurement type *//* rm request flags */#define WLC_RM_FLAG_PARALLEL (1<<0) /* Flag for setting for Parallel bit */#define WLC_RM_FLAG_LATE (1<<1) /* Flag for LATE bit */#define WLC_RM_FLAG_INCAPABLE (1<<2) /* Flag for Incapable bit */#define WLC_RM_FLAG_REFUSED (1<<3) /* Flag for REFUSED *//* rm report type */#define WLC_RM_CLASS_NONE 0 /* No report */#define WLC_RM_CLASS_IOCTL 1 /* IOCTL type of report */#define WLC_RM_CLASS_11H 2 /* Report for 11H *//* * Detect Card removed. * Even checking an sbconfig register read will not false trigger when the core is in reset. * it breaks CF address mechanism. Accessing gphy phyversion will cause SB error if aphy * is in reset on 4306B0-DB. Need a simple accessible reg with fixed 0/1 pattern * (some platforms return all 0). * If clocks are present, call the sb routine which will figure out if the device is removed. */#define DEVICEREMOVED(wlc) ((wlc->core->clk) ? \ ((R_REG(&wlc->regs->maccontrol) & (MCTL_PSM_JMP_0 | MCTL_IHR_EN)) != MCTL_IHR_EN) : \ (sb_deviceremoved(wlc->pub.sbh)))/* * Multiband 101: * * A "band" is a radio frequency/channel range. * We support the 802.11b band (2.4Ghz) using the B or G phy and the 2050 radio. * We support the 802.11a band (5 Ghz) using the A phy and the 2060 radio. * * Some chips and boards support a single band (uniband) and some * support both B/G and A bands (multiband). * * Versions of the dot11 io core <= 4 support a single phytype/band. * Versions of the dot11 io core >= 5 support multiple phytypes. * The sbtmstatelow.gmode flag is used to switch between phytypes. * * 4306B0 (corerev4) includes two dot11 cores, one with a Gphy and one with an Aphy. * 4306C0 and later chips (>= corerev5) include a single dot11 core having * some combination of A, B, and/or G cores . * The driver multiband design abstracts the core portion * (such as dma engines and pio fifos) from the band portion (phy+radio state). * * For convenience, band 0 is always the B/G phy, and, if it exists, * band 1 is the A phy. *//* * core state (mac) */typedef struct wlccore { uint coreunit; /* # d11 core instance */ uint coreidx; /* # sb enumerated core */ bool clk; /* core is out of reset and has clock */ /* fifo */ hnddma_t *di[NFIFO]; /* hnddma handles, per fifo */ pio_t *pio[NFIFO]; /* pio handlers, per fifo */ uint *txavail[NFIFO]; /* # tx descriptors available */ int8 txpktpend[NFIFO]; /* tx admission control */ uint16 xmtfifo_limit[NFIFO]; /* max tx fifo in 256B for each fifo */ /* gpio */ uint32 gpio_led_outen; /* gpio leds used */ macstat32_t macstat_delta; /* mac hw prev read values */ uint32 tsf_timerlow; /* value at last bandswitch (only if ncores > 1) */} wlccore_t;/* TX Power indexes */#define TXP_FIRST_CCK 0 /* Index for first CCK rate */#define TXP_LAST_CCK 3 /* Index for last CCK rate */#define TXP_FIRST_OFDM 4 /* Index for first OFDM rate */#define TXP_LAST_OFDM 11 /* Index for last OFDM rate */#define TXP_NUM_RATES 12 /* number of rates *//* * band state (phy+ana+radio) */typedef struct wlcband { wlc_phy_t *pi; /* pointer to phy specific information */ int bandtype; /* WLC_BAND_2G, WLC_BAND_5G */ uint bandunit; /* bandstate[] index */ uint8 gmode; /* gmode (see wlioctl.h) */ bool init; /* band has been initialized */ struct scb *bcmc_scb; /* permanent mcast ap-ps scb */ struct scb *hwrs_scb; /* permanent scb for hw rateset */ struct rateset defrateset; /* band-specific copy of default_bss.rateset */ ratespec_t rspec_override; /* 802.11 rate override */ ratespec_t mrspec_override; /* multicast rate override */ bcm_tlv_t* sup_chan_ie; /* Supported Channels Info Elt */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -