Commit 73ffc2fc authored by Alwin Beukers's avatar Alwin Beukers Committed by John W. Linville
Browse files

brcm80211: cleanup defines in main.c

parent ef5af747
Loading
Loading
Loading
Loading
+148 −200
Original line number Diff line number Diff line
@@ -37,11 +37,6 @@
 */
#define ALLPRIO				-1

/*
 * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
 */
#define SSID_FMT_BUF_LEN	((4 * IEEE80211_MAX_SSID_LEN) + 1)

/* watchdog timer, in unit of ms */
#define TIMER_INTERVAL_WATCHDOG		1000
/* radio monitor timer, in unit of ms */
@@ -54,20 +49,11 @@

/* Min MPC timeout, in unit of watchdog */
#define BRCMS_MPC_MIN_DELAYCNT		1
#define	BRCMS_MPC_THRESHOLD	3	/* MPC count threshold level */
/* MPC count threshold level */
#define BRCMS_MPC_THRESHOLD		3

/* beacon interval, in unit of 1024TU */
#define BEACON_INTERVAL_DEFAULT		100
/* DTIM interval, in unit of beacon interval */
#define	DTIM_INTERVAL_DEFAULT	3

/* Scale down delays to accommodate QT slow speed */
/* beacon interval, in unit of 1024TU */
#define	BEACON_INTERVAL_DEF_QT	20
/* DTIM interval, in unit of beacon interval */
#define	DTIM_INTERVAL_DEF_QT	1

#define	TBTT_ALIGN_LEEWAY_US	100	/* min leeway before first TBTT in us */

/* n-mode support capability */
/* 2x2 includes both 1x1 & 2x2 devices
@@ -78,16 +64,6 @@
#define WL_11N_3x3			3
#define WL_11N_4x4			4

/* define 11n feature disable flags */
#define WLFEATURE_DISABLE_11N		0x00000001
#define WLFEATURE_DISABLE_11N_STBC_TX	0x00000002
#define WLFEATURE_DISABLE_11N_STBC_RX	0x00000004
#define WLFEATURE_DISABLE_11N_SGI_TX	0x00000008
#define WLFEATURE_DISABLE_11N_SGI_RX	0x00000010
#define WLFEATURE_DISABLE_11N_AMPDU_TX	0x00000020
#define WLFEATURE_DISABLE_11N_AMPDU_RX	0x00000040
#define WLFEATURE_DISABLE_11N_GF	0x00000080

#define EDCF_ACI_MASK			0x60
#define EDCF_ACI_SHIFT			5
#define EDCF_ECWMIN_MASK		0x0f
@@ -142,46 +118,19 @@
#define BPHY_PLCP_TIME			192
#define RIFS_11N_TIME			2

#define WME_VER			1
#define WME_SUBTYPE_PARAM_IE	1
#define WME_TYPE		2
#define WME_OUI			"\x00\x50\xf2"

#define AC_BE				0
#define AC_BK				1
#define AC_VI				2
#define AC_VO				3

#define	BCN_TMPL_LEN		512	/* length of the BCN template area */
/* length of the BCN template area */
#define BCN_TMPL_LEN			512

/* brcms_bss_info flag bit values */
#define BRCMS_BSS_HT			0x0020	/* BSS is HT (MIMO) capable */

/* Flags used in brcms_c_txq_info.stopped */
/* per prio flow control bits */
#define TXQ_STOP_FOR_PRIOFC_MASK	0x000000FF
/* stop txq enqueue for packet drain */
#define TXQ_STOP_FOR_PKT_DRAIN		0x00000100
/* stop txq enqueue for ampdu flow control */
#define TXQ_STOP_FOR_AMPDU_FLOW_CNTRL	0x00000200

#define	BRCMS_HWRXOFF		38	/* chip rx buffer offset */

/* Find basic rate for a given rate */
static u8 brcms_basic_rate(struct brcms_c_info *wlc, u32 rspec)
{
	if (is_mcs_rate(rspec))
		return wlc->band->basic_rate[mcs_table[rspec & RSPEC_RATE_MASK]
		       .leg_ofdm];
	return wlc->band->basic_rate[rspec & RSPEC_RATE_MASK];
}

static u16 frametype(u32 rspec, u8 mimoframe)
{
	if (is_mcs_rate(rspec))
		return mimoframe;
	return is_cck_rate(rspec) ? FT_CCK : FT_OFDM;
}
/* chip rx buffer offset */
#define BRCMS_HWRXOFF			38

/* rfdisable delay timer 500 ms, runs of ALP clock */
#define RFDISABLE_DEFAULT		10000000
@@ -203,17 +152,13 @@ static u16 frametype(u32 rspec, u8 mimoframe)
#define _BRCMS_PREC_VO			12	/* Vo - Voice */
#define _BRCMS_PREC_NC			14	/* NC - Network Control */

/* The BSS is generating beacons in HW */
#define BRCMS_BSSCFG_HW_BCN	0x20

