📄 wlc_scb.h
字号:
/** * Common interface to the 802.11 Station Control Block (scb) * structure. * This file aims to encapsulating the sbc structure. * 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_scb_h_#define _wlc_scb_h_#include <proto/802.1d.h>#define SCB_BSSCFG_BITSIZE ROUNDUP(WLC_MAXBSSCFG, NBBY)/NBBY/* Information node for scb packet transmit path */struct tx_path_node { txmod_tx_fn_t next_tx_fn; /* Next function to be executed */ void *next_handle; bool configured; /* Whether this feature is configured */};/* station control block - one per remote MAC address */struct scb { uint32 flags; /* various bit flags as defined below */ uint8 state; /* current state bitfield of auth/assoc process */ uint8 auth_bsscfg[SCB_BSSCFG_BITSIZE]; /* authentication state w/ respect to bsscfg(s) */ wsec_key_t *key; /* per station WEP key */ wlc_bsscfg_t *bsscfg; /* bsscfg to which this scb belongs */ bool permanent; /* scb should not be reclaimed */ struct ether_addr ea; /* station address */ uint used; /* time of last use */ uint32 assoctime; /* time of association */ uint bandunit; /* tha band it belongs to */ /* tx header cache */ struct { uint txhlen; /* #bytes txh[] valid, 0=invalid */ uint pktlen; /* tag: original user packet length */ uint fifo; /* fifo for the pkt */ uint8 prio; /* pkt prio */ uint gen; /* generation number (compare to wlc->txcgen) */ uchar txh[TXOFF]; /* cached tx header */ } txc; uint8 WPA_auth; /* WPA: authenticated key management */ struct rateset rateset; /* operational rates for this remote station */ struct rateset select_rateset; /* rate selection preferred rates for this remote station */ void *fragbuf[NUMPRIO]; /* defragmentation buffer per prio */ uint fragresid[NUMPRIO]; /* #bytes unused in frag buffer per prio */ uint8 ratestate[WLC_RATE_STATE_LEN]; /* rate selection stats.must prefix with a */ /* 32-bit field to get word-aligned */ uint16 seqctl[NUMPRIO]; /* seqctl of last received frame (for dups) */ uint16 seqnum[NUMPRIO]; /* WME: driver maintained sw seqnum per priority */ /* APSD configuration */ struct { uint16 maxsplen; /* Maximum Service Period Length from assoc req */ ac_bitmap_t ac_defl; /* Bitmap of ACs enabled for APSD from assoc req */ ac_bitmap_t ac_trig; /* Bitmap of ACs currently trigger-enabled */ ac_bitmap_t ac_delv; /* Bitmap of ACs currently delivery-enabled */ } apsd; uint16 amsdu_mtu_pref; /* preferred AMSDU mtu in bytes */ struct tx_path_node tx_path[SCB_LAST]; /* Function chain for tx path for a pkt */};struct scb_module { struct scb *scb; /* station control block link list */};/* Iterator for scb list */struct scb_iter { struct scb *next;};/* Direct access to the next */struct scb *wlc_scb_getnext(struct scb *scb);/* Initialize an scb iterator pre-fetching the next scb as it moves along the list */void wlc_scb_iterinit(struct scb_iter *scbiter, struct scb *scb);/* move the iterator */struct scb *wlc_scb_iternext(struct scb_iter *scbiter);#define FOREACHSCB(scbiter, scbstart, scb) for (wlc_scb_iterinit((scbiter), (scbstart)), \ scb = scbstart; (scb); \ (scb) = wlc_scb_iternext(scbiter))scb_module_t *wlc_scb_attach(wlc_pub_t *pub);void wlc_scb_detach(scb_module_t *scbstate);/* scb cubby cb functions */typedef void (*scb_cubby_init_t)(void *, struct scb *);typedef void (*scb_cubby_deinit_t)(void *, struct scb *);typedef int (*scb_cubby_dump_t)(void *, struct scb *, char *buf, int size);/* This function allocates an opaque cubby of the requested size in the scb container. * The cb functions fn_init/fn_deinit are called when a scb is allocated/freed. * The functions are called with the context passed in and a scb pointer. * It returns a handle that can be used in macro SCB_CUBBY to retrieve the cubby. * Function returns a negative number on failure */int wlc_scb_cubby_reserve(wlc_info_t *wlc, uint size, scb_cubby_init_t fn_init, scb_cubby_deinit_t fn_deinit, scb_cubby_dump_t fn_fump, void *context);/* macro to retrieve pointer to module specific opaque data in scb container */#define SCB_CUBBY(scb, handle) (void *)(((uint8 *)(scb)) + handle)/* * Accessors */struct wlcband * wlc_scbband(struct scb *scb);#define wlc_scb_getkey(scb) ((scb)->key)void wlc_scb_setkey(struct scb *scb, wsec_key_t *key);/* Find station control block corresponding to the remote id */struct scb *wlc_scbfind(wlc_info_t *wlc, const struct ether_addr *ea);/* Lookup station control for ID. If not found, create a new entry. */struct scb *wlc_scblookup(wlc_info_t *wlc, const struct ether_addr *ea);/* Lookup station control for ID. If not found, create a new entry. */struct scb *wlc_scblookupband(wlc_info_t *wlc, const struct ether_addr *ea, int bandunit);/* Get scb from band */struct scb *wlc_scbfindband(wlc_info_t *wlc, const struct ether_addr *ea, int bandunit);struct scb *wlc_scballoc(wlc_info_t *wlc);bool wlc_scbfree(wlc_info_t *wlc, struct scb *remove);/* * "|" operation */void wlc_scb_setstatebit(struct scb *scb, uint8 state);/* * "& ~" operation . */void wlc_scb_clearstatebit(struct scb *scb, uint8 state);/* * "|" operation . idx = position of the bsscfg in the wlc array of multi ssids. */void wlc_scb_setstatebit_bsscfg(struct scb *scb, uint8 state, int idx);/* * "& ~" operation . idx = position of the bsscfg in the wlc array of multi ssids. */void wlc_scb_clearstatebit_bsscfg(struct scb *scb, uint8 state, int idx);/* * reset all state. the multi ssid array is cleared as well. */void wlc_scb_resetstate(struct scb *scb);void wlc_scb_rate_init(wlc_info_t *wlc, struct scb *scb);void wlc_scb_reinit(wlc_info_t *wlc);/* free all scbs, unless permanent. Force indicates reclaim permanent as well */void wlc_scbclear(struct wlc_info *wlc, bool force);/* (de)authorize/(de)authenticate single station */void wlc_scb_set_auth(wlc_info_t *wlc, struct scb *scb, bool enable, uint32 flag, int rc);/* sort rates for a single scb */void wlc_scb_sortrates(struct scb *scb);/* sort rates for all scb in wlc */void BCMINITFN(wlc_scblist_validaterates)(wlc_info_t *wlc);int wlc_dumpscb(wlc_info_t *wlc, char *buf, int size);/* SCB flags */#define SCB_NONERP 0x0001 /* No ERP */#define SCB_LONGSLOT 0x0002 /* Long Slot */#define SCB_SHORTPREAMBLE 0x0004 /* Short Preamble ok */#define SCB_8021XHDR 0x0008 /* 802.1x Header */#define SCB_WPA_SUP 0x0010 /* 0 - authenticator, 1 - supplicant */#define SCB_DEAUTH 0x0020 /* 0 - ok to deauth, 1 - no (just did) */#define SCB_WME_CAPABLE 0x0040 /* Capable of WME; may ONLY be set if WME_ENAB(wlc) */#define SCB_BRCM 0x0100 /* BRCM AP or STA */#define SCB_WDS_LINKUP 0x0200 /* WDS link up */#define SCB_LEGACY_AES 0x0400 /* legacy AES device */#define SCB_LEGACY_CRAM 0x0800 #define SCB_MYAP 0x1000 /* We are associated to this AP */#define SCB_PENDING_PROBE 0x2000 /* Probe is pending to this SCB */#define SCB_RECV_PM 0x20000 /* state of PM bit in last data frame recv'd *//* PS macros */#define SCB_PS(_scb) ((_scb) && (_scb)->PS)/* scb association state bitfield */#define UNAUTHENTICATED 0 /* 802.11 unauthenticated */#define AUTHENTICATED 1 /* 802.11 authenticated (open or shared key) */#define ASSOCIATED 2 /* 802.11 associated */#define PENDING_AUTH 4 /* Waiting for 802.11 authentication response */#define PENDING_ASSOC 8 /* Waiting for 802.11 association response */#define AUTHORIZED 0x10 /* 802.1X authorized *//* scb association state helpers */#define SCB_ASSOCIATED(a) ((a)->state & ASSOCIATED)#define SCB_AUTHENTICATED(a) ((a)->state & AUTHENTICATED)#define SCB_AUTHORIZED(a) ((a)->state & AUTHORIZED)/* flag access */#define SCB_ISMYAP(a) ((a)->flags & SCB_MYAP)#define SCB_ISPERMANENT(a) ((a)->permanent)/* scb association state helpers w/ respect to ssid (in case of multi ssids) * The bit set in the bit field is relative to the current state (i.e. if * the current state is "associated", a 1 at the position "i" means the * sta is associated to ssid "i" */#define SCB_ASSOCIATED_BSSCFG(a, i) \ (((a)->state & ASSOCIATED) && isset(&(scb->auth_bsscfg), i))#define SCB_AUTHENTICATED_BSSCFG(a, i) \ (((a)->state & AUTHENTICATED) && isset(&(scb->auth_bsscfg), i))#define SCB_AUTHORIZED_BSSCFG(a, i) \ (((a)->state & AUTHORIZED) && isset(&(scb->auth_bsscfg), i))#define SCB_LONG_TIMEOUT 3600 /* # seconds time out for an authenticated STA */#define SCB_TIMEOUT 60 /* # seconds age out nonresponsive STA */#define SCB_ACTIVITY_TIME 5 /* # seconds skip probe if activity during this time */#define SCB_GRACE_ATTEMPTS 3 /* # attempts to probe sta beyond scb_activity_time *//* scb_info macros */#define SCB_INTERFACE(a) NULL#define SCB_WLCIFP(a) (&((a)->bsscfg->wlcif))#define SCB_WME(a) FALSE#define SCB_BA(a) FALSE#define SCB_AMPDU(a) FALSE#define SCB_AMSDU(a) FALSE#define SCB_BSSCFG(a) ((a)->bsscfg)#define SCB_SEQNUM(scb, prio) (scb)->seqnum[(prio)]#define SCBHASHINDEX(id) ((id[3] ^ id[4] ^ id[5]) & (NSCBHASH - 1))#define SCB_ISMULTI(a) ETHER_ISMULTI((a)->ea.octet)#define SCB_ISVALID(a, _pkttag_dbgid) ((a) && (a)->_dbgid == (_pkttag_dbgid))/* API for accessing SCB pointer in WLPKTTAG */#define WLPKTTAGSCBSET(p, scb) (WLPKTTAG(p)->_scb = scb)#define WLPKTTAGSCBCLR(p) (WLPKTTAG(p)->_scb = NULL)static INLINE struct scb *wlc_pkttag_scb_get(void *p){ struct scb *scb; scb = WLPKTTAG(p)->_scb; return scb;}#define WLPKTTAGSCBGET(p) (wlc_pkttag_scb_get(p))/* Given the 'feature', invoke the next stage of transmission in tx path */#define SCB_TX_NEXT(fid, scb, pkt, prec) \ (scb->tx_path[(fid)].next_tx_fn((scb->tx_path[(fid)].next_handle), (scb), (pkt), (prec)))/* Is the feature currently in the path to handle transmit. ACTIVE implies CONFIGURED */#define SCB_TXMOD_ACTIVE(scb, fid) (scb->tx_path[(fid)].next_tx_fn != NULL)extern void wlc_txmod_config(wlc_info_t *wlc, struct scb *scb, scb_txmod_t fid);extern void wlc_txmod_unconfig(wlc_info_t *wlc, struct scb *scb, scb_txmod_t fid);#endif /* _wlc_scb_h_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -