xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/mvl88w8977/mlan/esa/common/wlpd.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /** @file wlpd.h
2  *
3  *  @brief RX and TX packet descriptor
4  *
5  * Copyright (C) 2014-2017, Marvell International Ltd.
6  *
7  * This software file (the "File") is distributed by Marvell International
8  * Ltd. under the terms of the GNU General Public License Version 2, June 1991
9  * (the "License").  You may use, redistribute and/or modify this File in
10  * accordance with the terms and conditions of the License, a copy of which
11  * is available by writing to the Free Software Foundation, Inc.,
12  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
13  * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
14  *
15  * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
17  * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
18  * this warranty disclaimer.
19  */
20 
21 /******************************************************
22 Change log:
23     03/07/2014: Initial version
24 ******************************************************/
25 #ifndef WLPD_H__
26 #define WLPD_H__
27 
28 /** include files **/
29 #include "packetType.h"
30 #include "wltypes.h"
31 
32  /** @defgroup PacketTypes Tx Rx Data Packet Types
33  *  Functions exported by wlpd.h
34  *  @{
35  */
36 
37 /*****************************************************************************/
38 typedef MLAN_PACK_START struct {
39 	UINT8 tdlsPkt:1;
40 	UINT8 rsvd:7;
41 } MLAN_PACK_END rxFlags_t;
42 /**
43 *** @brief Enumeration of action to be take for returned Rx Packets.
44 **/
45 
46 /**
47 *** @brief Receive Packet Descriptor
48 **/
49 typedef MLAN_PACK_START struct RxPD_t {
50 	/* TODO: Port EMBEDDED_TCPIP and VISTA_802_11_DRIVER_INTERFACE
51 	   members to W8786 */
52 	UINT8 RxBSSType;
53 	UINT8 RxBSSNum;
54 	UINT16 RxPacketLength;	//!< Rx Packet Length
55 	SINT16 RxPacketOffset;	//!< Offset to the Rx Data
56 	UINT16 RxPacketType;
57 	UINT16 SeqNum;
58 	UINT8 userPriority;
59 	UINT8 RxRate;		// LG 0-3 (11b), 5-12(11g), HT :MCS# (11n)
60 	SINT8 SNR;
61 	SINT8 RxSQ2;		// defined to RxNF
62 	UINT8 RxHTInfo;		// [Bit o] RxRate format : Legacy = 0 , HT =1
63 	//[Bit 1] HT Bandwidth :BW20 =0 , BW40 = 1
64 	//[Bit 2] HT Guard Interval : LGI = 0, SGI = 1
65 #if defined(VISTA_802_11_DRIVER_INTERFACE) || defined(SNIFFER_MODE_ENABLE)
66 	UINT8 PacketType;
67 	UINT8 NumFragments;
68 	UINT8 EncryptionStatus;
69 #else
70 	UINT8 Reserved2[3];
71 #endif
72 	rxFlags_t flags;
73 	UINT8 Reserved3;
74 } MLAN_PACK_END RxPD_t;
75 
76 #define PACKET_TYPE_802_3               0
77 #define PACKET_TYPE_802_11              1
78 #define PACKET_TYPE_802_11_QOS          2
79 #define PACKET_TYPE_802_11_MRVL_MESH    3
80 #define PACKET_TYPE_TDLS                4
81 
82 #define MESH_FWD_PACKET_MASK  (1 << 0)
83 #define MESH_OLPC_PKT_MASK    (1 << 1)
84 
85 #define PACKET_DECRYPTED        0
86 #define PACKET_NOT_DECRYPTED    1
87 
88 #if defined(VISTA_802_11_DRIVER_INTERFACE)
89 
90 #define PACKET_NO_DECRYPT_NEEDED 2
91 #define MAGIC_PACKET_MARKER_BITMASK     (1<<3)
92 #define COALESCED_PACKET_MARKER_BITMASK (1<<2)
93 
94 #endif
95 
96 #define RxNF    RxSQ2
97 
98 // Since Small Debug print and Myung's Debug Facility both use
99 // PKT_TYPE_DEBUG rx pkt, the following debug header is required to distinguish
100 // Small Debug from Myung's.
101 //
102 typedef MLAN_PACK_START struct {
103 	UINT8 dbg_type;
104 	UINT8 reserve[3];
105 } MLAN_PACK_END to_host_dbg_hdr_t;
106 #define DBG_TYPE_SMALL  2
107 
108 /* The following fields have been added for Null frame handling
109    in Power Save Mode.
110  */
111 typedef MLAN_PACK_START struct {
112 	UINT8 nullPkt:1;
113 	UINT8 overRideFwPM:1;
114 	UINT8 pmVal:1;
115 	UINT8 lastTxPkt:1;
116 	UINT8 tdlsPkt:1;
117 	UINT8 rsvd:3;
118 } MLAN_PACK_END wcb_flags_t;
119 
120 /**
121 *** @brief Transmit Packet Descriptor
122 **/
123 typedef MLAN_PACK_START struct {
124 	/* TODO: Port EMBEDDED_TCPIP and VISTA_802_11_DRIVER_INTERFACE
125 	   members to W8786 */
126 	UINT8 TxBSSType;
127 	UINT8 TxBSSNum;
128 	UINT16 TxPacketLength;	//!< Tx Packet Length
129 	UINT16 TxPacketOffset;	//!< Offset to Tx Data
130 	UINT16 TxPacketType;	//!< Tx Packet Type
131 	UINT32 TxControl;	//b3-0: RateID; b4:HostRateCtrl;
132 	//b11-8: RetryLimit; b12:HostRetryCtrl;
133 	//b14-13: Ack Policy, 10 ACK_IMMD
134 	//        11 NO_ACK 0x ACK_PER_FRM
135 	UINT8 userPriority;
136 	wcb_flags_t flags;	// These BitFields are for Null Frame Handling and
137 	// other Power Save requirements.
138 	UINT8 PktDelay_2ms;	/* Driver queue delay used in stats and MSDU
139 				 **  lifetime expiry calcs; value is represented
140 				 **  by 2ms units (ms bit shifted by 1)
141 				 */
142 #ifdef VISTA_802_11_DRIVER_INTERFACE
143 	/* Include Packet type for NWF */
144 	UINT8 PacketType;
145 	UINT8 EncrOpt;
146 #else
147 	UINT8 Reserved[2];
148 #endif
149 	UINT8 TxTokenId;
150 
151 } MLAN_PACK_END wcb_t;
152 
153 // Encryption Option is an 8 bit field
154 #define ENCR_OPT_NORMAL          0x00	// Normal packet. Follows Enc rules in FW
155 #define ENCR_OPT_FORCE_PTEXT     0x01	// Force plain text. No encryption.
156 #define ENCR_OPT_FW_KEY_MAP      0x02	// Encrypt using key mapping table in FW
157 #define ENCR_OPT_PTEXT_80211_PKT 0x03	// No encryption for 802.11 pkt
158 
159 /*@}*/
160 
161 #endif /* _WLPD_H_ */
162