1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
258619b14SKalle Valo #ifndef B43_XMIT_H_
358619b14SKalle Valo #define B43_XMIT_H_
458619b14SKalle Valo
558619b14SKalle Valo #include "main.h"
658619b14SKalle Valo #include <net/mac80211.h>
758619b14SKalle Valo
858619b14SKalle Valo
958619b14SKalle Valo #define _b43_declare_plcp_hdr(size) \
1058619b14SKalle Valo struct b43_plcp_hdr##size { \
1158619b14SKalle Valo union { \
1258619b14SKalle Valo __le32 data; \
1358619b14SKalle Valo __u8 raw[size]; \
1458619b14SKalle Valo } __packed; \
1558619b14SKalle Valo } __packed
1658619b14SKalle Valo
1758619b14SKalle Valo /* struct b43_plcp_hdr4 */
1858619b14SKalle Valo _b43_declare_plcp_hdr(4);
1958619b14SKalle Valo /* struct b43_plcp_hdr6 */
2058619b14SKalle Valo _b43_declare_plcp_hdr(6);
2158619b14SKalle Valo
2258619b14SKalle Valo #undef _b43_declare_plcp_hdr
2358619b14SKalle Valo
2458619b14SKalle Valo /* TX header for v4 firmware */
2558619b14SKalle Valo struct b43_txhdr {
2658619b14SKalle Valo __le32 mac_ctl; /* MAC TX control */
2758619b14SKalle Valo __le16 mac_frame_ctl; /* Copy of the FrameControl field */
2858619b14SKalle Valo __le16 tx_fes_time_norm; /* TX FES Time Normal */
2958619b14SKalle Valo __le16 phy_ctl; /* PHY TX control */
3058619b14SKalle Valo __le16 phy_ctl1; /* PHY TX control word 1 */
3158619b14SKalle Valo __le16 phy_ctl1_fb; /* PHY TX control word 1 for fallback rates */
3258619b14SKalle Valo __le16 phy_ctl1_rts; /* PHY TX control word 1 RTS */
3358619b14SKalle Valo __le16 phy_ctl1_rts_fb; /* PHY TX control word 1 RTS for fallback rates */
3458619b14SKalle Valo __u8 phy_rate; /* PHY rate */
3558619b14SKalle Valo __u8 phy_rate_rts; /* PHY rate for RTS/CTS */
3658619b14SKalle Valo __u8 extra_ft; /* Extra Frame Types */
3758619b14SKalle Valo __u8 chan_radio_code; /* Channel Radio Code */
3858619b14SKalle Valo __u8 iv[16]; /* Encryption IV */
3958619b14SKalle Valo __u8 tx_receiver[6]; /* TX Frame Receiver address */
4058619b14SKalle Valo __le16 tx_fes_time_fb; /* TX FES Time Fallback */
4158619b14SKalle Valo struct b43_plcp_hdr6 rts_plcp_fb; /* RTS fallback PLCP header */
4258619b14SKalle Valo __le16 rts_dur_fb; /* RTS fallback duration */
4358619b14SKalle Valo struct b43_plcp_hdr6 plcp_fb; /* Fallback PLCP header */
4458619b14SKalle Valo __le16 dur_fb; /* Fallback duration */
4558619b14SKalle Valo __le16 mimo_modelen; /* MIMO mode length */
4658619b14SKalle Valo __le16 mimo_ratelen_fb; /* MIMO fallback rate length */
4758619b14SKalle Valo __le32 timeout; /* Timeout */
4858619b14SKalle Valo
4958619b14SKalle Valo union {
5058619b14SKalle Valo /* Tested with 598.314, 644.1001 and 666.2 */
5158619b14SKalle Valo struct {
5258619b14SKalle Valo __le16 mimo_antenna; /* MIMO antenna select */
5358619b14SKalle Valo __le16 preload_size; /* Preload size */
5458619b14SKalle Valo PAD_BYTES(2);
5558619b14SKalle Valo __le16 cookie; /* TX frame cookie */
5658619b14SKalle Valo __le16 tx_status; /* TX status */
5758619b14SKalle Valo __le16 max_n_mpdus;
5858619b14SKalle Valo __le16 max_a_bytes_mrt;
5958619b14SKalle Valo __le16 max_a_bytes_fbr;
6058619b14SKalle Valo __le16 min_m_bytes;
6158619b14SKalle Valo struct b43_plcp_hdr6 rts_plcp; /* RTS PLCP header */
6258619b14SKalle Valo __u8 rts_frame[16]; /* The RTS frame (if used) */
6358619b14SKalle Valo PAD_BYTES(2);
6458619b14SKalle Valo struct b43_plcp_hdr6 plcp; /* Main PLCP header */
6558619b14SKalle Valo } format_598 __packed;
6658619b14SKalle Valo
6758619b14SKalle Valo /* Tested with 410.2160, 478.104 and 508.* */
6858619b14SKalle Valo struct {
6958619b14SKalle Valo __le16 mimo_antenna; /* MIMO antenna select */
7058619b14SKalle Valo __le16 preload_size; /* Preload size */
7158619b14SKalle Valo PAD_BYTES(2);
7258619b14SKalle Valo __le16 cookie; /* TX frame cookie */
7358619b14SKalle Valo __le16 tx_status; /* TX status */
7458619b14SKalle Valo struct b43_plcp_hdr6 rts_plcp; /* RTS PLCP header */
7558619b14SKalle Valo __u8 rts_frame[16]; /* The RTS frame (if used) */
7658619b14SKalle Valo PAD_BYTES(2);
7758619b14SKalle Valo struct b43_plcp_hdr6 plcp; /* Main PLCP header */
7858619b14SKalle Valo } format_410 __packed;
7958619b14SKalle Valo
8058619b14SKalle Valo /* Tested with 351.126 */
8158619b14SKalle Valo struct {
8258619b14SKalle Valo PAD_BYTES(2);
8358619b14SKalle Valo __le16 cookie; /* TX frame cookie */
8458619b14SKalle Valo __le16 tx_status; /* TX status */
8558619b14SKalle Valo struct b43_plcp_hdr6 rts_plcp; /* RTS PLCP header */
8658619b14SKalle Valo __u8 rts_frame[16]; /* The RTS frame (if used) */
8758619b14SKalle Valo PAD_BYTES(2);
8858619b14SKalle Valo struct b43_plcp_hdr6 plcp; /* Main PLCP header */
8958619b14SKalle Valo } format_351 __packed;
9058619b14SKalle Valo
9158619b14SKalle Valo } __packed;
9258619b14SKalle Valo } __packed;
9358619b14SKalle Valo
9458619b14SKalle Valo struct b43_tx_legacy_rate_phy_ctl_entry {
9558619b14SKalle Valo u8 bitrate;
9658619b14SKalle Valo u16 coding_rate;
9758619b14SKalle Valo u16 modulation;
9858619b14SKalle Valo };
9958619b14SKalle Valo
10058619b14SKalle Valo /* MAC TX control */
10158619b14SKalle Valo #define B43_TXH_MAC_RTS_FB_SHORTPRMBL 0x80000000 /* RTS fallback preamble */
10258619b14SKalle Valo #define B43_TXH_MAC_RTS_SHORTPRMBL 0x40000000 /* RTS main rate preamble */
10358619b14SKalle Valo #define B43_TXH_MAC_FB_SHORTPRMBL 0x20000000 /* Main fallback preamble */
10458619b14SKalle Valo #define B43_TXH_MAC_USEFBR 0x10000000 /* Use fallback rate for this AMPDU */
10558619b14SKalle Valo #define B43_TXH_MAC_KEYIDX 0x0FF00000 /* Security key index */
10658619b14SKalle Valo #define B43_TXH_MAC_KEYIDX_SHIFT 20
10758619b14SKalle Valo #define B43_TXH_MAC_ALT_TXPWR 0x00080000 /* Use alternate txpwr defined at loc. M_ALT_TXPWR_IDX */
10858619b14SKalle Valo #define B43_TXH_MAC_KEYALG 0x00070000 /* Security key algorithm */
10958619b14SKalle Valo #define B43_TXH_MAC_KEYALG_SHIFT 16
11058619b14SKalle Valo #define B43_TXH_MAC_AMIC 0x00008000 /* AMIC */
11158619b14SKalle Valo #define B43_TXH_MAC_RIFS 0x00004000 /* Use RIFS */
11258619b14SKalle Valo #define B43_TXH_MAC_LIFETIME 0x00002000 /* Lifetime */
11358619b14SKalle Valo #define B43_TXH_MAC_FRAMEBURST 0x00001000 /* Frameburst */
11458619b14SKalle Valo #define B43_TXH_MAC_SENDCTS 0x00000800 /* Send CTS-to-self */
11558619b14SKalle Valo #define B43_TXH_MAC_AMPDU 0x00000600 /* AMPDU status */
11658619b14SKalle Valo #define B43_TXH_MAC_AMPDU_MPDU 0x00000000 /* Regular MPDU, not an AMPDU */
11758619b14SKalle Valo #define B43_TXH_MAC_AMPDU_FIRST 0x00000200 /* First MPDU or AMPDU */
11858619b14SKalle Valo #define B43_TXH_MAC_AMPDU_INTER 0x00000400 /* Intermediate MPDU or AMPDU */
11958619b14SKalle Valo #define B43_TXH_MAC_AMPDU_LAST 0x00000600 /* Last (or only) MPDU of AMPDU */
12058619b14SKalle Valo #define B43_TXH_MAC_40MHZ 0x00000100 /* Use 40 MHz bandwidth */
12158619b14SKalle Valo #define B43_TXH_MAC_5GHZ 0x00000080 /* 5GHz band */
12258619b14SKalle Valo #define B43_TXH_MAC_DFCS 0x00000040 /* DFCS */
12358619b14SKalle Valo #define B43_TXH_MAC_IGNPMQ 0x00000020 /* Ignore PMQ */
12458619b14SKalle Valo #define B43_TXH_MAC_HWSEQ 0x00000010 /* Use Hardware Sequence Number */
12558619b14SKalle Valo #define B43_TXH_MAC_STMSDU 0x00000008 /* Start MSDU */
12658619b14SKalle Valo #define B43_TXH_MAC_SENDRTS 0x00000004 /* Send RTS */
12758619b14SKalle Valo #define B43_TXH_MAC_LONGFRAME 0x00000002 /* Long frame */
12858619b14SKalle Valo #define B43_TXH_MAC_ACK 0x00000001 /* Immediate ACK */
12958619b14SKalle Valo
13058619b14SKalle Valo /* Extra Frame Types */
13158619b14SKalle Valo #define B43_TXH_EFT_FB 0x03 /* Data frame fallback encoding */
13258619b14SKalle Valo #define B43_TXH_EFT_FB_CCK 0x00 /* CCK */
13358619b14SKalle Valo #define B43_TXH_EFT_FB_OFDM 0x01 /* OFDM */
13458619b14SKalle Valo #define B43_TXH_EFT_FB_HT 0x02 /* HT */
13558619b14SKalle Valo #define B43_TXH_EFT_FB_VHT 0x03 /* VHT */
13658619b14SKalle Valo #define B43_TXH_EFT_RTS 0x0C /* RTS/CTS encoding */
13758619b14SKalle Valo #define B43_TXH_EFT_RTS_CCK 0x00 /* CCK */
13858619b14SKalle Valo #define B43_TXH_EFT_RTS_OFDM 0x04 /* OFDM */
13958619b14SKalle Valo #define B43_TXH_EFT_RTS_HT 0x08 /* HT */
14058619b14SKalle Valo #define B43_TXH_EFT_RTS_VHT 0x0C /* VHT */
14158619b14SKalle Valo #define B43_TXH_EFT_RTSFB 0x30 /* RTS/CTS fallback encoding */
14258619b14SKalle Valo #define B43_TXH_EFT_RTSFB_CCK 0x00 /* CCK */
14358619b14SKalle Valo #define B43_TXH_EFT_RTSFB_OFDM 0x10 /* OFDM */
14458619b14SKalle Valo #define B43_TXH_EFT_RTSFB_HT 0x20 /* HT */
14558619b14SKalle Valo #define B43_TXH_EFT_RTSFB_VHT 0x30 /* VHT */
14658619b14SKalle Valo
14758619b14SKalle Valo /* PHY TX control word */
14858619b14SKalle Valo #define B43_TXH_PHY_ENC 0x0003 /* Data frame encoding */
14958619b14SKalle Valo #define B43_TXH_PHY_ENC_CCK 0x0000 /* CCK */
15058619b14SKalle Valo #define B43_TXH_PHY_ENC_OFDM 0x0001 /* OFDM */
15158619b14SKalle Valo #define B43_TXH_PHY_ENC_HT 0x0002 /* HT */
15258619b14SKalle Valo #define B43_TXH_PHY_ENC_VHT 0x0003 /* VHT */
15358619b14SKalle Valo #define B43_TXH_PHY_SHORTPRMBL 0x0010 /* Use short preamble */
15458619b14SKalle Valo #define B43_TXH_PHY_ANT 0x03C0 /* Antenna selection */
15558619b14SKalle Valo #define B43_TXH_PHY_ANT0 0x0000 /* Use antenna 0 */
15658619b14SKalle Valo #define B43_TXH_PHY_ANT1 0x0040 /* Use antenna 1 */
15758619b14SKalle Valo #define B43_TXH_PHY_ANT01AUTO 0x00C0 /* Use antenna 0/1 auto */
15858619b14SKalle Valo #define B43_TXH_PHY_ANT2 0x0100 /* Use antenna 2 */
15958619b14SKalle Valo #define B43_TXH_PHY_ANT3 0x0200 /* Use antenna 3 */
16058619b14SKalle Valo #define B43_TXH_PHY_TXPWR 0xFC00 /* TX power */
16158619b14SKalle Valo #define B43_TXH_PHY_TXPWR_SHIFT 10
16258619b14SKalle Valo
16358619b14SKalle Valo /* PHY TX control word 1 */
16458619b14SKalle Valo #define B43_TXH_PHY1_BW 0x0007 /* Bandwidth */
16558619b14SKalle Valo #define B43_TXH_PHY1_BW_10 0x0000 /* 10 MHz */
16658619b14SKalle Valo #define B43_TXH_PHY1_BW_10U 0x0001 /* 10 MHz upper */
16758619b14SKalle Valo #define B43_TXH_PHY1_BW_20 0x0002 /* 20 MHz */
16858619b14SKalle Valo #define B43_TXH_PHY1_BW_20U 0x0003 /* 20 MHz upper */
16958619b14SKalle Valo #define B43_TXH_PHY1_BW_40 0x0004 /* 40 MHz */
17058619b14SKalle Valo #define B43_TXH_PHY1_BW_40DUP 0x0005 /* 40 MHz duplicate */
17158619b14SKalle Valo #define B43_TXH_PHY1_MODE 0x0038 /* Mode */
17258619b14SKalle Valo #define B43_TXH_PHY1_MODE_SISO 0x0000 /* SISO */
17358619b14SKalle Valo #define B43_TXH_PHY1_MODE_CDD 0x0008 /* CDD */
17458619b14SKalle Valo #define B43_TXH_PHY1_MODE_STBC 0x0010 /* STBC */
17558619b14SKalle Valo #define B43_TXH_PHY1_MODE_SDM 0x0018 /* SDM */
17658619b14SKalle Valo #define B43_TXH_PHY1_CRATE 0x0700 /* Coding rate */
17758619b14SKalle Valo #define B43_TXH_PHY1_CRATE_1_2 0x0000 /* 1/2 */
17858619b14SKalle Valo #define B43_TXH_PHY1_CRATE_2_3 0x0100 /* 2/3 */
17958619b14SKalle Valo #define B43_TXH_PHY1_CRATE_3_4 0x0200 /* 3/4 */
18058619b14SKalle Valo #define B43_TXH_PHY1_CRATE_4_5 0x0300 /* 4/5 */
18158619b14SKalle Valo #define B43_TXH_PHY1_CRATE_5_6 0x0400 /* 5/6 */
18258619b14SKalle Valo #define B43_TXH_PHY1_CRATE_7_8 0x0600 /* 7/8 */
18358619b14SKalle Valo #define B43_TXH_PHY1_MODUL 0x3800 /* Modulation scheme */
18458619b14SKalle Valo #define B43_TXH_PHY1_MODUL_BPSK 0x0000 /* BPSK */
18558619b14SKalle Valo #define B43_TXH_PHY1_MODUL_QPSK 0x0800 /* QPSK */
18658619b14SKalle Valo #define B43_TXH_PHY1_MODUL_QAM16 0x1000 /* QAM16 */
18758619b14SKalle Valo #define B43_TXH_PHY1_MODUL_QAM64 0x1800 /* QAM64 */
18858619b14SKalle Valo #define B43_TXH_PHY1_MODUL_QAM256 0x2000 /* QAM256 */
18958619b14SKalle Valo
19058619b14SKalle Valo
19158619b14SKalle Valo static inline
b43_txhdr_size(struct b43_wldev * dev)19258619b14SKalle Valo size_t b43_txhdr_size(struct b43_wldev *dev)
19358619b14SKalle Valo {
19458619b14SKalle Valo switch (dev->fw.hdr_format) {
19558619b14SKalle Valo case B43_FW_HDR_598:
19658619b14SKalle Valo return 112 + sizeof(struct b43_plcp_hdr6);
19758619b14SKalle Valo case B43_FW_HDR_410:
19858619b14SKalle Valo return 104 + sizeof(struct b43_plcp_hdr6);
19958619b14SKalle Valo case B43_FW_HDR_351:
20058619b14SKalle Valo return 100 + sizeof(struct b43_plcp_hdr6);
20158619b14SKalle Valo }
20258619b14SKalle Valo return 0;
20358619b14SKalle Valo }
20458619b14SKalle Valo
20558619b14SKalle Valo
20658619b14SKalle Valo int b43_generate_txhdr(struct b43_wldev *dev,
20758619b14SKalle Valo u8 * txhdr,
20858619b14SKalle Valo struct sk_buff *skb_frag,
20958619b14SKalle Valo struct ieee80211_tx_info *txctl, u16 cookie);
21058619b14SKalle Valo
21158619b14SKalle Valo /* Transmit Status */
21258619b14SKalle Valo struct b43_txstatus {
21358619b14SKalle Valo u16 cookie; /* The cookie from the txhdr */
21458619b14SKalle Valo u16 seq; /* Sequence number */
21558619b14SKalle Valo u8 phy_stat; /* PHY TX status */
21658619b14SKalle Valo u8 frame_count; /* Frame transmit count */
21758619b14SKalle Valo u8 rts_count; /* RTS transmit count */
21858619b14SKalle Valo u8 supp_reason; /* Suppression reason */
21958619b14SKalle Valo /* flags */
22058619b14SKalle Valo u8 pm_indicated; /* PM mode indicated to AP */
22158619b14SKalle Valo u8 intermediate; /* Intermediate status notification (not final) */
22258619b14SKalle Valo u8 for_ampdu; /* Status is for an AMPDU (afterburner) */
22358619b14SKalle Valo u8 acked; /* Wireless ACK received */
22458619b14SKalle Valo };
22558619b14SKalle Valo
22658619b14SKalle Valo /* txstatus supp_reason values */
22758619b14SKalle Valo enum {
22858619b14SKalle Valo B43_TXST_SUPP_NONE, /* Not suppressed */
22958619b14SKalle Valo B43_TXST_SUPP_PMQ, /* Suppressed due to PMQ entry */
23058619b14SKalle Valo B43_TXST_SUPP_FLUSH, /* Suppressed due to flush request */
23158619b14SKalle Valo B43_TXST_SUPP_PREV, /* Previous fragment failed */
23258619b14SKalle Valo B43_TXST_SUPP_CHAN, /* Channel mismatch */
23358619b14SKalle Valo B43_TXST_SUPP_LIFE, /* Lifetime expired */
23458619b14SKalle Valo B43_TXST_SUPP_UNDER, /* Buffer underflow */
23558619b14SKalle Valo B43_TXST_SUPP_ABNACK, /* Afterburner NACK */
23658619b14SKalle Valo };
23758619b14SKalle Valo
23858619b14SKalle Valo /* Receive header for v4 firmware. */
23958619b14SKalle Valo struct b43_rxhdr_fw4 {
24058619b14SKalle Valo __le16 frame_len; /* Frame length */
24158619b14SKalle Valo PAD_BYTES(2);
24258619b14SKalle Valo __le16 phy_status0; /* PHY RX Status 0 */
24358619b14SKalle Valo union {
24458619b14SKalle Valo /* RSSI for A/B/G-PHYs */
24558619b14SKalle Valo struct {
24658619b14SKalle Valo __u8 jssi; /* PHY RX Status 1: JSSI */
24758619b14SKalle Valo __u8 sig_qual; /* PHY RX Status 1: Signal Quality */
24858619b14SKalle Valo } __packed;
24958619b14SKalle Valo
25058619b14SKalle Valo /* RSSI for N-PHYs */
25158619b14SKalle Valo struct {
25258619b14SKalle Valo __s8 power0; /* PHY RX Status 1: Power 0 */
25358619b14SKalle Valo __s8 power1; /* PHY RX Status 1: Power 1 */
25458619b14SKalle Valo } __packed;
25558619b14SKalle Valo } __packed;
25658619b14SKalle Valo union {
25758619b14SKalle Valo /* HT-PHY */
25858619b14SKalle Valo struct {
25958619b14SKalle Valo PAD_BYTES(1);
26058619b14SKalle Valo __s8 phy_ht_power0;
26158619b14SKalle Valo } __packed;
26258619b14SKalle Valo
26358619b14SKalle Valo /* RSSI for N-PHYs */
26458619b14SKalle Valo struct {
26558619b14SKalle Valo __s8 power2;
26658619b14SKalle Valo PAD_BYTES(1);
26758619b14SKalle Valo } __packed;
26858619b14SKalle Valo
26958619b14SKalle Valo __le16 phy_status2; /* PHY RX Status 2 */
27058619b14SKalle Valo } __packed;
27158619b14SKalle Valo union {
27258619b14SKalle Valo /* HT-PHY */
27358619b14SKalle Valo struct {
27458619b14SKalle Valo __s8 phy_ht_power1;
27558619b14SKalle Valo __s8 phy_ht_power2;
27658619b14SKalle Valo } __packed;
27758619b14SKalle Valo
27858619b14SKalle Valo __le16 phy_status3; /* PHY RX Status 3 */
27958619b14SKalle Valo } __packed;
28058619b14SKalle Valo union {
28158619b14SKalle Valo /* Tested with 598.314, 644.1001 and 666.2 */
28258619b14SKalle Valo struct {
28358619b14SKalle Valo __le16 phy_status4; /* PHY RX Status 4 */
28458619b14SKalle Valo __le16 phy_status5; /* PHY RX Status 5 */
28558619b14SKalle Valo __le32 mac_status; /* MAC RX status */
28658619b14SKalle Valo __le16 mac_time;
28758619b14SKalle Valo __le16 channel;
28858619b14SKalle Valo } format_598 __packed;
28958619b14SKalle Valo
29058619b14SKalle Valo /* Tested with 351.126, 410.2160, 478.104 and 508.* */
29158619b14SKalle Valo struct {
29258619b14SKalle Valo __le32 mac_status; /* MAC RX status */
29358619b14SKalle Valo __le16 mac_time;
29458619b14SKalle Valo __le16 channel;
29558619b14SKalle Valo } format_351 __packed;
29658619b14SKalle Valo } __packed;
29758619b14SKalle Valo } __packed;
29858619b14SKalle Valo
29958619b14SKalle Valo /* PHY RX Status 0 */
30058619b14SKalle Valo #define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */
30158619b14SKalle Valo #define B43_RX_PHYST0_PLCPHCF 0x0200
30258619b14SKalle Valo #define B43_RX_PHYST0_PLCPFV 0x0100
30358619b14SKalle Valo #define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */
30458619b14SKalle Valo #define B43_RX_PHYST0_LCRS 0x0040
30558619b14SKalle Valo #define B43_RX_PHYST0_ANT 0x0020 /* Antenna */
30658619b14SKalle Valo #define B43_RX_PHYST0_UNSRATE 0x0010
30758619b14SKalle Valo #define B43_RX_PHYST0_CLIP 0x000C
30858619b14SKalle Valo #define B43_RX_PHYST0_CLIP_SHIFT 2
30958619b14SKalle Valo #define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */
31058619b14SKalle Valo #define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */
31158619b14SKalle Valo #define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */
31258619b14SKalle Valo #define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */
31358619b14SKalle Valo #define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */
31458619b14SKalle Valo
31558619b14SKalle Valo /* PHY RX Status 2 */
31658619b14SKalle Valo #define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */
31758619b14SKalle Valo #define B43_RX_PHYST2_LNAG_SHIFT 14
31858619b14SKalle Valo #define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */
31958619b14SKalle Valo #define B43_RX_PHYST2_PNAG_SHIFT 10
32058619b14SKalle Valo #define B43_RX_PHYST2_FOFF 0x03FF /* F offset */
32158619b14SKalle Valo
32258619b14SKalle Valo /* PHY RX Status 3 */
32358619b14SKalle Valo #define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */
32458619b14SKalle Valo #define B43_RX_PHYST3_DIGG_SHIFT 11
32558619b14SKalle Valo #define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */
32658619b14SKalle Valo
32758619b14SKalle Valo /* MAC RX Status */
32858619b14SKalle Valo #define B43_RX_MAC_RXST_VALID 0x01000000 /* PHY RXST valid */
32958619b14SKalle Valo #define B43_RX_MAC_TKIP_MICERR 0x00100000 /* TKIP MIC error */
33058619b14SKalle Valo #define B43_RX_MAC_TKIP_MICATT 0x00080000 /* TKIP MIC attempted */
33158619b14SKalle Valo #define B43_RX_MAC_AGGTYPE 0x00060000 /* Aggregation type */
33258619b14SKalle Valo #define B43_RX_MAC_AGGTYPE_SHIFT 17
33358619b14SKalle Valo #define B43_RX_MAC_AMSDU 0x00010000 /* A-MSDU mask */
33458619b14SKalle Valo #define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon sent flag */
33558619b14SKalle Valo #define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */
33658619b14SKalle Valo #define B43_RX_MAC_KEYIDX_SHIFT 5
33758619b14SKalle Valo #define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */
33858619b14SKalle Valo #define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */
33958619b14SKalle Valo #define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */
34058619b14SKalle Valo #define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */
34158619b14SKalle Valo #define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */
34258619b14SKalle Valo
34358619b14SKalle Valo /* RX channel */
34458619b14SKalle Valo #define B43_RX_CHAN_40MHZ 0x1000 /* 40 Mhz channel width */
34558619b14SKalle Valo #define B43_RX_CHAN_5GHZ 0x0800 /* 5 Ghz band */
34658619b14SKalle Valo #define B43_RX_CHAN_ID 0x07F8 /* Channel ID */
34758619b14SKalle Valo #define B43_RX_CHAN_ID_SHIFT 3
34858619b14SKalle Valo #define B43_RX_CHAN_PHYTYPE 0x0007 /* PHY type */
34958619b14SKalle Valo
35058619b14SKalle Valo
35158619b14SKalle Valo u8 b43_plcp_get_ratecode_cck(const u8 bitrate);
35258619b14SKalle Valo u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate);
35358619b14SKalle Valo
35458619b14SKalle Valo void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp,
35558619b14SKalle Valo const u16 octets, const u8 bitrate);
35658619b14SKalle Valo
35758619b14SKalle Valo void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr);
35858619b14SKalle Valo
35958619b14SKalle Valo void b43_handle_txstatus(struct b43_wldev *dev,
36058619b14SKalle Valo const struct b43_txstatus *status);
36158619b14SKalle Valo bool b43_fill_txstatus_report(struct b43_wldev *dev,
36258619b14SKalle Valo struct ieee80211_tx_info *report,
36358619b14SKalle Valo const struct b43_txstatus *status);
36458619b14SKalle Valo
36558619b14SKalle Valo void b43_tx_suspend(struct b43_wldev *dev);
36658619b14SKalle Valo void b43_tx_resume(struct b43_wldev *dev);
36758619b14SKalle Valo
36858619b14SKalle Valo
36958619b14SKalle Valo /* Helper functions for converting the key-table index from "firmware-format"
37058619b14SKalle Valo * to "raw-format" and back. The firmware API changed for this at some revision.
37158619b14SKalle Valo * We need to account for that here. */
b43_new_kidx_api(struct b43_wldev * dev)37258619b14SKalle Valo static inline int b43_new_kidx_api(struct b43_wldev *dev)
37358619b14SKalle Valo {
37458619b14SKalle Valo /* FIXME: Not sure the change was at rev 351 */
37558619b14SKalle Valo return (dev->fw.rev >= 351);
37658619b14SKalle Valo }
b43_kidx_to_fw(struct b43_wldev * dev,u8 raw_kidx)37758619b14SKalle Valo static inline u8 b43_kidx_to_fw(struct b43_wldev *dev, u8 raw_kidx)
37858619b14SKalle Valo {
37958619b14SKalle Valo u8 firmware_kidx;
38058619b14SKalle Valo if (b43_new_kidx_api(dev)) {
38158619b14SKalle Valo firmware_kidx = raw_kidx;
38258619b14SKalle Valo } else {
38358619b14SKalle Valo if (raw_kidx >= 4) /* Is per STA key? */
38458619b14SKalle Valo firmware_kidx = raw_kidx - 4;
38558619b14SKalle Valo else
38658619b14SKalle Valo firmware_kidx = raw_kidx; /* TX default key */
38758619b14SKalle Valo }
38858619b14SKalle Valo return firmware_kidx;
38958619b14SKalle Valo }
b43_kidx_to_raw(struct b43_wldev * dev,u8 firmware_kidx)39058619b14SKalle Valo static inline u8 b43_kidx_to_raw(struct b43_wldev *dev, u8 firmware_kidx)
39158619b14SKalle Valo {
39258619b14SKalle Valo u8 raw_kidx;
39358619b14SKalle Valo if (b43_new_kidx_api(dev))
39458619b14SKalle Valo raw_kidx = firmware_kidx;
39558619b14SKalle Valo else
39658619b14SKalle Valo raw_kidx = firmware_kidx + 4; /* RX default keys or per STA keys */
39758619b14SKalle Valo return raw_kidx;
39858619b14SKalle Valo }
39958619b14SKalle Valo
40058619b14SKalle Valo /* struct b43_private_tx_info - TX info private to b43.
40158619b14SKalle Valo * The structure is placed in (struct ieee80211_tx_info *)->rate_driver_data
40258619b14SKalle Valo *
40358619b14SKalle Valo * @bouncebuffer: DMA Bouncebuffer (if used)
40458619b14SKalle Valo */
40558619b14SKalle Valo struct b43_private_tx_info {
40658619b14SKalle Valo void *bouncebuffer;
40758619b14SKalle Valo };
40858619b14SKalle Valo
40958619b14SKalle Valo static inline struct b43_private_tx_info *
b43_get_priv_tx_info(struct ieee80211_tx_info * info)41058619b14SKalle Valo b43_get_priv_tx_info(struct ieee80211_tx_info *info)
41158619b14SKalle Valo {
41258619b14SKalle Valo BUILD_BUG_ON(sizeof(struct b43_private_tx_info) >
41358619b14SKalle Valo sizeof(info->rate_driver_data));
41458619b14SKalle Valo return (struct b43_private_tx_info *)info->rate_driver_data;
41558619b14SKalle Valo }
41658619b14SKalle Valo
41758619b14SKalle Valo #endif /* B43_XMIT_H_ */
418