18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2010 Broadcom Corporation
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
118c2ecf20Sopenharmony_ci * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
138c2ecf20Sopenharmony_ci * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
148c2ecf20Sopenharmony_ci * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifndef _BRCM_SCB_H_
188c2ecf20Sopenharmony_ci#define _BRCM_SCB_H_
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include <linux/if_ether.h>
218c2ecf20Sopenharmony_ci#include <brcmu_utils.h>
228c2ecf20Sopenharmony_ci#include <defs.h>
238c2ecf20Sopenharmony_ci#include "types.h"
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define AMPDU_TX_BA_MAX_WSIZE	64	/* max Tx ba window size (in pdu) */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define AMPDU_MAX_SCB_TID	NUMPRIO
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* scb flags */
308c2ecf20Sopenharmony_ci#define SCB_WMECAP		0x0040
318c2ecf20Sopenharmony_ci#define SCB_HTCAP		0x10000	/* HT (MIMO) capable device */
328c2ecf20Sopenharmony_ci#define SCB_IS40		0x80000	/* 40MHz capable */
338c2ecf20Sopenharmony_ci#define SCB_STBCCAP		0x40000000	/* STBC Capable */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define SCB_MAGIC	0xbeefcafe
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/* structure to store per-tid state for the ampdu initiator */
388c2ecf20Sopenharmony_cistruct scb_ampdu_tid_ini {
398c2ecf20Sopenharmony_ci	u8 tid;		  /* initiator tid for easy lookup */
408c2ecf20Sopenharmony_ci	/* tx retry count; indexed by seq modulo */
418c2ecf20Sopenharmony_ci	u8 txretry[AMPDU_TX_BA_MAX_WSIZE];
428c2ecf20Sopenharmony_ci	struct scb *scb;  /* backptr for easy lookup */
438c2ecf20Sopenharmony_ci	u8 ba_wsize;	  /* negotiated ba window size (in pdu) */
448c2ecf20Sopenharmony_ci};
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_cistruct scb_ampdu {
478c2ecf20Sopenharmony_ci	struct scb *scb;	/* back pointer for easy reference */
488c2ecf20Sopenharmony_ci	u8 mpdu_density;	/* mpdu density */
498c2ecf20Sopenharmony_ci	u8 max_pdu;		/* max pdus allowed in ampdu */
508c2ecf20Sopenharmony_ci	u8 release;		/* # of mpdus released at a time */
518c2ecf20Sopenharmony_ci	u16 min_len;		/* min mpdu len to support the density */
528c2ecf20Sopenharmony_ci	u32 max_rx_ampdu_bytes;	/* max ampdu rcv length; 8k, 16k, 32k, 64k */
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci	/*
558c2ecf20Sopenharmony_ci	 * This could easily be a ini[] pointer and we keep this info in wl
568c2ecf20Sopenharmony_ci	 * itself instead of having mac80211 hold it for us. Also could be made
578c2ecf20Sopenharmony_ci	 * dynamic per tid instead of static.
588c2ecf20Sopenharmony_ci	 */
598c2ecf20Sopenharmony_ci	/* initiator info - per tid (NUMPRIO): */
608c2ecf20Sopenharmony_ci	struct scb_ampdu_tid_ini ini[AMPDU_MAX_SCB_TID];
618c2ecf20Sopenharmony_ci};
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/* station control block - one per remote MAC address */
648c2ecf20Sopenharmony_cistruct scb {
658c2ecf20Sopenharmony_ci	u32 magic;
668c2ecf20Sopenharmony_ci	u32 flags;	/* various bit flags as defined below */
678c2ecf20Sopenharmony_ci	u32 flags2;	/* various bit flags2 as defined below */
688c2ecf20Sopenharmony_ci	u8 state;	/* current state bitfield of auth/assoc process */
698c2ecf20Sopenharmony_ci	u8 ea[ETH_ALEN];	/* station address */
708c2ecf20Sopenharmony_ci	uint fragresid[NUMPRIO];/* #bytes unused in frag buffer per prio */
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci	u16 seqctl[NUMPRIO];	/* seqctl of last received frame (for dups) */
738c2ecf20Sopenharmony_ci	/* seqctl of last received frame (for dups) for non-QoS data and
748c2ecf20Sopenharmony_ci	 * management */
758c2ecf20Sopenharmony_ci	u16 seqctl_nonqos;
768c2ecf20Sopenharmony_ci	u16 seqnum[NUMPRIO];/* WME: driver maintained sw seqnum per priority */
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci	struct scb_ampdu scb_ampdu;	/* AMPDU state including per tid info */
798c2ecf20Sopenharmony_ci};
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#endif				/* _BRCM_SCB_H_ */
82