Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'staging-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver updates from Greg KH:
"Here is the big set of staging driver cleanups and removals for
6.12-rc1.

Nothing exciting here, just slow, constant, forward progress in
removing code and cleaning up some old drivers, along with removing
one of them that was not being used anymore at all. In discussions
with some developers this past week, even more deletions will be
happening for the next major merge window, as we seems to have code
here that obviously no one is using anymore.

Along with the normal cleanups is the good vme_user code forward
progress, the one major bright spot in the staging subsystem for code
that people rely on, and is getting good development behind it.
Hopefully it can graduate out of staging "soon".

All of these changes have been in linux-next for a long time with no
reported problems"

* tag 'staging-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (141 commits)
staging: vt6655: Rename variable apTD1Rings
staging: vt6655: Rename variable apTD0Rings
staging: rtl8723bs: remove unused 'poll_cnt' from rtw_set_rpwm()
staging: rtl8723bs: remove unused cnt from recv_func()
staging: rtl8723bs: remove unused efuseValue from efuse_OneByteWrite()
staging: rtl8712: remove unused drvinfo_sz from update_recvframe_attrib
staging: vt6655: mac.h: Fix possible precedence issue in macros
staging: rtl8723bs: include: Remove spaces before tabs in rtw_security.h
staging: rtl8723bs: include: Fix trailing */ position in rtw_security.h
staging: rtl8723bs: include: Fix indent for else block struct in rtw_security.h
staging: rtl8723bs: include: Fix indent for struct _byte_ in rtw_security.h
staging: rtl8723bs: include: Fix use of tabs for indent in rtw_security.h
staging: rtl8723bs: include: Fix indent for switch block in rtw_security.h
staging: rtl8723bs: include: Fix indent for switch case in rtw_security.h
staging: rtl8723bs: include: Fix open brace position in rtw_security.h
staging: nvec: Use IRQF_NO_AUTOEN flag in request_irq()
staging: rtl8723bs: Remove unused file rtw_rf.c
staging: rtl8723bs: Remove unused function rtw_ch2freq
staging: rtl8723bs: Remove unused files rtw_debug.c and rtw_debug.h
staging: rtl8723bs: Remove unused function dump_4_regs
...

+835 -8539
-2
drivers/staging/Kconfig
··· 54 54 55 55 source "drivers/staging/most/Kconfig" 56 56 57 - source "drivers/staging/ks7010/Kconfig" 58 - 59 57 source "drivers/staging/greybus/Kconfig" 60 58 61 59 source "drivers/staging/vc04_services/Kconfig"
-1
drivers/staging/Makefile
··· 17 17 obj-$(CONFIG_LTE_GDM724X) += gdm724x/ 18 18 obj-$(CONFIG_FB_TFT) += fbtft/ 19 19 obj-$(CONFIG_MOST) += most/ 20 - obj-$(CONFIG_KS7010) += ks7010/ 21 20 obj-$(CONFIG_GREYBUS) += greybus/ 22 21 obj-$(CONFIG_BCM2835_VCHIQ) += vc04_services/ 23 22 obj-$(CONFIG_XIL_AXIS_FIFO) += axis-fifo/
-2
drivers/staging/fbtft/fb_ili9320.c
··· 35 35 par->fbtftops.reset(par); 36 36 37 37 devcode = read_devicecode(par); 38 - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "Device code: 0x%04X\n", 39 - devcode); 40 38 if ((devcode != 0x0000) && (devcode != 0x9320)) 41 39 dev_warn(par->info->device, 42 40 "Unrecognized Device code: 0x%04X (expected 0x9320)\n",
-7
drivers/staging/fbtft/fb_ra8875.c
··· 41 41 { 42 42 gpiod_set_value(par->gpio.dc, 1); 43 43 44 - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, 45 - "%s()\n", __func__); 46 - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, 47 - "display size %dx%d\n", 48 - par->info->var.xres, 49 - par->info->var.yres); 50 - 51 44 par->fbtftops.reset(par); 52 45 53 46 if ((par->info->var.xres == 320) && (par->info->var.yres == 240)) {
-3
drivers/staging/fbtft/fb_sh1106.c
··· 88 88 89 89 static int blank(struct fbtft_par *par, bool on) 90 90 { 91 - fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n", 92 - __func__, on ? "true" : "false"); 93 - 94 91 write_reg(par, on ? 0xAE : 0xAF); 95 92 96 93 return 0;
-3
drivers/staging/fbtft/fb_ssd1289.c
··· 93 93 { 94 94 if (par->fbtftops.init_display != init_display) { 95 95 /* don't risk messing up register 11h */ 96 - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, 97 - "%s: skipping since custom init_display() is used\n", 98 - __func__); 99 96 return 0; 100 97 } 101 98
-3
drivers/staging/fbtft/fb_ssd1306.c
··· 148 148 149 149 static int blank(struct fbtft_par *par, bool on) 150 150 { 151 - fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n", 152 - __func__, on ? "true" : "false"); 153 - 154 151 if (on) 155 152 write_reg(par, 0xAE); 156 153 else
-9
drivers/staging/fbtft/fb_ssd1325.c
··· 72 72 73 73 static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) 74 74 { 75 - fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, 76 - "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, 77 - ye); 78 - 79 75 write_reg(par, 0x75); 80 76 write_reg(par, 0x00); 81 77 write_reg(par, 0x3f); ··· 82 86 83 87 static int blank(struct fbtft_par *par, bool on) 84 88 { 85 - fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n", 86 - __func__, on ? "true" : "false"); 87 - 88 89 if (on) 89 90 write_reg(par, 0xAE); 90 91 else ··· 101 108 static int set_gamma(struct fbtft_par *par, u32 *curves) 102 109 { 103 110 int i; 104 - 105 - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); 106 111 107 112 for (i = 0; i < GAMMA_LEN; i++) { 108 113 if (i > 0 && curves[i] < 1) {
-2
drivers/staging/fbtft/fb_ssd1331.c
··· 167 167 168 168 static int blank(struct fbtft_par *par, bool on) 169 169 { 170 - fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n", 171 - __func__, on ? "true" : "false"); 172 170 if (on) 173 171 write_reg(par, 0xAE); 174 172 else
+1 -4
drivers/staging/fbtft/fb_ssd1351.c
··· 72 72 73 73 if (par->fbtftops.init_display != init_display) { 74 74 /* don't risk messing up register A0h */ 75 - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, 76 - "%s: skipping since custom init_display() is used\n", 77 - __func__); 78 75 return 0; 79 76 } 80 77 ··· 210 213 struct backlight_properties bl_props = { 0, }; 211 214 212 215 bl_props.type = BACKLIGHT_RAW; 213 - bl_props.power = FB_BLANK_POWERDOWN; 216 + bl_props.power = BACKLIGHT_POWER_OFF; 214 217 215 218 bd = backlight_device_register(dev_driver_string(par->info->device), 216 219 par->info->device, par, &bl_ops,
-3
drivers/staging/fbtft/fb_uc1611.c
··· 135 135 136 136 static int blank(struct fbtft_par *par, bool on) 137 137 { 138 - fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n", 139 - __func__, on ? "true" : "false"); 140 - 141 138 if (on) 142 139 write_reg(par, 0xA8 | 0x00); 143 140 else
-9
drivers/staging/fbtft/fbtft-bus.c
··· 129 129 int ret = 0; 130 130 size_t startbyte_size = 0; 131 131 132 - fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s(offset=%zu, len=%zu)\n", 133 - __func__, offset, len); 134 - 135 132 remain = len / 2; 136 133 vmem16 = (u16 *)(par->info->screen_buffer + offset); 137 134 ··· 179 182 int i; 180 183 int ret = 0; 181 184 182 - fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s(offset=%zu, len=%zu)\n", 183 - __func__, offset, len); 184 - 185 185 if (!par->txbuf.buf) { 186 186 dev_err(par->info->device, "%s: txbuf.buf is NULL\n", __func__); 187 187 return -1; ··· 225 231 int fbtft_write_vmem16_bus16(struct fbtft_par *par, size_t offset, size_t len) 226 232 { 227 233 u16 *vmem16; 228 - 229 - fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s(offset=%zu, len=%zu)\n", 230 - __func__, offset, len); 231 234 232 235 vmem16 = (u16 *)(par->info->screen_buffer + offset); 233 236
+3 -10
drivers/staging/fbtft/fbtft-core.c
··· 152 152 void fbtft_unregister_backlight(struct fbtft_par *par) 153 153 { 154 154 if (par->info->bl_dev) { 155 - par->info->bl_dev->props.power = FB_BLANK_POWERDOWN; 155 + par->info->bl_dev->props.power = BACKLIGHT_POWER_OFF; 156 156 backlight_update_status(par->info->bl_dev); 157 157 backlight_device_unregister(par->info->bl_dev); 158 158 par->info->bl_dev = NULL; ··· 178 178 179 179 bl_props.type = BACKLIGHT_RAW; 180 180 /* Assume backlight is off, get polarity from current state of pin */ 181 - bl_props.power = FB_BLANK_POWERDOWN; 181 + bl_props.power = BACKLIGHT_POWER_OFF; 182 182 if (!gpiod_get_value(par->gpio.led[0])) 183 183 par->polarity = true; 184 184 ··· 214 214 { 215 215 if (!par->gpio.reset) 216 216 return; 217 - 218 - fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__); 219 217 220 218 gpiod_set_value_cansleep(par->gpio.reset, 1); 221 219 usleep_range(20, 40); ··· 799 801 800 802 /* Turn on backlight if available */ 801 803 if (fb_info->bl_dev) { 802 - fb_info->bl_dev->props.power = FB_BLANK_UNBLANK; 804 + fb_info->bl_dev->props.power = BACKLIGHT_POWER_ON; 803 805 fb_info->bl_dev->ops->update_status(fb_info->bl_dev); 804 806 } 805 807 ··· 1050 1052 struct fbtft_platform_data *pdata = par->pdata; 1051 1053 int i; 1052 1054 1053 - fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); 1054 - 1055 1055 if (pdata->display.buswidth != 9 && par->startbyte == 0 && 1056 1056 !par->gpio.dc) { 1057 1057 dev_err(par->info->device, ··· 1152 1156 dev = &sdev->dev; 1153 1157 else 1154 1158 dev = &pdev->dev; 1155 - 1156 - if (unlikely(display->debug & DEBUG_DRIVER_INIT_FUNCTIONS)) 1157 - dev_info(dev, "%s()\n", __func__); 1158 1159 1159 1160 pdata = dev->platform_data; 1160 1161 if (!pdata) {
-4
drivers/staging/fbtft/fbtft-sysfs.c
··· 27 27 int curve_counter, value_counter; 28 28 int _count; 29 29 30 - fbtft_par_dbg(DEBUG_SYSFS, par, "%s() str=\n", __func__); 31 - 32 30 if (!str || !curves) 33 31 return -EINVAL; 34 - 35 - fbtft_par_dbg(DEBUG_SYSFS, par, "%s\n", str); 36 32 37 33 tmp = kmemdup(str, size + 1, GFP_KERNEL); 38 34 if (!tmp)
+2
drivers/staging/fbtft/fbtft.h
··· 202 202 u8 *buf; 203 203 u8 startbyte; 204 204 struct fbtft_ops fbtftops; 205 + /* Spinlock to ensure thread-safe access to dirty_lines_start and dirty_lines_end */ 205 206 spinlock_t dirty_lock; 206 207 unsigned int dirty_lines_start; 207 208 unsigned int dirty_lines_end; ··· 219 218 } gpio; 220 219 const s16 *init_sequence; 221 220 struct { 221 + /* Mutex to synchronize access to gamma curve locking */ 222 222 struct mutex lock; 223 223 u32 *curves; 224 224 int num_values;
+2 -2
drivers/staging/greybus/gb-camera.h
··· 92 92 unsigned int *flags, struct gb_camera_stream *streams, 93 93 struct gb_camera_csi_params *csi_params); 94 94 int (*capture)(void *priv, u32 request_id, 95 - unsigned int streams, unsigned int num_frames, 96 - size_t settings_size, const void *settings); 95 + unsigned int streams, unsigned int num_frames, 96 + size_t settings_size, const void *settings); 97 97 int (*flush)(void *priv, u32 *request_id); 98 98 }; 99 99
+3 -3
drivers/staging/greybus/spilib.c
··· 490 490 int ret; 491 491 u8 i; 492 492 493 - /* Allocate master with space for data */ 494 - ctlr = spi_alloc_master(dev, sizeof(*spi)); 493 + /* Allocate host with space for data */ 494 + ctlr = spi_alloc_host(dev, sizeof(*spi)); 495 495 if (!ctlr) { 496 - dev_err(dev, "cannot alloc SPI master\n"); 496 + dev_err(dev, "cannot alloc SPI host\n"); 497 497 return -ENOMEM; 498 498 } 499 499
-14
drivers/staging/ks7010/Kconfig
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - config KS7010 3 - tristate "KeyStream KS7010 SDIO support" 4 - depends on MMC && WIRELESS 5 - select WIRELESS_EXT 6 - select WEXT_PRIV 7 - select FW_LOADER 8 - select CRYPTO 9 - select CRYPTO_HASH 10 - select CRYPTO_MICHAEL_MIC 11 - help 12 - This is a driver for KeyStream KS7010 based SDIO WIFI cards. It is 13 - found on at least later Spectec SDW-821 (FCC-ID "S2Y-WLAN-11G-K" only, 14 - sadly not FCC-ID "S2Y-WLAN-11B-G") and Spectec SDW-823 microSD cards.
-4
drivers/staging/ks7010/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - obj-$(CONFIG_KS7010) += ks7010.o 3 - 4 - ks7010-y := ks_hostif.o ks_wlan_net.o ks7010_sdio.o
-36
drivers/staging/ks7010/TODO
··· 1 - KS7010 Linux driver 2 - =================== 3 - 4 - This driver is based on source code from the Ben Nanonote extra repository [1] 5 - which is based on the original v007 release from Renesas [2]. Some more 6 - background info about the chipset can be found here [3] and here [4]. Thank 7 - you to all which already participated in cleaning up the driver so far! 8 - 9 - [1] http://projects.qi-hardware.com/index.php/p/openwrt-packages/source/tree/master/ks7010/src 10 - [2] http://downloads.qi-hardware.com/software/ks7010_sdio_v007.tar.bz2 11 - [3] http://en.qi-hardware.com/wiki/Ben_NanoNote_Wi-Fi 12 - [4] https://wikidevi.com/wiki/Renesas 13 - 14 - TODO 15 - ---- 16 - 17 - First a few words what not to do (at least not blindly): 18 - 19 - - don't be overly strict with the 80 char limit. Only if it REALLY makes the 20 - code more readable 21 - 22 - Now the TODOs: 23 - 24 - - fix codechecker warnings (checkpatch, sparse, smatch). But PLEASE make sure 25 - that you are not only silencing the warning but really fixing code. You 26 - should understand the change you submit. 27 - - fix the 'card removal' event when card is inserted when booting 28 - - check what other upstream wireless mechanisms can be used instead of the 29 - custom ones here 30 - - Switch to use LIB80211. 31 - - Switch to use MAC80211. 32 - - Switch to use CFG80211. 33 - 34 - Please send any patches to: 35 - Greg Kroah-Hartman <gregkh@linuxfoundation.org> 36 - Linux Driver Project Developer List <driverdev-devel@linuxdriverproject.org>
-70
drivers/staging/ks7010/eap_packet.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef EAP_PACKET_H 3 - #define EAP_PACKET_H 4 - 5 - #include <linux/compiler.h> 6 - #include <linux/bitops.h> 7 - #include <uapi/linux/if_ether.h> 8 - 9 - struct ether_hdr { 10 - unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ 11 - unsigned char h_source[ETH_ALEN]; /* source ether addr */ 12 - unsigned char h_dest_snap; 13 - unsigned char h_source_snap; 14 - unsigned char h_command; 15 - unsigned char h_vendor_id[3]; 16 - __be16 h_proto; /* packet type ID field */ 17 - /* followed by length octets of data */ 18 - } __packed; 19 - 20 - #define ETHER_HDR_SIZE sizeof(struct ether_hdr) 21 - 22 - struct ieee802_1x_hdr { 23 - unsigned char version; 24 - unsigned char type; 25 - unsigned short length; 26 - /* followed by length octets of data */ 27 - } __packed; 28 - 29 - enum { 30 - IEEE802_1X_TYPE_EAP_PACKET = 0, 31 - IEEE802_1X_TYPE_EAPOL_START = 1, 32 - IEEE802_1X_TYPE_EAPOL_LOGOFF = 2, 33 - IEEE802_1X_TYPE_EAPOL_KEY = 3, 34 - IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4 35 - }; 36 - 37 - #define WPA_NONCE_LEN 32 38 - #define WPA_REPLAY_COUNTER_LEN 8 39 - 40 - struct wpa_eapol_key { 41 - unsigned char type; 42 - __be16 key_info; 43 - unsigned short key_length; 44 - unsigned char replay_counter[WPA_REPLAY_COUNTER_LEN]; 45 - unsigned char key_nonce[WPA_NONCE_LEN]; 46 - unsigned char key_iv[16]; 47 - unsigned char key_rsc[8]; 48 - unsigned char key_id[8]; /* Reserved in IEEE 802.11i/RSN */ 49 - unsigned char key_mic[16]; 50 - unsigned short key_data_length; 51 - /* followed by key_data_length bytes of key_data */ 52 - } __packed; 53 - 54 - #define WPA_KEY_INFO_TYPE_MASK GENMASK(2, 0) 55 - #define WPA_KEY_INFO_TYPE_HMAC_MD5_RC4 BIT(0) 56 - #define WPA_KEY_INFO_TYPE_HMAC_SHA1_AES BIT(1) 57 - #define WPA_KEY_INFO_KEY_TYPE BIT(3) /* 1 = Pairwise, 0 = Group key */ 58 - /* bit4..5 is used in WPA, but is reserved in IEEE 802.11i/RSN */ 59 - #define WPA_KEY_INFO_KEY_INDEX_MASK GENMASK(5, 4) 60 - #define WPA_KEY_INFO_KEY_INDEX_SHIFT 4 61 - #define WPA_KEY_INFO_INSTALL BIT(6) /* pairwise */ 62 - #define WPA_KEY_INFO_TXRX BIT(6) /* group */ 63 - #define WPA_KEY_INFO_ACK BIT(7) 64 - #define WPA_KEY_INFO_MIC BIT(8) 65 - #define WPA_KEY_INFO_SECURE BIT(9) 66 - #define WPA_KEY_INFO_ERROR BIT(10) 67 - #define WPA_KEY_INFO_REQUEST BIT(11) 68 - #define WPA_KEY_INFO_ENCR_KEY_DATA BIT(12) /* IEEE 802.11i/RSN only */ 69 - 70 - #endif /* EAP_PACKET_H */
-1143
drivers/staging/ks7010/ks7010_sdio.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Driver for KeyStream, KS7010 based SDIO cards. 4 - * 5 - * Copyright (C) 2006-2008 KeyStream Corp. 6 - * Copyright (C) 2009 Renesas Technology Corp. 7 - * Copyright (C) 2016 Sang Engineering, Wolfram Sang 8 - */ 9 - 10 - #include <linux/atomic.h> 11 - #include <linux/firmware.h> 12 - #include <linux/jiffies.h> 13 - #include <linux/mmc/card.h> 14 - #include <linux/mmc/sdio_func.h> 15 - #include <linux/module.h> 16 - #include <linux/workqueue.h> 17 - #include "ks_wlan.h" 18 - #include "ks_hostif.h" 19 - 20 - #define ROM_FILE "ks7010sd.rom" 21 - 22 - /* SDIO KeyStream vendor and device */ 23 - #define SDIO_VENDOR_ID_KS_CODE_A 0x005b 24 - #define SDIO_VENDOR_ID_KS_CODE_B 0x0023 25 - 26 - /* Older sources suggest earlier versions were named 7910 or 79xx */ 27 - #define SDIO_DEVICE_ID_KS_7010 0x7910 28 - 29 - /* Read/Write Status Register */ 30 - #define READ_STATUS_REG 0x000000 31 - #define WRITE_STATUS_REG 0x00000C 32 - enum reg_status_type { 33 - REG_STATUS_BUSY, 34 - REG_STATUS_IDLE 35 - }; 36 - 37 - /* Read Index Register */ 38 - #define READ_INDEX_REG 0x000004 39 - 40 - /* Read Data Size Register */ 41 - #define READ_DATA_SIZE_REG 0x000008 42 - 43 - /* Write Index Register */ 44 - #define WRITE_INDEX_REG 0x000010 45 - 46 - /* 47 - * Write Status/Read Data Size Register 48 - * for network packet (less than 2048 bytes data) 49 - */ 50 - #define WSTATUS_RSIZE_REG 0x000014 51 - 52 - /* Write Status Register value */ 53 - #define WSTATUS_MASK 0x80 54 - 55 - /* Read Data Size Register value [10:4] */ 56 - #define RSIZE_MASK 0x7F 57 - 58 - /* ARM to SD interrupt Enable */ 59 - #define INT_ENABLE_REG 0x000020 60 - /* ARM to SD interrupt Pending */ 61 - #define INT_PENDING_REG 0x000024 62 - 63 - #define INT_GCR_B BIT(7) 64 - #define INT_GCR_A BIT(6) 65 - #define INT_WRITE_STATUS BIT(5) 66 - #define INT_WRITE_INDEX BIT(4) 67 - #define INT_WRITE_SIZE BIT(3) 68 - #define INT_READ_STATUS BIT(2) 69 - #define INT_READ_INDEX BIT(1) 70 - #define INT_READ_SIZE BIT(0) 71 - 72 - /* General Communication Register A */ 73 - #define GCR_A_REG 0x000028 74 - enum gen_com_reg_a { 75 - GCR_A_INIT, 76 - GCR_A_REMAP, 77 - GCR_A_RUN 78 - }; 79 - 80 - /* General Communication Register B */ 81 - #define GCR_B_REG 0x00002C 82 - enum gen_com_reg_b { 83 - GCR_B_ACTIVE, 84 - GCR_B_DOZE 85 - }; 86 - 87 - /* Wakeup Register */ 88 - #define WAKEUP_REG 0x008018 89 - #define WAKEUP_REQ 0x5a 90 - 91 - /* AHB Data Window 0x010000-0x01FFFF */ 92 - #define DATA_WINDOW 0x010000 93 - #define WINDOW_SIZE (64 * 1024) 94 - 95 - #define KS7010_IRAM_ADDRESS 0x06000000 96 - 97 - #define KS7010_IO_BLOCK_SIZE 512 98 - 99 - /** 100 - * struct ks_sdio_card - SDIO device data. 101 - * 102 - * Structure is used as the &struct sdio_func private data. 103 - * 104 - * @func: Pointer to the SDIO function device. 105 - * @priv: Pointer to the &struct net_device private data. 106 - */ 107 - struct ks_sdio_card { 108 - struct sdio_func *func; 109 - struct ks_wlan_private *priv; 110 - }; 111 - 112 - static struct sdio_func *ks7010_to_func(struct ks_wlan_private *priv) 113 - { 114 - struct ks_sdio_card *ks_sdio = priv->if_hw; 115 - 116 - return ks_sdio->func; 117 - } 118 - 119 - /* Read single byte from device address into byte (CMD52) */ 120 - static int ks7010_sdio_readb(struct ks_wlan_private *priv, 121 - u32 address, u8 *byte) 122 - { 123 - struct sdio_func *func = ks7010_to_func(priv); 124 - int ret; 125 - 126 - *byte = sdio_readb(func, address, &ret); 127 - 128 - return ret; 129 - } 130 - 131 - /* Read length bytes from device address into buffer (CMD53) */ 132 - static int ks7010_sdio_read(struct ks_wlan_private *priv, u32 address, 133 - u8 *buffer, unsigned int length) 134 - { 135 - struct sdio_func *func = ks7010_to_func(priv); 136 - 137 - return sdio_memcpy_fromio(func, buffer, address, length); 138 - } 139 - 140 - /* Write single byte to device address (CMD52) */ 141 - static int ks7010_sdio_writeb(struct ks_wlan_private *priv, 142 - u32 address, u8 byte) 143 - { 144 - struct sdio_func *func = ks7010_to_func(priv); 145 - int ret; 146 - 147 - sdio_writeb(func, byte, address, &ret); 148 - 149 - return ret; 150 - } 151 - 152 - /* Write length bytes to device address from buffer (CMD53) */ 153 - static int ks7010_sdio_write(struct ks_wlan_private *priv, u32 address, 154 - u8 *buffer, unsigned int length) 155 - { 156 - struct sdio_func *func = ks7010_to_func(priv); 157 - 158 - return sdio_memcpy_toio(func, address, buffer, length); 159 - } 160 - 161 - static void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private *priv) 162 - { 163 - int ret; 164 - 165 - /* clear request */ 166 - atomic_set(&priv->sleepstatus.doze_request, 0); 167 - 168 - if (atomic_read(&priv->sleepstatus.status) == 0) { 169 - ret = ks7010_sdio_writeb(priv, GCR_B_REG, GCR_B_DOZE); 170 - if (ret) { 171 - netdev_err(priv->net_dev, "write GCR_B_REG\n"); 172 - goto set_sleep_mode; 173 - } 174 - atomic_set(&priv->sleepstatus.status, 1); 175 - priv->last_doze = jiffies; 176 - } 177 - 178 - set_sleep_mode: 179 - priv->sleep_mode = atomic_read(&priv->sleepstatus.status); 180 - } 181 - 182 - static void ks_wlan_hw_sleep_wakeup_request(struct ks_wlan_private *priv) 183 - { 184 - int ret; 185 - 186 - /* clear request */ 187 - atomic_set(&priv->sleepstatus.wakeup_request, 0); 188 - 189 - if (atomic_read(&priv->sleepstatus.status) == 1) { 190 - ret = ks7010_sdio_writeb(priv, WAKEUP_REG, WAKEUP_REQ); 191 - if (ret) { 192 - netdev_err(priv->net_dev, "write WAKEUP_REG\n"); 193 - goto set_sleep_mode; 194 - } 195 - atomic_set(&priv->sleepstatus.status, 0); 196 - priv->last_wakeup = jiffies; 197 - ++priv->wakeup_count; 198 - } 199 - 200 - set_sleep_mode: 201 - priv->sleep_mode = atomic_read(&priv->sleepstatus.status); 202 - } 203 - 204 - void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv) 205 - { 206 - int ret; 207 - 208 - if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) { 209 - ret = ks7010_sdio_writeb(priv, WAKEUP_REG, WAKEUP_REQ); 210 - if (ret) 211 - netdev_err(priv->net_dev, "write WAKEUP_REG\n"); 212 - 213 - priv->last_wakeup = jiffies; 214 - ++priv->wakeup_count; 215 - } 216 - } 217 - 218 - static void _ks_wlan_hw_power_save(struct ks_wlan_private *priv) 219 - { 220 - u8 byte; 221 - int ret; 222 - 223 - if (priv->reg.power_mgmt == POWER_MGMT_ACTIVE) 224 - return; 225 - 226 - if (priv->reg.operation_mode != MODE_INFRASTRUCTURE) 227 - return; 228 - 229 - if (!is_connect_status(priv->connect_status)) 230 - return; 231 - 232 - if (priv->dev_state != DEVICE_STATE_SLEEP) 233 - return; 234 - 235 - if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) 236 - return; 237 - 238 - netdev_dbg(priv->net_dev, 239 - "STATUS:\n" 240 - "- psstatus.status = %d\n" 241 - "- psstatus.confirm_wait = %d\n" 242 - "- psstatus.snooze_guard = %d\n" 243 - "- txq_count = %d\n", 244 - atomic_read(&priv->psstatus.status), 245 - atomic_read(&priv->psstatus.confirm_wait), 246 - atomic_read(&priv->psstatus.snooze_guard), 247 - txq_count(priv)); 248 - 249 - if (atomic_read(&priv->psstatus.confirm_wait) || 250 - atomic_read(&priv->psstatus.snooze_guard) || 251 - txq_has_space(priv)) { 252 - queue_delayed_work(priv->wq, &priv->rw_dwork, 0); 253 - return; 254 - } 255 - 256 - ret = ks7010_sdio_readb(priv, INT_PENDING_REG, &byte); 257 - if (ret) { 258 - netdev_err(priv->net_dev, "read INT_PENDING_REG\n"); 259 - goto queue_delayed_work; 260 - } 261 - if (byte) 262 - goto queue_delayed_work; 263 - 264 - ret = ks7010_sdio_writeb(priv, GCR_B_REG, GCR_B_DOZE); 265 - if (ret) { 266 - netdev_err(priv->net_dev, "write GCR_B_REG\n"); 267 - goto queue_delayed_work; 268 - } 269 - atomic_set(&priv->psstatus.status, PS_SNOOZE); 270 - 271 - return; 272 - 273 - queue_delayed_work: 274 - queue_delayed_work(priv->wq, &priv->rw_dwork, 1); 275 - } 276 - 277 - int ks_wlan_hw_power_save(struct ks_wlan_private *priv) 278 - { 279 - queue_delayed_work(priv->wq, &priv->rw_dwork, 1); 280 - return 0; 281 - } 282 - 283 - static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p, 284 - unsigned long size, 285 - void (*complete_handler)(struct ks_wlan_private *priv, 286 - struct sk_buff *skb), 287 - struct sk_buff *skb) 288 - { 289 - struct tx_device_buffer *sp; 290 - int ret; 291 - 292 - if (priv->dev_state < DEVICE_STATE_BOOT) { 293 - ret = -EPERM; 294 - goto err_complete; 295 - } 296 - 297 - if ((TX_DEVICE_BUFF_SIZE - 1) <= txq_count(priv)) { 298 - netdev_err(priv->net_dev, "tx buffer overflow\n"); 299 - ret = -EOVERFLOW; 300 - goto err_complete; 301 - } 302 - 303 - sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qtail]; 304 - sp->sendp = p; 305 - sp->size = size; 306 - sp->complete_handler = complete_handler; 307 - sp->skb = skb; 308 - inc_txqtail(priv); 309 - 310 - return 0; 311 - 312 - err_complete: 313 - kfree(p); 314 - if (complete_handler) 315 - (*complete_handler)(priv, skb); 316 - 317 - return ret; 318 - } 319 - 320 - /* write data */ 321 - static int write_to_device(struct ks_wlan_private *priv, u8 *buffer, 322 - unsigned long size) 323 - { 324 - struct hostif_hdr *hdr; 325 - int ret; 326 - 327 - hdr = (struct hostif_hdr *)buffer; 328 - 329 - if (le16_to_cpu(hdr->event) < HIF_DATA_REQ || 330 - le16_to_cpu(hdr->event) > HIF_REQ_MAX) { 331 - netdev_err(priv->net_dev, "unknown event=%04X\n", hdr->event); 332 - return 0; 333 - } 334 - 335 - ret = ks7010_sdio_write(priv, DATA_WINDOW, buffer, size); 336 - if (ret) { 337 - netdev_err(priv->net_dev, "write DATA_WINDOW\n"); 338 - return ret; 339 - } 340 - 341 - ret = ks7010_sdio_writeb(priv, WRITE_STATUS_REG, REG_STATUS_BUSY); 342 - if (ret) { 343 - netdev_err(priv->net_dev, "write WRITE_STATUS_REG\n"); 344 - return ret; 345 - } 346 - 347 - return 0; 348 - } 349 - 350 - static void tx_device_task(struct ks_wlan_private *priv) 351 - { 352 - struct tx_device_buffer *sp; 353 - int ret; 354 - 355 - if (!txq_has_space(priv) || 356 - atomic_read(&priv->psstatus.status) == PS_SNOOZE) 357 - return; 358 - 359 - sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; 360 - if (priv->dev_state >= DEVICE_STATE_BOOT) { 361 - ret = write_to_device(priv, sp->sendp, sp->size); 362 - if (ret) { 363 - netdev_err(priv->net_dev, 364 - "write_to_device error !!(%d)\n", ret); 365 - queue_delayed_work(priv->wq, &priv->rw_dwork, 1); 366 - return; 367 - } 368 - } 369 - kfree(sp->sendp); 370 - if (sp->complete_handler) /* TX Complete */ 371 - (*sp->complete_handler)(priv, sp->skb); 372 - inc_txqhead(priv); 373 - 374 - if (txq_has_space(priv)) 375 - queue_delayed_work(priv->wq, &priv->rw_dwork, 0); 376 - } 377 - 378 - int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, 379 - void (*complete_handler)(struct ks_wlan_private *priv, 380 - struct sk_buff *skb), 381 - struct sk_buff *skb) 382 - { 383 - int result; 384 - struct hostif_hdr *hdr; 385 - 386 - hdr = (struct hostif_hdr *)p; 387 - 388 - if (le16_to_cpu(hdr->event) < HIF_DATA_REQ || 389 - le16_to_cpu(hdr->event) > HIF_REQ_MAX) { 390 - netdev_err(priv->net_dev, "unknown event=%04X\n", hdr->event); 391 - return 0; 392 - } 393 - 394 - /* add event to hostt buffer */ 395 - priv->hostt.buff[priv->hostt.qtail] = le16_to_cpu(hdr->event); 396 - priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE; 397 - 398 - spin_lock_bh(&priv->tx_dev.tx_dev_lock); 399 - result = enqueue_txdev(priv, p, size, complete_handler, skb); 400 - spin_unlock_bh(&priv->tx_dev.tx_dev_lock); 401 - 402 - if (txq_has_space(priv)) 403 - queue_delayed_work(priv->wq, &priv->rw_dwork, 0); 404 - 405 - return result; 406 - } 407 - 408 - static void rx_event_task(struct tasklet_struct *t) 409 - { 410 - struct ks_wlan_private *priv = from_tasklet(priv, t, rx_bh_task); 411 - struct rx_device_buffer *rp; 412 - 413 - if (rxq_has_space(priv) && priv->dev_state >= DEVICE_STATE_BOOT) { 414 - rp = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qhead]; 415 - hostif_receive(priv, rp->data, rp->size); 416 - inc_rxqhead(priv); 417 - 418 - if (rxq_has_space(priv)) 419 - tasklet_schedule(&priv->rx_bh_task); 420 - } 421 - } 422 - 423 - static void ks_wlan_hw_rx(struct ks_wlan_private *priv, size_t size) 424 - { 425 - int ret; 426 - struct rx_device_buffer *rx_buffer; 427 - struct hostif_hdr *hdr; 428 - u16 event = 0; 429 - 430 - /* receive data */ 431 - if (rxq_count(priv) >= (RX_DEVICE_BUFF_SIZE - 1)) { 432 - netdev_err(priv->net_dev, "rx buffer overflow\n"); 433 - return; 434 - } 435 - rx_buffer = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qtail]; 436 - 437 - ret = ks7010_sdio_read(priv, DATA_WINDOW, &rx_buffer->data[0], 438 - hif_align_size(size)); 439 - if (ret) 440 - return; 441 - 442 - /* length check */ 443 - if (size > 2046 || size == 0) { 444 - #ifdef DEBUG 445 - print_hex_dump_bytes("INVALID DATA dump: ", 446 - DUMP_PREFIX_OFFSET, 447 - rx_buffer->data, 32); 448 - #endif 449 - ret = ks7010_sdio_writeb(priv, READ_STATUS_REG, 450 - REG_STATUS_IDLE); 451 - if (ret) 452 - netdev_err(priv->net_dev, "write READ_STATUS_REG\n"); 453 - 454 - /* length check fail */ 455 - return; 456 - } 457 - 458 - hdr = (struct hostif_hdr *)&rx_buffer->data[0]; 459 - rx_buffer->size = le16_to_cpu(hdr->size) + sizeof(hdr->size); 460 - event = le16_to_cpu(hdr->event); 461 - inc_rxqtail(priv); 462 - 463 - ret = ks7010_sdio_writeb(priv, READ_STATUS_REG, REG_STATUS_IDLE); 464 - if (ret) 465 - netdev_err(priv->net_dev, "write READ_STATUS_REG\n"); 466 - 467 - if (atomic_read(&priv->psstatus.confirm_wait) && is_hif_conf(event)) { 468 - netdev_dbg(priv->net_dev, "IS_HIF_CONF true !!\n"); 469 - atomic_dec(&priv->psstatus.confirm_wait); 470 - } 471 - 472 - tasklet_schedule(&priv->rx_bh_task); 473 - } 474 - 475 - static void ks7010_rw_function(struct work_struct *work) 476 - { 477 - struct ks_wlan_private *priv = container_of(work, 478 - struct ks_wlan_private, 479 - rw_dwork.work); 480 - struct sdio_func *func = ks7010_to_func(priv); 481 - u8 byte; 482 - int ret; 483 - 484 - /* wait after DOZE */ 485 - if (time_after(priv->last_doze + msecs_to_jiffies(30), jiffies)) { 486 - netdev_dbg(priv->net_dev, "wait after DOZE\n"); 487 - queue_delayed_work(priv->wq, &priv->rw_dwork, 1); 488 - return; 489 - } 490 - 491 - /* wait after WAKEUP */ 492 - while (time_after(priv->last_wakeup + msecs_to_jiffies(30), jiffies)) { 493 - netdev_dbg(priv->net_dev, "wait after WAKEUP\n"); 494 - dev_info(&func->dev, "wake: %lu %lu\n", 495 - priv->last_wakeup + msecs_to_jiffies(30), jiffies); 496 - msleep(30); 497 - } 498 - 499 - sdio_claim_host(func); 500 - 501 - /* power save wakeup */ 502 - if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) { 503 - if (txq_has_space(priv)) { 504 - ks_wlan_hw_wakeup_request(priv); 505 - queue_delayed_work(priv->wq, &priv->rw_dwork, 1); 506 - } 507 - goto release_host; 508 - } 509 - 510 - /* sleep mode doze */ 511 - if (atomic_read(&priv->sleepstatus.doze_request) == 1) { 512 - ks_wlan_hw_sleep_doze_request(priv); 513 - goto release_host; 514 - } 515 - /* sleep mode wakeup */ 516 - if (atomic_read(&priv->sleepstatus.wakeup_request) == 1) { 517 - ks_wlan_hw_sleep_wakeup_request(priv); 518 - goto release_host; 519 - } 520 - 521 - /* read (WriteStatus/ReadDataSize FN1:00_0014) */ 522 - ret = ks7010_sdio_readb(priv, WSTATUS_RSIZE_REG, &byte); 523 - if (ret) { 524 - netdev_err(priv->net_dev, "read WSTATUS_RSIZE_REG psstatus=%d\n", 525 - atomic_read(&priv->psstatus.status)); 526 - goto release_host; 527 - } 528 - 529 - if (byte & RSIZE_MASK) { /* Read schedule */ 530 - ks_wlan_hw_rx(priv, (size_t)((byte & RSIZE_MASK) << 4)); 531 - } 532 - if ((byte & WSTATUS_MASK)) 533 - tx_device_task(priv); 534 - 535 - _ks_wlan_hw_power_save(priv); 536 - 537 - release_host: 538 - sdio_release_host(func); 539 - } 540 - 541 - static void ks_sdio_interrupt(struct sdio_func *func) 542 - { 543 - int ret; 544 - struct ks_sdio_card *card; 545 - struct ks_wlan_private *priv; 546 - u8 status, rsize, byte; 547 - 548 - card = sdio_get_drvdata(func); 549 - priv = card->priv; 550 - 551 - if (priv->dev_state < DEVICE_STATE_BOOT) 552 - goto queue_delayed_work; 553 - 554 - ret = ks7010_sdio_readb(priv, INT_PENDING_REG, &status); 555 - if (ret) { 556 - netdev_err(priv->net_dev, "read INT_PENDING_REG\n"); 557 - goto queue_delayed_work; 558 - } 559 - 560 - /* schedule task for interrupt status */ 561 - /* bit7 -> Write General Communication B register */ 562 - /* read (General Communication B register) */ 563 - /* bit5 -> Write Status Idle */ 564 - /* bit2 -> Read Status Busy */ 565 - if (status & INT_GCR_B || 566 - atomic_read(&priv->psstatus.status) == PS_SNOOZE) { 567 - ret = ks7010_sdio_readb(priv, GCR_B_REG, &byte); 568 - if (ret) { 569 - netdev_err(priv->net_dev, "read GCR_B_REG\n"); 570 - goto queue_delayed_work; 571 - } 572 - if (byte == GCR_B_ACTIVE) { 573 - if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) { 574 - atomic_set(&priv->psstatus.status, PS_WAKEUP); 575 - priv->wakeup_count = 0; 576 - } 577 - complete(&priv->psstatus.wakeup_wait); 578 - } 579 - } 580 - 581 - do { 582 - /* read (WriteStatus/ReadDataSize FN1:00_0014) */ 583 - ret = ks7010_sdio_readb(priv, WSTATUS_RSIZE_REG, &byte); 584 - if (ret) { 585 - netdev_err(priv->net_dev, "read WSTATUS_RSIZE_REG\n"); 586 - goto queue_delayed_work; 587 - } 588 - rsize = byte & RSIZE_MASK; 589 - if (rsize != 0) /* Read schedule */ 590 - ks_wlan_hw_rx(priv, (size_t)(rsize << 4)); 591 - 592 - if (byte & WSTATUS_MASK) { 593 - if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) { 594 - if (txq_has_space(priv)) { 595 - ks_wlan_hw_wakeup_request(priv); 596 - queue_delayed_work(priv->wq, 597 - &priv->rw_dwork, 1); 598 - return; 599 - } 600 - } else { 601 - tx_device_task(priv); 602 - } 603 - } 604 - } while (rsize); 605 - 606 - queue_delayed_work: 607 - queue_delayed_work(priv->wq, &priv->rw_dwork, 0); 608 - } 609 - 610 - static int trx_device_init(struct ks_wlan_private *priv) 611 - { 612 - priv->tx_dev.qhead = 0; 613 - priv->tx_dev.qtail = 0; 614 - 615 - priv->rx_dev.qhead = 0; 616 - priv->rx_dev.qtail = 0; 617 - 618 - spin_lock_init(&priv->tx_dev.tx_dev_lock); 619 - spin_lock_init(&priv->rx_dev.rx_dev_lock); 620 - 621 - tasklet_setup(&priv->rx_bh_task, rx_event_task); 622 - 623 - return 0; 624 - } 625 - 626 - static void trx_device_exit(struct ks_wlan_private *priv) 627 - { 628 - struct tx_device_buffer *sp; 629 - 630 - /* tx buffer clear */ 631 - while (txq_has_space(priv)) { 632 - sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; 633 - kfree(sp->sendp); 634 - if (sp->complete_handler) /* TX Complete */ 635 - (*sp->complete_handler)(priv, sp->skb); 636 - inc_txqhead(priv); 637 - } 638 - 639 - tasklet_kill(&priv->rx_bh_task); 640 - } 641 - 642 - static int ks7010_sdio_update_index(struct ks_wlan_private *priv, u32 index) 643 - { 644 - int ret; 645 - unsigned char *data_buf; 646 - 647 - data_buf = kmemdup(&index, sizeof(u32), GFP_KERNEL); 648 - if (!data_buf) 649 - return -ENOMEM; 650 - 651 - ret = ks7010_sdio_write(priv, WRITE_INDEX_REG, data_buf, sizeof(index)); 652 - if (ret) 653 - goto err_free_data_buf; 654 - 655 - ret = ks7010_sdio_write(priv, READ_INDEX_REG, data_buf, sizeof(index)); 656 - if (ret) 657 - goto err_free_data_buf; 658 - 659 - return 0; 660 - 661 - err_free_data_buf: 662 - kfree(data_buf); 663 - 664 - return ret; 665 - } 666 - 667 - #define ROM_BUFF_SIZE (64 * 1024) 668 - static int ks7010_sdio_data_compare(struct ks_wlan_private *priv, u32 address, 669 - u8 *data, unsigned int size) 670 - { 671 - int ret; 672 - u8 *read_buf; 673 - 674 - read_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL); 675 - if (!read_buf) 676 - return -ENOMEM; 677 - 678 - ret = ks7010_sdio_read(priv, address, read_buf, size); 679 - if (ret) 680 - goto err_free_read_buf; 681 - 682 - if (memcmp(data, read_buf, size) != 0) { 683 - ret = -EIO; 684 - netdev_err(priv->net_dev, "data compare error (%d)\n", ret); 685 - goto err_free_read_buf; 686 - } 687 - 688 - return 0; 689 - 690 - err_free_read_buf: 691 - kfree(read_buf); 692 - 693 - return ret; 694 - } 695 - 696 - static int ks7010_copy_firmware(struct ks_wlan_private *priv, 697 - const struct firmware *fw_entry) 698 - { 699 - unsigned int length; 700 - unsigned int size; 701 - unsigned int offset; 702 - unsigned int n = 0; 703 - u8 *rom_buf; 704 - int ret; 705 - 706 - rom_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL); 707 - if (!rom_buf) 708 - return -ENOMEM; 709 - 710 - length = fw_entry->size; 711 - 712 - do { 713 - if (length >= ROM_BUFF_SIZE) { 714 - size = ROM_BUFF_SIZE; 715 - length = length - ROM_BUFF_SIZE; 716 - } else { 717 - size = length; 718 - length = 0; 719 - } 720 - if (size == 0) 721 - break; 722 - 723 - memcpy(rom_buf, fw_entry->data + n, size); 724 - 725 - offset = n; 726 - ret = ks7010_sdio_update_index(priv, 727 - KS7010_IRAM_ADDRESS + offset); 728 - if (ret) 729 - goto free_rom_buf; 730 - 731 - ret = ks7010_sdio_write(priv, DATA_WINDOW, rom_buf, size); 732 - if (ret) 733 - goto free_rom_buf; 734 - 735 - ret = ks7010_sdio_data_compare(priv, 736 - DATA_WINDOW, rom_buf, size); 737 - if (ret) 738 - goto free_rom_buf; 739 - 740 - n += size; 741 - 742 - } while (size); 743 - 744 - ret = ks7010_sdio_writeb(priv, GCR_A_REG, GCR_A_REMAP); 745 - 746 - free_rom_buf: 747 - kfree(rom_buf); 748 - return ret; 749 - } 750 - 751 - static int ks7010_upload_firmware(struct ks_sdio_card *card) 752 - { 753 - struct ks_wlan_private *priv = card->priv; 754 - struct sdio_func *func = ks7010_to_func(priv); 755 - unsigned int n; 756 - u8 byte = 0; 757 - int ret; 758 - const struct firmware *fw_entry = NULL; 759 - 760 - sdio_claim_host(func); 761 - 762 - /* Firmware running ? */ 763 - ret = ks7010_sdio_readb(priv, GCR_A_REG, &byte); 764 - if (ret) 765 - goto release_host; 766 - if (byte == GCR_A_RUN) { 767 - netdev_dbg(priv->net_dev, "MAC firmware running ...\n"); 768 - ret = -EBUSY; 769 - goto release_host; 770 - } 771 - 772 - ret = request_firmware(&fw_entry, ROM_FILE, 773 - &func->dev); 774 - if (ret) 775 - goto release_host; 776 - 777 - ret = ks7010_copy_firmware(priv, fw_entry); 778 - if (ret) 779 - goto release_firmware; 780 - 781 - /* Firmware running check */ 782 - for (n = 0; n < 50; ++n) { 783 - usleep_range(10000, 11000); /* wait_ms(10); */ 784 - ret = ks7010_sdio_readb(priv, GCR_A_REG, &byte); 785 - if (ret) 786 - goto release_firmware; 787 - 788 - if (byte == GCR_A_RUN) 789 - break; 790 - } 791 - if ((50) <= n) { 792 - netdev_err(priv->net_dev, "firmware can't start\n"); 793 - ret = -EIO; 794 - goto release_firmware; 795 - } 796 - 797 - ret = 0; 798 - 799 - release_firmware: 800 - release_firmware(fw_entry); 801 - release_host: 802 - sdio_release_host(func); 803 - 804 - return ret; 805 - } 806 - 807 - static void ks7010_sme_enqueue_events(struct ks_wlan_private *priv) 808 - { 809 - static const u16 init_events[] = { 810 - SME_GET_EEPROM_CKSUM, SME_STOP_REQUEST, 811 - SME_RTS_THRESHOLD_REQUEST, SME_FRAGMENTATION_THRESHOLD_REQUEST, 812 - SME_WEP_INDEX_REQUEST, SME_WEP_KEY1_REQUEST, 813 - SME_WEP_KEY2_REQUEST, SME_WEP_KEY3_REQUEST, 814 - SME_WEP_KEY4_REQUEST, SME_WEP_FLAG_REQUEST, 815 - SME_RSN_ENABLED_REQUEST, SME_MODE_SET_REQUEST, 816 - SME_START_REQUEST 817 - }; 818 - int ev; 819 - 820 - for (ev = 0; ev < ARRAY_SIZE(init_events); ev++) 821 - hostif_sme_enqueue(priv, init_events[ev]); 822 - } 823 - 824 - static void ks7010_card_init(struct ks_wlan_private *priv) 825 - { 826 - init_completion(&priv->confirm_wait); 827 - 828 - /* get mac address & firmware version */ 829 - hostif_sme_enqueue(priv, SME_START); 830 - 831 - if (!wait_for_completion_interruptible_timeout 832 - (&priv->confirm_wait, 5 * HZ)) { 833 - netdev_dbg(priv->net_dev, "wait time out!! SME_START\n"); 834 - } 835 - 836 - if (priv->mac_address_valid && priv->version_size != 0) 837 - priv->dev_state = DEVICE_STATE_PREINIT; 838 - 839 - ks7010_sme_enqueue_events(priv); 840 - 841 - if (!wait_for_completion_interruptible_timeout 842 - (&priv->confirm_wait, 5 * HZ)) { 843 - netdev_dbg(priv->net_dev, "wait time out!! wireless parameter set\n"); 844 - } 845 - 846 - if (priv->dev_state >= DEVICE_STATE_PREINIT) { 847 - netdev_dbg(priv->net_dev, "DEVICE READY!!\n"); 848 - priv->dev_state = DEVICE_STATE_READY; 849 - } 850 - } 851 - 852 - static void ks7010_init_defaults(struct ks_wlan_private *priv) 853 - { 854 - priv->reg.tx_rate = TX_RATE_AUTO; 855 - priv->reg.preamble = LONG_PREAMBLE; 856 - priv->reg.power_mgmt = POWER_MGMT_ACTIVE; 857 - priv->reg.scan_type = ACTIVE_SCAN; 858 - priv->reg.beacon_lost_count = 20; 859 - priv->reg.rts = 2347UL; 860 - priv->reg.fragment = 2346UL; 861 - priv->reg.phy_type = D_11BG_COMPATIBLE_MODE; 862 - priv->reg.cts_mode = CTS_MODE_FALSE; 863 - priv->reg.rate_set.body[11] = TX_RATE_54M; 864 - priv->reg.rate_set.body[10] = TX_RATE_48M; 865 - priv->reg.rate_set.body[9] = TX_RATE_36M; 866 - priv->reg.rate_set.body[8] = TX_RATE_18M; 867 - priv->reg.rate_set.body[7] = TX_RATE_9M; 868 - priv->reg.rate_set.body[6] = TX_RATE_24M | BASIC_RATE; 869 - priv->reg.rate_set.body[5] = TX_RATE_12M | BASIC_RATE; 870 - priv->reg.rate_set.body[4] = TX_RATE_6M | BASIC_RATE; 871 - priv->reg.rate_set.body[3] = TX_RATE_11M | BASIC_RATE; 872 - priv->reg.rate_set.body[2] = TX_RATE_5M | BASIC_RATE; 873 - priv->reg.rate_set.body[1] = TX_RATE_2M | BASIC_RATE; 874 - priv->reg.rate_set.body[0] = TX_RATE_1M | BASIC_RATE; 875 - priv->reg.tx_rate = TX_RATE_FULL_AUTO; 876 - priv->reg.rate_set.size = 12; 877 - } 878 - 879 - static int ks7010_sdio_setup_irqs(struct sdio_func *func) 880 - { 881 - int ret; 882 - 883 - /* interrupt disable */ 884 - sdio_writeb(func, 0, INT_ENABLE_REG, &ret); 885 - if (ret) 886 - goto irq_error; 887 - 888 - sdio_writeb(func, 0xff, INT_PENDING_REG, &ret); 889 - if (ret) 890 - goto irq_error; 891 - 892 - /* setup interrupt handler */ 893 - ret = sdio_claim_irq(func, ks_sdio_interrupt); 894 - 895 - irq_error: 896 - return ret; 897 - } 898 - 899 - static void ks7010_sdio_init_irqs(struct sdio_func *func, 900 - struct ks_wlan_private *priv) 901 - { 902 - u8 byte; 903 - int ret; 904 - 905 - /* 906 - * interrupt setting 907 - * clear Interrupt status write 908 - * (ARMtoSD_InterruptPending FN1:00_0024) 909 - */ 910 - sdio_claim_host(func); 911 - ret = ks7010_sdio_writeb(priv, INT_PENDING_REG, 0xff); 912 - sdio_release_host(func); 913 - if (ret) 914 - netdev_err(priv->net_dev, "write INT_PENDING_REG\n"); 915 - 916 - /* enable ks7010sdio interrupt */ 917 - byte = (INT_GCR_B | INT_READ_STATUS | INT_WRITE_STATUS); 918 - sdio_claim_host(func); 919 - ret = ks7010_sdio_writeb(priv, INT_ENABLE_REG, byte); 920 - sdio_release_host(func); 921 - if (ret) 922 - netdev_err(priv->net_dev, "write INT_ENABLE_REG\n"); 923 - } 924 - 925 - static void ks7010_private_init(struct ks_wlan_private *priv, 926 - struct ks_sdio_card *card, 927 - struct net_device *netdev) 928 - { 929 - /* private memory initialize */ 930 - priv->if_hw = card; 931 - 932 - priv->dev_state = DEVICE_STATE_PREBOOT; 933 - priv->net_dev = netdev; 934 - priv->firmware_version[0] = '\0'; 935 - priv->version_size = 0; 936 - priv->last_doze = jiffies; 937 - priv->last_wakeup = jiffies; 938 - memset(&priv->nstats, 0, sizeof(priv->nstats)); 939 - memset(&priv->wstats, 0, sizeof(priv->wstats)); 940 - 941 - /* sleep mode */ 942 - atomic_set(&priv->sleepstatus.status, 0); 943 - atomic_set(&priv->sleepstatus.doze_request, 0); 944 - atomic_set(&priv->sleepstatus.wakeup_request, 0); 945 - 946 - trx_device_init(priv); 947 - hostif_init(priv); 948 - ks_wlan_net_start(netdev); 949 - ks7010_init_defaults(priv); 950 - } 951 - 952 - static int ks7010_sdio_probe(struct sdio_func *func, 953 - const struct sdio_device_id *device) 954 - { 955 - struct ks_wlan_private *priv = NULL; 956 - struct net_device *netdev = NULL; 957 - struct ks_sdio_card *card; 958 - int ret; 959 - 960 - card = kzalloc(sizeof(*card), GFP_KERNEL); 961 - if (!card) 962 - return -ENOMEM; 963 - 964 - card->func = func; 965 - 966 - sdio_claim_host(func); 967 - 968 - ret = sdio_set_block_size(func, KS7010_IO_BLOCK_SIZE); 969 - if (ret) 970 - goto err_free_card; 971 - 972 - dev_dbg(&card->func->dev, "multi_block=%d sdio_set_block_size()=%d %d\n", 973 - func->card->cccr.multi_block, func->cur_blksize, ret); 974 - 975 - ret = sdio_enable_func(func); 976 - if (ret) 977 - goto err_free_card; 978 - 979 - ret = ks7010_sdio_setup_irqs(func); 980 - if (ret) 981 - goto err_disable_func; 982 - 983 - sdio_release_host(func); 984 - 985 - sdio_set_drvdata(func, card); 986 - 987 - dev_dbg(&card->func->dev, "class = 0x%X, vendor = 0x%X, device = 0x%X\n", 988 - func->class, func->vendor, func->device); 989 - 990 - /* private memory allocate */ 991 - netdev = alloc_etherdev(sizeof(*priv)); 992 - if (!netdev) { 993 - dev_err(&card->func->dev, "Unable to alloc new net device\n"); 994 - goto err_release_irq; 995 - } 996 - 997 - ret = dev_alloc_name(netdev, "wlan%d"); 998 - if (ret < 0) { 999 - dev_err(&card->func->dev, "Couldn't get name!\n"); 1000 - goto err_free_netdev; 1001 - } 1002 - 1003 - priv = netdev_priv(netdev); 1004 - 1005 - card->priv = priv; 1006 - SET_NETDEV_DEV(netdev, &card->func->dev); 1007 - 1008 - ks7010_private_init(priv, card, netdev); 1009 - 1010 - ret = ks7010_upload_firmware(card); 1011 - if (ret) { 1012 - netdev_err(priv->net_dev, 1013 - "firmware load failed !! ret = %d\n", ret); 1014 - goto err_free_netdev; 1015 - } 1016 - 1017 - ks7010_sdio_init_irqs(func, priv); 1018 - 1019 - priv->dev_state = DEVICE_STATE_BOOT; 1020 - 1021 - priv->wq = alloc_workqueue("wq", WQ_MEM_RECLAIM, 1); 1022 - if (!priv->wq) { 1023 - netdev_err(priv->net_dev, "create_workqueue failed !!\n"); 1024 - goto err_free_netdev; 1025 - } 1026 - 1027 - INIT_DELAYED_WORK(&priv->rw_dwork, ks7010_rw_function); 1028 - ks7010_card_init(priv); 1029 - 1030 - ret = register_netdev(priv->net_dev); 1031 - if (ret) 1032 - goto err_destroy_wq; 1033 - 1034 - return 0; 1035 - 1036 - err_destroy_wq: 1037 - destroy_workqueue(priv->wq); 1038 - err_free_netdev: 1039 - free_netdev(netdev); 1040 - err_release_irq: 1041 - sdio_claim_host(func); 1042 - sdio_release_irq(func); 1043 - err_disable_func: 1044 - sdio_disable_func(func); 1045 - err_free_card: 1046 - sdio_release_host(func); 1047 - sdio_set_drvdata(func, NULL); 1048 - kfree(card); 1049 - 1050 - return -ENODEV; 1051 - } 1052 - 1053 - /* send stop request to MAC */ 1054 - static int send_stop_request(struct sdio_func *func) 1055 - { 1056 - struct hostif_stop_request *pp; 1057 - struct ks_sdio_card *card; 1058 - size_t size; 1059 - 1060 - card = sdio_get_drvdata(func); 1061 - 1062 - pp = kzalloc(hif_align_size(sizeof(*pp)), GFP_KERNEL); 1063 - if (!pp) 1064 - return -ENOMEM; 1065 - 1066 - size = sizeof(*pp) - sizeof(pp->header.size); 1067 - pp->header.size = cpu_to_le16(size); 1068 - pp->header.event = cpu_to_le16(HIF_STOP_REQ); 1069 - 1070 - sdio_claim_host(func); 1071 - write_to_device(card->priv, (u8 *)pp, hif_align_size(sizeof(*pp))); 1072 - sdio_release_host(func); 1073 - 1074 - kfree(pp); 1075 - return 0; 1076 - } 1077 - 1078 - static void ks7010_sdio_remove(struct sdio_func *func) 1079 - { 1080 - int ret; 1081 - struct ks_sdio_card *card; 1082 - struct ks_wlan_private *priv; 1083 - 1084 - card = sdio_get_drvdata(func); 1085 - 1086 - if (!card) 1087 - return; 1088 - 1089 - priv = card->priv; 1090 - if (!priv) 1091 - goto err_free_card; 1092 - 1093 - ks_wlan_net_stop(priv->net_dev); 1094 - 1095 - /* interrupt disable */ 1096 - sdio_claim_host(func); 1097 - sdio_writeb(func, 0, INT_ENABLE_REG, &ret); 1098 - sdio_writeb(func, 0xff, INT_PENDING_REG, &ret); 1099 - sdio_release_host(func); 1100 - 1101 - ret = send_stop_request(func); 1102 - if (ret) /* memory allocation failure */ 1103 - goto err_free_card; 1104 - 1105 - if (priv->wq) 1106 - destroy_workqueue(priv->wq); 1107 - 1108 - hostif_exit(priv); 1109 - 1110 - unregister_netdev(priv->net_dev); 1111 - 1112 - trx_device_exit(priv); 1113 - free_netdev(priv->net_dev); 1114 - card->priv = NULL; 1115 - 1116 - sdio_claim_host(func); 1117 - sdio_release_irq(func); 1118 - sdio_disable_func(func); 1119 - sdio_release_host(func); 1120 - err_free_card: 1121 - sdio_set_drvdata(func, NULL); 1122 - kfree(card); 1123 - } 1124 - 1125 - static const struct sdio_device_id ks7010_sdio_ids[] = { 1126 - {SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_A, SDIO_DEVICE_ID_KS_7010)}, 1127 - {SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_B, SDIO_DEVICE_ID_KS_7010)}, 1128 - { /* all zero */ } 1129 - }; 1130 - MODULE_DEVICE_TABLE(sdio, ks7010_sdio_ids); 1131 - 1132 - static struct sdio_driver ks7010_sdio_driver = { 1133 - .name = "ks7010_sdio", 1134 - .id_table = ks7010_sdio_ids, 1135 - .probe = ks7010_sdio_probe, 1136 - .remove = ks7010_sdio_remove, 1137 - }; 1138 - 1139 - module_sdio_driver(ks7010_sdio_driver); 1140 - MODULE_AUTHOR("Sang Engineering, Qi-Hardware, KeyStream"); 1141 - MODULE_DESCRIPTION("Driver for KeyStream KS7010 based SDIO cards"); 1142 - MODULE_LICENSE("GPL v2"); 1143 - MODULE_FIRMWARE(ROM_FILE);
-2312
drivers/staging/ks7010/ks_hostif.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Driver for KeyStream wireless LAN cards. 4 - * 5 - * Copyright (C) 2005-2008 KeyStream Corp. 6 - * Copyright (C) 2009 Renesas Technology Corp. 7 - */ 8 - 9 - #include <crypto/hash.h> 10 - #include <linux/circ_buf.h> 11 - #include <linux/if_arp.h> 12 - #include <net/iw_handler.h> 13 - #include <uapi/linux/llc.h> 14 - #include "eap_packet.h" 15 - #include "ks_wlan.h" 16 - #include "ks_hostif.h" 17 - 18 - #define MICHAEL_MIC_KEY_LEN 8 19 - #define MICHAEL_MIC_LEN 8 20 - 21 - static inline void inc_smeqhead(struct ks_wlan_private *priv) 22 - { 23 - priv->sme_i.qhead = (priv->sme_i.qhead + 1) % SME_EVENT_BUFF_SIZE; 24 - } 25 - 26 - static inline void inc_smeqtail(struct ks_wlan_private *priv) 27 - { 28 - priv->sme_i.qtail = (priv->sme_i.qtail + 1) % SME_EVENT_BUFF_SIZE; 29 - } 30 - 31 - static inline unsigned int cnt_smeqbody(struct ks_wlan_private *priv) 32 - { 33 - return CIRC_CNT_TO_END(priv->sme_i.qhead, priv->sme_i.qtail, 34 - SME_EVENT_BUFF_SIZE); 35 - } 36 - 37 - static inline u8 get_byte(struct ks_wlan_private *priv) 38 - { 39 - u8 data; 40 - 41 - data = *priv->rxp++; 42 - /* length check in advance ! */ 43 - --(priv->rx_size); 44 - return data; 45 - } 46 - 47 - static inline u16 get_word(struct ks_wlan_private *priv) 48 - { 49 - u16 data; 50 - 51 - data = (get_byte(priv) & 0xff); 52 - data |= ((get_byte(priv) << 8) & 0xff00); 53 - return data; 54 - } 55 - 56 - static inline u32 get_dword(struct ks_wlan_private *priv) 57 - { 58 - u32 data; 59 - 60 - data = (get_byte(priv) & 0xff); 61 - data |= ((get_byte(priv) << 8) & 0x0000ff00); 62 - data |= ((get_byte(priv) << 16) & 0x00ff0000); 63 - data |= ((get_byte(priv) << 24) & 0xff000000); 64 - return data; 65 - } 66 - 67 - static void ks_wlan_hw_wakeup_task(struct work_struct *work) 68 - { 69 - struct ks_wlan_private *priv; 70 - int ps_status; 71 - long time_left; 72 - 73 - priv = container_of(work, struct ks_wlan_private, wakeup_work); 74 - ps_status = atomic_read(&priv->psstatus.status); 75 - 76 - if (ps_status == PS_SNOOZE) { 77 - ks_wlan_hw_wakeup_request(priv); 78 - time_left = wait_for_completion_interruptible_timeout(&priv->psstatus.wakeup_wait, 79 - msecs_to_jiffies(20)); 80 - if (time_left <= 0) { 81 - netdev_dbg(priv->net_dev, "wake up timeout or interrupted !!!\n"); 82 - schedule_work(&priv->wakeup_work); 83 - return; 84 - } 85 - } 86 - } 87 - 88 - static void ks_wlan_do_power_save(struct ks_wlan_private *priv) 89 - { 90 - if (is_connect_status(priv->connect_status)) 91 - hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST); 92 - else 93 - priv->dev_state = DEVICE_STATE_READY; 94 - } 95 - 96 - static 97 - int get_current_ap(struct ks_wlan_private *priv, struct link_ap_info *ap_info) 98 - { 99 - struct local_ap *ap; 100 - union iwreq_data wrqu; 101 - struct net_device *netdev = priv->net_dev; 102 - u8 size; 103 - 104 - ap = &priv->current_ap; 105 - 106 - if (is_disconnect_status(priv->connect_status)) { 107 - memset(ap, 0, sizeof(struct local_ap)); 108 - return -EPERM; 109 - } 110 - 111 - ether_addr_copy(ap->bssid, ap_info->bssid); 112 - memcpy(ap->ssid.body, priv->reg.ssid.body, 113 - priv->reg.ssid.size); 114 - ap->ssid.size = priv->reg.ssid.size; 115 - memcpy(ap->rate_set.body, ap_info->rate_set.body, 116 - ap_info->rate_set.size); 117 - ap->rate_set.size = ap_info->rate_set.size; 118 - if (ap_info->ext_rate_set.size != 0) { 119 - memcpy(&ap->rate_set.body[ap->rate_set.size], 120 - ap_info->ext_rate_set.body, 121 - ap_info->ext_rate_set.size); 122 - ap->rate_set.size += ap_info->ext_rate_set.size; 123 - } 124 - ap->channel = ap_info->ds_parameter.channel; 125 - ap->rssi = ap_info->rssi; 126 - ap->sq = ap_info->sq; 127 - ap->noise = ap_info->noise; 128 - ap->capability = le16_to_cpu(ap_info->capability); 129 - size = (ap_info->rsn.size <= RSN_IE_BODY_MAX) ? 130 - ap_info->rsn.size : RSN_IE_BODY_MAX; 131 - if ((ap_info->rsn_mode & RSN_MODE_WPA2) && 132 - (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2)) { 133 - ap->rsn_ie.id = RSN_INFO_ELEM_ID; 134 - ap->rsn_ie.size = size; 135 - memcpy(ap->rsn_ie.body, ap_info->rsn.body, size); 136 - } else if ((ap_info->rsn_mode & RSN_MODE_WPA) && 137 - (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA)) { 138 - ap->wpa_ie.id = WPA_INFO_ELEM_ID; 139 - ap->wpa_ie.size = size; 140 - memcpy(ap->wpa_ie.body, ap_info->rsn.body, size); 141 - } else { 142 - ap->rsn_ie.id = 0; 143 - ap->rsn_ie.size = 0; 144 - ap->wpa_ie.id = 0; 145 - ap->wpa_ie.size = 0; 146 - } 147 - 148 - wrqu.data.length = 0; 149 - wrqu.data.flags = 0; 150 - wrqu.ap_addr.sa_family = ARPHRD_ETHER; 151 - if (is_connect_status(priv->connect_status)) { 152 - ether_addr_copy(wrqu.ap_addr.sa_data, priv->current_ap.bssid); 153 - netdev_dbg(priv->net_dev, 154 - "IWEVENT: connect bssid=%pM\n", 155 - wrqu.ap_addr.sa_data); 156 - wireless_send_event(netdev, SIOCGIWAP, &wrqu, NULL); 157 - } 158 - netdev_dbg(priv->net_dev, "Link AP\n" 159 - "- bssid=%pM\n" 160 - "- essid=%s\n" 161 - "- rate_set=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X\n" 162 - "- channel=%d\n" 163 - "- rssi=%d\n" 164 - "- sq=%d\n" 165 - "- capability=%04X\n" 166 - "- rsn.mode=%d\n" 167 - "- rsn.size=%d\n" 168 - "- ext_rate_set_size=%d\n" 169 - "- rate_set_size=%d\n", 170 - ap->bssid, 171 - &ap->ssid.body[0], 172 - ap->rate_set.body[0], ap->rate_set.body[1], 173 - ap->rate_set.body[2], ap->rate_set.body[3], 174 - ap->rate_set.body[4], ap->rate_set.body[5], 175 - ap->rate_set.body[6], ap->rate_set.body[7], 176 - ap->channel, ap->rssi, ap->sq, ap->capability, 177 - ap_info->rsn_mode, ap_info->rsn.size, 178 - ap_info->ext_rate_set.size, ap_info->rate_set.size); 179 - 180 - return 0; 181 - } 182 - 183 - static u8 read_ie(unsigned char *bp, u8 max, u8 *body) 184 - { 185 - u8 size = (*(bp + 1) <= max) ? *(bp + 1) : max; 186 - 187 - memcpy(body, bp + 2, size); 188 - return size; 189 - } 190 - 191 - static int 192 - michael_mic(u8 *key, u8 *data, unsigned int len, u8 priority, u8 *result) 193 - { 194 - u8 pad_data[4] = { priority, 0, 0, 0 }; 195 - struct crypto_shash *tfm = NULL; 196 - struct shash_desc *desc = NULL; 197 - int ret; 198 - 199 - tfm = crypto_alloc_shash("michael_mic", 0, 0); 200 - if (IS_ERR(tfm)) { 201 - ret = PTR_ERR(tfm); 202 - goto err; 203 - } 204 - 205 - ret = crypto_shash_setkey(tfm, key, MICHAEL_MIC_KEY_LEN); 206 - if (ret < 0) 207 - goto err_free_tfm; 208 - 209 - desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(tfm), GFP_KERNEL); 210 - if (!desc) { 211 - ret = -ENOMEM; 212 - goto err_free_tfm; 213 - } 214 - 215 - desc->tfm = tfm; 216 - 217 - ret = crypto_shash_init(desc); 218 - if (ret < 0) 219 - goto err_free_desc; 220 - 221 - // Compute the MIC value 222 - /* 223 - * IEEE802.11i page 47 224 - * Figure 43g TKIP MIC processing format 225 - * +--+--+--------+--+----+--+--+--+--+--+--+--+--+ 226 - * |6 |6 |1 |3 |M |1 |1 |1 |1 |1 |1 |1 |1 | Octet 227 - * +--+--+--------+--+----+--+--+--+--+--+--+--+--+ 228 - * |DA|SA|Priority|0 |Data|M0|M1|M2|M3|M4|M5|M6|M7| 229 - * +--+--+--------+--+----+--+--+--+--+--+--+--+--+ 230 - */ 231 - 232 - ret = crypto_shash_update(desc, data, 12); 233 - if (ret < 0) 234 - goto err_free_desc; 235 - 236 - ret = crypto_shash_update(desc, pad_data, 4); 237 - if (ret < 0) 238 - goto err_free_desc; 239 - 240 - ret = crypto_shash_finup(desc, data + 12, len - 12, result); 241 - 242 - err_free_desc: 243 - kfree_sensitive(desc); 244 - 245 - err_free_tfm: 246 - crypto_free_shash(tfm); 247 - 248 - err: 249 - return ret; 250 - } 251 - 252 - static 253 - int get_ap_information(struct ks_wlan_private *priv, struct ap_info *ap_info, 254 - struct local_ap *ap) 255 - { 256 - unsigned char *bp; 257 - int bsize, offset; 258 - 259 - memset(ap, 0, sizeof(struct local_ap)); 260 - 261 - ether_addr_copy(ap->bssid, ap_info->bssid); 262 - ap->rssi = ap_info->rssi; 263 - ap->sq = ap_info->sq; 264 - ap->noise = ap_info->noise; 265 - ap->capability = le16_to_cpu(ap_info->capability); 266 - ap->channel = ap_info->ch_info; 267 - 268 - bp = ap_info->body; 269 - bsize = le16_to_cpu(ap_info->body_size); 270 - offset = 0; 271 - 272 - while (bsize > offset) { 273 - switch (*bp) { /* Information Element ID */ 274 - case WLAN_EID_SSID: 275 - ap->ssid.size = read_ie(bp, IEEE80211_MAX_SSID_LEN, 276 - ap->ssid.body); 277 - break; 278 - case WLAN_EID_SUPP_RATES: 279 - case WLAN_EID_EXT_SUPP_RATES: 280 - if ((*(bp + 1) + ap->rate_set.size) <= 281 - RATE_SET_MAX_SIZE) { 282 - memcpy(&ap->rate_set.body[ap->rate_set.size], 283 - bp + 2, *(bp + 1)); 284 - ap->rate_set.size += *(bp + 1); 285 - } else { 286 - memcpy(&ap->rate_set.body[ap->rate_set.size], 287 - bp + 2, 288 - RATE_SET_MAX_SIZE - ap->rate_set.size); 289 - ap->rate_set.size += 290 - (RATE_SET_MAX_SIZE - ap->rate_set.size); 291 - } 292 - break; 293 - case WLAN_EID_RSN: 294 - ap->rsn_ie.id = *bp; 295 - ap->rsn_ie.size = read_ie(bp, RSN_IE_BODY_MAX, 296 - ap->rsn_ie.body); 297 - break; 298 - case WLAN_EID_VENDOR_SPECIFIC: /* WPA */ 299 - /* WPA OUI check */ 300 - if (memcmp(bp + 2, CIPHER_ID_WPA_WEP40, 4) == 0) { 301 - ap->wpa_ie.id = *bp; 302 - ap->wpa_ie.size = read_ie(bp, RSN_IE_BODY_MAX, 303 - ap->wpa_ie.body); 304 - } 305 - break; 306 - case WLAN_EID_DS_PARAMS: 307 - case WLAN_EID_FH_PARAMS: 308 - case WLAN_EID_CF_PARAMS: 309 - case WLAN_EID_TIM: 310 - case WLAN_EID_IBSS_PARAMS: 311 - case WLAN_EID_COUNTRY: 312 - case WLAN_EID_ERP_INFO: 313 - break; 314 - default: 315 - netdev_err(priv->net_dev, 316 - "unknown Element ID=%d\n", *bp); 317 - break; 318 - } 319 - 320 - offset += 2; /* id & size field */ 321 - offset += *(bp + 1); /* +size offset */ 322 - bp += (*(bp + 1) + 2); /* pointer update */ 323 - } 324 - 325 - return 0; 326 - } 327 - 328 - static 329 - int hostif_data_indication_wpa(struct ks_wlan_private *priv, 330 - unsigned short auth_type) 331 - { 332 - struct ether_hdr *eth_hdr; 333 - unsigned short eth_proto; 334 - unsigned char recv_mic[MICHAEL_MIC_LEN]; 335 - char buf[128]; 336 - unsigned long now; 337 - struct mic_failure *mic_failure; 338 - u8 mic[MICHAEL_MIC_LEN]; 339 - union iwreq_data wrqu; 340 - unsigned int key_index = auth_type - 1; 341 - struct wpa_key *key = &priv->wpa.key[key_index]; 342 - 343 - eth_hdr = (struct ether_hdr *)(priv->rxp); 344 - eth_proto = ntohs(eth_hdr->h_proto); 345 - 346 - if (eth_hdr->h_dest_snap != eth_hdr->h_source_snap) { 347 - netdev_err(priv->net_dev, "invalid data format\n"); 348 - priv->nstats.rx_errors++; 349 - return -EINVAL; 350 - } 351 - if (((auth_type == TYPE_PMK1 && 352 - priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) || 353 - (auth_type == TYPE_GMK1 && 354 - priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP) || 355 - (auth_type == TYPE_GMK2 && 356 - priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP)) && 357 - key->key_len) { 358 - int ret; 359 - 360 - netdev_dbg(priv->net_dev, "TKIP: protocol=%04X: size=%u\n", 361 - eth_proto, priv->rx_size); 362 - /* MIC save */ 363 - memcpy(&recv_mic[0], 364 - (priv->rxp) + ((priv->rx_size) - sizeof(recv_mic)), 365 - sizeof(recv_mic)); 366 - priv->rx_size = priv->rx_size - sizeof(recv_mic); 367 - 368 - ret = michael_mic(key->rx_mic_key, priv->rxp, priv->rx_size, 369 - 0, mic); 370 - if (ret < 0) 371 - return ret; 372 - if (memcmp(mic, recv_mic, sizeof(mic)) != 0) { 373 - now = jiffies; 374 - mic_failure = &priv->wpa.mic_failure; 375 - /* MIC FAILURE */ 376 - if (mic_failure->last_failure_time && 377 - (now - mic_failure->last_failure_time) / HZ >= 60) { 378 - mic_failure->failure = 0; 379 - } 380 - netdev_err(priv->net_dev, "MIC FAILURE\n"); 381 - if (mic_failure->failure == 0) { 382 - mic_failure->failure = 1; 383 - mic_failure->counter = 0; 384 - } else if (mic_failure->failure == 1) { 385 - mic_failure->failure = 2; 386 - mic_failure->counter = 387 - (u16)((now - mic_failure->last_failure_time) / HZ); 388 - /* range 1-60 */ 389 - if (!mic_failure->counter) 390 - mic_failure->counter = 1; 391 - } 392 - priv->wpa.mic_failure.last_failure_time = now; 393 - 394 - /* needed parameters: count, keyid, key type, TSC */ 395 - sprintf(buf, 396 - "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=%pM)", 397 - key_index, 398 - eth_hdr->h_dest[0] & 0x01 ? "broad" : "uni", 399 - eth_hdr->h_source); 400 - memset(&wrqu, 0, sizeof(wrqu)); 401 - wrqu.data.length = strlen(buf); 402 - wireless_send_event(priv->net_dev, IWEVCUSTOM, &wrqu, 403 - buf); 404 - return -EINVAL; 405 - } 406 - } 407 - return 0; 408 - } 409 - 410 - static 411 - void hostif_data_indication(struct ks_wlan_private *priv) 412 - { 413 - unsigned int rx_ind_size; /* indicate data size */ 414 - struct sk_buff *skb; 415 - u16 auth_type; 416 - unsigned char temp[256]; 417 - struct ether_hdr *eth_hdr; 418 - struct ieee802_1x_hdr *aa1x_hdr; 419 - size_t size; 420 - int ret; 421 - 422 - /* min length check */ 423 - if (priv->rx_size <= ETH_HLEN) { 424 - priv->nstats.rx_errors++; 425 - return; 426 - } 427 - 428 - auth_type = get_word(priv); /* AuthType */ 429 - get_word(priv); /* Reserve Area */ 430 - 431 - eth_hdr = (struct ether_hdr *)(priv->rxp); 432 - 433 - /* source address check */ 434 - if (ether_addr_equal(&priv->eth_addr[0], eth_hdr->h_source)) { 435 - netdev_err(priv->net_dev, "invalid : source is own mac address !!\n"); 436 - netdev_err(priv->net_dev, "eth_hdrernet->h_dest=%pM\n", eth_hdr->h_source); 437 - priv->nstats.rx_errors++; 438 - return; 439 - } 440 - 441 - /* for WPA */ 442 - if (auth_type != TYPE_DATA && priv->wpa.rsn_enabled) { 443 - ret = hostif_data_indication_wpa(priv, auth_type); 444 - if (ret) 445 - return; 446 - } 447 - 448 - if ((priv->connect_status & FORCE_DISCONNECT) || 449 - priv->wpa.mic_failure.failure == 2) { 450 - return; 451 - } 452 - 453 - /* check 13th byte at rx data */ 454 - switch (*(priv->rxp + 12)) { 455 - case LLC_SAP_SNAP: 456 - rx_ind_size = priv->rx_size - 6; 457 - skb = dev_alloc_skb(rx_ind_size); 458 - if (!skb) { 459 - priv->nstats.rx_dropped++; 460 - return; 461 - } 462 - netdev_dbg(priv->net_dev, "SNAP, rx_ind_size = %d\n", 463 - rx_ind_size); 464 - 465 - size = ETH_ALEN * 2; 466 - skb_put_data(skb, priv->rxp, size); 467 - 468 - /* (SNAP+UI..) skip */ 469 - 470 - size = rx_ind_size - (ETH_ALEN * 2); 471 - skb_put_data(skb, &eth_hdr->h_proto, size); 472 - 473 - aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + ETHER_HDR_SIZE); 474 - break; 475 - case LLC_SAP_NETBEUI: 476 - rx_ind_size = (priv->rx_size + 2); 477 - skb = dev_alloc_skb(rx_ind_size); 478 - if (!skb) { 479 - priv->nstats.rx_dropped++; 480 - return; 481 - } 482 - netdev_dbg(priv->net_dev, "NETBEUI/NetBIOS rx_ind_size=%d\n", 483 - rx_ind_size); 484 - 485 - /* 8802/FDDI MAC copy */ 486 - skb_put_data(skb, priv->rxp, 12); 487 - 488 - /* NETBEUI size add */ 489 - temp[0] = (((rx_ind_size - 12) >> 8) & 0xff); 490 - temp[1] = ((rx_ind_size - 12) & 0xff); 491 - skb_put_data(skb, temp, 2); 492 - 493 - /* copy after Type */ 494 - skb_put_data(skb, priv->rxp + 12, rx_ind_size - 14); 495 - 496 - aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + 14); 497 - break; 498 - default: /* other rx data */ 499 - netdev_err(priv->net_dev, "invalid data format\n"); 500 - priv->nstats.rx_errors++; 501 - return; 502 - } 503 - 504 - if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY && 505 - priv->wpa.rsn_enabled) 506 - atomic_set(&priv->psstatus.snooze_guard, 1); 507 - 508 - /* rx indication */ 509 - skb->dev = priv->net_dev; 510 - skb->protocol = eth_type_trans(skb, skb->dev); 511 - priv->nstats.rx_packets++; 512 - priv->nstats.rx_bytes += rx_ind_size; 513 - netif_rx(skb); 514 - } 515 - 516 - static 517 - void hostif_mib_get_confirm(struct ks_wlan_private *priv) 518 - { 519 - struct net_device *dev = priv->net_dev; 520 - u32 mib_status; 521 - u32 mib_attribute; 522 - 523 - mib_status = get_dword(priv); 524 - mib_attribute = get_dword(priv); 525 - get_word(priv); /* mib_val_size */ 526 - get_word(priv); /* mib_val_type */ 527 - 528 - if (mib_status) { 529 - netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n", 530 - mib_attribute, mib_status); 531 - return; 532 - } 533 - 534 - switch (mib_attribute) { 535 - case DOT11_MAC_ADDRESS: 536 - hostif_sme_enqueue(priv, SME_GET_MAC_ADDRESS); 537 - ether_addr_copy(priv->eth_addr, priv->rxp); 538 - priv->mac_address_valid = true; 539 - eth_hw_addr_set(dev, priv->eth_addr); 540 - netdev_info(dev, "MAC ADDRESS = %pM\n", priv->eth_addr); 541 - break; 542 - case DOT11_PRODUCT_VERSION: 543 - priv->version_size = priv->rx_size; 544 - memcpy(priv->firmware_version, priv->rxp, priv->rx_size); 545 - priv->firmware_version[priv->rx_size] = '\0'; 546 - netdev_info(dev, "firmware ver. = %s\n", 547 - priv->firmware_version); 548 - hostif_sme_enqueue(priv, SME_GET_PRODUCT_VERSION); 549 - /* wake_up_interruptible_all(&priv->confirm_wait); */ 550 - complete(&priv->confirm_wait); 551 - break; 552 - case LOCAL_GAIN: 553 - memcpy(&priv->gain, priv->rxp, sizeof(priv->gain)); 554 - netdev_dbg(priv->net_dev, "tx_mode=%d, rx_mode=%d, tx_gain=%d, rx_gain=%d\n", 555 - priv->gain.tx_mode, priv->gain.rx_mode, 556 - priv->gain.tx_gain, priv->gain.rx_gain); 557 - break; 558 - case LOCAL_EEPROM_SUM: 559 - memcpy(&priv->eeprom_sum, priv->rxp, sizeof(priv->eeprom_sum)); 560 - if (priv->eeprom_sum.type != 0 && 561 - priv->eeprom_sum.type != 1) { 562 - netdev_err(dev, "LOCAL_EEPROM_SUM error!\n"); 563 - return; 564 - } 565 - priv->eeprom_checksum = (priv->eeprom_sum.type == 0) ? 566 - EEPROM_CHECKSUM_NONE : 567 - (priv->eeprom_sum.result == 0) ? 568 - EEPROM_NG : EEPROM_OK; 569 - break; 570 - default: 571 - netdev_err(priv->net_dev, "mib_attribute=%08x\n", 572 - (unsigned int)mib_attribute); 573 - break; 574 - } 575 - } 576 - 577 - static 578 - void hostif_mib_set_confirm(struct ks_wlan_private *priv) 579 - { 580 - u32 mib_status; 581 - u32 mib_attribute; 582 - 583 - mib_status = get_dword(priv); 584 - mib_attribute = get_dword(priv); 585 - 586 - if (mib_status) { 587 - /* in case of error */ 588 - netdev_err(priv->net_dev, "error :: attribute=%08X, status=%08X\n", 589 - mib_attribute, mib_status); 590 - } 591 - 592 - switch (mib_attribute) { 593 - case DOT11_RTS_THRESHOLD: 594 - hostif_sme_enqueue(priv, SME_RTS_THRESHOLD_CONFIRM); 595 - break; 596 - case DOT11_FRAGMENTATION_THRESHOLD: 597 - hostif_sme_enqueue(priv, SME_FRAGMENTATION_THRESHOLD_CONFIRM); 598 - break; 599 - case DOT11_WEP_DEFAULT_KEY_ID: 600 - if (!priv->wpa.wpa_enabled) 601 - hostif_sme_enqueue(priv, SME_WEP_INDEX_CONFIRM); 602 - break; 603 - case DOT11_WEP_DEFAULT_KEY_VALUE1: 604 - if (priv->wpa.rsn_enabled) 605 - hostif_sme_enqueue(priv, SME_SET_PMK_TSC); 606 - else 607 - hostif_sme_enqueue(priv, SME_WEP_KEY1_CONFIRM); 608 - break; 609 - case DOT11_WEP_DEFAULT_KEY_VALUE2: 610 - if (priv->wpa.rsn_enabled) 611 - hostif_sme_enqueue(priv, SME_SET_GMK1_TSC); 612 - else 613 - hostif_sme_enqueue(priv, SME_WEP_KEY2_CONFIRM); 614 - break; 615 - case DOT11_WEP_DEFAULT_KEY_VALUE3: 616 - if (priv->wpa.rsn_enabled) 617 - hostif_sme_enqueue(priv, SME_SET_GMK2_TSC); 618 - else 619 - hostif_sme_enqueue(priv, SME_WEP_KEY3_CONFIRM); 620 - break; 621 - case DOT11_WEP_DEFAULT_KEY_VALUE4: 622 - if (!priv->wpa.rsn_enabled) 623 - hostif_sme_enqueue(priv, SME_WEP_KEY4_CONFIRM); 624 - break; 625 - case DOT11_PRIVACY_INVOKED: 626 - if (!priv->wpa.rsn_enabled) 627 - hostif_sme_enqueue(priv, SME_WEP_FLAG_CONFIRM); 628 - break; 629 - case DOT11_RSN_ENABLED: 630 - hostif_sme_enqueue(priv, SME_RSN_ENABLED_CONFIRM); 631 - break; 632 - case LOCAL_RSN_MODE: 633 - hostif_sme_enqueue(priv, SME_RSN_MODE_CONFIRM); 634 - break; 635 - case LOCAL_MULTICAST_ADDRESS: 636 - hostif_sme_enqueue(priv, SME_MULTICAST_REQUEST); 637 - break; 638 - case LOCAL_MULTICAST_FILTER: 639 - hostif_sme_enqueue(priv, SME_MULTICAST_CONFIRM); 640 - break; 641 - case LOCAL_CURRENTADDRESS: 642 - priv->mac_address_valid = true; 643 - break; 644 - case DOT11_RSN_CONFIG_MULTICAST_CIPHER: 645 - hostif_sme_enqueue(priv, SME_RSN_MCAST_CONFIRM); 646 - break; 647 - case DOT11_RSN_CONFIG_UNICAST_CIPHER: 648 - hostif_sme_enqueue(priv, SME_RSN_UCAST_CONFIRM); 649 - break; 650 - case DOT11_RSN_CONFIG_AUTH_SUITE: 651 - hostif_sme_enqueue(priv, SME_RSN_AUTH_CONFIRM); 652 - break; 653 - case DOT11_GMK1_TSC: 654 - if (atomic_read(&priv->psstatus.snooze_guard)) 655 - atomic_set(&priv->psstatus.snooze_guard, 0); 656 - break; 657 - case DOT11_GMK2_TSC: 658 - if (atomic_read(&priv->psstatus.snooze_guard)) 659 - atomic_set(&priv->psstatus.snooze_guard, 0); 660 - break; 661 - case DOT11_PMK_TSC: 662 - case LOCAL_PMK: 663 - case LOCAL_GAIN: 664 - case LOCAL_WPS_ENABLE: 665 - case LOCAL_WPS_PROBE_REQ: 666 - case LOCAL_REGION: 667 - default: 668 - break; 669 - } 670 - } 671 - 672 - static 673 - void hostif_power_mgmt_confirm(struct ks_wlan_private *priv) 674 - { 675 - if (priv->reg.power_mgmt > POWER_MGMT_ACTIVE && 676 - priv->reg.operation_mode == MODE_INFRASTRUCTURE) { 677 - atomic_set(&priv->psstatus.confirm_wait, 0); 678 - priv->dev_state = DEVICE_STATE_SLEEP; 679 - ks_wlan_hw_power_save(priv); 680 - } else { 681 - priv->dev_state = DEVICE_STATE_READY; 682 - } 683 - } 684 - 685 - static 686 - void hostif_sleep_confirm(struct ks_wlan_private *priv) 687 - { 688 - atomic_set(&priv->sleepstatus.doze_request, 1); 689 - queue_delayed_work(priv->wq, &priv->rw_dwork, 1); 690 - } 691 - 692 - static 693 - void hostif_start_confirm(struct ks_wlan_private *priv) 694 - { 695 - union iwreq_data wrqu; 696 - 697 - wrqu.data.length = 0; 698 - wrqu.data.flags = 0; 699 - wrqu.ap_addr.sa_family = ARPHRD_ETHER; 700 - if (is_connect_status(priv->connect_status)) { 701 - eth_zero_addr(wrqu.ap_addr.sa_data); 702 - wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); 703 - } 704 - netdev_dbg(priv->net_dev, " scan_ind_count=%d\n", priv->scan_ind_count); 705 - hostif_sme_enqueue(priv, SME_START_CONFIRM); 706 - } 707 - 708 - static 709 - void hostif_connect_indication(struct ks_wlan_private *priv) 710 - { 711 - u16 connect_code; 712 - unsigned int tmp = 0; 713 - unsigned int old_status = priv->connect_status; 714 - struct net_device *netdev = priv->net_dev; 715 - union iwreq_data wrqu0; 716 - 717 - connect_code = get_word(priv); 718 - 719 - switch (connect_code) { 720 - case RESULT_CONNECT: 721 - if (!(priv->connect_status & FORCE_DISCONNECT)) 722 - netif_carrier_on(netdev); 723 - tmp = FORCE_DISCONNECT & priv->connect_status; 724 - priv->connect_status = tmp + CONNECT_STATUS; 725 - break; 726 - case RESULT_DISCONNECT: 727 - netif_carrier_off(netdev); 728 - tmp = FORCE_DISCONNECT & priv->connect_status; 729 - priv->connect_status = tmp + DISCONNECT_STATUS; 730 - break; 731 - default: 732 - netdev_dbg(priv->net_dev, "unknown connect_code=%d :: scan_ind_count=%d\n", 733 - connect_code, priv->scan_ind_count); 734 - netif_carrier_off(netdev); 735 - tmp = FORCE_DISCONNECT & priv->connect_status; 736 - priv->connect_status = tmp + DISCONNECT_STATUS; 737 - break; 738 - } 739 - 740 - get_current_ap(priv, (struct link_ap_info *)priv->rxp); 741 - if (is_connect_status(priv->connect_status) && 742 - is_disconnect_status(old_status)) { 743 - /* for power save */ 744 - atomic_set(&priv->psstatus.snooze_guard, 0); 745 - atomic_set(&priv->psstatus.confirm_wait, 0); 746 - } 747 - ks_wlan_do_power_save(priv); 748 - 749 - wrqu0.data.length = 0; 750 - wrqu0.data.flags = 0; 751 - wrqu0.ap_addr.sa_family = ARPHRD_ETHER; 752 - if (is_disconnect_status(priv->connect_status) && 753 - is_connect_status(old_status)) { 754 - eth_zero_addr(wrqu0.ap_addr.sa_data); 755 - netdev_dbg(priv->net_dev, "disconnect :: scan_ind_count=%d\n", 756 - priv->scan_ind_count); 757 - wireless_send_event(netdev, SIOCGIWAP, &wrqu0, NULL); 758 - } 759 - priv->scan_ind_count = 0; 760 - } 761 - 762 - static 763 - void hostif_scan_indication(struct ks_wlan_private *priv) 764 - { 765 - int i; 766 - struct ap_info *ap_info; 767 - 768 - netdev_dbg(priv->net_dev, 769 - "scan_ind_count = %d\n", priv->scan_ind_count); 770 - ap_info = (struct ap_info *)(priv->rxp); 771 - 772 - if (priv->scan_ind_count) { 773 - /* bssid check */ 774 - for (i = 0; i < priv->aplist.size; i++) { 775 - u8 *bssid = priv->aplist.ap[i].bssid; 776 - 777 - if (ether_addr_equal(ap_info->bssid, bssid)) 778 - continue; 779 - 780 - if (ap_info->frame_type == IEEE80211_STYPE_PROBE_RESP) 781 - get_ap_information(priv, ap_info, 782 - &priv->aplist.ap[i]); 783 - return; 784 - } 785 - } 786 - priv->scan_ind_count++; 787 - if (priv->scan_ind_count < LOCAL_APLIST_MAX + 1) { 788 - netdev_dbg(priv->net_dev, " scan_ind_count=%d :: aplist.size=%d\n", 789 - priv->scan_ind_count, priv->aplist.size); 790 - get_ap_information(priv, (struct ap_info *)(priv->rxp), 791 - &priv->aplist.ap[priv->scan_ind_count - 1]); 792 - priv->aplist.size = priv->scan_ind_count; 793 - } else { 794 - netdev_dbg(priv->net_dev, " count over :: scan_ind_count=%d\n", 795 - priv->scan_ind_count); 796 - } 797 - } 798 - 799 - static 800 - void hostif_stop_confirm(struct ks_wlan_private *priv) 801 - { 802 - unsigned int tmp = 0; 803 - unsigned int old_status = priv->connect_status; 804 - struct net_device *netdev = priv->net_dev; 805 - union iwreq_data wrqu0; 806 - 807 - if (priv->dev_state == DEVICE_STATE_SLEEP) 808 - priv->dev_state = DEVICE_STATE_READY; 809 - 810 - /* disconnect indication */ 811 - if (is_connect_status(priv->connect_status)) { 812 - netif_carrier_off(netdev); 813 - tmp = FORCE_DISCONNECT & priv->connect_status; 814 - priv->connect_status = tmp | DISCONNECT_STATUS; 815 - netdev_info(netdev, "IWEVENT: disconnect\n"); 816 - 817 - wrqu0.data.length = 0; 818 - wrqu0.data.flags = 0; 819 - wrqu0.ap_addr.sa_family = ARPHRD_ETHER; 820 - if (is_disconnect_status(priv->connect_status) && 821 - is_connect_status(old_status)) { 822 - eth_zero_addr(wrqu0.ap_addr.sa_data); 823 - netdev_info(netdev, "IWEVENT: disconnect\n"); 824 - wireless_send_event(netdev, SIOCGIWAP, &wrqu0, NULL); 825 - } 826 - priv->scan_ind_count = 0; 827 - } 828 - 829 - hostif_sme_enqueue(priv, SME_STOP_CONFIRM); 830 - } 831 - 832 - static 833 - void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv) 834 - { 835 - priv->infra_status = 0; /* infrastructure mode cancel */ 836 - hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM); 837 - } 838 - 839 - static 840 - void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv) 841 - { 842 - get_word(priv); /* result_code */ 843 - priv->infra_status = 1; /* infrastructure mode set */ 844 - hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM); 845 - } 846 - 847 - static 848 - void hostif_adhoc_set_confirm(struct ks_wlan_private *priv) 849 - { 850 - priv->infra_status = 1; /* infrastructure mode set */ 851 - hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM); 852 - } 853 - 854 - static 855 - void hostif_associate_indication(struct ks_wlan_private *priv) 856 - { 857 - struct association_request *assoc_req; 858 - struct association_response *assoc_resp; 859 - unsigned char *pb; 860 - union iwreq_data wrqu; 861 - char buf[IW_CUSTOM_MAX]; 862 - char *pbuf = &buf[0]; 863 - int i; 864 - 865 - static const char associnfo_leader0[] = "ASSOCINFO(ReqIEs="; 866 - static const char associnfo_leader1[] = " RespIEs="; 867 - 868 - assoc_req = (struct association_request *)(priv->rxp); 869 - assoc_resp = (struct association_response *)(assoc_req + 1); 870 - pb = (unsigned char *)(assoc_resp + 1); 871 - 872 - memset(&wrqu, 0, sizeof(wrqu)); 873 - memcpy(pbuf, associnfo_leader0, sizeof(associnfo_leader0) - 1); 874 - wrqu.data.length += sizeof(associnfo_leader0) - 1; 875 - pbuf += sizeof(associnfo_leader0) - 1; 876 - 877 - for (i = 0; i < le16_to_cpu(assoc_req->req_ies_size); i++) 878 - pbuf += sprintf(pbuf, "%02x", *(pb + i)); 879 - wrqu.data.length += (le16_to_cpu(assoc_req->req_ies_size)) * 2; 880 - 881 - memcpy(pbuf, associnfo_leader1, sizeof(associnfo_leader1) - 1); 882 - wrqu.data.length += sizeof(associnfo_leader1) - 1; 883 - pbuf += sizeof(associnfo_leader1) - 1; 884 - 885 - pb += le16_to_cpu(assoc_req->req_ies_size); 886 - for (i = 0; i < le16_to_cpu(assoc_resp->resp_ies_size); i++) 887 - pbuf += sprintf(pbuf, "%02x", *(pb + i)); 888 - wrqu.data.length += (le16_to_cpu(assoc_resp->resp_ies_size)) * 2; 889 - 890 - pbuf += sprintf(pbuf, ")"); 891 - wrqu.data.length += 1; 892 - 893 - wireless_send_event(priv->net_dev, IWEVCUSTOM, &wrqu, buf); 894 - } 895 - 896 - static 897 - void hostif_bss_scan_confirm(struct ks_wlan_private *priv) 898 - { 899 - u32 result_code; 900 - struct net_device *dev = priv->net_dev; 901 - union iwreq_data wrqu; 902 - 903 - result_code = get_dword(priv); 904 - netdev_dbg(priv->net_dev, "result=%d :: scan_ind_count=%d\n", 905 - result_code, priv->scan_ind_count); 906 - 907 - priv->sme_i.sme_flag &= ~SME_AP_SCAN; 908 - hostif_sme_enqueue(priv, SME_BSS_SCAN_CONFIRM); 909 - 910 - wrqu.data.length = 0; 911 - wrqu.data.flags = 0; 912 - wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL); 913 - priv->scan_ind_count = 0; 914 - } 915 - 916 - static 917 - void hostif_phy_information_confirm(struct ks_wlan_private *priv) 918 - { 919 - struct iw_statistics *wstats = &priv->wstats; 920 - u8 rssi, signal; 921 - u8 link_speed; 922 - u32 transmitted_frame_count, received_fragment_count; 923 - u32 failed_count, fcs_error_count; 924 - 925 - rssi = get_byte(priv); 926 - signal = get_byte(priv); 927 - get_byte(priv); /* noise */ 928 - link_speed = get_byte(priv); 929 - transmitted_frame_count = get_dword(priv); 930 - received_fragment_count = get_dword(priv); 931 - failed_count = get_dword(priv); 932 - fcs_error_count = get_dword(priv); 933 - 934 - netdev_dbg(priv->net_dev, "phyinfo confirm rssi=%d signal=%d\n", 935 - rssi, signal); 936 - priv->current_rate = (link_speed & RATE_MASK); 937 - wstats->qual.qual = signal; 938 - wstats->qual.level = 256 - rssi; 939 - wstats->qual.noise = 0; /* invalid noise value */ 940 - wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; 941 - 942 - netdev_dbg(priv->net_dev, "\n rssi=%u\n" 943 - " signal=%u\n" 944 - " link_speed=%ux500Kbps\n" 945 - " transmitted_frame_count=%u\n" 946 - " received_fragment_count=%u\n" 947 - " failed_count=%u\n" 948 - " fcs_error_count=%u\n", 949 - rssi, signal, link_speed, transmitted_frame_count, 950 - received_fragment_count, failed_count, fcs_error_count); 951 - /* wake_up_interruptible_all(&priv->confirm_wait); */ 952 - complete(&priv->confirm_wait); 953 - } 954 - 955 - static 956 - void hostif_mic_failure_confirm(struct ks_wlan_private *priv) 957 - { 958 - netdev_dbg(priv->net_dev, "mic_failure=%u\n", 959 - priv->wpa.mic_failure.failure); 960 - hostif_sme_enqueue(priv, SME_MIC_FAILURE_CONFIRM); 961 - } 962 - 963 - static 964 - void hostif_event_check(struct ks_wlan_private *priv) 965 - { 966 - u16 event; 967 - 968 - event = get_word(priv); 969 - switch (event) { 970 - case HIF_DATA_IND: 971 - hostif_data_indication(priv); 972 - break; 973 - case HIF_MIB_GET_CONF: 974 - hostif_mib_get_confirm(priv); 975 - break; 976 - case HIF_MIB_SET_CONF: 977 - hostif_mib_set_confirm(priv); 978 - break; 979 - case HIF_POWER_MGMT_CONF: 980 - hostif_power_mgmt_confirm(priv); 981 - break; 982 - case HIF_SLEEP_CONF: 983 - hostif_sleep_confirm(priv); 984 - break; 985 - case HIF_START_CONF: 986 - hostif_start_confirm(priv); 987 - break; 988 - case HIF_CONNECT_IND: 989 - hostif_connect_indication(priv); 990 - break; 991 - case HIF_STOP_CONF: 992 - hostif_stop_confirm(priv); 993 - break; 994 - case HIF_PS_ADH_SET_CONF: 995 - hostif_ps_adhoc_set_confirm(priv); 996 - break; 997 - case HIF_INFRA_SET_CONF: 998 - case HIF_INFRA_SET2_CONF: 999 - hostif_infrastructure_set_confirm(priv); 1000 - break; 1001 - case HIF_ADH_SET_CONF: 1002 - case HIF_ADH_SET2_CONF: 1003 - hostif_adhoc_set_confirm(priv); 1004 - break; 1005 - case HIF_ASSOC_INFO_IND: 1006 - hostif_associate_indication(priv); 1007 - break; 1008 - case HIF_MIC_FAILURE_CONF: 1009 - hostif_mic_failure_confirm(priv); 1010 - break; 1011 - case HIF_SCAN_CONF: 1012 - hostif_bss_scan_confirm(priv); 1013 - break; 1014 - case HIF_PHY_INFO_CONF: 1015 - case HIF_PHY_INFO_IND: 1016 - hostif_phy_information_confirm(priv); 1017 - break; 1018 - case HIF_SCAN_IND: 1019 - hostif_scan_indication(priv); 1020 - break; 1021 - case HIF_AP_SET_CONF: 1022 - default: 1023 - netdev_err(priv->net_dev, "undefined event[%04X]\n", event); 1024 - /* wake_up_all(&priv->confirm_wait); */ 1025 - complete(&priv->confirm_wait); 1026 - break; 1027 - } 1028 - 1029 - /* add event to hostt buffer */ 1030 - priv->hostt.buff[priv->hostt.qtail] = event; 1031 - priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE; 1032 - } 1033 - 1034 - /* allocate size bytes, set header size and event */ 1035 - static void *hostif_generic_request(size_t size, int event) 1036 - { 1037 - struct hostif_hdr *p; 1038 - 1039 - p = kzalloc(hif_align_size(size), GFP_ATOMIC); 1040 - if (!p) 1041 - return NULL; 1042 - 1043 - p->size = cpu_to_le16(size - sizeof(p->size)); 1044 - p->event = cpu_to_le16(event); 1045 - 1046 - return p; 1047 - } 1048 - 1049 - int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) 1050 - { 1051 - unsigned int skb_len = 0; 1052 - unsigned char *buffer = NULL; 1053 - unsigned int length = 0; 1054 - struct hostif_data_request *pp; 1055 - unsigned char *p; 1056 - unsigned short eth_proto; 1057 - struct ether_hdr *eth_hdr; 1058 - unsigned short keyinfo = 0; 1059 - struct ieee802_1x_hdr *aa1x_hdr; 1060 - struct wpa_eapol_key *eap_key; 1061 - struct ethhdr *eth; 1062 - size_t size; 1063 - int ret; 1064 - 1065 - skb_len = skb->len; 1066 - if (skb_len > ETH_FRAME_LEN) { 1067 - netdev_err(priv->net_dev, "bad length skb_len=%d\n", skb_len); 1068 - ret = -EOVERFLOW; 1069 - goto err_kfree_skb; 1070 - } 1071 - 1072 - if (is_disconnect_status(priv->connect_status) || 1073 - (priv->connect_status & FORCE_DISCONNECT) || 1074 - priv->wpa.mic_failure.stop) { 1075 - if (netif_queue_stopped(priv->net_dev)) 1076 - netif_wake_queue(priv->net_dev); 1077 - 1078 - dev_kfree_skb(skb); 1079 - 1080 - return 0; 1081 - } 1082 - 1083 - /* power save wakeup */ 1084 - if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) { 1085 - if (!netif_queue_stopped(priv->net_dev)) 1086 - netif_stop_queue(priv->net_dev); 1087 - } 1088 - 1089 - size = sizeof(*pp) + 6 + skb_len + 8; 1090 - pp = kmalloc(hif_align_size(size), GFP_ATOMIC); 1091 - if (!pp) { 1092 - ret = -ENOMEM; 1093 - goto err_kfree_skb; 1094 - } 1095 - 1096 - p = (unsigned char *)pp->data; 1097 - 1098 - buffer = skb->data; 1099 - length = skb->len; 1100 - 1101 - /* skb check */ 1102 - eth = (struct ethhdr *)skb->data; 1103 - if (!ether_addr_equal(&priv->eth_addr[0], eth->h_source)) { 1104 - netdev_err(priv->net_dev, 1105 - "Invalid mac address: ethernet->h_source=%pM\n", 1106 - eth->h_source); 1107 - ret = -ENXIO; 1108 - goto err_kfree; 1109 - } 1110 - 1111 - /* dest and src MAC address copy */ 1112 - size = ETH_ALEN * 2; 1113 - memcpy(p, buffer, size); 1114 - p += size; 1115 - buffer += size; 1116 - length -= size; 1117 - 1118 - /* EtherType/Length check */ 1119 - if (*(buffer + 1) + (*buffer << 8) > 1500) { 1120 - /* ProtocolEAP = *(buffer+1) + (*buffer << 8); */ 1121 - /* SAP/CTL/OUI(6 byte) add */ 1122 - *p++ = 0xAA; /* DSAP */ 1123 - *p++ = 0xAA; /* SSAP */ 1124 - *p++ = 0x03; /* CTL */ 1125 - *p++ = 0x00; /* OUI ("000000") */ 1126 - *p++ = 0x00; /* OUI ("000000") */ 1127 - *p++ = 0x00; /* OUI ("000000") */ 1128 - skb_len += 6; 1129 - } else { 1130 - /* Length(2 byte) delete */ 1131 - buffer += 2; 1132 - length -= 2; 1133 - skb_len -= 2; 1134 - } 1135 - 1136 - /* pp->data copy */ 1137 - memcpy(p, buffer, length); 1138 - 1139 - p += length; 1140 - 1141 - /* for WPA */ 1142 - eth_hdr = (struct ether_hdr *)&pp->data[0]; 1143 - eth_proto = ntohs(eth_hdr->h_proto); 1144 - 1145 - /* for MIC FAILURE REPORT check */ 1146 - if (eth_proto == ETH_P_PAE && 1147 - priv->wpa.mic_failure.failure > 0) { 1148 - aa1x_hdr = (struct ieee802_1x_hdr *)(eth_hdr + 1); 1149 - if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY) { 1150 - eap_key = (struct wpa_eapol_key *)(aa1x_hdr + 1); 1151 - keyinfo = ntohs(eap_key->key_info); 1152 - } 1153 - } 1154 - 1155 - if (priv->wpa.rsn_enabled && priv->wpa.key[0].key_len) { 1156 - /* no encryption */ 1157 - if (eth_proto == ETH_P_PAE && 1158 - priv->wpa.key[1].key_len == 0 && 1159 - priv->wpa.key[2].key_len == 0 && 1160 - priv->wpa.key[3].key_len == 0) { 1161 - pp->auth_type = cpu_to_le16(TYPE_AUTH); 1162 - } else { 1163 - if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) { 1164 - u8 mic[MICHAEL_MIC_LEN]; 1165 - 1166 - ret = michael_mic(priv->wpa.key[0].tx_mic_key, 1167 - &pp->data[0], skb_len, 1168 - 0, mic); 1169 - if (ret < 0) 1170 - goto err_kfree; 1171 - 1172 - memcpy(p, mic, sizeof(mic)); 1173 - length += sizeof(mic); 1174 - skb_len += sizeof(mic); 1175 - p += sizeof(mic); 1176 - pp->auth_type = 1177 - cpu_to_le16(TYPE_DATA); 1178 - } else if (priv->wpa.pairwise_suite == 1179 - IW_AUTH_CIPHER_CCMP) { 1180 - pp->auth_type = 1181 - cpu_to_le16(TYPE_DATA); 1182 - } 1183 - } 1184 - } else { 1185 - if (eth_proto == ETH_P_PAE) 1186 - pp->auth_type = cpu_to_le16(TYPE_AUTH); 1187 - else 1188 - pp->auth_type = cpu_to_le16(TYPE_DATA); 1189 - } 1190 - 1191 - /* header value set */ 1192 - pp->header.size = 1193 - cpu_to_le16((sizeof(*pp) - sizeof(pp->header.size) + skb_len)); 1194 - pp->header.event = cpu_to_le16(HIF_DATA_REQ); 1195 - 1196 - /* tx request */ 1197 - ret = ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp) + skb_len), 1198 - send_packet_complete, skb); 1199 - 1200 - /* MIC FAILURE REPORT check */ 1201 - if (eth_proto == ETH_P_PAE && 1202 - priv->wpa.mic_failure.failure > 0) { 1203 - if (keyinfo & WPA_KEY_INFO_ERROR && 1204 - keyinfo & WPA_KEY_INFO_REQUEST) { 1205 - netdev_err(priv->net_dev, 1206 - "MIC ERROR Report SET : %04X\n", keyinfo); 1207 - hostif_sme_enqueue(priv, SME_MIC_FAILURE_REQUEST); 1208 - } 1209 - if (priv->wpa.mic_failure.failure == 2) 1210 - priv->wpa.mic_failure.stop = 1; 1211 - } 1212 - 1213 - return ret; 1214 - 1215 - err_kfree: 1216 - kfree(pp); 1217 - err_kfree_skb: 1218 - dev_kfree_skb(skb); 1219 - 1220 - return ret; 1221 - } 1222 - 1223 - static inline void ps_confirm_wait_inc(struct ks_wlan_private *priv) 1224 - { 1225 - if (atomic_read(&priv->psstatus.status) > PS_ACTIVE_SET) 1226 - atomic_inc(&priv->psstatus.confirm_wait); 1227 - } 1228 - 1229 - static inline void send_request_to_device(struct ks_wlan_private *priv, 1230 - void *data, size_t size) 1231 - { 1232 - ps_confirm_wait_inc(priv); 1233 - ks_wlan_hw_tx(priv, data, size, NULL, NULL); 1234 - } 1235 - 1236 - static void hostif_mib_get_request(struct ks_wlan_private *priv, 1237 - u32 mib_attribute) 1238 - { 1239 - struct hostif_mib_get_request *pp; 1240 - 1241 - pp = hostif_generic_request(sizeof(*pp), HIF_MIB_GET_REQ); 1242 - if (!pp) 1243 - return; 1244 - 1245 - pp->mib_attribute = cpu_to_le32(mib_attribute); 1246 - 1247 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1248 - } 1249 - 1250 - static void hostif_mib_set_request(struct ks_wlan_private *priv, 1251 - enum mib_attribute attr, 1252 - enum mib_data_type type, 1253 - void *data, size_t size) 1254 - { 1255 - struct hostif_mib_set_request_t *pp; 1256 - 1257 - if (priv->dev_state < DEVICE_STATE_BOOT) 1258 - return; 1259 - 1260 - pp = hostif_generic_request(sizeof(*pp), HIF_MIB_SET_REQ); 1261 - if (!pp) 1262 - return; 1263 - 1264 - pp->mib_attribute = cpu_to_le32(attr); 1265 - pp->mib_value.size = cpu_to_le16(size); 1266 - pp->mib_value.type = cpu_to_le16(type); 1267 - memcpy(&pp->mib_value.body, data, size); 1268 - 1269 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp) + size)); 1270 - } 1271 - 1272 - static inline void hostif_mib_set_request_int(struct ks_wlan_private *priv, 1273 - enum mib_attribute attr, int val) 1274 - { 1275 - __le32 v = cpu_to_le32(val); 1276 - size_t size = sizeof(v); 1277 - 1278 - hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_INT, &v, size); 1279 - } 1280 - 1281 - static inline void hostif_mib_set_request_bool(struct ks_wlan_private *priv, 1282 - enum mib_attribute attr, 1283 - bool val) 1284 - { 1285 - __le32 v = cpu_to_le32(val); 1286 - size_t size = sizeof(v); 1287 - 1288 - hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_BOOL, &v, size); 1289 - } 1290 - 1291 - static inline void hostif_mib_set_request_ostring(struct ks_wlan_private *priv, 1292 - enum mib_attribute attr, 1293 - void *data, size_t size) 1294 - { 1295 - hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_OSTRING, data, size); 1296 - } 1297 - 1298 - static 1299 - void hostif_start_request(struct ks_wlan_private *priv, unsigned char mode) 1300 - { 1301 - struct hostif_start_request *pp; 1302 - 1303 - pp = hostif_generic_request(sizeof(*pp), HIF_START_REQ); 1304 - if (!pp) 1305 - return; 1306 - 1307 - pp->mode = cpu_to_le16(mode); 1308 - 1309 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1310 - 1311 - priv->aplist.size = 0; 1312 - priv->scan_ind_count = 0; 1313 - } 1314 - 1315 - static __le16 ks_wlan_cap(struct ks_wlan_private *priv) 1316 - { 1317 - u16 capability = 0x0000; 1318 - 1319 - if (priv->reg.preamble == SHORT_PREAMBLE) 1320 - capability |= WLAN_CAPABILITY_SHORT_PREAMBLE; 1321 - 1322 - capability &= ~(WLAN_CAPABILITY_PBCC); /* pbcc not support */ 1323 - 1324 - if (priv->reg.phy_type != D_11B_ONLY_MODE) { 1325 - capability |= WLAN_CAPABILITY_SHORT_SLOT_TIME; 1326 - capability &= ~(WLAN_CAPABILITY_DSSS_OFDM); 1327 - } 1328 - 1329 - return cpu_to_le16(capability); 1330 - } 1331 - 1332 - static void init_request(struct ks_wlan_private *priv, 1333 - struct hostif_request *req) 1334 - { 1335 - req->phy_type = cpu_to_le16(priv->reg.phy_type); 1336 - req->cts_mode = cpu_to_le16(priv->reg.cts_mode); 1337 - req->scan_type = cpu_to_le16(priv->reg.scan_type); 1338 - req->rate_set.size = priv->reg.rate_set.size; 1339 - req->capability = ks_wlan_cap(priv); 1340 - memcpy(&req->rate_set.body[0], &priv->reg.rate_set.body[0], 1341 - priv->reg.rate_set.size); 1342 - } 1343 - 1344 - static 1345 - void hostif_ps_adhoc_set_request(struct ks_wlan_private *priv) 1346 - { 1347 - struct hostif_ps_adhoc_set_request *pp; 1348 - 1349 - pp = hostif_generic_request(sizeof(*pp), HIF_PS_ADH_SET_REQ); 1350 - if (!pp) 1351 - return; 1352 - 1353 - init_request(priv, &pp->request); 1354 - pp->channel = cpu_to_le16(priv->reg.channel); 1355 - 1356 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1357 - } 1358 - 1359 - static 1360 - void hostif_infrastructure_set_request(struct ks_wlan_private *priv, int event) 1361 - { 1362 - struct hostif_infrastructure_set_request *pp; 1363 - 1364 - pp = hostif_generic_request(sizeof(*pp), event); 1365 - if (!pp) 1366 - return; 1367 - 1368 - init_request(priv, &pp->request); 1369 - pp->ssid.size = priv->reg.ssid.size; 1370 - memcpy(&pp->ssid.body[0], &priv->reg.ssid.body[0], priv->reg.ssid.size); 1371 - pp->beacon_lost_count = 1372 - cpu_to_le16(priv->reg.beacon_lost_count); 1373 - pp->auth_type = cpu_to_le16(priv->reg.authenticate_type); 1374 - 1375 - pp->channel_list.body[0] = 1; 1376 - pp->channel_list.body[1] = 8; 1377 - pp->channel_list.body[2] = 2; 1378 - pp->channel_list.body[3] = 9; 1379 - pp->channel_list.body[4] = 3; 1380 - pp->channel_list.body[5] = 10; 1381 - pp->channel_list.body[6] = 4; 1382 - pp->channel_list.body[7] = 11; 1383 - pp->channel_list.body[8] = 5; 1384 - pp->channel_list.body[9] = 12; 1385 - pp->channel_list.body[10] = 6; 1386 - pp->channel_list.body[11] = 13; 1387 - pp->channel_list.body[12] = 7; 1388 - if (priv->reg.phy_type == D_11G_ONLY_MODE) { 1389 - pp->channel_list.size = 13; 1390 - } else { 1391 - pp->channel_list.body[13] = 14; 1392 - pp->channel_list.size = 14; 1393 - } 1394 - 1395 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1396 - } 1397 - 1398 - static 1399 - void hostif_adhoc_set_request(struct ks_wlan_private *priv) 1400 - { 1401 - struct hostif_adhoc_set_request *pp; 1402 - 1403 - pp = hostif_generic_request(sizeof(*pp), HIF_ADH_SET_REQ); 1404 - if (!pp) 1405 - return; 1406 - 1407 - init_request(priv, &pp->request); 1408 - pp->channel = cpu_to_le16(priv->reg.channel); 1409 - pp->ssid.size = priv->reg.ssid.size; 1410 - memcpy(&pp->ssid.body[0], &priv->reg.ssid.body[0], priv->reg.ssid.size); 1411 - 1412 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1413 - } 1414 - 1415 - static 1416 - void hostif_adhoc_set2_request(struct ks_wlan_private *priv) 1417 - { 1418 - struct hostif_adhoc_set2_request *pp; 1419 - 1420 - pp = hostif_generic_request(sizeof(*pp), HIF_ADH_SET_REQ); 1421 - if (!pp) 1422 - return; 1423 - 1424 - init_request(priv, &pp->request); 1425 - pp->ssid.size = priv->reg.ssid.size; 1426 - memcpy(&pp->ssid.body[0], &priv->reg.ssid.body[0], priv->reg.ssid.size); 1427 - 1428 - pp->channel_list.body[0] = priv->reg.channel; 1429 - pp->channel_list.size = 1; 1430 - memcpy(pp->bssid, priv->reg.bssid, ETH_ALEN); 1431 - 1432 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1433 - } 1434 - 1435 - static 1436 - void hostif_stop_request(struct ks_wlan_private *priv) 1437 - { 1438 - struct hostif_stop_request *pp; 1439 - 1440 - pp = hostif_generic_request(sizeof(*pp), HIF_STOP_REQ); 1441 - if (!pp) 1442 - return; 1443 - 1444 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1445 - } 1446 - 1447 - static 1448 - void hostif_phy_information_request(struct ks_wlan_private *priv) 1449 - { 1450 - struct hostif_phy_information_request *pp; 1451 - 1452 - pp = hostif_generic_request(sizeof(*pp), HIF_PHY_INFO_REQ); 1453 - if (!pp) 1454 - return; 1455 - 1456 - if (priv->reg.phy_info_timer) { 1457 - pp->type = cpu_to_le16(TIME_TYPE); 1458 - pp->time = cpu_to_le16(priv->reg.phy_info_timer); 1459 - } else { 1460 - pp->type = cpu_to_le16(NORMAL_TYPE); 1461 - pp->time = cpu_to_le16(0); 1462 - } 1463 - 1464 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1465 - } 1466 - 1467 - static 1468 - void hostif_power_mgmt_request(struct ks_wlan_private *priv, 1469 - u32 mode, u32 wake_up, u32 receive_dtims) 1470 - { 1471 - struct hostif_power_mgmt_request *pp; 1472 - 1473 - pp = hostif_generic_request(sizeof(*pp), HIF_POWER_MGMT_REQ); 1474 - if (!pp) 1475 - return; 1476 - 1477 - pp->mode = cpu_to_le32(mode); 1478 - pp->wake_up = cpu_to_le32(wake_up); 1479 - pp->receive_dtims = cpu_to_le32(receive_dtims); 1480 - 1481 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1482 - } 1483 - 1484 - static 1485 - void hostif_sleep_request(struct ks_wlan_private *priv, 1486 - enum sleep_mode_type mode) 1487 - { 1488 - struct hostif_sleep_request *pp; 1489 - 1490 - if (mode == SLP_SLEEP) { 1491 - pp = hostif_generic_request(sizeof(*pp), HIF_SLEEP_REQ); 1492 - if (!pp) 1493 - return; 1494 - 1495 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1496 - } else if (mode == SLP_ACTIVE) { 1497 - atomic_set(&priv->sleepstatus.wakeup_request, 1); 1498 - queue_delayed_work(priv->wq, &priv->rw_dwork, 1); 1499 - } else { 1500 - netdev_err(priv->net_dev, "invalid mode %ld\n", (long)mode); 1501 - return; 1502 - } 1503 - } 1504 - 1505 - static 1506 - void hostif_bss_scan_request(struct ks_wlan_private *priv, 1507 - unsigned long scan_type, u8 *scan_ssid, 1508 - u8 scan_ssid_len) 1509 - { 1510 - struct hostif_bss_scan_request *pp; 1511 - 1512 - pp = hostif_generic_request(sizeof(*pp), HIF_SCAN_REQ); 1513 - if (!pp) 1514 - return; 1515 - 1516 - pp->scan_type = scan_type; 1517 - 1518 - pp->ch_time_min = cpu_to_le32(110); /* default value */ 1519 - pp->ch_time_max = cpu_to_le32(130); /* default value */ 1520 - pp->channel_list.body[0] = 1; 1521 - pp->channel_list.body[1] = 8; 1522 - pp->channel_list.body[2] = 2; 1523 - pp->channel_list.body[3] = 9; 1524 - pp->channel_list.body[4] = 3; 1525 - pp->channel_list.body[5] = 10; 1526 - pp->channel_list.body[6] = 4; 1527 - pp->channel_list.body[7] = 11; 1528 - pp->channel_list.body[8] = 5; 1529 - pp->channel_list.body[9] = 12; 1530 - pp->channel_list.body[10] = 6; 1531 - pp->channel_list.body[11] = 13; 1532 - pp->channel_list.body[12] = 7; 1533 - if (priv->reg.phy_type == D_11G_ONLY_MODE) { 1534 - pp->channel_list.size = 13; 1535 - } else { 1536 - pp->channel_list.body[13] = 14; 1537 - pp->channel_list.size = 14; 1538 - } 1539 - pp->ssid.size = 0; 1540 - 1541 - /* specified SSID SCAN */ 1542 - if (scan_ssid_len > 0 && scan_ssid_len <= 32) { 1543 - pp->ssid.size = scan_ssid_len; 1544 - memcpy(&pp->ssid.body[0], scan_ssid, scan_ssid_len); 1545 - } 1546 - 1547 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1548 - 1549 - priv->aplist.size = 0; 1550 - priv->scan_ind_count = 0; 1551 - } 1552 - 1553 - static 1554 - void hostif_mic_failure_request(struct ks_wlan_private *priv, 1555 - u16 failure_count, u16 timer) 1556 - { 1557 - struct hostif_mic_failure_request *pp; 1558 - 1559 - pp = hostif_generic_request(sizeof(*pp), HIF_MIC_FAILURE_REQ); 1560 - if (!pp) 1561 - return; 1562 - 1563 - pp->failure_count = cpu_to_le16(failure_count); 1564 - pp->timer = cpu_to_le16(timer); 1565 - 1566 - send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); 1567 - } 1568 - 1569 - /* Device I/O Receive indicate */ 1570 - static void devio_rec_ind(struct ks_wlan_private *priv, unsigned char *p, 1571 - unsigned int size) 1572 - { 1573 - if (!priv->is_device_open) 1574 - return; 1575 - 1576 - spin_lock(&priv->dev_read_lock); 1577 - priv->dev_data[atomic_read(&priv->rec_count)] = p; 1578 - priv->dev_size[atomic_read(&priv->rec_count)] = size; 1579 - 1580 - if (atomic_read(&priv->event_count) != DEVICE_STOCK_COUNT) { 1581 - /* rx event count inc */ 1582 - atomic_inc(&priv->event_count); 1583 - } 1584 - atomic_inc(&priv->rec_count); 1585 - if (atomic_read(&priv->rec_count) == DEVICE_STOCK_COUNT) 1586 - atomic_set(&priv->rec_count, 0); 1587 - 1588 - wake_up_interruptible_all(&priv->devread_wait); 1589 - 1590 - spin_unlock(&priv->dev_read_lock); 1591 - } 1592 - 1593 - void hostif_receive(struct ks_wlan_private *priv, unsigned char *p, 1594 - unsigned int size) 1595 - { 1596 - devio_rec_ind(priv, p, size); 1597 - 1598 - priv->rxp = p; 1599 - priv->rx_size = size; 1600 - 1601 - if (get_word(priv) == priv->rx_size) 1602 - hostif_event_check(priv); 1603 - } 1604 - 1605 - static void hostif_sme_set_wep(struct ks_wlan_private *priv, int type) 1606 - { 1607 - switch (type) { 1608 - case SME_WEP_INDEX_REQUEST: 1609 - hostif_mib_set_request_int(priv, DOT11_WEP_DEFAULT_KEY_ID, 1610 - priv->reg.wep_index); 1611 - break; 1612 - case SME_WEP_KEY1_REQUEST: 1613 - if (priv->wpa.wpa_enabled) 1614 - return; 1615 - hostif_mib_set_request_ostring(priv, 1616 - DOT11_WEP_DEFAULT_KEY_VALUE1, 1617 - &priv->reg.wep_key[0].val[0], 1618 - priv->reg.wep_key[0].size); 1619 - break; 1620 - case SME_WEP_KEY2_REQUEST: 1621 - if (priv->wpa.wpa_enabled) 1622 - return; 1623 - hostif_mib_set_request_ostring(priv, 1624 - DOT11_WEP_DEFAULT_KEY_VALUE2, 1625 - &priv->reg.wep_key[1].val[0], 1626 - priv->reg.wep_key[1].size); 1627 - break; 1628 - case SME_WEP_KEY3_REQUEST: 1629 - if (priv->wpa.wpa_enabled) 1630 - return; 1631 - hostif_mib_set_request_ostring(priv, 1632 - DOT11_WEP_DEFAULT_KEY_VALUE3, 1633 - &priv->reg.wep_key[2].val[0], 1634 - priv->reg.wep_key[2].size); 1635 - break; 1636 - case SME_WEP_KEY4_REQUEST: 1637 - if (priv->wpa.wpa_enabled) 1638 - return; 1639 - hostif_mib_set_request_ostring(priv, 1640 - DOT11_WEP_DEFAULT_KEY_VALUE4, 1641 - &priv->reg.wep_key[3].val[0], 1642 - priv->reg.wep_key[3].size); 1643 - break; 1644 - case SME_WEP_FLAG_REQUEST: 1645 - hostif_mib_set_request_bool(priv, DOT11_PRIVACY_INVOKED, 1646 - priv->reg.privacy_invoked); 1647 - break; 1648 - } 1649 - } 1650 - 1651 - struct wpa_suite { 1652 - __le16 size; 1653 - unsigned char suite[4][CIPHER_ID_LEN]; 1654 - } __packed; 1655 - 1656 - struct rsn_mode { 1657 - __le32 rsn_mode; 1658 - __le16 rsn_capability; 1659 - } __packed; 1660 - 1661 - static void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type) 1662 - { 1663 - struct wpa_suite wpa_suite; 1664 - struct rsn_mode rsn_mode; 1665 - size_t size; 1666 - u32 mode; 1667 - const u8 *buf = NULL; 1668 - 1669 - memset(&wpa_suite, 0, sizeof(wpa_suite)); 1670 - 1671 - switch (type) { 1672 - case SME_RSN_UCAST_REQUEST: 1673 - wpa_suite.size = cpu_to_le16(1); 1674 - switch (priv->wpa.pairwise_suite) { 1675 - case IW_AUTH_CIPHER_NONE: 1676 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1677 - CIPHER_ID_WPA2_NONE : CIPHER_ID_WPA_NONE; 1678 - break; 1679 - case IW_AUTH_CIPHER_WEP40: 1680 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1681 - CIPHER_ID_WPA2_WEP40 : CIPHER_ID_WPA_WEP40; 1682 - break; 1683 - case IW_AUTH_CIPHER_TKIP: 1684 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1685 - CIPHER_ID_WPA2_TKIP : CIPHER_ID_WPA_TKIP; 1686 - break; 1687 - case IW_AUTH_CIPHER_CCMP: 1688 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1689 - CIPHER_ID_WPA2_CCMP : CIPHER_ID_WPA_CCMP; 1690 - break; 1691 - case IW_AUTH_CIPHER_WEP104: 1692 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1693 - CIPHER_ID_WPA2_WEP104 : CIPHER_ID_WPA_WEP104; 1694 - break; 1695 - } 1696 - 1697 - if (buf) 1698 - memcpy(&wpa_suite.suite[0][0], buf, CIPHER_ID_LEN); 1699 - size = sizeof(wpa_suite.size) + 1700 - (CIPHER_ID_LEN * le16_to_cpu(wpa_suite.size)); 1701 - hostif_mib_set_request_ostring(priv, 1702 - DOT11_RSN_CONFIG_UNICAST_CIPHER, 1703 - &wpa_suite, size); 1704 - break; 1705 - case SME_RSN_MCAST_REQUEST: 1706 - switch (priv->wpa.group_suite) { 1707 - case IW_AUTH_CIPHER_NONE: 1708 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1709 - CIPHER_ID_WPA2_NONE : CIPHER_ID_WPA_NONE; 1710 - break; 1711 - case IW_AUTH_CIPHER_WEP40: 1712 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1713 - CIPHER_ID_WPA2_WEP40 : CIPHER_ID_WPA_WEP40; 1714 - break; 1715 - case IW_AUTH_CIPHER_TKIP: 1716 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1717 - CIPHER_ID_WPA2_TKIP : CIPHER_ID_WPA_TKIP; 1718 - break; 1719 - case IW_AUTH_CIPHER_CCMP: 1720 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1721 - CIPHER_ID_WPA2_CCMP : CIPHER_ID_WPA_CCMP; 1722 - break; 1723 - case IW_AUTH_CIPHER_WEP104: 1724 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1725 - CIPHER_ID_WPA2_WEP104 : CIPHER_ID_WPA_WEP104; 1726 - break; 1727 - } 1728 - if (buf) 1729 - memcpy(&wpa_suite.suite[0][0], buf, CIPHER_ID_LEN); 1730 - hostif_mib_set_request_ostring(priv, 1731 - DOT11_RSN_CONFIG_MULTICAST_CIPHER, 1732 - &wpa_suite.suite[0][0], 1733 - CIPHER_ID_LEN); 1734 - break; 1735 - case SME_RSN_AUTH_REQUEST: 1736 - wpa_suite.size = cpu_to_le16(1); 1737 - switch (priv->wpa.key_mgmt_suite) { 1738 - case IW_AUTH_KEY_MGMT_802_1X: 1739 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1740 - KEY_MGMT_ID_WPA2_1X : KEY_MGMT_ID_WPA_1X; 1741 - break; 1742 - case IW_AUTH_KEY_MGMT_PSK: 1743 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1744 - KEY_MGMT_ID_WPA2_PSK : KEY_MGMT_ID_WPA_PSK; 1745 - break; 1746 - case 0: 1747 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1748 - KEY_MGMT_ID_WPA2_NONE : KEY_MGMT_ID_WPA_NONE; 1749 - break; 1750 - case 4: 1751 - buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1752 - KEY_MGMT_ID_WPA2_WPANONE : 1753 - KEY_MGMT_ID_WPA_WPANONE; 1754 - break; 1755 - } 1756 - 1757 - if (buf) 1758 - memcpy(&wpa_suite.suite[0][0], buf, KEY_MGMT_ID_LEN); 1759 - size = sizeof(wpa_suite.size) + 1760 - (KEY_MGMT_ID_LEN * le16_to_cpu(wpa_suite.size)); 1761 - hostif_mib_set_request_ostring(priv, 1762 - DOT11_RSN_CONFIG_AUTH_SUITE, 1763 - &wpa_suite, size); 1764 - break; 1765 - case SME_RSN_ENABLED_REQUEST: 1766 - hostif_mib_set_request_bool(priv, DOT11_RSN_ENABLED, 1767 - priv->wpa.rsn_enabled); 1768 - break; 1769 - case SME_RSN_MODE_REQUEST: 1770 - mode = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? 1771 - RSN_MODE_WPA2 : 1772 - (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA) ? 1773 - RSN_MODE_WPA : RSN_MODE_NONE; 1774 - rsn_mode.rsn_mode = cpu_to_le32(mode); 1775 - rsn_mode.rsn_capability = cpu_to_le16(0); 1776 - hostif_mib_set_request_ostring(priv, LOCAL_RSN_MODE, 1777 - &rsn_mode, sizeof(rsn_mode)); 1778 - break; 1779 - } 1780 - } 1781 - 1782 - static 1783 - void hostif_sme_mode_setup(struct ks_wlan_private *priv) 1784 - { 1785 - unsigned char rate_size; 1786 - unsigned char rate_octet[RATE_SET_MAX_SIZE]; 1787 - int i = 0; 1788 - 1789 - /* rate setting if rate segging is auto for changing phy_type (#94) */ 1790 - if (priv->reg.tx_rate == TX_RATE_FULL_AUTO) { 1791 - if (priv->reg.phy_type == D_11B_ONLY_MODE) { 1792 - priv->reg.rate_set.body[3] = TX_RATE_11M; 1793 - priv->reg.rate_set.body[2] = TX_RATE_5M; 1794 - priv->reg.rate_set.body[1] = TX_RATE_2M | BASIC_RATE; 1795 - priv->reg.rate_set.body[0] = TX_RATE_1M | BASIC_RATE; 1796 - priv->reg.rate_set.size = 4; 1797 - } else { /* D_11G_ONLY_MODE or D_11BG_COMPATIBLE_MODE */ 1798 - priv->reg.rate_set.body[11] = TX_RATE_54M; 1799 - priv->reg.rate_set.body[10] = TX_RATE_48M; 1800 - priv->reg.rate_set.body[9] = TX_RATE_36M; 1801 - priv->reg.rate_set.body[8] = TX_RATE_18M; 1802 - priv->reg.rate_set.body[7] = TX_RATE_9M; 1803 - priv->reg.rate_set.body[6] = TX_RATE_24M | BASIC_RATE; 1804 - priv->reg.rate_set.body[5] = TX_RATE_12M | BASIC_RATE; 1805 - priv->reg.rate_set.body[4] = TX_RATE_6M | BASIC_RATE; 1806 - priv->reg.rate_set.body[3] = TX_RATE_11M | BASIC_RATE; 1807 - priv->reg.rate_set.body[2] = TX_RATE_5M | BASIC_RATE; 1808 - priv->reg.rate_set.body[1] = TX_RATE_2M | BASIC_RATE; 1809 - priv->reg.rate_set.body[0] = TX_RATE_1M | BASIC_RATE; 1810 - priv->reg.rate_set.size = 12; 1811 - } 1812 - } 1813 - 1814 - /* rate mask by phy setting */ 1815 - if (priv->reg.phy_type == D_11B_ONLY_MODE) { 1816 - for (i = 0; i < priv->reg.rate_set.size; i++) { 1817 - if (!is_11b_rate(priv->reg.rate_set.body[i])) 1818 - break; 1819 - 1820 - if ((priv->reg.rate_set.body[i] & RATE_MASK) >= TX_RATE_5M) { 1821 - rate_octet[i] = priv->reg.rate_set.body[i] & 1822 - RATE_MASK; 1823 - } else { 1824 - rate_octet[i] = priv->reg.rate_set.body[i]; 1825 - } 1826 - } 1827 - 1828 - } else { /* D_11G_ONLY_MODE or D_11BG_COMPATIBLE_MODE */ 1829 - for (i = 0; i < priv->reg.rate_set.size; i++) { 1830 - if (!is_11bg_rate(priv->reg.rate_set.body[i])) 1831 - break; 1832 - 1833 - if (is_ofdm_ext_rate(priv->reg.rate_set.body[i])) { 1834 - rate_octet[i] = priv->reg.rate_set.body[i] & 1835 - RATE_MASK; 1836 - } else { 1837 - rate_octet[i] = priv->reg.rate_set.body[i]; 1838 - } 1839 - } 1840 - } 1841 - rate_size = i; 1842 - if (rate_size == 0) { 1843 - if (priv->reg.phy_type == D_11G_ONLY_MODE) 1844 - rate_octet[0] = TX_RATE_6M | BASIC_RATE; 1845 - else 1846 - rate_octet[0] = TX_RATE_2M | BASIC_RATE; 1847 - rate_size = 1; 1848 - } 1849 - 1850 - /* rate set update */ 1851 - priv->reg.rate_set.size = rate_size; 1852 - memcpy(&priv->reg.rate_set.body[0], &rate_octet[0], rate_size); 1853 - 1854 - switch (priv->reg.operation_mode) { 1855 - case MODE_PSEUDO_ADHOC: 1856 - hostif_ps_adhoc_set_request(priv); 1857 - break; 1858 - case MODE_INFRASTRUCTURE: 1859 - if (!is_valid_ether_addr((u8 *)priv->reg.bssid)) { 1860 - hostif_infrastructure_set_request(priv, 1861 - HIF_INFRA_SET_REQ); 1862 - } else { 1863 - hostif_infrastructure_set_request(priv, 1864 - HIF_INFRA_SET2_REQ); 1865 - netdev_dbg(priv->net_dev, 1866 - "Infra bssid = %pM\n", priv->reg.bssid); 1867 - } 1868 - break; 1869 - case MODE_ADHOC: 1870 - if (!is_valid_ether_addr((u8 *)priv->reg.bssid)) { 1871 - hostif_adhoc_set_request(priv); 1872 - } else { 1873 - hostif_adhoc_set2_request(priv); 1874 - netdev_dbg(priv->net_dev, 1875 - "Adhoc bssid = %pM\n", priv->reg.bssid); 1876 - } 1877 - break; 1878 - default: 1879 - break; 1880 - } 1881 - } 1882 - 1883 - static 1884 - void hostif_sme_multicast_set(struct ks_wlan_private *priv) 1885 - { 1886 - struct net_device *dev = priv->net_dev; 1887 - int mc_count; 1888 - struct netdev_hw_addr *ha; 1889 - char set_address[NIC_MAX_MCAST_LIST * ETH_ALEN]; 1890 - int i = 0; 1891 - 1892 - spin_lock(&priv->multicast_spin); 1893 - 1894 - memset(set_address, 0, NIC_MAX_MCAST_LIST * ETH_ALEN); 1895 - 1896 - if (dev->flags & IFF_PROMISC) { 1897 - hostif_mib_set_request_int(priv, LOCAL_MULTICAST_FILTER, 1898 - MCAST_FILTER_PROMISC); 1899 - goto spin_unlock; 1900 - } 1901 - 1902 - if ((netdev_mc_count(dev) > NIC_MAX_MCAST_LIST) || 1903 - (dev->flags & IFF_ALLMULTI)) { 1904 - hostif_mib_set_request_int(priv, LOCAL_MULTICAST_FILTER, 1905 - MCAST_FILTER_MCASTALL); 1906 - goto spin_unlock; 1907 - } 1908 - 1909 - if (priv->sme_i.sme_flag & SME_MULTICAST) { 1910 - mc_count = netdev_mc_count(dev); 1911 - netdev_for_each_mc_addr(ha, dev) { 1912 - ether_addr_copy(&set_address[i * ETH_ALEN], ha->addr); 1913 - i++; 1914 - } 1915 - priv->sme_i.sme_flag &= ~SME_MULTICAST; 1916 - hostif_mib_set_request_ostring(priv, LOCAL_MULTICAST_ADDRESS, 1917 - &set_address[0], 1918 - ETH_ALEN * mc_count); 1919 - } else { 1920 - priv->sme_i.sme_flag |= SME_MULTICAST; 1921 - hostif_mib_set_request_int(priv, LOCAL_MULTICAST_FILTER, 1922 - MCAST_FILTER_MCAST); 1923 - } 1924 - 1925 - spin_unlock: 1926 - spin_unlock(&priv->multicast_spin); 1927 - } 1928 - 1929 - static void hostif_sme_power_mgmt_set(struct ks_wlan_private *priv) 1930 - { 1931 - u32 mode, wake_up, receive_dtims; 1932 - 1933 - if (priv->reg.power_mgmt != POWER_MGMT_SAVE1 && 1934 - priv->reg.power_mgmt != POWER_MGMT_SAVE2) { 1935 - mode = POWER_ACTIVE; 1936 - wake_up = 0; 1937 - receive_dtims = 0; 1938 - } else { 1939 - mode = (priv->reg.operation_mode == MODE_INFRASTRUCTURE) ? 1940 - POWER_SAVE : POWER_ACTIVE; 1941 - wake_up = 0; 1942 - receive_dtims = (priv->reg.operation_mode == MODE_INFRASTRUCTURE && 1943 - priv->reg.power_mgmt == POWER_MGMT_SAVE2); 1944 - } 1945 - 1946 - hostif_power_mgmt_request(priv, mode, wake_up, receive_dtims); 1947 - } 1948 - 1949 - static void hostif_sme_sleep_set(struct ks_wlan_private *priv) 1950 - { 1951 - if (priv->sleep_mode != SLP_SLEEP && 1952 - priv->sleep_mode != SLP_ACTIVE) 1953 - return; 1954 - 1955 - hostif_sleep_request(priv, priv->sleep_mode); 1956 - } 1957 - 1958 - static 1959 - void hostif_sme_set_key(struct ks_wlan_private *priv, int type) 1960 - { 1961 - switch (type) { 1962 - case SME_SET_FLAG: 1963 - hostif_mib_set_request_bool(priv, DOT11_PRIVACY_INVOKED, 1964 - priv->reg.privacy_invoked); 1965 - break; 1966 - case SME_SET_TXKEY: 1967 - hostif_mib_set_request_int(priv, DOT11_WEP_DEFAULT_KEY_ID, 1968 - priv->wpa.txkey); 1969 - break; 1970 - case SME_SET_KEY1: 1971 - hostif_mib_set_request_ostring(priv, 1972 - DOT11_WEP_DEFAULT_KEY_VALUE1, 1973 - &priv->wpa.key[0].key_val[0], 1974 - priv->wpa.key[0].key_len); 1975 - break; 1976 - case SME_SET_KEY2: 1977 - hostif_mib_set_request_ostring(priv, 1978 - DOT11_WEP_DEFAULT_KEY_VALUE2, 1979 - &priv->wpa.key[1].key_val[0], 1980 - priv->wpa.key[1].key_len); 1981 - break; 1982 - case SME_SET_KEY3: 1983 - hostif_mib_set_request_ostring(priv, 1984 - DOT11_WEP_DEFAULT_KEY_VALUE3, 1985 - &priv->wpa.key[2].key_val[0], 1986 - priv->wpa.key[2].key_len); 1987 - break; 1988 - case SME_SET_KEY4: 1989 - hostif_mib_set_request_ostring(priv, 1990 - DOT11_WEP_DEFAULT_KEY_VALUE4, 1991 - &priv->wpa.key[3].key_val[0], 1992 - priv->wpa.key[3].key_len); 1993 - break; 1994 - case SME_SET_PMK_TSC: 1995 - hostif_mib_set_request_ostring(priv, DOT11_PMK_TSC, 1996 - &priv->wpa.key[0].rx_seq[0], 1997 - WPA_RX_SEQ_LEN); 1998 - break; 1999 - case SME_SET_GMK1_TSC: 2000 - hostif_mib_set_request_ostring(priv, DOT11_GMK1_TSC, 2001 - &priv->wpa.key[1].rx_seq[0], 2002 - WPA_RX_SEQ_LEN); 2003 - break; 2004 - case SME_SET_GMK2_TSC: 2005 - hostif_mib_set_request_ostring(priv, DOT11_GMK2_TSC, 2006 - &priv->wpa.key[2].rx_seq[0], 2007 - WPA_RX_SEQ_LEN); 2008 - break; 2009 - } 2010 - } 2011 - 2012 - static 2013 - void hostif_sme_set_pmksa(struct ks_wlan_private *priv) 2014 - { 2015 - struct pmk_cache { 2016 - __le16 size; 2017 - struct { 2018 - u8 bssid[ETH_ALEN]; 2019 - u8 pmkid[IW_PMKID_LEN]; 2020 - } __packed list[PMK_LIST_MAX]; 2021 - } __packed pmkcache; 2022 - struct pmk *pmk; 2023 - size_t size; 2024 - int i = 0; 2025 - 2026 - list_for_each_entry(pmk, &priv->pmklist.head, list) { 2027 - if (i >= PMK_LIST_MAX) 2028 - break; 2029 - ether_addr_copy(pmkcache.list[i].bssid, pmk->bssid); 2030 - memcpy(pmkcache.list[i].pmkid, pmk->pmkid, IW_PMKID_LEN); 2031 - i++; 2032 - } 2033 - pmkcache.size = cpu_to_le16(priv->pmklist.size); 2034 - size = sizeof(priv->pmklist.size) + 2035 - ((ETH_ALEN + IW_PMKID_LEN) * priv->pmklist.size); 2036 - hostif_mib_set_request_ostring(priv, LOCAL_PMK, &pmkcache, size); 2037 - } 2038 - 2039 - /* execute sme */ 2040 - static void hostif_sme_execute(struct ks_wlan_private *priv, int event) 2041 - { 2042 - u16 failure; 2043 - 2044 - switch (event) { 2045 - case SME_START: 2046 - if (priv->dev_state == DEVICE_STATE_BOOT) 2047 - hostif_mib_get_request(priv, DOT11_MAC_ADDRESS); 2048 - break; 2049 - case SME_MULTICAST_REQUEST: 2050 - hostif_sme_multicast_set(priv); 2051 - break; 2052 - case SME_MACADDRESS_SET_REQUEST: 2053 - hostif_mib_set_request_ostring(priv, LOCAL_CURRENTADDRESS, 2054 - &priv->eth_addr[0], ETH_ALEN); 2055 - break; 2056 - case SME_BSS_SCAN_REQUEST: 2057 - hostif_bss_scan_request(priv, priv->reg.scan_type, 2058 - priv->scan_ssid, priv->scan_ssid_len); 2059 - break; 2060 - case SME_POW_MNGMT_REQUEST: 2061 - hostif_sme_power_mgmt_set(priv); 2062 - break; 2063 - case SME_PHY_INFO_REQUEST: 2064 - hostif_phy_information_request(priv); 2065 - break; 2066 - case SME_MIC_FAILURE_REQUEST: 2067 - failure = priv->wpa.mic_failure.failure; 2068 - if (failure != 1 && failure != 2) { 2069 - netdev_err(priv->net_dev, 2070 - "SME_MIC_FAILURE_REQUEST: failure count=%u error?\n", 2071 - failure); 2072 - return; 2073 - } 2074 - hostif_mic_failure_request(priv, failure - 1, (failure == 1) ? 2075 - 0 : priv->wpa.mic_failure.counter); 2076 - break; 2077 - case SME_MIC_FAILURE_CONFIRM: 2078 - if (priv->wpa.mic_failure.failure == 2) { 2079 - if (priv->wpa.mic_failure.stop) 2080 - priv->wpa.mic_failure.stop = 0; 2081 - priv->wpa.mic_failure.failure = 0; 2082 - hostif_start_request(priv, priv->reg.operation_mode); 2083 - } 2084 - break; 2085 - case SME_GET_MAC_ADDRESS: 2086 - if (priv->dev_state == DEVICE_STATE_BOOT) 2087 - hostif_mib_get_request(priv, DOT11_PRODUCT_VERSION); 2088 - break; 2089 - case SME_GET_PRODUCT_VERSION: 2090 - if (priv->dev_state == DEVICE_STATE_BOOT) 2091 - priv->dev_state = DEVICE_STATE_PREINIT; 2092 - break; 2093 - case SME_STOP_REQUEST: 2094 - hostif_stop_request(priv); 2095 - break; 2096 - case SME_RTS_THRESHOLD_REQUEST: 2097 - hostif_mib_set_request_int(priv, DOT11_RTS_THRESHOLD, 2098 - priv->reg.rts); 2099 - break; 2100 - case SME_FRAGMENTATION_THRESHOLD_REQUEST: 2101 - hostif_mib_set_request_int(priv, DOT11_FRAGMENTATION_THRESHOLD, 2102 - priv->reg.fragment); 2103 - break; 2104 - case SME_WEP_INDEX_REQUEST: 2105 - case SME_WEP_KEY1_REQUEST: 2106 - case SME_WEP_KEY2_REQUEST: 2107 - case SME_WEP_KEY3_REQUEST: 2108 - case SME_WEP_KEY4_REQUEST: 2109 - case SME_WEP_FLAG_REQUEST: 2110 - hostif_sme_set_wep(priv, event); 2111 - break; 2112 - case SME_RSN_UCAST_REQUEST: 2113 - case SME_RSN_MCAST_REQUEST: 2114 - case SME_RSN_AUTH_REQUEST: 2115 - case SME_RSN_ENABLED_REQUEST: 2116 - case SME_RSN_MODE_REQUEST: 2117 - hostif_sme_set_rsn(priv, event); 2118 - break; 2119 - case SME_SET_FLAG: 2120 - case SME_SET_TXKEY: 2121 - case SME_SET_KEY1: 2122 - case SME_SET_KEY2: 2123 - case SME_SET_KEY3: 2124 - case SME_SET_KEY4: 2125 - case SME_SET_PMK_TSC: 2126 - case SME_SET_GMK1_TSC: 2127 - case SME_SET_GMK2_TSC: 2128 - hostif_sme_set_key(priv, event); 2129 - break; 2130 - case SME_SET_PMKSA: 2131 - hostif_sme_set_pmksa(priv); 2132 - break; 2133 - case SME_WPS_ENABLE_REQUEST: 2134 - hostif_mib_set_request_int(priv, LOCAL_WPS_ENABLE, 2135 - priv->wps.wps_enabled); 2136 - break; 2137 - case SME_WPS_PROBE_REQUEST: 2138 - hostif_mib_set_request_ostring(priv, LOCAL_WPS_PROBE_REQ, 2139 - priv->wps.ie, priv->wps.ielen); 2140 - break; 2141 - case SME_MODE_SET_REQUEST: 2142 - hostif_sme_mode_setup(priv); 2143 - break; 2144 - case SME_SET_GAIN: 2145 - hostif_mib_set_request_ostring(priv, LOCAL_GAIN, 2146 - &priv->gain, sizeof(priv->gain)); 2147 - break; 2148 - case SME_GET_GAIN: 2149 - hostif_mib_get_request(priv, LOCAL_GAIN); 2150 - break; 2151 - case SME_GET_EEPROM_CKSUM: 2152 - priv->eeprom_checksum = EEPROM_FW_NOT_SUPPORT; /* initialize */ 2153 - hostif_mib_get_request(priv, LOCAL_EEPROM_SUM); 2154 - break; 2155 - case SME_START_REQUEST: 2156 - hostif_start_request(priv, priv->reg.operation_mode); 2157 - break; 2158 - case SME_START_CONFIRM: 2159 - /* for power save */ 2160 - atomic_set(&priv->psstatus.snooze_guard, 0); 2161 - atomic_set(&priv->psstatus.confirm_wait, 0); 2162 - if (priv->dev_state == DEVICE_STATE_PREINIT) 2163 - priv->dev_state = DEVICE_STATE_INIT; 2164 - /* wake_up_interruptible_all(&priv->confirm_wait); */ 2165 - complete(&priv->confirm_wait); 2166 - break; 2167 - case SME_SLEEP_REQUEST: 2168 - hostif_sme_sleep_set(priv); 2169 - break; 2170 - case SME_SET_REGION: 2171 - hostif_mib_set_request_int(priv, LOCAL_REGION, priv->region); 2172 - break; 2173 - case SME_MULTICAST_CONFIRM: 2174 - case SME_BSS_SCAN_CONFIRM: 2175 - case SME_POW_MNGMT_CONFIRM: 2176 - case SME_PHY_INFO_CONFIRM: 2177 - case SME_STOP_CONFIRM: 2178 - case SME_RTS_THRESHOLD_CONFIRM: 2179 - case SME_FRAGMENTATION_THRESHOLD_CONFIRM: 2180 - case SME_WEP_INDEX_CONFIRM: 2181 - case SME_WEP_KEY1_CONFIRM: 2182 - case SME_WEP_KEY2_CONFIRM: 2183 - case SME_WEP_KEY3_CONFIRM: 2184 - case SME_WEP_KEY4_CONFIRM: 2185 - case SME_WEP_FLAG_CONFIRM: 2186 - case SME_RSN_UCAST_CONFIRM: 2187 - case SME_RSN_MCAST_CONFIRM: 2188 - case SME_RSN_AUTH_CONFIRM: 2189 - case SME_RSN_ENABLED_CONFIRM: 2190 - case SME_RSN_MODE_CONFIRM: 2191 - case SME_MODE_SET_CONFIRM: 2192 - case SME_TERMINATE: 2193 - default: 2194 - break; 2195 - } 2196 - } 2197 - 2198 - static void hostif_sme_work(struct work_struct *work) 2199 - { 2200 - struct ks_wlan_private *priv; 2201 - 2202 - priv = container_of(work, struct ks_wlan_private, sme_work); 2203 - 2204 - if (priv->dev_state < DEVICE_STATE_BOOT) 2205 - return; 2206 - 2207 - if (cnt_smeqbody(priv) <= 0) 2208 - return; 2209 - 2210 - hostif_sme_execute(priv, priv->sme_i.event_buff[priv->sme_i.qhead]); 2211 - inc_smeqhead(priv); 2212 - if (cnt_smeqbody(priv) > 0) 2213 - schedule_work(&priv->sme_work); 2214 - } 2215 - 2216 - /* send to Station Management Entity module */ 2217 - void hostif_sme_enqueue(struct ks_wlan_private *priv, u16 event) 2218 - { 2219 - /* enqueue sme event */ 2220 - if (cnt_smeqbody(priv) < (SME_EVENT_BUFF_SIZE - 1)) { 2221 - priv->sme_i.event_buff[priv->sme_i.qtail] = event; 2222 - inc_smeqtail(priv); 2223 - } else { 2224 - /* in case of buffer overflow */ 2225 - netdev_err(priv->net_dev, "sme queue buffer overflow\n"); 2226 - } 2227 - 2228 - schedule_work(&priv->sme_work); 2229 - } 2230 - 2231 - static inline void hostif_aplist_init(struct ks_wlan_private *priv) 2232 - { 2233 - size_t size = LOCAL_APLIST_MAX * sizeof(struct local_ap); 2234 - 2235 - priv->aplist.size = 0; 2236 - memset(&priv->aplist.ap[0], 0, size); 2237 - } 2238 - 2239 - static inline void hostif_status_init(struct ks_wlan_private *priv) 2240 - { 2241 - priv->infra_status = 0; 2242 - priv->current_rate = 4; 2243 - priv->connect_status = DISCONNECT_STATUS; 2244 - } 2245 - 2246 - static inline void hostif_sme_init(struct ks_wlan_private *priv) 2247 - { 2248 - priv->sme_i.sme_status = SME_IDLE; 2249 - priv->sme_i.qhead = 0; 2250 - priv->sme_i.qtail = 0; 2251 - spin_lock_init(&priv->sme_i.sme_spin); 2252 - priv->sme_i.sme_flag = 0; 2253 - INIT_WORK(&priv->sme_work, hostif_sme_work); 2254 - } 2255 - 2256 - static inline void hostif_wpa_init(struct ks_wlan_private *priv) 2257 - { 2258 - memset(&priv->wpa, 0, sizeof(priv->wpa)); 2259 - priv->wpa.rsn_enabled = false; 2260 - priv->wpa.mic_failure.failure = 0; 2261 - priv->wpa.mic_failure.last_failure_time = 0; 2262 - priv->wpa.mic_failure.stop = 0; 2263 - } 2264 - 2265 - static inline void hostif_power_save_init(struct ks_wlan_private *priv) 2266 - { 2267 - atomic_set(&priv->psstatus.status, PS_NONE); 2268 - atomic_set(&priv->psstatus.confirm_wait, 0); 2269 - atomic_set(&priv->psstatus.snooze_guard, 0); 2270 - init_completion(&priv->psstatus.wakeup_wait); 2271 - INIT_WORK(&priv->wakeup_work, ks_wlan_hw_wakeup_task); 2272 - } 2273 - 2274 - static inline void hostif_pmklist_init(struct ks_wlan_private *priv) 2275 - { 2276 - int i; 2277 - 2278 - memset(&priv->pmklist, 0, sizeof(priv->pmklist)); 2279 - INIT_LIST_HEAD(&priv->pmklist.head); 2280 - for (i = 0; i < PMK_LIST_MAX; i++) 2281 - INIT_LIST_HEAD(&priv->pmklist.pmk[i].list); 2282 - } 2283 - 2284 - static inline void hostif_counters_init(struct ks_wlan_private *priv) 2285 - { 2286 - priv->dev_count = 0; 2287 - atomic_set(&priv->event_count, 0); 2288 - atomic_set(&priv->rec_count, 0); 2289 - } 2290 - 2291 - int hostif_init(struct ks_wlan_private *priv) 2292 - { 2293 - hostif_aplist_init(priv); 2294 - hostif_status_init(priv); 2295 - 2296 - spin_lock_init(&priv->multicast_spin); 2297 - spin_lock_init(&priv->dev_read_lock); 2298 - init_waitqueue_head(&priv->devread_wait); 2299 - 2300 - hostif_counters_init(priv); 2301 - hostif_power_save_init(priv); 2302 - hostif_wpa_init(priv); 2303 - hostif_pmklist_init(priv); 2304 - hostif_sme_init(priv); 2305 - 2306 - return 0; 2307 - } 2308 - 2309 - void hostif_exit(struct ks_wlan_private *priv) 2310 - { 2311 - cancel_work_sync(&priv->sme_work); 2312 - }
-617
drivers/staging/ks7010/ks_hostif.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Driver for KeyStream wireless LAN 4 - * 5 - * Copyright (c) 2005-2008 KeyStream Corp. 6 - * Copyright (C) 2009 Renesas Technology Corp. 7 - */ 8 - 9 - #ifndef _KS_HOSTIF_H_ 10 - #define _KS_HOSTIF_H_ 11 - 12 - #include <linux/compiler.h> 13 - #include <linux/ieee80211.h> 14 - 15 - /* 16 - * HOST-MAC I/F events 17 - */ 18 - #define HIF_DATA_REQ 0xE001 19 - #define HIF_DATA_IND 0xE801 20 - #define HIF_MIB_GET_REQ 0xE002 21 - #define HIF_MIB_GET_CONF 0xE802 22 - #define HIF_MIB_SET_REQ 0xE003 23 - #define HIF_MIB_SET_CONF 0xE803 24 - #define HIF_POWER_MGMT_REQ 0xE004 25 - #define HIF_POWER_MGMT_CONF 0xE804 26 - #define HIF_START_REQ 0xE005 27 - #define HIF_START_CONF 0xE805 28 - #define HIF_CONNECT_IND 0xE806 29 - #define HIF_STOP_REQ 0xE006 30 - #define HIF_STOP_CONF 0xE807 31 - #define HIF_PS_ADH_SET_REQ 0xE007 32 - #define HIF_PS_ADH_SET_CONF 0xE808 33 - #define HIF_INFRA_SET_REQ 0xE008 34 - #define HIF_INFRA_SET_CONF 0xE809 35 - #define HIF_ADH_SET_REQ 0xE009 36 - #define HIF_ADH_SET_CONF 0xE80A 37 - #define HIF_AP_SET_REQ 0xE00A 38 - #define HIF_AP_SET_CONF 0xE80B 39 - #define HIF_ASSOC_INFO_IND 0xE80C 40 - #define HIF_MIC_FAILURE_REQ 0xE00B 41 - #define HIF_MIC_FAILURE_CONF 0xE80D 42 - #define HIF_SCAN_REQ 0xE00C 43 - #define HIF_SCAN_CONF 0xE80E 44 - #define HIF_PHY_INFO_REQ 0xE00D 45 - #define HIF_PHY_INFO_CONF 0xE80F 46 - #define HIF_SLEEP_REQ 0xE00E 47 - #define HIF_SLEEP_CONF 0xE810 48 - #define HIF_PHY_INFO_IND 0xE811 49 - #define HIF_SCAN_IND 0xE812 50 - #define HIF_INFRA_SET2_REQ 0xE00F 51 - #define HIF_INFRA_SET2_CONF 0xE813 52 - #define HIF_ADH_SET2_REQ 0xE010 53 - #define HIF_ADH_SET2_CONF 0xE814 54 - 55 - #define HIF_REQ_MAX 0xE010 56 - 57 - /* 58 - * HOST-MAC I/F data structure 59 - * Byte alignment Little Endian 60 - */ 61 - 62 - struct hostif_hdr { 63 - __le16 size; 64 - __le16 event; 65 - } __packed; 66 - 67 - struct hostif_data_request { 68 - struct hostif_hdr header; 69 - __le16 auth_type; 70 - #define TYPE_DATA 0x0000 71 - #define TYPE_AUTH 0x0001 72 - __le16 reserved; 73 - u8 data[]; 74 - } __packed; 75 - 76 - #define TYPE_PMK1 0x0001 77 - #define TYPE_GMK1 0x0002 78 - #define TYPE_GMK2 0x0003 79 - 80 - #define CHANNEL_LIST_MAX_SIZE 14 81 - struct channel_list { 82 - u8 size; 83 - u8 body[CHANNEL_LIST_MAX_SIZE]; 84 - u8 pad; 85 - } __packed; 86 - 87 - /** 88 - * enum mib_attribute - Management Information Base attribute 89 - * Attribute value used for accessing and updating MIB 90 - * 91 - * @DOT11_MAC_ADDRESS: MAC Address (R) 92 - * @DOT11_PRODUCT_VERSION: FirmWare Version (R) 93 - * @DOT11_RTS_THRESHOLD: RTS Threshold (R/W) 94 - * @DOT11_FRAGMENTATION_THRESHOLD: Fragment Threshold (R/W) 95 - * @DOT11_PRIVACY_INVOKED: WEP ON/OFF (W) 96 - * @DOT11_WEP_DEFAULT_KEY_ID: WEP Index (W) 97 - * @DOT11_WEP_DEFAULT_KEY_VALUE1: WEP Key#1(TKIP AES: PairwiseTemporalKey) (W) 98 - * @DOT11_WEP_DEFAULT_KEY_VALUE2: WEP Key#2(TKIP AES: GroupKey1) (W) 99 - * @DOT11_WEP_DEFAULT_KEY_VALUE3: WEP Key#3(TKIP AES: GroupKey2) (W) 100 - * @DOT11_WEP_DEFAULT_KEY_VALUE4: WEP Key#4 (W) 101 - * @DOT11_WEP_LIST: WEP LIST 102 - * @DOT11_DESIRED_SSID: SSID 103 - * @DOT11_CURRENT_CHANNEL: channel set 104 - * @DOT11_OPERATION_RATE_SET: rate set 105 - * @LOCAL_AP_SEARCH_INTERVAL: AP search interval (R/W) 106 - * @LOCAL_CURRENTADDRESS: MAC Address change (W) 107 - * @LOCAL_MULTICAST_ADDRESS: Multicast Address (W) 108 - * @LOCAL_MULTICAST_FILTER: Multicast Address Filter enable/disable (W) 109 - * @LOCAL_SEARCHED_AP_LIST: AP list (R) 110 - * @LOCAL_LINK_AP_STATUS: Link AP status (R) 111 - * @LOCAL_PACKET_STATISTICS: tx,rx packets statistics 112 - * @LOCAL_AP_SCAN_LIST_TYPE_SET: AP_SCAN_LIST_TYPE 113 - * @DOT11_RSN_ENABLED: WPA enable/disable (W) 114 - * @LOCAL_RSN_MODE: RSN mode WPA/WPA2 (W) 115 - * @DOT11_RSN_CONFIG_MULTICAST_CIPHER: GroupKeyCipherSuite (W) 116 - * @DOT11_RSN_CONFIG_UNICAST_CIPHER: PairwiseKeyCipherSuite (W) 117 - * @DOT11_RSN_CONFIG_AUTH_SUITE: AuthenticationKeyManagementSuite (W) 118 - * @DOT11_RSN_CONFIG_VERSION: RSN version (W) 119 - * @LOCAL_RSN_CONFIG_ALL: RSN CONFIG ALL (W) 120 - * @DOT11_PMK_TSC: PMK_TSC (W) 121 - * @DOT11_GMK1_TSC: GMK1_TSC (W) 122 - * @DOT11_GMK2_TSC: GMK2_TSC (W) 123 - * @DOT11_GMK3_TSC: GMK3_TSC 124 - * @LOCAL_PMK: Pairwise Master Key cache (W) 125 - * @LOCAL_REGION: Region setting 126 - * @LOCAL_WPS_ENABLE: WiFi Protected Setup 127 - * @LOCAL_WPS_PROBE_REQ: WPS Probe Request 128 - * @LOCAL_GAIN: Carrer sense threshold for demo ato show 129 - * @LOCAL_EEPROM_SUM: EEPROM checksum information 130 - */ 131 - enum mib_attribute { 132 - DOT11_MAC_ADDRESS = 0x21010100, 133 - DOT11_PRODUCT_VERSION = 0x31024100, 134 - DOT11_RTS_THRESHOLD = 0x21020100, 135 - DOT11_FRAGMENTATION_THRESHOLD = 0x21050100, 136 - DOT11_PRIVACY_INVOKED = 0x15010100, 137 - DOT11_WEP_DEFAULT_KEY_ID = 0x15020100, 138 - DOT11_WEP_DEFAULT_KEY_VALUE1 = 0x13020101, 139 - DOT11_WEP_DEFAULT_KEY_VALUE2 = 0x13020102, 140 - DOT11_WEP_DEFAULT_KEY_VALUE3 = 0x13020103, 141 - DOT11_WEP_DEFAULT_KEY_VALUE4 = 0x13020104, 142 - DOT11_WEP_LIST = 0x13020100, 143 - DOT11_DESIRED_SSID = 0x11090100, 144 - DOT11_CURRENT_CHANNEL = 0x45010100, 145 - DOT11_OPERATION_RATE_SET = 0x11110100, 146 - LOCAL_AP_SEARCH_INTERVAL = 0xF1010100, 147 - LOCAL_CURRENTADDRESS = 0xF1050100, 148 - LOCAL_MULTICAST_ADDRESS = 0xF1060100, 149 - LOCAL_MULTICAST_FILTER = 0xF1060200, 150 - LOCAL_SEARCHED_AP_LIST = 0xF1030100, 151 - LOCAL_LINK_AP_STATUS = 0xF1040100, 152 - LOCAL_PACKET_STATISTICS = 0xF1020100, 153 - LOCAL_AP_SCAN_LIST_TYPE_SET = 0xF1030200, 154 - DOT11_RSN_ENABLED = 0x15070100, 155 - LOCAL_RSN_MODE = 0x56010100, 156 - DOT11_RSN_CONFIG_MULTICAST_CIPHER = 0x51040100, 157 - DOT11_RSN_CONFIG_UNICAST_CIPHER = 0x52020100, 158 - DOT11_RSN_CONFIG_AUTH_SUITE = 0x53020100, 159 - DOT11_RSN_CONFIG_VERSION = 0x51020100, 160 - LOCAL_RSN_CONFIG_ALL = 0x5F010100, 161 - DOT11_PMK_TSC = 0x55010100, 162 - DOT11_GMK1_TSC = 0x55010101, 163 - DOT11_GMK2_TSC = 0x55010102, 164 - DOT11_GMK3_TSC = 0x55010103, 165 - LOCAL_PMK = 0x58010100, 166 - LOCAL_REGION = 0xF10A0100, 167 - LOCAL_WPS_ENABLE = 0xF10B0100, 168 - LOCAL_WPS_PROBE_REQ = 0xF10C0100, 169 - LOCAL_GAIN = 0xF10D0100, 170 - LOCAL_EEPROM_SUM = 0xF10E0100 171 - }; 172 - 173 - struct hostif_mib_get_request { 174 - struct hostif_hdr header; 175 - __le32 mib_attribute; 176 - } __packed; 177 - 178 - /** 179 - * enum mib_data_type - Message Information Base data type. 180 - * @MIB_VALUE_TYPE_NULL: NULL type 181 - * @MIB_VALUE_TYPE_INT: INTEGER type 182 - * @MIB_VALUE_TYPE_BOOL: BOOL type 183 - * @MIB_VALUE_TYPE_COUNT32: unused 184 - * @MIB_VALUE_TYPE_OSTRING: Chunk of memory 185 - */ 186 - enum mib_data_type { 187 - MIB_VALUE_TYPE_NULL = 0, 188 - MIB_VALUE_TYPE_INT, 189 - MIB_VALUE_TYPE_BOOL, 190 - MIB_VALUE_TYPE_COUNT32, 191 - MIB_VALUE_TYPE_OSTRING 192 - }; 193 - 194 - struct hostif_mib_value { 195 - __le16 size; 196 - __le16 type; 197 - u8 body[]; 198 - } __packed; 199 - 200 - struct hostif_mib_get_confirm_t { 201 - struct hostif_hdr header; 202 - __le32 mib_status; 203 - #define MIB_SUCCESS 0 204 - #define MIB_INVALID 1 205 - #define MIB_READ_ONLY 2 206 - #define MIB_WRITE_ONLY 3 207 - __le32 mib_attribute; 208 - struct hostif_mib_value mib_value; 209 - } __packed; 210 - 211 - struct hostif_mib_set_request_t { 212 - struct hostif_hdr header; 213 - __le32 mib_attribute; 214 - struct hostif_mib_value mib_value; 215 - } __packed; 216 - 217 - struct hostif_power_mgmt_request { 218 - struct hostif_hdr header; 219 - __le32 mode; 220 - #define POWER_ACTIVE 1 221 - #define POWER_SAVE 2 222 - __le32 wake_up; 223 - #define SLEEP_FALSE 0 224 - #define SLEEP_TRUE 1 /* not used */ 225 - __le32 receive_dtims; 226 - #define DTIM_FALSE 0 227 - #define DTIM_TRUE 1 228 - } __packed; 229 - 230 - enum power_mgmt_mode_type { 231 - POWER_MGMT_ACTIVE, 232 - POWER_MGMT_SAVE1, 233 - POWER_MGMT_SAVE2 234 - }; 235 - 236 - #define RESULT_SUCCESS 0 237 - #define RESULT_INVALID_PARAMETERS 1 238 - #define RESULT_NOT_SUPPORTED 2 239 - /* #define RESULT_ALREADY_RUNNING 3 */ 240 - #define RESULT_ALREADY_RUNNING 7 241 - 242 - struct hostif_start_request { 243 - struct hostif_hdr header; 244 - __le16 mode; 245 - #define MODE_PSEUDO_ADHOC 0 246 - #define MODE_INFRASTRUCTURE 1 247 - #define MODE_AP 2 /* not used */ 248 - #define MODE_ADHOC 3 249 - } __packed; 250 - 251 - struct ssid { 252 - u8 size; 253 - u8 body[IEEE80211_MAX_SSID_LEN]; 254 - u8 ssid_pad; 255 - } __packed; 256 - 257 - #define RATE_SET_MAX_SIZE 16 258 - struct rate_set8 { 259 - u8 size; 260 - u8 body[8]; 261 - u8 rate_pad; 262 - } __packed; 263 - 264 - struct fh_parms { 265 - __le16 dwell_time; 266 - u8 hop_set; 267 - u8 hop_pattern; 268 - u8 hop_index; 269 - } __packed; 270 - 271 - struct ds_parms { 272 - u8 channel; 273 - } __packed; 274 - 275 - struct cf_parms { 276 - u8 count; 277 - u8 period; 278 - __le16 max_duration; 279 - __le16 dur_remaining; 280 - } __packed; 281 - 282 - struct ibss_parms { 283 - __le16 atim_window; 284 - } __packed; 285 - 286 - struct rsn_t { 287 - u8 size; 288 - #define RSN_BODY_SIZE 64 289 - u8 body[RSN_BODY_SIZE]; 290 - } __packed; 291 - 292 - struct erp_params_t { 293 - u8 erp_info; 294 - } __packed; 295 - 296 - struct rate_set16 { 297 - u8 size; 298 - u8 body[16]; 299 - u8 rate_pad; 300 - } __packed; 301 - 302 - struct ap_info { 303 - u8 bssid[6]; /* +00 */ 304 - u8 rssi; /* +06 */ 305 - u8 sq; /* +07 */ 306 - u8 noise; /* +08 */ 307 - u8 pad0; /* +09 */ 308 - __le16 beacon_period; /* +10 */ 309 - __le16 capability; /* +12 */ 310 - u8 frame_type; /* +14 */ 311 - u8 ch_info; /* +15 */ 312 - __le16 body_size; /* +16 */ 313 - u8 body[1024]; /* +18 */ 314 - /* +1032 */ 315 - } __packed; 316 - 317 - struct link_ap_info { 318 - u8 bssid[6]; /* +00 */ 319 - u8 rssi; /* +06 */ 320 - u8 sq; /* +07 */ 321 - u8 noise; /* +08 */ 322 - u8 pad0; /* +09 */ 323 - __le16 beacon_period; /* +10 */ 324 - __le16 capability; /* +12 */ 325 - struct rate_set8 rate_set; /* +14 */ 326 - struct fh_parms fh_parameter; /* +24 */ 327 - struct ds_parms ds_parameter; /* +29 */ 328 - struct cf_parms cf_parameter; /* +30 */ 329 - struct ibss_parms ibss_parameter; /* +36 */ 330 - struct erp_params_t erp_parameter; /* +38 */ 331 - u8 pad1; /* +39 */ 332 - struct rate_set8 ext_rate_set; /* +40 */ 333 - u8 DTIM_period; /* +50 */ 334 - u8 rsn_mode; /* +51 */ 335 - #define RSN_MODE_NONE 0 336 - #define RSN_MODE_WPA 1 337 - #define RSN_MODE_WPA2 2 338 - struct { 339 - u8 size; /* +52 */ 340 - u8 body[128]; /* +53 */ 341 - } __packed rsn; 342 - } __packed; 343 - 344 - #define RESULT_CONNECT 0 345 - #define RESULT_DISCONNECT 1 346 - 347 - struct hostif_stop_request { 348 - struct hostif_hdr header; 349 - } __packed; 350 - 351 - #define D_11B_ONLY_MODE 0 352 - #define D_11G_ONLY_MODE 1 353 - #define D_11BG_COMPATIBLE_MODE 2 354 - #define D_11A_ONLY_MODE 3 355 - 356 - #define CTS_MODE_FALSE 0 357 - #define CTS_MODE_TRUE 1 358 - 359 - struct hostif_request { 360 - __le16 phy_type; 361 - __le16 cts_mode; 362 - __le16 scan_type; 363 - __le16 capability; 364 - struct rate_set16 rate_set; 365 - } __packed; 366 - 367 - /** 368 - * struct hostif_ps_adhoc_set_request - pseudo adhoc mode 369 - * @capability: bit5 : preamble 370 - * bit6 : pbcc - Not supported always 0 371 - * bit10 : ShortSlotTime 372 - * bit13 : DSSS-OFDM - Not supported always 0 373 - */ 374 - struct hostif_ps_adhoc_set_request { 375 - struct hostif_hdr header; 376 - struct hostif_request request; 377 - __le16 channel; 378 - } __packed; 379 - 380 - #define AUTH_TYPE_OPEN_SYSTEM 0 381 - #define AUTH_TYPE_SHARED_KEY 1 382 - 383 - /** 384 - * struct hostif_infrastructure_set_request 385 - * @capability: bit5 : preamble 386 - * bit6 : pbcc - Not supported always 0 387 - * bit10 : ShortSlotTime 388 - * bit13 : DSSS-OFDM - Not supported always 0 389 - */ 390 - struct hostif_infrastructure_set_request { 391 - struct hostif_hdr header; 392 - struct hostif_request request; 393 - struct ssid ssid; 394 - __le16 beacon_lost_count; 395 - __le16 auth_type; 396 - struct channel_list channel_list; 397 - u8 bssid[ETH_ALEN]; 398 - } __packed; 399 - 400 - /** 401 - * struct hostif_adhoc_set_request 402 - * @capability: bit5 : preamble 403 - * bit6 : pbcc - Not supported always 0 404 - * bit10 : ShortSlotTime 405 - * bit13 : DSSS-OFDM - Not supported always 0 406 - */ 407 - struct hostif_adhoc_set_request { 408 - struct hostif_hdr header; 409 - struct hostif_request request; 410 - struct ssid ssid; 411 - __le16 channel; 412 - } __packed; 413 - 414 - /** 415 - * struct hostif_adhoc_set2_request 416 - * @capability: bit5 : preamble 417 - * bit6 : pbcc - Not supported always 0 418 - * bit10 : ShortSlotTime 419 - * bit13 : DSSS-OFDM - Not supported always 0 420 - */ 421 - struct hostif_adhoc_set2_request { 422 - struct hostif_hdr header; 423 - struct hostif_request request; 424 - __le16 reserved; 425 - struct ssid ssid; 426 - struct channel_list channel_list; 427 - u8 bssid[ETH_ALEN]; 428 - } __packed; 429 - 430 - struct association_request { 431 - u8 type; 432 - u8 pad; 433 - __le16 capability; 434 - __le16 listen_interval; 435 - u8 ap_address[6]; 436 - __le16 req_ies_size; 437 - } __packed; 438 - 439 - struct association_response { 440 - u8 type; 441 - u8 pad; 442 - __le16 capability; 443 - __le16 status; 444 - __le16 association_id; 445 - __le16 resp_ies_size; 446 - } __packed; 447 - 448 - struct hostif_bss_scan_request { 449 - struct hostif_hdr header; 450 - u8 scan_type; 451 - #define ACTIVE_SCAN 0 452 - #define PASSIVE_SCAN 1 453 - u8 pad[3]; 454 - __le32 ch_time_min; 455 - __le32 ch_time_max; 456 - struct channel_list channel_list; 457 - struct ssid ssid; 458 - } __packed; 459 - 460 - struct hostif_phy_information_request { 461 - struct hostif_hdr header; 462 - __le16 type; 463 - #define NORMAL_TYPE 0 464 - #define TIME_TYPE 1 465 - __le16 time; /* unit 100ms */ 466 - } __packed; 467 - 468 - enum sleep_mode_type { 469 - SLP_ACTIVE, 470 - SLP_SLEEP 471 - }; 472 - 473 - struct hostif_sleep_request { 474 - struct hostif_hdr header; 475 - } __packed; 476 - 477 - struct hostif_mic_failure_request { 478 - struct hostif_hdr header; 479 - __le16 failure_count; 480 - __le16 timer; 481 - } __packed; 482 - 483 - #define BASIC_RATE 0x80 484 - #define RATE_MASK 0x7F 485 - 486 - #define TX_RATE_AUTO 0xff 487 - #define TX_RATE_1M_FIXED 0 488 - #define TX_RATE_2M_FIXED 1 489 - #define TX_RATE_1_2M_AUTO 2 490 - #define TX_RATE_5M_FIXED 3 491 - #define TX_RATE_11M_FIXED 4 492 - 493 - #define TX_RATE_FULL_AUTO 0 494 - #define TX_RATE_11_AUTO 1 495 - #define TX_RATE_11B_AUTO 2 496 - #define TX_RATE_11BG_AUTO 3 497 - #define TX_RATE_MANUAL_AUTO 4 498 - #define TX_RATE_FIXED 5 499 - 500 - /* 11b rate */ 501 - #define TX_RATE_1M ((u8)(10 / 5)) /* 11b 11g basic rate */ 502 - #define TX_RATE_2M ((u8)(20 / 5)) /* 11b 11g basic rate */ 503 - #define TX_RATE_5M ((u8)(55 / 5)) /* 11g basic rate */ 504 - #define TX_RATE_11M ((u8)(110 / 5)) /* 11g basic rate */ 505 - 506 - /* 11g rate */ 507 - #define TX_RATE_6M ((u8)(60 / 5)) /* 11g basic rate */ 508 - #define TX_RATE_12M ((u8)(120 / 5)) /* 11g basic rate */ 509 - #define TX_RATE_24M ((u8)(240 / 5)) /* 11g basic rate */ 510 - #define TX_RATE_9M ((u8)(90 / 5)) 511 - #define TX_RATE_18M ((u8)(180 / 5)) 512 - #define TX_RATE_36M ((u8)(360 / 5)) 513 - #define TX_RATE_48M ((u8)(480 / 5)) 514 - #define TX_RATE_54M ((u8)(540 / 5)) 515 - 516 - static inline bool is_11b_rate(u8 rate) 517 - { 518 - return (((rate & RATE_MASK) == TX_RATE_1M) || 519 - ((rate & RATE_MASK) == TX_RATE_2M) || 520 - ((rate & RATE_MASK) == TX_RATE_5M) || 521 - ((rate & RATE_MASK) == TX_RATE_11M)); 522 - } 523 - 524 - static inline bool is_ofdm_rate(u8 rate) 525 - { 526 - return (((rate & RATE_MASK) == TX_RATE_6M) || 527 - ((rate & RATE_MASK) == TX_RATE_12M) || 528 - ((rate & RATE_MASK) == TX_RATE_24M) || 529 - ((rate & RATE_MASK) == TX_RATE_9M) || 530 - ((rate & RATE_MASK) == TX_RATE_18M) || 531 - ((rate & RATE_MASK) == TX_RATE_36M) || 532 - ((rate & RATE_MASK) == TX_RATE_48M) || 533 - ((rate & RATE_MASK) == TX_RATE_54M)); 534 - } 535 - 536 - static inline bool is_11bg_rate(u8 rate) 537 - { 538 - return (is_11b_rate(rate) || is_ofdm_rate(rate)); 539 - } 540 - 541 - static inline bool is_ofdm_ext_rate(u8 rate) 542 - { 543 - return (((rate & RATE_MASK) == TX_RATE_9M) || 544 - ((rate & RATE_MASK) == TX_RATE_18M) || 545 - ((rate & RATE_MASK) == TX_RATE_36M) || 546 - ((rate & RATE_MASK) == TX_RATE_48M) || 547 - ((rate & RATE_MASK) == TX_RATE_54M)); 548 - } 549 - 550 - enum connect_status_type { 551 - CONNECT_STATUS, 552 - DISCONNECT_STATUS 553 - }; 554 - 555 - enum preamble_type { 556 - LONG_PREAMBLE, 557 - SHORT_PREAMBLE 558 - }; 559 - 560 - enum multicast_filter_type { 561 - MCAST_FILTER_MCAST, 562 - MCAST_FILTER_MCASTALL, 563 - MCAST_FILTER_PROMISC, 564 - }; 565 - 566 - #define NIC_MAX_MCAST_LIST 32 567 - 568 - #define HIF_EVENT_MASK 0xE800 569 - 570 - static inline bool is_hif_ind(unsigned short event) 571 - { 572 - return (((event & HIF_EVENT_MASK) == HIF_EVENT_MASK) && 573 - (((event & ~HIF_EVENT_MASK) == 0x0001) || 574 - ((event & ~HIF_EVENT_MASK) == 0x0006) || 575 - ((event & ~HIF_EVENT_MASK) == 0x000C) || 576 - ((event & ~HIF_EVENT_MASK) == 0x0011) || 577 - ((event & ~HIF_EVENT_MASK) == 0x0012))); 578 - } 579 - 580 - static inline bool is_hif_conf(unsigned short event) 581 - { 582 - return (((event & HIF_EVENT_MASK) == HIF_EVENT_MASK) && 583 - ((event & ~HIF_EVENT_MASK) > 0x0000) && 584 - ((event & ~HIF_EVENT_MASK) < 0x0012) && 585 - !is_hif_ind(event)); 586 - } 587 - 588 - #ifdef __KERNEL__ 589 - 590 - #include "ks_wlan.h" 591 - 592 - /* function prototype */ 593 - int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb); 594 - void hostif_receive(struct ks_wlan_private *priv, unsigned char *p, 595 - unsigned int size); 596 - void hostif_sme_enqueue(struct ks_wlan_private *priv, u16 event); 597 - int hostif_init(struct ks_wlan_private *priv); 598 - void hostif_exit(struct ks_wlan_private *priv); 599 - int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, 600 - void (*complete_handler)(struct ks_wlan_private *priv, 601 - struct sk_buff *skb), 602 - struct sk_buff *skb); 603 - void send_packet_complete(struct ks_wlan_private *priv, struct sk_buff *skb); 604 - 605 - void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv); 606 - int ks_wlan_hw_power_save(struct ks_wlan_private *priv); 607 - 608 - #define KS7010_SIZE_ALIGNMENT 32 609 - 610 - static inline size_t hif_align_size(size_t size) 611 - { 612 - return ALIGN(size, KS7010_SIZE_ALIGNMENT); 613 - } 614 - 615 - #endif /* __KERNEL__ */ 616 - 617 - #endif /* _KS_HOSTIF_H_ */
-567
drivers/staging/ks7010/ks_wlan.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Driver for KeyStream IEEE802.11 b/g wireless LAN cards. 4 - * 5 - * Copyright (C) 2006-2008 KeyStream Corp. 6 - * Copyright (C) 2009 Renesas Technology Corp. 7 - */ 8 - 9 - #ifndef _KS_WLAN_H 10 - #define _KS_WLAN_H 11 - 12 - #include <linux/atomic.h> 13 - #include <linux/circ_buf.h> 14 - #include <linux/completion.h> 15 - #include <linux/netdevice.h> 16 - #include <linux/sched.h> 17 - #include <linux/spinlock.h> 18 - #include <linux/wireless.h> 19 - 20 - struct ks_wlan_parameter { 21 - u8 operation_mode; 22 - u8 channel; 23 - u8 tx_rate; 24 - struct { 25 - u8 size; 26 - u8 body[16]; 27 - } rate_set; 28 - u8 bssid[ETH_ALEN]; 29 - struct { 30 - u8 size; 31 - u8 body[32 + 1]; 32 - } ssid; 33 - u8 preamble; 34 - u8 power_mgmt; 35 - u32 scan_type; 36 - #define BEACON_LOST_COUNT_MAX 65535 37 - u32 beacon_lost_count; 38 - u32 rts; 39 - u32 fragment; 40 - u32 privacy_invoked; 41 - u32 wep_index; 42 - struct { 43 - u8 size; 44 - u8 val[13 * 2 + 1]; 45 - } wep_key[4]; 46 - u16 authenticate_type; 47 - u16 phy_type; 48 - u16 cts_mode; 49 - u16 phy_info_timer; 50 - }; 51 - 52 - enum { 53 - DEVICE_STATE_OFF = 0, /* this means hw_unavailable is != 0 */ 54 - DEVICE_STATE_PREBOOT, /* we are in a pre-boot state (empty RAM) */ 55 - DEVICE_STATE_BOOT, /* boot state (fw upload, run fw) */ 56 - DEVICE_STATE_PREINIT, /* pre-init state */ 57 - DEVICE_STATE_INIT, /* init state (restore MIB backup to device) */ 58 - DEVICE_STATE_READY, /* driver&device are in operational state */ 59 - DEVICE_STATE_SLEEP /* device in sleep mode */ 60 - }; 61 - 62 - /* SME flag */ 63 - #define SME_MODE_SET BIT(0) 64 - #define SME_RTS BIT(1) 65 - #define SME_FRAG BIT(2) 66 - #define SME_WEP_FLAG BIT(3) 67 - #define SME_WEP_INDEX BIT(4) 68 - #define SME_WEP_VAL1 BIT(5) 69 - #define SME_WEP_VAL2 BIT(6) 70 - #define SME_WEP_VAL3 BIT(7) 71 - #define SME_WEP_VAL4 BIT(8) 72 - #define SME_WEP_VAL_MASK GENMASK(8, 5) 73 - #define SME_RSN BIT(9) 74 - #define SME_RSN_MULTICAST BIT(10) 75 - #define SME_RSN_UNICAST BIT(11) 76 - #define SME_RSN_AUTH BIT(12) 77 - 78 - #define SME_AP_SCAN BIT(13) 79 - #define SME_MULTICAST BIT(14) 80 - 81 - /* SME Event */ 82 - enum { 83 - SME_START, 84 - 85 - SME_MULTICAST_REQUEST, 86 - SME_MACADDRESS_SET_REQUEST, 87 - SME_BSS_SCAN_REQUEST, 88 - SME_SET_FLAG, 89 - SME_SET_TXKEY, 90 - SME_SET_KEY1, 91 - SME_SET_KEY2, 92 - SME_SET_KEY3, 93 - SME_SET_KEY4, 94 - SME_SET_PMK_TSC, 95 - SME_SET_GMK1_TSC, 96 - SME_SET_GMK2_TSC, 97 - SME_SET_GMK3_TSC, 98 - SME_SET_PMKSA, 99 - SME_POW_MNGMT_REQUEST, 100 - SME_PHY_INFO_REQUEST, 101 - SME_MIC_FAILURE_REQUEST, 102 - SME_GET_MAC_ADDRESS, 103 - SME_GET_PRODUCT_VERSION, 104 - SME_STOP_REQUEST, 105 - SME_RTS_THRESHOLD_REQUEST, 106 - SME_FRAGMENTATION_THRESHOLD_REQUEST, 107 - SME_WEP_INDEX_REQUEST, 108 - SME_WEP_KEY1_REQUEST, 109 - SME_WEP_KEY2_REQUEST, 110 - SME_WEP_KEY3_REQUEST, 111 - SME_WEP_KEY4_REQUEST, 112 - SME_WEP_FLAG_REQUEST, 113 - SME_RSN_UCAST_REQUEST, 114 - SME_RSN_MCAST_REQUEST, 115 - SME_RSN_AUTH_REQUEST, 116 - SME_RSN_ENABLED_REQUEST, 117 - SME_RSN_MODE_REQUEST, 118 - SME_WPS_ENABLE_REQUEST, 119 - SME_WPS_PROBE_REQUEST, 120 - SME_SET_GAIN, 121 - SME_GET_GAIN, 122 - SME_SLEEP_REQUEST, 123 - SME_SET_REGION, 124 - SME_MODE_SET_REQUEST, 125 - SME_START_REQUEST, 126 - SME_GET_EEPROM_CKSUM, 127 - 128 - SME_MIC_FAILURE_CONFIRM, 129 - SME_START_CONFIRM, 130 - 131 - SME_MULTICAST_CONFIRM, 132 - SME_BSS_SCAN_CONFIRM, 133 - SME_GET_CURRENT_AP, 134 - SME_POW_MNGMT_CONFIRM, 135 - SME_PHY_INFO_CONFIRM, 136 - SME_STOP_CONFIRM, 137 - SME_RTS_THRESHOLD_CONFIRM, 138 - SME_FRAGMENTATION_THRESHOLD_CONFIRM, 139 - SME_WEP_INDEX_CONFIRM, 140 - SME_WEP_KEY1_CONFIRM, 141 - SME_WEP_KEY2_CONFIRM, 142 - SME_WEP_KEY3_CONFIRM, 143 - SME_WEP_KEY4_CONFIRM, 144 - SME_WEP_FLAG_CONFIRM, 145 - SME_RSN_UCAST_CONFIRM, 146 - SME_RSN_MCAST_CONFIRM, 147 - SME_RSN_AUTH_CONFIRM, 148 - SME_RSN_ENABLED_CONFIRM, 149 - SME_RSN_MODE_CONFIRM, 150 - SME_MODE_SET_CONFIRM, 151 - SME_SLEEP_CONFIRM, 152 - 153 - SME_RSN_SET_CONFIRM, 154 - SME_WEP_SET_CONFIRM, 155 - SME_TERMINATE, 156 - 157 - SME_EVENT_SIZE 158 - }; 159 - 160 - /* SME Status */ 161 - enum { 162 - SME_IDLE, 163 - SME_SETUP, 164 - SME_DISCONNECT, 165 - SME_CONNECT 166 - }; 167 - 168 - #define SME_EVENT_BUFF_SIZE 128 169 - 170 - struct sme_info { 171 - int sme_status; 172 - int event_buff[SME_EVENT_BUFF_SIZE]; 173 - unsigned int qhead; 174 - unsigned int qtail; 175 - spinlock_t sme_spin; 176 - unsigned long sme_flag; 177 - }; 178 - 179 - struct hostt { 180 - int buff[SME_EVENT_BUFF_SIZE]; 181 - unsigned int qhead; 182 - unsigned int qtail; 183 - }; 184 - 185 - #define RSN_IE_BODY_MAX 64 186 - struct rsn_ie { 187 - u8 id; /* 0xdd = WPA or 0x30 = RSN */ 188 - u8 size; /* max ? 255 ? */ 189 - u8 body[RSN_IE_BODY_MAX]; 190 - } __packed; 191 - 192 - #define WPA_INFO_ELEM_ID 0xdd 193 - #define RSN_INFO_ELEM_ID 0x30 194 - 195 - #define WPS_IE_BODY_MAX 255 196 - struct wps_ie { 197 - u8 id; /* 221 'dd <len> 00 50 F2 04' */ 198 - u8 size; /* max ? 255 ? */ 199 - u8 body[WPS_IE_BODY_MAX]; 200 - } __packed; 201 - 202 - struct local_ap { 203 - u8 bssid[6]; 204 - u8 rssi; 205 - u8 sq; 206 - struct { 207 - u8 size; 208 - u8 body[32]; 209 - u8 ssid_pad; 210 - } ssid; 211 - struct { 212 - u8 size; 213 - u8 body[16]; 214 - u8 rate_pad; 215 - } rate_set; 216 - u16 capability; 217 - u8 channel; 218 - u8 noise; 219 - struct rsn_ie wpa_ie; 220 - struct rsn_ie rsn_ie; 221 - struct wps_ie wps_ie; 222 - }; 223 - 224 - #define LOCAL_APLIST_MAX 31 225 - #define LOCAL_CURRENT_AP LOCAL_APLIST_MAX 226 - struct local_aplist { 227 - int size; 228 - struct local_ap ap[LOCAL_APLIST_MAX + 1]; 229 - }; 230 - 231 - struct local_gain { 232 - u8 tx_mode; 233 - u8 rx_mode; 234 - u8 tx_gain; 235 - u8 rx_gain; 236 - }; 237 - 238 - struct local_eeprom_sum { 239 - u8 type; 240 - u8 result; 241 - }; 242 - 243 - enum { 244 - EEPROM_OK, 245 - EEPROM_CHECKSUM_NONE, 246 - EEPROM_FW_NOT_SUPPORT, 247 - EEPROM_NG, 248 - }; 249 - 250 - /* Power Save Status */ 251 - enum { 252 - PS_NONE, 253 - PS_ACTIVE_SET, 254 - PS_SAVE_SET, 255 - PS_CONF_WAIT, 256 - PS_SNOOZE, 257 - PS_WAKEUP 258 - }; 259 - 260 - struct power_save_status { 261 - atomic_t status; /* initialvalue 0 */ 262 - struct completion wakeup_wait; 263 - atomic_t confirm_wait; 264 - atomic_t snooze_guard; 265 - }; 266 - 267 - struct sleep_status { 268 - atomic_t status; /* initialvalue 0 */ 269 - atomic_t doze_request; 270 - atomic_t wakeup_request; 271 - }; 272 - 273 - /* WPA */ 274 - struct scan_ext { 275 - unsigned int flag; 276 - char ssid[IW_ESSID_MAX_SIZE + 1]; 277 - }; 278 - 279 - #define CIPHER_ID_WPA_NONE "\x00\x50\xf2\x00" 280 - #define CIPHER_ID_WPA_WEP40 "\x00\x50\xf2\x01" 281 - #define CIPHER_ID_WPA_TKIP "\x00\x50\xf2\x02" 282 - #define CIPHER_ID_WPA_CCMP "\x00\x50\xf2\x04" 283 - #define CIPHER_ID_WPA_WEP104 "\x00\x50\xf2\x05" 284 - 285 - #define CIPHER_ID_WPA2_NONE "\x00\x0f\xac\x00" 286 - #define CIPHER_ID_WPA2_WEP40 "\x00\x0f\xac\x01" 287 - #define CIPHER_ID_WPA2_TKIP "\x00\x0f\xac\x02" 288 - #define CIPHER_ID_WPA2_CCMP "\x00\x0f\xac\x04" 289 - #define CIPHER_ID_WPA2_WEP104 "\x00\x0f\xac\x05" 290 - 291 - #define CIPHER_ID_LEN 4 292 - 293 - enum { 294 - KEY_MGMT_802_1X, 295 - KEY_MGMT_PSK, 296 - KEY_MGMT_WPANONE, 297 - }; 298 - 299 - #define KEY_MGMT_ID_WPA_NONE "\x00\x50\xf2\x00" 300 - #define KEY_MGMT_ID_WPA_1X "\x00\x50\xf2\x01" 301 - #define KEY_MGMT_ID_WPA_PSK "\x00\x50\xf2\x02" 302 - #define KEY_MGMT_ID_WPA_WPANONE "\x00\x50\xf2\xff" 303 - 304 - #define KEY_MGMT_ID_WPA2_NONE "\x00\x0f\xac\x00" 305 - #define KEY_MGMT_ID_WPA2_1X "\x00\x0f\xac\x01" 306 - #define KEY_MGMT_ID_WPA2_PSK "\x00\x0f\xac\x02" 307 - #define KEY_MGMT_ID_WPA2_WPANONE "\x00\x0f\xac\xff" 308 - 309 - #define KEY_MGMT_ID_LEN 4 310 - 311 - #define MIC_KEY_SIZE 8 312 - 313 - struct wpa_key { 314 - u32 ext_flags; /* IW_ENCODE_EXT_xxx */ 315 - u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ 316 - u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ 317 - struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast 318 - * (group) keys or unicast address for 319 - * individual keys 320 - */ 321 - u16 alg; 322 - u16 key_len; /* WEP: 5 or 13, TKIP: 32, CCMP: 16 */ 323 - u8 key_val[IW_ENCODING_TOKEN_MAX]; 324 - u8 tx_mic_key[MIC_KEY_SIZE]; 325 - u8 rx_mic_key[MIC_KEY_SIZE]; 326 - }; 327 - 328 - #define WPA_KEY_INDEX_MAX 4 329 - #define WPA_RX_SEQ_LEN 6 330 - 331 - struct mic_failure { 332 - u16 failure; /* MIC Failure counter 0 or 1 or 2 */ 333 - u16 counter; /* 1sec counter 0-60 */ 334 - u32 last_failure_time; 335 - int stop; 336 - }; 337 - 338 - struct wpa_status { 339 - int wpa_enabled; 340 - bool rsn_enabled; 341 - int version; 342 - int pairwise_suite; /* unicast cipher */ 343 - int group_suite; /* multicast cipher */ 344 - int key_mgmt_suite; 345 - int auth_alg; 346 - int txkey; 347 - struct wpa_key key[WPA_KEY_INDEX_MAX]; 348 - struct scan_ext scan_ext; 349 - struct mic_failure mic_failure; 350 - }; 351 - 352 - #include <linux/list.h> 353 - #define PMK_LIST_MAX 8 354 - struct pmk_list { 355 - u16 size; 356 - struct list_head head; 357 - struct pmk { 358 - struct list_head list; 359 - u8 bssid[ETH_ALEN]; 360 - u8 pmkid[IW_PMKID_LEN]; 361 - } pmk[PMK_LIST_MAX]; 362 - }; 363 - 364 - struct wps_status { 365 - int wps_enabled; 366 - int ielen; 367 - u8 ie[255]; 368 - }; 369 - 370 - /* Tx Device struct */ 371 - #define TX_DEVICE_BUFF_SIZE 1024 372 - 373 - struct ks_wlan_private; 374 - 375 - /** 376 - * struct tx_device_buffer - Queue item for the tx queue. 377 - * @sendp: Pointer to the send request data. 378 - * @size: Size of @sendp data. 379 - * @complete_handler: Function called once data write to device is complete. 380 - * @arg1: First argument to @complete_handler. 381 - * @arg2: Second argument to @complete_handler. 382 - */ 383 - struct tx_device_buffer { 384 - unsigned char *sendp; 385 - unsigned int size; 386 - void (*complete_handler)(struct ks_wlan_private *priv, 387 - struct sk_buff *skb); 388 - struct sk_buff *skb; 389 - }; 390 - 391 - /** 392 - * struct tx_device - Tx buffer queue. 393 - * @tx_device_buffer: Queue buffer. 394 - * @qhead: Head of tx queue. 395 - * @qtail: Tail of tx queue. 396 - * @tx_dev_lock: Queue lock. 397 - */ 398 - struct tx_device { 399 - struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE]; 400 - unsigned int qhead; 401 - unsigned int qtail; 402 - spinlock_t tx_dev_lock; /* protect access to the queue */ 403 - }; 404 - 405 - /* Rx Device struct */ 406 - #define RX_DATA_SIZE (2 + 2 + 2347 + 1) 407 - #define RX_DEVICE_BUFF_SIZE 32 408 - 409 - /** 410 - * struct rx_device_buffer - Queue item for the rx queue. 411 - * @data: rx data. 412 - * @size: Size of @data. 413 - */ 414 - struct rx_device_buffer { 415 - unsigned char data[RX_DATA_SIZE]; 416 - unsigned int size; 417 - }; 418 - 419 - /** 420 - * struct rx_device - Rx buffer queue. 421 - * @rx_device_buffer: Queue buffer. 422 - * @qhead: Head of rx queue. 423 - * @qtail: Tail of rx queue. 424 - * @rx_dev_lock: Queue lock. 425 - */ 426 - struct rx_device { 427 - struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE]; 428 - unsigned int qhead; 429 - unsigned int qtail; 430 - spinlock_t rx_dev_lock; /* protect access to the queue */ 431 - }; 432 - 433 - struct ks_wlan_private { 434 - /* hardware information */ 435 - void *if_hw; 436 - struct workqueue_struct *wq; 437 - struct delayed_work rw_dwork; 438 - struct tasklet_struct rx_bh_task; 439 - 440 - struct net_device *net_dev; 441 - struct net_device_stats nstats; 442 - struct iw_statistics wstats; 443 - 444 - struct completion confirm_wait; 445 - 446 - /* trx device & sme */ 447 - struct tx_device tx_dev; 448 - struct rx_device rx_dev; 449 - struct sme_info sme_i; 450 - u8 *rxp; 451 - unsigned int rx_size; 452 - struct work_struct sme_work; 453 - struct work_struct wakeup_work; 454 - int scan_ind_count; 455 - 456 - unsigned char eth_addr[ETH_ALEN]; 457 - 458 - struct local_aplist aplist; 459 - struct local_ap current_ap; 460 - struct power_save_status psstatus; 461 - struct sleep_status sleepstatus; 462 - struct wpa_status wpa; 463 - struct pmk_list pmklist; 464 - /* wireless parameter */ 465 - struct ks_wlan_parameter reg; 466 - u8 current_rate; 467 - 468 - char nick[IW_ESSID_MAX_SIZE + 1]; 469 - 470 - spinlock_t multicast_spin; 471 - 472 - spinlock_t dev_read_lock; 473 - wait_queue_head_t devread_wait; 474 - 475 - unsigned int need_commit; /* for ioctl */ 476 - 477 - /* DeviceIoControl */ 478 - bool is_device_open; 479 - atomic_t event_count; 480 - atomic_t rec_count; 481 - int dev_count; 482 - #define DEVICE_STOCK_COUNT 20 483 - unsigned char *dev_data[DEVICE_STOCK_COUNT]; 484 - int dev_size[DEVICE_STOCK_COUNT]; 485 - 486 - /* ioctl : IOCTL_FIRMWARE_VERSION */ 487 - unsigned char firmware_version[128 + 1]; 488 - int version_size; 489 - 490 - bool mac_address_valid; 491 - 492 - int dev_state; 493 - 494 - struct sk_buff *skb; 495 - unsigned int cur_rx; /* Index into the Rx buffer of next Rx pkt. */ 496 - #define FORCE_DISCONNECT 0x80000000 497 - #define CONNECT_STATUS_MASK 0x7FFFFFFF 498 - u32 connect_status; 499 - int infra_status; 500 - u8 scan_ssid_len; 501 - u8 scan_ssid[IW_ESSID_MAX_SIZE + 1]; 502 - struct local_gain gain; 503 - struct wps_status wps; 504 - u8 sleep_mode; 505 - 506 - u8 region; 507 - struct local_eeprom_sum eeprom_sum; 508 - u8 eeprom_checksum; 509 - 510 - struct hostt hostt; 511 - 512 - unsigned long last_doze; 513 - unsigned long last_wakeup; 514 - 515 - unsigned int wakeup_count; /* for detect wakeup loop */ 516 - }; 517 - 518 - static inline void inc_txqhead(struct ks_wlan_private *priv) 519 - { 520 - priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE; 521 - } 522 - 523 - static inline void inc_txqtail(struct ks_wlan_private *priv) 524 - { 525 - priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE; 526 - } 527 - 528 - static inline bool txq_has_space(struct ks_wlan_private *priv) 529 - { 530 - return (CIRC_SPACE(priv->tx_dev.qhead, priv->tx_dev.qtail, 531 - TX_DEVICE_BUFF_SIZE) > 0); 532 - } 533 - 534 - static inline void inc_rxqhead(struct ks_wlan_private *priv) 535 - { 536 - priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE; 537 - } 538 - 539 - static inline void inc_rxqtail(struct ks_wlan_private *priv) 540 - { 541 - priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE; 542 - } 543 - 544 - static inline bool rxq_has_space(struct ks_wlan_private *priv) 545 - { 546 - return (CIRC_SPACE(priv->rx_dev.qhead, priv->rx_dev.qtail, 547 - RX_DEVICE_BUFF_SIZE) > 0); 548 - } 549 - 550 - static inline unsigned int txq_count(struct ks_wlan_private *priv) 551 - { 552 - return CIRC_CNT_TO_END(priv->tx_dev.qhead, priv->tx_dev.qtail, 553 - TX_DEVICE_BUFF_SIZE); 554 - } 555 - 556 - static inline unsigned int rxq_count(struct ks_wlan_private *priv) 557 - { 558 - return CIRC_CNT_TO_END(priv->rx_dev.qhead, priv->rx_dev.qtail, 559 - RX_DEVICE_BUFF_SIZE); 560 - } 561 - 562 - int ks_wlan_net_start(struct net_device *dev); 563 - int ks_wlan_net_stop(struct net_device *dev); 564 - bool is_connect_status(u32 status); 565 - bool is_disconnect_status(u32 status); 566 - 567 - #endif /* _KS_WLAN_H */
-61
drivers/staging/ks7010/ks_wlan_ioctl.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Driver for KeyStream 11b/g wireless LAN 4 - * 5 - * Copyright (c) 2005-2008 KeyStream Corp. 6 - * Copyright (C) 2009 Renesas Technology Corp. 7 - */ 8 - 9 - #ifndef _KS_WLAN_IOCTL_H 10 - #define _KS_WLAN_IOCTL_H 11 - 12 - #include <linux/wireless.h> 13 - /* The low order bit identify a SET (0) or a GET (1) ioctl. */ 14 - 15 - /* (SIOCIWFIRSTPRIV + 0) */ 16 - /* former KS_WLAN_GET_DRIVER_VERSION (SIOCIWFIRSTPRIV + 1) */ 17 - /* (SIOCIWFIRSTPRIV + 2) */ 18 - #define KS_WLAN_GET_FIRM_VERSION (SIOCIWFIRSTPRIV + 3) 19 - #define KS_WLAN_SET_WPS_ENABLE (SIOCIWFIRSTPRIV + 4) 20 - #define KS_WLAN_GET_WPS_ENABLE (SIOCIWFIRSTPRIV + 5) 21 - #define KS_WLAN_SET_WPS_PROBE_REQ (SIOCIWFIRSTPRIV + 6) 22 - #define KS_WLAN_GET_EEPROM_CKSUM (SIOCIWFIRSTPRIV + 7) 23 - #define KS_WLAN_SET_PREAMBLE (SIOCIWFIRSTPRIV + 8) 24 - #define KS_WLAN_GET_PREAMBLE (SIOCIWFIRSTPRIV + 9) 25 - #define KS_WLAN_SET_POWER_SAVE (SIOCIWFIRSTPRIV + 10) 26 - #define KS_WLAN_GET_POWER_SAVE (SIOCIWFIRSTPRIV + 11) 27 - #define KS_WLAN_SET_SCAN_TYPE (SIOCIWFIRSTPRIV + 12) 28 - #define KS_WLAN_GET_SCAN_TYPE (SIOCIWFIRSTPRIV + 13) 29 - #define KS_WLAN_SET_RX_GAIN (SIOCIWFIRSTPRIV + 14) 30 - #define KS_WLAN_GET_RX_GAIN (SIOCIWFIRSTPRIV + 15) 31 - #define KS_WLAN_HOSTT (SIOCIWFIRSTPRIV + 16) /* unused */ 32 - //#define KS_WLAN_SET_REGION (SIOCIWFIRSTPRIV + 17) 33 - #define KS_WLAN_SET_BEACON_LOST (SIOCIWFIRSTPRIV + 18) 34 - #define KS_WLAN_GET_BEACON_LOST (SIOCIWFIRSTPRIV + 19) 35 - 36 - #define KS_WLAN_SET_TX_GAIN (SIOCIWFIRSTPRIV + 20) 37 - #define KS_WLAN_GET_TX_GAIN (SIOCIWFIRSTPRIV + 21) 38 - 39 - /* for KS7010 */ 40 - #define KS_WLAN_SET_PHY_TYPE (SIOCIWFIRSTPRIV + 22) 41 - #define KS_WLAN_GET_PHY_TYPE (SIOCIWFIRSTPRIV + 23) 42 - #define KS_WLAN_SET_CTS_MODE (SIOCIWFIRSTPRIV + 24) 43 - #define KS_WLAN_GET_CTS_MODE (SIOCIWFIRSTPRIV + 25) 44 - /* (SIOCIWFIRSTPRIV + 26) */ 45 - /* (SIOCIWFIRSTPRIV + 27) */ 46 - #define KS_WLAN_SET_SLEEP_MODE (SIOCIWFIRSTPRIV + 28) /* sleep mode */ 47 - #define KS_WLAN_GET_SLEEP_MODE (SIOCIWFIRSTPRIV + 29) /* sleep mode */ 48 - /* (SIOCIWFIRSTPRIV + 30) */ 49 - /* (SIOCIWFIRSTPRIV + 31) */ 50 - 51 - #ifdef __KERNEL__ 52 - 53 - #include "ks_wlan.h" 54 - #include <linux/netdevice.h> 55 - 56 - int ks_wlan_setup_parameter(struct ks_wlan_private *priv, 57 - unsigned int commit_flag); 58 - 59 - #endif /* __KERNEL__ */ 60 - 61 - #endif /* _KS_WLAN_IOCTL_H */
-2676
drivers/staging/ks7010/ks_wlan_net.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Driver for KeyStream 11b/g wireless LAN 4 - * 5 - * Copyright (C) 2005-2008 KeyStream Corp. 6 - * Copyright (C) 2009 Renesas Technology Corp. 7 - */ 8 - 9 - #include <linux/atomic.h> 10 - #include <linux/completion.h> 11 - #include <linux/if_arp.h> 12 - #include <linux/netdevice.h> 13 - #include <linux/timer.h> 14 - #include <linux/uaccess.h> 15 - 16 - static int wep_on_off; 17 - #define WEP_OFF 0 18 - #define WEP_ON_64BIT 1 19 - #define WEP_ON_128BIT 2 20 - 21 - #include "ks_wlan.h" 22 - #include "ks_hostif.h" 23 - #include "ks_wlan_ioctl.h" 24 - 25 - /* Include Wireless Extension definition and check version */ 26 - #include <linux/wireless.h> 27 - #define WIRELESS_SPY /* enable iwspy support */ 28 - #include <net/iw_handler.h> /* New driver API */ 29 - 30 - /* Frequency list (map channels to frequencies) */ 31 - static const long frequency_list[] = { 32 - 2412, 2417, 2422, 2427, 2432, 2437, 2442, 33 - 2447, 2452, 2457, 2462, 2467, 2472, 2484 34 - }; 35 - 36 - /* A few details needed for WEP (Wireless Equivalent Privacy) */ 37 - #define MAX_KEY_SIZE 13 /* 128 (?) bits */ 38 - #define MIN_KEY_SIZE 5 /* 40 bits RC4 - WEP */ 39 - struct wep_key { 40 - u16 len; 41 - u8 key[16]; /* 40-bit and 104-bit keys */ 42 - }; 43 - 44 - /* 45 - * function prototypes 46 - */ 47 - static int ks_wlan_open(struct net_device *dev); 48 - static void ks_wlan_tx_timeout(struct net_device *dev, unsigned int txqueue); 49 - static netdev_tx_t ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev); 50 - static int ks_wlan_close(struct net_device *dev); 51 - static void ks_wlan_set_rx_mode(struct net_device *dev); 52 - static struct net_device_stats *ks_wlan_get_stats(struct net_device *dev); 53 - static int ks_wlan_set_mac_address(struct net_device *dev, void *addr); 54 - static int ks_wlan_netdev_ioctl(struct net_device *dev, struct ifreq *rq, 55 - int cmd); 56 - 57 - static atomic_t update_phyinfo; 58 - static struct timer_list update_phyinfo_timer; 59 - static 60 - int ks_wlan_update_phy_information(struct ks_wlan_private *priv) 61 - { 62 - struct iw_statistics *wstats = &priv->wstats; 63 - 64 - netdev_dbg(priv->net_dev, "in_interrupt = %ld\n", in_interrupt()); 65 - 66 - if (priv->dev_state < DEVICE_STATE_READY) 67 - return -EBUSY; /* not finished initialize */ 68 - 69 - if (atomic_read(&update_phyinfo)) 70 - return -EPERM; 71 - 72 - /* The status */ 73 - wstats->status = priv->reg.operation_mode; /* Operation mode */ 74 - 75 - /* Signal quality and co. But where is the noise level ??? */ 76 - hostif_sme_enqueue(priv, SME_PHY_INFO_REQUEST); 77 - 78 - /* interruptible_sleep_on_timeout(&priv->confirm_wait, HZ/2); */ 79 - if (!wait_for_completion_interruptible_timeout 80 - (&priv->confirm_wait, HZ / 2)) { 81 - netdev_dbg(priv->net_dev, "wait time out!!\n"); 82 - } 83 - 84 - atomic_inc(&update_phyinfo); 85 - update_phyinfo_timer.expires = jiffies + HZ; /* 1sec */ 86 - add_timer(&update_phyinfo_timer); 87 - 88 - return 0; 89 - } 90 - 91 - static 92 - void ks_wlan_update_phyinfo_timeout(struct timer_list *unused) 93 - { 94 - pr_debug("in_interrupt = %ld\n", in_interrupt()); 95 - atomic_set(&update_phyinfo, 0); 96 - } 97 - 98 - int ks_wlan_setup_parameter(struct ks_wlan_private *priv, 99 - unsigned int commit_flag) 100 - { 101 - hostif_sme_enqueue(priv, SME_STOP_REQUEST); 102 - 103 - if (commit_flag & SME_RTS) 104 - hostif_sme_enqueue(priv, SME_RTS_THRESHOLD_REQUEST); 105 - if (commit_flag & SME_FRAG) 106 - hostif_sme_enqueue(priv, SME_FRAGMENTATION_THRESHOLD_REQUEST); 107 - 108 - if (commit_flag & SME_WEP_INDEX) 109 - hostif_sme_enqueue(priv, SME_WEP_INDEX_REQUEST); 110 - if (commit_flag & SME_WEP_VAL1) 111 - hostif_sme_enqueue(priv, SME_WEP_KEY1_REQUEST); 112 - if (commit_flag & SME_WEP_VAL2) 113 - hostif_sme_enqueue(priv, SME_WEP_KEY2_REQUEST); 114 - if (commit_flag & SME_WEP_VAL3) 115 - hostif_sme_enqueue(priv, SME_WEP_KEY3_REQUEST); 116 - if (commit_flag & SME_WEP_VAL4) 117 - hostif_sme_enqueue(priv, SME_WEP_KEY4_REQUEST); 118 - if (commit_flag & SME_WEP_FLAG) 119 - hostif_sme_enqueue(priv, SME_WEP_FLAG_REQUEST); 120 - 121 - if (commit_flag & SME_RSN) { 122 - hostif_sme_enqueue(priv, SME_RSN_ENABLED_REQUEST); 123 - hostif_sme_enqueue(priv, SME_RSN_MODE_REQUEST); 124 - } 125 - if (commit_flag & SME_RSN_MULTICAST) 126 - hostif_sme_enqueue(priv, SME_RSN_MCAST_REQUEST); 127 - if (commit_flag & SME_RSN_UNICAST) 128 - hostif_sme_enqueue(priv, SME_RSN_UCAST_REQUEST); 129 - if (commit_flag & SME_RSN_AUTH) 130 - hostif_sme_enqueue(priv, SME_RSN_AUTH_REQUEST); 131 - 132 - hostif_sme_enqueue(priv, SME_MODE_SET_REQUEST); 133 - 134 - hostif_sme_enqueue(priv, SME_START_REQUEST); 135 - 136 - return 0; 137 - } 138 - 139 - /* 140 - * Initial Wireless Extension code for Ks_Wlannet driver by : 141 - * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 17 November 00 142 - * Conversion to new driver API by : 143 - * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 26 March 02 144 - * Javier also did a good amount of work here, adding some new extensions 145 - * and fixing my code. Let's just say that without him this code just 146 - * would not work at all... - Jean II 147 - */ 148 - 149 - static int ks_wlan_get_name(struct net_device *dev, 150 - struct iw_request_info *info, 151 - union iwreq_data *cwrq, 152 - char *extra) 153 - { 154 - struct ks_wlan_private *priv = netdev_priv(dev); 155 - 156 - if (priv->sleep_mode == SLP_SLEEP) 157 - return -EPERM; 158 - 159 - /* for SLEEP MODE */ 160 - if (priv->dev_state < DEVICE_STATE_READY) 161 - strscpy(cwrq->name, "NOT READY!", sizeof(cwrq->name)); 162 - else if (priv->reg.phy_type == D_11B_ONLY_MODE) 163 - strscpy(cwrq->name, "IEEE 802.11b", sizeof(cwrq->name)); 164 - else if (priv->reg.phy_type == D_11G_ONLY_MODE) 165 - strscpy(cwrq->name, "IEEE 802.11g", sizeof(cwrq->name)); 166 - else 167 - strscpy(cwrq->name, "IEEE 802.11b/g", sizeof(cwrq->name)); 168 - 169 - return 0; 170 - } 171 - 172 - static int ks_wlan_set_freq(struct net_device *dev, 173 - struct iw_request_info *info, 174 - union iwreq_data *fwrq, char *extra) 175 - { 176 - struct ks_wlan_private *priv = netdev_priv(dev); 177 - int channel; 178 - 179 - if (priv->sleep_mode == SLP_SLEEP) 180 - return -EPERM; 181 - 182 - /* for SLEEP MODE */ 183 - /* If setting by frequency, convert to a channel */ 184 - if ((fwrq->freq.e == 1) && 185 - (fwrq->freq.m >= 241200000) && (fwrq->freq.m <= 248700000)) { 186 - int f = fwrq->freq.m / 100000; 187 - int c = 0; 188 - 189 - while ((c < 14) && (f != frequency_list[c])) 190 - c++; 191 - /* Hack to fall through... */ 192 - fwrq->freq.e = 0; 193 - fwrq->freq.m = c + 1; 194 - } 195 - /* Setting by channel number */ 196 - if ((fwrq->freq.m > 1000) || (fwrq->freq.e > 0)) 197 - return -EOPNOTSUPP; 198 - 199 - channel = fwrq->freq.m; 200 - /* We should do a better check than that, 201 - * based on the card capability !!! 202 - */ 203 - if ((channel < 1) || (channel > 14)) { 204 - netdev_dbg(dev, "%s: New channel value of %d is invalid!\n", 205 - dev->name, fwrq->freq.m); 206 - return -EINVAL; 207 - } 208 - 209 - /* Yes ! We can set it !!! */ 210 - priv->reg.channel = (u8)(channel); 211 - priv->need_commit |= SME_MODE_SET; 212 - 213 - return -EINPROGRESS; /* Call commit handler */ 214 - } 215 - 216 - static int ks_wlan_get_freq(struct net_device *dev, 217 - struct iw_request_info *info, 218 - union iwreq_data *fwrq, char *extra) 219 - { 220 - struct ks_wlan_private *priv = netdev_priv(dev); 221 - int f; 222 - 223 - if (priv->sleep_mode == SLP_SLEEP) 224 - return -EPERM; 225 - 226 - /* for SLEEP MODE */ 227 - if (is_connect_status(priv->connect_status)) 228 - f = (int)priv->current_ap.channel; 229 - else 230 - f = (int)priv->reg.channel; 231 - 232 - fwrq->freq.m = frequency_list[f - 1] * 100000; 233 - fwrq->freq.e = 1; 234 - 235 - return 0; 236 - } 237 - 238 - static int ks_wlan_set_essid(struct net_device *dev, 239 - struct iw_request_info *info, 240 - union iwreq_data *dwrq, char *extra) 241 - { 242 - struct ks_wlan_private *priv = netdev_priv(dev); 243 - size_t len; 244 - 245 - if (priv->sleep_mode == SLP_SLEEP) 246 - return -EPERM; 247 - 248 - /* for SLEEP MODE */ 249 - /* Check if we asked for `any' */ 250 - if (!dwrq->essid.flags) { 251 - /* Just send an empty SSID list */ 252 - memset(priv->reg.ssid.body, 0, sizeof(priv->reg.ssid.body)); 253 - priv->reg.ssid.size = 0; 254 - } else { 255 - len = dwrq->essid.length; 256 - /* iwconfig uses nul termination in SSID.. */ 257 - if (len > 0 && extra[len - 1] == '\0') 258 - len--; 259 - 260 - /* Check the size of the string */ 261 - if (len > IW_ESSID_MAX_SIZE) 262 - return -EINVAL; 263 - 264 - /* Set the SSID */ 265 - memset(priv->reg.ssid.body, 0, sizeof(priv->reg.ssid.body)); 266 - memcpy(priv->reg.ssid.body, extra, len); 267 - priv->reg.ssid.size = len; 268 - } 269 - /* Write it to the card */ 270 - priv->need_commit |= SME_MODE_SET; 271 - 272 - ks_wlan_setup_parameter(priv, priv->need_commit); 273 - priv->need_commit = 0; 274 - return 0; 275 - } 276 - 277 - static int ks_wlan_get_essid(struct net_device *dev, 278 - struct iw_request_info *info, 279 - union iwreq_data *dwrq, char *extra) 280 - { 281 - struct ks_wlan_private *priv = netdev_priv(dev); 282 - 283 - if (priv->sleep_mode == SLP_SLEEP) 284 - return -EPERM; 285 - 286 - /* for SLEEP MODE */ 287 - /* Note : if dwrq->flags != 0, we should 288 - * get the relevant SSID from the SSID list... 289 - */ 290 - if (priv->reg.ssid.size != 0) { 291 - /* Get the current SSID */ 292 - memcpy(extra, priv->reg.ssid.body, priv->reg.ssid.size); 293 - 294 - /* If none, we may want to get the one that was set */ 295 - 296 - /* Push it out ! */ 297 - dwrq->essid.length = priv->reg.ssid.size; 298 - dwrq->essid.flags = 1; /* active */ 299 - } else { 300 - dwrq->essid.length = 0; 301 - dwrq->essid.flags = 0; /* ANY */ 302 - } 303 - 304 - return 0; 305 - } 306 - 307 - static int ks_wlan_set_wap(struct net_device *dev, struct iw_request_info *info, 308 - union iwreq_data *awrq, char *extra) 309 - { 310 - struct ks_wlan_private *priv = netdev_priv(dev); 311 - 312 - if (priv->sleep_mode == SLP_SLEEP) 313 - return -EPERM; 314 - 315 - /* for SLEEP MODE */ 316 - if (priv->reg.operation_mode != MODE_ADHOC && 317 - priv->reg.operation_mode != MODE_INFRASTRUCTURE) { 318 - eth_zero_addr(priv->reg.bssid); 319 - return -EOPNOTSUPP; 320 - } 321 - 322 - ether_addr_copy(priv->reg.bssid, awrq->ap_addr.sa_data); 323 - if (is_valid_ether_addr((u8 *)priv->reg.bssid)) 324 - priv->need_commit |= SME_MODE_SET; 325 - 326 - netdev_dbg(dev, "bssid = %pM\n", priv->reg.bssid); 327 - 328 - /* Write it to the card */ 329 - if (priv->need_commit) { 330 - priv->need_commit |= SME_MODE_SET; 331 - return -EINPROGRESS; /* Call commit handler */ 332 - } 333 - return 0; 334 - } 335 - 336 - static int ks_wlan_get_wap(struct net_device *dev, struct iw_request_info *info, 337 - union iwreq_data *awrq, char *extra) 338 - { 339 - struct ks_wlan_private *priv = netdev_priv(dev); 340 - 341 - if (priv->sleep_mode == SLP_SLEEP) 342 - return -EPERM; 343 - 344 - /* for SLEEP MODE */ 345 - if (is_connect_status(priv->connect_status)) 346 - ether_addr_copy(awrq->ap_addr.sa_data, priv->current_ap.bssid); 347 - else 348 - eth_zero_addr(awrq->ap_addr.sa_data); 349 - 350 - awrq->ap_addr.sa_family = ARPHRD_ETHER; 351 - 352 - return 0; 353 - } 354 - 355 - static int ks_wlan_set_nick(struct net_device *dev, 356 - struct iw_request_info *info, 357 - union iwreq_data *dwrq, char *extra) 358 - { 359 - struct ks_wlan_private *priv = netdev_priv(dev); 360 - 361 - if (priv->sleep_mode == SLP_SLEEP) 362 - return -EPERM; 363 - 364 - /* for SLEEP MODE */ 365 - /* Check the size of the string */ 366 - if (dwrq->data.length > 16 + 1) 367 - return -E2BIG; 368 - 369 - memset(priv->nick, 0, sizeof(priv->nick)); 370 - memcpy(priv->nick, extra, dwrq->data.length); 371 - 372 - return -EINPROGRESS; /* Call commit handler */ 373 - } 374 - 375 - static int ks_wlan_get_nick(struct net_device *dev, 376 - struct iw_request_info *info, 377 - union iwreq_data *dwrq, char *extra) 378 - { 379 - struct ks_wlan_private *priv = netdev_priv(dev); 380 - 381 - if (priv->sleep_mode == SLP_SLEEP) 382 - return -EPERM; 383 - 384 - /* for SLEEP MODE */ 385 - strscpy(extra, priv->nick, 17); 386 - dwrq->data.length = strlen(extra) + 1; 387 - 388 - return 0; 389 - } 390 - 391 - static int ks_wlan_set_rate(struct net_device *dev, 392 - struct iw_request_info *info, 393 - union iwreq_data *vwrq, char *extra) 394 - { 395 - struct ks_wlan_private *priv = netdev_priv(dev); 396 - int i = 0; 397 - 398 - if (priv->sleep_mode == SLP_SLEEP) 399 - return -EPERM; 400 - 401 - /* for SLEEP MODE */ 402 - if (priv->reg.phy_type == D_11B_ONLY_MODE) { 403 - if (vwrq->bitrate.fixed == 1) { 404 - switch (vwrq->bitrate.value) { 405 - case 11000000: 406 - case 5500000: 407 - priv->reg.rate_set.body[0] = 408 - (u8)(vwrq->bitrate.value / 500000); 409 - break; 410 - case 2000000: 411 - case 1000000: 412 - priv->reg.rate_set.body[0] = 413 - ((u8)(vwrq->bitrate.value / 500000)) | 414 - BASIC_RATE; 415 - break; 416 - default: 417 - return -EINVAL; 418 - } 419 - priv->reg.tx_rate = TX_RATE_FIXED; 420 - priv->reg.rate_set.size = 1; 421 - } else { /* vwrq->fixed == 0 */ 422 - if (vwrq->bitrate.value > 0) { 423 - switch (vwrq->bitrate.value) { 424 - case 11000000: 425 - priv->reg.rate_set.body[3] = 426 - TX_RATE_11M; 427 - i++; 428 - fallthrough; 429 - case 5500000: 430 - priv->reg.rate_set.body[2] = TX_RATE_5M; 431 - i++; 432 - fallthrough; 433 - case 2000000: 434 - priv->reg.rate_set.body[1] = 435 - TX_RATE_2M | BASIC_RATE; 436 - i++; 437 - fallthrough; 438 - case 1000000: 439 - priv->reg.rate_set.body[0] = 440 - TX_RATE_1M | BASIC_RATE; 441 - i++; 442 - break; 443 - default: 444 - return -EINVAL; 445 - } 446 - priv->reg.tx_rate = TX_RATE_MANUAL_AUTO; 447 - priv->reg.rate_set.size = i; 448 - } else { 449 - priv->reg.rate_set.body[3] = TX_RATE_11M; 450 - priv->reg.rate_set.body[2] = TX_RATE_5M; 451 - priv->reg.rate_set.body[1] = 452 - TX_RATE_2M | BASIC_RATE; 453 - priv->reg.rate_set.body[0] = 454 - TX_RATE_1M | BASIC_RATE; 455 - priv->reg.tx_rate = TX_RATE_FULL_AUTO; 456 - priv->reg.rate_set.size = 4; 457 - } 458 - } 459 - } else { /* D_11B_ONLY_MODE or D_11BG_COMPATIBLE_MODE */ 460 - if (vwrq->bitrate.fixed == 1) { 461 - switch (vwrq->bitrate.value) { 462 - case 54000000: 463 - case 48000000: 464 - case 36000000: 465 - case 18000000: 466 - case 9000000: 467 - priv->reg.rate_set.body[0] = 468 - (u8)(vwrq->bitrate.value / 500000); 469 - break; 470 - case 24000000: 471 - case 12000000: 472 - case 11000000: 473 - case 6000000: 474 - case 5500000: 475 - case 2000000: 476 - case 1000000: 477 - priv->reg.rate_set.body[0] = 478 - ((u8)(vwrq->bitrate.value / 500000)) | 479 - BASIC_RATE; 480 - break; 481 - default: 482 - return -EINVAL; 483 - } 484 - priv->reg.tx_rate = TX_RATE_FIXED; 485 - priv->reg.rate_set.size = 1; 486 - } else { /* vwrq->fixed == 0 */ 487 - if (vwrq->bitrate.value > 0) { 488 - switch (vwrq->bitrate.value) { 489 - case 54000000: 490 - priv->reg.rate_set.body[11] = 491 - TX_RATE_54M; 492 - i++; 493 - fallthrough; 494 - case 48000000: 495 - priv->reg.rate_set.body[10] = 496 - TX_RATE_48M; 497 - i++; 498 - fallthrough; 499 - case 36000000: 500 - priv->reg.rate_set.body[9] = 501 - TX_RATE_36M; 502 - i++; 503 - fallthrough; 504 - case 24000000: 505 - case 18000000: 506 - case 12000000: 507 - case 11000000: 508 - case 9000000: 509 - case 6000000: 510 - if (vwrq->bitrate.value == 24000000) { 511 - priv->reg.rate_set.body[8] = 512 - TX_RATE_18M; 513 - i++; 514 - priv->reg.rate_set.body[7] = 515 - TX_RATE_9M; 516 - i++; 517 - priv->reg.rate_set.body[6] = 518 - TX_RATE_24M | BASIC_RATE; 519 - i++; 520 - priv->reg.rate_set.body[5] = 521 - TX_RATE_12M | BASIC_RATE; 522 - i++; 523 - priv->reg.rate_set.body[4] = 524 - TX_RATE_6M | BASIC_RATE; 525 - i++; 526 - priv->reg.rate_set.body[3] = 527 - TX_RATE_11M | BASIC_RATE; 528 - i++; 529 - } else if (vwrq->bitrate.value == 18000000) { 530 - priv->reg.rate_set.body[7] = 531 - TX_RATE_18M; 532 - i++; 533 - priv->reg.rate_set.body[6] = 534 - TX_RATE_9M; 535 - i++; 536 - priv->reg.rate_set.body[5] = 537 - TX_RATE_12M | BASIC_RATE; 538 - i++; 539 - priv->reg.rate_set.body[4] = 540 - TX_RATE_6M | BASIC_RATE; 541 - i++; 542 - priv->reg.rate_set.body[3] = 543 - TX_RATE_11M | BASIC_RATE; 544 - i++; 545 - } else if (vwrq->bitrate.value == 12000000) { 546 - priv->reg.rate_set.body[6] = 547 - TX_RATE_9M; 548 - i++; 549 - priv->reg.rate_set.body[5] = 550 - TX_RATE_12M | BASIC_RATE; 551 - i++; 552 - priv->reg.rate_set.body[4] = 553 - TX_RATE_6M | BASIC_RATE; 554 - i++; 555 - priv->reg.rate_set.body[3] = 556 - TX_RATE_11M | BASIC_RATE; 557 - i++; 558 - } else if (vwrq->bitrate.value == 11000000) { 559 - priv->reg.rate_set.body[5] = 560 - TX_RATE_9M; 561 - i++; 562 - priv->reg.rate_set.body[4] = 563 - TX_RATE_6M | BASIC_RATE; 564 - i++; 565 - priv->reg.rate_set.body[3] = 566 - TX_RATE_11M | BASIC_RATE; 567 - i++; 568 - } else if (vwrq->bitrate.value == 9000000) { 569 - priv->reg.rate_set.body[4] = 570 - TX_RATE_9M; 571 - i++; 572 - priv->reg.rate_set.body[3] = 573 - TX_RATE_6M | BASIC_RATE; 574 - i++; 575 - } else { /* vwrq->value == 6000000 */ 576 - priv->reg.rate_set.body[3] = 577 - TX_RATE_6M | BASIC_RATE; 578 - i++; 579 - } 580 - fallthrough; 581 - case 5500000: 582 - priv->reg.rate_set.body[2] = 583 - TX_RATE_5M | BASIC_RATE; 584 - i++; 585 - fallthrough; 586 - case 2000000: 587 - priv->reg.rate_set.body[1] = 588 - TX_RATE_2M | BASIC_RATE; 589 - i++; 590 - fallthrough; 591 - case 1000000: 592 - priv->reg.rate_set.body[0] = 593 - TX_RATE_1M | BASIC_RATE; 594 - i++; 595 - break; 596 - default: 597 - return -EINVAL; 598 - } 599 - priv->reg.tx_rate = TX_RATE_MANUAL_AUTO; 600 - priv->reg.rate_set.size = i; 601 - } else { 602 - priv->reg.rate_set.body[11] = TX_RATE_54M; 603 - priv->reg.rate_set.body[10] = TX_RATE_48M; 604 - priv->reg.rate_set.body[9] = TX_RATE_36M; 605 - priv->reg.rate_set.body[8] = TX_RATE_18M; 606 - priv->reg.rate_set.body[7] = TX_RATE_9M; 607 - priv->reg.rate_set.body[6] = 608 - TX_RATE_24M | BASIC_RATE; 609 - priv->reg.rate_set.body[5] = 610 - TX_RATE_12M | BASIC_RATE; 611 - priv->reg.rate_set.body[4] = 612 - TX_RATE_6M | BASIC_RATE; 613 - priv->reg.rate_set.body[3] = 614 - TX_RATE_11M | BASIC_RATE; 615 - priv->reg.rate_set.body[2] = 616 - TX_RATE_5M | BASIC_RATE; 617 - priv->reg.rate_set.body[1] = 618 - TX_RATE_2M | BASIC_RATE; 619 - priv->reg.rate_set.body[0] = 620 - TX_RATE_1M | BASIC_RATE; 621 - priv->reg.tx_rate = TX_RATE_FULL_AUTO; 622 - priv->reg.rate_set.size = 12; 623 - } 624 - } 625 - } 626 - 627 - priv->need_commit |= SME_MODE_SET; 628 - 629 - return -EINPROGRESS; /* Call commit handler */ 630 - } 631 - 632 - static int ks_wlan_get_rate(struct net_device *dev, 633 - struct iw_request_info *info, 634 - union iwreq_data *vwrq, char *extra) 635 - { 636 - struct ks_wlan_private *priv = netdev_priv(dev); 637 - 638 - netdev_dbg(dev, "in_interrupt = %ld update_phyinfo = %d\n", 639 - in_interrupt(), atomic_read(&update_phyinfo)); 640 - 641 - if (priv->sleep_mode == SLP_SLEEP) 642 - return -EPERM; 643 - 644 - /* for SLEEP MODE */ 645 - if (!atomic_read(&update_phyinfo)) 646 - ks_wlan_update_phy_information(priv); 647 - 648 - vwrq->bitrate.value = ((priv->current_rate) & RATE_MASK) * 500000; 649 - vwrq->bitrate.fixed = (priv->reg.tx_rate == TX_RATE_FIXED) ? 1 : 0; 650 - 651 - return 0; 652 - } 653 - 654 - static int ks_wlan_set_rts(struct net_device *dev, struct iw_request_info *info, 655 - union iwreq_data *vwrq, char *extra) 656 - { 657 - struct ks_wlan_private *priv = netdev_priv(dev); 658 - int rthr = vwrq->rts.value; 659 - 660 - if (priv->sleep_mode == SLP_SLEEP) 661 - return -EPERM; 662 - 663 - /* for SLEEP MODE */ 664 - if (vwrq->rts.disabled) 665 - rthr = 2347; 666 - if ((rthr < 0) || (rthr > 2347)) 667 - return -EINVAL; 668 - 669 - priv->reg.rts = rthr; 670 - priv->need_commit |= SME_RTS; 671 - 672 - return -EINPROGRESS; /* Call commit handler */ 673 - } 674 - 675 - static int ks_wlan_get_rts(struct net_device *dev, struct iw_request_info *info, 676 - union iwreq_data *vwrq, char *extra) 677 - { 678 - struct ks_wlan_private *priv = netdev_priv(dev); 679 - 680 - if (priv->sleep_mode == SLP_SLEEP) 681 - return -EPERM; 682 - 683 - /* for SLEEP MODE */ 684 - vwrq->rts.value = priv->reg.rts; 685 - vwrq->rts.disabled = (vwrq->rts.value >= 2347); 686 - vwrq->rts.fixed = 1; 687 - 688 - return 0; 689 - } 690 - 691 - static int ks_wlan_set_frag(struct net_device *dev, 692 - struct iw_request_info *info, 693 - union iwreq_data *vwrq, char *extra) 694 - { 695 - struct ks_wlan_private *priv = netdev_priv(dev); 696 - int fthr = vwrq->frag.value; 697 - 698 - if (priv->sleep_mode == SLP_SLEEP) 699 - return -EPERM; 700 - 701 - /* for SLEEP MODE */ 702 - if (vwrq->frag.disabled) 703 - fthr = 2346; 704 - if ((fthr < 256) || (fthr > 2346)) 705 - return -EINVAL; 706 - 707 - fthr &= ~0x1; /* Get an even value - is it really needed ??? */ 708 - priv->reg.fragment = fthr; 709 - priv->need_commit |= SME_FRAG; 710 - 711 - return -EINPROGRESS; /* Call commit handler */ 712 - } 713 - 714 - static int ks_wlan_get_frag(struct net_device *dev, 715 - struct iw_request_info *info, 716 - union iwreq_data *vwrq, char *extra) 717 - { 718 - struct ks_wlan_private *priv = netdev_priv(dev); 719 - 720 - if (priv->sleep_mode == SLP_SLEEP) 721 - return -EPERM; 722 - 723 - /* for SLEEP MODE */ 724 - vwrq->frag.value = priv->reg.fragment; 725 - vwrq->frag.disabled = (vwrq->frag.value >= 2346); 726 - vwrq->frag.fixed = 1; 727 - 728 - return 0; 729 - } 730 - 731 - static int ks_wlan_set_mode(struct net_device *dev, 732 - struct iw_request_info *info, 733 - union iwreq_data *uwrq, char *extra) 734 - { 735 - struct ks_wlan_private *priv = netdev_priv(dev); 736 - 737 - if (priv->sleep_mode == SLP_SLEEP) 738 - return -EPERM; 739 - 740 - if (uwrq->mode != IW_MODE_ADHOC && 741 - uwrq->mode != IW_MODE_INFRA) 742 - return -EINVAL; 743 - 744 - priv->reg.operation_mode = (uwrq->mode == IW_MODE_ADHOC) ? 745 - MODE_ADHOC : MODE_INFRASTRUCTURE; 746 - priv->need_commit |= SME_MODE_SET; 747 - 748 - return -EINPROGRESS; /* Call commit handler */ 749 - } 750 - 751 - static int ks_wlan_get_mode(struct net_device *dev, 752 - struct iw_request_info *info, 753 - union iwreq_data *uwrq, char *extra) 754 - { 755 - struct ks_wlan_private *priv = netdev_priv(dev); 756 - 757 - if (priv->sleep_mode == SLP_SLEEP) 758 - return -EPERM; 759 - 760 - /* If not managed, assume it's ad-hoc */ 761 - uwrq->mode = (priv->reg.operation_mode == MODE_INFRASTRUCTURE) ? 762 - IW_MODE_INFRA : IW_MODE_ADHOC; 763 - 764 - return 0; 765 - } 766 - 767 - static int ks_wlan_set_encode(struct net_device *dev, 768 - struct iw_request_info *info, 769 - union iwreq_data *dwrq, char *extra) 770 - { 771 - struct ks_wlan_private *priv = netdev_priv(dev); 772 - struct iw_point *enc = &dwrq->encoding; 773 - struct wep_key key; 774 - int index = (enc->flags & IW_ENCODE_INDEX); 775 - 776 - if (priv->sleep_mode == SLP_SLEEP) 777 - return -EPERM; 778 - 779 - if (enc->length > MAX_KEY_SIZE) 780 - return -EINVAL; 781 - 782 - /* for SLEEP MODE */ 783 - if ((index < 0) || (index > 4)) 784 - return -EINVAL; 785 - 786 - index = (index == 0) ? priv->reg.wep_index : (index - 1); 787 - 788 - /* Is WEP supported ? */ 789 - /* Basic checking: do we have a key to set ? */ 790 - if (enc->length > 0) { 791 - key.len = (enc->length > MIN_KEY_SIZE) ? 792 - MAX_KEY_SIZE : MIN_KEY_SIZE; 793 - priv->reg.privacy_invoked = 0x01; 794 - priv->need_commit |= SME_WEP_FLAG; 795 - wep_on_off = (enc->length > MIN_KEY_SIZE) ? 796 - WEP_ON_128BIT : WEP_ON_64BIT; 797 - /* Check if the key is not marked as invalid */ 798 - if (enc->flags & IW_ENCODE_NOKEY) 799 - return 0; 800 - 801 - /* Cleanup */ 802 - memset(key.key, 0, MAX_KEY_SIZE); 803 - /* Copy the key in the driver */ 804 - if (copy_from_user(key.key, enc->pointer, enc->length)) { 805 - key.len = 0; 806 - return -EFAULT; 807 - } 808 - /* Send the key to the card */ 809 - priv->reg.wep_key[index].size = key.len; 810 - memcpy(&priv->reg.wep_key[index].val[0], &key.key[0], 811 - priv->reg.wep_key[index].size); 812 - priv->need_commit |= (SME_WEP_VAL1 << index); 813 - priv->reg.wep_index = index; 814 - priv->need_commit |= SME_WEP_INDEX; 815 - } else { 816 - if (enc->flags & IW_ENCODE_DISABLED) { 817 - priv->reg.wep_key[0].size = 0; 818 - priv->reg.wep_key[1].size = 0; 819 - priv->reg.wep_key[2].size = 0; 820 - priv->reg.wep_key[3].size = 0; 821 - priv->reg.privacy_invoked = 0x00; 822 - if (priv->reg.authenticate_type == AUTH_TYPE_SHARED_KEY) 823 - priv->need_commit |= SME_MODE_SET; 824 - 825 - priv->reg.authenticate_type = AUTH_TYPE_OPEN_SYSTEM; 826 - wep_on_off = WEP_OFF; 827 - priv->need_commit |= SME_WEP_FLAG; 828 - } else { 829 - /* set_wep_key(priv, index, 0, 0, 1); xxx */ 830 - if (priv->reg.wep_key[index].size == 0) 831 - return -EINVAL; 832 - priv->reg.wep_index = index; 833 - priv->need_commit |= SME_WEP_INDEX; 834 - } 835 - } 836 - 837 - /* Commit the changes if needed */ 838 - if (enc->flags & IW_ENCODE_MODE) 839 - priv->need_commit |= SME_WEP_FLAG; 840 - 841 - if (enc->flags & IW_ENCODE_OPEN) { 842 - if (priv->reg.authenticate_type == AUTH_TYPE_SHARED_KEY) 843 - priv->need_commit |= SME_MODE_SET; 844 - 845 - priv->reg.authenticate_type = AUTH_TYPE_OPEN_SYSTEM; 846 - } else if (enc->flags & IW_ENCODE_RESTRICTED) { 847 - if (priv->reg.authenticate_type == AUTH_TYPE_OPEN_SYSTEM) 848 - priv->need_commit |= SME_MODE_SET; 849 - 850 - priv->reg.authenticate_type = AUTH_TYPE_SHARED_KEY; 851 - } 852 - if (priv->need_commit) { 853 - ks_wlan_setup_parameter(priv, priv->need_commit); 854 - priv->need_commit = 0; 855 - } 856 - return 0; 857 - } 858 - 859 - static int ks_wlan_get_encode(struct net_device *dev, 860 - struct iw_request_info *info, 861 - union iwreq_data *dwrq, char *extra) 862 - { 863 - struct ks_wlan_private *priv = netdev_priv(dev); 864 - struct iw_point *enc = &dwrq->encoding; 865 - int index = (enc->flags & IW_ENCODE_INDEX) - 1; 866 - 867 - if (priv->sleep_mode == SLP_SLEEP) 868 - return -EPERM; 869 - 870 - /* for SLEEP MODE */ 871 - enc->flags = IW_ENCODE_DISABLED; 872 - 873 - /* Check encryption mode */ 874 - switch (priv->reg.authenticate_type) { 875 - case AUTH_TYPE_OPEN_SYSTEM: 876 - enc->flags = IW_ENCODE_OPEN; 877 - break; 878 - case AUTH_TYPE_SHARED_KEY: 879 - enc->flags = IW_ENCODE_RESTRICTED; 880 - break; 881 - } 882 - 883 - /* Which key do we want ? -1 -> tx index */ 884 - if ((index < 0) || (index >= 4)) 885 - index = priv->reg.wep_index; 886 - if (priv->reg.privacy_invoked) { 887 - enc->flags &= ~IW_ENCODE_DISABLED; 888 - /* dwrq->flags |= IW_ENCODE_NOKEY; */ 889 - } 890 - enc->flags |= index + 1; 891 - /* Copy the key to the user buffer */ 892 - if (index >= 0 && index < 4) { 893 - enc->length = (priv->reg.wep_key[index].size <= 16) ? 894 - priv->reg.wep_key[index].size : 0; 895 - memcpy(extra, priv->reg.wep_key[index].val, enc->length); 896 - } 897 - 898 - return 0; 899 - } 900 - 901 - static int ks_wlan_get_range(struct net_device *dev, 902 - struct iw_request_info *info, 903 - union iwreq_data *dwrq, char *extra) 904 - { 905 - struct ks_wlan_private *priv = netdev_priv(dev); 906 - struct iw_range *range = (struct iw_range *)extra; 907 - int i, k; 908 - 909 - if (priv->sleep_mode == SLP_SLEEP) 910 - return -EPERM; 911 - 912 - /* for SLEEP MODE */ 913 - dwrq->data.length = sizeof(struct iw_range); 914 - memset(range, 0, sizeof(*range)); 915 - range->min_nwid = 0x0000; 916 - range->max_nwid = 0x0000; 917 - range->num_channels = 14; 918 - /* Should be based on cap_rid.country to give only 919 - * what the current card support 920 - */ 921 - k = 0; 922 - for (i = 0; i < 13; i++) { /* channel 1 -- 13 */ 923 - range->freq[k].i = i + 1; /* List index */ 924 - range->freq[k].m = frequency_list[i] * 100000; 925 - range->freq[k++].e = 1; /* Values in table in MHz -> * 10^5 * 10 */ 926 - } 927 - range->num_frequency = k; 928 - if (priv->reg.phy_type == D_11B_ONLY_MODE || 929 - priv->reg.phy_type == D_11BG_COMPATIBLE_MODE) { /* channel 14 */ 930 - range->freq[13].i = 14; /* List index */ 931 - range->freq[13].m = frequency_list[13] * 100000; 932 - range->freq[13].e = 1; /* Values in table in MHz -> * 10^5 * 10 */ 933 - range->num_frequency = 14; 934 - } 935 - 936 - /* Hum... Should put the right values there */ 937 - range->max_qual.qual = 100; 938 - range->max_qual.level = 256 - 128; /* 0 dBm? */ 939 - range->max_qual.noise = 256 - 128; 940 - range->sensitivity = 1; 941 - 942 - if (priv->reg.phy_type == D_11B_ONLY_MODE) { 943 - range->bitrate[0] = 1e6; 944 - range->bitrate[1] = 2e6; 945 - range->bitrate[2] = 5.5e6; 946 - range->bitrate[3] = 11e6; 947 - range->num_bitrates = 4; 948 - } else { /* D_11G_ONLY_MODE or D_11BG_COMPATIBLE_MODE */ 949 - range->bitrate[0] = 1e6; 950 - range->bitrate[1] = 2e6; 951 - range->bitrate[2] = 5.5e6; 952 - range->bitrate[3] = 11e6; 953 - 954 - range->bitrate[4] = 6e6; 955 - range->bitrate[5] = 9e6; 956 - range->bitrate[6] = 12e6; 957 - if (IW_MAX_BITRATES < 9) { 958 - range->bitrate[7] = 54e6; 959 - range->num_bitrates = 8; 960 - } else { 961 - range->bitrate[7] = 18e6; 962 - range->bitrate[8] = 24e6; 963 - range->bitrate[9] = 36e6; 964 - range->bitrate[10] = 48e6; 965 - range->bitrate[11] = 54e6; 966 - 967 - range->num_bitrates = 12; 968 - } 969 - } 970 - 971 - /* Set an indication of the max TCP throughput 972 - * in bit/s that we can expect using this interface. 973 - * May be use for QoS stuff... Jean II 974 - */ 975 - if (i > 2) 976 - range->throughput = 5000 * 1000; 977 - else 978 - range->throughput = 1500 * 1000; 979 - 980 - range->min_rts = 0; 981 - range->max_rts = 2347; 982 - range->min_frag = 256; 983 - range->max_frag = 2346; 984 - 985 - range->encoding_size[0] = 5; /* WEP: RC4 40 bits */ 986 - range->encoding_size[1] = 13; /* WEP: RC4 ~128 bits */ 987 - range->num_encoding_sizes = 2; 988 - range->max_encoding_tokens = 4; 989 - 990 - /* power management not support */ 991 - range->pmp_flags = IW_POWER_ON; 992 - range->pmt_flags = IW_POWER_ON; 993 - range->pm_capa = 0; 994 - 995 - /* Transmit Power - values are in dBm( or mW) */ 996 - range->txpower[0] = -256; 997 - range->num_txpower = 1; 998 - range->txpower_capa = IW_TXPOW_DBM; 999 - /* range->txpower_capa = IW_TXPOW_MWATT; */ 1000 - 1001 - range->we_version_source = 21; 1002 - range->we_version_compiled = WIRELESS_EXT; 1003 - 1004 - range->retry_capa = IW_RETRY_ON; 1005 - range->retry_flags = IW_RETRY_ON; 1006 - range->r_time_flags = IW_RETRY_ON; 1007 - 1008 - /* Experimental measurements - boundary 11/5.5 Mb/s 1009 - * 1010 - * Note : with or without the (local->rssi), results 1011 - * are somewhat different. - Jean II 1012 - */ 1013 - range->avg_qual.qual = 50; 1014 - range->avg_qual.level = 186; /* -70 dBm */ 1015 - range->avg_qual.noise = 0; 1016 - 1017 - /* Event capability (kernel + driver) */ 1018 - range->event_capa[0] = (IW_EVENT_CAPA_K_0 | 1019 - IW_EVENT_CAPA_MASK(SIOCGIWAP) | 1020 - IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); 1021 - range->event_capa[1] = IW_EVENT_CAPA_K_1; 1022 - range->event_capa[4] = (IW_EVENT_CAPA_MASK(IWEVCUSTOM) | 1023 - IW_EVENT_CAPA_MASK(IWEVMICHAELMICFAILURE)); 1024 - 1025 - /* encode extension (WPA) capability */ 1026 - range->enc_capa = (IW_ENC_CAPA_WPA | 1027 - IW_ENC_CAPA_WPA2 | 1028 - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP); 1029 - return 0; 1030 - } 1031 - 1032 - static int ks_wlan_set_power(struct net_device *dev, 1033 - struct iw_request_info *info, 1034 - union iwreq_data *vwrq, char *extra) 1035 - { 1036 - struct ks_wlan_private *priv = netdev_priv(dev); 1037 - 1038 - if (priv->sleep_mode == SLP_SLEEP) 1039 - return -EPERM; 1040 - 1041 - if (vwrq->power.disabled) { 1042 - priv->reg.power_mgmt = POWER_MGMT_ACTIVE; 1043 - } else { 1044 - if (priv->reg.operation_mode != MODE_INFRASTRUCTURE) 1045 - return -EINVAL; 1046 - priv->reg.power_mgmt = POWER_MGMT_SAVE1; 1047 - } 1048 - 1049 - hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST); 1050 - 1051 - return 0; 1052 - } 1053 - 1054 - static int ks_wlan_get_power(struct net_device *dev, 1055 - struct iw_request_info *info, 1056 - union iwreq_data *vwrq, char *extra) 1057 - { 1058 - struct ks_wlan_private *priv = netdev_priv(dev); 1059 - 1060 - if (priv->sleep_mode == SLP_SLEEP) 1061 - return -EPERM; 1062 - /* for SLEEP MODE */ 1063 - vwrq->power.disabled = (priv->reg.power_mgmt <= 0); 1064 - 1065 - return 0; 1066 - } 1067 - 1068 - static int ks_wlan_get_iwstats(struct net_device *dev, 1069 - struct iw_request_info *info, 1070 - union iwreq_data *vwrq, char *extra) 1071 - { 1072 - struct ks_wlan_private *priv = netdev_priv(dev); 1073 - 1074 - if (priv->sleep_mode == SLP_SLEEP) 1075 - return -EPERM; 1076 - /* for SLEEP MODE */ 1077 - vwrq->qual.qual = 0; /* not supported */ 1078 - vwrq->qual.level = priv->wstats.qual.level; 1079 - vwrq->qual.noise = 0; /* not supported */ 1080 - vwrq->qual.updated = 0; 1081 - 1082 - return 0; 1083 - } 1084 - 1085 - /* Note : this is deprecated in favor of IWSCAN */ 1086 - static int ks_wlan_get_aplist(struct net_device *dev, 1087 - struct iw_request_info *info, 1088 - union iwreq_data *dwrq, char *extra) 1089 - { 1090 - struct ks_wlan_private *priv = netdev_priv(dev); 1091 - struct sockaddr *address = (struct sockaddr *)extra; 1092 - struct iw_quality qual[LOCAL_APLIST_MAX]; 1093 - int i; 1094 - 1095 - if (priv->sleep_mode == SLP_SLEEP) 1096 - return -EPERM; 1097 - /* for SLEEP MODE */ 1098 - for (i = 0; i < priv->aplist.size; i++) { 1099 - ether_addr_copy(address[i].sa_data, priv->aplist.ap[i].bssid); 1100 - address[i].sa_family = ARPHRD_ETHER; 1101 - qual[i].level = 256 - priv->aplist.ap[i].rssi; 1102 - qual[i].qual = priv->aplist.ap[i].sq; 1103 - qual[i].noise = 0; /* invalid noise value */ 1104 - qual[i].updated = 7; 1105 - } 1106 - if (i) { 1107 - dwrq->data.flags = 1; /* Should be define'd */ 1108 - memcpy(extra + sizeof(struct sockaddr) * i, 1109 - &qual, sizeof(struct iw_quality) * i); 1110 - } 1111 - dwrq->data.length = i; 1112 - 1113 - return 0; 1114 - } 1115 - 1116 - static int ks_wlan_set_scan(struct net_device *dev, 1117 - struct iw_request_info *info, 1118 - union iwreq_data *wrqu, char *extra) 1119 - { 1120 - struct ks_wlan_private *priv = netdev_priv(dev); 1121 - struct iw_scan_req *req = NULL; 1122 - int len; 1123 - 1124 - if (priv->sleep_mode == SLP_SLEEP) 1125 - return -EPERM; 1126 - 1127 - /* for SLEEP MODE */ 1128 - /* specified SSID SCAN */ 1129 - if (wrqu->data.length == sizeof(struct iw_scan_req) && 1130 - wrqu->data.flags & IW_SCAN_THIS_ESSID) { 1131 - req = (struct iw_scan_req *)extra; 1132 - len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE); 1133 - priv->scan_ssid_len = len; 1134 - memcpy(priv->scan_ssid, req->essid, len); 1135 - } else { 1136 - priv->scan_ssid_len = 0; 1137 - } 1138 - 1139 - priv->sme_i.sme_flag |= SME_AP_SCAN; 1140 - hostif_sme_enqueue(priv, SME_BSS_SCAN_REQUEST); 1141 - 1142 - /* At this point, just return to the user. */ 1143 - 1144 - return 0; 1145 - } 1146 - 1147 - static char *ks_wlan_add_leader_event(const char *rsn_leader, char *end_buf, 1148 - char *current_ev, struct rsn_ie *rsn, 1149 - struct iw_event *iwe, 1150 - struct iw_request_info *info) 1151 - { 1152 - char buffer[RSN_IE_BODY_MAX * 2 + 30]; 1153 - char *pbuf; 1154 - int i; 1155 - 1156 - pbuf = &buffer[0]; 1157 - memset(iwe, 0, sizeof(*iwe)); 1158 - iwe->cmd = IWEVCUSTOM; 1159 - memcpy(buffer, rsn_leader, sizeof(rsn_leader) - 1); 1160 - iwe->u.data.length += sizeof(rsn_leader) - 1; 1161 - pbuf += sizeof(rsn_leader) - 1; 1162 - pbuf += sprintf(pbuf, "%02x", rsn->id); 1163 - pbuf += sprintf(pbuf, "%02x", rsn->size); 1164 - iwe->u.data.length += 4; 1165 - 1166 - for (i = 0; i < rsn->size; i++) 1167 - pbuf += sprintf(pbuf, "%02x", rsn->body[i]); 1168 - 1169 - iwe->u.data.length += rsn->size * 2; 1170 - 1171 - return iwe_stream_add_point(info, current_ev, end_buf, iwe, &buffer[0]); 1172 - } 1173 - 1174 - /* 1175 - * Translate scan data returned from the card to a card independent 1176 - * format that the Wireless Tools will understand - Jean II 1177 - */ 1178 - static inline char *ks_wlan_translate_scan(struct net_device *dev, 1179 - struct iw_request_info *info, 1180 - char *current_ev, char *end_buf, 1181 - struct local_ap *ap) 1182 - { 1183 - /* struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; */ 1184 - static const char rsn_leader[] = "rsn_ie="; 1185 - static const char wpa_leader[] = "wpa_ie="; 1186 - struct iw_event iwe; /* Temporary buffer */ 1187 - u16 capabilities; 1188 - char *current_val; /* For rates */ 1189 - int i; 1190 - 1191 - /* First entry *MUST* be the AP MAC address */ 1192 - iwe.cmd = SIOCGIWAP; 1193 - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 1194 - ether_addr_copy(iwe.u.ap_addr.sa_data, ap->bssid); 1195 - current_ev = iwe_stream_add_event(info, current_ev, 1196 - end_buf, &iwe, IW_EV_ADDR_LEN); 1197 - 1198 - /* Other entries will be displayed in the order we give them */ 1199 - 1200 - /* Add the ESSID */ 1201 - iwe.u.data.length = ap->ssid.size; 1202 - if (iwe.u.data.length > 32) 1203 - iwe.u.data.length = 32; 1204 - iwe.cmd = SIOCGIWESSID; 1205 - iwe.u.data.flags = 1; 1206 - current_ev = iwe_stream_add_point(info, current_ev, 1207 - end_buf, &iwe, ap->ssid.body); 1208 - 1209 - /* Add mode */ 1210 - iwe.cmd = SIOCGIWMODE; 1211 - capabilities = ap->capability; 1212 - if (capabilities & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) { 1213 - iwe.u.mode = (capabilities & WLAN_CAPABILITY_ESS) ? 1214 - IW_MODE_INFRA : IW_MODE_ADHOC; 1215 - current_ev = iwe_stream_add_event(info, current_ev, 1216 - end_buf, &iwe, IW_EV_UINT_LEN); 1217 - } 1218 - 1219 - /* Add frequency */ 1220 - iwe.cmd = SIOCGIWFREQ; 1221 - iwe.u.freq.m = ap->channel; 1222 - iwe.u.freq.m = frequency_list[iwe.u.freq.m - 1] * 100000; 1223 - iwe.u.freq.e = 1; 1224 - current_ev = iwe_stream_add_event(info, current_ev, 1225 - end_buf, &iwe, IW_EV_FREQ_LEN); 1226 - 1227 - /* Add quality statistics */ 1228 - iwe.cmd = IWEVQUAL; 1229 - iwe.u.qual.level = 256 - ap->rssi; 1230 - iwe.u.qual.qual = ap->sq; 1231 - iwe.u.qual.noise = 0; /* invalid noise value */ 1232 - current_ev = iwe_stream_add_event(info, current_ev, end_buf, 1233 - &iwe, IW_EV_QUAL_LEN); 1234 - 1235 - /* Add encryption capability */ 1236 - iwe.cmd = SIOCGIWENCODE; 1237 - iwe.u.data.flags = (capabilities & WLAN_CAPABILITY_PRIVACY) ? 1238 - (IW_ENCODE_ENABLED | IW_ENCODE_NOKEY) : 1239 - IW_ENCODE_DISABLED; 1240 - iwe.u.data.length = 0; 1241 - current_ev = iwe_stream_add_point(info, current_ev, end_buf, 1242 - &iwe, ap->ssid.body); 1243 - 1244 - /* 1245 - * Rate : stuffing multiple values in a single event 1246 - * require a bit more of magic - Jean II 1247 - */ 1248 - current_val = current_ev + IW_EV_LCP_LEN; 1249 - 1250 - iwe.cmd = SIOCGIWRATE; 1251 - 1252 - /* These two flags are ignored... */ 1253 - iwe.u.bitrate.fixed = 0; 1254 - iwe.u.bitrate.disabled = 0; 1255 - 1256 - /* Max 16 values */ 1257 - for (i = 0; i < 16; i++) { 1258 - /* NULL terminated */ 1259 - if (i >= ap->rate_set.size) 1260 - break; 1261 - /* Bit rate given in 500 kb/s units (+ 0x80) */ 1262 - iwe.u.bitrate.value = ((ap->rate_set.body[i] & 0x7f) * 500000); 1263 - /* Add new value to event */ 1264 - current_val = iwe_stream_add_value(info, current_ev, 1265 - current_val, end_buf, &iwe, 1266 - IW_EV_PARAM_LEN); 1267 - } 1268 - /* Check if we added any event */ 1269 - if ((current_val - current_ev) > IW_EV_LCP_LEN) 1270 - current_ev = current_val; 1271 - 1272 - if (ap->rsn_ie.id == RSN_INFO_ELEM_ID && ap->rsn_ie.size != 0) 1273 - current_ev = ks_wlan_add_leader_event(rsn_leader, end_buf, 1274 - current_ev, &ap->rsn_ie, 1275 - &iwe, info); 1276 - 1277 - if (ap->wpa_ie.id == WPA_INFO_ELEM_ID && ap->wpa_ie.size != 0) 1278 - current_ev = ks_wlan_add_leader_event(wpa_leader, end_buf, 1279 - current_ev, &ap->wpa_ie, 1280 - &iwe, info); 1281 - 1282 - /* 1283 - * The other data in the scan result are not really 1284 - * interesting, so for now drop it - Jean II 1285 - */ 1286 - return current_ev; 1287 - } 1288 - 1289 - static int ks_wlan_get_scan(struct net_device *dev, 1290 - struct iw_request_info *info, 1291 - union iwreq_data *dwrq, char *extra) 1292 - { 1293 - struct ks_wlan_private *priv = netdev_priv(dev); 1294 - int i; 1295 - char *current_ev = extra; 1296 - 1297 - if (priv->sleep_mode == SLP_SLEEP) 1298 - return -EPERM; 1299 - /* for SLEEP MODE */ 1300 - if (priv->sme_i.sme_flag & SME_AP_SCAN) 1301 - return -EAGAIN; 1302 - 1303 - if (priv->aplist.size == 0) { 1304 - /* Client error, no scan results... 1305 - * The caller need to restart the scan. 1306 - */ 1307 - return -ENODATA; 1308 - } 1309 - 1310 - /* Read and parse all entries */ 1311 - for (i = 0; i < priv->aplist.size; i++) { 1312 - if ((extra + dwrq->data.length) - current_ev <= IW_EV_ADDR_LEN) { 1313 - dwrq->data.length = 0; 1314 - return -E2BIG; 1315 - } 1316 - /* Translate to WE format this entry */ 1317 - current_ev = ks_wlan_translate_scan(dev, info, current_ev, 1318 - extra + dwrq->data.length, 1319 - &priv->aplist.ap[i]); 1320 - } 1321 - /* Length of data */ 1322 - dwrq->data.length = (current_ev - extra); 1323 - dwrq->data.flags = 0; 1324 - 1325 - return 0; 1326 - } 1327 - 1328 - /* called after a bunch of SET operations */ 1329 - static int ks_wlan_config_commit(struct net_device *dev, 1330 - struct iw_request_info *info, 1331 - union iwreq_data *zwrq, 1332 - char *extra) 1333 - { 1334 - struct ks_wlan_private *priv = netdev_priv(dev); 1335 - 1336 - if (!priv->need_commit) 1337 - return 0; 1338 - 1339 - ks_wlan_setup_parameter(priv, priv->need_commit); 1340 - priv->need_commit = 0; 1341 - return 0; 1342 - } 1343 - 1344 - /* set association ie params */ 1345 - static int ks_wlan_set_genie(struct net_device *dev, 1346 - struct iw_request_info *info, 1347 - union iwreq_data *dwrq, char *extra) 1348 - { 1349 - struct ks_wlan_private *priv = netdev_priv(dev); 1350 - 1351 - if (priv->sleep_mode == SLP_SLEEP) 1352 - return -EPERM; 1353 - /* for SLEEP MODE */ 1354 - return 0; 1355 - // return -EOPNOTSUPP; 1356 - } 1357 - 1358 - static int ks_wlan_set_auth_mode(struct net_device *dev, 1359 - struct iw_request_info *info, 1360 - union iwreq_data *vwrq, char *extra) 1361 - { 1362 - struct ks_wlan_private *priv = netdev_priv(dev); 1363 - struct iw_param *param = &vwrq->param; 1364 - int index = (param->flags & IW_AUTH_INDEX); 1365 - int value = param->value; 1366 - 1367 - if (priv->sleep_mode == SLP_SLEEP) 1368 - return -EPERM; 1369 - /* for SLEEP MODE */ 1370 - switch (index) { 1371 - case IW_AUTH_WPA_VERSION: /* 0 */ 1372 - switch (value) { 1373 - case IW_AUTH_WPA_VERSION_DISABLED: 1374 - priv->wpa.version = value; 1375 - if (priv->wpa.rsn_enabled) 1376 - priv->wpa.rsn_enabled = false; 1377 - priv->need_commit |= SME_RSN; 1378 - break; 1379 - case IW_AUTH_WPA_VERSION_WPA: 1380 - case IW_AUTH_WPA_VERSION_WPA2: 1381 - priv->wpa.version = value; 1382 - if (!(priv->wpa.rsn_enabled)) 1383 - priv->wpa.rsn_enabled = true; 1384 - priv->need_commit |= SME_RSN; 1385 - break; 1386 - default: 1387 - return -EOPNOTSUPP; 1388 - } 1389 - break; 1390 - case IW_AUTH_CIPHER_PAIRWISE: /* 1 */ 1391 - switch (value) { 1392 - case IW_AUTH_CIPHER_NONE: 1393 - if (priv->reg.privacy_invoked) { 1394 - priv->reg.privacy_invoked = 0x00; 1395 - priv->need_commit |= SME_WEP_FLAG; 1396 - } 1397 - break; 1398 - case IW_AUTH_CIPHER_WEP40: 1399 - case IW_AUTH_CIPHER_TKIP: 1400 - case IW_AUTH_CIPHER_CCMP: 1401 - case IW_AUTH_CIPHER_WEP104: 1402 - if (!priv->reg.privacy_invoked) { 1403 - priv->reg.privacy_invoked = 0x01; 1404 - priv->need_commit |= SME_WEP_FLAG; 1405 - } 1406 - priv->wpa.pairwise_suite = value; 1407 - priv->need_commit |= SME_RSN_UNICAST; 1408 - break; 1409 - default: 1410 - return -EOPNOTSUPP; 1411 - } 1412 - break; 1413 - case IW_AUTH_CIPHER_GROUP: /* 2 */ 1414 - switch (value) { 1415 - case IW_AUTH_CIPHER_NONE: 1416 - if (priv->reg.privacy_invoked) { 1417 - priv->reg.privacy_invoked = 0x00; 1418 - priv->need_commit |= SME_WEP_FLAG; 1419 - } 1420 - break; 1421 - case IW_AUTH_CIPHER_WEP40: 1422 - case IW_AUTH_CIPHER_TKIP: 1423 - case IW_AUTH_CIPHER_CCMP: 1424 - case IW_AUTH_CIPHER_WEP104: 1425 - if (!priv->reg.privacy_invoked) { 1426 - priv->reg.privacy_invoked = 0x01; 1427 - priv->need_commit |= SME_WEP_FLAG; 1428 - } 1429 - priv->wpa.group_suite = value; 1430 - priv->need_commit |= SME_RSN_MULTICAST; 1431 - break; 1432 - default: 1433 - return -EOPNOTSUPP; 1434 - } 1435 - break; 1436 - case IW_AUTH_KEY_MGMT: /* 3 */ 1437 - switch (value) { 1438 - case IW_AUTH_KEY_MGMT_802_1X: 1439 - case IW_AUTH_KEY_MGMT_PSK: 1440 - case 0: /* NONE or 802_1X_NO_WPA */ 1441 - case 4: /* WPA_NONE */ 1442 - priv->wpa.key_mgmt_suite = value; 1443 - priv->need_commit |= SME_RSN_AUTH; 1444 - break; 1445 - default: 1446 - return -EOPNOTSUPP; 1447 - } 1448 - break; 1449 - case IW_AUTH_80211_AUTH_ALG: /* 6 */ 1450 - switch (value) { 1451 - case IW_AUTH_ALG_OPEN_SYSTEM: 1452 - priv->wpa.auth_alg = value; 1453 - priv->reg.authenticate_type = AUTH_TYPE_OPEN_SYSTEM; 1454 - break; 1455 - case IW_AUTH_ALG_SHARED_KEY: 1456 - priv->wpa.auth_alg = value; 1457 - priv->reg.authenticate_type = AUTH_TYPE_SHARED_KEY; 1458 - break; 1459 - case IW_AUTH_ALG_LEAP: 1460 - default: 1461 - return -EOPNOTSUPP; 1462 - } 1463 - priv->need_commit |= SME_MODE_SET; 1464 - break; 1465 - case IW_AUTH_WPA_ENABLED: /* 7 */ 1466 - priv->wpa.wpa_enabled = value; 1467 - break; 1468 - case IW_AUTH_PRIVACY_INVOKED: /* 10 */ 1469 - if ((value && !priv->reg.privacy_invoked) || 1470 - (!value && priv->reg.privacy_invoked)) { 1471 - priv->reg.privacy_invoked = value ? 0x01 : 0x00; 1472 - priv->need_commit |= SME_WEP_FLAG; 1473 - } 1474 - break; 1475 - case IW_AUTH_RX_UNENCRYPTED_EAPOL: /* 4 */ 1476 - case IW_AUTH_TKIP_COUNTERMEASURES: /* 5 */ 1477 - case IW_AUTH_DROP_UNENCRYPTED: /* 8 */ 1478 - case IW_AUTH_ROAMING_CONTROL: /* 9 */ 1479 - default: 1480 - break; 1481 - } 1482 - 1483 - /* return -EINPROGRESS; */ 1484 - if (priv->need_commit) { 1485 - ks_wlan_setup_parameter(priv, priv->need_commit); 1486 - priv->need_commit = 0; 1487 - } 1488 - return 0; 1489 - } 1490 - 1491 - static int ks_wlan_get_auth_mode(struct net_device *dev, 1492 - struct iw_request_info *info, 1493 - union iwreq_data *vwrq, char *extra) 1494 - { 1495 - struct ks_wlan_private *priv = netdev_priv(dev); 1496 - struct iw_param *param = &vwrq->param; 1497 - int index = (param->flags & IW_AUTH_INDEX); 1498 - 1499 - if (priv->sleep_mode == SLP_SLEEP) 1500 - return -EPERM; 1501 - 1502 - /* for SLEEP MODE */ 1503 - /* WPA (not used ?? wpa_supplicant) */ 1504 - switch (index) { 1505 - case IW_AUTH_WPA_VERSION: 1506 - param->value = priv->wpa.version; 1507 - break; 1508 - case IW_AUTH_CIPHER_PAIRWISE: 1509 - param->value = priv->wpa.pairwise_suite; 1510 - break; 1511 - case IW_AUTH_CIPHER_GROUP: 1512 - param->value = priv->wpa.group_suite; 1513 - break; 1514 - case IW_AUTH_KEY_MGMT: 1515 - param->value = priv->wpa.key_mgmt_suite; 1516 - break; 1517 - case IW_AUTH_80211_AUTH_ALG: 1518 - param->value = priv->wpa.auth_alg; 1519 - break; 1520 - case IW_AUTH_WPA_ENABLED: 1521 - param->value = priv->wpa.rsn_enabled; 1522 - break; 1523 - case IW_AUTH_RX_UNENCRYPTED_EAPOL: /* OK??? */ 1524 - case IW_AUTH_TKIP_COUNTERMEASURES: 1525 - case IW_AUTH_DROP_UNENCRYPTED: 1526 - default: 1527 - /* return -EOPNOTSUPP; */ 1528 - break; 1529 - } 1530 - return 0; 1531 - } 1532 - 1533 - /* set encoding token & mode (WPA)*/ 1534 - static int ks_wlan_set_encode_ext(struct net_device *dev, 1535 - struct iw_request_info *info, 1536 - union iwreq_data *dwrq, char *extra) 1537 - { 1538 - struct ks_wlan_private *priv = netdev_priv(dev); 1539 - struct iw_encode_ext *enc; 1540 - int index = dwrq->encoding.flags & IW_ENCODE_INDEX; 1541 - unsigned int commit = 0; 1542 - struct wpa_key *key; 1543 - 1544 - enc = (struct iw_encode_ext *)extra; 1545 - if (!enc) 1546 - return -EINVAL; 1547 - 1548 - if (priv->sleep_mode == SLP_SLEEP) 1549 - return -EPERM; 1550 - 1551 - /* for SLEEP MODE */ 1552 - if (index < 1 || index > 4) 1553 - return -EINVAL; 1554 - index--; 1555 - key = &priv->wpa.key[index]; 1556 - 1557 - if (dwrq->encoding.flags & IW_ENCODE_DISABLED) 1558 - key->key_len = 0; 1559 - 1560 - key->ext_flags = enc->ext_flags; 1561 - if (enc->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { 1562 - priv->wpa.txkey = index; 1563 - commit |= SME_WEP_INDEX; 1564 - } else if (enc->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { 1565 - memcpy(&key->rx_seq[0], &enc->rx_seq[0], IW_ENCODE_SEQ_MAX_SIZE); 1566 - } 1567 - 1568 - ether_addr_copy(&key->addr.sa_data[0], &enc->addr.sa_data[0]); 1569 - 1570 - switch (enc->alg) { 1571 - case IW_ENCODE_ALG_NONE: 1572 - if (priv->reg.privacy_invoked) { 1573 - priv->reg.privacy_invoked = 0x00; 1574 - commit |= SME_WEP_FLAG; 1575 - } 1576 - key->key_len = 0; 1577 - 1578 - break; 1579 - case IW_ENCODE_ALG_WEP: 1580 - case IW_ENCODE_ALG_CCMP: 1581 - if (!priv->reg.privacy_invoked) { 1582 - priv->reg.privacy_invoked = 0x01; 1583 - commit |= SME_WEP_FLAG; 1584 - } 1585 - if (enc->key_len) { 1586 - int key_len = clamp_val(enc->key_len, 0, IW_ENCODING_TOKEN_MAX); 1587 - 1588 - memcpy(&key->key_val[0], &enc->key[0], key_len); 1589 - key->key_len = key_len; 1590 - commit |= (SME_WEP_VAL1 << index); 1591 - } 1592 - break; 1593 - case IW_ENCODE_ALG_TKIP: 1594 - if (!priv->reg.privacy_invoked) { 1595 - priv->reg.privacy_invoked = 0x01; 1596 - commit |= SME_WEP_FLAG; 1597 - } 1598 - if (enc->key_len == 32) { 1599 - memcpy(&key->key_val[0], &enc->key[0], enc->key_len - 16); 1600 - key->key_len = enc->key_len - 16; 1601 - if (priv->wpa.key_mgmt_suite == 4) { /* WPA_NONE */ 1602 - memcpy(&key->tx_mic_key[0], &enc->key[16], 8); 1603 - memcpy(&key->rx_mic_key[0], &enc->key[16], 8); 1604 - } else { 1605 - memcpy(&key->tx_mic_key[0], &enc->key[16], 8); 1606 - memcpy(&key->rx_mic_key[0], &enc->key[24], 8); 1607 - } 1608 - commit |= (SME_WEP_VAL1 << index); 1609 - } 1610 - break; 1611 - default: 1612 - return -EINVAL; 1613 - } 1614 - key->alg = enc->alg; 1615 - 1616 - if (commit) { 1617 - if (commit & SME_WEP_INDEX) 1618 - hostif_sme_enqueue(priv, SME_SET_TXKEY); 1619 - if (commit & SME_WEP_VAL_MASK) 1620 - hostif_sme_enqueue(priv, SME_SET_KEY1 + index); 1621 - if (commit & SME_WEP_FLAG) 1622 - hostif_sme_enqueue(priv, SME_WEP_FLAG_REQUEST); 1623 - } 1624 - 1625 - return 0; 1626 - } 1627 - 1628 - /* get encoding token & mode (WPA)*/ 1629 - static int ks_wlan_get_encode_ext(struct net_device *dev, 1630 - struct iw_request_info *info, 1631 - union iwreq_data *dwrq, char *extra) 1632 - { 1633 - struct ks_wlan_private *priv = netdev_priv(dev); 1634 - 1635 - if (priv->sleep_mode == SLP_SLEEP) 1636 - return -EPERM; 1637 - 1638 - /* for SLEEP MODE */ 1639 - /* WPA (not used ?? wpa_supplicant) 1640 - * struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; 1641 - * struct iw_encode_ext *enc; 1642 - * enc = (struct iw_encode_ext *)extra; 1643 - * int index = dwrq->flags & IW_ENCODE_INDEX; 1644 - * WPA (not used ?? wpa_supplicant) 1645 - */ 1646 - return 0; 1647 - } 1648 - 1649 - static int ks_wlan_set_pmksa(struct net_device *dev, 1650 - struct iw_request_info *info, 1651 - union iwreq_data *dwrq, char *extra) 1652 - { 1653 - struct ks_wlan_private *priv = netdev_priv(dev); 1654 - struct iw_pmksa *pmksa; 1655 - int i; 1656 - struct pmk *pmk; 1657 - struct list_head *ptr; 1658 - 1659 - if (priv->sleep_mode == SLP_SLEEP) 1660 - return -EPERM; 1661 - 1662 - /* for SLEEP MODE */ 1663 - if (!extra) 1664 - return -EINVAL; 1665 - 1666 - pmksa = (struct iw_pmksa *)extra; 1667 - 1668 - switch (pmksa->cmd) { 1669 - case IW_PMKSA_ADD: 1670 - if (list_empty(&priv->pmklist.head)) { 1671 - for (i = 0; i < PMK_LIST_MAX; i++) { 1672 - pmk = &priv->pmklist.pmk[i]; 1673 - if (is_zero_ether_addr(pmk->bssid)) 1674 - break; 1675 - } 1676 - ether_addr_copy(pmk->bssid, pmksa->bssid.sa_data); 1677 - memcpy(pmk->pmkid, pmksa->pmkid, IW_PMKID_LEN); 1678 - list_add(&pmk->list, &priv->pmklist.head); 1679 - priv->pmklist.size++; 1680 - break; 1681 - } 1682 - /* search cache data */ 1683 - list_for_each(ptr, &priv->pmklist.head) { 1684 - pmk = list_entry(ptr, struct pmk, list); 1685 - if (ether_addr_equal(pmksa->bssid.sa_data, pmk->bssid)) { 1686 - memcpy(pmk->pmkid, pmksa->pmkid, IW_PMKID_LEN); 1687 - list_move(&pmk->list, &priv->pmklist.head); 1688 - break; 1689 - } 1690 - } 1691 - /* not find address. */ 1692 - if (ptr != &priv->pmklist.head) 1693 - break; 1694 - /* new cache data */ 1695 - if (priv->pmklist.size < PMK_LIST_MAX) { 1696 - for (i = 0; i < PMK_LIST_MAX; i++) { 1697 - pmk = &priv->pmklist.pmk[i]; 1698 - if (is_zero_ether_addr(pmk->bssid)) 1699 - break; 1700 - } 1701 - ether_addr_copy(pmk->bssid, pmksa->bssid.sa_data); 1702 - memcpy(pmk->pmkid, pmksa->pmkid, IW_PMKID_LEN); 1703 - list_add(&pmk->list, &priv->pmklist.head); 1704 - priv->pmklist.size++; 1705 - } else { /* overwrite old cache data */ 1706 - pmk = list_entry(priv->pmklist.head.prev, struct pmk, 1707 - list); 1708 - ether_addr_copy(pmk->bssid, pmksa->bssid.sa_data); 1709 - memcpy(pmk->pmkid, pmksa->pmkid, IW_PMKID_LEN); 1710 - list_move(&pmk->list, &priv->pmklist.head); 1711 - } 1712 - break; 1713 - case IW_PMKSA_REMOVE: 1714 - if (list_empty(&priv->pmklist.head)) 1715 - return -EINVAL; 1716 - /* search cache data */ 1717 - list_for_each(ptr, &priv->pmklist.head) { 1718 - pmk = list_entry(ptr, struct pmk, list); 1719 - if (ether_addr_equal(pmksa->bssid.sa_data, pmk->bssid)) { 1720 - eth_zero_addr(pmk->bssid); 1721 - memset(pmk->pmkid, 0, IW_PMKID_LEN); 1722 - list_del_init(&pmk->list); 1723 - break; 1724 - } 1725 - } 1726 - /* not find address. */ 1727 - if (ptr == &priv->pmklist.head) 1728 - return 0; 1729 - break; 1730 - case IW_PMKSA_FLUSH: 1731 - memset(&priv->pmklist, 0, sizeof(priv->pmklist)); 1732 - INIT_LIST_HEAD(&priv->pmklist.head); 1733 - for (i = 0; i < PMK_LIST_MAX; i++) 1734 - INIT_LIST_HEAD(&priv->pmklist.pmk[i].list); 1735 - break; 1736 - default: 1737 - return -EINVAL; 1738 - } 1739 - 1740 - hostif_sme_enqueue(priv, SME_SET_PMKSA); 1741 - return 0; 1742 - } 1743 - 1744 - static struct iw_statistics *ks_get_wireless_stats(struct net_device *dev) 1745 - { 1746 - struct ks_wlan_private *priv = netdev_priv(dev); 1747 - struct iw_statistics *wstats = &priv->wstats; 1748 - 1749 - if (!atomic_read(&update_phyinfo)) 1750 - return (priv->dev_state < DEVICE_STATE_READY) ? NULL : wstats; 1751 - 1752 - /* 1753 - * Packets discarded in the wireless adapter due to wireless 1754 - * specific problems 1755 - */ 1756 - wstats->discard.nwid = 0; /* Rx invalid nwid */ 1757 - wstats->discard.code = 0; /* Rx invalid crypt */ 1758 - wstats->discard.fragment = 0; /* Rx invalid frag */ 1759 - wstats->discard.retries = 0; /* Tx excessive retries */ 1760 - wstats->discard.misc = 0; /* Invalid misc */ 1761 - wstats->miss.beacon = 0; /* Missed beacon */ 1762 - 1763 - return wstats; 1764 - } 1765 - 1766 - static int ks_wlan_set_stop_request(struct net_device *dev, 1767 - struct iw_request_info *info, 1768 - union iwreq_data *uwrq, char *extra) 1769 - { 1770 - struct ks_wlan_private *priv = netdev_priv(dev); 1771 - 1772 - if (priv->sleep_mode == SLP_SLEEP) 1773 - return -EPERM; 1774 - 1775 - /* for SLEEP MODE */ 1776 - if (!(uwrq->mode)) 1777 - return -EINVAL; 1778 - 1779 - hostif_sme_enqueue(priv, SME_STOP_REQUEST); 1780 - return 0; 1781 - } 1782 - 1783 - #include <linux/ieee80211.h> 1784 - static int ks_wlan_set_mlme(struct net_device *dev, 1785 - struct iw_request_info *info, 1786 - union iwreq_data *dwrq, char *extra) 1787 - { 1788 - struct ks_wlan_private *priv = netdev_priv(dev); 1789 - struct iw_mlme *mlme = (struct iw_mlme *)extra; 1790 - union iwreq_data uwrq; 1791 - 1792 - uwrq.mode = 1; 1793 - 1794 - if (priv->sleep_mode == SLP_SLEEP) 1795 - return -EPERM; 1796 - 1797 - if (mlme->cmd != IW_MLME_DEAUTH && 1798 - mlme->cmd != IW_MLME_DISASSOC) 1799 - return -EOPNOTSUPP; 1800 - 1801 - if (mlme->cmd == IW_MLME_DEAUTH && 1802 - mlme->reason_code == WLAN_REASON_MIC_FAILURE) 1803 - return 0; 1804 - 1805 - return ks_wlan_set_stop_request(dev, NULL, &uwrq, NULL); 1806 - } 1807 - 1808 - static int ks_wlan_get_firmware_version(struct net_device *dev, 1809 - struct iw_request_info *info, 1810 - union iwreq_data *uwrq, char *extra) 1811 - { 1812 - struct iw_point *dwrq = &uwrq->data; 1813 - struct ks_wlan_private *priv = netdev_priv(dev); 1814 - 1815 - dwrq->length = priv->version_size + 1; 1816 - strscpy(extra, priv->firmware_version, dwrq->length); 1817 - return 0; 1818 - } 1819 - 1820 - static int ks_wlan_set_preamble(struct net_device *dev, 1821 - struct iw_request_info *info, 1822 - union iwreq_data *uwrq, char *extra) 1823 - { 1824 - struct ks_wlan_private *priv = netdev_priv(dev); 1825 - 1826 - if (priv->sleep_mode == SLP_SLEEP) 1827 - return -EPERM; 1828 - 1829 - /* for SLEEP MODE */ 1830 - if (uwrq->mode != LONG_PREAMBLE && uwrq->mode != SHORT_PREAMBLE) 1831 - return -EINVAL; 1832 - 1833 - priv->reg.preamble = uwrq->mode; 1834 - priv->need_commit |= SME_MODE_SET; 1835 - return -EINPROGRESS; /* Call commit handler */ 1836 - } 1837 - 1838 - static int ks_wlan_get_preamble(struct net_device *dev, 1839 - struct iw_request_info *info, 1840 - union iwreq_data *uwrq, char *extra) 1841 - { 1842 - struct ks_wlan_private *priv = netdev_priv(dev); 1843 - 1844 - if (priv->sleep_mode == SLP_SLEEP) 1845 - return -EPERM; 1846 - 1847 - /* for SLEEP MODE */ 1848 - uwrq->mode = priv->reg.preamble; 1849 - return 0; 1850 - } 1851 - 1852 - static int ks_wlan_set_power_mgmt(struct net_device *dev, 1853 - struct iw_request_info *info, 1854 - union iwreq_data *uwrq, char *extra) 1855 - { 1856 - struct ks_wlan_private *priv = netdev_priv(dev); 1857 - 1858 - if (priv->sleep_mode == SLP_SLEEP) 1859 - return -EPERM; 1860 - 1861 - if (uwrq->mode != POWER_MGMT_ACTIVE && 1862 - uwrq->mode != POWER_MGMT_SAVE1 && 1863 - uwrq->mode != POWER_MGMT_SAVE2) 1864 - return -EINVAL; 1865 - 1866 - if ((uwrq->mode == POWER_MGMT_SAVE1 || uwrq->mode == POWER_MGMT_SAVE2) && 1867 - (priv->reg.operation_mode != MODE_INFRASTRUCTURE)) 1868 - return -EINVAL; 1869 - 1870 - priv->reg.power_mgmt = uwrq->mode; 1871 - hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST); 1872 - 1873 - return 0; 1874 - } 1875 - 1876 - static int ks_wlan_get_power_mgmt(struct net_device *dev, 1877 - struct iw_request_info *info, 1878 - union iwreq_data *uwrq, char *extra) 1879 - { 1880 - struct ks_wlan_private *priv = netdev_priv(dev); 1881 - 1882 - if (priv->sleep_mode == SLP_SLEEP) 1883 - return -EPERM; 1884 - 1885 - /* for SLEEP MODE */ 1886 - uwrq->mode = priv->reg.power_mgmt; 1887 - return 0; 1888 - } 1889 - 1890 - static int ks_wlan_set_scan_type(struct net_device *dev, 1891 - struct iw_request_info *info, 1892 - union iwreq_data *uwrq, char *extra) 1893 - { 1894 - struct ks_wlan_private *priv = netdev_priv(dev); 1895 - 1896 - if (priv->sleep_mode == SLP_SLEEP) 1897 - return -EPERM; 1898 - /* for SLEEP MODE */ 1899 - 1900 - if (uwrq->mode != ACTIVE_SCAN && uwrq->mode != PASSIVE_SCAN) 1901 - return -EINVAL; 1902 - 1903 - priv->reg.scan_type = uwrq->mode; 1904 - return 0; 1905 - } 1906 - 1907 - static int ks_wlan_get_scan_type(struct net_device *dev, 1908 - struct iw_request_info *info, 1909 - union iwreq_data *uwrq, char *extra) 1910 - { 1911 - struct ks_wlan_private *priv = netdev_priv(dev); 1912 - 1913 - if (priv->sleep_mode == SLP_SLEEP) 1914 - return -EPERM; 1915 - /* for SLEEP MODE */ 1916 - uwrq->mode = priv->reg.scan_type; 1917 - return 0; 1918 - } 1919 - 1920 - static int ks_wlan_set_beacon_lost(struct net_device *dev, 1921 - struct iw_request_info *info, 1922 - union iwreq_data *uwrq, char *extra) 1923 - { 1924 - struct ks_wlan_private *priv = netdev_priv(dev); 1925 - 1926 - if (priv->sleep_mode == SLP_SLEEP) 1927 - return -EPERM; 1928 - /* for SLEEP MODE */ 1929 - if (uwrq->mode > BEACON_LOST_COUNT_MAX) 1930 - return -EINVAL; 1931 - 1932 - priv->reg.beacon_lost_count = uwrq->mode; 1933 - 1934 - if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) { 1935 - priv->need_commit |= SME_MODE_SET; 1936 - return -EINPROGRESS; /* Call commit handler */ 1937 - } 1938 - 1939 - return 0; 1940 - } 1941 - 1942 - static int ks_wlan_get_beacon_lost(struct net_device *dev, 1943 - struct iw_request_info *info, 1944 - union iwreq_data *uwrq, char *extra) 1945 - { 1946 - struct ks_wlan_private *priv = netdev_priv(dev); 1947 - 1948 - if (priv->sleep_mode == SLP_SLEEP) 1949 - return -EPERM; 1950 - /* for SLEEP MODE */ 1951 - uwrq->mode = priv->reg.beacon_lost_count; 1952 - return 0; 1953 - } 1954 - 1955 - static int ks_wlan_set_phy_type(struct net_device *dev, 1956 - struct iw_request_info *info, 1957 - union iwreq_data *uwrq, char *extra) 1958 - { 1959 - struct ks_wlan_private *priv = netdev_priv(dev); 1960 - 1961 - if (priv->sleep_mode == SLP_SLEEP) 1962 - return -EPERM; 1963 - 1964 - if (uwrq->mode != D_11B_ONLY_MODE && 1965 - uwrq->mode != D_11G_ONLY_MODE && 1966 - uwrq->mode != D_11BG_COMPATIBLE_MODE) 1967 - return -EINVAL; 1968 - 1969 - /* for SLEEP MODE */ 1970 - priv->reg.phy_type = uwrq->mode; 1971 - priv->need_commit |= SME_MODE_SET; 1972 - return -EINPROGRESS; /* Call commit handler */ 1973 - } 1974 - 1975 - static int ks_wlan_get_phy_type(struct net_device *dev, 1976 - struct iw_request_info *info, 1977 - union iwreq_data *uwrq, char *extra) 1978 - { 1979 - struct ks_wlan_private *priv = netdev_priv(dev); 1980 - 1981 - if (priv->sleep_mode == SLP_SLEEP) 1982 - return -EPERM; 1983 - /* for SLEEP MODE */ 1984 - uwrq->mode = priv->reg.phy_type; 1985 - return 0; 1986 - } 1987 - 1988 - static int ks_wlan_set_cts_mode(struct net_device *dev, 1989 - struct iw_request_info *info, 1990 - union iwreq_data *uwrq, char *extra) 1991 - { 1992 - struct ks_wlan_private *priv = netdev_priv(dev); 1993 - 1994 - if (priv->sleep_mode == SLP_SLEEP) 1995 - return -EPERM; 1996 - /* for SLEEP MODE */ 1997 - if (uwrq->mode != CTS_MODE_FALSE && uwrq->mode != CTS_MODE_TRUE) 1998 - return -EINVAL; 1999 - 2000 - priv->reg.cts_mode = (uwrq->mode == CTS_MODE_FALSE) ? uwrq->mode : 2001 - (priv->reg.phy_type == D_11G_ONLY_MODE || 2002 - priv->reg.phy_type == D_11BG_COMPATIBLE_MODE) ? 2003 - uwrq->mode : !uwrq->mode; 2004 - 2005 - priv->need_commit |= SME_MODE_SET; 2006 - return -EINPROGRESS; /* Call commit handler */ 2007 - } 2008 - 2009 - static int ks_wlan_get_cts_mode(struct net_device *dev, 2010 - struct iw_request_info *info, 2011 - union iwreq_data *uwrq, char *extra) 2012 - { 2013 - struct ks_wlan_private *priv = netdev_priv(dev); 2014 - 2015 - if (priv->sleep_mode == SLP_SLEEP) 2016 - return -EPERM; 2017 - /* for SLEEP MODE */ 2018 - uwrq->mode = priv->reg.cts_mode; 2019 - return 0; 2020 - } 2021 - 2022 - static int ks_wlan_set_sleep_mode(struct net_device *dev, 2023 - struct iw_request_info *info, 2024 - union iwreq_data *uwrq, char *extra) 2025 - { 2026 - struct ks_wlan_private *priv = netdev_priv(dev); 2027 - 2028 - if (uwrq->mode != SLP_SLEEP && 2029 - uwrq->mode != SLP_ACTIVE) { 2030 - netdev_err(dev, "SET_SLEEP_MODE %d error\n", uwrq->mode); 2031 - return -EINVAL; 2032 - } 2033 - 2034 - priv->sleep_mode = uwrq->mode; 2035 - netdev_info(dev, "SET_SLEEP_MODE %d\n", priv->sleep_mode); 2036 - 2037 - if (uwrq->mode == SLP_SLEEP) 2038 - hostif_sme_enqueue(priv, SME_STOP_REQUEST); 2039 - 2040 - hostif_sme_enqueue(priv, SME_SLEEP_REQUEST); 2041 - 2042 - return 0; 2043 - } 2044 - 2045 - static int ks_wlan_get_sleep_mode(struct net_device *dev, 2046 - struct iw_request_info *info, 2047 - union iwreq_data *uwrq, char *extra) 2048 - { 2049 - struct ks_wlan_private *priv = netdev_priv(dev); 2050 - 2051 - uwrq->mode = priv->sleep_mode; 2052 - 2053 - return 0; 2054 - } 2055 - 2056 - static int ks_wlan_set_wps_enable(struct net_device *dev, 2057 - struct iw_request_info *info, 2058 - union iwreq_data *uwrq, char *extra) 2059 - { 2060 - struct ks_wlan_private *priv = netdev_priv(dev); 2061 - 2062 - if (priv->sleep_mode == SLP_SLEEP) 2063 - return -EPERM; 2064 - /* for SLEEP MODE */ 2065 - if (uwrq->mode != 0 && uwrq->mode != 1) 2066 - return -EINVAL; 2067 - 2068 - priv->wps.wps_enabled = uwrq->mode; 2069 - hostif_sme_enqueue(priv, SME_WPS_ENABLE_REQUEST); 2070 - 2071 - return 0; 2072 - } 2073 - 2074 - static int ks_wlan_get_wps_enable(struct net_device *dev, 2075 - struct iw_request_info *info, 2076 - union iwreq_data *uwrq, char *extra) 2077 - { 2078 - struct ks_wlan_private *priv = netdev_priv(dev); 2079 - 2080 - if (priv->sleep_mode == SLP_SLEEP) 2081 - return -EPERM; 2082 - /* for SLEEP MODE */ 2083 - uwrq->mode = priv->wps.wps_enabled; 2084 - netdev_info(dev, "return=%d\n", uwrq->mode); 2085 - 2086 - return 0; 2087 - } 2088 - 2089 - static int ks_wlan_set_wps_probe_req(struct net_device *dev, 2090 - struct iw_request_info *info, 2091 - union iwreq_data *uwrq, char *extra) 2092 - { 2093 - struct iw_point *dwrq = &uwrq->data; 2094 - u8 *p = extra; 2095 - unsigned char len; 2096 - struct ks_wlan_private *priv = netdev_priv(dev); 2097 - 2098 - if (priv->sleep_mode == SLP_SLEEP) 2099 - return -EPERM; 2100 - 2101 - /* length check */ 2102 - if (p[1] + 2 != dwrq->length || dwrq->length > 256) 2103 - return -EINVAL; 2104 - 2105 - priv->wps.ielen = p[1] + 2 + 1; /* IE header + IE + sizeof(len) */ 2106 - len = p[1] + 2; /* IE header + IE */ 2107 - 2108 - memcpy(priv->wps.ie, &len, sizeof(len)); 2109 - p = memcpy(priv->wps.ie + 1, p, len); 2110 - 2111 - netdev_dbg(dev, "%d(%#x): %02X %02X %02X %02X ... %02X %02X %02X\n", 2112 - priv->wps.ielen, priv->wps.ielen, p[0], p[1], p[2], p[3], 2113 - p[priv->wps.ielen - 3], p[priv->wps.ielen - 2], 2114 - p[priv->wps.ielen - 1]); 2115 - 2116 - hostif_sme_enqueue(priv, SME_WPS_PROBE_REQUEST); 2117 - 2118 - return 0; 2119 - } 2120 - 2121 - static int ks_wlan_set_tx_gain(struct net_device *dev, 2122 - struct iw_request_info *info, 2123 - union iwreq_data *uwrq, char *extra) 2124 - { 2125 - struct ks_wlan_private *priv = netdev_priv(dev); 2126 - 2127 - if (priv->sleep_mode == SLP_SLEEP) 2128 - return -EPERM; 2129 - /* for SLEEP MODE */ 2130 - if (uwrq->mode > 0xFF) 2131 - return -EINVAL; 2132 - 2133 - priv->gain.tx_gain = (u8)uwrq->mode; 2134 - priv->gain.tx_mode = (priv->gain.tx_gain < 0xFF) ? 1 : 0; 2135 - hostif_sme_enqueue(priv, SME_SET_GAIN); 2136 - return 0; 2137 - } 2138 - 2139 - static int ks_wlan_get_tx_gain(struct net_device *dev, 2140 - struct iw_request_info *info, 2141 - union iwreq_data *uwrq, char *extra) 2142 - { 2143 - struct ks_wlan_private *priv = netdev_priv(dev); 2144 - 2145 - if (priv->sleep_mode == SLP_SLEEP) 2146 - return -EPERM; 2147 - /* for SLEEP MODE */ 2148 - uwrq->mode = priv->gain.tx_gain; 2149 - hostif_sme_enqueue(priv, SME_GET_GAIN); 2150 - return 0; 2151 - } 2152 - 2153 - static int ks_wlan_set_rx_gain(struct net_device *dev, 2154 - struct iw_request_info *info, 2155 - union iwreq_data *uwrq, char *extra) 2156 - { 2157 - struct ks_wlan_private *priv = netdev_priv(dev); 2158 - 2159 - if (priv->sleep_mode == SLP_SLEEP) 2160 - return -EPERM; 2161 - /* for SLEEP MODE */ 2162 - if (uwrq->mode > 0xFF) 2163 - return -EINVAL; 2164 - 2165 - priv->gain.rx_gain = (u8)uwrq->mode; 2166 - priv->gain.rx_mode = (priv->gain.rx_gain < 0xFF) ? 1 : 0; 2167 - hostif_sme_enqueue(priv, SME_SET_GAIN); 2168 - return 0; 2169 - } 2170 - 2171 - static int ks_wlan_get_rx_gain(struct net_device *dev, 2172 - struct iw_request_info *info, 2173 - union iwreq_data *uwrq, char *extra) 2174 - { 2175 - struct ks_wlan_private *priv = netdev_priv(dev); 2176 - 2177 - if (priv->sleep_mode == SLP_SLEEP) 2178 - return -EPERM; 2179 - /* for SLEEP MODE */ 2180 - uwrq->mode = priv->gain.rx_gain; 2181 - hostif_sme_enqueue(priv, SME_GET_GAIN); 2182 - return 0; 2183 - } 2184 - 2185 - static int ks_wlan_get_eeprom_cksum(struct net_device *dev, 2186 - struct iw_request_info *info, 2187 - union iwreq_data *uwrq, char *extra) 2188 - { 2189 - struct ks_wlan_private *priv = netdev_priv(dev); 2190 - 2191 - uwrq->mode = priv->eeprom_checksum; 2192 - return 0; 2193 - } 2194 - 2195 - static void print_hif_event(struct net_device *dev, int event) 2196 - { 2197 - switch (event) { 2198 - case HIF_DATA_REQ: 2199 - netdev_info(dev, "HIF_DATA_REQ\n"); 2200 - break; 2201 - case HIF_DATA_IND: 2202 - netdev_info(dev, "HIF_DATA_IND\n"); 2203 - break; 2204 - case HIF_MIB_GET_REQ: 2205 - netdev_info(dev, "HIF_MIB_GET_REQ\n"); 2206 - break; 2207 - case HIF_MIB_GET_CONF: 2208 - netdev_info(dev, "HIF_MIB_GET_CONF\n"); 2209 - break; 2210 - case HIF_MIB_SET_REQ: 2211 - netdev_info(dev, "HIF_MIB_SET_REQ\n"); 2212 - break; 2213 - case HIF_MIB_SET_CONF: 2214 - netdev_info(dev, "HIF_MIB_SET_CONF\n"); 2215 - break; 2216 - case HIF_POWER_MGMT_REQ: 2217 - netdev_info(dev, "HIF_POWER_MGMT_REQ\n"); 2218 - break; 2219 - case HIF_POWER_MGMT_CONF: 2220 - netdev_info(dev, "HIF_POWER_MGMT_CONF\n"); 2221 - break; 2222 - case HIF_START_REQ: 2223 - netdev_info(dev, "HIF_START_REQ\n"); 2224 - break; 2225 - case HIF_START_CONF: 2226 - netdev_info(dev, "HIF_START_CONF\n"); 2227 - break; 2228 - case HIF_CONNECT_IND: 2229 - netdev_info(dev, "HIF_CONNECT_IND\n"); 2230 - break; 2231 - case HIF_STOP_REQ: 2232 - netdev_info(dev, "HIF_STOP_REQ\n"); 2233 - break; 2234 - case HIF_STOP_CONF: 2235 - netdev_info(dev, "HIF_STOP_CONF\n"); 2236 - break; 2237 - case HIF_PS_ADH_SET_REQ: 2238 - netdev_info(dev, "HIF_PS_ADH_SET_REQ\n"); 2239 - break; 2240 - case HIF_PS_ADH_SET_CONF: 2241 - netdev_info(dev, "HIF_PS_ADH_SET_CONF\n"); 2242 - break; 2243 - case HIF_INFRA_SET_REQ: 2244 - netdev_info(dev, "HIF_INFRA_SET_REQ\n"); 2245 - break; 2246 - case HIF_INFRA_SET_CONF: 2247 - netdev_info(dev, "HIF_INFRA_SET_CONF\n"); 2248 - break; 2249 - case HIF_ADH_SET_REQ: 2250 - netdev_info(dev, "HIF_ADH_SET_REQ\n"); 2251 - break; 2252 - case HIF_ADH_SET_CONF: 2253 - netdev_info(dev, "HIF_ADH_SET_CONF\n"); 2254 - break; 2255 - case HIF_AP_SET_REQ: 2256 - netdev_info(dev, "HIF_AP_SET_REQ\n"); 2257 - break; 2258 - case HIF_AP_SET_CONF: 2259 - netdev_info(dev, "HIF_AP_SET_CONF\n"); 2260 - break; 2261 - case HIF_ASSOC_INFO_IND: 2262 - netdev_info(dev, "HIF_ASSOC_INFO_IND\n"); 2263 - break; 2264 - case HIF_MIC_FAILURE_REQ: 2265 - netdev_info(dev, "HIF_MIC_FAILURE_REQ\n"); 2266 - break; 2267 - case HIF_MIC_FAILURE_CONF: 2268 - netdev_info(dev, "HIF_MIC_FAILURE_CONF\n"); 2269 - break; 2270 - case HIF_SCAN_REQ: 2271 - netdev_info(dev, "HIF_SCAN_REQ\n"); 2272 - break; 2273 - case HIF_SCAN_CONF: 2274 - netdev_info(dev, "HIF_SCAN_CONF\n"); 2275 - break; 2276 - case HIF_PHY_INFO_REQ: 2277 - netdev_info(dev, "HIF_PHY_INFO_REQ\n"); 2278 - break; 2279 - case HIF_PHY_INFO_CONF: 2280 - netdev_info(dev, "HIF_PHY_INFO_CONF\n"); 2281 - break; 2282 - case HIF_SLEEP_REQ: 2283 - netdev_info(dev, "HIF_SLEEP_REQ\n"); 2284 - break; 2285 - case HIF_SLEEP_CONF: 2286 - netdev_info(dev, "HIF_SLEEP_CONF\n"); 2287 - break; 2288 - case HIF_PHY_INFO_IND: 2289 - netdev_info(dev, "HIF_PHY_INFO_IND\n"); 2290 - break; 2291 - case HIF_SCAN_IND: 2292 - netdev_info(dev, "HIF_SCAN_IND\n"); 2293 - break; 2294 - case HIF_INFRA_SET2_REQ: 2295 - netdev_info(dev, "HIF_INFRA_SET2_REQ\n"); 2296 - break; 2297 - case HIF_INFRA_SET2_CONF: 2298 - netdev_info(dev, "HIF_INFRA_SET2_CONF\n"); 2299 - break; 2300 - case HIF_ADH_SET2_REQ: 2301 - netdev_info(dev, "HIF_ADH_SET2_REQ\n"); 2302 - break; 2303 - case HIF_ADH_SET2_CONF: 2304 - netdev_info(dev, "HIF_ADH_SET2_CONF\n"); 2305 - } 2306 - } 2307 - 2308 - /* get host command history */ 2309 - static int ks_wlan_hostt(struct net_device *dev, struct iw_request_info *info, 2310 - union iwreq_data *uwrq, char *extra) 2311 - { 2312 - int i, event; 2313 - struct ks_wlan_private *priv = netdev_priv(dev); 2314 - 2315 - for (i = 63; i >= 0; i--) { 2316 - event = 2317 - priv->hostt.buff[(priv->hostt.qtail - 1 - i) % 2318 - SME_EVENT_BUFF_SIZE]; 2319 - print_hif_event(dev, event); 2320 - } 2321 - return 0; 2322 - } 2323 - 2324 - /* Structures to export the Wireless Handlers */ 2325 - 2326 - static const struct iw_priv_args ks_wlan_private_args[] = { 2327 - /*{ cmd, set_args, get_args, name[16] } */ 2328 - {KS_WLAN_GET_FIRM_VERSION, IW_PRIV_TYPE_NONE, 2329 - IW_PRIV_TYPE_CHAR | (128 + 1), "GetFirmwareVer"}, 2330 - {KS_WLAN_SET_WPS_ENABLE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 2331 - IW_PRIV_TYPE_NONE, "SetWPSEnable"}, 2332 - {KS_WLAN_GET_WPS_ENABLE, IW_PRIV_TYPE_NONE, 2333 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetW"}, 2334 - {KS_WLAN_SET_WPS_PROBE_REQ, IW_PRIV_TYPE_BYTE | 2047, IW_PRIV_TYPE_NONE, 2335 - "SetWPSProbeReq"}, 2336 - {KS_WLAN_SET_PREAMBLE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 2337 - IW_PRIV_TYPE_NONE, "SetPreamble"}, 2338 - {KS_WLAN_GET_PREAMBLE, IW_PRIV_TYPE_NONE, 2339 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetPreamble"}, 2340 - {KS_WLAN_SET_POWER_SAVE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 2341 - IW_PRIV_TYPE_NONE, "SetPowerSave"}, 2342 - {KS_WLAN_GET_POWER_SAVE, IW_PRIV_TYPE_NONE, 2343 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetPowerSave"}, 2344 - {KS_WLAN_SET_SCAN_TYPE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 2345 - IW_PRIV_TYPE_NONE, "SetScanType"}, 2346 - {KS_WLAN_GET_SCAN_TYPE, IW_PRIV_TYPE_NONE, 2347 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetScanType"}, 2348 - {KS_WLAN_SET_RX_GAIN, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 2349 - IW_PRIV_TYPE_NONE, "SetRxGain"}, 2350 - {KS_WLAN_GET_RX_GAIN, IW_PRIV_TYPE_NONE, 2351 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetRxGain"}, 2352 - {KS_WLAN_HOSTT, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_CHAR | (128 + 1), 2353 - "hostt"}, 2354 - {KS_WLAN_SET_BEACON_LOST, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 2355 - IW_PRIV_TYPE_NONE, "SetBeaconLost"}, 2356 - {KS_WLAN_GET_BEACON_LOST, IW_PRIV_TYPE_NONE, 2357 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetBeaconLost"}, 2358 - {KS_WLAN_SET_SLEEP_MODE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 2359 - IW_PRIV_TYPE_NONE, "SetSleepMode"}, 2360 - {KS_WLAN_GET_SLEEP_MODE, IW_PRIV_TYPE_NONE, 2361 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetSleepMode"}, 2362 - {KS_WLAN_SET_TX_GAIN, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 2363 - IW_PRIV_TYPE_NONE, "SetTxGain"}, 2364 - {KS_WLAN_GET_TX_GAIN, IW_PRIV_TYPE_NONE, 2365 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetTxGain"}, 2366 - {KS_WLAN_SET_PHY_TYPE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 2367 - IW_PRIV_TYPE_NONE, "SetPhyType"}, 2368 - {KS_WLAN_GET_PHY_TYPE, IW_PRIV_TYPE_NONE, 2369 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetPhyType"}, 2370 - {KS_WLAN_SET_CTS_MODE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 2371 - IW_PRIV_TYPE_NONE, "SetCtsMode"}, 2372 - {KS_WLAN_GET_CTS_MODE, IW_PRIV_TYPE_NONE, 2373 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetCtsMode"}, 2374 - {KS_WLAN_GET_EEPROM_CKSUM, IW_PRIV_TYPE_NONE, 2375 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetChecksum"}, 2376 - }; 2377 - 2378 - static const iw_handler ks_wlan_handler[] = { 2379 - IW_HANDLER(SIOCSIWCOMMIT, ks_wlan_config_commit), 2380 - IW_HANDLER(SIOCGIWNAME, ks_wlan_get_name), 2381 - IW_HANDLER(SIOCSIWFREQ, ks_wlan_set_freq), 2382 - IW_HANDLER(SIOCGIWFREQ, ks_wlan_get_freq), 2383 - IW_HANDLER(SIOCSIWMODE, ks_wlan_set_mode), 2384 - IW_HANDLER(SIOCGIWMODE, ks_wlan_get_mode), 2385 - IW_HANDLER(SIOCGIWRANGE, ks_wlan_get_range), 2386 - IW_HANDLER(SIOCGIWSTATS, ks_wlan_get_iwstats), 2387 - IW_HANDLER(SIOCSIWAP, ks_wlan_set_wap), 2388 - IW_HANDLER(SIOCGIWAP, ks_wlan_get_wap), 2389 - IW_HANDLER(SIOCSIWMLME, ks_wlan_set_mlme), 2390 - IW_HANDLER(SIOCGIWAPLIST, ks_wlan_get_aplist), 2391 - IW_HANDLER(SIOCSIWSCAN, ks_wlan_set_scan), 2392 - IW_HANDLER(SIOCGIWSCAN, ks_wlan_get_scan), 2393 - IW_HANDLER(SIOCSIWESSID, ks_wlan_set_essid), 2394 - IW_HANDLER(SIOCGIWESSID, ks_wlan_get_essid), 2395 - IW_HANDLER(SIOCSIWNICKN, ks_wlan_set_nick), 2396 - IW_HANDLER(SIOCGIWNICKN, ks_wlan_get_nick), 2397 - IW_HANDLER(SIOCSIWRATE, ks_wlan_set_rate), 2398 - IW_HANDLER(SIOCGIWRATE, ks_wlan_get_rate), 2399 - IW_HANDLER(SIOCSIWRTS, ks_wlan_set_rts), 2400 - IW_HANDLER(SIOCGIWRTS, ks_wlan_get_rts), 2401 - IW_HANDLER(SIOCSIWFRAG, ks_wlan_set_frag), 2402 - IW_HANDLER(SIOCGIWFRAG, ks_wlan_get_frag), 2403 - IW_HANDLER(SIOCSIWENCODE, ks_wlan_set_encode), 2404 - IW_HANDLER(SIOCGIWENCODE, ks_wlan_get_encode), 2405 - IW_HANDLER(SIOCSIWPOWER, ks_wlan_set_power), 2406 - IW_HANDLER(SIOCGIWPOWER, ks_wlan_get_power), 2407 - IW_HANDLER(SIOCSIWGENIE, ks_wlan_set_genie), 2408 - IW_HANDLER(SIOCSIWAUTH, ks_wlan_set_auth_mode), 2409 - IW_HANDLER(SIOCGIWAUTH, ks_wlan_get_auth_mode), 2410 - IW_HANDLER(SIOCSIWENCODEEXT, ks_wlan_set_encode_ext), 2411 - IW_HANDLER(SIOCGIWENCODEEXT, ks_wlan_get_encode_ext), 2412 - IW_HANDLER(SIOCSIWPMKSA, ks_wlan_set_pmksa), 2413 - }; 2414 - 2415 - /* private_handler */ 2416 - static const iw_handler ks_wlan_private_handler[] = { 2417 - NULL, /* 0 */ 2418 - NULL, /* 1, KS_WLAN_GET_DRIVER_VERSION */ 2419 - NULL, /* 2 */ 2420 - ks_wlan_get_firmware_version, /* 3 KS_WLAN_GET_FIRM_VERSION */ 2421 - ks_wlan_set_wps_enable, /* 4 KS_WLAN_SET_WPS_ENABLE */ 2422 - ks_wlan_get_wps_enable, /* 5 KS_WLAN_GET_WPS_ENABLE */ 2423 - ks_wlan_set_wps_probe_req, /* 6 KS_WLAN_SET_WPS_PROBE_REQ */ 2424 - ks_wlan_get_eeprom_cksum, /* 7 KS_WLAN_GET_CONNECT */ 2425 - ks_wlan_set_preamble, /* 8 KS_WLAN_SET_PREAMBLE */ 2426 - ks_wlan_get_preamble, /* 9 KS_WLAN_GET_PREAMBLE */ 2427 - ks_wlan_set_power_mgmt, /* 10 KS_WLAN_SET_POWER_SAVE */ 2428 - ks_wlan_get_power_mgmt, /* 11 KS_WLAN_GET_POWER_SAVE */ 2429 - ks_wlan_set_scan_type, /* 12 KS_WLAN_SET_SCAN_TYPE */ 2430 - ks_wlan_get_scan_type, /* 13 KS_WLAN_GET_SCAN_TYPE */ 2431 - ks_wlan_set_rx_gain, /* 14 KS_WLAN_SET_RX_GAIN */ 2432 - ks_wlan_get_rx_gain, /* 15 KS_WLAN_GET_RX_GAIN */ 2433 - ks_wlan_hostt, /* 16 KS_WLAN_HOSTT */ 2434 - NULL, /* 17 */ 2435 - ks_wlan_set_beacon_lost, /* 18 KS_WLAN_SET_BECAN_LOST */ 2436 - ks_wlan_get_beacon_lost, /* 19 KS_WLAN_GET_BECAN_LOST */ 2437 - ks_wlan_set_tx_gain, /* 20 KS_WLAN_SET_TX_GAIN */ 2438 - ks_wlan_get_tx_gain, /* 21 KS_WLAN_GET_TX_GAIN */ 2439 - ks_wlan_set_phy_type, /* 22 KS_WLAN_SET_PHY_TYPE */ 2440 - ks_wlan_get_phy_type, /* 23 KS_WLAN_GET_PHY_TYPE */ 2441 - ks_wlan_set_cts_mode, /* 24 KS_WLAN_SET_CTS_MODE */ 2442 - ks_wlan_get_cts_mode, /* 25 KS_WLAN_GET_CTS_MODE */ 2443 - NULL, /* 26 */ 2444 - NULL, /* 27 */ 2445 - ks_wlan_set_sleep_mode, /* 28 KS_WLAN_SET_SLEEP_MODE */ 2446 - ks_wlan_get_sleep_mode, /* 29 KS_WLAN_GET_SLEEP_MODE */ 2447 - NULL, /* 30 */ 2448 - NULL, /* 31 */ 2449 - }; 2450 - 2451 - static const struct iw_handler_def ks_wlan_handler_def = { 2452 - .num_standard = ARRAY_SIZE(ks_wlan_handler), 2453 - .num_private = ARRAY_SIZE(ks_wlan_private_handler), 2454 - .num_private_args = ARRAY_SIZE(ks_wlan_private_args), 2455 - .standard = ks_wlan_handler, 2456 - .private = ks_wlan_private_handler, 2457 - .private_args = ks_wlan_private_args, 2458 - .get_wireless_stats = ks_get_wireless_stats, 2459 - }; 2460 - 2461 - static int ks_wlan_netdev_ioctl(struct net_device *dev, struct ifreq *rq, 2462 - int cmd) 2463 - { 2464 - int ret; 2465 - struct iwreq *wrq = (struct iwreq *)rq; 2466 - 2467 - switch (cmd) { 2468 - case SIOCIWFIRSTPRIV + 20: /* KS_WLAN_SET_STOP_REQ */ 2469 - ret = ks_wlan_set_stop_request(dev, NULL, &wrq->u, NULL); 2470 - break; 2471 - // All other calls are currently unsupported 2472 - default: 2473 - ret = -EOPNOTSUPP; 2474 - } 2475 - 2476 - return ret; 2477 - } 2478 - 2479 - static 2480 - struct net_device_stats *ks_wlan_get_stats(struct net_device *dev) 2481 - { 2482 - struct ks_wlan_private *priv = netdev_priv(dev); 2483 - 2484 - if (priv->dev_state < DEVICE_STATE_READY) 2485 - return NULL; /* not finished initialize */ 2486 - 2487 - return &priv->nstats; 2488 - } 2489 - 2490 - static 2491 - int ks_wlan_set_mac_address(struct net_device *dev, void *addr) 2492 - { 2493 - struct ks_wlan_private *priv = netdev_priv(dev); 2494 - struct sockaddr *mac_addr = (struct sockaddr *)addr; 2495 - 2496 - if (netif_running(dev)) 2497 - return -EBUSY; 2498 - eth_hw_addr_set(dev, mac_addr->sa_data); 2499 - ether_addr_copy(priv->eth_addr, mac_addr->sa_data); 2500 - 2501 - priv->mac_address_valid = false; 2502 - hostif_sme_enqueue(priv, SME_MACADDRESS_SET_REQUEST); 2503 - netdev_info(dev, "ks_wlan: MAC ADDRESS = %pM\n", priv->eth_addr); 2504 - return 0; 2505 - } 2506 - 2507 - static 2508 - void ks_wlan_tx_timeout(struct net_device *dev, unsigned int txqueue) 2509 - { 2510 - struct ks_wlan_private *priv = netdev_priv(dev); 2511 - 2512 - netdev_dbg(dev, "head(%d) tail(%d)!!\n", priv->tx_dev.qhead, 2513 - priv->tx_dev.qtail); 2514 - if (!netif_queue_stopped(dev)) 2515 - netif_stop_queue(dev); 2516 - priv->nstats.tx_errors++; 2517 - netif_wake_queue(dev); 2518 - } 2519 - 2520 - static 2521 - netdev_tx_t ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev) 2522 - { 2523 - struct ks_wlan_private *priv = netdev_priv(dev); 2524 - int ret; 2525 - 2526 - netdev_dbg(dev, "in_interrupt()=%ld\n", in_interrupt()); 2527 - 2528 - if (!skb) { 2529 - netdev_err(dev, "ks_wlan: skb == NULL!!!\n"); 2530 - return 0; 2531 - } 2532 - if (priv->dev_state < DEVICE_STATE_READY) { 2533 - dev_kfree_skb(skb); 2534 - return 0; /* not finished initialize */ 2535 - } 2536 - 2537 - if (netif_running(dev)) 2538 - netif_stop_queue(dev); 2539 - 2540 - ret = hostif_data_request(priv, skb); 2541 - netif_trans_update(dev); 2542 - 2543 - if (ret) 2544 - netdev_err(dev, "hostif_data_request error: =%d\n", ret); 2545 - 2546 - return 0; 2547 - } 2548 - 2549 - void send_packet_complete(struct ks_wlan_private *priv, struct sk_buff *skb) 2550 - { 2551 - priv->nstats.tx_packets++; 2552 - 2553 - if (netif_queue_stopped(priv->net_dev)) 2554 - netif_wake_queue(priv->net_dev); 2555 - 2556 - if (skb) { 2557 - priv->nstats.tx_bytes += skb->len; 2558 - dev_kfree_skb(skb); 2559 - } 2560 - } 2561 - 2562 - /* 2563 - * Set or clear the multicast filter for this adaptor. 2564 - * This routine is not state sensitive and need not be SMP locked. 2565 - */ 2566 - static 2567 - void ks_wlan_set_rx_mode(struct net_device *dev) 2568 - { 2569 - struct ks_wlan_private *priv = netdev_priv(dev); 2570 - 2571 - if (priv->dev_state < DEVICE_STATE_READY) 2572 - return; /* not finished initialize */ 2573 - hostif_sme_enqueue(priv, SME_MULTICAST_REQUEST); 2574 - } 2575 - 2576 - static 2577 - int ks_wlan_open(struct net_device *dev) 2578 - { 2579 - struct ks_wlan_private *priv = netdev_priv(dev); 2580 - 2581 - priv->cur_rx = 0; 2582 - 2583 - if (!priv->mac_address_valid) { 2584 - netdev_err(dev, "ks_wlan : %s Not READY !!\n", dev->name); 2585 - return -EBUSY; 2586 - } 2587 - netif_start_queue(dev); 2588 - 2589 - return 0; 2590 - } 2591 - 2592 - static 2593 - int ks_wlan_close(struct net_device *dev) 2594 - { 2595 - netif_stop_queue(dev); 2596 - 2597 - return 0; 2598 - } 2599 - 2600 - /* Operational parameters that usually are not changed. */ 2601 - /* Time in jiffies before concluding the transmitter is hung. */ 2602 - #define TX_TIMEOUT (3 * HZ) 2603 - static const unsigned char dummy_addr[] = { 2604 - 0x00, 0x0b, 0xe3, 0x00, 0x00, 0x00 2605 - }; 2606 - 2607 - static const struct net_device_ops ks_wlan_netdev_ops = { 2608 - .ndo_start_xmit = ks_wlan_start_xmit, 2609 - .ndo_open = ks_wlan_open, 2610 - .ndo_stop = ks_wlan_close, 2611 - .ndo_do_ioctl = ks_wlan_netdev_ioctl, 2612 - .ndo_set_mac_address = ks_wlan_set_mac_address, 2613 - .ndo_get_stats = ks_wlan_get_stats, 2614 - .ndo_tx_timeout = ks_wlan_tx_timeout, 2615 - .ndo_set_rx_mode = ks_wlan_set_rx_mode, 2616 - }; 2617 - 2618 - int ks_wlan_net_start(struct net_device *dev) 2619 - { 2620 - struct ks_wlan_private *priv; 2621 - /* int rc; */ 2622 - 2623 - priv = netdev_priv(dev); 2624 - priv->mac_address_valid = false; 2625 - priv->is_device_open = true; 2626 - priv->need_commit = 0; 2627 - /* phy information update timer */ 2628 - atomic_set(&update_phyinfo, 0); 2629 - timer_setup(&update_phyinfo_timer, ks_wlan_update_phyinfo_timeout, 0); 2630 - 2631 - /* dummy address set */ 2632 - ether_addr_copy(priv->eth_addr, dummy_addr); 2633 - eth_hw_addr_set(dev, priv->eth_addr); 2634 - 2635 - /* The ks_wlan-specific entries in the device structure. */ 2636 - dev->netdev_ops = &ks_wlan_netdev_ops; 2637 - dev->wireless_handlers = &ks_wlan_handler_def; 2638 - dev->watchdog_timeo = TX_TIMEOUT; 2639 - 2640 - netif_carrier_off(dev); 2641 - 2642 - return 0; 2643 - } 2644 - 2645 - int ks_wlan_net_stop(struct net_device *dev) 2646 - { 2647 - struct ks_wlan_private *priv = netdev_priv(dev); 2648 - 2649 - priv->is_device_open = false; 2650 - del_timer_sync(&update_phyinfo_timer); 2651 - 2652 - if (netif_running(dev)) 2653 - netif_stop_queue(dev); 2654 - 2655 - return 0; 2656 - } 2657 - 2658 - /** 2659 - * is_connect_status() - return true if status is 'connected' 2660 - * @status: high bit is used as FORCE_DISCONNECT, low bits used for 2661 - * connect status. 2662 - */ 2663 - bool is_connect_status(u32 status) 2664 - { 2665 - return (status & CONNECT_STATUS_MASK) == CONNECT_STATUS; 2666 - } 2667 - 2668 - /** 2669 - * is_disconnect_status() - return true if status is 'disconnected' 2670 - * @status: high bit is used as FORCE_DISCONNECT, low bits used for 2671 - * disconnect status. 2672 - */ 2673 - bool is_disconnect_status(u32 status) 2674 - { 2675 - return (status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS; 2676 - }
+1 -2
drivers/staging/media/atomisp/pci/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.c
··· 65 65 * the original out res. for video pipe, it has two output pins --- out and 66 66 * vf_out, so it can keep these two resolutions already. */ 67 67 if (binary->info->sp.pipeline.mode == IA_CSS_BINARY_MODE_PREVIEW && 68 - binary->vf_downscale_log2 > 0) 69 - { 68 + binary->vf_downscale_log2 > 0) { 70 69 /* TODO: Remove this after preview output decimation is fixed 71 70 * by configuring out&vf info files properly */ 72 71 my_info.padded_width <<= binary->vf_downscale_log2;
+3 -3
drivers/staging/most/video/video.c
··· 454 454 struct most_video_dev *mdev = get_comp_dev(iface, channel_idx); 455 455 456 456 if (mdev) { 457 - pr_err("channel already linked\n"); 457 + pr_err("Channel already linked\n"); 458 458 return -EEXIST; 459 459 } 460 460 461 461 if (ccfg->direction != MOST_CH_RX) { 462 - pr_err("wrong direction, expect rx\n"); 462 + pr_err("Wrong direction, expected rx\n"); 463 463 return -EINVAL; 464 464 } 465 465 466 466 if (ccfg->data_type != MOST_CH_SYNC && 467 467 ccfg->data_type != MOST_CH_ISOC) { 468 - pr_err("wrong channel type, expect sync or isoc\n"); 468 + pr_err("Wrong channel type, expected sync or isoc\n"); 469 469 return -EINVAL; 470 470 } 471 471
+8 -9
drivers/staging/nvec/nvec.c
··· 175 175 } 176 176 } 177 177 178 - dev_err(nvec->dev, "could not allocate %s buffer\n", 178 + dev_err(nvec->dev, "Could not allocate %s buffer\n", 179 179 (category == NVEC_MSG_TX) ? "TX" : "RX"); 180 180 181 181 return NULL; ··· 315 315 if (!(wait_for_completion_timeout(&nvec->sync_write, 316 316 msecs_to_jiffies(2000)))) { 317 317 dev_warn(nvec->dev, 318 - "timeout waiting for sync write to complete\n"); 318 + "Timeout waiting for sync write to complete\n"); 319 319 mutex_unlock(&nvec->sync_write_mutex); 320 320 return -ETIMEDOUT; 321 321 } ··· 392 392 msecs_to_jiffies(5000)); 393 393 394 394 if (err == 0) { 395 - dev_warn(nvec->dev, "timeout waiting for ec transfer\n"); 395 + dev_warn(nvec->dev, "Timeout waiting for ec transfer\n"); 396 396 nvec_gpio_set_value(nvec, 1); 397 397 msg->pos = 0; 398 398 } ··· 454 454 455 455 if (nvec->sync_write_pending == 456 456 (msg->data[2] << 8) + msg->data[0]) { 457 - dev_dbg(nvec->dev, "sync write completed!\n"); 457 + dev_dbg(nvec->dev, "Sync write completed!\n"); 458 458 nvec->sync_write_pending = 0; 459 459 nvec->last_sync_msg = msg; 460 460 complete(&nvec->sync_write); ··· 477 477 { 478 478 /* We got an END_TRANS, let's skip this, maybe there's an event */ 479 479 if (nvec->tx->pos != nvec->tx->size) { 480 - dev_err(nvec->dev, "premature END_TRANS, resending\n"); 480 + dev_err(nvec->dev, "Premature END_TRANS, resending\n"); 481 481 nvec->tx->pos = 0; 482 482 nvec_gpio_set_value(nvec, 0); 483 483 } else { ··· 608 608 609 609 /* Filter out some errors */ 610 610 if ((status & irq_mask) == 0 && (status & ~irq_mask) != 0) { 611 - dev_err(nvec->dev, "unexpected irq mask %lx\n", status); 611 + dev_err(nvec->dev, "Unexpected irq mask %lx\n", status); 612 612 return IRQ_HANDLED; 613 613 } 614 614 if ((status & I2C_SL_IRQ) == 0) { ··· 631 631 if (status != (I2C_SL_IRQ | RCVD)) 632 632 nvec_invalid_flags(nvec, status, false); 633 633 break; 634 - case 1: /* command byte */ 634 + case 1: /* Command byte */ 635 635 if (status != I2C_SL_IRQ) { 636 636 nvec_invalid_flags(nvec, status, true); 637 637 } else { ··· 845 845 return PTR_ERR(nvec->gpiod); 846 846 } 847 847 848 - err = devm_request_irq(dev, nvec->irq, nvec_interrupt, 0, 848 + err = devm_request_irq(dev, nvec->irq, nvec_interrupt, IRQF_NO_AUTOEN, 849 849 "nvec", nvec); 850 850 if (err) { 851 851 dev_err(dev, "couldn't request irq\n"); 852 852 return -ENODEV; 853 853 } 854 - disable_irq(nvec->irq); 855 854 856 855 tegra_init_i2c_slave(nvec); 857 856
+1 -1
drivers/staging/olpc_dcon/olpc_dcon.c
··· 544 544 static struct backlight_properties dcon_bl_props = { 545 545 .max_brightness = 15, 546 546 .type = BACKLIGHT_RAW, 547 - .power = FB_BLANK_UNBLANK, 547 + .power = BACKLIGHT_POWER_ON, 548 548 }; 549 549 550 550 static int dcon_reboot_notify(struct notifier_block *nb,
+3 -2
drivers/staging/rtl8192e/rtl8192e/r8190P_def.h
··· 8 8 #define R8190P_DEF_H 9 9 10 10 #include <linux/types.h> 11 + #include "r8192E_phy.h" 11 12 12 13 #define MAX_SILENT_RESET_RX_SLOT_NUM 10 13 14 ··· 138 137 }; 139 138 140 139 struct phy_sts_ofdm_819xpci { 141 - u8 trsw_gain_X[4]; 140 + u8 trsw_gain_X[RF90_PATH_MAX]; 142 141 u8 pwdb_all; 143 142 u8 cfosho_X[4]; 144 143 u8 cfotail_X[4]; ··· 227 226 u16 Length:14; 228 227 u16 CRC32:1; 229 228 u16 ICV:1; 230 - u8 RxDrvInfoSize; 229 + u8 rx_drv_info_size; 231 230 u8 Shift:2; 232 231 u8 PHYStatus:1; 233 232 u8 SWDec:1;
+5 -5
drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
··· 16 16 struct sk_buff *skb; 17 17 unsigned char *seg_ptr; 18 18 struct cb_desc *tcb_desc; 19 - u8 bLastIniPkt; 19 + u8 last_ini_pkt; 20 20 21 21 struct tx_fwinfo_8190pci *pTxFwInfo = NULL; 22 22 23 23 do { 24 24 if ((len - frag_offset) > CMDPACKET_FRAG_SIZE) { 25 25 frag_length = CMDPACKET_FRAG_SIZE; 26 - bLastIniPkt = 0; 26 + last_ini_pkt = 0; 27 27 28 28 } else { 29 29 frag_length = (u16)(len - frag_offset); 30 - bLastIniPkt = 1; 30 + last_ini_pkt = 1; 31 31 } 32 32 33 33 if (type == DESC_PACKET_TYPE_NORMAL) ··· 42 42 memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); 43 43 tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); 44 44 tcb_desc->queue_index = TXCMD_QUEUE; 45 - tcb_desc->bCmdOrInit = type; 46 - tcb_desc->bLastIniPkt = bLastIniPkt; 45 + tcb_desc->cmd_or_init = type; 46 + tcb_desc->last_ini_pkt = last_ini_pkt; 47 47 48 48 if (type == DESC_PACKET_TYPE_NORMAL) { 49 49 tcb_desc->pkt_size = frag_length;
+42 -47
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
··· 289 289 290 290 for (i = 0; i < 6; i += 2) { 291 291 usValue = rtl92e_eeprom_read(dev, 292 - (EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1); 292 + (EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1); 293 293 *(u16 *)(&addr[i]) = usValue; 294 294 } 295 295 eth_hw_addr_set(dev, addr); ··· 987 987 if (dma_mapping_error(&priv->pdev->dev, mapping)) 988 988 netdev_err(dev, "%s(): DMA Mapping error\n", __func__); 989 989 memset(entry, 0, 12); 990 - entry->LINIP = cb_desc->bLastIniPkt; 990 + entry->LINIP = cb_desc->last_ini_pkt; 991 991 entry->FirstSeg = 1; 992 992 entry->LastSeg = 1; 993 - if (cb_desc->bCmdOrInit == DESC_PACKET_TYPE_INIT) { 993 + if (cb_desc->cmd_or_init == DESC_PACKET_TYPE_INIT) { 994 994 entry->CmdInit = DESC_PACKET_TYPE_INIT; 995 995 } else { 996 996 struct tx_desc *entry_tmp = (struct tx_desc *)entry; ··· 1145 1145 _pdrvinfo->RxRate == DESC90_RATE11M) &&\ 1146 1146 !_pdrvinfo->RxHT) 1147 1147 1148 - static void _rtl92e_query_rxphystatus( 1149 - struct r8192_priv *priv, 1150 - struct rtllib_rx_stats *pstats, 1151 - struct rx_desc *pdesc, 1152 - struct rx_fwinfo *pdrvinfo, 1153 - struct rtllib_rx_stats *precord_stats, 1154 - bool bpacket_match_bssid, 1155 - bool bpacket_toself, 1156 - bool bPacketBeacon, 1157 - bool bToSelfBA 1158 - ) 1148 + static void _rtl92e_query_rxphystatus(struct r8192_priv *priv, 1149 + struct rtllib_rx_stats *pstats, 1150 + struct rx_desc *pdesc, 1151 + struct rx_fwinfo *pdrvinfo, 1152 + struct rtllib_rx_stats *precord_stats, 1153 + bool bpacket_match_bssid, 1154 + bool bpacket_toself, 1155 + bool bPacketBeacon, 1156 + bool bToSelfBA) 1159 1157 { 1160 1158 struct phy_sts_ofdm_819xpci *pofdm_buf; 1161 1159 struct phy_sts_cck_819xpci *pcck_buf; 1162 1160 u8 *prxpkt; 1163 1161 u8 i, max_spatial_stream, tmp_rxevm; 1164 - s8 rx_pwr[4], rx_pwr_all = 0; 1162 + s8 rx_pwr[RF90_PATH_MAX], rx_pwr_all = 0; 1165 1163 s8 rx_evmX; 1166 1164 u8 evm, pwdb_all; 1167 1165 u32 RSSI, total_rssi = 0; ··· 1172 1174 memset(precord_stats, 0, sizeof(struct rtllib_rx_stats)); 1173 1175 pstats->bPacketMatchBSSID = precord_stats->bPacketMatchBSSID = 1174 1176 bpacket_match_bssid; 1175 - pstats->bPacketToSelf = precord_stats->bPacketToSelf = bpacket_toself; 1177 + pstats->packet_to_self = precord_stats->packet_to_self = bpacket_toself; 1176 1178 pstats->bIsCCK = precord_stats->bIsCCK = is_cck_rate; 1177 1179 pstats->bPacketBeacon = precord_stats->bPacketBeacon = bPacketBeacon; 1178 1180 pstats->bToSelfBA = precord_stats->bToSelfBA = bToSelfBA; ··· 1264 1266 else 1265 1267 sq = ((64 - sq) * 100) / 44; 1266 1268 } 1267 - pstats->SignalQuality = sq; 1268 - precord_stats->SignalQuality = sq; 1269 + pstats->signal_quality = sq; 1270 + precord_stats->signal_quality = sq; 1269 1271 pstats->RxMIMOSignalQuality[0] = sq; 1270 1272 precord_stats->RxMIMOSignalQuality[0] = sq; 1271 1273 pstats->RxMIMOSignalQuality[1] = -1; ··· 1309 1311 evm = rtl92e_evm_db_to_percent(rx_evmX); 1310 1312 if (bpacket_match_bssid) { 1311 1313 if (i == 0) { 1312 - pstats->SignalQuality = evm & 0xff; 1313 - precord_stats->SignalQuality = evm & 0xff; 1314 + pstats->signal_quality = evm & 0xff; 1315 + precord_stats->signal_quality = evm & 0xff; 1314 1316 } 1315 1317 pstats->RxMIMOSignalQuality[i] = evm & 0xff; 1316 1318 precord_stats->RxMIMOSignalQuality[i] = evm & 0xff; ··· 1319 1321 } 1320 1322 1321 1323 if (is_cck_rate) { 1322 - pstats->SignalStrength = precord_stats->SignalStrength = 1323 - _rtl92e_signal_scale_mapping(priv, 1324 - (long)pwdb_all); 1324 + pstats->signal_strength = precord_stats->signal_strength = 1325 + _rtl92e_signal_scale_mapping(priv, (long)pwdb_all); 1325 1326 1326 1327 } else { 1327 1328 if (rf_rx_num != 0) 1328 - pstats->SignalStrength = precord_stats->SignalStrength = 1329 + pstats->signal_strength = precord_stats->signal_strength = 1329 1330 _rtl92e_signal_scale_mapping(priv, 1330 1331 (long)(total_rssi /= rf_rx_num)); 1331 1332 } ··· 1352 1355 last_rssi = priv->stats.slide_signal_strength[slide_rssi_index]; 1353 1356 priv->stats.slide_rssi_total -= last_rssi; 1354 1357 } 1355 - priv->stats.slide_rssi_total += prev_st->SignalStrength; 1358 + priv->stats.slide_rssi_total += prev_st->signal_strength; 1356 1359 1357 1360 priv->stats.slide_signal_strength[slide_rssi_index++] = 1358 - prev_st->SignalStrength; 1361 + prev_st->signal_strength; 1359 1362 if (slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX) 1360 1363 slide_rssi_index = 0; 1361 1364 ··· 1370 1373 if (!bcheck) 1371 1374 return; 1372 1375 1373 - if (!prev_st->bIsCCK && prev_st->bPacketToSelf) { 1376 + if (!prev_st->bIsCCK && prev_st->packet_to_self) { 1374 1377 for (rfpath = RF90_PATH_A; rfpath < priv->num_total_rf_path; rfpath++) { 1375 1378 if (priv->stats.rx_rssi_percentage[rfpath] == 0) { 1376 1379 priv->stats.rx_rssi_percentage[rfpath] = ··· 1416 1419 if (prev_st->RxPWDBAll >= 3) 1417 1420 prev_st->RxPWDBAll -= 3; 1418 1421 } 1419 - if (prev_st->bPacketToSelf || prev_st->bPacketBeacon || 1422 + if (prev_st->packet_to_self || prev_st->bPacketBeacon || 1420 1423 prev_st->bToSelfBA) { 1421 1424 if (priv->undecorated_smoothed_pwdb < 0) 1422 1425 priv->undecorated_smoothed_pwdb = prev_st->RxPWDBAll; ··· 1436 1439 rtl92e_update_rx_statistics(priv, prev_st); 1437 1440 } 1438 1441 1439 - if (prev_st->SignalQuality != 0) { 1440 - if (prev_st->bPacketToSelf || prev_st->bPacketBeacon || 1442 + if (prev_st->signal_quality != 0) { 1443 + if (prev_st->packet_to_self || prev_st->bPacketBeacon || 1441 1444 prev_st->bToSelfBA) { 1442 1445 if (slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX) { 1443 1446 slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX; ··· 1446 1449 priv->stats.slide_evm_total -= last_evm; 1447 1450 } 1448 1451 1449 - priv->stats.slide_evm_total += prev_st->SignalQuality; 1452 + priv->stats.slide_evm_total += prev_st->signal_quality; 1450 1453 1451 1454 priv->stats.slide_evm[slide_evm_index++] = 1452 - prev_st->SignalQuality; 1455 + prev_st->signal_quality; 1453 1456 if (slide_evm_index >= PHY_RSSI_SLID_WIN_MAX) 1454 1457 slide_evm_index = 0; 1455 1458 ··· 1458 1461 priv->stats.last_signal_strength_inpercent = tmp_val; 1459 1462 } 1460 1463 1461 - if (prev_st->bPacketToSelf || 1464 + if (prev_st->packet_to_self || 1462 1465 prev_st->bPacketBeacon || 1463 1466 prev_st->bToSelfBA) { 1464 1467 for (ij = 0; ij < 2; ij++) { ··· 1493 1496 u8 *tmp_buf; 1494 1497 u8 *praddr; 1495 1498 1496 - tmp_buf = skb->data + pstats->RxDrvInfoSize + pstats->RxBufShift; 1499 + tmp_buf = skb->data + pstats->rx_drv_info_size + pstats->rx_buf_shift; 1497 1500 1498 1501 hdr = (struct ieee80211_hdr_3addr *)tmp_buf; 1499 1502 fc = le16_to_cpu(hdr->frame_control); ··· 1506 1509 (fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : 1507 1510 (fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : 1508 1511 hdr->addr3) && 1509 - (!pstats->bHwError) && (!pstats->bCRC) && (!pstats->bICV)); 1512 + (!pstats->hw_error) && (!pstats->bCRC) && (!pstats->bICV)); 1510 1513 bpacket_toself = bpacket_match_bssid && /* check this */ 1511 1514 ether_addr_equal(praddr, priv->rtllib->dev->dev_addr); 1512 1515 if (ieee80211_is_beacon(hdr->frame_control)) ··· 1518 1521 rtl92e_copy_mpdu_stats(pstats, &previous_stats); 1519 1522 } 1520 1523 1521 - static void _rtl92e_update_received_rate_histogram_stats( 1522 - struct net_device *dev, 1523 - struct rtllib_rx_stats *pstats) 1524 + static void _rtl92e_update_received_rate_histogram_stats(struct net_device *dev, 1525 + struct rtllib_rx_stats *pstats) 1524 1526 { 1525 1527 struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); 1526 1528 u32 rcvType = 1; ··· 1630 1634 1631 1635 stats->bICV = pdesc->ICV; 1632 1636 stats->bCRC = pdesc->CRC32; 1633 - stats->bHwError = pdesc->CRC32 | pdesc->ICV; 1637 + stats->hw_error = pdesc->CRC32 | pdesc->ICV; 1634 1638 1635 1639 stats->Length = pdesc->Length; 1636 1640 if (stats->Length < 24) 1637 - stats->bHwError |= 1; 1641 + stats->hw_error |= 1; 1638 1642 1639 - if (stats->bHwError) 1643 + if (stats->hw_error) 1640 1644 return false; 1641 1645 1642 - stats->RxDrvInfoSize = pdesc->RxDrvInfoSize; 1643 - stats->RxBufShift = (pdesc->Shift) & 0x03; 1646 + stats->rx_drv_info_size = pdesc->rx_drv_info_size; 1647 + stats->rx_buf_shift = (pdesc->Shift) & 0x03; 1644 1648 stats->decrypted = !pdesc->SWDec; 1645 1649 1646 - pDrvInfo = (struct rx_fwinfo *)(skb->data + stats->RxBufShift); 1650 + pDrvInfo = (struct rx_fwinfo *)(skb->data + stats->rx_buf_shift); 1647 1651 1648 1652 stats->rate = _rtl92e_rate_hw_to_mgn((bool)pDrvInfo->RxHT, 1649 1653 pDrvInfo->RxRate); ··· 1833 1837 rx_chk_cnt++; 1834 1838 if (priv->undecorated_smoothed_pwdb >= (RATE_ADAPTIVE_TH_HIGH + 5)) { 1835 1839 rx_chk_cnt = 0; 1836 - } else if ((priv->undecorated_smoothed_pwdb < (RATE_ADAPTIVE_TH_HIGH + 5)) 1837 - && (((priv->current_chnl_bw != HT_CHANNEL_WIDTH_20) && 1840 + } else if ((priv->undecorated_smoothed_pwdb < (RATE_ADAPTIVE_TH_HIGH + 5)) && 1841 + (((priv->current_chnl_bw != HT_CHANNEL_WIDTH_20) && 1838 1842 (priv->undecorated_smoothed_pwdb >= RATE_ADAPTIVE_TH_LOW_40M)) 1839 1843 || ((priv->current_chnl_bw == HT_CHANNEL_WIDTH_20) && 1840 1844 (priv->undecorated_smoothed_pwdb >= RATE_ADAPTIVE_TH_LOW_20M)))) { ··· 1854 1858 return bStuck; 1855 1859 rx_chk_cnt = 0; 1856 1860 } 1857 - 1858 1861 1859 1862 slot_index = (priv->silent_reset_rx_slot_index++) % SilentResetRxSoltNum; 1860 1863
+1 -1
drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h
··· 229 229 RATR_MCS6 | RATR_MCS7) 230 230 #define RATE_ALL_OFDM_2SS (RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | \ 231 231 RATR_MCS11 | RATR_MCS12 | RATR_MCS13 | \ 232 - RATR_MCS14|RATR_MCS15) 232 + RATR_MCS14 | RATR_MCS15) 233 233 234 234 DRIVER_RSSI = 0x32c, 235 235 MCS_TXAGC = 0x340,
+34 -33
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
··· 416 416 417 417 return rtStatus; 418 418 } 419 + 419 420 bool rtl92e_config_bb(struct net_device *dev) 420 421 { 421 422 _rtl92e_init_bb_rf_reg_def(dev); ··· 509 508 static u8 _rtl92e_phy_set_sw_chnl_cmd_array(struct net_device *dev, 510 509 struct sw_chnl_cmd *CmdTable, 511 510 u32 CmdTableIdx, u32 CmdTableSz, 512 - enum sw_chnl_cmd_id CmdID, 513 - u32 Para1, u32 Para2, u32 msDelay) 511 + enum sw_chnl_cmd_id cmd_id, 512 + u32 para1, u32 para2, u32 ms_delay) 514 513 { 515 514 struct sw_chnl_cmd *pCmd; 516 515 ··· 524 523 } 525 524 526 525 pCmd = CmdTable + CmdTableIdx; 527 - pCmd->CmdID = CmdID; 528 - pCmd->Para1 = Para1; 529 - pCmd->Para2 = Para2; 530 - pCmd->msDelay = msDelay; 526 + pCmd->cmd_id = cmd_id; 527 + pCmd->para1 = para1; 528 + pCmd->para2 = para2; 529 + pCmd->ms_delay = ms_delay; 531 530 532 531 return true; 533 532 } ··· 553 552 _rtl92e_phy_set_sw_chnl_cmd_array(dev, ieee->PreCommonCmd, 554 553 PreCommonCmdCnt++, 555 554 MAX_PRECMD_CNT, 556 - CmdID_SetTxPowerLevel, 555 + cmd_id_set_tx_power_level, 557 556 0, 0, 0); 558 557 _rtl92e_phy_set_sw_chnl_cmd_array(dev, ieee->PreCommonCmd, 559 558 PreCommonCmdCnt++, 560 - MAX_PRECMD_CNT, CmdID_End, 559 + MAX_PRECMD_CNT, cmd_id_end, 561 560 0, 0, 0); 562 561 563 562 PostCommonCmdCnt = 0; 564 563 565 564 _rtl92e_phy_set_sw_chnl_cmd_array(dev, ieee->PostCommonCmd, 566 565 PostCommonCmdCnt++, 567 - MAX_POSTCMD_CNT, CmdID_End, 566 + MAX_POSTCMD_CNT, cmd_id_end, 568 567 0, 0, 0); 569 568 570 569 RfDependCmdCnt = 0; ··· 579 578 ieee->RfDependCmd, 580 579 RfDependCmdCnt++, 581 580 MAX_RFDEPENDCMD_CNT, 582 - CmdID_RF_WriteReg, 581 + cmd_id_rf_write_reg, 583 582 rZebra1_Channel, 584 583 channel, 10); 585 584 _rtl92e_phy_set_sw_chnl_cmd_array(dev, 586 585 ieee->RfDependCmd, 587 586 RfDependCmdCnt++, 588 587 MAX_RFDEPENDCMD_CNT, 589 - CmdID_End, 0, 0, 0); 588 + cmd_id_end, 0, 0, 0); 590 589 591 590 do { 592 591 switch (*stage) { ··· 601 600 break; 602 601 } 603 602 604 - if (CurrentCmd && CurrentCmd->CmdID == CmdID_End) { 603 + if (CurrentCmd && CurrentCmd->cmd_id == cmd_id_end) { 605 604 if ((*stage) == 2) 606 605 return true; 607 606 (*stage)++; ··· 611 610 612 611 if (!CurrentCmd) 613 612 continue; 614 - switch (CurrentCmd->CmdID) { 615 - case CmdID_SetTxPowerLevel: 613 + switch (CurrentCmd->cmd_id) { 614 + case cmd_id_set_tx_power_level: 616 615 if (priv->ic_cut > VERSION_8190_BD) 617 616 _rtl92e_set_tx_power_level(dev, 618 617 channel); 619 618 break; 620 - case CmdID_WritePortUlong: 621 - rtl92e_writel(dev, CurrentCmd->Para1, 622 - CurrentCmd->Para2); 619 + case cmd_id_write_port_ulong: 620 + rtl92e_writel(dev, CurrentCmd->para1, 621 + CurrentCmd->para2); 623 622 break; 624 - case CmdID_WritePortUshort: 625 - rtl92e_writew(dev, CurrentCmd->Para1, 626 - CurrentCmd->Para2); 623 + case cmd_id_write_port_ushort: 624 + rtl92e_writew(dev, CurrentCmd->para1, 625 + CurrentCmd->para2); 627 626 break; 628 - case CmdID_WritePortUchar: 629 - rtl92e_writeb(dev, CurrentCmd->Para1, 630 - CurrentCmd->Para2); 627 + case cmd_id_write_port_uchar: 628 + rtl92e_writeb(dev, CurrentCmd->para1, 629 + CurrentCmd->para2); 631 630 break; 632 - case CmdID_RF_WriteReg: 631 + case cmd_id_rf_write_reg: 633 632 for (eRFPath = 0; eRFPath < 634 633 priv->num_total_rf_path; eRFPath++) 635 634 rtl92e_set_rf_reg(dev, 636 635 (enum rf90_radio_path)eRFPath, 637 - CurrentCmd->Para1, bMask12Bits, 638 - CurrentCmd->Para2 << 7); 636 + CurrentCmd->para1, bMask12Bits, 637 + CurrentCmd->para2 << 7); 639 638 break; 640 639 default: 641 640 break; ··· 645 644 } while (true); 646 645 } /*for (Number of RF paths)*/ 647 646 648 - (*delay) = CurrentCmd->msDelay; 647 + (*delay) = CurrentCmd->ms_delay; 649 648 (*step)++; 650 649 return false; 651 650 } ··· 945 944 case IG_Restore: 946 945 BitMask = 0x7f; 947 946 rtl92e_set_bb_reg(dev, rOFDM0_XAAGCCore1, BitMask, 948 - (u32)priv->initgain_backup.xaagccore1); 947 + (u32)priv->initgain_backup.xaagccore1); 949 948 rtl92e_set_bb_reg(dev, rOFDM0_XBAGCCore1, BitMask, 950 - (u32)priv->initgain_backup.xbagccore1); 949 + (u32)priv->initgain_backup.xbagccore1); 951 950 rtl92e_set_bb_reg(dev, rOFDM0_XCAGCCore1, BitMask, 952 - (u32)priv->initgain_backup.xcagccore1); 951 + (u32)priv->initgain_backup.xcagccore1); 953 952 rtl92e_set_bb_reg(dev, rOFDM0_XDAGCCore1, BitMask, 954 - (u32)priv->initgain_backup.xdagccore1); 953 + (u32)priv->initgain_backup.xdagccore1); 955 954 BitMask = bMaskByte2; 956 955 rtl92e_set_bb_reg(dev, rCCK0_CCA, BitMask, 957 - (u32)priv->initgain_backup.cca); 956 + (u32)priv->initgain_backup.cca); 958 957 959 958 rtl92e_set_tx_power(dev, 960 - priv->rtllib->current_network.channel); 959 + priv->rtllib->current_network.channel); 961 960 break; 962 961 } 963 962 }
+2 -4
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h
··· 20 20 enum rf90_radio_path { 21 21 RF90_PATH_A = 0, 22 22 RF90_PATH_B = 1, 23 - RF90_PATH_C = 2, 24 - RF90_PATH_D = 3, 25 23 RF90_PATH_MAX 26 24 }; 27 25 ··· 43 45 void rtl92e_set_bw_mode(struct net_device *dev, 44 46 enum ht_channel_width bandwidth, 45 47 enum ht_extchnl_offset Offset); 46 - void rtl92e_init_gain(struct net_device *dev, u8 Operation); 48 + void rtl92e_init_gain(struct net_device *dev, u8 operation); 47 49 48 50 void rtl92e_set_rf_off(struct net_device *dev); 49 51 50 52 bool rtl92e_set_rf_power_state(struct net_device *dev, 51 53 enum rt_rf_power_state rf_power_state); 52 54 53 - void rtl92e_scan_op_backup(struct net_device *dev, u8 Operation); 55 + void rtl92e_scan_op_backup(struct net_device *dev, u8 operation); 54 56 55 57 #endif
+10 -10
drivers/staging/rtl8192e/rtl8192e/rtl_core.c
··· 25 25 int hwwep = 1; 26 26 static char *ifname = "wlan%d"; 27 27 28 - static struct pci_device_id rtl8192_pci_id_tbl[] = { 28 + static const struct pci_device_id rtl8192_pci_id_tbl[] = { 29 29 {PCI_DEVICE(0x10ec, 0x8192)}, 30 30 {PCI_DEVICE(0x07aa, 0x0044)}, 31 31 {PCI_DEVICE(0x07aa, 0x0047)}, ··· 173 173 else 174 174 priv->blinked_ingpio = false; 175 175 rtllib_mgnt_disconnect(priv->rtllib, 176 - WLAN_REASON_DISASSOC_STA_HAS_LEFT); 176 + WLAN_REASON_DISASSOC_STA_HAS_LEFT); 177 177 } 178 178 } 179 179 if ((change_source == RF_CHANGE_BY_HW) && !priv->hw_radio_off) ··· 322 322 323 323 if (network->flags & NETWORK_HAS_QOS_MASK) { 324 324 if (active_network && 325 - (network->flags & NETWORK_HAS_QOS_PARAMETERS)) 325 + (network->flags & NETWORK_HAS_QOS_PARAMETERS)) 326 326 network->qos_data.active = network->qos_data.supported; 327 327 328 328 if ((network->qos_data.active == 1) && (active_network == 1) && ··· 665 665 priv->rtllib->init_gain_handler = rtl92e_init_gain; 666 666 priv->rtllib->rtllib_ips_leave_wq = rtl92e_rtllib_ips_leave_wq; 667 667 priv->rtllib->rtllib_ips_leave = rtl92e_rtllib_ips_leave; 668 - priv->rtllib->ScanOperationBackupHandler = rtl92e_scan_op_backup; 668 + priv->rtllib->scan_operation_backup_handler = rtl92e_scan_op_backup; 669 669 } 670 670 671 671 static void _rtl92e_init_priv_variable(struct net_device *dev) ··· 860 860 skb = __skb_peek(&ring->queue); 861 861 tcb_desc = (struct cb_desc *)(skb->cb + 862 862 MAX_DEV_ADDR_SIZE); 863 - tcb_desc->nStuckCount++; 863 + tcb_desc->stuck_count++; 864 864 bCheckFwTxCnt = true; 865 - if (tcb_desc->nStuckCount > 1) 865 + if (tcb_desc->stuck_count > 1) 866 866 netdev_info(dev, 867 - "%s: QueueID=%d tcb_desc->nStuckCount=%d\n", 867 + "%s: QueueID=%d tcb_desc->stuck_count=%d\n", 868 868 __func__, QueueID, 869 - tcb_desc->nStuckCount); 869 + tcb_desc->stuck_count); 870 870 } 871 871 } 872 872 spin_unlock_irqrestore(&priv->irq_th_lock, flags); ··· 1522 1522 priv->rxbuffersize, DMA_FROM_DEVICE); 1523 1523 1524 1524 skb_put(skb, pdesc->Length); 1525 - skb_reserve(skb, stats.RxDrvInfoSize + 1526 - stats.RxBufShift); 1525 + skb_reserve(skb, stats.rx_drv_info_size + 1526 + stats.rx_buf_shift); 1527 1527 skb_trim(skb, skb->len - S_CRC_LEN); 1528 1528 rtllib_hdr = (struct ieee80211_hdr *)skb->data; 1529 1529 if (!is_multicast_ether_addr(rtllib_hdr->addr1)) {
+1 -1
drivers/staging/rtl8192e/rtl8192e/rtl_core.h
··· 300 300 301 301 u32 rf_reg_0value[4]; 302 302 u8 num_total_rf_path; 303 - bool brfpath_rxenable[4]; 303 + bool brfpath_rxenable[RF90_PATH_MAX]; 304 304 305 305 bool tx_pwr_data_read_from_eeprom; 306 306
+1 -2
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
··· 1484 1484 rtl92e_set_bb_reg(dev, 1485 1485 rOFDM1_TRxPathEnable, 1486 1486 0x1 << i, 0x1); 1487 - dm_rx_path_sel_table.rf_enable_rssi_th[i] 1488 - = 100; 1487 + dm_rx_path_sel_table.rf_enable_rssi_th[i] = 100; 1489 1488 disabled_rf_cnt--; 1490 1489 } 1491 1490 }
+1 -2
drivers/staging/rtl8192e/rtl8192e/rtl_ps.c
··· 204 204 &priv->rtllib->pwr_save_ctrl; 205 205 206 206 if (!((priv->rtllib->iw_mode == IW_MODE_INFRA) && 207 - (priv->rtllib->link_state == MAC80211_LINKED))) 207 + (priv->rtllib->link_state == MAC80211_LINKED))) 208 208 return; 209 209 210 210 if (psc->bLeisurePs) { 211 211 if (psc->lps_idle_count >= RT_CHECK_FOR_HANG_PERIOD) { 212 - 213 212 if (priv->rtllib->ps == RTLLIB_PS_DISABLED) 214 213 _rtl92e_ps_set_mode(dev, RTLLIB_PS_MBCAST | RTLLIB_PS_UNICAST); 215 214 } else {
+8 -7
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
··· 288 288 if (priv->rtllib->rf_power_state != rf_off) { 289 289 priv->rtllib->actscanning = true; 290 290 291 - ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_BACKUP); 291 + ieee->scan_operation_backup_handler(ieee->dev, SCAN_OPT_BACKUP); 292 292 293 293 rtllib_start_scan_syncro(priv->rtllib); 294 294 295 - ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_RESTORE); 295 + ieee->scan_operation_backup_handler(ieee->dev, SCAN_OPT_RESTORE); 296 296 } 297 297 ret = 0; 298 298 } else { ··· 526 526 mutex_unlock(&priv->wx_mutex); 527 527 528 528 if (wrqu->encoding.flags & IW_ENCODE_DISABLED) { 529 - ieee->pairwise_key_type = ieee->group_key_type = KEY_TYPE_NA; 529 + ieee->pairwise_key_type = KEY_TYPE_NA; 530 + ieee->group_key_type = KEY_TYPE_NA; 530 531 rtl92e_cam_reset(dev); 531 532 memset(priv->rtllib->swcamtable, 0, 532 533 sizeof(struct sw_cam_table) * 32); ··· 676 675 u8 idx = 0, alg = 0, group = 0; 677 676 678 677 if ((encoding->flags & IW_ENCODE_DISABLED) || 679 - ext->alg == IW_ENCODE_ALG_NONE) { 680 - ieee->pairwise_key_type = ieee->group_key_type 681 - = KEY_TYPE_NA; 678 + ext->alg == IW_ENCODE_ALG_NONE) { 679 + ieee->pairwise_key_type = KEY_TYPE_NA; 680 + ieee->group_key_type = KEY_TYPE_NA; 682 681 rtl92e_cam_reset(dev); 683 682 memset(priv->rtllib->swcamtable, 0, 684 683 sizeof(struct sw_cam_table) * 32); ··· 711 710 rtl92e_set_swcam(dev, idx, idx, alg, broadcast_addr, key); 712 711 } else { 713 712 if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && 714 - ieee->ht_info->current_ht_support) 713 + ieee->ht_info->current_ht_support) 715 714 rtl92e_writeb(dev, 0x173, 1); 716 715 rtl92e_set_key(dev, 4, idx, alg, 717 716 (u8 *)ieee->ap_mac_addr, 0, key);
+20 -20
drivers/staging/rtl8192e/rtl819x_HTProc.c
··· 188 188 } 189 189 190 190 static u8 ht_iot_act_is_mgnt_use_cck_6m(struct rtllib_device *ieee, 191 - struct rtllib_network *network) 191 + struct rtllib_network *network) 192 192 { 193 193 u8 retValue = 0; 194 194 ··· 559 559 } 560 560 561 561 void ht_reset_self_and_save_peer_setting(struct rtllib_device *ieee, 562 - struct rtllib_network *pNetwork) 562 + struct rtllib_network *network) 563 563 { 564 564 struct rt_hi_throughput *ht_info = ieee->ht_info; 565 565 u8 bIOTAction = 0; ··· 567 567 /* unmark enable_ht flag here is the same reason why unmarked in 568 568 * function rtllib_softmac_new_net. WB 2008.09.10 569 569 */ 570 - if (pNetwork->bssht.bd_support_ht) { 570 + if (network->bssht.bd_support_ht) { 571 571 ht_info->current_ht_support = true; 572 - ht_info->peer_ht_spec_ver = pNetwork->bssht.bd_ht_spec_ver; 572 + ht_info->peer_ht_spec_ver = network->bssht.bd_ht_spec_ver; 573 573 574 - if (pNetwork->bssht.bd_ht_cap_len > 0 && 575 - pNetwork->bssht.bd_ht_cap_len <= sizeof(ht_info->peer_ht_cap_buf)) 574 + if (network->bssht.bd_ht_cap_len > 0 && 575 + network->bssht.bd_ht_cap_len <= sizeof(ht_info->peer_ht_cap_buf)) 576 576 memcpy(ht_info->peer_ht_cap_buf, 577 - pNetwork->bssht.bd_ht_cap_buf, 578 - pNetwork->bssht.bd_ht_cap_len); 577 + network->bssht.bd_ht_cap_buf, 578 + network->bssht.bd_ht_cap_len); 579 579 580 - if (pNetwork->bssht.bd_ht_info_len > 0 && 581 - pNetwork->bssht.bd_ht_info_len <= 580 + if (network->bssht.bd_ht_info_len > 0 && 581 + network->bssht.bd_ht_info_len <= 582 582 sizeof(ht_info->peer_ht_info_buf)) 583 583 memcpy(ht_info->peer_ht_info_buf, 584 - pNetwork->bssht.bd_ht_info_buf, 585 - pNetwork->bssht.bd_ht_info_len); 584 + network->bssht.bd_ht_info_buf, 585 + network->bssht.bd_ht_info_len); 586 586 587 587 ht_info->current_rt2rt_aggregation = 588 - pNetwork->bssht.bd_rt2rt_aggregation; 588 + network->bssht.bd_rt2rt_aggregation; 589 589 ht_info->current_rt2rt_long_slot_time = 590 - pNetwork->bssht.bd_rt2rt_long_slot_time; 590 + network->bssht.bd_rt2rt_long_slot_time; 591 591 592 592 ht_iot_peer_determine(ieee); 593 593 594 594 ht_info->iot_action = 0; 595 - bIOTAction = ht_iot_act_is_mgnt_use_cck_6m(ieee, pNetwork); 595 + bIOTAction = ht_iot_act_is_mgnt_use_cck_6m(ieee, network); 596 596 if (bIOTAction) 597 597 ht_info->iot_action |= HT_IOT_ACT_MGNT_USE_CCK_6M; 598 598 bIOTAction = ht_iot_act_is_ccd_fsync(ieee); ··· 609 609 } 610 610 611 611 void HT_update_self_and_peer_setting(struct rtllib_device *ieee, 612 - struct rtllib_network *pNetwork) 612 + struct rtllib_network *network) 613 613 { 614 614 struct rt_hi_throughput *ht_info = ieee->ht_info; 615 615 struct ht_info_ele *pPeerHTInfo = 616 - (struct ht_info_ele *)pNetwork->bssht.bd_ht_info_buf; 616 + (struct ht_info_ele *)network->bssht.bd_ht_info_buf; 617 617 618 618 if (ht_info->current_ht_support) { 619 - if (pNetwork->bssht.bd_ht_info_len != 0) 619 + if (network->bssht.bd_ht_info_len != 0) 620 620 ht_info->current_op_mode = pPeerHTInfo->opt_mode; 621 621 } 622 622 } 623 623 EXPORT_SYMBOL(HT_update_self_and_peer_setting); 624 624 625 - u8 ht_c_check(struct rtllib_device *ieee, u8 *pFrame) 625 + u8 ht_c_check(struct rtllib_device *ieee, u8 *frame) 626 626 { 627 627 if (ieee->ht_info->current_ht_support) { 628 - if ((is_qos_data_frame(pFrame) && frame_order(pFrame)) == 1) { 628 + if ((is_qos_data_frame(frame) && frame_order(frame)) == 1) { 629 629 netdev_dbg(ieee->dev, "HT CONTROL FILED EXIST!!\n"); 630 630 return true; 631 631 }
+15 -15
drivers/staging/rtl8192e/rtl819x_TSProc.c
··· 14 14 struct rtllib_device *ieee = container_of(ts, struct rtllib_device, 15 15 rx_ts_records[ts->num]); 16 16 17 - struct rx_reorder_entry *pReorderEntry = NULL; 17 + struct rx_reorder_entry *reorder_entry = NULL; 18 18 19 19 unsigned long flags = 0; 20 20 u8 index = 0; ··· 23 23 spin_lock_irqsave(&(ieee->reorder_spinlock), flags); 24 24 if (ts->rx_timeout_indicate_seq != 0xffff) { 25 25 while (!list_empty(&ts->rx_pending_pkt_list)) { 26 - pReorderEntry = (struct rx_reorder_entry *) 26 + reorder_entry = (struct rx_reorder_entry *) 27 27 list_entry(ts->rx_pending_pkt_list.prev, 28 28 struct rx_reorder_entry, list); 29 29 if (index == 0) 30 - ts->rx_indicate_seq = pReorderEntry->SeqNum; 30 + ts->rx_indicate_seq = reorder_entry->seq_num; 31 31 32 - if (SN_LESS(pReorderEntry->SeqNum, 32 + if (SN_LESS(reorder_entry->seq_num, 33 33 ts->rx_indicate_seq) || 34 - SN_EQUAL(pReorderEntry->SeqNum, 34 + SN_EQUAL(reorder_entry->seq_num, 35 35 ts->rx_indicate_seq)) { 36 - list_del_init(&pReorderEntry->list); 36 + list_del_init(&reorder_entry->list); 37 37 38 - if (SN_EQUAL(pReorderEntry->SeqNum, 38 + if (SN_EQUAL(reorder_entry->seq_num, 39 39 ts->rx_indicate_seq)) 40 40 ts->rx_indicate_seq = 41 41 (ts->rx_indicate_seq + 1) % 4096; 42 42 43 43 netdev_dbg(ieee->dev, 44 - "%s(): Indicate SeqNum: %d\n", 45 - __func__, pReorderEntry->SeqNum); 44 + "%s(): Indicate seq_num: %d\n", 45 + __func__, reorder_entry->seq_num); 46 46 ieee->stats_IndicateArray[index] = 47 - pReorderEntry->prxb; 47 + reorder_entry->prxb; 48 48 index++; 49 49 50 - list_add_tail(&pReorderEntry->list, 50 + list_add_tail(&reorder_entry->list, 51 51 &ieee->RxReorder_Unused_List); 52 52 } else { 53 53 pkt_in_buf = true; ··· 225 225 } 226 226 227 227 bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS, 228 - u8 *addr, u8 TID, enum tr_select tx_rx_select, bool bAddNewTs) 228 + u8 *addr, u8 TID, enum tr_select tx_rx_select, bool add_new_ts) 229 229 { 230 230 u8 UP = 0; 231 231 struct qos_tsinfo tspec; ··· 269 269 if (*ppTS) 270 270 return true; 271 271 272 - if (!bAddNewTs) { 272 + if (!add_new_ts) { 273 273 netdev_dbg(ieee->dev, "add new TS failed(tid:%d)\n", UP); 274 274 return false; 275 275 } ··· 336 336 pRxReorderEntry = (struct rx_reorder_entry *) 337 337 list_entry(ts->rx_pending_pkt_list.prev, 338 338 struct rx_reorder_entry, list); 339 - netdev_dbg(ieee->dev, "%s(): Delete SeqNum %d!\n", 340 - __func__, pRxReorderEntry->SeqNum); 339 + netdev_dbg(ieee->dev, "%s(): Delete seq_num %d!\n", 340 + __func__, pRxReorderEntry->seq_num); 341 341 list_del_init(&pRxReorderEntry->list); 342 342 { 343 343 int i = 0;
+65 -76
drivers/staging/rtl8192e/rtllib.h
··· 93 93 #define SUPPORT_CKIP_PK 0x10 94 94 #define RT_RF_OFF_LEVL_HALT_NIC BIT(3) 95 95 #define RT_IN_PS_LEVEL(psc, _PS_FLAG) \ 96 - ((psc->CurPsLevel & _PS_FLAG) ? true : false) 96 + ((psc->cur_ps_level & _PS_FLAG) ? true : false) 97 97 #define RT_CLEAR_PS_LEVEL(psc, _PS_FLAG) \ 98 - (psc->CurPsLevel &= (~(_PS_FLAG))) 98 + (psc->cur_ps_level &= (~(_PS_FLAG))) 99 99 100 100 /* defined for skb cb field */ 101 101 /* At most 28 byte */ 102 102 struct cb_desc { 103 103 /* Tx Desc Related flags (8-9) */ 104 - u8 bLastIniPkt:1; 105 - u8 bCmdOrInit:1; 104 + u8 last_ini_pkt:1; 105 + u8 cmd_or_init:1; 106 106 u8 tx_dis_rate_fallback:1; 107 107 u8 tx_use_drv_assinged_rate:1; 108 108 u8 hw_sec:1; 109 109 110 - u8 nStuckCount; 110 + u8 stuck_count; 111 111 112 112 /* Tx Firmware Related flags (10-11)*/ 113 113 u8 cts_enable:1; ··· 153 153 }; 154 154 155 155 enum sw_chnl_cmd_id { 156 - CmdID_End, 157 - CmdID_SetTxPowerLevel, 158 - CmdID_BBRegWrite10, 159 - CmdID_WritePortUlong, 160 - CmdID_WritePortUshort, 161 - CmdID_WritePortUchar, 162 - CmdID_RF_WriteReg, 156 + cmd_id_end, 157 + cmd_id_set_tx_power_level, 158 + cmd_id_bbreg_write10, 159 + cmd_id_write_port_ulong, 160 + cmd_id_write_port_ushort, 161 + cmd_id_write_port_uchar, 162 + cmd_id_rf_write_reg, 163 163 }; 164 164 165 165 struct sw_chnl_cmd { 166 - enum sw_chnl_cmd_id CmdID; 167 - u32 Para1; 168 - u32 Para2; 169 - u32 msDelay; 166 + enum sw_chnl_cmd_id cmd_id; 167 + u32 para1; 168 + u32 para2; 169 + u32 ms_delay; 170 170 }; 171 171 172 172 /*--------------------------Define -------------------------------------------*/ ··· 339 339 340 340 #define FC_QOS_BIT BIT(7) 341 341 #define is_data_frame(pdu) (((pdu[0] & 0x0C) == 0x08) ? true : false) 342 - #define is_legacy_data_frame(pdu) (is_data_frame(pdu) && (!(pdu[0]&FC_QOS_BIT))) 342 + #define is_legacy_data_frame(pdu) (is_data_frame(pdu) && (!(pdu[0] & FC_QOS_BIT))) 343 343 #define is_qos_data_frame(pframe) \ 344 - ((*(u16 *)pframe&(IEEE80211_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA)) == \ 345 - (IEEE80211_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA)) 346 - #define frame_order(pframe) (*(u16 *)pframe&IEEE80211_FCTL_ORDER) 347 - #define SN_LESS(a, b) (((a-b)&0x800) != 0) 344 + ((*(u16 *)pframe & (IEEE80211_STYPE_QOS_DATA | RTLLIB_FTYPE_DATA)) == \ 345 + (IEEE80211_STYPE_QOS_DATA | RTLLIB_FTYPE_DATA)) 346 + #define frame_order(pframe) (*(u16 *)pframe & IEEE80211_FCTL_ORDER) 347 + #define SN_LESS(a, b) (((a - b) & 0x800) != 0) 348 348 #define SN_EQUAL(a, b) (a == b) 349 349 #define MAX_DEV_ADDR_SIZE 8 350 350 ··· 414 414 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTLLIB_SCTL_FRAG) 415 415 #define WLAN_GET_SEQ_SEQ(seq) (((seq) & RTLLIB_SCTL_SEQ) >> 4) 416 416 417 - /* Authentication algorithms */ 418 - #define WLAN_AUTH_OPEN 0 419 - #define WLAN_AUTH_SHARED_KEY 1 420 - #define WLAN_AUTH_LEAP 128 421 - 422 - #define WLAN_CAPABILITY_ESS (1<<0) 423 - #define WLAN_CAPABILITY_IBSS (1<<1) 424 - #define WLAN_CAPABILITY_PRIVACY (1<<4) 425 - #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) 426 - #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) 427 - 428 - #define RTLLIB_STATMASK_SIGNAL (1<<0) 429 - #define RTLLIB_STATMASK_RSSI (1<<1) 430 - #define RTLLIB_STATMASK_NOISE (1<<2) 417 + #define RTLLIB_STATMASK_SIGNAL (1 << 0) 418 + #define RTLLIB_STATMASK_RSSI (1 << 1) 419 + #define RTLLIB_STATMASK_NOISE (1 << 2) 431 420 #define RTLLIB_STATMASK_WEMASK 0x7 432 421 433 - #define RTLLIB_CCK_MODULATION (1<<0) 434 - #define RTLLIB_OFDM_MODULATION (1<<1) 422 + #define RTLLIB_CCK_MODULATION (1 << 0) 423 + #define RTLLIB_OFDM_MODULATION (1 << 1) 435 424 436 425 #define RTLLIB_CCK_RATE_LEN 4 437 426 #define RTLLIB_CCK_RATE_1MB 0x02 ··· 464 475 u8 mask; 465 476 u16 len; 466 477 u16 Length; 467 - u8 SignalQuality; 478 + u8 signal_quality; 468 479 s32 RecvSignalPower; 469 - u8 SignalStrength; 470 - u16 bHwError:1; 480 + u8 signal_strength; 481 + u16 hw_error:1; 471 482 u16 bCRC:1; 472 483 u16 bICV:1; 473 484 u16 decrypted:1; 474 485 u32 time_stamp_low; 475 486 u32 time_stamp_high; 476 487 477 - u8 RxDrvInfoSize; 478 - u8 RxBufShift; 488 + u8 rx_drv_info_size; 489 + u8 rx_buf_shift; 479 490 bool bIsAMPDU; 480 491 bool bFirstMPDU; 481 492 bool contain_htc; 482 493 u32 RxPWDBAll; 483 - u8 RxMIMOSignalStrength[4]; 494 + u8 RxMIMOSignalStrength[2]; 484 495 s8 RxMIMOSignalQuality[2]; 485 496 bool bPacketMatchBSSID; 486 497 bool bIsCCK; 487 - bool bPacketToSelf; 498 + bool packet_to_self; 488 499 bool bPacketBeacon; 489 500 bool bToSelfBA; 490 501 }; ··· 507 518 508 519 struct rtllib_device; 509 520 510 - #define SEC_ACTIVE_KEY (1<<4) 511 - #define SEC_AUTH_MODE (1<<5) 512 - #define SEC_UNICAST_GROUP (1<<6) 513 - #define SEC_LEVEL (1<<7) 514 - #define SEC_ENABLED (1<<8) 521 + #define SEC_ACTIVE_KEY (1 << 4) 522 + #define SEC_AUTH_MODE (1 << 5) 523 + #define SEC_UNICAST_GROUP (1 << 6) 524 + #define SEC_LEVEL (1 << 7) 525 + #define SEC_ENABLED (1 << 8) 515 526 516 527 #define SEC_LEVEL_0 0 /* None */ 517 528 #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ ··· 696 707 #define MAX_WPA_IE_LEN 64 697 708 #define MAX_WZC_IE_LEN 256 698 709 699 - #define NETWORK_EMPTY_ESSID (1<<0) 700 - #define NETWORK_HAS_OFDM (1<<1) 701 - #define NETWORK_HAS_CCK (1<<2) 710 + #define NETWORK_EMPTY_ESSID (1 << 0) 711 + #define NETWORK_HAS_OFDM (1 << 1) 712 + #define NETWORK_HAS_CCK (1 << 2) 702 713 703 714 /* QoS structure */ 704 - #define NETWORK_HAS_QOS_PARAMETERS (1<<3) 705 - #define NETWORK_HAS_QOS_INFORMATION (1<<4) 715 + #define NETWORK_HAS_QOS_PARAMETERS (1 << 3) 716 + #define NETWORK_HAS_QOS_INFORMATION (1 << 4) 706 717 #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \ 707 718 NETWORK_HAS_QOS_INFORMATION) 708 719 /* 802.11h */ 709 - #define NETWORK_HAS_ERP_VALUE (1<<10) 720 + #define NETWORK_HAS_ERP_VALUE (1 << 10) 710 721 711 722 #define QOS_QUEUE_NUM 4 712 723 #define QOS_OUI_LEN 3 ··· 951 962 bool unknown_cap_exist; 952 963 bool berp_info_valid; 953 964 bool buseprotection; 954 - u8 SignalStrength; 965 + u8 signal_strength; 955 966 u8 RSSI; 956 967 struct list_head list; 957 968 }; ··· 996 1007 #define DEFAULT_MAX_SCAN_AGE (15 * HZ) 997 1008 #define DEFAULT_FTS 2346 998 1009 999 - #define CFG_RTLLIB_RESERVE_FCS (1<<0) 1000 - #define CFG_RTLLIB_COMPUTE_FCS (1<<1) 1010 + #define CFG_RTLLIB_RESERVE_FCS (1 << 0) 1011 + #define CFG_RTLLIB_COMPUTE_FCS (1 << 1) 1001 1012 1002 1013 struct tx_pending { 1003 1014 int frag; ··· 1015 1026 #define REORDER_ENTRY_NUM 128 1016 1027 struct rx_reorder_entry { 1017 1028 struct list_head list; 1018 - u16 SeqNum; 1029 + u16 seq_num; 1019 1030 struct rtllib_rxb *prxb; 1020 1031 }; 1021 1032 ··· 1046 1057 u8 lps_idle_count; 1047 1058 u8 lps_awake_intvl; 1048 1059 1049 - u32 CurPsLevel; 1060 + u32 cur_ps_level; 1050 1061 }; 1051 1062 1052 1063 #define RT_RF_CHANGE_SOURCE u32 ··· 1288 1299 u16 scan_watch_dog; 1289 1300 1290 1301 /* map of allowed channels. 0 is dummy */ 1291 - u8 active_channel_map[MAX_CHANNEL_NUMBER+1]; 1302 + u8 active_channel_map[MAX_CHANNEL_NUMBER + 1]; 1292 1303 1293 1304 int rate; /* current rate */ 1294 1305 int basic_rate; ··· 1460 1471 void (*set_wireless_mode)(struct net_device *dev, u8 wireless_mode); 1461 1472 bool (*get_half_nmode_support_by_aps_handler)(struct net_device *dev); 1462 1473 u8 (*rtllib_ap_sec_type)(struct rtllib_device *ieee); 1463 - void (*init_gain_handler)(struct net_device *dev, u8 Operation); 1464 - void (*ScanOperationBackupHandler)(struct net_device *dev, 1465 - u8 Operation); 1474 + void (*init_gain_handler)(struct net_device *dev, u8 operation); 1475 + void (*scan_operation_backup_handler)(struct net_device *dev, 1476 + u8 operation); 1466 1477 void (*set_hw_reg_handler)(struct net_device *dev, u8 variable, u8 *val); 1467 1478 1468 1479 void (*allow_all_dest_addr_handler)(struct net_device *dev, ··· 1486 1497 /* Uses the channel change callback directly 1487 1498 * instead of [start/stop] scan callbacks 1488 1499 */ 1489 - #define IEEE_SOFTMAC_SCAN (1<<2) 1500 + #define IEEE_SOFTMAC_SCAN (1 << 2) 1490 1501 1491 1502 /* Perform authentication and association handshake */ 1492 - #define IEEE_SOFTMAC_ASSOCIATE (1<<3) 1503 + #define IEEE_SOFTMAC_ASSOCIATE (1 << 3) 1493 1504 1494 1505 /* Generate probe requests */ 1495 - #define IEEE_SOFTMAC_PROBERQ (1<<4) 1506 + #define IEEE_SOFTMAC_PROBERQ (1 << 4) 1496 1507 1497 1508 /* Generate response to probe requests */ 1498 - #define IEEE_SOFTMAC_PROBERS (1<<5) 1509 + #define IEEE_SOFTMAC_PROBERS (1 << 5) 1499 1510 1500 1511 /* The ieee802.11 stack will manage the netif queue 1501 1512 * wake/stop for the driver, taking care of 802.11 1502 1513 * fragmentation. See softmac.c for details. 1503 1514 */ 1504 - #define IEEE_SOFTMAC_TX_QUEUE (1<<7) 1515 + #define IEEE_SOFTMAC_TX_QUEUE (1 << 7) 1505 1516 1506 1517 /* Uses only the softmac_data_hard_start_xmit 1507 1518 * even for TX management frames. 1508 1519 */ 1509 - #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8) 1520 + #define IEEE_SOFTMAC_SINGLE_QUEUE (1 << 8) 1510 1521 1511 1522 /* Generate beacons. The stack will enqueue beacons 1512 1523 * to the card 1513 1524 */ 1514 - #define IEEE_SOFTMAC_BEACONS (1<<6) 1525 + #define IEEE_SOFTMAC_BEACONS (1 << 6) 1515 1526 1516 1527 static inline void *rtllib_priv(struct net_device *dev) 1517 1528 { ··· 1726 1737 void ht_update_default_setting(struct rtllib_device *ieee); 1727 1738 void ht_construct_capability_element(struct rtllib_device *ieee, 1728 1739 u8 *pos_ht_cap, u8 *len, 1729 - u8 isEncrypt, bool bAssoc); 1740 + u8 is_encrypt, bool assoc); 1730 1741 void ht_construct_rt2rt_agg_element(struct rtllib_device *ieee, 1731 1742 u8 *posRT2RTAgg, u8 *len); 1732 1743 void ht_on_assoc_rsp(struct rtllib_device *ieee); 1733 1744 void ht_initialize_ht_info(struct rtllib_device *ieee); 1734 1745 void ht_initialize_bss_desc(struct bss_ht *bss_ht); 1735 1746 void ht_reset_self_and_save_peer_setting(struct rtllib_device *ieee, 1736 - struct rtllib_network *pNetwork); 1747 + struct rtllib_network *network); 1737 1748 void HT_update_self_and_peer_setting(struct rtllib_device *ieee, 1738 - struct rtllib_network *pNetwork); 1749 + struct rtllib_network *network); 1739 1750 u8 ht_get_highest_mcs_rate(struct rtllib_device *ieee, u8 *pMCSRateSet, 1740 1751 u8 *pMCSFilter); 1741 1752 extern u8 MCS_FILTER_ALL[]; 1742 1753 extern u16 MCS_DATA_RATE[2][2][77]; 1743 - u8 ht_c_check(struct rtllib_device *ieee, u8 *pFrame); 1754 + u8 ht_c_check(struct rtllib_device *ieee, u8 *frame); 1744 1755 void ht_reset_iot_setting(struct rt_hi_throughput *ht_info); 1745 1756 bool is_ht_half_nmode_aps(struct rtllib_device *ieee); 1746 1757 u16 tx_count_to_data_rate(struct rtllib_device *ieee, u8 nDataRate); ··· 1757 1768 void rtllib_rx_ba_inact_timeout(struct timer_list *t); 1758 1769 void rtllib_reset_ba_entry(struct ba_record *ba); 1759 1770 bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 *addr, 1760 - u8 TID, enum tr_select tx_rx_select, bool bAddNewTs); 1771 + u8 TID, enum tr_select tx_rx_select, bool add_new_ts); 1761 1772 void rtllib_ts_init(struct rtllib_device *ieee); 1762 1773 void rtllib_ts_start_add_ba_process(struct rtllib_device *ieee, 1763 1774 struct tx_ts_record *pTxTS);
-6
drivers/staging/rtl8192e/rtllib_crypt_tkip.c
··· 637 637 638 638 if (seq) { 639 639 /* Return the sequence number of the last transmitted frame. */ 640 - u16 iv16 = tkey->tx_iv16; 641 - u32 iv32 = tkey->tx_iv32; 642 - 643 - if (iv16 == 0) 644 - iv32--; 645 - iv16--; 646 640 seq[0] = tkey->tx_iv16; 647 641 seq[1] = tkey->tx_iv16 >> 8; 648 642 seq[2] = tkey->tx_iv32;
+70 -70
drivers/staging/rtl8192e/rtllib_rx.c
··· 403 403 } 404 404 405 405 static bool add_reorder_entry(struct rx_ts_record *ts, 406 - struct rx_reorder_entry *pReorderEntry) 406 + struct rx_reorder_entry *reorder_entry) 407 407 { 408 408 struct list_head *list = &ts->rx_pending_pkt_list; 409 409 410 410 while (list->next != &ts->rx_pending_pkt_list) { 411 - if (SN_LESS(pReorderEntry->SeqNum, ((struct rx_reorder_entry *) 411 + if (SN_LESS(reorder_entry->seq_num, ((struct rx_reorder_entry *) 412 412 list_entry(list->next, struct rx_reorder_entry, 413 - list))->SeqNum)) 413 + list))->seq_num)) 414 414 list = list->next; 415 - else if (SN_EQUAL(pReorderEntry->SeqNum, 415 + else if (SN_EQUAL(reorder_entry->seq_num, 416 416 ((struct rx_reorder_entry *)list_entry(list->next, 417 - struct rx_reorder_entry, list))->SeqNum)) 417 + struct rx_reorder_entry, list))->seq_num)) 418 418 return false; 419 419 else 420 420 break; 421 421 } 422 - pReorderEntry->list.next = list->next; 423 - pReorderEntry->list.next->prev = &pReorderEntry->list; 424 - pReorderEntry->list.prev = list; 425 - list->next = &pReorderEntry->list; 422 + reorder_entry->list.next = list->next; 423 + reorder_entry->list.next->prev = &reorder_entry->list; 424 + reorder_entry->list.prev = list; 425 + list->next = &reorder_entry->list; 426 426 427 427 return true; 428 428 } ··· 504 504 pRxReorderEntry = (struct rx_reorder_entry *) 505 505 list_entry(ts->rx_pending_pkt_list.prev, 506 506 struct rx_reorder_entry, list); 507 - netdev_dbg(ieee->dev, "%s(): Indicate SeqNum %d!\n", __func__, 508 - pRxReorderEntry->SeqNum); 507 + netdev_dbg(ieee->dev, "%s(): Indicate seq_num %d!\n", __func__, 508 + pRxReorderEntry->seq_num); 509 509 list_del_init(&pRxReorderEntry->list); 510 510 511 511 ieee->rfd_array[rfd_cnt] = pRxReorderEntry->prxb; ··· 521 521 522 522 static void rx_reorder_indicate_packet(struct rtllib_device *ieee, 523 523 struct rtllib_rxb *prxb, 524 - struct rx_ts_record *ts, u16 SeqNum) 524 + struct rx_ts_record *ts, u16 seq_num) 525 525 { 526 526 struct rt_hi_throughput *ht_info = ieee->ht_info; 527 - struct rx_reorder_entry *pReorderEntry = NULL; 527 + struct rx_reorder_entry *reorder_entry = NULL; 528 528 u8 win_size = ht_info->rx_reorder_win_size; 529 529 u16 win_end = 0; 530 530 u8 index = 0; ··· 533 533 534 534 netdev_dbg(ieee->dev, 535 535 "%s(): Seq is %d, ts->rx_indicate_seq is %d, win_size is %d\n", 536 - __func__, SeqNum, ts->rx_indicate_seq, win_size); 536 + __func__, seq_num, ts->rx_indicate_seq, win_size); 537 537 538 538 spin_lock_irqsave(&(ieee->reorder_spinlock), flags); 539 539 540 540 win_end = (ts->rx_indicate_seq + win_size - 1) % 4096; 541 541 /* Rx Reorder initialize condition.*/ 542 542 if (ts->rx_indicate_seq == 0xffff) 543 - ts->rx_indicate_seq = SeqNum; 543 + ts->rx_indicate_seq = seq_num; 544 544 545 - /* Drop out the packet which SeqNum is smaller than WinStart */ 546 - if (SN_LESS(SeqNum, ts->rx_indicate_seq)) { 545 + /* Drop out the packet which seq_num is smaller than WinStart */ 546 + if (SN_LESS(seq_num, ts->rx_indicate_seq)) { 547 547 netdev_dbg(ieee->dev, 548 548 "Packet Drop! IndicateSeq: %d, NewSeq: %d\n", 549 - ts->rx_indicate_seq, SeqNum); 549 + ts->rx_indicate_seq, seq_num); 550 550 ht_info->rx_reorder_drop_counter++; 551 551 { 552 552 int i; ··· 561 561 } 562 562 563 563 /* Sliding window manipulation. Conditions includes: 564 - * 1. Incoming SeqNum is equal to WinStart =>Window shift 1 565 - * 2. Incoming SeqNum is larger than the win_end => Window shift N 564 + * 1. Incoming seq_num is equal to WinStart =>Window shift 1 565 + * 2. Incoming seq_num is larger than the win_end => Window shift N 566 566 */ 567 - if (SN_EQUAL(SeqNum, ts->rx_indicate_seq)) { 567 + if (SN_EQUAL(seq_num, ts->rx_indicate_seq)) { 568 568 ts->rx_indicate_seq = (ts->rx_indicate_seq + 1) % 4096; 569 569 match_win_start = true; 570 - } else if (SN_LESS(win_end, SeqNum)) { 571 - if (SeqNum >= (win_size - 1)) 572 - ts->rx_indicate_seq = SeqNum + 1 - win_size; 570 + } else if (SN_LESS(win_end, seq_num)) { 571 + if (seq_num >= (win_size - 1)) 572 + ts->rx_indicate_seq = seq_num + 1 - win_size; 573 573 else 574 574 ts->rx_indicate_seq = 4095 - 575 - (win_size - (SeqNum + 1)) + 1; 575 + (win_size - (seq_num + 1)) + 1; 576 576 netdev_dbg(ieee->dev, 577 577 "Window Shift! IndicateSeq: %d, NewSeq: %d\n", 578 - ts->rx_indicate_seq, SeqNum); 578 + ts->rx_indicate_seq, seq_num); 579 579 } 580 580 581 581 /* Indication process. 582 582 * After Packet dropping and Sliding Window shifting as above, we can 583 - * now just indicate the packets with the SeqNum smaller than latest 583 + * now just indicate the packets with the seq_num smaller than latest 584 584 * WinStart and struct buffer other packets. 585 585 * 586 586 * For Rx Reorder condition: 587 - * 1. All packets with SeqNum smaller than WinStart => Indicate 588 - * 2. All packets with SeqNum larger than or equal to 587 + * 1. All packets with seq_num smaller than WinStart => Indicate 588 + * 2. All packets with seq_num larger than or equal to 589 589 * WinStart => Buffer it. 590 590 */ 591 591 if (match_win_start) { 592 592 /* Current packet is going to be indicated.*/ 593 593 netdev_dbg(ieee->dev, 594 594 "Packets indication! IndicateSeq: %d, NewSeq: %d\n", 595 - ts->rx_indicate_seq, SeqNum); 595 + ts->rx_indicate_seq, seq_num); 596 596 ieee->prxb_indicate_array[0] = prxb; 597 597 index = 1; 598 598 } else { 599 599 /* Current packet is going to be inserted into pending list.*/ 600 600 if (!list_empty(&ieee->RxReorder_Unused_List)) { 601 - pReorderEntry = (struct rx_reorder_entry *) 601 + reorder_entry = (struct rx_reorder_entry *) 602 602 list_entry(ieee->RxReorder_Unused_List.next, 603 603 struct rx_reorder_entry, list); 604 - list_del_init(&pReorderEntry->list); 604 + list_del_init(&reorder_entry->list); 605 605 606 606 /* Make a reorder entry and insert 607 607 * into a the packet list. 608 608 */ 609 - pReorderEntry->SeqNum = SeqNum; 610 - pReorderEntry->prxb = prxb; 609 + reorder_entry->seq_num = seq_num; 610 + reorder_entry->prxb = prxb; 611 611 612 - if (!add_reorder_entry(ts, pReorderEntry)) { 612 + if (!add_reorder_entry(ts, reorder_entry)) { 613 613 int i; 614 614 615 615 netdev_dbg(ieee->dev, 616 616 "%s(): Duplicate packet is dropped. IndicateSeq: %d, NewSeq: %d\n", 617 617 __func__, ts->rx_indicate_seq, 618 - SeqNum); 619 - list_add_tail(&pReorderEntry->list, 618 + seq_num); 619 + list_add_tail(&reorder_entry->list, 620 620 &ieee->RxReorder_Unused_List); 621 621 622 622 for (i = 0; i < prxb->nr_subframes; i++) ··· 626 626 } else { 627 627 netdev_dbg(ieee->dev, 628 628 "Pkt insert into struct buffer. IndicateSeq: %d, NewSeq: %d\n", 629 - ts->rx_indicate_seq, SeqNum); 629 + ts->rx_indicate_seq, seq_num); 630 630 } 631 631 } else { 632 632 /* Packets are dropped if there are not enough reorder ··· 653 653 netdev_dbg(ieee->dev, "%s(): start RREORDER indicate\n", 654 654 __func__); 655 655 656 - pReorderEntry = (struct rx_reorder_entry *) 656 + reorder_entry = (struct rx_reorder_entry *) 657 657 list_entry(ts->rx_pending_pkt_list.prev, 658 658 struct rx_reorder_entry, 659 659 list); 660 - if (SN_LESS(pReorderEntry->SeqNum, ts->rx_indicate_seq) || 661 - SN_EQUAL(pReorderEntry->SeqNum, ts->rx_indicate_seq)) { 660 + if (SN_LESS(reorder_entry->seq_num, ts->rx_indicate_seq) || 661 + SN_EQUAL(reorder_entry->seq_num, ts->rx_indicate_seq)) { 662 662 /* This protect struct buffer from overflow. */ 663 663 if (index >= REORDER_WIN_SIZE) { 664 664 netdev_err(ieee->dev, ··· 668 668 break; 669 669 } 670 670 671 - list_del_init(&pReorderEntry->list); 671 + list_del_init(&reorder_entry->list); 672 672 673 - if (SN_EQUAL(pReorderEntry->SeqNum, ts->rx_indicate_seq)) 673 + if (SN_EQUAL(reorder_entry->seq_num, ts->rx_indicate_seq)) 674 674 ts->rx_indicate_seq = (ts->rx_indicate_seq + 1) % 675 675 4096; 676 676 677 - ieee->prxb_indicate_array[index] = pReorderEntry->prxb; 678 - netdev_dbg(ieee->dev, "%s(): Indicate SeqNum %d!\n", 679 - __func__, pReorderEntry->SeqNum); 677 + ieee->prxb_indicate_array[index] = reorder_entry->prxb; 678 + netdev_dbg(ieee->dev, "%s(): Indicate seq_num %d!\n", 679 + __func__, reorder_entry->seq_num); 680 680 index++; 681 681 682 - list_add_tail(&pReorderEntry->list, 682 + list_add_tail(&reorder_entry->list, 683 683 &ieee->RxReorder_Unused_List); 684 684 } else { 685 685 pkt_in_buf = true; ··· 729 729 730 730 u16 llc_offset = sizeof(struct ieee80211_hdr_3addr); 731 731 bool is_aggregate_frame = false; 732 - u16 nSubframe_Length; 732 + u16 subframe_len; 733 733 u8 pad_len = 0; 734 - u16 SeqNum = 0; 734 + u16 seq_num = 0; 735 735 struct sk_buff *sub_skb; 736 736 /* just for debug purpose */ 737 - SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctrl)); 737 + seq_num = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctrl)); 738 738 if ((RTLLIB_QOS_HAS_SEQ(fc)) && 739 739 (((union frameqos *)(skb->data + RTLLIB_3ADDR_LEN))->field.reserved)) 740 740 is_aggregate_frame = true; ··· 781 781 memcpy(rxb->dst, dst, ETH_ALEN); 782 782 while (skb->len > ETHERNET_HEADER_SIZE) { 783 783 /* Offset 12 denote 2 mac address */ 784 - nSubframe_Length = *((u16 *)(skb->data + 12)); 785 - nSubframe_Length = (nSubframe_Length >> 8) + 786 - (nSubframe_Length << 8); 784 + subframe_len = *((u16 *)(skb->data + 12)); 785 + subframe_len = (subframe_len >> 8) + 786 + (subframe_len << 8); 787 787 788 - if (skb->len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) { 788 + if (skb->len < (ETHERNET_HEADER_SIZE + subframe_len)) { 789 789 netdev_info(ieee->dev, 790 790 "%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n", 791 791 __func__, rxb->nr_subframes); 792 792 netdev_info(ieee->dev, 793 793 "%s: A-MSDU parse error!! Subframe Length: %d\n", 794 - __func__, nSubframe_Length); 794 + __func__, subframe_len); 795 795 netdev_info(ieee->dev, 796 - "nRemain_Length is %d and nSubframe_Length is : %d\n", 797 - skb->len, nSubframe_Length); 796 + "nRemain_Length is %d and subframe_len is : %d\n", 797 + skb->len, subframe_len); 798 798 netdev_info(ieee->dev, 799 - "The Packet SeqNum is %d\n", 800 - SeqNum); 799 + "The Packet seq_num is %d\n", 800 + seq_num); 801 801 return 0; 802 802 } 803 803 ··· 813 813 */ 814 814 815 815 /* Allocate new skb for releasing to upper layer */ 816 - sub_skb = dev_alloc_skb(nSubframe_Length + 12); 816 + sub_skb = dev_alloc_skb(subframe_len + 12); 817 817 if (!sub_skb) 818 818 return 0; 819 819 skb_reserve(sub_skb, 12); 820 - skb_put_data(sub_skb, skb->data, nSubframe_Length); 820 + skb_put_data(sub_skb, skb->data, subframe_len); 821 821 822 822 sub_skb->dev = ieee->dev; 823 823 rxb->subframes[rxb->nr_subframes++] = sub_skb; ··· 826 826 "ParseSubframe(): Too many Subframes! Packets dropped!\n"); 827 827 break; 828 828 } 829 - skb_pull(skb, nSubframe_Length); 829 + skb_pull(skb, subframe_len); 830 830 831 831 if (skb->len != 0) { 832 - pad_len = 4 - ((nSubframe_Length + 832 + pad_len = 4 - ((subframe_len + 833 833 ETHERNET_HEADER_SIZE) % 4); 834 834 if (pad_len == 4) 835 835 pad_len = 0; ··· 1227 1227 struct lib80211_crypt_data *crypt = NULL; 1228 1228 struct rtllib_rxb *rxb = NULL; 1229 1229 struct rx_ts_record *ts = NULL; 1230 - u16 fc, sc, SeqNum = 0; 1230 + u16 fc, sc, seq_num = 0; 1231 1231 u8 type, stype, multicast = 0, unicast = 0, nr_subframes = 0, TID = 0; 1232 1232 u8 dst[ETH_ALEN]; 1233 1233 u8 src[ETH_ALEN]; ··· 1321 1321 if (ieee->current_network.qos_data.active && is_qos_data_frame(skb->data) 1322 1322 && !is_multicast_ether_addr(hdr->addr1)) { 1323 1323 TID = frame_qos_tid(skb->data); 1324 - SeqNum = WLAN_GET_SEQ_SEQ(sc); 1324 + seq_num = WLAN_GET_SEQ_SEQ(sc); 1325 1325 rtllib_get_ts(ieee, (struct ts_common_info **)&ts, hdr->addr2, TID, 1326 1326 RX_DIR, true); 1327 1327 if (TID != 0 && TID != 3) ··· 1362 1362 if (!ieee->ht_info->cur_rx_reorder_enable || !ts) 1363 1363 rtllib_rx_indicate_pkt_legacy(ieee, rx_stats, rxb, dst, src); 1364 1364 else 1365 - rx_reorder_indicate_packet(ieee, rxb, ts, SeqNum); 1365 + rx_reorder_indicate_packet(ieee, rxb, ts, seq_num); 1366 1366 1367 1367 dev_kfree_skb(skb); 1368 1368 ··· 2177 2177 network->marvell_cap_exist = false; 2178 2178 network->airgo_cap_exist = false; 2179 2179 network->turbo_enable = 0; 2180 - network->SignalStrength = stats->SignalStrength; 2181 - network->RSSI = stats->SignalStrength; 2180 + network->signal_strength = stats->signal_strength; 2181 + network->RSSI = stats->signal_strength; 2182 2182 network->country_ie_len = 0; 2183 2183 memset(network->country_ie_buf, 0, MAX_IE_LEN); 2184 2184 ht_initialize_bss_desc(&network->bssht); ··· 2215 2215 } 2216 2216 if (rtllib_is_empty_essid(network->ssid, network->ssid_len)) 2217 2217 network->flags |= NETWORK_EMPTY_ESSID; 2218 - stats->signal = 30 + (stats->SignalStrength * 70) / 100; 2218 + stats->signal = 30 + (stats->signal_strength * 70) / 100; 2219 2219 stats->noise = rtllib_translate_todbm((u8)(100 - stats->signal)) - 25; 2220 2220 2221 2221 memcpy(&network->stats, stats, sizeof(network->stats)); ··· 2334 2334 src->wmm_param[3].ac_aci_acm_aifsn) 2335 2335 memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN); 2336 2336 2337 - dst->SignalStrength = src->SignalStrength; 2337 + dst->signal_strength = src->signal_strength; 2338 2338 dst->RSSI = src->RSSI; 2339 2339 dst->turbo_enable = src->turbo_enable; 2340 2340
+2 -2
drivers/staging/rtl8192e/rtllib_softmac_wx.c
··· 314 314 /* wait for ps packet to be kicked out successfully */ 315 315 msleep(50); 316 316 317 - ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_BACKUP); 317 + ieee->scan_operation_backup_handler(ieee->dev, SCAN_OPT_BACKUP); 318 318 319 319 if (ieee->ht_info->current_ht_support && ieee->ht_info->enable_ht && 320 320 ieee->ht_info->cur_bw_40mhz) { ··· 339 339 ieee->set_chan(ieee->dev, chan); 340 340 } 341 341 342 - ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_RESTORE); 342 + ieee->scan_operation_backup_handler(ieee->dev, SCAN_OPT_RESTORE); 343 343 344 344 ieee->link_state = MAC80211_LINKED; 345 345 ieee->link_change(ieee->dev);
-4
drivers/staging/rtl8712/rtl8712_recv.c
··· 136 136 static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib, 137 137 struct recv_stat *prxstat) 138 138 { 139 - u16 drvinfo_sz; 140 - 141 - drvinfo_sz = (le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16; 142 - drvinfo_sz <<= 3; 143 139 /*TODO: 144 140 * Offset 0 145 141 */
+3 -2
drivers/staging/rtl8712/rtl871x_cmd.c
··· 528 528 if (unicast_key) 529 529 memcpy(&psetstakey_para->key, &sta->x_UncstKey, 16); 530 530 else 531 - memcpy(&psetstakey_para->key, &psecuritypriv->XGrpKey[psecuritypriv->XGrpKeyid - 1]. 532 - skey, 16); 531 + memcpy(&psetstakey_para->key, 532 + &psecuritypriv->XGrpKey[psecuritypriv->XGrpKeyid - 1].skey, 533 + 16); 533 534 r8712_enqueue_cmd(pcmdpriv, ph2c); 534 535 } 535 536
+1 -1
drivers/staging/rtl8712/rtl871x_cmd.h
··· 736 736 void r8712_readtssi_cmdrsp_callback(struct _adapter *padapter, struct cmd_obj *pcmd); 737 737 void r8712_setstaKey_cmdrsp_callback(struct _adapter *padapter, struct cmd_obj *pcmd); 738 738 void r8712_setassocsta_cmdrsp_callback(struct _adapter *padapter, struct cmd_obj *pcmd); 739 - void r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, u32 tryPktCnt, 739 + void r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, u32 tryPktCnt, 740 740 u32 tryPktInterval, u32 firstStageTO); 741 741 742 742 struct _cmd_callback {
+2 -2
drivers/staging/rtl8712/rtl871x_io.c
··· 48 48 set_intf_funs = &(r8712_usb_set_intf_funs); 49 49 set_intf_ops = &r8712_usb_set_intf_ops; 50 50 init_intf_priv = &r8712_usb_init_intf_priv; 51 - pintf_priv = pintf_hdl->pintfpriv = kmalloc(sizeof(struct intf_priv), 52 - GFP_ATOMIC); 51 + pintf_priv = kmalloc(sizeof(*pintf_priv), GFP_ATOMIC); 52 + pintf_hdl->pintfpriv = pintf_priv; 53 53 if (!pintf_priv) 54 54 goto _init_intf_hdl_fail; 55 55 pintf_hdl->adapter = (u8 *)padapter;
+1 -1
drivers/staging/rtl8712/usb_ops_linux.c
··· 221 221 fallthrough; 222 222 case -EPROTO: 223 223 r8712_read_port(padapter, precvpriv->ff_hwaddr, 0, 224 - (unsigned char *)precvbuf); 224 + (unsigned char *)precvbuf); 225 225 break; 226 226 case -EINPROGRESS: 227 227 netdev_err(padapter->pnetdev, "ERROR: URB IS IN PROGRESS!\n");
-1
drivers/staging/rtl8723bs/Kconfig
··· 3 3 tristate "Realtek RTL8723BS SDIO Wireless LAN NIC driver" 4 4 depends on WLAN && MMC && CFG80211 5 5 depends on m 6 - select CFG80211_WEXT 7 6 select CRYPTO 8 7 select CRYPTO_LIB_ARC4 9 8 help
-2
drivers/staging/rtl8723bs/Makefile
··· 3 3 core/rtw_ap.o \ 4 4 core/rtw_btcoex.o \ 5 5 core/rtw_cmd.o \ 6 - core/rtw_debug.o \ 7 6 core/rtw_efuse.o \ 8 7 core/rtw_io.o \ 9 8 core/rtw_ioctl_set.o \ ··· 11 12 core/rtw_mlme_ext.o \ 12 13 core/rtw_pwrctrl.o \ 13 14 core/rtw_recv.o \ 14 - core/rtw_rf.o \ 15 15 core/rtw_security.o \ 16 16 core/rtw_sta_mgt.o \ 17 17 core/rtw_wlan_util.o \
+2 -3
drivers/staging/rtl8723bs/core/rtw_ap.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include <asm/unaligned.h> 11 10 12 11 void init_mlme_ap_info(struct adapter *padapter) ··· 276 277 /* switch to correct channel of current network before issue keep-alive frames */ 277 278 if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) { 278 279 backup_oper_channel = rtw_get_oper_ch(padapter); 279 - SelectChannel(padapter, pmlmeext->cur_channel); 280 + r8723bs_select_channel(padapter, pmlmeext->cur_channel); 280 281 } 281 282 282 283 /* issue null data to check sta alive*/ ··· 314 315 } 315 316 316 317 if (backup_oper_channel > 0) /* back to the original operation channel */ 317 - SelectChannel(padapter, backup_oper_channel); 318 + r8723bs_select_channel(padapter, backup_oper_channel); 318 319 } 319 320 320 321 associated_clients_update(padapter, updated);
-1
drivers/staging/rtl8723bs/core/rtw_btcoex.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <rtw_btcoex.h> 10 9 #include <hal_btcoex.h> 11 10
-4
drivers/staging/rtl8723bs/core/rtw_cmd.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <hal_btcoex.h> 10 9 #include <linux/jiffies.h> 11 10 ··· 1882 1883 1883 1884 /* copy pdev_network information to pmlmepriv->cur_network */ 1884 1885 memcpy(&tgt_network->network, pnetwork, (get_wlan_bssid_ex_sz(pnetwork))); 1885 - 1886 - /* reset ds_config */ 1887 - /* tgt_network->network.configuration.ds_config = (u32)rtw_ch2freq(pnetwork->configuration.ds_config); */ 1888 1886 1889 1887 _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); 1890 1888
-68
drivers/staging/rtl8723bs/core/rtw_debug.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /****************************************************************************** 3 - * 4 - * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. 5 - * 6 - ******************************************************************************/ 7 - 8 - #include <drv_types.h> 9 - #include <rtw_debug.h> 10 - #include <hal_btcoex.h> 11 - 12 - #include <rtw_version.h> 13 - 14 - static void dump_4_regs(struct adapter *adapter, int offset) 15 - { 16 - u32 reg[4]; 17 - int i; 18 - 19 - for (i = 0; i < 4; i++) 20 - reg[i] = rtw_read32(adapter, offset + i); 21 - 22 - netdev_dbg(adapter->pnetdev, "0x%03x 0x%08x 0x%08x 0x%08x 0x%08x\n", 23 - i, reg[0], reg[1], reg[2], reg[3]); 24 - } 25 - 26 - void mac_reg_dump(struct adapter *adapter) 27 - { 28 - int i; 29 - 30 - netdev_dbg(adapter->pnetdev, "======= MAC REG =======\n"); 31 - 32 - for (i = 0x0; i < 0x800; i += 4) 33 - dump_4_regs(adapter, i); 34 - } 35 - 36 - void bb_reg_dump(struct adapter *adapter) 37 - { 38 - int i; 39 - 40 - netdev_dbg(adapter->pnetdev, "======= BB REG =======\n"); 41 - 42 - for (i = 0x800; i < 0x1000 ; i += 4) 43 - dump_4_regs(adapter, i); 44 - } 45 - 46 - static void dump_4_rf_regs(struct adapter *adapter, int path, int offset) 47 - { 48 - u8 reg[4]; 49 - int i; 50 - 51 - for (i = 0; i < 4; i++) 52 - reg[i] = rtw_hal_read_rfreg(adapter, path, offset + i, 53 - 0xffffffff); 54 - 55 - netdev_dbg(adapter->pnetdev, "0x%02x 0x%08x 0x%08x 0x%08x 0x%08x\n", 56 - i, reg[0], reg[1], reg[2], reg[3]); 57 - } 58 - 59 - void rf_reg_dump(struct adapter *adapter) 60 - { 61 - int i, path = 0; 62 - 63 - netdev_dbg(adapter->pnetdev, "======= RF REG =======\n"); 64 - 65 - netdev_dbg(adapter->pnetdev, "RF_Path(%x)\n", path); 66 - for (i = 0; i < 0x100; i++) 67 - dump_4_rf_regs(adapter, path, i); 68 - }
+25 -35
drivers/staging/rtl8723bs/core/rtw_efuse.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <hal_data.h> 10 9 #include <linux/jiffies.h> 11 10 ··· 37 38 if (fakeEfuseBank == 0) 38 39 *Value = fakeEfuseContent[Offset]; 39 40 else 40 - *Value = fakeBTEfuseContent[fakeEfuseBank-1][Offset]; 41 + *Value = fakeBTEfuseContent[fakeEfuseBank - 1][Offset]; 41 42 return true; 42 43 } 43 44 ··· 49 50 if (fakeEfuseBank == 0) 50 51 fakeEfuseContent[Offset] = Value; 51 52 else 52 - fakeBTEfuseContent[fakeEfuseBank-1][Offset] = Value; 53 + fakeBTEfuseContent[fakeEfuseBank - 1][Offset] = Value; 53 54 return true; 54 55 } 55 56 ··· 205 206 if (Address < contentLen) {/* E-fuse 512Byte */ 206 207 /* Write E-fuse Register address bit0~7 */ 207 208 temp = Address & 0xFF; 208 - rtw_write8(Adapter, EFUSE_CTRL+1, temp); 209 - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2); 209 + rtw_write8(Adapter, EFUSE_CTRL + 1, temp); 210 + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 2); 210 211 /* Write E-fuse Register address bit8~9 */ 211 212 temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC); 212 - rtw_write8(Adapter, EFUSE_CTRL+2, temp); 213 + rtw_write8(Adapter, EFUSE_CTRL + 2, temp); 213 214 214 215 /* Write 0x30[31]= 0 */ 215 - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); 216 + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 3); 216 217 temp = Bytetemp & 0x7F; 217 - rtw_write8(Adapter, EFUSE_CTRL+3, temp); 218 + rtw_write8(Adapter, EFUSE_CTRL + 3, temp); 218 219 219 220 /* Wait Write-ready (0x30[31]= 1) */ 220 - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); 221 + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 3); 221 222 while (!(Bytetemp & 0x80)) { 222 - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); 223 + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 3); 223 224 k++; 224 225 if (k == 1000) 225 226 break; ··· 252 253 253 254 /* -----------------e-fuse reg ctrl --------------------------------- */ 254 255 /* address */ 255 - rtw_write8(padapter, EFUSE_CTRL+1, (u8)(addr&0xff)); 256 - rtw_write8(padapter, EFUSE_CTRL+2, ((u8)((addr>>8) & 0x03)) | 257 - (rtw_read8(padapter, EFUSE_CTRL+2)&0xFC)); 256 + rtw_write8(padapter, EFUSE_CTRL + 1, (u8)(addr & 0xff)); 257 + rtw_write8(padapter, EFUSE_CTRL + 2, ((u8)((addr >> 8) & 0x03)) | 258 + (rtw_read8(padapter, EFUSE_CTRL + 2) & 0xFC)); 258 259 259 260 /* rtw_write8(padapter, EFUSE_CTRL+3, 0x72); read cmd */ 260 261 /* Write bit 32 0 */ 261 - readbyte = rtw_read8(padapter, EFUSE_CTRL+3); 262 - rtw_write8(padapter, EFUSE_CTRL+3, (readbyte & 0x7f)); 262 + readbyte = rtw_read8(padapter, EFUSE_CTRL + 3); 263 + rtw_write8(padapter, EFUSE_CTRL + 3, (readbyte & 0x7f)); 263 264 264 - while (!(0x80 & rtw_read8(padapter, EFUSE_CTRL+3)) && (tmpidx < 1000)) { 265 + while (!(0x80 & rtw_read8(padapter, EFUSE_CTRL + 3)) && (tmpidx < 1000)) { 265 266 mdelay(1); 266 267 tmpidx++; 267 268 } ··· 281 282 { 282 283 u8 tmpidx = 0; 283 284 u8 bResult = false; 284 - u32 efuseValue; 285 285 286 286 if (bPseudoTest) 287 287 return Efuse_Write1ByteToFakeContent(addr, data); 288 288 289 - 290 289 /* -----------------e-fuse reg ctrl --------------------------------- */ 291 290 /* address */ 292 - 293 - 294 - efuseValue = rtw_read32(padapter, EFUSE_CTRL); 295 - efuseValue |= (BIT21|BIT31); 296 - efuseValue &= ~(0x3FFFF); 297 - efuseValue |= ((addr<<8 | data) & 0x3FFFF); 298 - 299 291 300 292 /* <20130227, Kordan> 8192E MP chip A-cut had better not set 0x34[11] until B-Cut. */ 301 293 ··· 294 304 /* 0x34[11]: SW force PGMEN input of efuse to high. (for the bank selected by 0x34[9:8]) */ 295 305 /* PHY_SetMacReg(padapter, 0x34, BIT11, 1); */ 296 306 rtw_write16(padapter, 0x34, rtw_read16(padapter, 0x34) | (BIT11)); 297 - rtw_write32(padapter, EFUSE_CTRL, 0x90600000|((addr<<8 | data))); 307 + rtw_write32(padapter, EFUSE_CTRL, 0x90600000 | ((addr << 8 | data))); 298 308 299 - while ((0x80 & rtw_read8(padapter, EFUSE_CTRL+3)) && (tmpidx < 100)) { 309 + while ((0x80 & rtw_read8(padapter, EFUSE_CTRL + 3)) && (tmpidx < 100)) { 300 310 mdelay(1); 301 311 tmpidx++; 302 312 } ··· 355 365 u8 *sourdata, 356 366 u8 *targetdata) 357 367 { 358 - if (!(word_en&BIT(0))) { 368 + if (!(word_en & BIT(0))) { 359 369 targetdata[0] = sourdata[0]; 360 370 targetdata[1] = sourdata[1]; 361 371 } 362 - if (!(word_en&BIT(1))) { 372 + if (!(word_en & BIT(1))) { 363 373 targetdata[2] = sourdata[2]; 364 374 targetdata[3] = sourdata[3]; 365 375 } 366 - if (!(word_en&BIT(2))) { 376 + if (!(word_en & BIT(2))) { 367 377 targetdata[4] = sourdata[4]; 368 378 targetdata[5] = sourdata[5]; 369 379 } 370 - if (!(word_en&BIT(3))) { 380 + if (!(word_en & BIT(3))) { 371 381 targetdata[6] = sourdata[6]; 372 382 targetdata[7] = sourdata[7]; 373 383 } ··· 453 463 struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); 454 464 455 465 *Value = pEEPROM->efuse_eeprom_data[Offset]; 456 - *Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8; 466 + *Value |= pEEPROM->efuse_eeprom_data[Offset + 1] << 8; 457 467 458 468 } /* EFUSE_ShadowRead2Byte */ 459 469 ··· 463 473 struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); 464 474 465 475 *Value = pEEPROM->efuse_eeprom_data[Offset]; 466 - *Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8; 467 - *Value |= pEEPROM->efuse_eeprom_data[Offset+2]<<16; 468 - *Value |= pEEPROM->efuse_eeprom_data[Offset+3]<<24; 476 + *Value |= pEEPROM->efuse_eeprom_data[Offset + 1] << 8; 477 + *Value |= pEEPROM->efuse_eeprom_data[Offset + 2] << 16; 478 + *Value |= pEEPROM->efuse_eeprom_data[Offset + 3] << 24; 469 479 470 480 } /* efuse_ShadowRead4Byte */ 471 481
+3 -2
drivers/staging/rtl8723bs/core/rtw_ieee80211.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include <linux/of.h> 11 10 #include <asm/unaligned.h> 12 11 ··· 54 55 55 56 int rtw_get_bit_value_from_ieee_value(u8 val) 56 57 { 57 - unsigned char dot11_rate_table[] = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 0}; /* last element must be zero!! */ 58 + static const unsigned char dot11_rate_table[] = { 59 + 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 0 60 + }; /* last element must be zero!! */ 58 61 int i = 0; 59 62 60 63 while (dot11_rate_table[i] != 0) {
-1
drivers/staging/rtl8723bs/core/rtw_io.c
··· 26 26 */ 27 27 28 28 #include <drv_types.h> 29 - #include <rtw_debug.h> 30 29 31 30 u8 rtw_read8(struct adapter *adapter, u32 addr) 32 31 {
-1
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 11 10 u8 rtw_validate_bssid(u8 *bssid) 12 11 {
-1
drivers/staging/rtl8723bs/core/rtw_mlme.c
··· 6 6 ******************************************************************************/ 7 7 #include <linux/etherdevice.h> 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include <hal_btcoex.h> 11 10 #include <linux/jiffies.h> 12 11
+3 -4
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <rtw_wifi_regd.h> 10 9 #include <hal_btcoex.h> 11 10 #include <linux/kernel.h> ··· 627 628 ret = rtw_check_bcn_info(padapter, pframe, len); 628 629 if (!ret) { 629 630 netdev_dbg(padapter->pnetdev, 630 - "ap has changed, disconnect now\n "); 631 + "ap has changed, disconnect now\n"); 631 632 receive_disconnect(padapter, 632 633 pmlmeinfo->network.mac_address, 0); 633 634 return _SUCCESS; ··· 3830 3831 } else { 3831 3832 #ifdef DBG_FIXED_CHAN 3832 3833 if (pmlmeext->fixed_chan != 0xff) 3833 - SelectChannel(padapter, pmlmeext->fixed_chan); 3834 + r8723bs_select_channel(padapter, pmlmeext->fixed_chan); 3834 3835 else 3835 3836 #endif 3836 - SelectChannel(padapter, survey_channel); 3837 + r8723bs_select_channel(padapter, survey_channel); 3837 3838 } 3838 3839 3839 3840 if (ScanType == SCAN_ACTIVE) { /* obey the channel plan setting... */
-3
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <hal_data.h> 10 9 #include <linux/jiffies.h> 11 10 ··· 284 285 if (rpwm & PS_ACK) { 285 286 unsigned long start_time; 286 287 u8 cpwm_now; 287 - u8 poll_cnt = 0; 288 288 289 289 start_time = jiffies; 290 290 291 291 /* polling cpwm */ 292 292 do { 293 293 mdelay(1); 294 - poll_cnt++; 295 294 rtw_hal_get_hwreg(padapter, HW_VAR_CPWM, &cpwm_now); 296 295 if ((cpwm_orig ^ cpwm_now) & 0x80) { 297 296 pwrpriv->cpwm = PS_STATE_S4;
+1 -5
drivers/staging/rtl8723bs/core/rtw_recv.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <linux/jiffies.h> 10 9 #include <rtw_recv.h> 11 10 #include <net/cfg80211.h> ··· 2026 2027 /* check if need to handle uc_swdec_pending_queue*/ 2027 2028 if (check_fwstate(mlmepriv, WIFI_STATION_STATE) && psecuritypriv->busetkipkey) { 2028 2029 union recv_frame *pending_frame; 2029 - int cnt = 0; 2030 2030 2031 - while ((pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue))) { 2032 - cnt++; 2031 + while ((pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue))) 2033 2032 recv_func_posthandle(padapter, pending_frame); 2034 - } 2035 2033 } 2036 2034 2037 2035 ret = recv_func_prehandle(padapter, rframe);
-34
drivers/staging/rtl8723bs/core/rtw_rf.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /****************************************************************************** 3 - * 4 - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 - * 6 - ******************************************************************************/ 7 - 8 - #include <drv_types.h> 9 - #include <linux/kernel.h> 10 - 11 - static const u32 ch_freq_map[] = { 12 - 2412, 13 - 2417, 14 - 2422, 15 - 2427, 16 - 2432, 17 - 2437, 18 - 2442, 19 - 2447, 20 - 2452, 21 - 2457, 22 - 2462, 23 - 2467, 24 - 2472, 25 - 2484 26 - }; 27 - 28 - u32 rtw_ch2freq(u32 channel) 29 - { 30 - if (channel == 0 || channel > ARRAY_SIZE(ch_freq_map)) 31 - return 2412; 32 - 33 - return ch_freq_map[channel - 1]; 34 - }
-1
drivers/staging/rtl8723bs/core/rtw_security.c
··· 6 6 ******************************************************************************/ 7 7 #include <linux/crc32.h> 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include <crypto/aes.h> 11 10 12 11 static const char * const _security_type_str[] = {
-1
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 10 9 void _rtw_init_stainfo(struct sta_info *psta); 11 10 void _rtw_init_stainfo(struct sta_info *psta)
+1 -2
drivers/staging/rtl8723bs/core/rtw_wlan_util.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include <hal_com_h2c.h> 11 10 12 11 static unsigned char ARTHEROS_OUI1[] = {0x00, 0x03, 0x7f}; ··· 332 333 return 0; 333 334 } 334 335 335 - void SelectChannel(struct adapter *padapter, unsigned char channel) 336 + void r8723bs_select_channel(struct adapter *padapter, unsigned char channel) 336 337 { 337 338 if (mutex_lock_interruptible(&(adapter_to_dvobj(padapter)->setch_mutex))) 338 339 return;
+1 -2
drivers/staging/rtl8723bs/core/rtw_xmit.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 10 9 static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; 11 10 static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; ··· 44 45 init_completion(&pxmitpriv->terminate_xmitthread_comp); 45 46 46 47 /* 47 - * Please insert all the queue initializaiton using _rtw_init_queue below 48 + * Please insert all the queue initialization using _rtw_init_queue below 48 49 */ 49 50 50 51 pxmitpriv->adapter = padapter;
-1
drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include "odm_precomp.h" 11 10 12 11 /* MACRO definition for pRFCalibrateInfo->TxIQC_8723B[0] */
-1
drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c
··· 21 21 22 22 --*/ 23 23 #include <drv_types.h> 24 - #include <rtw_debug.h> 25 24 #include <HalPwrSeqCmd.h> 26 25 27 26
-1
drivers/staging/rtl8723bs/hal/hal_btcoex.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <hal_data.h> 9 - #include <rtw_debug.h> 10 9 #include <hal_btcoex.h> 11 10 #include <Mp_Precomp.h> 12 11
-1
drivers/staging/rtl8723bs/hal/hal_com.c
··· 7 7 8 8 #include <linux/kernel.h> 9 9 #include <drv_types.h> 10 - #include <rtw_debug.h> 11 10 #include "hal_com_h2c.h" 12 11 13 12 #include "odm_precomp.h"
-1
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include <hal_data.h> 11 10 #include <linux/kernel.h> 12 11
-7
drivers/staging/rtl8723bs/hal/hal_intf.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <hal_data.h> 10 9 11 10 void rtw_hal_chip_configure(struct adapter *padapter) ··· 157 158 { 158 159 if (padapter->HalFunc.SetHalODMVarHandler) 159 160 padapter->HalFunc.SetHalODMVarHandler(padapter, eVariable, pValue1, bSet); 160 - } 161 - 162 - void rtw_hal_get_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, void *pValue2) 163 - { 164 - if (padapter->HalFunc.GetHalODMVarHandler) 165 - padapter->HalFunc.GetHalODMVarHandler(padapter, eVariable, pValue1, pValue2); 166 161 } 167 162 168 163 void rtw_hal_enable_interrupt(struct adapter *padapter)
-1
drivers/staging/rtl8723bs/hal/hal_sdio.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include <hal_data.h> 11 10 12 11 u8 rtw_hal_sdio_max_txoqt_free_space(struct adapter *padapter)
-1
drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include <rtl8723b_hal.h> 11 10 #include "hal_com_h2c.h" 12 11
-1
drivers/staging/rtl8723bs/hal/rtl8723b_dm.c
··· 8 8 /* This file is for 92CE/92CU dynamic mechanism only */ 9 9 10 10 #include <drv_types.h> 11 - #include <rtw_debug.h> 12 11 #include <rtl8723b_hal.h> 13 12 14 13 /* Global var */
-1
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
··· 8 8 #include <linux/firmware.h> 9 9 #include <linux/slab.h> 10 10 #include <drv_types.h> 11 - #include <rtw_debug.h> 12 11 #include <rtl8723b_hal.h> 13 12 #include "hal_com_h2c.h" 14 13
-1
drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include <rtl8723b_hal.h> 11 10 12 11 /**
-1
drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include <rtl8723b_hal.h> 11 10 12 11 static void initrecvbuf(struct recv_buf *precvbuf, struct adapter *padapter)
-1
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
··· 6 6 ******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 #include <rtl8723b_hal.h> 11 10 12 11 static u8 rtw_sdio_wait_enough_TxOQT_space(struct adapter *padapter, u8 agg_num)
+2 -3
drivers/staging/rtl8723bs/hal/sdio_halinit.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <rtl8723b_hal.h> 10 9 11 10 #include "hal_com_h2c.h" ··· 379 380 rtw_write32(padapter, REG_RCR, pHalData->ReceiveConfig); 380 381 381 382 /* Accept all multicast address */ 382 - rtw_write32(padapter, REG_MAR, 0xFFFFFFFF); 383 - rtw_write32(padapter, REG_MAR + 4, 0xFFFFFFFF); 383 + rtw_write32(padapter, REG_MAR, 0xFFFFFFFF); /* Offset 0x0620-0x0623 */ 384 + rtw_write32(padapter, REG_MAR + 4, 0xFFFFFFFF); /* Offset 0x0624-0x0627 */ 384 385 385 386 /* Accept all data frames */ 386 387 value16 = 0xFFFF;
-1
drivers/staging/rtl8723bs/hal/sdio_ops.c
··· 5 5 * 6 6 *******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <rtl8723b_hal.h> 10 9 11 10 /* */
-7
drivers/staging/rtl8723bs/include/drv_types.h
··· 452 452 #define DF_RX_BIT BIT1 453 453 #define DF_IO_BIT BIT2 454 454 455 - /* define RTW_DISABLE_FUNC(padapter, func) (atomic_add(&adapter_to_dvobj(padapter)->disable_func, (func))) */ 456 455 /* define RTW_ENABLE_FUNC(padapter, func) (atomic_sub(&adapter_to_dvobj(padapter)->disable_func, (func))) */ 457 - static inline void RTW_DISABLE_FUNC(struct adapter *padapter, int func_bit) 458 - { 459 - int df = atomic_read(&adapter_to_dvobj(padapter)->disable_func); 460 - df |= func_bit; 461 - atomic_set(&adapter_to_dvobj(padapter)->disable_func, df); 462 - } 463 456 464 457 static inline void RTW_ENABLE_FUNC(struct adapter *padapter, int func_bit) 465 458 {
-1
drivers/staging/rtl8723bs/include/hal_intf.h
··· 301 301 u8 rtw_hal_get_def_var(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue); 302 302 303 303 void rtw_hal_set_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet); 304 - void rtw_hal_get_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, void *pValue2); 305 304 306 305 void rtw_hal_enable_interrupt(struct adapter *padapter); 307 306 void rtw_hal_disable_interrupt(struct adapter *padapter);
+1 -1
drivers/staging/rtl8723bs/include/hal_pwr_seq.h
··· 101 101 {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07 = 0x20 , SOP option to disable BG/MB*/ \ 102 102 {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \ 103 103 {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \ 104 - {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \ 104 + {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \ 105 105 {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \ 106 106 {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \ 107 107 {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
+1 -3
drivers/staging/rtl8723bs/include/osdep_service.h
··· 81 81 static inline void flush_signals_thread(void) 82 82 { 83 83 if (signal_pending(current)) 84 - { 85 84 flush_signals(current); 86 - } 87 85 } 88 86 89 87 #define rtw_warn_on(condition) WARN_ON(condition) ··· 100 102 #define MAC_ARG(x) (x) 101 103 #endif 102 104 103 - extern void rtw_free_netdev(struct net_device * netdev); 105 + extern void rtw_free_netdev(struct net_device *netdev); 104 106 105 107 /* Macros for handling unaligned memory accesses */ 106 108
+33 -35
drivers/staging/rtl8723bs/include/osdep_service_linux.h
··· 7 7 #ifndef __OSDEP_LINUX_SERVICE_H_ 8 8 #define __OSDEP_LINUX_SERVICE_H_ 9 9 10 - #include <linux/spinlock.h> 11 - #include <linux/compiler.h> 12 - #include <linux/kernel.h> 13 - #include <linux/errno.h> 14 - #include <linux/init.h> 15 - #include <linux/slab.h> 16 - #include <linux/module.h> 17 - #include <linux/kref.h> 18 - /* include <linux/smp_lock.h> */ 19 - #include <linux/netdevice.h> 20 - #include <linux/skbuff.h> 21 - #include <linux/uaccess.h> 22 - #include <asm/byteorder.h> 23 - #include <linux/atomic.h> 24 - #include <linux/io.h> 25 - #include <linux/sem.h> 26 - #include <linux/sched.h> 27 - #include <linux/etherdevice.h> 28 - #include <linux/wireless.h> 29 - #include <net/iw_handler.h> 30 - #include <linux/if_arp.h> 31 - #include <linux/rtnetlink.h> 32 - #include <linux/delay.h> 33 - #include <linux/interrupt.h> /* for struct tasklet_struct */ 34 - #include <linux/ip.h> 35 - #include <linux/kthread.h> 36 - #include <linux/list.h> 37 - #include <linux/vmalloc.h> 10 + #include <linux/spinlock.h> 11 + #include <linux/compiler.h> 12 + #include <linux/kernel.h> 13 + #include <linux/errno.h> 14 + #include <linux/init.h> 15 + #include <linux/slab.h> 16 + #include <linux/module.h> 17 + #include <linux/kref.h> 18 + #include <linux/netdevice.h> 19 + #include <linux/skbuff.h> 20 + #include <linux/uaccess.h> 21 + #include <asm/byteorder.h> 22 + #include <linux/atomic.h> 23 + #include <linux/io.h> 24 + #include <linux/sem.h> 25 + #include <linux/sched.h> 26 + #include <linux/etherdevice.h> 27 + #include <linux/wireless.h> 28 + #include <net/iw_handler.h> 29 + #include <linux/if_arp.h> 30 + #include <linux/rtnetlink.h> 31 + #include <linux/delay.h> 32 + #include <linux/interrupt.h> /* for struct tasklet_struct */ 33 + #include <linux/ip.h> 34 + #include <linux/kthread.h> 35 + #include <linux/list.h> 36 + #include <linux/vmalloc.h> 38 37 39 - /* #include <linux/ieee80211.h> */ 40 - #include <net/ieee80211_radiotap.h> 41 - #include <net/cfg80211.h> 38 + #include <net/ieee80211_radiotap.h> 39 + #include <net/cfg80211.h> 42 40 43 - struct __queue { 44 - struct list_head queue; 45 - spinlock_t lock; 46 - }; 41 + struct __queue { 42 + struct list_head queue; 43 + spinlock_t lock; 44 + }; 47 45 48 46 static inline struct list_head *get_next(struct list_head *list) 49 47 {
+1 -1
drivers/staging/rtl8723bs/include/rtl8723b_hal.h
··· 38 38 39 39 /* This structure must be carefully byte-ordered. */ 40 40 struct rt_firmware_hdr { 41 - /* 8-byte alinment required */ 41 + /* 8-byte alignment required */ 42 42 43 43 /* LONG WORD 0 ---- */ 44 44 __le16 signature; /* 92C0: test chip; 92C, 88C0: test chip;
-4
drivers/staging/rtl8723bs/include/rtw_cmd.h
··· 516 516 517 517 /*------------------- Below are used for RF/BB tuning ---------------------*/ 518 518 519 - struct getcountjudge_rsp { 520 - u8 count_judge[MAX_RATES_LENGTH]; 521 - }; 522 - 523 519 struct addBaReq_parm { 524 520 unsigned int tid; 525 521 u8 addr[ETH_ALEN];
-14
drivers/staging/rtl8723bs/include/rtw_debug.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /****************************************************************************** 3 - * 4 - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 - * 6 - ******************************************************************************/ 7 - #ifndef __RTW_DEBUG_H__ 8 - #define __RTW_DEBUG_H__ 9 - 10 - void mac_reg_dump(struct adapter *adapter); 11 - void bb_reg_dump(struct adapter *adapter); 12 - void rf_reg_dump(struct adapter *adapter); 13 - 14 - #endif /* __RTW_DEBUG_H__ */
+1 -1
drivers/staging/rtl8723bs/include/rtw_event.h
··· 28 28 }; 29 29 30 30 /* 31 - Used to report the link result of joinning the given bss 31 + Used to report the link result of joining the given bss 32 32 33 33 34 34 join_res:
+1 -1
drivers/staging/rtl8723bs/include/rtw_io.h
··· 13 13 Otherwise, io_handler will free io_req 14 14 */ 15 15 16 - /* below is for the intf_option bit defition... */ 16 + /* below is for the intf_option bit definition... */ 17 17 18 18 struct intf_priv; 19 19 struct intf_hdl;
+1 -1
drivers/staging/rtl8723bs/include/rtw_mlme.h
··· 131 131 u8 roam_rssi_diff_th; /* rssi difference threshold for active scan candidate selection */ 132 132 u32 roam_scan_int_ms; /* scan interval for active roam */ 133 133 u32 roam_scanr_exp_ms; /* scan result expire time in ms for roam */ 134 - u8 roam_tgt_addr[ETH_ALEN]; /* request to roam to speicific target without other consideration */ 134 + u8 roam_tgt_addr[ETH_ALEN]; /* request to roam to specific target without other consideration */ 135 135 136 136 u8 *nic_hdl; 137 137
+3 -3
drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
··· 384 384 unsigned char default_supported_mcs_set[16]; 385 385 386 386 struct ss_res sitesurvey_res; 387 - struct mlme_ext_info mlmext_info;/* for sta/adhoc mode, including current scanning/connecting/connected related info. */ 388 - /* for ap mode, network includes ap's cap_info */ 387 + struct mlme_ext_info mlmext_info; /* for sta/adhoc mode, including current scanning/connecting/connected related info. */ 388 + /* for ap mode, network includes ap's cap_info */ 389 389 struct timer_list survey_timer; 390 390 struct timer_list link_timer; 391 391 struct timer_list sa_query_timer; ··· 455 455 unsigned long rtw_get_on_cur_ch_time(struct adapter *adapter); 456 456 457 457 void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigned char channel_offset, unsigned short bwmode); 458 - void SelectChannel(struct adapter *padapter, unsigned char channel); 458 + void r8723bs_select_channel(struct adapter *padapter, unsigned char channel); 459 459 460 460 unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval); 461 461
-10
drivers/staging/rtl8723bs/include/rtw_recv.h
··· 444 444 445 445 } 446 446 447 - static inline union recv_frame *rxmem_to_recvframe(u8 *rxmem) 448 - { 449 - /* due to the design of 2048 bytes alignment of recv_frame, we can reference the union recv_frame */ 450 - /* from any given member of recv_frame. */ 451 - /* rxmem indicates the any member/address in recv_frame */ 452 - 453 - return (union recv_frame *)(((SIZE_PTR)rxmem >> RXFRAME_ALIGN) << RXFRAME_ALIGN); 454 - 455 - } 456 - 457 447 static inline signed int get_recvframe_len(union recv_frame *precvframe) 458 448 { 459 449 return precvframe->u.hdr.len;
-2
drivers/staging/rtl8723bs/include/rtw_rf.h
··· 97 97 HT_DATA_SC_20_LOWER_OF_40MHZ = 2, 98 98 }; 99 99 100 - u32 rtw_ch2freq(u32 ch); 101 - 102 100 #endif /* _RTL8711_RF_H_ */
+63 -64
drivers/staging/rtl8723bs/include/rtw_security.h
··· 50 50 #ifdef __LITTLE_ENDIAN 51 51 52 52 struct { 53 - u8 TSC0; 54 - u8 TSC1; 55 - u8 TSC2; 56 - u8 TSC3; 57 - u8 TSC4; 58 - u8 TSC5; 59 - u8 TSC6; 60 - u8 TSC7; 53 + u8 TSC0; 54 + u8 TSC1; 55 + u8 TSC2; 56 + u8 TSC3; 57 + u8 TSC4; 58 + u8 TSC5; 59 + u8 TSC6; 60 + u8 TSC7; 61 61 } _byte_; 62 62 #else 63 63 struct { 64 - u8 TSC7; 65 - u8 TSC6; 66 - u8 TSC5; 67 - u8 TSC4; 68 - u8 TSC3; 69 - u8 TSC2; 70 - u8 TSC1; 71 - u8 TSC0; 64 + u8 TSC7; 65 + u8 TSC6; 66 + u8 TSC5; 67 + u8 TSC4; 68 + u8 TSC3; 69 + u8 TSC2; 70 + u8 TSC1; 71 + u8 TSC0; 72 72 } _byte_; 73 73 #endif 74 74 75 75 }; 76 76 77 77 union Keytype { 78 - u8 skey[16]; 79 - u32 lkey[4]; 78 + u8 skey[16]; 79 + u32 lkey[4]; 80 80 }; 81 81 82 82 83 83 struct rt_pmkid_list { 84 - u8 bUsed; 85 - u8 Bssid[6]; 86 - u8 PMKID[16]; 87 - u8 SsidBuf[33]; 84 + u8 bUsed; 85 + u8 Bssid[6]; 86 + u8 PMKID[16]; 87 + u8 SsidBuf[33]; 88 88 u8 *ssid_octet; 89 - u16 ssid_length; 89 + u16 ssid_length; 90 90 }; 91 91 92 92 ··· 162 162 163 163 /* For WPA2 Pre-Authentication. */ 164 164 struct rt_pmkid_list PMKIDList[NUM_PMKID_CACHE]; /* Renamed from PreAuthKey[NUM_PRE_AUTH_KEY]. Annie, 2006-10-13. */ 165 - u8 PMKIDIndex; 165 + u8 PMKIDIndex; 166 166 167 167 u8 bWepDefaultKeyIdxSet; 168 168 ··· 170 170 171 171 #define GET_ENCRY_ALGO(psecuritypriv, psta, encry_algo, bmcst)\ 172 172 do {\ 173 - switch (psecuritypriv->dot11AuthAlgrthm)\ 174 - {\ 175 - case dot11AuthAlgrthm_Open:\ 176 - case dot11AuthAlgrthm_Shared:\ 177 - case dot11AuthAlgrthm_Auto:\ 178 - encry_algo = (u8)psecuritypriv->dot11PrivacyAlgrthm;\ 179 - break;\ 180 - case dot11AuthAlgrthm_8021X:\ 181 - if (bmcst)\ 182 - encry_algo = (u8)psecuritypriv->dot118021XGrpPrivacy;\ 183 - else\ 184 - encry_algo = (u8)psta->dot118021XPrivacy;\ 185 - break;\ 186 - case dot11AuthAlgrthm_WAPI:\ 187 - encry_algo = (u8)psecuritypriv->dot11PrivacyAlgrthm;\ 188 - break;\ 173 + switch (psecuritypriv->dot11AuthAlgrthm) {\ 174 + case dot11AuthAlgrthm_Open:\ 175 + case dot11AuthAlgrthm_Shared:\ 176 + case dot11AuthAlgrthm_Auto:\ 177 + encry_algo = (u8)psecuritypriv->dot11PrivacyAlgrthm;\ 178 + break;\ 179 + case dot11AuthAlgrthm_8021X:\ 180 + if (bmcst)\ 181 + encry_algo = (u8)psecuritypriv->dot118021XGrpPrivacy;\ 182 + else\ 183 + encry_algo = (u8)psta->dot118021XPrivacy;\ 184 + break;\ 185 + case dot11AuthAlgrthm_WAPI:\ 186 + encry_algo = (u8)psecuritypriv->dot11PrivacyAlgrthm;\ 187 + break;\ 189 188 } \ 190 189 } while (0) 191 190 192 191 #define SET_ICE_IV_LEN(iv_len, icv_len, encrypt)\ 193 192 do {\ 194 - switch (encrypt)\ 195 - {\ 196 - case _WEP40_:\ 197 - case _WEP104_:\ 198 - iv_len = 4;\ 199 - icv_len = 4;\ 200 - break;\ 201 - case _TKIP_:\ 202 - iv_len = 8;\ 203 - icv_len = 4;\ 204 - break;\ 205 - case _AES_:\ 206 - iv_len = 8;\ 207 - icv_len = 8;\ 208 - break;\ 209 - case _SMS4_:\ 210 - iv_len = 18;\ 211 - icv_len = 16;\ 212 - break;\ 213 - default:\ 214 - iv_len = 0;\ 215 - icv_len = 0;\ 216 - break;\ 193 + switch (encrypt) {\ 194 + case _WEP40_:\ 195 + case _WEP104_:\ 196 + iv_len = 4;\ 197 + icv_len = 4;\ 198 + break;\ 199 + case _TKIP_:\ 200 + iv_len = 8;\ 201 + icv_len = 4;\ 202 + break;\ 203 + case _AES_:\ 204 + iv_len = 8;\ 205 + icv_len = 8;\ 206 + break;\ 207 + case _SMS4_:\ 208 + iv_len = 18;\ 209 + icv_len = 16;\ 210 + break;\ 211 + default:\ 212 + iv_len = 0;\ 213 + icv_len = 0;\ 214 + break;\ 217 215 } \ 218 216 } while (0) 219 217 ··· 240 242 /* ===== start - public domain SHA256 implementation ===== */ 241 243 242 244 /* This is based on SHA256 implementation in LibTomCrypt that was released into 243 - * public domain by Tom St Denis. */ 245 + * public domain by Tom St Denis. 246 + */ 244 247 245 248 int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac); 246 249 void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key);
+1 -1
drivers/staging/rtl8723bs/include/rtw_xmit.h
··· 15 15 16 16 #define XMITBUF_ALIGN_SZ 512 17 17 18 - /* xmit extension buff defination */ 18 + /* xmit extension buff definition */ 19 19 #define MAX_XMIT_EXTBUF_SZ (1536) 20 20 #define NR_XMIT_EXTBUFF (32) 21 21
-1
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
··· 7 7 8 8 #include <linux/etherdevice.h> 9 9 #include <drv_types.h> 10 - #include <rtw_debug.h> 11 10 #include <linux/jiffies.h> 12 11 13 12 #include <rtw_wifi_regd.h>
-1
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
··· 7 7 8 8 #include <linux/etherdevice.h> 9 9 #include <drv_types.h> 10 - #include <rtw_debug.h> 11 10 #include <rtw_mp.h> 12 11 #include <hal_btcoex.h> 13 12 #include <linux/jiffies.h>
-1
drivers/staging/rtl8723bs/os_dep/mlme_linux.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 10 9 static void _dynamic_check_timer_handler(struct timer_list *t) 11 10 {
-1
drivers/staging/rtl8723bs/os_dep/os_intfs.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <hal_data.h> 10 9 11 10 MODULE_LICENSE("GPL");
-1
drivers/staging/rtl8723bs/os_dep/osdep_service.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 10 9 /* 11 10 * Translate the OS dependent @param error_code to OS independent RTW_STATUS_CODE
-1
drivers/staging/rtl8723bs/os_dep/recv_linux.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <linux/jiffies.h> 10 9 #include <net/cfg80211.h> 11 10 #include <asm/unaligned.h>
-1
drivers/staging/rtl8723bs/os_dep/sdio_intf.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 #include <hal_btcoex.h> 10 9 #include <linux/jiffies.h> 11 10
-1
drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
··· 6 6 *******************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 11 10 static bool rtw_sdio_claim_host_needed(struct sdio_func *func) 12 11 {
-1
drivers/staging/rtl8723bs/os_dep/wifi_regd.c
··· 6 6 *****************************************************************************/ 7 7 8 8 #include <drv_types.h> 9 - #include <rtw_debug.h> 10 9 11 10 #include <rtw_wifi_regd.h> 12 11
+1 -3
drivers/staging/rtl8723bs/os_dep/xmit_linux.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 - #include <rtw_debug.h> 9 8 10 9 11 10 uint rtw_remainder_len(struct pkt_file *pfile) ··· 143 144 psta = list_entry(plist, struct sta_info, asoc_list); 144 145 145 146 stainfo_offset = rtw_stainfo_offset(pstapriv, psta); 146 - if (stainfo_offset_valid(stainfo_offset)) { 147 + if (stainfo_offset_valid(stainfo_offset)) 147 148 chk_alive_list[chk_alive_num++] = stainfo_offset; 148 - } 149 149 } 150 150 spin_unlock_bh(&pstapriv->asoc_list_lock); 151 151
+10 -10
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
··· 857 857 switch (mode) { 858 858 case VCHIQ_BULK_MODE_NOCALLBACK: 859 859 case VCHIQ_BULK_MODE_CALLBACK: 860 - ret = vchiq_bulk_transfer(instance, handle, 861 - (void *)data, NULL, 862 - size, userdata, mode, 863 - VCHIQ_BULK_TRANSMIT); 860 + ret = vchiq_bulk_xfer_callback_interruptible(instance, handle, 861 + (void *)data, NULL, 862 + size, mode, userdata, 863 + VCHIQ_BULK_TRANSMIT); 864 864 break; 865 865 case VCHIQ_BULK_MODE_BLOCKING: 866 866 ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size, ··· 895 895 switch (mode) { 896 896 case VCHIQ_BULK_MODE_NOCALLBACK: 897 897 case VCHIQ_BULK_MODE_CALLBACK: 898 - ret = vchiq_bulk_transfer(instance, handle, data, NULL, 899 - size, userdata, 900 - mode, VCHIQ_BULK_RECEIVE); 898 + ret = vchiq_bulk_xfer_callback_interruptible(instance, handle, 899 + (void *)data, NULL, 900 + size, mode, userdata, 901 + VCHIQ_BULK_RECEIVE); 901 902 break; 902 903 case VCHIQ_BULK_MODE_BLOCKING: 903 904 ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size, ··· 969 968 return -ENOMEM; 970 969 } 971 970 972 - ret = vchiq_bulk_transfer(instance, handle, data, NULL, size, 973 - &waiter->bulk_waiter, 974 - VCHIQ_BULK_MODE_BLOCKING, dir); 971 + ret = vchiq_bulk_xfer_blocking_interruptible(instance, handle, data, NULL, size, 972 + &waiter->bulk_waiter, dir); 975 973 if ((ret != -EAGAIN) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) { 976 974 struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk; 977 975
+207 -136
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
··· 1139 1139 int msgid, 1140 1140 ssize_t (*copy_callback)(void *context, void *dest, 1141 1141 size_t offset, size_t maxsize), 1142 - void *context, int size, int is_blocking) 1142 + void *context, int size) 1143 1143 { 1144 1144 struct vchiq_shared_state *local; 1145 1145 struct vchiq_header *header; ··· 1517 1517 /* Acknowledge the OPEN */ 1518 1518 if (service->sync) { 1519 1519 if (queue_message_sync(state, NULL, openack_id, memcpy_copy_callback, 1520 - &ack_payload, sizeof(ack_payload), 0) == -EAGAIN) 1520 + &ack_payload, sizeof(ack_payload)) == -EAGAIN) 1521 1521 goto bail_not_ready; 1522 1522 1523 1523 /* The service is now open */ ··· 2655 2655 return status; 2656 2656 } 2657 2657 2658 + /* 2659 + * Prepares a bulk transfer to be queued. The function is interruptible and is 2660 + * intended to be called from user threads. It may return -EAGAIN to indicate 2661 + * that a signal has been received and the call should be retried after being 2662 + * returned to user context. 2663 + */ 2664 + static int 2665 + vchiq_bulk_xfer_queue_msg_interruptible(struct vchiq_service *service, 2666 + void *offset, void __user *uoffset, 2667 + int size, void *userdata, 2668 + enum vchiq_bulk_mode mode, 2669 + enum vchiq_bulk_dir dir) 2670 + { 2671 + struct vchiq_bulk_queue *queue; 2672 + struct bulk_waiter *bulk_waiter = NULL; 2673 + struct vchiq_bulk *bulk; 2674 + struct vchiq_state *state = service->state; 2675 + const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r'; 2676 + const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ? 2677 + VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX; 2678 + int status = -EINVAL; 2679 + int payload[2]; 2680 + 2681 + if (mode == VCHIQ_BULK_MODE_BLOCKING) { 2682 + bulk_waiter = userdata; 2683 + init_completion(&bulk_waiter->event); 2684 + bulk_waiter->actual = 0; 2685 + bulk_waiter->bulk = NULL; 2686 + } 2687 + 2688 + queue = (dir == VCHIQ_BULK_TRANSMIT) ? 2689 + &service->bulk_tx : &service->bulk_rx; 2690 + 2691 + if (mutex_lock_killable(&service->bulk_mutex)) 2692 + return -EAGAIN; 2693 + 2694 + if (queue->local_insert == queue->remove + VCHIQ_NUM_SERVICE_BULKS) { 2695 + VCHIQ_SERVICE_STATS_INC(service, bulk_stalls); 2696 + do { 2697 + mutex_unlock(&service->bulk_mutex); 2698 + if (wait_for_completion_interruptible(&service->bulk_remove_event)) 2699 + return -EAGAIN; 2700 + if (mutex_lock_killable(&service->bulk_mutex)) 2701 + return -EAGAIN; 2702 + } while (queue->local_insert == queue->remove + 2703 + VCHIQ_NUM_SERVICE_BULKS); 2704 + } 2705 + 2706 + bulk = &queue->bulks[BULK_INDEX(queue->local_insert)]; 2707 + 2708 + bulk->mode = mode; 2709 + bulk->dir = dir; 2710 + bulk->userdata = userdata; 2711 + bulk->size = size; 2712 + bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED; 2713 + 2714 + if (vchiq_prepare_bulk_data(service->instance, bulk, offset, uoffset, size, dir)) 2715 + goto unlock_error_exit; 2716 + 2717 + /* 2718 + * Ensure that the bulk data record is visible to the peer 2719 + * before proceeding. 2720 + */ 2721 + wmb(); 2722 + 2723 + dev_dbg(state->dev, "core: %d: bt (%d->%d) %cx %x@%pad %pK\n", 2724 + state->id, service->localport, service->remoteport, 2725 + dir_char, size, &bulk->data, userdata); 2726 + 2727 + /* 2728 + * The slot mutex must be held when the service is being closed, so 2729 + * claim it here to ensure that isn't happening 2730 + */ 2731 + if (mutex_lock_killable(&state->slot_mutex)) { 2732 + status = -EAGAIN; 2733 + goto cancel_bulk_error_exit; 2734 + } 2735 + 2736 + if (service->srvstate != VCHIQ_SRVSTATE_OPEN) 2737 + goto unlock_both_error_exit; 2738 + 2739 + payload[0] = lower_32_bits(bulk->data); 2740 + payload[1] = bulk->size; 2741 + status = queue_message(state, 2742 + NULL, 2743 + VCHIQ_MAKE_MSG(dir_msgtype, 2744 + service->localport, 2745 + service->remoteport), 2746 + memcpy_copy_callback, 2747 + &payload, 2748 + sizeof(payload), 2749 + QMFLAGS_IS_BLOCKING | 2750 + QMFLAGS_NO_MUTEX_LOCK | 2751 + QMFLAGS_NO_MUTEX_UNLOCK); 2752 + if (status) 2753 + goto unlock_both_error_exit; 2754 + 2755 + queue->local_insert++; 2756 + 2757 + mutex_unlock(&state->slot_mutex); 2758 + mutex_unlock(&service->bulk_mutex); 2759 + 2760 + dev_dbg(state->dev, "core: %d: bt:%d %cx li=%x ri=%x p=%x\n", 2761 + state->id, service->localport, dir_char, queue->local_insert, 2762 + queue->remote_insert, queue->process); 2763 + 2764 + if (bulk_waiter) { 2765 + bulk_waiter->bulk = bulk; 2766 + if (wait_for_completion_interruptible(&bulk_waiter->event)) 2767 + status = -EAGAIN; 2768 + else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) 2769 + status = -EINVAL; 2770 + } 2771 + 2772 + return status; 2773 + 2774 + unlock_both_error_exit: 2775 + mutex_unlock(&state->slot_mutex); 2776 + cancel_bulk_error_exit: 2777 + vchiq_complete_bulk(service->instance, bulk); 2778 + unlock_error_exit: 2779 + mutex_unlock(&service->bulk_mutex); 2780 + 2781 + return status; 2782 + } 2783 + 2658 2784 /* Called by the slot handler */ 2659 2785 int 2660 2786 vchiq_close_service_internal(struct vchiq_service *service, int close_recvd) ··· 3104 2978 return status; 3105 2979 } 3106 2980 3107 - /* 3108 - * This function may be called by kernel threads or user threads. 3109 - * User threads may receive -EAGAIN to indicate that a signal has been 3110 - * received and the call should be retried after being returned to user 3111 - * context. 3112 - * When called in blocking mode, the userdata field points to a bulk_waiter 3113 - * structure. 3114 - */ 3115 - int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, 3116 - void *offset, void __user *uoffset, int size, void *userdata, 3117 - enum vchiq_bulk_mode mode, enum vchiq_bulk_dir dir) 2981 + int 2982 + vchiq_bulk_xfer_blocking_interruptible(struct vchiq_instance *instance, unsigned int handle, 2983 + void *offset, void __user *uoffset, int size, 2984 + void __user *userdata, enum vchiq_bulk_dir dir) 3118 2985 { 3119 2986 struct vchiq_service *service = find_service_by_handle(instance, handle); 3120 - struct vchiq_bulk_queue *queue; 3121 - struct vchiq_bulk *bulk; 3122 - struct vchiq_state *state; 3123 - struct bulk_waiter *bulk_waiter = NULL; 3124 - const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r'; 3125 - const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ? 3126 - VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX; 2987 + enum vchiq_bulk_mode mode = VCHIQ_BULK_MODE_BLOCKING; 3127 2988 int status = -EINVAL; 3128 - int payload[2]; 3129 2989 3130 2990 if (!service) 2991 + return -EINVAL; 2992 + 2993 + if (service->srvstate != VCHIQ_SRVSTATE_OPEN) 2994 + goto error_exit; 2995 + 2996 + if (!offset && !uoffset) 2997 + goto error_exit; 2998 + 2999 + if (vchiq_check_service(service)) 3000 + goto error_exit; 3001 + 3002 + 3003 + status = vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffset, size, 3004 + userdata, mode, dir); 3005 + 3006 + error_exit: 3007 + vchiq_service_put(service); 3008 + 3009 + return status; 3010 + } 3011 + 3012 + int 3013 + vchiq_bulk_xfer_callback_interruptible(struct vchiq_instance *instance, unsigned int handle, 3014 + void *offset, void __user *uoffset, int size, 3015 + enum vchiq_bulk_mode mode, void *userdata, 3016 + enum vchiq_bulk_dir dir) 3017 + { 3018 + struct vchiq_service *service = find_service_by_handle(instance, handle); 3019 + int status = -EINVAL; 3020 + 3021 + if (!service) 3022 + return -EINVAL; 3023 + 3024 + if (mode != VCHIQ_BULK_MODE_CALLBACK && 3025 + mode != VCHIQ_BULK_MODE_NOCALLBACK) 3131 3026 goto error_exit; 3132 3027 3133 3028 if (service->srvstate != VCHIQ_SRVSTATE_OPEN) ··· 3160 3013 if (vchiq_check_service(service)) 3161 3014 goto error_exit; 3162 3015 3163 - switch (mode) { 3164 - case VCHIQ_BULK_MODE_NOCALLBACK: 3165 - case VCHIQ_BULK_MODE_CALLBACK: 3166 - break; 3167 - case VCHIQ_BULK_MODE_BLOCKING: 3168 - bulk_waiter = userdata; 3169 - init_completion(&bulk_waiter->event); 3170 - bulk_waiter->actual = 0; 3171 - bulk_waiter->bulk = NULL; 3172 - break; 3173 - case VCHIQ_BULK_MODE_WAITING: 3174 - bulk_waiter = userdata; 3175 - bulk = bulk_waiter->bulk; 3176 - goto waiting; 3177 - default: 3016 + status = vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffset, 3017 + size, userdata, mode, dir); 3018 + 3019 + error_exit: 3020 + vchiq_service_put(service); 3021 + 3022 + return status; 3023 + } 3024 + 3025 + /* 3026 + * This function is called by VCHIQ ioctl interface and is interruptible. 3027 + * It may receive -EAGAIN to indicate that a signal has been received 3028 + * and the call should be retried after being returned to user context. 3029 + */ 3030 + int 3031 + vchiq_bulk_xfer_waiting_interruptible(struct vchiq_instance *instance, 3032 + unsigned int handle, struct bulk_waiter *userdata) 3033 + { 3034 + struct vchiq_service *service = find_service_by_handle(instance, handle); 3035 + struct bulk_waiter *bulk_waiter; 3036 + int status = -EINVAL; 3037 + 3038 + if (!service) 3039 + return -EINVAL; 3040 + 3041 + if (!userdata) 3178 3042 goto error_exit; 3179 - } 3180 - 3181 - state = service->state; 3182 - 3183 - queue = (dir == VCHIQ_BULK_TRANSMIT) ? 3184 - &service->bulk_tx : &service->bulk_rx; 3185 - 3186 - if (mutex_lock_killable(&service->bulk_mutex)) { 3187 - status = -EAGAIN; 3188 - goto error_exit; 3189 - } 3190 - 3191 - if (queue->local_insert == queue->remove + VCHIQ_NUM_SERVICE_BULKS) { 3192 - VCHIQ_SERVICE_STATS_INC(service, bulk_stalls); 3193 - do { 3194 - mutex_unlock(&service->bulk_mutex); 3195 - if (wait_for_completion_interruptible(&service->bulk_remove_event)) { 3196 - status = -EAGAIN; 3197 - goto error_exit; 3198 - } 3199 - if (mutex_lock_killable(&service->bulk_mutex)) { 3200 - status = -EAGAIN; 3201 - goto error_exit; 3202 - } 3203 - } while (queue->local_insert == queue->remove + 3204 - VCHIQ_NUM_SERVICE_BULKS); 3205 - } 3206 - 3207 - bulk = &queue->bulks[BULK_INDEX(queue->local_insert)]; 3208 - 3209 - bulk->mode = mode; 3210 - bulk->dir = dir; 3211 - bulk->userdata = userdata; 3212 - bulk->size = size; 3213 - bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED; 3214 - 3215 - if (vchiq_prepare_bulk_data(instance, bulk, offset, uoffset, size, dir)) 3216 - goto unlock_error_exit; 3217 - 3218 - /* 3219 - * Ensure that the bulk data record is visible to the peer 3220 - * before proceeding. 3221 - */ 3222 - wmb(); 3223 - 3224 - dev_dbg(state->dev, "core: %d: bt (%d->%d) %cx %x@%pad %pK\n", 3225 - state->id, service->localport, service->remoteport, 3226 - dir_char, size, &bulk->data, userdata); 3227 - 3228 - /* 3229 - * The slot mutex must be held when the service is being closed, so 3230 - * claim it here to ensure that isn't happening 3231 - */ 3232 - if (mutex_lock_killable(&state->slot_mutex)) { 3233 - status = -EAGAIN; 3234 - goto cancel_bulk_error_exit; 3235 - } 3236 3043 3237 3044 if (service->srvstate != VCHIQ_SRVSTATE_OPEN) 3238 - goto unlock_both_error_exit; 3045 + goto error_exit; 3239 3046 3240 - payload[0] = lower_32_bits(bulk->data); 3241 - payload[1] = bulk->size; 3242 - status = queue_message(state, 3243 - NULL, 3244 - VCHIQ_MAKE_MSG(dir_msgtype, 3245 - service->localport, 3246 - service->remoteport), 3247 - memcpy_copy_callback, 3248 - &payload, 3249 - sizeof(payload), 3250 - QMFLAGS_IS_BLOCKING | 3251 - QMFLAGS_NO_MUTEX_LOCK | 3252 - QMFLAGS_NO_MUTEX_UNLOCK); 3253 - if (status) 3254 - goto unlock_both_error_exit; 3047 + if (vchiq_check_service(service)) 3048 + goto error_exit; 3255 3049 3256 - queue->local_insert++; 3050 + bulk_waiter = userdata; 3257 3051 3258 - mutex_unlock(&state->slot_mutex); 3259 - mutex_unlock(&service->bulk_mutex); 3260 - 3261 - dev_dbg(state->dev, "core: %d: bt:%d %cx li=%x ri=%x p=%x\n", 3262 - state->id, service->localport, dir_char, queue->local_insert, 3263 - queue->remote_insert, queue->process); 3264 - 3265 - waiting: 3266 3052 vchiq_service_put(service); 3267 3053 3268 3054 status = 0; 3269 3055 3270 - if (bulk_waiter) { 3271 - bulk_waiter->bulk = bulk; 3272 - if (wait_for_completion_interruptible(&bulk_waiter->event)) 3273 - status = -EAGAIN; 3274 - else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) 3275 - status = -EINVAL; 3276 - } 3056 + if (wait_for_completion_interruptible(&bulk_waiter->event)) 3057 + return -EAGAIN; 3058 + else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) 3059 + return -EINVAL; 3277 3060 3278 3061 return status; 3279 3062 3280 - unlock_both_error_exit: 3281 - mutex_unlock(&state->slot_mutex); 3282 - cancel_bulk_error_exit: 3283 - vchiq_complete_bulk(service->instance, bulk); 3284 - unlock_error_exit: 3285 - mutex_unlock(&service->bulk_mutex); 3286 - 3287 3063 error_exit: 3288 - if (service) 3289 - vchiq_service_put(service); 3064 + vchiq_service_put(service); 3065 + 3290 3066 return status; 3291 3067 } 3292 3068 ··· 3245 3175 switch (service->srvstate) { 3246 3176 case VCHIQ_SRVSTATE_OPEN: 3247 3177 status = queue_message(service->state, service, data_id, 3248 - copy_callback, context, size, 1); 3178 + copy_callback, context, size, 3179 + QMFLAGS_IS_BLOCKING); 3249 3180 break; 3250 3181 case VCHIQ_SRVSTATE_OPENSYNC: 3251 3182 status = queue_message_sync(service->state, service, data_id, 3252 - copy_callback, context, size, 1); 3183 + copy_callback, context, size); 3253 3184 break; 3254 3185 default: 3255 3186 status = -EINVAL;
+13 -3
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
··· 471 471 remote_event_pollall(struct vchiq_state *state); 472 472 473 473 extern int 474 - vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, void *offset, 475 - void __user *uoffset, int size, void *userdata, enum vchiq_bulk_mode mode, 476 - enum vchiq_bulk_dir dir); 474 + vchiq_bulk_xfer_waiting_interruptible(struct vchiq_instance *instance, 475 + unsigned int handle, struct bulk_waiter *userdata); 476 + 477 + extern int 478 + vchiq_bulk_xfer_blocking_interruptible(struct vchiq_instance *instance, unsigned int handle, 479 + void *offset, void __user *uoffset, int size, 480 + void __user *userdata, enum vchiq_bulk_dir dir); 481 + 482 + extern int 483 + vchiq_bulk_xfer_callback_interruptible(struct vchiq_instance *instance, unsigned int handle, 484 + void *offset, void __user *uoffset, int size, 485 + enum vchiq_bulk_mode mode, void *userdata, 486 + enum vchiq_bulk_dir dir); 477 487 478 488 extern void 479 489 vchiq_dump_state(struct seq_file *f, struct vchiq_state *state);
+12 -3
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
··· 304 304 } 305 305 306 306 userdata = &waiter->bulk_waiter; 307 + 308 + status = vchiq_bulk_xfer_blocking_interruptible(instance, args->handle, 309 + NULL, args->data, args->size, 310 + userdata, dir); 311 + 307 312 } else if (args->mode == VCHIQ_BULK_MODE_WAITING) { 308 313 mutex_lock(&instance->bulk_waiter_list_mutex); 309 314 list_for_each_entry(iter, &instance->bulk_waiter_list, ··· 329 324 dev_dbg(service->state->dev, "arm: found bulk_waiter %pK for pid %d\n", 330 325 waiter, current->pid); 331 326 userdata = &waiter->bulk_waiter; 327 + 328 + status = vchiq_bulk_xfer_waiting_interruptible(instance, args->handle, userdata); 332 329 } else { 333 330 userdata = args->userdata; 334 - } 335 331 336 - status = vchiq_bulk_transfer(instance, args->handle, NULL, args->data, args->size, 337 - userdata, args->mode, dir); 332 + status = vchiq_bulk_xfer_callback_interruptible(instance, args->handle, NULL, 333 + args->data, args->size, 334 + args->mode, userdata, dir); 335 + 336 + } 338 337 339 338 if (!waiter) { 340 339 ret = 0;
+1 -9
drivers/staging/vme_user/vme.c
··· 416 416 417 417 slave_image = list_entry(resource->entry, struct vme_slave_resource, 418 418 list); 419 - if (!slave_image) { 420 - dev_err(bridge->parent, "Can't find slave resource\n"); 421 - return; 422 - } 423 419 424 420 /* Unlock image */ 425 421 mutex_lock(&slave_image->mtx); ··· 790 794 791 795 master_image = list_entry(resource->entry, struct vme_master_resource, 792 796 list); 793 - if (!master_image) { 794 - dev_err(bridge->parent, "Can't find master resource\n"); 795 - return; 796 - } 797 797 798 798 /* Unlock image */ 799 799 spin_lock(&master_image->lock); ··· 1257 1265 1258 1266 void vme_irq_handler(struct vme_bridge *bridge, int level, int statid) 1259 1267 { 1260 - void (*call)(int, int, void *); 1268 + void (*call)(int level, int statid, void *priv_data); 1261 1269 void *priv_data; 1262 1270 1263 1271 call = bridge->irq[level - 1].callback[statid].func;
+8 -9
drivers/staging/vme_user/vme.h
··· 129 129 }; 130 130 131 131 void *vme_alloc_consistent(struct vme_resource *, size_t, dma_addr_t *); 132 - void vme_free_consistent(struct vme_resource *, size_t, void *, 133 - dma_addr_t); 132 + void vme_free_consistent(struct vme_resource *, size_t, void *, dma_addr_t); 134 133 135 134 size_t vme_get_size(struct vme_resource *); 136 135 int vme_check_window(struct vme_bridge *bridge, u32 aspace, ··· 137 138 138 139 struct vme_resource *vme_slave_request(struct vme_dev *, u32, u32); 139 140 int vme_slave_set(struct vme_resource *, int, unsigned long long, 140 - unsigned long long, dma_addr_t, u32, u32); 141 + unsigned long long, dma_addr_t, u32, u32); 141 142 int vme_slave_get(struct vme_resource *, int *, unsigned long long *, 142 - unsigned long long *, dma_addr_t *, u32 *, u32 *); 143 + unsigned long long *, dma_addr_t *, u32 *, u32 *); 143 144 void vme_slave_free(struct vme_resource *); 144 145 145 146 struct vme_resource *vme_master_request(struct vme_dev *, u32, u32, u32); 146 147 int vme_master_set(struct vme_resource *, int, unsigned long long, 147 - unsigned long long, u32, u32, u32); 148 + unsigned long long, u32, u32, u32); 148 149 int vme_master_get(struct vme_resource *, int *, unsigned long long *, 149 - unsigned long long *, u32 *, u32 *, u32 *); 150 + unsigned long long *, u32 *, u32 *, u32 *); 150 151 ssize_t vme_master_read(struct vme_resource *, void *, size_t, loff_t); 151 152 ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t); 152 153 unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int, 153 - unsigned int, loff_t); 154 + unsigned int, loff_t); 154 155 int vme_master_mmap(struct vme_resource *resource, struct vm_area_struct *vma); 155 156 void vme_master_free(struct vme_resource *); 156 157 ··· 161 162 struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long, u32, u32, u32); 162 163 void vme_dma_free_attribute(struct vme_dma_attr *); 163 164 int vme_dma_list_add(struct vme_dma_list *, struct vme_dma_attr *, 164 - struct vme_dma_attr *, size_t); 165 + struct vme_dma_attr *, size_t); 165 166 int vme_dma_list_exec(struct vme_dma_list *); 166 167 int vme_dma_list_free(struct vme_dma_list *); 167 168 int vme_dma_free(struct vme_resource *); 168 169 169 170 int vme_irq_request(struct vme_dev *, int, int, 170 - void (*callback)(int, int, void *), void *); 171 + void (*callback)(int, int, void *), void *); 171 172 void vme_irq_free(struct vme_dev *, int, int); 172 173 int vme_irq_generate(struct vme_dev *, int, int); 173 174
+8 -2
drivers/staging/vme_user/vme_fake.c
··· 79 79 }; 80 80 81 81 /* Module parameter */ 82 - static int geoid; 82 + static u32 geoid; 83 83 84 84 static const char driver_name[] = "vme_fake"; 85 85 ··· 1059 1059 struct vme_slave_resource *slave_image; 1060 1060 struct vme_lm_resource *lm; 1061 1061 1062 + if (geoid >= VME_MAX_SLOTS) { 1063 + pr_err("VME geographical address must be between 0 and %d (exclusive), but got %d\n", 1064 + VME_MAX_SLOTS, geoid); 1065 + return -EINVAL; 1066 + } 1067 + 1062 1068 /* We need a fake parent device */ 1063 1069 vme_root = root_device_register("vme"); 1064 1070 if (IS_ERR(vme_root)) ··· 1289 1283 } 1290 1284 1291 1285 MODULE_PARM_DESC(geoid, "Set geographical addressing"); 1292 - module_param(geoid, int, 0); 1286 + module_param(geoid, uint, 0); 1293 1287 1294 1288 MODULE_DESCRIPTION("Fake VME bridge driver"); 1295 1289 MODULE_LICENSE("GPL");
+79 -76
drivers/staging/vme_user/vme_tsi148.c
··· 36 36 37 37 /* Module parameter */ 38 38 static bool err_chk; 39 - static int geoid; 39 + static u32 geoid; 40 40 41 41 static const char driver_name[] = "vme_tsi148"; 42 42 ··· 55 55 }; 56 56 57 57 static void reg_join(unsigned int high, unsigned int low, 58 - unsigned long long *variable) 58 + unsigned long long *variable) 59 59 { 60 60 *variable = (unsigned long long)high << 32; 61 61 *variable |= (unsigned long long)low; 62 62 } 63 63 64 64 static void reg_split(unsigned long long variable, unsigned int *high, 65 - unsigned int *low) 65 + unsigned int *low) 66 66 { 67 67 *low = (unsigned int)variable & 0xFFFFFFFF; 68 68 *high = (unsigned int)(variable >> 32); ··· 72 72 * Wakes up DMA queue. 73 73 */ 74 74 static u32 tsi148_DMA_irqhandler(struct tsi148_driver *bridge, 75 - int channel_mask) 75 + int channel_mask) 76 76 { 77 77 u32 serviced = 0; 78 78 ··· 207 207 * Calling VME bus interrupt callback if provided. 208 208 */ 209 209 static u32 tsi148_VIRQ_irqhandler(struct vme_bridge *tsi148_bridge, 210 - u32 stat) 210 + u32 stat) 211 211 { 212 212 int vec, i, serviced = 0; 213 213 struct tsi148_driver *bridge; ··· 358 358 } 359 359 360 360 static void tsi148_irq_exit(struct vme_bridge *tsi148_bridge, 361 - struct pci_dev *pdev) 361 + struct pci_dev *pdev) 362 362 { 363 363 struct tsi148_driver *bridge = tsi148_bridge->driver_priv; 364 364 ··· 392 392 * Configure VME interrupt 393 393 */ 394 394 static void tsi148_irq_set(struct vme_bridge *tsi148_bridge, int level, 395 - int state, int sync) 395 + int state, int sync) 396 396 { 397 397 struct pci_dev *pdev; 398 398 u32 tmp; ··· 430 430 * interrupt to be acked. 431 431 */ 432 432 static int tsi148_irq_generate(struct vme_bridge *tsi148_bridge, int level, 433 - int statid) 433 + int statid) 434 434 { 435 435 u32 tmp; 436 436 struct tsi148_driver *bridge; ··· 453 453 454 454 /* XXX Consider implementing a timeout? */ 455 455 wait_event_interruptible(bridge->iack_queue, 456 - tsi148_iack_received(bridge)); 456 + tsi148_iack_received(bridge)); 457 457 458 458 mutex_unlock(&bridge->vme_int); 459 459 ··· 464 464 * Initialize a slave window with the requested attributes. 465 465 */ 466 466 static int tsi148_slave_set(struct vme_slave_resource *image, int enabled, 467 - unsigned long long vme_base, unsigned long long size, 468 - dma_addr_t pci_base, u32 aspace, u32 cycle) 467 + unsigned long long vme_base, unsigned long long size, 468 + dma_addr_t pci_base, u32 aspace, u32 cycle) 469 469 { 470 470 unsigned int i, addr = 0, granularity = 0; 471 471 unsigned int temp_ctl = 0; ··· 607 607 * Get slave window configuration. 608 608 */ 609 609 static int tsi148_slave_get(struct vme_slave_resource *image, int *enabled, 610 - unsigned long long *vme_base, unsigned long long *size, 611 - dma_addr_t *pci_base, u32 *aspace, u32 *cycle) 610 + unsigned long long *vme_base, unsigned long long *size, 611 + dma_addr_t *pci_base, u32 *aspace, u32 *cycle) 612 612 { 613 613 unsigned int i, granularity = 0, ctl = 0; 614 614 unsigned int vme_base_low, vme_base_high; ··· 706 706 * Allocate and map PCI Resource 707 707 */ 708 708 static int tsi148_alloc_resource(struct vme_master_resource *image, 709 - unsigned long long size) 709 + unsigned long long size) 710 710 { 711 711 unsigned long long existing_size; 712 712 int retval = 0; ··· 751 751 image->bus_resource.end = (unsigned long)size; 752 752 image->bus_resource.flags = IORESOURCE_MEM; 753 753 754 - retval = pci_bus_alloc_resource(pdev->bus, 755 - &image->bus_resource, size, 0x10000, PCIBIOS_MIN_MEM, 756 - 0, NULL, NULL); 754 + retval = pci_bus_alloc_resource(pdev->bus, &image->bus_resource, 755 + size, 0x10000, PCIBIOS_MIN_MEM, 756 + 0, NULL, NULL); 757 757 if (retval) { 758 758 dev_err(tsi148_bridge->parent, "Failed to allocate mem resource for window %d size 0x%lx start 0x%lx\n", 759 759 image->number, (unsigned long)size, ··· 796 796 * Set the attributes of an outbound window. 797 797 */ 798 798 static int tsi148_master_set(struct vme_master_resource *image, int enabled, 799 - unsigned long long vme_base, unsigned long long size, u32 aspace, 800 - u32 cycle, u32 dwidth) 799 + unsigned long long vme_base, unsigned long long size, 800 + u32 aspace, u32 cycle, u32 dwidth) 801 801 { 802 802 int retval = 0; 803 803 unsigned int i; ··· 1031 1031 * XXX Not parsing prefetch information. 1032 1032 */ 1033 1033 static int __tsi148_master_get(struct vme_master_resource *image, int *enabled, 1034 - unsigned long long *vme_base, unsigned long long *size, u32 *aspace, 1035 - u32 *cycle, u32 *dwidth) 1034 + unsigned long long *vme_base, unsigned long long *size, 1035 + u32 *aspace, u32 *cycle, u32 *dwidth) 1036 1036 { 1037 1037 unsigned int i, ctl; 1038 1038 unsigned int pci_base_low, pci_base_high; ··· 1140 1140 } 1141 1141 1142 1142 static int tsi148_master_get(struct vme_master_resource *image, int *enabled, 1143 - unsigned long long *vme_base, unsigned long long *size, u32 *aspace, 1144 - u32 *cycle, u32 *dwidth) 1143 + unsigned long long *vme_base, unsigned long long *size, 1144 + u32 *aspace, u32 *cycle, u32 *dwidth) 1145 1145 { 1146 1146 int retval; 1147 1147 1148 1148 spin_lock(&image->lock); 1149 1149 1150 1150 retval = __tsi148_master_get(image, enabled, vme_base, size, aspace, 1151 - cycle, dwidth); 1151 + cycle, dwidth); 1152 1152 1153 1153 spin_unlock(&image->lock); 1154 1154 ··· 1156 1156 } 1157 1157 1158 1158 static ssize_t tsi148_master_read(struct vme_master_resource *image, void *buf, 1159 - size_t count, loff_t offset) 1159 + size_t count, loff_t offset) 1160 1160 { 1161 1161 int retval, enabled; 1162 1162 unsigned long long vme_base, size; ··· 1241 1241 } 1242 1242 1243 1243 static ssize_t tsi148_master_write(struct vme_master_resource *image, void *buf, 1244 - size_t count, loff_t offset) 1244 + size_t count, loff_t offset) 1245 1245 { 1246 1246 int retval = 0, enabled; 1247 1247 unsigned long long vme_base, size; ··· 1342 1342 * 1343 1343 * Requires a previously configured master window, returns final value. 1344 1344 */ 1345 - static unsigned int tsi148_master_rmw(struct vme_master_resource *image, 1346 - unsigned int mask, unsigned int compare, unsigned int swap, 1347 - loff_t offset) 1345 + static unsigned int tsi148_master_rmw(struct vme_master_resource *image, unsigned int mask, 1346 + unsigned int compare, unsigned int swap, loff_t offset) 1348 1347 { 1349 1348 unsigned long long pci_addr; 1350 1349 unsigned int pci_addr_high, pci_addr_low; ··· 1398 1399 } 1399 1400 1400 1401 static int tsi148_dma_set_vme_src_attributes(struct device *dev, __be32 *attr, 1401 - u32 aspace, u32 cycle, u32 dwidth) 1402 + u32 aspace, u32 cycle, u32 dwidth) 1402 1403 { 1403 1404 u32 val; 1404 1405 ··· 1496 1497 } 1497 1498 1498 1499 static int tsi148_dma_set_vme_dest_attributes(struct device *dev, __be32 *attr, 1499 - u32 aspace, u32 cycle, u32 dwidth) 1500 + u32 aspace, u32 cycle, u32 dwidth) 1500 1501 { 1501 1502 u32 val; 1502 1503 ··· 1598 1599 * 1599 1600 * Note: DMA engine expects the DMA descriptor to be big endian. 1600 1601 */ 1601 - static int tsi148_dma_list_add(struct vme_dma_list *list, 1602 - struct vme_dma_attr *src, struct vme_dma_attr *dest, size_t count) 1602 + static int tsi148_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src, 1603 + struct vme_dma_attr *dest, size_t count) 1603 1604 { 1604 1605 struct tsi148_dma_entry *entry, *prev; 1605 1606 u32 address_high, address_low, val; ··· 1652 1653 case VME_DMA_PCI: 1653 1654 pci_attr = src->private; 1654 1655 1655 - reg_split((unsigned long long)pci_attr->address, &address_high, 1656 - &address_low); 1656 + reg_split((unsigned long long)pci_attr->address, &address_high, &address_low); 1657 1657 entry->descriptor.dsau = cpu_to_be32(address_high); 1658 1658 entry->descriptor.dsal = cpu_to_be32(address_low); 1659 1659 entry->descriptor.dsat = cpu_to_be32(TSI148_LCSR_DSAT_TYP_PCI); ··· 1660 1662 case VME_DMA_VME: 1661 1663 vme_attr = src->private; 1662 1664 1663 - reg_split((unsigned long long)vme_attr->address, &address_high, 1664 - &address_low); 1665 + reg_split((unsigned long long)vme_attr->address, &address_high, &address_low); 1665 1666 entry->descriptor.dsau = cpu_to_be32(address_high); 1666 1667 entry->descriptor.dsal = cpu_to_be32(address_low); 1667 1668 entry->descriptor.dsat = cpu_to_be32(TSI148_LCSR_DSAT_TYP_VME); 1668 1669 1669 - retval = tsi148_dma_set_vme_src_attributes( 1670 - tsi148_bridge->parent, &entry->descriptor.dsat, 1671 - vme_attr->aspace, vme_attr->cycle, vme_attr->dwidth); 1670 + retval = tsi148_dma_set_vme_src_attributes(tsi148_bridge->parent, 1671 + &entry->descriptor.dsat, 1672 + vme_attr->aspace, 1673 + vme_attr->cycle, 1674 + vme_attr->dwidth); 1672 1675 if (retval < 0) 1673 1676 goto err_source; 1674 1677 break; ··· 1689 1690 pci_attr = dest->private; 1690 1691 1691 1692 reg_split((unsigned long long)pci_attr->address, &address_high, 1692 - &address_low); 1693 + &address_low); 1693 1694 entry->descriptor.ddau = cpu_to_be32(address_high); 1694 1695 entry->descriptor.ddal = cpu_to_be32(address_low); 1695 1696 entry->descriptor.ddat = cpu_to_be32(TSI148_LCSR_DDAT_TYP_PCI); ··· 1698 1699 vme_attr = dest->private; 1699 1700 1700 1701 reg_split((unsigned long long)vme_attr->address, &address_high, 1701 - &address_low); 1702 + &address_low); 1702 1703 entry->descriptor.ddau = cpu_to_be32(address_high); 1703 1704 entry->descriptor.ddal = cpu_to_be32(address_low); 1704 1705 entry->descriptor.ddat = cpu_to_be32(TSI148_LCSR_DDAT_TYP_VME); 1705 1706 1706 - retval = tsi148_dma_set_vme_dest_attributes( 1707 - tsi148_bridge->parent, &entry->descriptor.ddat, 1708 - vme_attr->aspace, vme_attr->cycle, vme_attr->dwidth); 1707 + retval = tsi148_dma_set_vme_dest_attributes(tsi148_bridge->parent, 1708 + &entry->descriptor.ddat, 1709 + vme_attr->aspace, 1710 + vme_attr->cycle, 1711 + vme_attr->dwidth); 1709 1712 if (retval < 0) 1710 1713 goto err_dest; 1711 1714 break; ··· 1736 1735 /* Fill out previous descriptors "Next Address" */ 1737 1736 if (entry->list.prev != &list->entries) { 1738 1737 reg_split((unsigned long long)entry->dma_handle, &address_high, 1739 - &address_low); 1738 + &address_low); 1740 1739 prev = list_entry(entry->list.prev, struct tsi148_dma_entry, 1741 1740 list); 1742 1741 prev->descriptor.dnlau = cpu_to_be32(address_high); ··· 1814 1813 1815 1814 /* Get first bus address and write into registers */ 1816 1815 entry = list_first_entry(&list->entries, struct tsi148_dma_entry, 1817 - list); 1816 + list); 1818 1817 1819 1818 mutex_unlock(&ctrlr->mtx); 1820 1819 ··· 1833 1832 TSI148_LCSR_DMA[channel] + TSI148_LCSR_OFFSET_DCTL); 1834 1833 1835 1834 retval = wait_event_interruptible(bridge->dma_queue[channel], 1836 - tsi148_dma_busy(ctrlr->parent, channel)); 1835 + tsi148_dma_busy(ctrlr->parent, channel)); 1837 1836 1838 1837 if (retval) { 1839 1838 iowrite32be(dctlreg | TSI148_LCSR_DCTL_ABT, bridge->base + ··· 1884 1883 entry = list_entry(pos, struct tsi148_dma_entry, list); 1885 1884 1886 1885 dma_unmap_single(tsi148_bridge->parent, entry->dma_handle, 1887 - sizeof(struct tsi148_dma_descriptor), DMA_TO_DEVICE); 1886 + sizeof(struct tsi148_dma_descriptor), DMA_TO_DEVICE); 1888 1887 kfree(entry); 1889 1888 } 1890 1889 ··· 1899 1898 * callback is attached and disabled when the last callback is removed. 1900 1899 */ 1901 1900 static int tsi148_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base, 1902 - u32 aspace, u32 cycle) 1901 + u32 aspace, u32 cycle) 1903 1902 { 1904 1903 u32 lm_base_high, lm_base_low, lm_ctl = 0; 1905 1904 int i; ··· 1964 1963 * or disabled. 1965 1964 */ 1966 1965 static int tsi148_lm_get(struct vme_lm_resource *lm, 1967 - unsigned long long *lm_base, u32 *aspace, u32 *cycle) 1966 + unsigned long long *lm_base, u32 *aspace, u32 *cycle) 1968 1967 { 1969 1968 u32 lm_base_high, lm_base_low, lm_ctl, enabled = 0; 1970 1969 struct tsi148_driver *bridge; ··· 2014 2013 * Callback will be passed the monitor triggered. 2015 2014 */ 2016 2015 static int tsi148_lm_attach(struct vme_lm_resource *lm, int monitor, 2017 - void (*callback)(void *), void *data) 2016 + void (*callback)(void *), void *data) 2018 2017 { 2019 2018 u32 lm_ctl, tmp; 2020 2019 struct vme_bridge *tsi148_bridge; ··· 2087 2086 iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEO); 2088 2087 2089 2088 iowrite32be(TSI148_LCSR_INTC_LMC[monitor], 2090 - bridge->base + TSI148_LCSR_INTC); 2089 + bridge->base + TSI148_LCSR_INTC); 2091 2090 2092 2091 /* Detach callback */ 2093 2092 bridge->lm_callback[monitor] = NULL; ··· 2127 2126 } 2128 2127 2129 2128 static void *tsi148_alloc_consistent(struct device *parent, size_t size, 2130 - dma_addr_t *dma) 2129 + dma_addr_t *dma) 2131 2130 { 2132 2131 struct pci_dev *pdev; 2133 2132 ··· 2138 2137 } 2139 2138 2140 2139 static void tsi148_free_consistent(struct device *parent, size_t size, 2141 - void *vaddr, dma_addr_t dma) 2140 + void *vaddr, dma_addr_t dma) 2142 2141 { 2143 2142 struct pci_dev *pdev; 2144 2143 ··· 2161 2160 * be mapped onto PCI memory. 2162 2161 */ 2163 2162 static int tsi148_crcsr_init(struct vme_bridge *tsi148_bridge, 2164 - struct pci_dev *pdev) 2163 + struct pci_dev *pdev) 2165 2164 { 2166 2165 u32 cbar, crat, vstat; 2167 2166 u32 crcsr_bus_high, crcsr_bus_low; ··· 2202 2201 dev_info(tsi148_bridge->parent, "CR/CSR already enabled\n"); 2203 2202 } else { 2204 2203 dev_info(tsi148_bridge->parent, "Enabling CR/CSR space\n"); 2205 - iowrite32be(crat | TSI148_LCSR_CRAT_EN, 2206 - bridge->base + TSI148_LCSR_CRAT); 2204 + iowrite32be(crat | TSI148_LCSR_CRAT_EN, bridge->base + TSI148_LCSR_CRAT); 2207 2205 } 2208 2206 2209 2207 /* If we want flushed, error-checked writes, set up a window ··· 2210 2210 * through VME writes. 2211 2211 */ 2212 2212 if (err_chk) { 2213 - retval = tsi148_master_set(bridge->flush_image, 1, 2214 - (vstat * 0x80000), 0x80000, VME_CRCSR, VME_SCT, 2215 - VME_D16); 2213 + retval = tsi148_master_set(bridge->flush_image, 1, (vstat * 0x80000), 2214 + 0x80000, VME_CRCSR, VME_SCT, VME_D16); 2216 2215 if (retval) 2217 2216 dev_err(tsi148_bridge->parent, "Configuring flush image failed\n"); 2218 2217 } ··· 2220 2221 } 2221 2222 2222 2223 static void tsi148_crcsr_exit(struct vme_bridge *tsi148_bridge, 2223 - struct pci_dev *pdev) 2224 + struct pci_dev *pdev) 2224 2225 { 2225 2226 u32 crat; 2226 2227 struct tsi148_driver *bridge; ··· 2230 2231 /* Turn off CR/CSR space */ 2231 2232 crat = ioread32be(bridge->base + TSI148_LCSR_CRAT); 2232 2233 iowrite32be(crat & ~TSI148_LCSR_CRAT_EN, 2233 - bridge->base + TSI148_LCSR_CRAT); 2234 + bridge->base + TSI148_LCSR_CRAT); 2234 2235 2235 2236 /* Free image */ 2236 2237 iowrite32be(0, bridge->base + TSI148_LCSR_CROU); ··· 2251 2252 struct vme_slave_resource *slave_image; 2252 2253 struct vme_dma_resource *dma_ctrlr; 2253 2254 struct vme_lm_resource *lm; 2255 + 2256 + if (geoid >= VME_MAX_SLOTS) { 2257 + dev_err(&pdev->dev, "VME geographical address must be between 0 and %d (exclusive), but got %d\n", 2258 + VME_MAX_SLOTS, geoid); 2259 + return -EINVAL; 2260 + } 2254 2261 2255 2262 /* If we want to support more than one of each bridge, we need to 2256 2263 * dynamically generate this so we get one per device ··· 2292 2287 2293 2288 /* map registers in BAR 0 */ 2294 2289 tsi148_device->base = ioremap(pci_resource_start(pdev, 0), 2295 - 4096); 2290 + 4096); 2296 2291 if (!tsi148_device->base) { 2297 2292 dev_err(&pdev->dev, "Unable to remap CRG region\n"); 2298 2293 retval = -EIO; ··· 2372 2367 sizeof(master_image->bus_resource)); 2373 2368 master_image->kern_base = NULL; 2374 2369 list_add_tail(&master_image->list, 2375 - &tsi148_bridge->master_resources); 2370 + &tsi148_bridge->master_resources); 2376 2371 } 2377 2372 2378 2373 /* Add slave windows to list */ ··· 2393 2388 VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER | 2394 2389 VME_PROG | VME_DATA; 2395 2390 list_add_tail(&slave_image->list, 2396 - &tsi148_bridge->slave_resources); 2391 + &tsi148_bridge->slave_resources); 2397 2392 } 2398 2393 2399 2394 /* Add dma engines to list */ ··· 2414 2409 INIT_LIST_HEAD(&dma_ctrlr->pending); 2415 2410 INIT_LIST_HEAD(&dma_ctrlr->running); 2416 2411 list_add_tail(&dma_ctrlr->list, 2417 - &tsi148_bridge->dma_resources); 2412 + &tsi148_bridge->dma_resources); 2418 2413 } 2419 2414 2420 2415 /* Add location monitor to list */ ··· 2452 2447 2453 2448 data = ioread32be(tsi148_device->base + TSI148_LCSR_VSTAT); 2454 2449 dev_info(&pdev->dev, "Board is%s the VME system controller\n", 2455 - (data & TSI148_LCSR_VSTAT_SCONS) ? "" : " not"); 2450 + (data & TSI148_LCSR_VSTAT_SCONS) ? "" : " not"); 2456 2451 if (!geoid) 2457 2452 dev_info(&pdev->dev, "VME geographical address is %d\n", 2458 - data & TSI148_LCSR_VSTAT_GA_M); 2453 + data & TSI148_LCSR_VSTAT_GA_M); 2459 2454 else 2460 2455 dev_info(&pdev->dev, "VME geographical address is set to %d\n", 2461 - geoid); 2456 + geoid); 2462 2457 2463 2458 dev_info(&pdev->dev, "VME Write and flush and error check is %s\n", 2464 - err_chk ? "enabled" : "disabled"); 2459 + err_chk ? "enabled" : "disabled"); 2465 2460 2466 2461 retval = tsi148_crcsr_init(tsi148_bridge, pdev); 2467 2462 if (retval) { ··· 2512 2507 err_master: 2513 2508 /* resources are stored in link list */ 2514 2509 list_for_each_safe(pos, n, &tsi148_bridge->master_resources) { 2515 - master_image = list_entry(pos, struct vme_master_resource, 2516 - list); 2510 + master_image = list_entry(pos, struct vme_master_resource, list); 2517 2511 list_del(pos); 2518 2512 kfree(master_image); 2519 2513 } ··· 2609 2605 2610 2606 /* resources are stored in link list */ 2611 2607 list_for_each_safe(pos, tmplist, &tsi148_bridge->master_resources) { 2612 - master_image = list_entry(pos, struct vme_master_resource, 2613 - list); 2608 + master_image = list_entry(pos, struct vme_master_resource, list); 2614 2609 list_del(pos); 2615 2610 kfree(master_image); 2616 2611 } ··· 2631 2628 module_param(err_chk, bool, 0); 2632 2629 2633 2630 MODULE_PARM_DESC(geoid, "Override geographical addressing"); 2634 - module_param(geoid, int, 0); 2631 + module_param(geoid, uint, 0); 2635 2632 2636 2633 MODULE_DESCRIPTION("VME driver for the Tundra Tempe VME bridge"); 2637 2634 MODULE_LICENSE("GPL");
+1 -1
drivers/staging/vt6655/TODO
··· 18 18 - integrate with drivers/net/wireless 19 19 20 20 Please send any patches to Greg Kroah-Hartman <greg@kroah.com> 21 - and Forest Bond <forest@alittletooquiet.net>. 21 + and Philipp Hortmann <philipp.g.hortmann@gmail.com>.
+6 -6
drivers/staging/vt6655/card.c
··· 388 388 struct vnt_tx_desc *curr_td; 389 389 390 390 /* initialize TD index */ 391 - priv->tail_td[0] = &priv->apTD0Rings[0]; 392 - priv->apCurrTD[0] = &priv->apTD0Rings[0]; 391 + priv->tail_td[0] = &priv->ap_td0_rings[0]; 392 + priv->apCurrTD[0] = &priv->ap_td0_rings[0]; 393 393 394 - priv->tail_td[1] = &priv->apTD1Rings[0]; 395 - priv->apCurrTD[1] = &priv->apTD1Rings[0]; 394 + priv->tail_td[1] = &priv->ap_td1_rings[0]; 395 + priv->apCurrTD[1] = &priv->ap_td1_rings[0]; 396 396 397 397 for (uu = 0; uu < TYPE_MAXTD; uu++) 398 398 priv->iTDUsed[uu] = 0; 399 399 400 400 for (uu = 0; uu < priv->opts.tx_descs[0]; uu++) { 401 - curr_td = &priv->apTD0Rings[uu]; 401 + curr_td = &priv->ap_td0_rings[uu]; 402 402 curr_td->td0.owner = OWNED_BY_HOST; 403 403 /* init all Tx Packet pointer to NULL */ 404 404 } 405 405 for (uu = 0; uu < priv->opts.tx_descs[1]; uu++) { 406 - curr_td = &priv->apTD1Rings[uu]; 406 + curr_td = &priv->ap_td1_rings[uu]; 407 407 curr_td->td0.owner = OWNED_BY_HOST; 408 408 /* init all Tx Packet pointer to NULL */ 409 409 }
+2 -2
drivers/staging/vt6655/card.h
··· 55 55 void card_radio_power_off(struct vnt_private *priv); 56 56 bool card_set_phy_parameter(struct vnt_private *priv, u8 bb_type); 57 57 bool card_update_tsf(struct vnt_private *priv, unsigned char rx_rate, 58 - u64 bss_timestamp); 58 + u64 bss_timestamp); 59 59 bool card_set_beacon_period(struct vnt_private *priv, 60 - unsigned short beacon_interval); 60 + unsigned short beacon_interval); 61 61 62 62 #endif /* __CARD_H__ */
+6 -6
drivers/staging/vt6655/device.h
··· 135 135 struct vnt_tx_desc *apCurrTD[TYPE_MAXTD]; 136 136 struct vnt_tx_desc *tail_td[TYPE_MAXTD]; 137 137 138 - struct vnt_tx_desc *apTD0Rings; 139 - struct vnt_tx_desc *apTD1Rings; 138 + struct vnt_tx_desc *ap_td0_rings; 139 + struct vnt_tx_desc *ap_td1_rings; 140 140 141 141 struct vnt_rx_desc *aRD0Ring; 142 142 struct vnt_rx_desc *aRD1Ring; ··· 189 189 190 190 u8 byBBType; /* 0:11A, 1:11B, 2:11G */ 191 191 u8 packet_type; /* 192 - * 0:11a,1:11b,2:11gb (only CCK 193 - * in BasicRate), 3:11ga (OFDM in 194 - * Basic Rate) 195 - */ 192 + * 0:11a,1:11b,2:11gb (only CCK 193 + * in BasicRate), 3:11ga (OFDM in 194 + * Basic Rate) 195 + */ 196 196 unsigned short wBasicRate; 197 197 unsigned char byACKRate; 198 198 unsigned char byTopOFDMBasicRate;
+17 -17
drivers/staging/vt6655/device_main.c
··· 550 550 priv->opts.tx_descs[0] * sizeof(struct vnt_tx_desc); 551 551 552 552 /* vir_pool: pvoid type */ 553 - priv->apTD0Rings = vir_pool 553 + priv->ap_td0_rings = vir_pool 554 554 + priv->opts.rx_descs0 * sizeof(struct vnt_rx_desc) 555 555 + priv->opts.rx_descs1 * sizeof(struct vnt_rx_desc); 556 556 557 - priv->apTD1Rings = vir_pool 557 + priv->ap_td1_rings = vir_pool 558 558 + priv->opts.rx_descs0 * sizeof(struct vnt_rx_desc) 559 559 + priv->opts.rx_descs1 * sizeof(struct vnt_rx_desc) 560 560 + priv->opts.tx_descs[0] * sizeof(struct vnt_tx_desc); ··· 720 720 curr = priv->td0_pool_dma; 721 721 for (i = 0; i < priv->opts.tx_descs[0]; 722 722 i++, curr += sizeof(struct vnt_tx_desc)) { 723 - desc = &priv->apTD0Rings[i]; 723 + desc = &priv->ap_td0_rings[i]; 724 724 desc->td_info = kzalloc(sizeof(*desc->td_info), GFP_KERNEL); 725 725 if (!desc->td_info) { 726 726 ret = -ENOMEM; ··· 730 730 desc->td_info->buf = priv->tx0_bufs + i * PKT_BUF_SZ; 731 731 desc->td_info->buf_dma = priv->tx_bufs_dma0 + i * PKT_BUF_SZ; 732 732 733 - desc->next = &(priv->apTD0Rings[(i + 1) % priv->opts.tx_descs[0]]); 733 + desc->next = &(priv->ap_td0_rings[(i + 1) % priv->opts.tx_descs[0]]); 734 734 desc->next_desc = cpu_to_le32(curr + 735 735 sizeof(struct vnt_tx_desc)); 736 736 } 737 737 738 738 if (i > 0) 739 - priv->apTD0Rings[i - 1].next_desc = cpu_to_le32(priv->td0_pool_dma); 740 - priv->tail_td[0] = priv->apCurrTD[0] = &priv->apTD0Rings[0]; 739 + priv->ap_td0_rings[i - 1].next_desc = cpu_to_le32(priv->td0_pool_dma); 740 + priv->tail_td[0] = priv->apCurrTD[0] = &priv->ap_td0_rings[0]; 741 741 742 742 return 0; 743 743 744 744 err_free_desc: 745 745 while (i--) { 746 - desc = &priv->apTD0Rings[i]; 746 + desc = &priv->ap_td0_rings[i]; 747 747 kfree(desc->td_info); 748 748 } 749 749 ··· 761 761 curr = priv->td1_pool_dma; 762 762 for (i = 0; i < priv->opts.tx_descs[1]; 763 763 i++, curr += sizeof(struct vnt_tx_desc)) { 764 - desc = &priv->apTD1Rings[i]; 764 + desc = &priv->ap_td1_rings[i]; 765 765 desc->td_info = kzalloc(sizeof(*desc->td_info), GFP_KERNEL); 766 766 if (!desc->td_info) { 767 767 ret = -ENOMEM; ··· 771 771 desc->td_info->buf = priv->tx1_bufs + i * PKT_BUF_SZ; 772 772 desc->td_info->buf_dma = priv->tx_bufs_dma1 + i * PKT_BUF_SZ; 773 773 774 - desc->next = &(priv->apTD1Rings[(i + 1) % priv->opts.tx_descs[1]]); 774 + desc->next = &(priv->ap_td1_rings[(i + 1) % priv->opts.tx_descs[1]]); 775 775 desc->next_desc = cpu_to_le32(curr + sizeof(struct vnt_tx_desc)); 776 776 } 777 777 778 778 if (i > 0) 779 - priv->apTD1Rings[i - 1].next_desc = cpu_to_le32(priv->td1_pool_dma); 780 - priv->tail_td[1] = priv->apCurrTD[1] = &priv->apTD1Rings[0]; 779 + priv->ap_td1_rings[i - 1].next_desc = cpu_to_le32(priv->td1_pool_dma); 780 + priv->tail_td[1] = priv->apCurrTD[1] = &priv->ap_td1_rings[0]; 781 781 782 782 return 0; 783 783 784 784 err_free_desc: 785 785 while (i--) { 786 - desc = &priv->apTD1Rings[i]; 786 + desc = &priv->ap_td1_rings[i]; 787 787 kfree(desc->td_info); 788 788 } 789 789 ··· 795 795 int i; 796 796 797 797 for (i = 0; i < priv->opts.tx_descs[0]; i++) { 798 - struct vnt_tx_desc *desc = &priv->apTD0Rings[i]; 798 + struct vnt_tx_desc *desc = &priv->ap_td0_rings[i]; 799 799 struct vnt_td_info *td_info = desc->td_info; 800 800 801 801 dev_kfree_skb(td_info->skb); ··· 808 808 int i; 809 809 810 810 for (i = 0; i < priv->opts.tx_descs[1]; i++) { 811 - struct vnt_tx_desc *desc = &priv->apTD1Rings[i]; 811 + struct vnt_tx_desc *desc = &priv->ap_td1_rings[i]; 812 812 struct vnt_td_info *td_info = desc->td_info; 813 813 814 814 dev_kfree_skb(td_info->skb); ··· 1140 1140 PSbIsNextTBTTWakeUp((void *)priv); 1141 1141 1142 1142 if ((priv->op_mode == NL80211_IFTYPE_AP || 1143 - priv->op_mode == NL80211_IFTYPE_ADHOC) && 1143 + priv->op_mode == NL80211_IFTYPE_ADHOC) && 1144 1144 priv->vif->bss_conf.enable_beacon) 1145 1145 MACvOneShotTimer1MicroSec(priv, 1146 1146 (priv->vif->bss_conf.beacon_int - ··· 1535 1535 priv->op_mode != NL80211_IFTYPE_AP) { 1536 1536 if (vif->cfg.assoc && conf->beacon_rate) { 1537 1537 card_update_tsf(priv, conf->beacon_rate->hw_value, 1538 - conf->sync_tsf); 1538 + conf->sync_tsf); 1539 1539 1540 1540 card_set_beacon_period(priv, conf->beacon_int); 1541 1541 ··· 1763 1763 priv->memaddr = pci_resource_start(pcid, 0); 1764 1764 priv->ioaddr = pci_resource_start(pcid, 1); 1765 1765 priv->port_offset = ioremap(priv->memaddr & PCI_BASE_ADDRESS_MEM_MASK, 1766 - 256); 1766 + 256); 1767 1767 if (!priv->port_offset) { 1768 1768 dev_err(&pcid->dev, ": Failed to IO remapping ..\n"); 1769 1769 device_free_info(priv);
+2 -2
drivers/staging/vt6655/mac.h
··· 537 537 538 538 /*--------------------- Export Macros ------------------------------*/ 539 539 540 - #define VT6655_MAC_SELECT_PAGE0(iobase) iowrite8(0, iobase + MAC_REG_PAGE1SEL) 540 + #define VT6655_MAC_SELECT_PAGE0(iobase) iowrite8(0, (iobase) + MAC_REG_PAGE1SEL) 541 541 542 - #define VT6655_MAC_SELECT_PAGE1(iobase) iowrite8(1, iobase + MAC_REG_PAGE1SEL) 542 + #define VT6655_MAC_SELECT_PAGE1(iobase) iowrite8(1, (iobase) + MAC_REG_PAGE1SEL) 543 543 544 544 #define MAKEWORD(lb, hb) \ 545 545 ((unsigned short)(((unsigned char)(lb)) | (((unsigned short)((unsigned char)(hb))) << 8)))
+7 -7
drivers/staging/vt6655/rxtx.c
··· 493 493 buf->duration_a = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, 494 494 wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); 495 495 buf->duration_b = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B, 496 - pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); 496 + pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); 497 497 buf->duration_a_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, 498 - wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); 498 + wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); 499 499 buf->duration_a_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, 500 500 wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); 501 501 ··· 520 520 buf->duration_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, 521 521 wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); 522 522 buf->duration_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, 523 - wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); 523 + wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); 524 524 buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); 525 525 return buf->duration; 526 526 } ··· 1375 1375 /* Get Duration and TimeStampOff */ 1376 1376 short_head->duration = 1377 1377 cpu_to_le16((u16)s_uGetDataDuration(priv, DATADUR_B, 1378 - frame_size, PK_TYPE_11A, current_rate, 1379 - false, 0, 0, 1, AUTO_FB_NONE)); 1378 + frame_size, PK_TYPE_11A, current_rate, 1379 + false, 0, 0, 1, AUTO_FB_NONE)); 1380 1380 1381 1381 short_head->time_stamp_off = 1382 1382 vnt_time_stamp_off(priv, current_rate); ··· 1391 1391 /* Get Duration and TimeStampOff */ 1392 1392 short_head->duration = 1393 1393 cpu_to_le16((u16)s_uGetDataDuration(priv, DATADUR_B, 1394 - frame_size, PK_TYPE_11B, current_rate, 1395 - false, 0, 0, 1, AUTO_FB_NONE)); 1394 + frame_size, PK_TYPE_11B, current_rate, 1395 + false, 0, 0, 1, AUTO_FB_NONE)); 1396 1396 1397 1397 short_head->time_stamp_off = 1398 1398 vnt_time_stamp_off(priv, current_rate);