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