staging: brcm80211: lower number of wlc_bsscfg.h includes
[pandora-kernel.git] / drivers / staging / brcm80211 / brcmsmac / wlc_bsscfg.h
1 /*
2  * Copyright (c) 2010 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef _WLC_BSSCFG_H_
18 #define _WLC_BSSCFG_H_
19
20 /* Check if a particular BSS config is AP or STA */
21 #define BSSCFG_AP(cfg)          (0)
22 #define BSSCFG_STA(cfg)         (1)
23
24 #define BSSCFG_IBSS(cfg)        (!(cfg)->BSS)
25
26 #define NTXRATE                 64      /* # tx MPDUs rate is reported for */
27 #define MAXMACLIST              64      /* max # source MAC matches */
28 #define BCN_TEMPLATE_COUNT      2
29
30 /* Iterator for "associated" STA bss configs:
31    (struct wlc_info *wlc, int idx, struct wlc_bsscfg *cfg) */
32 #define FOREACH_AS_STA(wlc, idx, cfg) \
33         for (idx = 0; (int) idx < WLC_MAXBSSCFG; idx++) \
34                 if ((cfg = (wlc)->bsscfg[idx]) && BSSCFG_STA(cfg) && cfg->associated)
35
36 /* As above for all non-NULL BSS configs */
37 #define FOREACH_BSS(wlc, idx, cfg) \
38         for (idx = 0; (int) idx < WLC_MAXBSSCFG; idx++) \
39                 if ((cfg = (wlc)->bsscfg[idx]))
40
41 /* BSS configuration state */
42 struct wlc_bsscfg {
43         struct wlc_info *wlc;   /* wlc to which this bsscfg belongs to. */
44         bool up;                /* is this configuration up operational */
45         bool enable;            /* is this configuration enabled */
46         bool associated;        /* is BSS in ASSOCIATED state */
47         bool BSS;               /* infraustructure or adhac */
48         bool dtim_programmed;
49
50         u8 SSID_len;            /* the length of SSID */
51         u8 SSID[IEEE80211_MAX_SSID_LEN]; /* SSID string */
52         struct scb *bcmc_scb[MAXBANDS]; /* one bcmc_scb per band */
53         s8 _idx;                /* the index of this bsscfg,
54                                  * assigned at wlc_bsscfg_alloc()
55                                  */
56         /* MAC filter */
57         uint nmac;              /* # of entries on maclist array */
58         int macmode;            /* allow/deny stations on maclist array */
59         struct ether_addr *maclist;     /* list of source MAC addrs to match */
60
61         /* security */
62         u32 wsec;               /* wireless security bitvec */
63         s16 auth;               /* 802.11 authentication: Open, Shared Key, WPA */
64         s16 openshared; /* try Open auth first, then Shared Key */
65         bool wsec_restrict;     /* drop unencrypted packets if wsec is enabled */
66         bool eap_restrict;      /* restrict data until 802.1X auth succeeds */
67         u16 WPA_auth;   /* WPA: authenticated key management */
68         bool wpa2_preauth;      /* default is true, wpa_cap sets value */
69         bool wsec_portopen;     /* indicates keys are plumbed */
70         wsec_iv_t wpa_none_txiv;        /* global txiv for WPA_NONE, tkip and aes */
71         int wsec_index;         /* 0-3: default tx key, -1: not set */
72         wsec_key_t *bss_def_keys[WLC_DEFAULT_KEYS];     /* default key storage */
73
74         /* TKIP countermeasures */
75         bool tkip_countermeasures;      /* flags TKIP no-assoc period */
76         u32 tk_cm_dt;   /* detect timer */
77         u32 tk_cm_bt;   /* blocking timer */
78         u32 tk_cm_bt_tmstmp;    /* Timestamp when TKIP BT is activated */
79         bool tk_cm_activate;    /* activate countermeasures after EAPOL-Key sent */
80
81         u8 BSSID[ETH_ALEN];     /* BSSID (associated) */
82         u8 cur_etheraddr[ETH_ALEN];     /* h/w address */
83         u16 bcmc_fid;   /* the last BCMC FID queued to TX_BCMC_FIFO */
84         u16 bcmc_fid_shm;       /* the last BCMC FID written to shared mem */
85
86         u32 flags;              /* WLC_BSSCFG flags; see below */
87
88         u8 *bcn;                /* AP beacon */
89         uint bcn_len;           /* AP beacon length */
90         bool ar_disassoc;       /* disassociated in associated recreation */
91
92         int auth_atmptd;        /* auth type (open/shared) attempted */
93
94         pmkid_cand_t pmkid_cand[MAXPMKID];      /* PMKID candidate list */
95         uint npmkid_cand;       /* num PMKID candidates */
96         pmkid_t pmkid[MAXPMKID];        /* PMKID cache */
97         uint npmkid;            /* num cached PMKIDs */
98
99         wlc_bss_info_t *current_bss;    /* BSS parms in ASSOCIATED state */
100
101         /* PM states */
102         bool PMawakebcn;        /* bcn recvd during current waking state */
103         bool PMpending;         /* waiting for tx status with PM indicated set */
104         bool priorPMstate;      /* Detecting PM state transitions */
105         bool PSpoll;            /* whether there is an outstanding PS-Poll frame */
106
107         /* BSSID entry in RCMTA, use the wsec key management infrastructure to
108          * manage the RCMTA entries.
109          */
110         wsec_key_t *rcmta;
111
112         /* 'unique' ID of this bsscfg, assigned at bsscfg allocation */
113         u16 ID;
114
115         uint txrspecidx;        /* index into tx rate circular buffer */
116         ratespec_t txrspec[NTXRATE][2]; /* circular buffer of prev MPDUs tx rates */
117 };
118
119 #define WLC_BSSCFG_11N_DISABLE  0x1000  /* Do not advertise .11n IEs for this BSS */
120 #define WLC_BSSCFG_HW_BCN       0x20    /* The BSS is generating beacons in HW */
121
122 #define HWBCN_ENAB(cfg)         (((cfg)->flags & WLC_BSSCFG_HW_BCN) != 0)
123 #define HWPRB_ENAB(cfg)         (((cfg)->flags & WLC_BSSCFG_HW_PRB) != 0)
124
125 extern void wlc_bsscfg_ID_assign(struct wlc_info *wlc,
126                                  struct wlc_bsscfg *bsscfg);
127
128 /* Extend N_ENAB to per-BSS */
129 #define BSS_N_ENAB(wlc, cfg) \
130         (N_ENAB((wlc)->pub) && !((cfg)->flags & WLC_BSSCFG_11N_DISABLE))
131
132 #define MBSS_BCN_ENAB(cfg)       0
133 #define MBSS_PRB_ENAB(cfg)       0
134 #define SOFTBCN_ENAB(pub)    (0)
135 #define SOFTPRB_ENAB(pub)    (0)
136 #define wlc_bsscfg_tx_check(a) do { } while (0);
137
138 #endif                          /* _WLC_BSSCFG_H_ */