18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef B43_XMIT_H_ 38c2ecf20Sopenharmony_ci#define B43_XMIT_H_ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include "main.h" 68c2ecf20Sopenharmony_ci#include <net/mac80211.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define _b43_declare_plcp_hdr(size) \ 108c2ecf20Sopenharmony_ci struct b43_plcp_hdr##size { \ 118c2ecf20Sopenharmony_ci union { \ 128c2ecf20Sopenharmony_ci __le32 data; \ 138c2ecf20Sopenharmony_ci __u8 raw[size]; \ 148c2ecf20Sopenharmony_ci } __packed; \ 158c2ecf20Sopenharmony_ci } __packed 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci/* struct b43_plcp_hdr4 */ 188c2ecf20Sopenharmony_ci_b43_declare_plcp_hdr(4); 198c2ecf20Sopenharmony_ci/* struct b43_plcp_hdr6 */ 208c2ecf20Sopenharmony_ci_b43_declare_plcp_hdr(6); 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#undef _b43_declare_plcp_hdr 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* TX header for v4 firmware */ 258c2ecf20Sopenharmony_cistruct b43_txhdr { 268c2ecf20Sopenharmony_ci __le32 mac_ctl; /* MAC TX control */ 278c2ecf20Sopenharmony_ci __le16 mac_frame_ctl; /* Copy of the FrameControl field */ 288c2ecf20Sopenharmony_ci __le16 tx_fes_time_norm; /* TX FES Time Normal */ 298c2ecf20Sopenharmony_ci __le16 phy_ctl; /* PHY TX control */ 308c2ecf20Sopenharmony_ci __le16 phy_ctl1; /* PHY TX control word 1 */ 318c2ecf20Sopenharmony_ci __le16 phy_ctl1_fb; /* PHY TX control word 1 for fallback rates */ 328c2ecf20Sopenharmony_ci __le16 phy_ctl1_rts; /* PHY TX control word 1 RTS */ 338c2ecf20Sopenharmony_ci __le16 phy_ctl1_rts_fb; /* PHY TX control word 1 RTS for fallback rates */ 348c2ecf20Sopenharmony_ci __u8 phy_rate; /* PHY rate */ 358c2ecf20Sopenharmony_ci __u8 phy_rate_rts; /* PHY rate for RTS/CTS */ 368c2ecf20Sopenharmony_ci __u8 extra_ft; /* Extra Frame Types */ 378c2ecf20Sopenharmony_ci __u8 chan_radio_code; /* Channel Radio Code */ 388c2ecf20Sopenharmony_ci __u8 iv[16]; /* Encryption IV */ 398c2ecf20Sopenharmony_ci __u8 tx_receiver[6]; /* TX Frame Receiver address */ 408c2ecf20Sopenharmony_ci __le16 tx_fes_time_fb; /* TX FES Time Fallback */ 418c2ecf20Sopenharmony_ci struct b43_plcp_hdr6 rts_plcp_fb; /* RTS fallback PLCP header */ 428c2ecf20Sopenharmony_ci __le16 rts_dur_fb; /* RTS fallback duration */ 438c2ecf20Sopenharmony_ci struct b43_plcp_hdr6 plcp_fb; /* Fallback PLCP header */ 448c2ecf20Sopenharmony_ci __le16 dur_fb; /* Fallback duration */ 458c2ecf20Sopenharmony_ci __le16 mimo_modelen; /* MIMO mode length */ 468c2ecf20Sopenharmony_ci __le16 mimo_ratelen_fb; /* MIMO fallback rate length */ 478c2ecf20Sopenharmony_ci __le32 timeout; /* Timeout */ 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci union { 508c2ecf20Sopenharmony_ci /* Tested with 598.314, 644.1001 and 666.2 */ 518c2ecf20Sopenharmony_ci struct { 528c2ecf20Sopenharmony_ci __le16 mimo_antenna; /* MIMO antenna select */ 538c2ecf20Sopenharmony_ci __le16 preload_size; /* Preload size */ 548c2ecf20Sopenharmony_ci PAD_BYTES(2); 558c2ecf20Sopenharmony_ci __le16 cookie; /* TX frame cookie */ 568c2ecf20Sopenharmony_ci __le16 tx_status; /* TX status */ 578c2ecf20Sopenharmony_ci __le16 max_n_mpdus; 588c2ecf20Sopenharmony_ci __le16 max_a_bytes_mrt; 598c2ecf20Sopenharmony_ci __le16 max_a_bytes_fbr; 608c2ecf20Sopenharmony_ci __le16 min_m_bytes; 618c2ecf20Sopenharmony_ci struct b43_plcp_hdr6 rts_plcp; /* RTS PLCP header */ 628c2ecf20Sopenharmony_ci __u8 rts_frame[16]; /* The RTS frame (if used) */ 638c2ecf20Sopenharmony_ci PAD_BYTES(2); 648c2ecf20Sopenharmony_ci struct b43_plcp_hdr6 plcp; /* Main PLCP header */ 658c2ecf20Sopenharmony_ci } format_598 __packed; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci /* Tested with 410.2160, 478.104 and 508.* */ 688c2ecf20Sopenharmony_ci struct { 698c2ecf20Sopenharmony_ci __le16 mimo_antenna; /* MIMO antenna select */ 708c2ecf20Sopenharmony_ci __le16 preload_size; /* Preload size */ 718c2ecf20Sopenharmony_ci PAD_BYTES(2); 728c2ecf20Sopenharmony_ci __le16 cookie; /* TX frame cookie */ 738c2ecf20Sopenharmony_ci __le16 tx_status; /* TX status */ 748c2ecf20Sopenharmony_ci struct b43_plcp_hdr6 rts_plcp; /* RTS PLCP header */ 758c2ecf20Sopenharmony_ci __u8 rts_frame[16]; /* The RTS frame (if used) */ 768c2ecf20Sopenharmony_ci PAD_BYTES(2); 778c2ecf20Sopenharmony_ci struct b43_plcp_hdr6 plcp; /* Main PLCP header */ 788c2ecf20Sopenharmony_ci } format_410 __packed; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci /* Tested with 351.126 */ 818c2ecf20Sopenharmony_ci struct { 828c2ecf20Sopenharmony_ci PAD_BYTES(2); 838c2ecf20Sopenharmony_ci __le16 cookie; /* TX frame cookie */ 848c2ecf20Sopenharmony_ci __le16 tx_status; /* TX status */ 858c2ecf20Sopenharmony_ci struct b43_plcp_hdr6 rts_plcp; /* RTS PLCP header */ 868c2ecf20Sopenharmony_ci __u8 rts_frame[16]; /* The RTS frame (if used) */ 878c2ecf20Sopenharmony_ci PAD_BYTES(2); 888c2ecf20Sopenharmony_ci struct b43_plcp_hdr6 plcp; /* Main PLCP header */ 898c2ecf20Sopenharmony_ci } format_351 __packed; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci } __packed; 928c2ecf20Sopenharmony_ci} __packed; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_cistruct b43_tx_legacy_rate_phy_ctl_entry { 958c2ecf20Sopenharmony_ci u8 bitrate; 968c2ecf20Sopenharmony_ci u16 coding_rate; 978c2ecf20Sopenharmony_ci u16 modulation; 988c2ecf20Sopenharmony_ci}; 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci/* MAC TX control */ 1018c2ecf20Sopenharmony_ci#define B43_TXH_MAC_RTS_FB_SHORTPRMBL 0x80000000 /* RTS fallback preamble */ 1028c2ecf20Sopenharmony_ci#define B43_TXH_MAC_RTS_SHORTPRMBL 0x40000000 /* RTS main rate preamble */ 1038c2ecf20Sopenharmony_ci#define B43_TXH_MAC_FB_SHORTPRMBL 0x20000000 /* Main fallback preamble */ 1048c2ecf20Sopenharmony_ci#define B43_TXH_MAC_USEFBR 0x10000000 /* Use fallback rate for this AMPDU */ 1058c2ecf20Sopenharmony_ci#define B43_TXH_MAC_KEYIDX 0x0FF00000 /* Security key index */ 1068c2ecf20Sopenharmony_ci#define B43_TXH_MAC_KEYIDX_SHIFT 20 1078c2ecf20Sopenharmony_ci#define B43_TXH_MAC_ALT_TXPWR 0x00080000 /* Use alternate txpwr defined at loc. M_ALT_TXPWR_IDX */ 1088c2ecf20Sopenharmony_ci#define B43_TXH_MAC_KEYALG 0x00070000 /* Security key algorithm */ 1098c2ecf20Sopenharmony_ci#define B43_TXH_MAC_KEYALG_SHIFT 16 1108c2ecf20Sopenharmony_ci#define B43_TXH_MAC_AMIC 0x00008000 /* AMIC */ 1118c2ecf20Sopenharmony_ci#define B43_TXH_MAC_RIFS 0x00004000 /* Use RIFS */ 1128c2ecf20Sopenharmony_ci#define B43_TXH_MAC_LIFETIME 0x00002000 /* Lifetime */ 1138c2ecf20Sopenharmony_ci#define B43_TXH_MAC_FRAMEBURST 0x00001000 /* Frameburst */ 1148c2ecf20Sopenharmony_ci#define B43_TXH_MAC_SENDCTS 0x00000800 /* Send CTS-to-self */ 1158c2ecf20Sopenharmony_ci#define B43_TXH_MAC_AMPDU 0x00000600 /* AMPDU status */ 1168c2ecf20Sopenharmony_ci#define B43_TXH_MAC_AMPDU_MPDU 0x00000000 /* Regular MPDU, not an AMPDU */ 1178c2ecf20Sopenharmony_ci#define B43_TXH_MAC_AMPDU_FIRST 0x00000200 /* First MPDU or AMPDU */ 1188c2ecf20Sopenharmony_ci#define B43_TXH_MAC_AMPDU_INTER 0x00000400 /* Intermediate MPDU or AMPDU */ 1198c2ecf20Sopenharmony_ci#define B43_TXH_MAC_AMPDU_LAST 0x00000600 /* Last (or only) MPDU of AMPDU */ 1208c2ecf20Sopenharmony_ci#define B43_TXH_MAC_40MHZ 0x00000100 /* Use 40 MHz bandwidth */ 1218c2ecf20Sopenharmony_ci#define B43_TXH_MAC_5GHZ 0x00000080 /* 5GHz band */ 1228c2ecf20Sopenharmony_ci#define B43_TXH_MAC_DFCS 0x00000040 /* DFCS */ 1238c2ecf20Sopenharmony_ci#define B43_TXH_MAC_IGNPMQ 0x00000020 /* Ignore PMQ */ 1248c2ecf20Sopenharmony_ci#define B43_TXH_MAC_HWSEQ 0x00000010 /* Use Hardware Sequence Number */ 1258c2ecf20Sopenharmony_ci#define B43_TXH_MAC_STMSDU 0x00000008 /* Start MSDU */ 1268c2ecf20Sopenharmony_ci#define B43_TXH_MAC_SENDRTS 0x00000004 /* Send RTS */ 1278c2ecf20Sopenharmony_ci#define B43_TXH_MAC_LONGFRAME 0x00000002 /* Long frame */ 1288c2ecf20Sopenharmony_ci#define B43_TXH_MAC_ACK 0x00000001 /* Immediate ACK */ 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci/* Extra Frame Types */ 1318c2ecf20Sopenharmony_ci#define B43_TXH_EFT_FB 0x03 /* Data frame fallback encoding */ 1328c2ecf20Sopenharmony_ci#define B43_TXH_EFT_FB_CCK 0x00 /* CCK */ 1338c2ecf20Sopenharmony_ci#define B43_TXH_EFT_FB_OFDM 0x01 /* OFDM */ 1348c2ecf20Sopenharmony_ci#define B43_TXH_EFT_FB_HT 0x02 /* HT */ 1358c2ecf20Sopenharmony_ci#define B43_TXH_EFT_FB_VHT 0x03 /* VHT */ 1368c2ecf20Sopenharmony_ci#define B43_TXH_EFT_RTS 0x0C /* RTS/CTS encoding */ 1378c2ecf20Sopenharmony_ci#define B43_TXH_EFT_RTS_CCK 0x00 /* CCK */ 1388c2ecf20Sopenharmony_ci#define B43_TXH_EFT_RTS_OFDM 0x04 /* OFDM */ 1398c2ecf20Sopenharmony_ci#define B43_TXH_EFT_RTS_HT 0x08 /* HT */ 1408c2ecf20Sopenharmony_ci#define B43_TXH_EFT_RTS_VHT 0x0C /* VHT */ 1418c2ecf20Sopenharmony_ci#define B43_TXH_EFT_RTSFB 0x30 /* RTS/CTS fallback encoding */ 1428c2ecf20Sopenharmony_ci#define B43_TXH_EFT_RTSFB_CCK 0x00 /* CCK */ 1438c2ecf20Sopenharmony_ci#define B43_TXH_EFT_RTSFB_OFDM 0x10 /* OFDM */ 1448c2ecf20Sopenharmony_ci#define B43_TXH_EFT_RTSFB_HT 0x20 /* HT */ 1458c2ecf20Sopenharmony_ci#define B43_TXH_EFT_RTSFB_VHT 0x30 /* VHT */ 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci/* PHY TX control word */ 1488c2ecf20Sopenharmony_ci#define B43_TXH_PHY_ENC 0x0003 /* Data frame encoding */ 1498c2ecf20Sopenharmony_ci#define B43_TXH_PHY_ENC_CCK 0x0000 /* CCK */ 1508c2ecf20Sopenharmony_ci#define B43_TXH_PHY_ENC_OFDM 0x0001 /* OFDM */ 1518c2ecf20Sopenharmony_ci#define B43_TXH_PHY_ENC_HT 0x0002 /* HT */ 1528c2ecf20Sopenharmony_ci#define B43_TXH_PHY_ENC_VHT 0x0003 /* VHT */ 1538c2ecf20Sopenharmony_ci#define B43_TXH_PHY_SHORTPRMBL 0x0010 /* Use short preamble */ 1548c2ecf20Sopenharmony_ci#define B43_TXH_PHY_ANT 0x03C0 /* Antenna selection */ 1558c2ecf20Sopenharmony_ci#define B43_TXH_PHY_ANT0 0x0000 /* Use antenna 0 */ 1568c2ecf20Sopenharmony_ci#define B43_TXH_PHY_ANT1 0x0040 /* Use antenna 1 */ 1578c2ecf20Sopenharmony_ci#define B43_TXH_PHY_ANT01AUTO 0x00C0 /* Use antenna 0/1 auto */ 1588c2ecf20Sopenharmony_ci#define B43_TXH_PHY_ANT2 0x0100 /* Use antenna 2 */ 1598c2ecf20Sopenharmony_ci#define B43_TXH_PHY_ANT3 0x0200 /* Use antenna 3 */ 1608c2ecf20Sopenharmony_ci#define B43_TXH_PHY_TXPWR 0xFC00 /* TX power */ 1618c2ecf20Sopenharmony_ci#define B43_TXH_PHY_TXPWR_SHIFT 10 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci/* PHY TX control word 1 */ 1648c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_BW 0x0007 /* Bandwidth */ 1658c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_BW_10 0x0000 /* 10 MHz */ 1668c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_BW_10U 0x0001 /* 10 MHz upper */ 1678c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_BW_20 0x0002 /* 20 MHz */ 1688c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_BW_20U 0x0003 /* 20 MHz upper */ 1698c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_BW_40 0x0004 /* 40 MHz */ 1708c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_BW_40DUP 0x0005 /* 40 MHz duplicate */ 1718c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_MODE 0x0038 /* Mode */ 1728c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_MODE_SISO 0x0000 /* SISO */ 1738c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_MODE_CDD 0x0008 /* CDD */ 1748c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_MODE_STBC 0x0010 /* STBC */ 1758c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_MODE_SDM 0x0018 /* SDM */ 1768c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_CRATE 0x0700 /* Coding rate */ 1778c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_CRATE_1_2 0x0000 /* 1/2 */ 1788c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_CRATE_2_3 0x0100 /* 2/3 */ 1798c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_CRATE_3_4 0x0200 /* 3/4 */ 1808c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_CRATE_4_5 0x0300 /* 4/5 */ 1818c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_CRATE_5_6 0x0400 /* 5/6 */ 1828c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_CRATE_7_8 0x0600 /* 7/8 */ 1838c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_MODUL 0x3800 /* Modulation scheme */ 1848c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_MODUL_BPSK 0x0000 /* BPSK */ 1858c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_MODUL_QPSK 0x0800 /* QPSK */ 1868c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_MODUL_QAM16 0x1000 /* QAM16 */ 1878c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_MODUL_QAM64 0x1800 /* QAM64 */ 1888c2ecf20Sopenharmony_ci#define B43_TXH_PHY1_MODUL_QAM256 0x2000 /* QAM256 */ 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_cistatic inline 1928c2ecf20Sopenharmony_cisize_t b43_txhdr_size(struct b43_wldev *dev) 1938c2ecf20Sopenharmony_ci{ 1948c2ecf20Sopenharmony_ci switch (dev->fw.hdr_format) { 1958c2ecf20Sopenharmony_ci case B43_FW_HDR_598: 1968c2ecf20Sopenharmony_ci return 112 + sizeof(struct b43_plcp_hdr6); 1978c2ecf20Sopenharmony_ci case B43_FW_HDR_410: 1988c2ecf20Sopenharmony_ci return 104 + sizeof(struct b43_plcp_hdr6); 1998c2ecf20Sopenharmony_ci case B43_FW_HDR_351: 2008c2ecf20Sopenharmony_ci return 100 + sizeof(struct b43_plcp_hdr6); 2018c2ecf20Sopenharmony_ci } 2028c2ecf20Sopenharmony_ci return 0; 2038c2ecf20Sopenharmony_ci} 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ciint b43_generate_txhdr(struct b43_wldev *dev, 2078c2ecf20Sopenharmony_ci u8 * txhdr, 2088c2ecf20Sopenharmony_ci struct sk_buff *skb_frag, 2098c2ecf20Sopenharmony_ci struct ieee80211_tx_info *txctl, u16 cookie); 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci/* Transmit Status */ 2128c2ecf20Sopenharmony_cistruct b43_txstatus { 2138c2ecf20Sopenharmony_ci u16 cookie; /* The cookie from the txhdr */ 2148c2ecf20Sopenharmony_ci u16 seq; /* Sequence number */ 2158c2ecf20Sopenharmony_ci u8 phy_stat; /* PHY TX status */ 2168c2ecf20Sopenharmony_ci u8 frame_count; /* Frame transmit count */ 2178c2ecf20Sopenharmony_ci u8 rts_count; /* RTS transmit count */ 2188c2ecf20Sopenharmony_ci u8 supp_reason; /* Suppression reason */ 2198c2ecf20Sopenharmony_ci /* flags */ 2208c2ecf20Sopenharmony_ci u8 pm_indicated; /* PM mode indicated to AP */ 2218c2ecf20Sopenharmony_ci u8 intermediate; /* Intermediate status notification (not final) */ 2228c2ecf20Sopenharmony_ci u8 for_ampdu; /* Status is for an AMPDU (afterburner) */ 2238c2ecf20Sopenharmony_ci u8 acked; /* Wireless ACK received */ 2248c2ecf20Sopenharmony_ci}; 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci/* txstatus supp_reason values */ 2278c2ecf20Sopenharmony_cienum { 2288c2ecf20Sopenharmony_ci B43_TXST_SUPP_NONE, /* Not suppressed */ 2298c2ecf20Sopenharmony_ci B43_TXST_SUPP_PMQ, /* Suppressed due to PMQ entry */ 2308c2ecf20Sopenharmony_ci B43_TXST_SUPP_FLUSH, /* Suppressed due to flush request */ 2318c2ecf20Sopenharmony_ci B43_TXST_SUPP_PREV, /* Previous fragment failed */ 2328c2ecf20Sopenharmony_ci B43_TXST_SUPP_CHAN, /* Channel mismatch */ 2338c2ecf20Sopenharmony_ci B43_TXST_SUPP_LIFE, /* Lifetime expired */ 2348c2ecf20Sopenharmony_ci B43_TXST_SUPP_UNDER, /* Buffer underflow */ 2358c2ecf20Sopenharmony_ci B43_TXST_SUPP_ABNACK, /* Afterburner NACK */ 2368c2ecf20Sopenharmony_ci}; 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci/* Receive header for v4 firmware. */ 2398c2ecf20Sopenharmony_cistruct b43_rxhdr_fw4 { 2408c2ecf20Sopenharmony_ci __le16 frame_len; /* Frame length */ 2418c2ecf20Sopenharmony_ci PAD_BYTES(2); 2428c2ecf20Sopenharmony_ci __le16 phy_status0; /* PHY RX Status 0 */ 2438c2ecf20Sopenharmony_ci union { 2448c2ecf20Sopenharmony_ci /* RSSI for A/B/G-PHYs */ 2458c2ecf20Sopenharmony_ci struct { 2468c2ecf20Sopenharmony_ci __u8 jssi; /* PHY RX Status 1: JSSI */ 2478c2ecf20Sopenharmony_ci __u8 sig_qual; /* PHY RX Status 1: Signal Quality */ 2488c2ecf20Sopenharmony_ci } __packed; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci /* RSSI for N-PHYs */ 2518c2ecf20Sopenharmony_ci struct { 2528c2ecf20Sopenharmony_ci __s8 power0; /* PHY RX Status 1: Power 0 */ 2538c2ecf20Sopenharmony_ci __s8 power1; /* PHY RX Status 1: Power 1 */ 2548c2ecf20Sopenharmony_ci } __packed; 2558c2ecf20Sopenharmony_ci } __packed; 2568c2ecf20Sopenharmony_ci union { 2578c2ecf20Sopenharmony_ci /* HT-PHY */ 2588c2ecf20Sopenharmony_ci struct { 2598c2ecf20Sopenharmony_ci PAD_BYTES(1); 2608c2ecf20Sopenharmony_ci __s8 phy_ht_power0; 2618c2ecf20Sopenharmony_ci } __packed; 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci /* RSSI for N-PHYs */ 2648c2ecf20Sopenharmony_ci struct { 2658c2ecf20Sopenharmony_ci __s8 power2; 2668c2ecf20Sopenharmony_ci PAD_BYTES(1); 2678c2ecf20Sopenharmony_ci } __packed; 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ci __le16 phy_status2; /* PHY RX Status 2 */ 2708c2ecf20Sopenharmony_ci } __packed; 2718c2ecf20Sopenharmony_ci union { 2728c2ecf20Sopenharmony_ci /* HT-PHY */ 2738c2ecf20Sopenharmony_ci struct { 2748c2ecf20Sopenharmony_ci __s8 phy_ht_power1; 2758c2ecf20Sopenharmony_ci __s8 phy_ht_power2; 2768c2ecf20Sopenharmony_ci } __packed; 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci __le16 phy_status3; /* PHY RX Status 3 */ 2798c2ecf20Sopenharmony_ci } __packed; 2808c2ecf20Sopenharmony_ci union { 2818c2ecf20Sopenharmony_ci /* Tested with 598.314, 644.1001 and 666.2 */ 2828c2ecf20Sopenharmony_ci struct { 2838c2ecf20Sopenharmony_ci __le16 phy_status4; /* PHY RX Status 4 */ 2848c2ecf20Sopenharmony_ci __le16 phy_status5; /* PHY RX Status 5 */ 2858c2ecf20Sopenharmony_ci __le32 mac_status; /* MAC RX status */ 2868c2ecf20Sopenharmony_ci __le16 mac_time; 2878c2ecf20Sopenharmony_ci __le16 channel; 2888c2ecf20Sopenharmony_ci } format_598 __packed; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci /* Tested with 351.126, 410.2160, 478.104 and 508.* */ 2918c2ecf20Sopenharmony_ci struct { 2928c2ecf20Sopenharmony_ci __le32 mac_status; /* MAC RX status */ 2938c2ecf20Sopenharmony_ci __le16 mac_time; 2948c2ecf20Sopenharmony_ci __le16 channel; 2958c2ecf20Sopenharmony_ci } format_351 __packed; 2968c2ecf20Sopenharmony_ci } __packed; 2978c2ecf20Sopenharmony_ci} __packed; 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci/* PHY RX Status 0 */ 3008c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */ 3018c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_PLCPHCF 0x0200 3028c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_PLCPFV 0x0100 3038c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */ 3048c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_LCRS 0x0040 3058c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_ANT 0x0020 /* Antenna */ 3068c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_UNSRATE 0x0010 3078c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_CLIP 0x000C 3088c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_CLIP_SHIFT 2 3098c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */ 3108c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */ 3118c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */ 3128c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */ 3138c2ecf20Sopenharmony_ci#define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */ 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_ci/* PHY RX Status 2 */ 3168c2ecf20Sopenharmony_ci#define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */ 3178c2ecf20Sopenharmony_ci#define B43_RX_PHYST2_LNAG_SHIFT 14 3188c2ecf20Sopenharmony_ci#define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */ 3198c2ecf20Sopenharmony_ci#define B43_RX_PHYST2_PNAG_SHIFT 10 3208c2ecf20Sopenharmony_ci#define B43_RX_PHYST2_FOFF 0x03FF /* F offset */ 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ci/* PHY RX Status 3 */ 3238c2ecf20Sopenharmony_ci#define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */ 3248c2ecf20Sopenharmony_ci#define B43_RX_PHYST3_DIGG_SHIFT 11 3258c2ecf20Sopenharmony_ci#define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */ 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci/* MAC RX Status */ 3288c2ecf20Sopenharmony_ci#define B43_RX_MAC_RXST_VALID 0x01000000 /* PHY RXST valid */ 3298c2ecf20Sopenharmony_ci#define B43_RX_MAC_TKIP_MICERR 0x00100000 /* TKIP MIC error */ 3308c2ecf20Sopenharmony_ci#define B43_RX_MAC_TKIP_MICATT 0x00080000 /* TKIP MIC attempted */ 3318c2ecf20Sopenharmony_ci#define B43_RX_MAC_AGGTYPE 0x00060000 /* Aggregation type */ 3328c2ecf20Sopenharmony_ci#define B43_RX_MAC_AGGTYPE_SHIFT 17 3338c2ecf20Sopenharmony_ci#define B43_RX_MAC_AMSDU 0x00010000 /* A-MSDU mask */ 3348c2ecf20Sopenharmony_ci#define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon sent flag */ 3358c2ecf20Sopenharmony_ci#define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */ 3368c2ecf20Sopenharmony_ci#define B43_RX_MAC_KEYIDX_SHIFT 5 3378c2ecf20Sopenharmony_ci#define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */ 3388c2ecf20Sopenharmony_ci#define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */ 3398c2ecf20Sopenharmony_ci#define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */ 3408c2ecf20Sopenharmony_ci#define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */ 3418c2ecf20Sopenharmony_ci#define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */ 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ci/* RX channel */ 3448c2ecf20Sopenharmony_ci#define B43_RX_CHAN_40MHZ 0x1000 /* 40 Mhz channel width */ 3458c2ecf20Sopenharmony_ci#define B43_RX_CHAN_5GHZ 0x0800 /* 5 Ghz band */ 3468c2ecf20Sopenharmony_ci#define B43_RX_CHAN_ID 0x07F8 /* Channel ID */ 3478c2ecf20Sopenharmony_ci#define B43_RX_CHAN_ID_SHIFT 3 3488c2ecf20Sopenharmony_ci#define B43_RX_CHAN_PHYTYPE 0x0007 /* PHY type */ 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ciu8 b43_plcp_get_ratecode_cck(const u8 bitrate); 3528c2ecf20Sopenharmony_ciu8 b43_plcp_get_ratecode_ofdm(const u8 bitrate); 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_civoid b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp, 3558c2ecf20Sopenharmony_ci const u16 octets, const u8 bitrate); 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_civoid b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr); 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_civoid b43_handle_txstatus(struct b43_wldev *dev, 3608c2ecf20Sopenharmony_ci const struct b43_txstatus *status); 3618c2ecf20Sopenharmony_cibool b43_fill_txstatus_report(struct b43_wldev *dev, 3628c2ecf20Sopenharmony_ci struct ieee80211_tx_info *report, 3638c2ecf20Sopenharmony_ci const struct b43_txstatus *status); 3648c2ecf20Sopenharmony_ci 3658c2ecf20Sopenharmony_civoid b43_tx_suspend(struct b43_wldev *dev); 3668c2ecf20Sopenharmony_civoid b43_tx_resume(struct b43_wldev *dev); 3678c2ecf20Sopenharmony_ci 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ci/* Helper functions for converting the key-table index from "firmware-format" 3708c2ecf20Sopenharmony_ci * to "raw-format" and back. The firmware API changed for this at some revision. 3718c2ecf20Sopenharmony_ci * We need to account for that here. */ 3728c2ecf20Sopenharmony_cistatic inline int b43_new_kidx_api(struct b43_wldev *dev) 3738c2ecf20Sopenharmony_ci{ 3748c2ecf20Sopenharmony_ci /* FIXME: Not sure the change was at rev 351 */ 3758c2ecf20Sopenharmony_ci return (dev->fw.rev >= 351); 3768c2ecf20Sopenharmony_ci} 3778c2ecf20Sopenharmony_cistatic inline u8 b43_kidx_to_fw(struct b43_wldev *dev, u8 raw_kidx) 3788c2ecf20Sopenharmony_ci{ 3798c2ecf20Sopenharmony_ci u8 firmware_kidx; 3808c2ecf20Sopenharmony_ci if (b43_new_kidx_api(dev)) { 3818c2ecf20Sopenharmony_ci firmware_kidx = raw_kidx; 3828c2ecf20Sopenharmony_ci } else { 3838c2ecf20Sopenharmony_ci if (raw_kidx >= 4) /* Is per STA key? */ 3848c2ecf20Sopenharmony_ci firmware_kidx = raw_kidx - 4; 3858c2ecf20Sopenharmony_ci else 3868c2ecf20Sopenharmony_ci firmware_kidx = raw_kidx; /* TX default key */ 3878c2ecf20Sopenharmony_ci } 3888c2ecf20Sopenharmony_ci return firmware_kidx; 3898c2ecf20Sopenharmony_ci} 3908c2ecf20Sopenharmony_cistatic inline u8 b43_kidx_to_raw(struct b43_wldev *dev, u8 firmware_kidx) 3918c2ecf20Sopenharmony_ci{ 3928c2ecf20Sopenharmony_ci u8 raw_kidx; 3938c2ecf20Sopenharmony_ci if (b43_new_kidx_api(dev)) 3948c2ecf20Sopenharmony_ci raw_kidx = firmware_kidx; 3958c2ecf20Sopenharmony_ci else 3968c2ecf20Sopenharmony_ci raw_kidx = firmware_kidx + 4; /* RX default keys or per STA keys */ 3978c2ecf20Sopenharmony_ci return raw_kidx; 3988c2ecf20Sopenharmony_ci} 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ci/* struct b43_private_tx_info - TX info private to b43. 4018c2ecf20Sopenharmony_ci * The structure is placed in (struct ieee80211_tx_info *)->rate_driver_data 4028c2ecf20Sopenharmony_ci * 4038c2ecf20Sopenharmony_ci * @bouncebuffer: DMA Bouncebuffer (if used) 4048c2ecf20Sopenharmony_ci */ 4058c2ecf20Sopenharmony_cistruct b43_private_tx_info { 4068c2ecf20Sopenharmony_ci void *bouncebuffer; 4078c2ecf20Sopenharmony_ci}; 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_cistatic inline struct b43_private_tx_info * 4108c2ecf20Sopenharmony_cib43_get_priv_tx_info(struct ieee80211_tx_info *info) 4118c2ecf20Sopenharmony_ci{ 4128c2ecf20Sopenharmony_ci BUILD_BUG_ON(sizeof(struct b43_private_tx_info) > 4138c2ecf20Sopenharmony_ci sizeof(info->rate_driver_data)); 4148c2ecf20Sopenharmony_ci return (struct b43_private_tx_info *)info->rate_driver_data; 4158c2ecf20Sopenharmony_ci} 4168c2ecf20Sopenharmony_ci 4178c2ecf20Sopenharmony_ci#endif /* B43_XMIT_H_ */ 418