xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/broadcom/brcm80211/brcmsmac/scb.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (c) 2010 Broadcom Corporation
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Permission to use, copy, modify, and/or distribute this software for any
5*4882a593Smuzhiyun  * purpose with or without fee is hereby granted, provided that the above
6*4882a593Smuzhiyun  * copyright notice and this permission notice appear in all copies.
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9*4882a593Smuzhiyun  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10*4882a593Smuzhiyun  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11*4882a593Smuzhiyun  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12*4882a593Smuzhiyun  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13*4882a593Smuzhiyun  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14*4882a593Smuzhiyun  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*4882a593Smuzhiyun  */
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun #ifndef _BRCM_SCB_H_
18*4882a593Smuzhiyun #define _BRCM_SCB_H_
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun #include <linux/if_ether.h>
21*4882a593Smuzhiyun #include <brcmu_utils.h>
22*4882a593Smuzhiyun #include <defs.h>
23*4882a593Smuzhiyun #include "types.h"
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun #define AMPDU_TX_BA_MAX_WSIZE	64	/* max Tx ba window size (in pdu) */
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun #define AMPDU_MAX_SCB_TID	NUMPRIO
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun /* scb flags */
30*4882a593Smuzhiyun #define SCB_WMECAP		0x0040
31*4882a593Smuzhiyun #define SCB_HTCAP		0x10000	/* HT (MIMO) capable device */
32*4882a593Smuzhiyun #define SCB_IS40		0x80000	/* 40MHz capable */
33*4882a593Smuzhiyun #define SCB_STBCCAP		0x40000000	/* STBC Capable */
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #define SCB_MAGIC	0xbeefcafe
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun /* structure to store per-tid state for the ampdu initiator */
38*4882a593Smuzhiyun struct scb_ampdu_tid_ini {
39*4882a593Smuzhiyun 	u8 tid;		  /* initiator tid for easy lookup */
40*4882a593Smuzhiyun 	/* tx retry count; indexed by seq modulo */
41*4882a593Smuzhiyun 	u8 txretry[AMPDU_TX_BA_MAX_WSIZE];
42*4882a593Smuzhiyun 	struct scb *scb;  /* backptr for easy lookup */
43*4882a593Smuzhiyun 	u8 ba_wsize;	  /* negotiated ba window size (in pdu) */
44*4882a593Smuzhiyun };
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun struct scb_ampdu {
47*4882a593Smuzhiyun 	struct scb *scb;	/* back pointer for easy reference */
48*4882a593Smuzhiyun 	u8 mpdu_density;	/* mpdu density */
49*4882a593Smuzhiyun 	u8 max_pdu;		/* max pdus allowed in ampdu */
50*4882a593Smuzhiyun 	u8 release;		/* # of mpdus released at a time */
51*4882a593Smuzhiyun 	u16 min_len;		/* min mpdu len to support the density */
52*4882a593Smuzhiyun 	u32 max_rx_ampdu_bytes;	/* max ampdu rcv length; 8k, 16k, 32k, 64k */
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun 	/*
55*4882a593Smuzhiyun 	 * This could easily be a ini[] pointer and we keep this info in wl
56*4882a593Smuzhiyun 	 * itself instead of having mac80211 hold it for us. Also could be made
57*4882a593Smuzhiyun 	 * dynamic per tid instead of static.
58*4882a593Smuzhiyun 	 */
59*4882a593Smuzhiyun 	/* initiator info - per tid (NUMPRIO): */
60*4882a593Smuzhiyun 	struct scb_ampdu_tid_ini ini[AMPDU_MAX_SCB_TID];
61*4882a593Smuzhiyun };
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun /* station control block - one per remote MAC address */
64*4882a593Smuzhiyun struct scb {
65*4882a593Smuzhiyun 	u32 magic;
66*4882a593Smuzhiyun 	u32 flags;	/* various bit flags as defined below */
67*4882a593Smuzhiyun 	u32 flags2;	/* various bit flags2 as defined below */
68*4882a593Smuzhiyun 	u8 state;	/* current state bitfield of auth/assoc process */
69*4882a593Smuzhiyun 	u8 ea[ETH_ALEN];	/* station address */
70*4882a593Smuzhiyun 	uint fragresid[NUMPRIO];/* #bytes unused in frag buffer per prio */
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun 	u16 seqctl[NUMPRIO];	/* seqctl of last received frame (for dups) */
73*4882a593Smuzhiyun 	/* seqctl of last received frame (for dups) for non-QoS data and
74*4882a593Smuzhiyun 	 * management */
75*4882a593Smuzhiyun 	u16 seqctl_nonqos;
76*4882a593Smuzhiyun 	u16 seqnum[NUMPRIO];/* WME: driver maintained sw seqnum per priority */
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun 	struct scb_ampdu scb_ampdu;	/* AMPDU state including per tid info */
79*4882a593Smuzhiyun };
80*4882a593Smuzhiyun 
81*4882a593Smuzhiyun #endif				/* _BRCM_SCB_H_ */
82