xref: /wlan-driver/fw-api/fw/htt_common.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2012-2016, 2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
6  *
7  *
8  * Permission to use, copy, modify, and/or distribute this software for
9  * any purpose with or without fee is hereby granted, provided that the
10  * above copyright notice and this permission notice appear in all
11  * copies.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
14  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
16  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
17  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
18  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20  * PERFORMANCE OF THIS SOFTWARE.
21  */
22 
23 /*
24  * This file was originally distributed by Qualcomm Atheros, Inc.
25  * under proprietary terms before Copyright ownership was assigned
26  * to the Linux Foundation.
27  */
28 
29 /**
30  * @file htt_common.h
31  *
32  * @details the public header file of HTT layer shared between host and firmware
33  */
34 
35 #ifndef _HTT_COMMON_H_
36 #define _HTT_COMMON_H_
37 
38 #include <htt_deps.h> /* A_UINT32 */
39 
40 enum htt_sec_type {
41     htt_sec_type_none,
42     htt_sec_type_wep128,
43     htt_sec_type_wep104,
44     htt_sec_type_wep40,
45     htt_sec_type_tkip,
46     htt_sec_type_tkip_nomic,
47     htt_sec_type_aes_ccmp,
48     htt_sec_type_wapi,
49     htt_sec_type_aes_ccmp_256,
50     htt_sec_type_aes_gcmp,
51     htt_sec_type_aes_gcmp_256,
52 
53     /* keep this last! */
54     htt_num_sec_types
55 };
56 
57 enum htt_rx_ind_mpdu_status {
58     HTT_RX_IND_MPDU_STATUS_UNKNOWN = 0x0,
59     HTT_RX_IND_MPDU_STATUS_OK,
60     HTT_RX_IND_MPDU_STATUS_ERR_FCS,
61     HTT_RX_IND_MPDU_STATUS_ERR_DUP,
62     HTT_RX_IND_MPDU_STATUS_ERR_REPLAY,
63     HTT_RX_IND_MPDU_STATUS_ERR_INV_PEER,
64     HTT_RX_IND_MPDU_STATUS_UNAUTH_PEER, /* only accept EAPOL frames */
65     HTT_RX_IND_MPDU_STATUS_OUT_OF_SYNC,
66     HTT_RX_IND_MPDU_STATUS_MGMT_CTRL, /* Non-data in promiscuous mode */
67     HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR,
68     HTT_RX_IND_MPDU_STATUS_DECRYPT_ERR,
69     HTT_RX_IND_MPDU_STATUS_MPDU_LENGTH_ERR,
70     HTT_RX_IND_MPDU_STATUS_ENCRYPT_REQUIRED_ERR,
71     HTT_RX_IND_MPDU_STATUS_PRIVACY_ERR,
72 
73     /*
74      * MISC: discard for unspecified reasons.
75      * Leave this enum value last.
76      */
77     HTT_RX_IND_MPDU_STATUS_ERR_MISC = 0xFF
78 };
79 
80 #define HTT_INVALID_PEER    0xffff
81 #define HTT_INVALID_VDEV    0xff
82 
83 #define HTT_NON_QOS_TID     16
84 #define HTT_INVALID_TID     31
85 
86 #define HTT_TX_EXT_TID_DEFAULT              0
87 #define HTT_TX_EXT_TID_NON_QOS_MCAST_BCAST HTT_NON_QOS_TID
88 #define HTT_TX_EXT_TID_MGMT                17
89 #define HTT_TX_EXT_TID_INVALID             HTT_INVALID_TID
90 #define HTT_TX_EXT_TID_NONPAUSE            19
91 
92 
93 
94 #define HTT_TX_L3_CKSUM_OFFLOAD      1
95 #define HTT_TX_L4_CKSUM_OFFLOAD      2
96 
97 
98 /**
99  * @brief General specification of the tx frame contents
100  *
101  * @details
102  * For efficiency, the HTT packet type values correspond
103  * to the bit positions of the WAL packet type values, so the
104  * translation is a simple shift operation.
105  * The exception is the "mgmt" type, which specifies frame payload
106  * type rather than L2 header type.
107  */
108 enum htt_pkt_type {
109     htt_pkt_type_raw = 0,
110     htt_pkt_type_native_wifi = 1,
111     htt_pkt_type_ethernet = 2,
112     htt_pkt_type_mgmt = 3,
113     htt_pkt_type_eth2 = 4,
114 
115     /* keep this last */
116     htt_pkt_num_types
117 };
118 
119 /*
120  * TX MSDU ID partition -
121  * FW supports bigger MSDU ID partition which is defined as
122  * HTT_TX_IPA_NEW_MSDU_ID_SPACE_BEGIN
123  * When both host and FW support new partition, FW uses
124  * HTT_TX_IPA_NEW_MSDU_ID_SPACE_BEGIN
125  * If host doesn't support, FW falls back to HTT_TX_IPA_MSDU_ID_SPACE_BEGIN
126  * Handshaking is done through WMI_READY and WMI_INIT
127  */
128 #define HTT_TX_HOST_MSDU_ID_SPACE_BEGIN 0
129 #define HTT_TX_IPA_MSDU_ID_SPACE_BEGIN  3000
130 #define TGT_RX2TX_MSDU_ID_SPACE_BEGIN 6000
131 #define HTT_TX_IPA_NEW_MSDU_ID_SPACE_BEGIN  8192  /* = 0x2000 = b10,0000,0000,0000 */
132 #define TGT_RX2TX_NEW_MSDU_ID_SPACE_BEGIN   12288 /* = 0x3000 = b11,0000,0000,0000 */
133 
134 /* HTT Access Category values */
135 enum HTT_AC_WMM {
136     /* WMM Access Categories */
137     HTT_AC_WMM_BE         = 0x0,
138     HTT_AC_WMM_BK         = 0x1,
139     HTT_AC_WMM_VI         = 0x2,
140     HTT_AC_WMM_VO         = 0x3,
141 
142     HTT_NUM_AC_WMM        = 0x4,
143 
144     /* extension Access Categories */
145     HTT_AC_EXT_NON_QOS    = 0x4,
146     HTT_AC_EXT_UCAST_MGMT = 0x5,
147     HTT_AC_EXT_MCAST_DATA = 0x6,
148     HTT_AC_EXT_MCAST_MGMT = 0x7,
149 };
150 
151 enum HTT_AC_WMM_MASK {
152     /* WMM Access Categories */
153     HTT_AC_WMM_BE_MASK = (1 << HTT_AC_WMM_BE),
154     HTT_AC_WMM_BK_MASK = (1 << HTT_AC_WMM_BK),
155     HTT_AC_WMM_VI_MASK = (1 << HTT_AC_WMM_VI),
156     HTT_AC_WMM_VO_MASK = (1 << HTT_AC_WMM_VO),
157     /* extension Access Categories */
158     HTT_AC_EXT_NON_QOS_MASK    = (1 << HTT_AC_EXT_NON_QOS),
159     HTT_AC_EXT_UCAST_MGMT_MASK = (1 << HTT_AC_EXT_UCAST_MGMT),
160     HTT_AC_EXT_MCAST_DATA_MASK = (1 << HTT_AC_EXT_MCAST_DATA),
161     HTT_AC_EXT_MCAST_MGMT_MASK = (1 << HTT_AC_EXT_MCAST_MGMT),
162 };
163 #define HTT_AC_MASK_WMM \
164     (HTT_AC_WMM_BE_MASK | HTT_AC_WMM_BK_MASK | \
165      HTT_AC_WMM_VI_MASK | HTT_AC_WMM_VO_MASK)
166 #define HTT_AC_MASK_EXT \
167     (HTT_AC_EXT_NON_QOS_MASK | HTT_AC_EXT_UCAST_MGMT_MASK | \
168     HTT_AC_EXT_MCAST_DATA_MASK | HTT_AC_EXT_MCAST_MGMT_MASK)
169 #define HTT_AC_MASK_ALL (HTT_AC_MASK_WMM | HTT_AC_MASK_EXT)
170 
171 /** 2 word representation of MAC addr */
172 typedef struct {
173     /** upper 4 bytes of  MAC address */
174     A_UINT32 mac_addr31to0;
175     /** lower 2 bytes of  MAC address */
176     A_UINT32 mac_addr47to32;
177 } htt_mac_addr;
178 
179 #define HTT_STATS_MAX_CHAINS 8
180 
181 #endif /* _HTT_COMMON_H_ */
182