blob: 04cd50dda82dfcd78fe955ec1984ecc771b869de [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2011-2012, 2014 The Linux Foundation. All rights reserved.
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)
44/* HW rx descriptor definitions */
45#include <hw/mac_descriptors/rx_attention.h>
46#include <hw/mac_descriptors/rx_frag_info.h>
47#include <hw/mac_descriptors/rx_msdu_start.h>
48#include <hw/mac_descriptors/rx_msdu_end.h>
49#include <hw/mac_descriptors/rx_mpdu_start.h>
50#include <hw/mac_descriptors/rx_mpdu_end.h>
51#include <hw/mac_descriptors/rx_ppdu_start.h>
52#include <hw/mac_descriptors/rx_ppdu_end.h>
53/*
54 * This struct defines the basic descriptor information, which is
55 * written by the 11ac HW MAC into the WAL's rx status descriptor
56 * ring.
57 */
58struct hw_rx_desc_base {
59 struct rx_attention attention;
60 struct rx_frag_info frag_info;
61 struct rx_mpdu_start mpdu_start;
62 struct rx_msdu_start msdu_start;
63 struct rx_msdu_end msdu_end;
64 struct rx_mpdu_end mpdu_end;
65 struct rx_ppdu_start ppdu_start;
66 struct rx_ppdu_end ppdu_end;
67};
68#endif
69
70/*
71 * This struct defines the basic MSDU rx descriptor created by FW.
72 */
73struct fw_rx_desc_base {
74 union {
75 struct {
76 A_UINT8 discard : 1,
77 forward : 1,
78 any_err : 1,
79 dup_err : 1, reserved : 1, inspect : 1, extension : 2;
80 } bits;
81 A_UINT8 val;
82 } u;
83};
84
85#define FW_RX_DESC_DISCARD_M 0x1
86#define FW_RX_DESC_DISCARD_S 0
87#define FW_RX_DESC_FORWARD_M 0x2
88#define FW_RX_DESC_FORWARD_S 1
89#define FW_RX_DESC_MIC_ERR_M 0x4
90#define FW_RX_DESC_MIC_ERR_S 2
91#define FW_RX_DESC_DUP_ERR_M 0x8
92#define FW_RX_DESC_DUP_ERR_S 3
93#define FW_RX_DESC_INSPECT_M 0x20
94#define FW_RX_DESC_INSPECT_S 5
95#define FW_RX_DESC_EXT_M 0xc0
96#define FW_RX_DESC_EXT_S 6
97
98#define FW_RX_DESC_CNT_2_BYTES(_fw_desc_cnt) (_fw_desc_cnt)
99
100enum {
101 FW_RX_DESC_EXT_NONE = 0,
102 FW_RX_DESC_EXT_LRO_ONLY,
103 FW_RX_DESC_EXT_LRO_AND_OTHER,
104 FW_RX_DESC_EXT_OTHER
105};
106
107#define FW_RX_DESC_DISCARD_GET(_var) \
108 (((_var) & FW_RX_DESC_DISCARD_M) >> FW_RX_DESC_DISCARD_S)
109#define FW_RX_DESC_DISCARD_SET(_var, _val) \
110 ((_var) |= ((_val) << FW_RX_DESC_DISCARD_S))
111
112#define FW_RX_DESC_FORWARD_GET(_var) \
113 (((_var) & FW_RX_DESC_FORWARD_M) >> FW_RX_DESC_FORWARD_S)
114#define FW_RX_DESC_FORWARD_SET(_var, _val) \
115 ((_var) |= ((_val) << FW_RX_DESC_FORWARD_S))
116
117#define FW_RX_DESC_INSPECT_GET(_var) \
118 (((_var) & FW_RX_DESC_INSPECT_M) >> FW_RX_DESC_INSPECT_S)
119#define FW_RX_DESC_INSPECT_SET(_var, _val) \
120 ((_var) |= ((_val) << FW_RX_DESC_INSPECT_S))
121
122#define FW_RX_DESC_EXT_GET(_var) \
123 (((_var) & FW_RX_DESC_EXT_M) >> FW_RX_DESC_EXT_S)
124#define FW_RX_DESC_EXT_SET(_var, _val) \
125 ((_var) |= ((_val) << FW_RX_DESC_EXT_S))
126
127#endif /* _WAL_RX_DESC__H_ */