#define	SYNTHPU_DLY_APHY_US	3700	/* a phy synthpu_dly time in us */
#define	SYNTHPU_DLY_BPHY_US	1050	/* b/g phy synthpu_dly time in us */
#define	SYNTHPU_DLY_NPHY_US	2048	/* n phy REV3 synthpu_dly time in us */
#define	SYNTHPU_DLY_LPPHY_US	300	/* lpphy synthpu_dly time in us */

#define	SYNTHPU_DLY_PHY_US_QT	100	/* QT synthpu_dly time in us */
/* synthpu_dly times in us */
#define SYNTHPU_DLY_APHY_US		3700
#define SYNTHPU_DLY_BPHY_US		1050
#define SYNTHPU_DLY_NPHY_US		2048
#define SYNTHPU_DLY_LPPHY_US		300

#define	ANTCNT			10	/* vanilla M_MAX_ANTCNT value */
#define ANTCNT				10	/* vanilla M_MAX_ANTCNT val */

/* Per-AC retry limit register definitions; uses defs.h bitfield macros */
#define EDCF_SHORT_S			0
@@ -228,8 +173,8 @@ static u16 frametype(u32 rspec, u8 mimoframe)
#define RETRY_SHORT_DEF			7	/* Default Short retry Limit */
#define RETRY_SHORT_MAX			255	/* Maximum Short retry Limit */
#define RETRY_LONG_DEF			4	/* Default Long retry count */
#define	RETRY_SHORT_FB			3 /* Short count for fallback rate */
#define	RETRY_LONG_FB			2 /* Long count for fallback rate */
#define RETRY_SHORT_FB			3	/* Short count for fb rate */
#define RETRY_LONG_FB			2	/* Long count for fb rate */

#define APHY_CWMIN			15
#define PHY_CWMAX			1023
@@ -289,13 +234,11 @@ static u16 frametype(u32 rspec, u8 mimoframe)
#define NRATE_STF_MASK			0x0000ff00
/* stf mode shift */
#define NRATE_STF_SHIFT			8
/* bit indicates override both rate & mode */
#define NRATE_OVERRIDE	0x80000000
/* bit indicate to override mcs only */
#define NRATE_OVERRIDE_MCS_ONLY		0x40000000
#define NRATE_SGI_MASK			0x00800000	/* sgi mode */
#define NRATE_SGI_SHIFT			23		/* sgi mode */
#define NRATE_LDPC_CODING 0x00400000	/* bit indicates adv coding in use */
#define NRATE_LDPC_CODING		0x00400000	/* adv coding in use */
#define NRATE_LDPC_SHIFT		22		/* ldpc shift */

#define NRATE_STF_SISO			0		/* stf mode SISO */
@@ -316,14 +259,10 @@ static u16 frametype(u32 rspec, u8 mimoframe)
/* data msg txq hiwat mark */
#define BRCMS_DATAHIWAT			50

/* bounded rx loops */
#define RXBND		8 /* max # frames to process in brcms_c_recv() */
#define TXSBND		8 /* max # tx status to process in wlc_txstatus() */

/*
 * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
 */
#define SSID_FMT_BUF_LEN	((4 * IEEE80211_MAX_SSID_LEN) + 1)
/* max # frames to process in brcms_c_recv() */
#define RXBND				8
/* max # tx status to process in wlc_txstatus() */
#define TXSBND				8

/* brcmu_format_flags() bit description structure */
struct brcms_c_bit_desc {
@@ -405,13 +344,6 @@ static const u16 xmtfifo_sz[][NFIFO] = {
	{9, 58, 22, 14, 14, 5},
};

static const u8 acbitmap2maxprio[] = {
	PRIO_8021D_BE, PRIO_8021D_BE, PRIO_8021D_BK, PRIO_8021D_BK,
	PRIO_8021D_VI, PRIO_8021D_VI, PRIO_8021D_VI, PRIO_8021D_VI,
	PRIO_8021D_VO, PRIO_8021D_VO, PRIO_8021D_VO, PRIO_8021D_VO,
	PRIO_8021D_VO, PRIO_8021D_VO, PRIO_8021D_VO, PRIO_8021D_VO
};

#ifdef BCMDBG
static const char * const fifo_names[] = {
	"AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" };
@@ -424,6 +356,22 @@ static const char fifo_names[6][0];
static struct brcms_c_info *wlc_info_dbg = (struct brcms_c_info *) (NULL);
#endif

/* Find basic rate for a given rate */
static u8 brcms_basic_rate(struct brcms_c_info *wlc, u32 rspec)
{
	if (is_mcs_rate(rspec))
		return wlc->band->basic_rate[mcs_table[rspec & RSPEC_RATE_MASK]
		       .leg_ofdm];
	return wlc->band->basic_rate[rspec & RSPEC_RATE_MASK];
}

static u16 frametype(u32 rspec, u8 mimoframe)
{
	if (is_mcs_rate(rspec))
		return mimoframe;
	return is_cck_rate(rspec) ? FT_CCK : FT_OFDM;
}

/* currently the best mechanism for determining SIFS is the band in use */
static u16 get_sifs(struct brcms_band *band)
{