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_g_fb { 77 struct vnt_phy_field b; 78 struct vnt_phy_field a; 79 __le16 duration_b; 80 __le16 duration_a; 81 __le16 duration_a_f0; 82 __le16 duration_a_f1; 83 __le16 time_stamp_off_b; 84 __le16 time_stamp_off_a; 85 struct ieee80211_hdr hdr; 86 } __packed; 87 88 struct vnt_tx_datahead_ab { 89 struct vnt_phy_field ab; 90 __le16 duration; 91 __le16 time_stamp_off; 92 struct ieee80211_hdr hdr; 93 } __packed; 94 95 struct vnt_tx_datahead_a_fb { 96 struct vnt_phy_field a; 97 __le16 duration; 98 __le16 time_stamp_off; 99 __le16 duration_f0; 100 __le16 duration_f1; 101 struct ieee80211_hdr hdr; 102 } __packed; 103 104 /* RTS buffer header */ 105 struct vnt_rts_g { 106 struct vnt_phy_field b; 107 struct vnt_phy_field a; 108 __le16 duration_ba; 109 __le16 duration_aa; 110 __le16 duration_bb; 111 u16 wReserved; 112 struct ieee80211_rts data; 113 struct vnt_tx_datahead_g data_head; 114 } __packed; 115 116 struct vnt_rts_g_fb { 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 __le16 rts_duration_ba_f0; 124 __le16 rts_duration_aa_f0; 125 __le16 rts_duration_ba_f1; 126 __le16 rts_duration_aa_f1; 127 struct ieee80211_rts data; 128 struct vnt_tx_datahead_g_fb data_head; 129 } __packed; 130 131 struct vnt_rts_ab { 132 struct vnt_phy_field ab; 133 __le16 duration; 134 u16 wReserved; 135 struct ieee80211_rts data; 136 struct vnt_tx_datahead_ab data_head; 137 } __packed; 138 139 struct vnt_rts_a_fb { 140 struct vnt_phy_field a; 141 __le16 duration; 142 u16 wReserved; 143 __le16 rts_duration_f0; 144 __le16 rts_duration_f1; 145 struct ieee80211_rts data; 146 struct vnt_tx_datahead_a_fb data_head; 147 } __packed; 148 149 /* CTS buffer header */ 150 struct vnt_cts { 151 struct vnt_phy_field b; 152 __le16 duration_ba; 153 u16 wReserved; 154 struct ieee80211_cts data; 155 u16 reserved2; 156 struct vnt_tx_datahead_g data_head; 157 } __packed; 158 159 struct vnt_cts_fb { 160 struct vnt_phy_field b; 161 __le16 duration_ba; 162 u16 wReserved; 163 __le16 cts_duration_ba_f0; 164 __le16 cts_duration_ba_f1; 165 struct ieee80211_cts data; 166 u16 reserved2; 167 struct vnt_tx_datahead_g_fb data_head; 168 } __packed; 169 170 union vnt_tx_data_head { 171 /* rts g */ 172 struct vnt_rts_g rts_g; 173 struct vnt_rts_g_fb rts_g_fb; 174 /* rts a/b */ 175 struct vnt_rts_ab rts_ab; 176 struct vnt_rts_a_fb rts_a_fb; 177 /* cts g */ 178 struct vnt_cts cts_g; 179 struct vnt_cts_fb cts_g_fb; 180 /* no rts/cts */ 181 struct vnt_tx_datahead_a_fb data_head_a_fb; 182 struct vnt_tx_datahead_ab data_head_ab; 183 }; 184 185 struct vnt_tx_mic_hdr { 186 struct vnt_mic_hdr hdr; 187 union vnt_tx_data_head head; 188 } __packed; 189 190 union vnt_tx { 191 struct vnt_tx_mic_hdr mic; 192 union vnt_tx_data_head head; 193 }; 194 195 union vnt_tx_head { 196 struct { 197 struct vnt_rrv_time_rts rts; 198 union vnt_tx tx; 199 } __packed tx_rts; 200 struct { 201 struct vnt_rrv_time_cts cts; 202 union vnt_tx tx; 203 } __packed tx_cts; 204 struct { 205 struct vnt_rrv_time_ab ab; 206 union vnt_tx tx; 207 } __packed tx_ab; 208 }; 209 210 struct vnt_tx_fifo_head { 211 u8 tx_key[WLAN_KEY_LEN_CCMP]; 212 __le16 fifo_ctl; 213 __le16 time_stamp; 214 __le16 frag_ctl; 215 __le16 current_rate; 216 } __packed; 217 218 struct vnt_tx_buffer { 219 u8 type; 220 u8 pkt_no; 221 __le16 tx_byte_count; 222 struct vnt_tx_fifo_head fifo_head; 223 union vnt_tx_head tx_head; 224 } __packed; 225 226 struct vnt_tx_short_buf_head { 227 __le16 fifo_ctl; 228 u16 time_stamp; 229 struct vnt_phy_field ab; 230 __le16 duration; 231 __le16 time_stamp_off; 232 } __packed; 233 234 struct vnt_beacon_buffer { 235 u8 type; 236 u8 pkt_no; 237 __le16 tx_byte_count; 238 struct vnt_tx_short_buf_head short_head; 239 struct ieee80211_mgmt mgmt_hdr; 240 } __packed; 241 242 int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb); 243 int vnt_beacon_make(struct vnt_private *priv, struct ieee80211_vif *vif); 244 int vnt_beacon_enable(struct vnt_private *priv, struct ieee80211_vif *vif, 245 struct ieee80211_bss_conf *conf); 246 247 #endif /* __RXTX_H__ */ 248