Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Govind Singh | 55b8daf | 2016-06-09 16:02:47 +0530 | [diff] [blame] | 2 | * Copyright (c) 2011-2012, 2014, 2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | #ifndef _WAL_RX_DESC__H_ |
| 29 | #define _WAL_RX_DESC__H_ |
| 30 | |
| 31 | #if defined(ATH_TARGET) |
| 32 | #include <athdefs.h> /* A_UINT8 */ |
| 33 | #else |
| 34 | #include <a_types.h> /* A_UINT8 */ |
| 35 | #endif |
| 36 | |
| 37 | /* |
| 38 | * As this header is used by host also, |
| 39 | * and host will access target registers by target reg tbl, |
| 40 | * so disable direct-reference here for host. |
| 41 | * |
| 42 | */ |
| 43 | #if !defined(ATH_PERF_PWR_OFFLOAD) |
Govind Singh | 55b8daf | 2016-06-09 16:02:47 +0530 | [diff] [blame] | 44 | #if defined(CONFIG_AR900B_SUPPORT) || defined(AR900B) |
| 45 | #include <hw/interface/rx_location_info.h> |
| 46 | #include <hw/interface/rx_pkt_end.h> |
| 47 | #include <hw/interface/rx_phy_ppdu_end.h> |
| 48 | #include <hw/interface/rx_timing_offset.h> |
| 49 | #include <hw/interface/rx_location_info.h> |
| 50 | #include <hw/tlv/rx_attention.h> |
| 51 | #include <hw/tlv/rx_frag_info.h> |
| 52 | #include <hw/tlv/rx_msdu_start.h> |
| 53 | #include <hw/tlv/rx_msdu_end.h> |
| 54 | #include <hw/tlv/rx_mpdu_start.h> |
| 55 | #include <hw/tlv/rx_mpdu_end.h> |
| 56 | #include <hw/tlv/rx_ppdu_start.h> |
| 57 | #include <hw/tlv/rx_ppdu_end.h> |
| 58 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 59 | /* HW rx descriptor definitions */ |
Govind Singh | 55b8daf | 2016-06-09 16:02:47 +0530 | [diff] [blame] | 60 | #include <mac_descriptors/rx_attention.h> |
| 61 | #include <mac_descriptors/rx_frag_info.h> |
| 62 | #include <mac_descriptors/rx_msdu_start.h> |
| 63 | #include <mac_descriptors/rx_msdu_end.h> |
| 64 | #include <mac_descriptors/rx_mpdu_start.h> |
| 65 | #include <mac_descriptors/rx_mpdu_end.h> |
| 66 | #include <mac_descriptors/rx_ppdu_start.h> |
| 67 | #include <mac_descriptors/rx_ppdu_end.h> |
| 68 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 69 | /* |
| 70 | * This struct defines the basic descriptor information, which is |
| 71 | * written by the 11ac HW MAC into the WAL's rx status descriptor |
| 72 | * ring. |
| 73 | */ |
| 74 | struct hw_rx_desc_base { |
| 75 | struct rx_attention attention; |
| 76 | struct rx_frag_info frag_info; |
| 77 | struct rx_mpdu_start mpdu_start; |
| 78 | struct rx_msdu_start msdu_start; |
| 79 | struct rx_msdu_end msdu_end; |
| 80 | struct rx_mpdu_end mpdu_end; |
| 81 | struct rx_ppdu_start ppdu_start; |
| 82 | struct rx_ppdu_end ppdu_end; |
| 83 | }; |
| 84 | #endif |
| 85 | |
| 86 | /* |
| 87 | * This struct defines the basic MSDU rx descriptor created by FW. |
| 88 | */ |
| 89 | struct fw_rx_desc_base { |
| 90 | union { |
| 91 | struct { |
Govind Singh | 55b8daf | 2016-06-09 16:02:47 +0530 | [diff] [blame] | 92 | A_UINT8 discard:1, |
| 93 | forward:1, |
| 94 | any_err:1, |
| 95 | dup_err:1, |
| 96 | ipa_ind:1, |
| 97 | inspect:1, |
| 98 | extension:2; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 99 | } bits; |
| 100 | A_UINT8 val; |
| 101 | } u; |
| 102 | }; |
| 103 | |
| 104 | #define FW_RX_DESC_DISCARD_M 0x1 |
| 105 | #define FW_RX_DESC_DISCARD_S 0 |
| 106 | #define FW_RX_DESC_FORWARD_M 0x2 |
| 107 | #define FW_RX_DESC_FORWARD_S 1 |
Govind Singh | 55b8daf | 2016-06-09 16:02:47 +0530 | [diff] [blame] | 108 | #define FW_RX_DESC_ANY_ERR_M 0x4 |
| 109 | #define FW_RX_DESC_ANY_ERR_S 2 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 110 | #define FW_RX_DESC_DUP_ERR_M 0x8 |
| 111 | #define FW_RX_DESC_DUP_ERR_S 3 |
| 112 | #define FW_RX_DESC_INSPECT_M 0x20 |
| 113 | #define FW_RX_DESC_INSPECT_S 5 |
| 114 | #define FW_RX_DESC_EXT_M 0xc0 |
| 115 | #define FW_RX_DESC_EXT_S 6 |
| 116 | |
| 117 | #define FW_RX_DESC_CNT_2_BYTES(_fw_desc_cnt) (_fw_desc_cnt) |
| 118 | |
| 119 | enum { |
| 120 | FW_RX_DESC_EXT_NONE = 0, |
| 121 | FW_RX_DESC_EXT_LRO_ONLY, |
| 122 | FW_RX_DESC_EXT_LRO_AND_OTHER, |
| 123 | FW_RX_DESC_EXT_OTHER |
| 124 | }; |
| 125 | |
| 126 | #define FW_RX_DESC_DISCARD_GET(_var) \ |
| 127 | (((_var) & FW_RX_DESC_DISCARD_M) >> FW_RX_DESC_DISCARD_S) |
| 128 | #define FW_RX_DESC_DISCARD_SET(_var, _val) \ |
| 129 | ((_var) |= ((_val) << FW_RX_DESC_DISCARD_S)) |
| 130 | |
| 131 | #define FW_RX_DESC_FORWARD_GET(_var) \ |
| 132 | (((_var) & FW_RX_DESC_FORWARD_M) >> FW_RX_DESC_FORWARD_S) |
| 133 | #define FW_RX_DESC_FORWARD_SET(_var, _val) \ |
| 134 | ((_var) |= ((_val) << FW_RX_DESC_FORWARD_S)) |
| 135 | |
| 136 | #define FW_RX_DESC_INSPECT_GET(_var) \ |
| 137 | (((_var) & FW_RX_DESC_INSPECT_M) >> FW_RX_DESC_INSPECT_S) |
| 138 | #define FW_RX_DESC_INSPECT_SET(_var, _val) \ |
| 139 | ((_var) |= ((_val) << FW_RX_DESC_INSPECT_S)) |
| 140 | |
| 141 | #define FW_RX_DESC_EXT_GET(_var) \ |
| 142 | (((_var) & FW_RX_DESC_EXT_M) >> FW_RX_DESC_EXT_S) |
| 143 | #define FW_RX_DESC_EXT_SET(_var, _val) \ |
| 144 | ((_var) |= ((_val) << FW_RX_DESC_EXT_S)) |
| 145 | |
Govind Singh | 55b8daf | 2016-06-09 16:02:47 +0530 | [diff] [blame] | 146 | /* |
| 147 | * This struct defines TCP_CHKSUM_OFFLOAD bit fields which are needed by host. |
| 148 | */ |
| 149 | struct fw_rx_msdu_info { |
| 150 | union { |
| 151 | /* |
| 152 | * The "bits" struct defines the flags in fw_rx_msdu_info used |
| 153 | * during regular operation. |
| 154 | */ |
| 155 | struct { |
| 156 | A_UINT8 tcp_udp_chksum_fail:1, /* for tcp checksum offload use */ |
| 157 | ip_chksum_fail:1, |
| 158 | ipv6_proto:1, |
| 159 | tcp_proto:1, |
| 160 | udp_proto:1, |
| 161 | ip_frag:1, |
| 162 | first_wakeup:1, |
| 163 | reserved:1; |
| 164 | } bits; |
| 165 | /* |
| 166 | * The "mon" struct defines the flags in fw_rx_msdu_info used |
| 167 | * during monitor mode. |
| 168 | */ |
| 169 | struct { |
| 170 | A_UINT8 last_frag:1, |
| 171 | reserved:7; |
| 172 | } mon; |
| 173 | A_UINT8 val; |
| 174 | } u; |
| 175 | }; |
| 176 | |
| 177 | /* regular operation flags */ |
| 178 | |
| 179 | #define FW_RX_MSDU_INFO_TCP_UDP_CHKSUM_FAIL_M 0x1 |
| 180 | #define FW_RX_MSDU_INFO_TCP_UDP_CHKSUM_FAIL_S 0 |
| 181 | #define FW_RX_MSDU_INFO_IP_CHKSUM_FAIL_M 0x2 |
| 182 | #define FW_RX_MSDU_INFO_IP_CHKSUM_FAIL_S 1 |
| 183 | #define FW_RX_MSDU_INFO_IPV6_PROTO_M 0x4 |
| 184 | #define FW_RX_MSDU_INFO_IPV6_PROTO_S 2 |
| 185 | #define FW_RX_MSDU_INFO_TCP_PROTO_M 0x8 |
| 186 | #define FW_RX_MSDU_INFO_TCP_PROTO_S 3 |
| 187 | #define FW_RX_MSDU_INFO_UDP_PROTO_M 0x10 |
| 188 | #define FW_RX_MSDU_INFO_UDP_PROTO_S 4 |
| 189 | #define FW_RX_MSDU_INFO_IP_FRAG_M 0x20 |
| 190 | #define FW_RX_MSDU_INFO_IP_FRAG_S 5 |
| 191 | #define FW_RX_MSDU_INFO_FIRST_WAKEUP_M 0x40 |
| 192 | #define FW_RX_MSDU_INFO_FIRST_WAKEUP_S 6 |
| 193 | |
| 194 | #define FW_RX_MSDU_INFO_TCP_UDP_CHKSUM_FAIL_GET(_var) \ |
| 195 | (((_var) & FW_RX_MSDU_INFO_TCP_UDP_CHKSUM_FAIL_M) >> FW_RX_MSDU_INFO_TCP_UDP_CHKSUM_FAIL_S) |
| 196 | #define FW_RX_MSDU_INFO_TCP_UDP_CHKSUM_FAIL_SET(_var, _val) \ |
| 197 | ((_var) |= ((_val) << FW_RX_MSDU_INFO_TCP_UDP_CHKSUM_FAIL_S)) |
| 198 | |
| 199 | #define FW_RX_MSDU_INFO_IP_CHKSUM_FAIL_GET(_var) \ |
| 200 | (((_var) & FW_RX_MSDU_INFO_IP_CHKSUM_FAIL_M) >> FW_RX_MSDU_INFO_IP_CHKSUM_FAIL_S) |
| 201 | #define FW_RX_MSDU_INFO_IP_CHKSUM_FAIL_SET(_var, _val) \ |
| 202 | ((_var) |= ((_val) << FW_RX_MSDU_INFO_IP_CHKSUM_FAIL_S)) |
| 203 | |
| 204 | #define FW_RX_MSDU_INFO_IPV6_PROTO_GET(_var) \ |
| 205 | (((_var) & FW_RX_MSDU_INFO_IPV6_PROTO_M) >> FW_RX_MSDU_INFO_IPV6_PROTO_S) |
| 206 | #define FW_RX_MSDU_INFO_IPV6_PROTO_SET(_var, _val) \ |
| 207 | ((_var) |= ((_val) << FW_RX_MSDU_INFO_IPV6_PROTO_S)) |
| 208 | |
| 209 | #define FW_RX_MSDU_INFO_TCP_PROTO_GET(_var) \ |
| 210 | (((_var) & FW_RX_MSDU_INFO_TCP_PROTO_M) >> FW_RX_MSDU_INFO_TCP_PROTO_S) |
| 211 | #define FW_RX_MSDU_INFO_TCP_PROTO_SET(_var, _val) \ |
| 212 | ((_var) |= ((_val) << FW_RX_MSDU_INFO_TCP_PROTO_S)) |
| 213 | |
| 214 | #define FW_RX_MSDU_INFO_UDP_PROTO_GET(_var) \ |
| 215 | (((_var) & FW_RX_MSDU_INFO_UDP_PROTO_M) >> FW_RX_MSDU_INFO_UDP_PROTO_S) |
| 216 | #define FW_RX_MSDU_INFO_UDP_PROTO_SET(_var, _val) \ |
| 217 | ((_var) |= ((_val) << FW_RX_MSDU_INFO_UDP_PROTO_S)) |
| 218 | |
| 219 | #define FW_RX_MSDU_INFO_IP_FRAG_GET(_var) \ |
| 220 | (((_var) & FW_RX_MSDU_INFO_IP_FRAG_M) >> FW_RX_MSDU_INFO_IP_FRAG_S) |
| 221 | #define FW_RX_MSDU_INFO_IP_FRAG_SET(_var, _val) \ |
| 222 | ((_var) |= ((_val) << FW_RX_MSDU_INFO_IP_FRAG_S)) |
| 223 | |
| 224 | #define FW_RX_MSDU_INFO_FIRST_WAKEUP_GET(_var) \ |
| 225 | (((_var) & FW_RX_MSDU_INFO_FIRST_WAKEUP_M) >> FW_RX_MSDU_INFO_FIRST_WAKEUP_S) |
| 226 | #define FW_RX_MSDU_INFO_FIRST_WAKEUP_SET(_var, _val) \ |
| 227 | ((_var) |= ((_val) << FW_RX_MSDU_INFO_FIRST_WAKEUP_S)) |
| 228 | |
| 229 | |
| 230 | /* monitor mode flags */ |
| 231 | |
| 232 | #define FW_RX_MSDU_INFO_MON_LAST_FRAG_M 0x1 |
| 233 | #define FW_RX_MSDU_INFO_MON_LAST_FRAG_S 0 |
| 234 | |
| 235 | |
| 236 | #define FW_RX_MSDU_INFO_MON_LAST_FRAG_GET(_var) \ |
| 237 | (((_var) & FW_RX_MSDU_INFO_MON_LAST_FRAG_M) >> FW_RX_MSDU_INFO_MON_LAST_FRAG_S) |
| 238 | #define FW_RX_MSDU_INFO_MON_LAST_FRAG_SET(_var, _val) \ |
| 239 | ((_var) |= ((_val) << FW_RX_MSDU_INFO_MON_LAST_FRAG_S)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 240 | #endif /* _WAL_RX_DESC__H_ */ |