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