1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
4  * All rights reserved.
5  *
6  * Purpose:
7  *
8  * Author: Jerry Chen
9  *
10  * Date: Jun. 27, 2002
11  *
12  */
13 
14 #ifndef __RXTX_H__
15 #define __RXTX_H__
16 
17 #include "device.h"
18 
19 #define DEFAULT_MSDU_LIFETIME_RES_64us	8000 /* 64us */
20 #define DEFAULT_MGN_LIFETIME_RES_64us	125  /* 64us */
21 
22 
23 /*---------------------  Export Definitions -------------------------*/
24 
25 /*---------------------  Export Variables  --------------------------*/
26 
27 /*---------------------  Export Functions  --------------------------*/
28 
29 /* MIC HDR data header */
30 struct vnt_mic_hdr {
31 	u8 id;
32 	u8 tx_priority;
33 	u8 mic_addr2[ETH_ALEN];
34 	u8 ccmp_pn[IEEE80211_CCMP_PN_LEN];
35 	__be16 payload_len;
36 	__be16 hlen;
37 	__le16 frame_control;
38 	u8 addr1[ETH_ALEN];
39 	u8 addr2[ETH_ALEN];
40 	u8 addr3[ETH_ALEN];
41 	__le16 seq_ctrl;
42 	u8 addr4[ETH_ALEN];
43 	u16 packing; /* packing to 48 bytes */
44 } __packed;
45 
46 /* RsvTime buffer header */
47 struct vnt_rrv_time_rts {
48 	__le16 rts_rrv_time_ba;
49 	__le16 rts_rrv_time_aa;
50 	__le16 rts_rrv_time_bb;
51 	u16 reserved;
52 	__le16 rrv_time_b;
53 	__le16 rrv_time_a;
54 } __packed;
55 
56 struct vnt_rrv_time_cts {
57 	__le16 cts_rrv_time_ba;
58 	u16 reserved;
59 	__le16 rrv_time_b;
60 	__le16 rrv_time_a;
61 } __packed;
62 
63 struct vnt_rrv_time_ab {
64 	__le16 rts_rrv_time;
65 	__le16 rrv_time;
66 } __packed;
67 
68 /* TX data header */
69 struct vnt_tx_datahead_g {
70 	struct vnt_phy_field b;
71 	struct vnt_phy_field a;
72 	__le16 duration_b;
73 	__le16 duration_a;
74 	__le16 time_stamp_off_b;
75 	__le16 time_stamp_off_a;
76 } __packed;
77 
78 struct vnt_tx_datahead_g_fb {
79 	struct vnt_phy_field b;
80 	struct vnt_phy_field a;
81 	__le16 duration_b;
82 	__le16 duration_a;
83 	__le16 duration_a_f0;
84 	__le16 duration_a_f1;
85 	__le16 time_stamp_off_b;
86 	__le16 time_stamp_off_a;
87 } __packed;
88 
89 struct vnt_tx_datahead_ab {
90 	struct vnt_phy_field ab;
91 	__le16 duration;
92 	__le16 time_stamp_off;
93 } __packed;
94 
95 struct vnt_tx_datahead_a_fb {
96 	struct vnt_phy_field a;
97 	__le16 duration;
98 	__le16 time_stamp_off;
99 	__le16 duration_f0;
100 	__le16 duration_f1;
101 } __packed;
102 
103 /* RTS buffer header */
104 struct vnt_rts_g {
105 	struct vnt_phy_field b;
106 	struct vnt_phy_field a;
107 	__le16 duration_ba;
108 	__le16 duration_aa;
109 	__le16 duration_bb;
110 	u16 reserved;
111 	struct ieee80211_rts data;
112 } __packed __aligned(2);
113 
114 struct vnt_rts_g_fb {
115 	struct vnt_phy_field b;
116 	struct vnt_phy_field a;
117 	__le16 duration_ba;
118 	__le16 duration_aa;
119 	__le16 duration_bb;
120 	u16 wReserved;
121 	__le16 rts_duration_ba_f0;
122 	__le16 rts_duration_aa_f0;
123 	__le16 rts_duration_ba_f1;
124 	__le16 rts_duration_aa_f1;
125 	struct ieee80211_rts data;
126 } __packed __aligned(2);
127 
128 struct vnt_rts_ab {
129 	struct vnt_phy_field ab;
130 	__le16 duration;
131 	u16 reserved;
132 	struct ieee80211_rts data;
133 } __packed __aligned(2);
134 
135 struct vnt_rts_a_fb {
136 	struct vnt_phy_field a;
137 	__le16 duration;
138 	u16 reserved;
139 	__le16 rts_duration_f0;
140 	__le16 rts_duration_f1;
141 	struct ieee80211_rts data;
142 } __packed __aligned(2);
143 
144 /* CTS buffer header */
145 struct vnt_cts {
146 	struct vnt_phy_field b;
147 	__le16 duration_ba;
148 	u16 reserved;
149 	struct ieee80211_cts data;
150 	u16 reserved2;
151 } __packed __aligned(2);
152 
153 struct vnt_cts_fb {
154 	struct vnt_phy_field b;
155 	__le16 duration_ba;
156 	u16 reserved;
157 	__le16 cts_duration_ba_f0;
158 	__le16 cts_duration_ba_f1;
159 	struct ieee80211_cts data;
160 	u16 reserved2;
161 } __packed __aligned(2);
162 
163 struct vnt_tx_fifo_head {
164 	u8 tx_key[WLAN_KEY_LEN_CCMP];
165 	__le16 fifo_ctl;
166 	__le16 time_stamp;
167 	__le16 frag_ctl;
168 	__le16 current_rate;
169 } __packed;
170 
171 struct vnt_tx_short_buf_head {
172 	__le16 fifo_ctl;
173 	u16 time_stamp;
174 	struct vnt_phy_field ab;
175 	__le16 duration;
176 	__le16 time_stamp_off;
177 } __packed;
178 
179 int vnt_generate_fifo_header(struct vnt_private *priv, u32 dma_idx,
180 			     struct vnt_tx_desc *head_td, struct sk_buff *skb);
181 int vnt_beacon_make(struct vnt_private *priv, struct ieee80211_vif *vif);
182 int vnt_beacon_enable(struct vnt_private *priv, struct ieee80211_vif *vif,
183 		      struct ieee80211_bss_conf *conf);
184 
185 #endif /* __RXTX_H__ */
186