1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. 4 * All rights reserved. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * 17 * File: rxtx.h 18 * 19 * Purpose: 20 * 21 * Author: Jerry Chen 22 * 23 * Date: Jun. 27, 2002 24 * 25 */ 26 27 #ifndef __RXTX_H__ 28 #define __RXTX_H__ 29 30 #include "device.h" 31 #include "wcmd.h" 32 #include "baseband.h" 33 34 #define DEFAULT_MGN_LIFETIME_RES_64us 125 /* 64us */ 35 #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 36 37 /* MIC HDR data header */ 38 struct vnt_mic_hdr { 39 u8 id; 40 u8 tx_priority; 41 u8 mic_addr2[6]; 42 u8 ccmp_pn[IEEE80211_CCMP_PN_LEN]; 43 __be16 payload_len; 44 __be16 hlen; 45 __le16 frame_control; 46 u8 addr1[6]; 47 u8 addr2[6]; 48 u8 addr3[6]; 49 __le16 seq_ctrl; 50 u8 addr4[6]; 51 u16 packing; /* packing to 48 bytes */ 52 } __packed; 53 54 /* RsvTime buffer header */ 55 struct vnt_rrv_time_rts { 56 __le16 rts_rrv_time_ba; 57 __le16 rts_rrv_time_aa; 58 __le16 rts_rrv_time_bb; 59 u16 wReserved; 60 __le16 rrv_time_b; 61 __le16 rrv_time_a; 62 } __packed; 63 64 struct vnt_rrv_time_cts { 65 __le16 cts_rrv_time_ba; 66 u16 wReserved; 67 __le16 rrv_time_b; 68 __le16 rrv_time_a; 69 } __packed; 70 71 struct vnt_rrv_time_ab { 72 __le16 rts_rrv_time; 73 __le16 rrv_time; 74 } __packed; 75 76 /* TX data header */ 77 struct vnt_tx_datahead_g { 78 struct vnt_phy_field b; 79 struct vnt_phy_field a; 80 __le16 duration_b; 81 __le16 duration_a; 82 __le16 time_stamp_off_b; 83 __le16 time_stamp_off_a; 84 struct ieee80211_hdr hdr; 85 } __packed; 86 87 struct vnt_tx_datahead_g_fb { 88 struct vnt_phy_field b; 89 struct vnt_phy_field a; 90 __le16 duration_b; 91 __le16 duration_a; 92 __le16 duration_a_f0; 93 __le16 duration_a_f1; 94 __le16 time_stamp_off_b; 95 __le16 time_stamp_off_a; 96 struct ieee80211_hdr hdr; 97 } __packed; 98 99 struct vnt_tx_datahead_ab { 100 struct vnt_phy_field ab; 101 __le16 duration; 102 __le16 time_stamp_off; 103 struct ieee80211_hdr hdr; 104 } __packed; 105 106 struct vnt_tx_datahead_a_fb { 107 struct vnt_phy_field a; 108 __le16 duration; 109 __le16 time_stamp_off; 110 __le16 duration_f0; 111 __le16 duration_f1; 112 struct ieee80211_hdr hdr; 113 } __packed; 114 115 /* RTS buffer header */ 116 struct vnt_rts_g { 117 struct vnt_phy_field b; 118 struct vnt_phy_field a; 119 __le16 duration_ba; 120 __le16 duration_aa; 121 __le16 duration_bb; 122 u16 wReserved; 123 struct ieee80211_rts data; 124 struct vnt_tx_datahead_g data_head; 125 } __packed; 126 127 struct vnt_rts_g_fb { 128 struct vnt_phy_field b; 129 struct vnt_phy_field a; 130 __le16 duration_ba; 131 __le16 duration_aa; 132 __le16 duration_bb; 133 u16 wReserved; 134 __le16 rts_duration_ba_f0; 135 __le16 rts_duration_aa_f0; 136 __le16 rts_duration_ba_f1; 137 __le16 rts_duration_aa_f1; 138 struct ieee80211_rts data; 139 struct vnt_tx_datahead_g_fb data_head; 140 } __packed; 141 142 struct vnt_rts_ab { 143 struct vnt_phy_field ab; 144 __le16 duration; 145 u16 wReserved; 146 struct ieee80211_rts data; 147 struct vnt_tx_datahead_ab data_head; 148 } __packed; 149 150 struct vnt_rts_a_fb { 151 struct vnt_phy_field a; 152 __le16 duration; 153 u16 wReserved; 154 __le16 rts_duration_f0; 155 __le16 rts_duration_f1; 156 struct ieee80211_rts data; 157 struct vnt_tx_datahead_a_fb data_head; 158 } __packed; 159 160 /* CTS buffer header */ 161 struct vnt_cts { 162 struct vnt_phy_field b; 163 __le16 duration_ba; 164 u16 wReserved; 165 struct ieee80211_cts data; 166 u16 reserved2; 167 struct vnt_tx_datahead_g data_head; 168 } __packed; 169 170 struct vnt_cts_fb { 171 struct vnt_phy_field b; 172 __le16 duration_ba; 173 u16 wReserved; 174 __le16 cts_duration_ba_f0; 175 __le16 cts_duration_ba_f1; 176 struct ieee80211_cts data; 177 u16 reserved2; 178 struct vnt_tx_datahead_g_fb data_head; 179 } __packed; 180 181 union vnt_tx_data_head { 182 /* rts g */ 183 struct vnt_rts_g rts_g; 184 struct vnt_rts_g_fb rts_g_fb; 185 /* rts a/b */ 186 struct vnt_rts_ab rts_ab; 187 struct vnt_rts_a_fb rts_a_fb; 188 /* cts g */ 189 struct vnt_cts cts_g; 190 struct vnt_cts_fb cts_g_fb; 191 /* no rts/cts */ 192 struct vnt_tx_datahead_a_fb data_head_a_fb; 193 struct vnt_tx_datahead_ab data_head_ab; 194 }; 195 196 struct vnt_tx_mic_hdr { 197 struct vnt_mic_hdr hdr; 198 union vnt_tx_data_head head; 199 } __packed; 200 201 union vnt_tx { 202 struct vnt_tx_mic_hdr mic; 203 union vnt_tx_data_head head; 204 }; 205 206 union vnt_tx_head { 207 struct { 208 struct vnt_rrv_time_rts rts; 209 union vnt_tx tx; 210 } __packed tx_rts; 211 struct { 212 struct vnt_rrv_time_cts cts; 213 union vnt_tx tx; 214 } __packed tx_cts; 215 struct { 216 struct vnt_rrv_time_ab ab; 217 union vnt_tx tx; 218 } __packed tx_ab; 219 }; 220 221 struct vnt_tx_fifo_head { 222 u8 tx_key[WLAN_KEY_LEN_CCMP]; 223 __le16 fifo_ctl; 224 __le16 time_stamp; 225 __le16 frag_ctl; 226 __le16 current_rate; 227 } __packed; 228 229 struct vnt_tx_buffer { 230 u8 type; 231 u8 pkt_no; 232 __le16 tx_byte_count; 233 struct vnt_tx_fifo_head fifo_head; 234 union vnt_tx_head tx_head; 235 } __packed; 236 237 struct vnt_tx_short_buf_head { 238 __le16 fifo_ctl; 239 u16 time_stamp; 240 struct vnt_phy_field ab; 241 __le16 duration; 242 __le16 time_stamp_off; 243 } __packed; 244 245 struct vnt_beacon_buffer { 246 u8 type; 247 u8 pkt_no; 248 __le16 tx_byte_count; 249 struct vnt_tx_short_buf_head short_head; 250 struct ieee80211_mgmt mgmt_hdr; 251 } __packed; 252 253 int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb); 254 int vnt_beacon_make(struct vnt_private *priv, struct ieee80211_vif *vif); 255 int vnt_beacon_enable(struct vnt_private *priv, struct ieee80211_vif *vif, 256 struct ieee80211_bss_conf *conf); 257 258 #endif /* __RXTX_H__ */ 259