xref: /openbmc/linux/drivers/staging/vt6656/rxtx.h (revision 9deca1e3)
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 /* Length, Service, and Signal fields of Phy for Tx */
27 struct vnt_phy_field {
28 	u8 signal;
29 	u8 service;
30 	__le16 len;
31 } __packed;
32 
33 /* MIC HDR data header */
34 struct vnt_mic_hdr {
35 	u8 id;
36 	u8 tx_priority;
37 	u8 mic_addr2[6];
38 	u8 ccmp_pn[IEEE80211_CCMP_PN_LEN];
39 	__be16 payload_len;
40 	__be16 hlen;
41 	__le16 frame_control;
42 	u8 addr1[6];
43 	u8 addr2[6];
44 	u8 addr3[6];
45 	__le16 seq_ctrl;
46 	u8 addr4[6];
47 	u16 packing; /* packing to 48 bytes */
48 } __packed;
49 
50 /* RsvTime buffer header */
51 struct vnt_rrv_time_rts {
52 	__le16 rts_rrv_time_ba;
53 	__le16 rts_rrv_time_aa;
54 	__le16 rts_rrv_time_bb;
55 	u16 wReserved;
56 	__le16 rrv_time_b;
57 	__le16 rrv_time_a;
58 } __packed;
59 
60 struct vnt_rrv_time_cts {
61 	__le16 cts_rrv_time_ba;
62 	u16 wReserved;
63 	__le16 rrv_time_b;
64 	__le16 rrv_time_a;
65 } __packed;
66 
67 struct vnt_rrv_time_ab {
68 	__le16 rts_rrv_time;
69 	__le16 rrv_time;
70 } __packed;
71 
72 /* TX data header */
73 struct vnt_tx_datahead_g {
74 	struct vnt_phy_field b;
75 	struct vnt_phy_field a;
76 	__le16 duration_b;
77 	__le16 duration_a;
78 	__le16 time_stamp_off_b;
79 	__le16 time_stamp_off_a;
80 } __packed;
81 
82 struct vnt_tx_datahead_ab {
83 	struct vnt_phy_field ab;
84 	__le16 duration;
85 	__le16 time_stamp_off;
86 } __packed;
87 
88 /* RTS buffer header */
89 struct vnt_rts_g {
90 	struct vnt_phy_field b;
91 	struct vnt_phy_field a;
92 	__le16 duration_ba;
93 	__le16 duration_aa;
94 	__le16 duration_bb;
95 	u16 wReserved;
96 	struct ieee80211_rts data;
97 	struct vnt_tx_datahead_g data_head;
98 } __packed;
99 
100 struct vnt_rts_ab {
101 	struct vnt_phy_field ab;
102 	__le16 duration;
103 	u16 wReserved;
104 	struct ieee80211_rts data;
105 	struct vnt_tx_datahead_ab data_head;
106 } __packed;
107 
108 /* CTS buffer header */
109 struct vnt_cts {
110 	struct vnt_phy_field b;
111 	__le16 duration_ba;
112 	u16 wReserved;
113 	struct ieee80211_cts data;
114 	u16 reserved2;
115 	struct vnt_tx_datahead_g data_head;
116 } __packed;
117 
118 union vnt_tx_data_head {
119 	/* rts g */
120 	struct vnt_rts_g rts_g;
121 	/* rts a/b */
122 	struct vnt_rts_ab rts_ab;
123 	/* cts g */
124 	struct vnt_cts cts_g;
125 	/* no rts/cts */
126 	struct vnt_tx_datahead_ab data_head_ab;
127 };
128 
129 struct vnt_tx_mic_hdr {
130 	struct vnt_mic_hdr hdr;
131 	union vnt_tx_data_head head;
132 } __packed;
133 
134 union vnt_tx {
135 	struct vnt_tx_mic_hdr mic;
136 	union vnt_tx_data_head head;
137 };
138 
139 union vnt_tx_head {
140 	struct {
141 		struct vnt_rrv_time_rts rts;
142 		union vnt_tx tx;
143 	} __packed tx_rts;
144 	struct {
145 		struct vnt_rrv_time_cts cts;
146 		union vnt_tx tx;
147 	} __packed tx_cts;
148 	struct {
149 		struct vnt_rrv_time_ab ab;
150 		union vnt_tx tx;
151 	} __packed tx_ab;
152 };
153 
154 struct vnt_tx_fifo_head {
155 	u8 tx_key[WLAN_KEY_LEN_CCMP];
156 	__le16 fifo_ctl;
157 	__le16 time_stamp;
158 	__le16 frag_ctl;
159 	__le16 current_rate;
160 } __packed;
161 
162 struct vnt_tx_usb_header {
163 	u8 type;
164 	u8 pkt_no;
165 	__le16 tx_byte_count;
166 } __packed;
167 
168 struct vnt_tx_buffer {
169 	struct vnt_tx_usb_header usb;
170 	struct vnt_tx_fifo_head fifo_head;
171 	union vnt_tx_head tx_head;
172 } __packed;
173 
174 struct vnt_tx_short_buf_head {
175 	__le16 fifo_ctl;
176 	u16 time_stamp;
177 	struct vnt_phy_field ab;
178 	__le16 duration;
179 	__le16 time_stamp_off;
180 } __packed;
181 
182 struct vnt_beacon_buffer {
183 	struct vnt_tx_usb_header usb;
184 	struct vnt_tx_short_buf_head short_head;
185 } __packed;
186 
187 int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb);
188 int vnt_beacon_make(struct vnt_private *priv, struct ieee80211_vif *vif);
189 int vnt_beacon_enable(struct vnt_private *priv, struct ieee80211_vif *vif,
190 		      struct ieee80211_bss_conf *conf);
191 
192 #endif /* __RXTX_H__ */
193