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