xref: /openbmc/linux/drivers/staging/vt6656/rxtx.h (revision 8e2e79ff)
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 
104 /* CTS buffer header */
105 struct vnt_cts {
106 	struct vnt_phy_field b;
107 	__le16 duration_ba;
108 	u16 wReserved;
109 	struct ieee80211_cts data;
110 	u16 reserved2;
111 	struct vnt_tx_datahead_g data_head;
112 } __packed;
113 
114 union vnt_tx_data_head {
115 	/* rts g */
116 	struct vnt_rts_g rts_g;
117 	/* rts a/b */
118 	struct vnt_rts_ab rts_ab;
119 	/* cts g */
120 	struct vnt_cts cts_g;
121 	/* no rts/cts */
122 	struct vnt_tx_datahead_ab data_head_ab;
123 };
124 
125 struct vnt_tx_mic_hdr {
126 	struct vnt_mic_hdr hdr;
127 	union vnt_tx_data_head head;
128 } __packed;
129 
130 union vnt_tx {
131 	struct vnt_tx_mic_hdr mic;
132 	union vnt_tx_data_head head;
133 };
134 
135 union vnt_tx_head {
136 	struct {
137 		struct vnt_rrv_time_rts rts;
138 		union vnt_tx tx;
139 	} __packed tx_rts;
140 	struct {
141 		struct vnt_rrv_time_cts cts;
142 		union vnt_tx tx;
143 	} __packed tx_cts;
144 	struct {
145 		struct vnt_rrv_time_ab ab;
146 		union vnt_tx tx;
147 	} __packed tx_ab;
148 };
149 
150 struct vnt_tx_fifo_head {
151 	u8 tx_key[WLAN_KEY_LEN_CCMP];
152 	__le16 fifo_ctl;
153 	__le16 time_stamp;
154 	__le16 frag_ctl;
155 	__le16 current_rate;
156 } __packed;
157 
158 struct vnt_tx_buffer {
159 	u8 type;
160 	u8 pkt_no;
161 	__le16 tx_byte_count;
162 	struct vnt_tx_fifo_head fifo_head;
163 	union vnt_tx_head tx_head;
164 } __packed;
165 
166 struct vnt_tx_short_buf_head {
167 	__le16 fifo_ctl;
168 	u16 time_stamp;
169 	struct vnt_phy_field ab;
170 	__le16 duration;
171 	__le16 time_stamp_off;
172 } __packed;
173 
174 struct vnt_beacon_buffer {
175 	u8 type;
176 	u8 pkt_no;
177 	__le16 tx_byte_count;
178 	struct vnt_tx_short_buf_head short_head;
179 	struct ieee80211_mgmt mgmt_hdr;
180 } __packed;
181 
182 int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb);
183 int vnt_beacon_make(struct vnt_private *priv, struct ieee80211_vif *vif);
184 int vnt_beacon_enable(struct vnt_private *priv, struct ieee80211_vif *vif,
185 		      struct ieee80211_bss_conf *conf);
186 
187 #endif /* __RXTX_H__ */
188