drivers/net/wireless/broadcom/brcm80211/brcmsmac/rate.h

Source file repositories/reference/linux-study-clean/drivers/net/wireless/broadcom/brcm80211/brcmsmac/rate.h

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/broadcom/brcm80211/brcmsmac/rate.h
Extension
.h
Size
7171 bytes
Lines
246
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct brcms_mcs_info {
	/* phy rate in kbps [20Mhz] */
	u32 phy_rate_20;
	/* phy rate in kbps [40Mhz] */
	u32 phy_rate_40;
	/* phy rate in kbps [20Mhz] with SGI */
	u32 phy_rate_20_sgi;
	/* phy rate in kbps [40Mhz] with SGI */
	u32 phy_rate_40_sgi;
	/* phy ctl byte 3, code rate, modulation type, # of streams */
	u8 tx_phy_ctl3;
	/* matching legacy ofdm rate in 500bkps */
	u8 leg_ofdm;
};

#define BRCMS_MAXMCS	32	/* max valid mcs index */
#define MCS_TABLE_SIZE	33	/* Number of mcs entries in the table */
extern const struct brcms_mcs_info mcs_table[];

#define MCS_TXS_MASK	0xc0	/* num tx streams - 1 bit mask */
#define MCS_TXS_SHIFT	6	/* num tx streams - 1 bit shift */

/* returns num tx streams - 1 */
static inline u8 mcs_2_txstreams(u8 mcs)
{
	return (mcs_table[mcs].tx_phy_ctl3 & MCS_TXS_MASK) >> MCS_TXS_SHIFT;
}

static inline uint mcs_2_rate(u8 mcs, bool is40, bool sgi)
{
	if (sgi) {
		if (is40)
			return mcs_table[mcs].phy_rate_40_sgi;
		return mcs_table[mcs].phy_rate_20_sgi;
	}
	if (is40)
		return mcs_table[mcs].phy_rate_40;

	return mcs_table[mcs].phy_rate_20;
}

/* Macro to use the rate_info table */
#define	BRCMS_RATE_MASK_FULL 0xff /* Rate value mask with basic rate flag */

/*
 * rate spec : holds rate and mode specific information required to generate a
 * tx frame. Legacy CCK and OFDM information is held in the same manner as was
 * done in the past (in the lower byte) the upper 3 bytes primarily hold MIMO
 * specific information
 */

/* rate spec bit fields */

/* Either 500Kbps units or MIMO MCS idx */
#define RSPEC_RATE_MASK		0x0000007F
/* mimo MCS is stored in RSPEC_RATE_MASK */
#define RSPEC_MIMORATE		0x08000000
/* mimo bw mask */
#define RSPEC_BW_MASK		0x00000700
/* mimo bw shift */
#define RSPEC_BW_SHIFT		8
/* mimo Space/Time/Frequency mode mask */
#define RSPEC_STF_MASK		0x00003800
/* mimo Space/Time/Frequency mode shift */
#define RSPEC_STF_SHIFT		11
/* mimo coding type mask */
#define RSPEC_CT_MASK		0x0000C000
/* mimo coding type shift */
#define RSPEC_CT_SHIFT		14
/* mimo num STC streams per PLCP defn. */
#define RSPEC_STC_MASK		0x00300000
/* mimo num STC streams per PLCP defn. */
#define RSPEC_STC_SHIFT		20
/* mimo bit indicates adv coding in use */
#define RSPEC_LDPC_CODING	0x00400000
/* mimo bit indicates short GI in use */
#define RSPEC_SHORT_GI		0x00800000
/* bit indicates override both rate & mode */
#define RSPEC_OVERRIDE		0x80000000
/* bit indicates override rate only */
#define RSPEC_OVERRIDE_MCS_ONLY 0x40000000

static inline bool rspec_active(u32 rspec)
{
	return rspec & (RSPEC_RATE_MASK | RSPEC_MIMORATE);
}

static inline u8 rspec_phytxbyte2(u32 rspec)
{
	return (rspec & 0xff00) >> 8;

Annotation

Implementation Notes