| .. | .. |
|---|
| 1 | | -// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. |
|---|
| 4 | 4 | * All rights reserved. |
|---|
| .. | .. |
|---|
| 16 | 16 | #ifndef __DEVICE_H__ |
|---|
| 17 | 17 | #define __DEVICE_H__ |
|---|
| 18 | 18 | |
|---|
| 19 | +#include <linux/bits.h> |
|---|
| 19 | 20 | #include <linux/module.h> |
|---|
| 20 | 21 | #include <linux/kernel.h> |
|---|
| 21 | 22 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 71 | 72 | #define DEVICE_FULL_DRV_NAM "VIA Networking Wireless LAN USB Driver" |
|---|
| 72 | 73 | |
|---|
| 73 | 74 | #define DEVICE_VERSION "mac80211" |
|---|
| 75 | + |
|---|
| 76 | +#define FIRMWARE_VERSION 0x133 /* version 1.51 */ |
|---|
| 77 | +#define FIRMWARE_NAME "vntwusb.fw" |
|---|
| 78 | +#define FIRMWARE_CHUNK_SIZE 0x400 |
|---|
| 74 | 79 | |
|---|
| 75 | 80 | #define CONFIG_PATH "/etc/vntconfiguration.dat" |
|---|
| 76 | 81 | |
|---|
| .. | .. |
|---|
| 129 | 134 | #define EEP_OFS_OFDMA_PWR_TBL 0x50 |
|---|
| 130 | 135 | |
|---|
| 131 | 136 | /* Bits in EEP_OFS_ANTENNA */ |
|---|
| 132 | | -#define EEP_ANTENNA_MAIN 0x1 |
|---|
| 133 | | -#define EEP_ANTENNA_AUX 0x2 |
|---|
| 134 | | -#define EEP_ANTINV 0x4 |
|---|
| 137 | +#define EEP_ANTENNA_MAIN BIT(0) |
|---|
| 138 | +#define EEP_ANTENNA_AUX BIT(1) |
|---|
| 139 | +#define EEP_ANTINV BIT(2) |
|---|
| 135 | 140 | |
|---|
| 136 | 141 | /* Bits in EEP_OFS_RADIOCTL */ |
|---|
| 137 | | -#define EEP_RADIOCTL_ENABLE 0x80 |
|---|
| 142 | +#define EEP_RADIOCTL_ENABLE BIT(7) |
|---|
| 138 | 143 | |
|---|
| 139 | 144 | /* control commands */ |
|---|
| 140 | 145 | #define MESSAGE_TYPE_READ 0x1 |
|---|
| .. | .. |
|---|
| 201 | 206 | * Enum of context types for SendPacket |
|---|
| 202 | 207 | */ |
|---|
| 203 | 208 | enum { |
|---|
| 204 | | - CONTEXT_DATA_PACKET = 1, |
|---|
| 205 | | - CONTEXT_MGMT_PACKET, |
|---|
| 209 | + CONTEXT_DATA_PACKET = 0, |
|---|
| 206 | 210 | CONTEXT_BEACON_PACKET |
|---|
| 207 | 211 | }; |
|---|
| 212 | + |
|---|
| 213 | +struct vnt_rx_header { |
|---|
| 214 | + u32 wbk_status; |
|---|
| 215 | + u8 rx_sts; |
|---|
| 216 | + u8 rx_rate; |
|---|
| 217 | + u16 pay_load_len; |
|---|
| 218 | +} __packed; |
|---|
| 219 | + |
|---|
| 220 | +struct vnt_rx_tail { |
|---|
| 221 | + __le64 tsf_time; |
|---|
| 222 | + u8 sq; |
|---|
| 223 | + u8 new_rsr; |
|---|
| 224 | + u8 rssi; |
|---|
| 225 | + u8 rsr; |
|---|
| 226 | + u8 sq_3; |
|---|
| 227 | +} __packed; |
|---|
| 208 | 228 | |
|---|
| 209 | 229 | /* RCB (Receive Control Block) */ |
|---|
| 210 | 230 | struct vnt_rcb { |
|---|
| 211 | 231 | void *priv; |
|---|
| 212 | 232 | struct urb *urb; |
|---|
| 213 | 233 | struct sk_buff *skb; |
|---|
| 214 | | - int in_use; |
|---|
| 215 | 234 | }; |
|---|
| 216 | 235 | |
|---|
| 217 | 236 | /* used to track bulk out irps */ |
|---|
| 218 | 237 | struct vnt_usb_send_context { |
|---|
| 219 | 238 | void *priv; |
|---|
| 220 | 239 | struct sk_buff *skb; |
|---|
| 221 | | - struct urb *urb; |
|---|
| 222 | | - struct ieee80211_hdr *hdr; |
|---|
| 223 | | - unsigned int buf_len; |
|---|
| 240 | + void *tx_buffer; |
|---|
| 224 | 241 | u32 frame_len; |
|---|
| 225 | 242 | u16 tx_hdr_size; |
|---|
| 226 | 243 | u16 tx_rate; |
|---|
| 227 | 244 | u8 type; |
|---|
| 228 | 245 | u8 pkt_no; |
|---|
| 229 | 246 | u8 pkt_type; |
|---|
| 230 | | - u8 need_ack; |
|---|
| 231 | | - u8 fb_option; |
|---|
| 232 | 247 | bool in_use; |
|---|
| 233 | | - unsigned char data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS]; |
|---|
| 234 | 248 | }; |
|---|
| 235 | 249 | |
|---|
| 236 | 250 | /* |
|---|
| .. | .. |
|---|
| 238 | 252 | */ |
|---|
| 239 | 253 | struct vnt_interrupt_buffer { |
|---|
| 240 | 254 | u8 *data_buf; |
|---|
| 241 | | - bool in_use; |
|---|
| 242 | | -}; |
|---|
| 243 | | - |
|---|
| 244 | | -/*++ NDIS related */ |
|---|
| 245 | | - |
|---|
| 246 | | -enum { |
|---|
| 247 | | - STATUS_SUCCESS = 0, |
|---|
| 248 | | - STATUS_FAILURE, |
|---|
| 249 | | - STATUS_RESOURCES, |
|---|
| 250 | | - STATUS_PENDING, |
|---|
| 251 | 255 | }; |
|---|
| 252 | 256 | |
|---|
| 253 | 257 | /* flags for options */ |
|---|
| .. | .. |
|---|
| 264 | 268 | struct usb_interface *intf; |
|---|
| 265 | 269 | |
|---|
| 266 | 270 | u64 tsf_time; |
|---|
| 267 | | - u8 rx_rate; |
|---|
| 268 | 271 | |
|---|
| 269 | 272 | u32 rx_buf_sz; |
|---|
| 270 | 273 | int mc_list_count; |
|---|
| .. | .. |
|---|
| 284 | 287 | |
|---|
| 285 | 288 | /* Variables to track resources for the BULK Out Pipe */ |
|---|
| 286 | 289 | struct vnt_usb_send_context *tx_context[CB_MAX_TX_DESC]; |
|---|
| 290 | + struct usb_anchor tx_submitted; |
|---|
| 287 | 291 | u32 num_tx_context; |
|---|
| 288 | 292 | |
|---|
| 289 | 293 | /* Variables to track resources for the Interrupt In Pipe */ |
|---|
| .. | .. |
|---|
| 340 | 344 | u8 ofdm_pwr_tbl[14]; |
|---|
| 341 | 345 | u8 ofdm_a_pwr_tbl[42]; |
|---|
| 342 | 346 | |
|---|
| 343 | | - u16 current_rate; |
|---|
| 344 | 347 | u16 tx_rate_fb0; |
|---|
| 345 | 348 | u16 tx_rate_fb1; |
|---|
| 346 | | - |
|---|
| 347 | | - u8 short_retry_limit; |
|---|
| 348 | | - u8 long_retry_limit; |
|---|
| 349 | 349 | |
|---|
| 350 | 350 | enum nl80211_iftype op_mode; |
|---|
| 351 | 351 | |
|---|
| .. | .. |
|---|
| 378 | 378 | |
|---|
| 379 | 379 | u8 bb_pre_ed_rssi; |
|---|
| 380 | 380 | u8 bb_pre_ed_index; |
|---|
| 381 | | - |
|---|
| 382 | | - u16 wake_up_count; |
|---|
| 383 | 381 | |
|---|
| 384 | 382 | /* command timer */ |
|---|
| 385 | 383 | struct delayed_work run_command_work; |
|---|