0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 #ifndef __CARL9170_SHARED_WLAN_H
0040 #define __CARL9170_SHARED_WLAN_H
0041
0042 #include "fwcmd.h"
0043
0044 #define AR9170_RX_PHY_RATE_CCK_1M 0x0a
0045 #define AR9170_RX_PHY_RATE_CCK_2M 0x14
0046 #define AR9170_RX_PHY_RATE_CCK_5M 0x37
0047 #define AR9170_RX_PHY_RATE_CCK_11M 0x6e
0048
0049 #define AR9170_ENC_ALG_NONE 0x0
0050 #define AR9170_ENC_ALG_WEP64 0x1
0051 #define AR9170_ENC_ALG_TKIP 0x2
0052 #define AR9170_ENC_ALG_AESCCMP 0x4
0053 #define AR9170_ENC_ALG_WEP128 0x5
0054 #define AR9170_ENC_ALG_WEP256 0x6
0055 #define AR9170_ENC_ALG_CENC 0x7
0056
0057 #define AR9170_RX_ENC_SOFTWARE 0x8
0058
0059 #define AR9170_RX_STATUS_MODULATION 0x03
0060 #define AR9170_RX_STATUS_MODULATION_S 0
0061 #define AR9170_RX_STATUS_MODULATION_CCK 0x00
0062 #define AR9170_RX_STATUS_MODULATION_OFDM 0x01
0063 #define AR9170_RX_STATUS_MODULATION_HT 0x02
0064 #define AR9170_RX_STATUS_MODULATION_DUPOFDM 0x03
0065
0066
0067 #define AR9170_RX_STATUS_SHORT_PREAMBLE 0x08
0068 #define AR9170_RX_STATUS_GREENFIELD 0x08
0069
0070 #define AR9170_RX_STATUS_MPDU 0x30
0071 #define AR9170_RX_STATUS_MPDU_S 4
0072 #define AR9170_RX_STATUS_MPDU_SINGLE 0x00
0073 #define AR9170_RX_STATUS_MPDU_FIRST 0x20
0074 #define AR9170_RX_STATUS_MPDU_MIDDLE 0x30
0075 #define AR9170_RX_STATUS_MPDU_LAST 0x10
0076
0077 #define AR9170_RX_STATUS_CONT_AGGR 0x40
0078 #define AR9170_RX_STATUS_TOTAL_ERROR 0x80
0079
0080 #define AR9170_RX_ERROR_RXTO 0x01
0081 #define AR9170_RX_ERROR_OVERRUN 0x02
0082 #define AR9170_RX_ERROR_DECRYPT 0x04
0083 #define AR9170_RX_ERROR_FCS 0x08
0084 #define AR9170_RX_ERROR_WRONG_RA 0x10
0085 #define AR9170_RX_ERROR_PLCP 0x20
0086 #define AR9170_RX_ERROR_MMIC 0x40
0087
0088
0089 #define AR9170_TX_MAC_PROT_RTS 0x0001
0090 #define AR9170_TX_MAC_PROT_CTS 0x0002
0091 #define AR9170_TX_MAC_PROT 0x0003
0092
0093 #define AR9170_TX_MAC_NO_ACK 0x0004
0094
0095 #define AR9170_TX_MAC_BACKOFF 0x0008
0096 #define AR9170_TX_MAC_BURST 0x0010
0097 #define AR9170_TX_MAC_AGGR 0x0020
0098
0099
0100 #define AR9170_TX_MAC_ENCR_NONE 0x0000
0101 #define AR9170_TX_MAC_ENCR_RC4 0x0040
0102 #define AR9170_TX_MAC_ENCR_CENC 0x0080
0103 #define AR9170_TX_MAC_ENCR_AES 0x00c0
0104
0105 #define AR9170_TX_MAC_MMIC 0x0100
0106 #define AR9170_TX_MAC_HW_DURATION 0x0200
0107 #define AR9170_TX_MAC_QOS_S 10
0108 #define AR9170_TX_MAC_QOS 0x0c00
0109 #define AR9170_TX_MAC_DISABLE_TXOP 0x1000
0110 #define AR9170_TX_MAC_TXOP_RIFS 0x2000
0111 #define AR9170_TX_MAC_IMM_BA 0x4000
0112
0113
0114 #define AR9170_TX_PHY_MOD_CCK 0x00000000
0115 #define AR9170_TX_PHY_MOD_OFDM 0x00000001
0116 #define AR9170_TX_PHY_MOD_HT 0x00000002
0117
0118
0119 #define AR9170_TX_PHY_SHORT_PREAMBLE 0x00000004
0120 #define AR9170_TX_PHY_GREENFIELD 0x00000004
0121
0122 #define AR9170_TX_PHY_BW_S 3
0123 #define AR9170_TX_PHY_BW (3 << AR9170_TX_PHY_BW_SHIFT)
0124 #define AR9170_TX_PHY_BW_20MHZ 0
0125 #define AR9170_TX_PHY_BW_40MHZ 2
0126 #define AR9170_TX_PHY_BW_40MHZ_DUP 3
0127
0128 #define AR9170_TX_PHY_TX_HEAVY_CLIP_S 6
0129 #define AR9170_TX_PHY_TX_HEAVY_CLIP (7 << \
0130 AR9170_TX_PHY_TX_HEAVY_CLIP_S)
0131
0132 #define AR9170_TX_PHY_TX_PWR_S 9
0133 #define AR9170_TX_PHY_TX_PWR (0x3f << \
0134 AR9170_TX_PHY_TX_PWR_S)
0135
0136 #define AR9170_TX_PHY_TXCHAIN_S 15
0137 #define AR9170_TX_PHY_TXCHAIN (7 << \
0138 AR9170_TX_PHY_TXCHAIN_S)
0139 #define AR9170_TX_PHY_TXCHAIN_1 1
0140
0141 #define AR9170_TX_PHY_TXCHAIN_2 5
0142
0143 #define AR9170_TX_PHY_MCS_S 18
0144 #define AR9170_TX_PHY_MCS (0x7f << \
0145 AR9170_TX_PHY_MCS_S)
0146
0147 #define AR9170_TX_PHY_RATE_CCK_1M 0x0
0148 #define AR9170_TX_PHY_RATE_CCK_2M 0x1
0149 #define AR9170_TX_PHY_RATE_CCK_5M 0x2
0150 #define AR9170_TX_PHY_RATE_CCK_11M 0x3
0151
0152
0153 #define AR9170_TXRX_PHY_RATE_OFDM_6M 0xb
0154 #define AR9170_TXRX_PHY_RATE_OFDM_9M 0xf
0155 #define AR9170_TXRX_PHY_RATE_OFDM_12M 0xa
0156 #define AR9170_TXRX_PHY_RATE_OFDM_18M 0xe
0157 #define AR9170_TXRX_PHY_RATE_OFDM_24M 0x9
0158 #define AR9170_TXRX_PHY_RATE_OFDM_36M 0xd
0159 #define AR9170_TXRX_PHY_RATE_OFDM_48M 0x8
0160 #define AR9170_TXRX_PHY_RATE_OFDM_54M 0xc
0161
0162 #define AR9170_TXRX_PHY_RATE_HT_MCS0 0x0
0163 #define AR9170_TXRX_PHY_RATE_HT_MCS1 0x1
0164 #define AR9170_TXRX_PHY_RATE_HT_MCS2 0x2
0165 #define AR9170_TXRX_PHY_RATE_HT_MCS3 0x3
0166 #define AR9170_TXRX_PHY_RATE_HT_MCS4 0x4
0167 #define AR9170_TXRX_PHY_RATE_HT_MCS5 0x5
0168 #define AR9170_TXRX_PHY_RATE_HT_MCS6 0x6
0169 #define AR9170_TXRX_PHY_RATE_HT_MCS7 0x7
0170 #define AR9170_TXRX_PHY_RATE_HT_MCS8 0x8
0171 #define AR9170_TXRX_PHY_RATE_HT_MCS9 0x9
0172 #define AR9170_TXRX_PHY_RATE_HT_MCS10 0xa
0173 #define AR9170_TXRX_PHY_RATE_HT_MCS11 0xb
0174 #define AR9170_TXRX_PHY_RATE_HT_MCS12 0xc
0175 #define AR9170_TXRX_PHY_RATE_HT_MCS13 0xd
0176 #define AR9170_TXRX_PHY_RATE_HT_MCS14 0xe
0177 #define AR9170_TXRX_PHY_RATE_HT_MCS15 0xf
0178
0179 #define AR9170_TX_PHY_SHORT_GI 0x80000000
0180
0181 #ifdef __CARL9170FW__
0182 struct ar9170_tx_hw_mac_control {
0183 union {
0184 struct {
0185
0186
0187
0188
0189 u8 erp_prot:2;
0190 u8 no_ack:1;
0191 u8 backoff:1;
0192 u8 burst:1;
0193 u8 ampdu:1;
0194
0195 u8 enc_mode:2;
0196
0197 u8 hw_mmic:1;
0198 u8 hw_duration:1;
0199
0200 u8 qos_queue:2;
0201
0202 u8 disable_txop:1;
0203 u8 txop_rifs:1;
0204
0205 u8 ba_end:1;
0206 u8 probe:1;
0207 } __packed;
0208
0209 __le16 set;
0210 } __packed;
0211 } __packed;
0212
0213 struct ar9170_tx_hw_phy_control {
0214 union {
0215 struct {
0216
0217
0218
0219
0220 u8 modulation:2;
0221 u8 preamble:1;
0222 u8 bandwidth:2;
0223 u8:1;
0224 u8 heavy_clip:3;
0225 u8 tx_power:6;
0226 u8 chains:3;
0227 u8 mcs:7;
0228 u8:6;
0229 u8 short_gi:1;
0230 } __packed;
0231
0232 __le32 set;
0233 } __packed;
0234 } __packed;
0235
0236 struct ar9170_tx_rate_info {
0237 u8 tries:3;
0238 u8 erp_prot:2;
0239 u8 ampdu:1;
0240 u8 free:2;
0241 } __packed;
0242
0243 struct carl9170_tx_superdesc {
0244 __le16 len;
0245 u8 rix;
0246 u8 cnt;
0247 u8 cookie;
0248 u8 ampdu_density:3;
0249 u8 ampdu_factor:2;
0250 u8 ampdu_commit_density:1;
0251 u8 ampdu_commit_factor:1;
0252 u8 ampdu_unused_bit:1;
0253 u8 queue:2;
0254 u8 assign_seq:1;
0255 u8 vif_id:3;
0256 u8 fill_in_tsf:1;
0257 u8 cab:1;
0258 u8 padding2;
0259 struct ar9170_tx_rate_info ri[CARL9170_TX_MAX_RATES];
0260 struct ar9170_tx_hw_phy_control rr[CARL9170_TX_MAX_RETRY_RATES];
0261 } __packed;
0262
0263 struct ar9170_tx_hwdesc {
0264 __le16 length;
0265 struct ar9170_tx_hw_mac_control mac;
0266 struct ar9170_tx_hw_phy_control phy;
0267 } __packed;
0268
0269 struct ar9170_tx_frame {
0270 struct ar9170_tx_hwdesc hdr;
0271
0272 union {
0273 struct ieee80211_hdr i3e;
0274 u8 payload[0];
0275 } data;
0276 } __packed;
0277
0278 struct carl9170_tx_superframe {
0279 struct carl9170_tx_superdesc s;
0280 struct ar9170_tx_frame f;
0281 } __packed __aligned(4);
0282
0283 #endif
0284
0285 struct _ar9170_tx_hwdesc {
0286 __le16 length;
0287 __le16 mac_control;
0288 __le32 phy_control;
0289 } __packed;
0290
0291 #define CARL9170_TX_SUPER_AMPDU_DENSITY_S 0
0292 #define CARL9170_TX_SUPER_AMPDU_DENSITY 0x7
0293 #define CARL9170_TX_SUPER_AMPDU_FACTOR 0x18
0294 #define CARL9170_TX_SUPER_AMPDU_FACTOR_S 3
0295 #define CARL9170_TX_SUPER_AMPDU_COMMIT_DENSITY 0x20
0296 #define CARL9170_TX_SUPER_AMPDU_COMMIT_DENSITY_S 5
0297 #define CARL9170_TX_SUPER_AMPDU_COMMIT_FACTOR 0x40
0298 #define CARL9170_TX_SUPER_AMPDU_COMMIT_FACTOR_S 6
0299
0300 #define CARL9170_TX_SUPER_MISC_QUEUE 0x3
0301 #define CARL9170_TX_SUPER_MISC_QUEUE_S 0
0302 #define CARL9170_TX_SUPER_MISC_ASSIGN_SEQ 0x4
0303 #define CARL9170_TX_SUPER_MISC_VIF_ID 0x38
0304 #define CARL9170_TX_SUPER_MISC_VIF_ID_S 3
0305 #define CARL9170_TX_SUPER_MISC_FILL_IN_TSF 0x40
0306 #define CARL9170_TX_SUPER_MISC_CAB 0x80
0307
0308 #define CARL9170_TX_SUPER_RI_TRIES 0x7
0309 #define CARL9170_TX_SUPER_RI_TRIES_S 0
0310 #define CARL9170_TX_SUPER_RI_ERP_PROT 0x18
0311 #define CARL9170_TX_SUPER_RI_ERP_PROT_S 3
0312 #define CARL9170_TX_SUPER_RI_AMPDU 0x20
0313 #define CARL9170_TX_SUPER_RI_AMPDU_S 5
0314
0315 struct _carl9170_tx_superdesc {
0316 __le16 len;
0317 u8 rix;
0318 u8 cnt;
0319 u8 cookie;
0320 u8 ampdu_settings;
0321 u8 misc;
0322 u8 padding;
0323 u8 ri[CARL9170_TX_MAX_RATES];
0324 __le32 rr[CARL9170_TX_MAX_RETRY_RATES];
0325 } __packed;
0326
0327 struct _carl9170_tx_superframe {
0328 struct _carl9170_tx_superdesc s;
0329 struct _ar9170_tx_hwdesc f;
0330 u8 frame_data[];
0331 } __packed __aligned(4);
0332
0333 #define CARL9170_TX_SUPERDESC_LEN 24
0334 #define AR9170_TX_HWDESC_LEN 8
0335 #define CARL9170_TX_SUPERFRAME_LEN (CARL9170_TX_SUPERDESC_LEN + \
0336 AR9170_TX_HWDESC_LEN)
0337
0338 struct ar9170_rx_head {
0339 u8 plcp[12];
0340 } __packed;
0341
0342 #define AR9170_RX_HEAD_LEN 12
0343
0344 struct ar9170_rx_phystatus {
0345 union {
0346 struct {
0347 u8 rssi_ant0, rssi_ant1, rssi_ant2,
0348 rssi_ant0x, rssi_ant1x, rssi_ant2x,
0349 rssi_combined;
0350 } __packed;
0351 u8 rssi[7];
0352 } __packed;
0353
0354 u8 evm_stream0[6], evm_stream1[6];
0355 u8 phy_err;
0356 } __packed;
0357
0358 #define AR9170_RX_PHYSTATUS_LEN 20
0359
0360 struct ar9170_rx_macstatus {
0361 u8 SAidx, DAidx;
0362 u8 error;
0363 u8 status;
0364 } __packed;
0365
0366 #define AR9170_RX_MACSTATUS_LEN 4
0367
0368 struct ar9170_rx_frame_single {
0369 struct ar9170_rx_head phy_head;
0370 struct ieee80211_hdr i3e __packed __aligned(2);
0371 struct ar9170_rx_phystatus phy_tail;
0372 struct ar9170_rx_macstatus macstatus;
0373 };
0374
0375 struct ar9170_rx_frame_head {
0376 struct ar9170_rx_head phy_head;
0377 struct ieee80211_hdr i3e __packed __aligned(2);
0378 struct ar9170_rx_macstatus macstatus;
0379 };
0380
0381 struct ar9170_rx_frame_middle {
0382 struct ieee80211_hdr i3e __packed __aligned(2);
0383 struct ar9170_rx_macstatus macstatus;
0384 };
0385
0386 struct ar9170_rx_frame_tail {
0387 struct ieee80211_hdr i3e __packed __aligned(2);
0388 struct ar9170_rx_phystatus phy_tail;
0389 struct ar9170_rx_macstatus macstatus;
0390 };
0391
0392 struct ar9170_rx_frame {
0393 union {
0394 struct ar9170_rx_frame_single single;
0395 struct ar9170_rx_frame_head head;
0396 struct ar9170_rx_frame_middle middle;
0397 struct ar9170_rx_frame_tail tail;
0398 };
0399 };
0400
0401 static inline u8 ar9170_get_decrypt_type(struct ar9170_rx_macstatus *t)
0402 {
0403 return (t->SAidx & 0xc0) >> 4 |
0404 (t->DAidx & 0xc0) >> 6;
0405 }
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424 enum ar9170_txq {
0425 AR9170_TXQ_BK = 0,
0426 AR9170_TXQ_BE,
0427 AR9170_TXQ_VI,
0428 AR9170_TXQ_VO,
0429
0430 __AR9170_NUM_TXQ,
0431 };
0432
0433 #define AR9170_TXQ_DEPTH 32
0434
0435 #endif