Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelv...
[pandora-kernel.git] / drivers / staging / brcm80211 / sys / 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 #include <wlc_types.h>
21
22 /* Check if a particular BSS config is AP or STA */
23 #define BSSCFG_AP(cfg)          (0)
24 #define BSSCFG_STA(cfg)         (1)
25
26 #define BSSCFG_IBSS(cfg)        (!(cfg)->BSS)
27
28 /* forward declarations */
29 typedef struct wlc_bsscfg wlc_bsscfg_t;
30
31 #include <wlc_rate.h>
32
33 #define NTXRATE                 64      /* # tx MPDUs rate is reported for */
34 #define MAXMACLIST              64      /* max # source MAC matches */
35 #define BCN_TEMPLATE_COUNT      2
36
37 /* Iterator for "associated" STA bss configs:  (wlc_info_t *wlc, int idx, wlc_bsscfg_t *cfg) */
38 #define FOREACH_AS_STA(wlc, idx, cfg) \
39         for (idx = 0; (int) idx < WLC_MAXBSSCFG; idx++) \
40                 if ((cfg = (wlc)->bsscfg[idx]) && BSSCFG_STA(cfg) && cfg->associated)
41
42 /* As above for all non-NULL BSS configs */
43 #define FOREACH_BSS(wlc, idx, cfg) \
44         for (idx = 0; (int) idx < WLC_MAXBSSCFG; idx++) \
45                 if ((cfg = (wlc)->bsscfg[idx]))
46
47 /* BSS configuration state */
48 struct wlc_bsscfg {
49         struct wlc_info *wlc;   /* wlc to which this bsscfg belongs to. */
50         bool up;                /* is this configuration up operational */
51         bool enable;            /* is this configuration enabled */
52         bool associated;        /* is BSS in ASSOCIATED state */
53         bool BSS;               /* infraustructure or adhac */
54         bool dtim_programmed;
55 #ifdef LATER
56         bool _ap;               /* is this configuration an AP */
57         struct wlc_if *wlcif;   /* virtual interface, NULL for primary bsscfg */
58         void *sup;              /* pointer to supplicant state */
59         s8 sup_type;            /* type of supplicant */
60         bool sup_enable_wpa;    /* supplicant WPA on/off */
61         void *authenticator;    /* pointer to authenticator state */
62         bool sup_auth_pending;  /* flag for auth timeout */
63 #endif
64         u8 SSID_len;            /* the length of SSID */
65         u8 SSID[DOT11_MAX_SSID_LEN];    /* SSID string */
66         struct scb *bcmc_scb[MAXBANDS]; /* one bcmc_scb per band */
67         s8 _idx;                /* the index of this bsscfg,
68                                  * assigned at wlc_bsscfg_alloc()
69                                  */
70         /* MAC filter */
71         uint nmac;              /* # of entries on maclist array */
72         int macmode;            /* allow/deny stations on maclist array */
73         struct ether_addr *maclist;     /* list of source MAC addrs to match */
74
75         /* security */
76         u32 wsec;               /* wireless security bitvec */
77         s16 auth;               /* 802.11 authentication: Open, Shared Key, WPA */
78         s16 openshared; /* try Open auth first, then Shared Key */
79         bool wsec_restrict;     /* drop unencrypted packets if wsec is enabled */
80         bool eap_restrict;      /* restrict data until 802.1X auth succeeds */
81         u16 WPA_auth;   /* WPA: authenticated key management */
82         bool wpa2_preauth;      /* default is true, wpa_cap sets value */
83         bool wsec_portopen;     /* indicates keys are plumbed */
84         wsec_iv_t wpa_none_txiv;        /* global txiv for WPA_NONE, tkip and aes */
85         int wsec_index;         /* 0-3: default tx key, -1: not set */
86         wsec_key_t *bss_def_keys[WLC_DEFAULT_KEYS];     /* default key storage */
87
88         /* TKIP countermeasures */
89         bool tkip_countermeasures;      /* flags TKIP no-assoc period */
90         u32 tk_cm_dt;   /* detect timer */
91         u32 tk_cm_bt;   /* blocking timer */
92         u32 tk_cm_bt_tmstmp;    /* Timestamp when TKIP BT is activated */
93         bool tk_cm_activate;    /* activate countermeasures after EAPOL-Key sent */
94
95         struct ether_addr BSSID;        /* BSSID (associated) */
96         struct ether_addr cur_etheraddr;        /* h/w address */
97         u16 bcmc_fid;   /* the last BCMC FID queued to TX_BCMC_FIFO */
98         u16 bcmc_fid_shm;       /* the last BCMC FID written to shared mem */
99
100         u32 flags;              /* WLC_BSSCFG flags; see below */
101
102         u8 *bcn;                /* AP beacon */
103         uint bcn_len;           /* AP beacon length */
104         bool ar_disassoc;       /* disassociated in associated recreation */
105
106         int auth_atmptd;        /* auth type (open/shared) attempted */
107
108         pmkid_cand_t pmkid_cand[MAXPMKID];      /* PMKID candidate list */
109         uint npmkid_cand;       /* num PMKID candidates */
110         pmkid_t pmkid[MAXPMKID];        /* PMKID cache */
111         uint npmkid;            /* num cached PMKIDs */
112
113         wlc_bss_info_t *target_bss;     /* BSS parms during tran. to ASSOCIATED state */
114         wlc_bss_info_t *current_bss;    /* BSS parms in ASSOCIATED state */
115
116         /* PM states */
117         bool PMawakebcn;        /* bcn recvd during current waking state */
118         bool PMpending;         /* waiting for tx status with PM indicated set */
119         bool priorPMstate;      /* Detecting PM state transitions */
120         bool PSpoll;            /* whether there is an outstanding PS-Poll frame */
121
122         /* BSSID entry in RCMTA, use the wsec key management infrastructure to
123          * manage the RCMTA entries.
124          */
125         wsec_key_t *rcmta;
126
127         /* 'unique' ID of this bsscfg, assigned at bsscfg allocation */
128         u16 ID;
129
130         uint txrspecidx;        /* index into tx rate circular buffer */
131         ratespec_t txrspec[NTXRATE][2]; /* circular buffer of prev MPDUs tx rates */
132 };
133
134 #define WLC_BSSCFG_11N_DISABLE  0x1000  /* Do not advertise .11n IEs for this BSS */
135 #define WLC_BSSCFG_HW_BCN       0x20    /* The BSS is generating beacons in HW */
136
137 #define HWBCN_ENAB(cfg)         (((cfg)->flags & WLC_BSSCFG_HW_BCN) != 0)
138 #define HWPRB_ENAB(cfg)         (((cfg)->flags & WLC_BSSCFG_HW_PRB) != 0)
139
140 extern void wlc_bsscfg_ID_assign(struct wlc_info *wlc, wlc_bsscfg_t * bsscfg);
141
142 /* Extend N_ENAB to per-BSS */
143 #define BSS_N_ENAB(wlc, cfg) \
144         (N_ENAB((wlc)->pub) && !((cfg)->flags & WLC_BSSCFG_11N_DISABLE))
145
146 #define MBSS_BCN_ENAB(cfg)       0
147 #define MBSS_PRB_ENAB(cfg)       0
148 #define SOFTBCN_ENAB(pub)    (0)
149 #define SOFTPRB_ENAB(pub)    (0)
150 #define wlc_bsscfg_tx_check(a) do { } while (0);
151
152 #endif                          /* _WLC_BSSCFG_H_ */