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 branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (35 commits)
Add support for the Davicom DM9161A PHY
sky2: only disable 88e8056 on some boards
sky2: 88e8071 support not ready
skge: crash on shutdown/suspend
sky2: fix oops on shutdown
mlx4: don't use deprecated IRQ flags
netxen_nic_main don't use deprecated irq flags
Use menuconfig objects II - netdev/wan
Use menuconfig objects II - netdev/pcmcia
Use menuconfig objects II - netdev/atm
Use menuconfig objects: netdev
Use menuconfig objects: PHY
spidernet: remove unnecessary accesses to phy
S2IO: Statistics for link up/down and memory allocated/freed
S2IO: statistics for memory allocation failuers
S2IO: getringparam ethtool option
[PATCH] libertas: 64-bit cleanups
[PATCH] libertas: sparse fixes
[PATCH] libertas: fix missing unlock in TX error path
[PATCH] libertas: make debugfs.c sparse-clean
...

+750 -3099
+17 -15
drivers/atm/Kconfig
··· 2 2 # ATM device configuration 3 3 # 4 4 5 - menu "ATM drivers" 5 + menuconfig ATM_DRIVERS 6 + bool "ATM drivers" 6 7 depends on NETDEVICES && ATM 8 + default y 9 + 10 + if ATM_DRIVERS 7 11 8 12 config ATM_DUMMY 9 13 tristate "Dummy ATM driver" 10 - depends on ATM 11 14 help 12 15 Dummy ATM driver. Useful for proxy signalling, testing, 13 16 and development. If unsure, say N. 14 17 15 18 config ATM_TCP 16 19 tristate "ATM over TCP" 17 - depends on INET && ATM 20 + depends on INET 18 21 help 19 22 ATM over TCP driver. Useful mainly for development and for 20 23 experiments. If unsure, say N. ··· 33 30 34 31 config ATM_ENI 35 32 tristate "Efficient Networks ENI155P" 36 - depends on PCI && ATM 33 + depends on PCI 37 34 ---help--- 38 35 Driver for the Efficient Networks ENI155p series and SMC ATM 39 36 Power155 155 Mbps ATM adapters. Both, the versions with 512KB and ··· 142 139 143 140 config ATM_FIRESTREAM 144 141 tristate "Fujitsu FireStream (FS50/FS155) " 145 - depends on PCI && ATM 142 + depends on PCI 146 143 help 147 144 Driver for the Fujitsu FireStream 155 (MB86697) and 148 145 FireStream 50 (MB86695) ATM PCI chips. ··· 152 149 153 150 config ATM_ZATM 154 151 tristate "ZeitNet ZN1221/ZN1225" 155 - depends on PCI && ATM 152 + depends on PCI 156 153 help 157 154 Driver for the ZeitNet ZN1221 (MMF) and ZN1225 (UTP-5) 155 Mbps ATM 158 155 adapters. ··· 172 169 173 170 config ATM_NICSTAR 174 171 tristate "IDT 77201 (NICStAR) (ForeRunnerLE)" 175 - depends on PCI && ATM && !64BIT 172 + depends on PCI && !64BIT 176 173 help 177 174 The NICStAR chipset family is used in a large number of ATM NICs for 178 175 25 and for 155 Mbps, including IDT cards and the Fore ForeRunnerLE ··· 205 202 206 203 config ATM_IDT77252 207 204 tristate "IDT 77252 (NICStAR II)" 208 - depends on PCI && ATM 205 + depends on PCI 209 206 help 210 207 Driver for the IDT 77252 ATM PCI chips. 211 208 ··· 240 237 241 238 config ATM_AMBASSADOR 242 239 tristate "Madge Ambassador (Collage PCI 155 Server)" 243 - depends on PCI && ATM 240 + depends on PCI 244 241 select BITREVERSE 245 242 help 246 243 This is a driver for ATMizer based ATM card produced by Madge ··· 265 262 266 263 config ATM_HORIZON 267 264 tristate "Madge Horizon [Ultra] (Collage PCI 25 and Collage PCI 155 Client)" 268 - depends on PCI && ATM 265 + depends on PCI 269 266 help 270 267 This is a driver for the Horizon chipset ATM adapter cards once 271 268 produced by Madge Networks Ltd. Say Y (or M to compile as a module ··· 289 286 290 287 config ATM_IA 291 288 tristate "Interphase ATM PCI x575/x525/x531" 292 - depends on PCI && ATM && !64BIT 289 + depends on PCI && !64BIT 293 290 ---help--- 294 291 This is a driver for the Interphase (i)ChipSAR adapter cards 295 292 which include a variety of variants in term of the size of the ··· 322 319 323 320 config ATM_FORE200E_MAYBE 324 321 tristate "FORE Systems 200E-series" 325 - depends on (PCI || SBUS) && ATM 322 + depends on PCI || SBUS 326 323 ---help--- 327 324 This is a driver for the FORE Systems 200E-series ATM adapter 328 325 cards. It simultaneously supports PCA-200E and SBA-200E models ··· 439 436 440 437 config ATM_HE 441 438 tristate "ForeRunner HE Series" 442 - depends on PCI && ATM 439 + depends on PCI 443 440 help 444 441 This is a driver for the Marconi ForeRunner HE-series ATM adapter 445 442 cards. It simultaneously supports the 155 and 622 versions. ··· 451 448 Support for the S/UNI-Ultra and S/UNI-622 found in the ForeRunner 452 449 HE cards. This driver provides carrier detection some statistics. 453 450 454 - endmenu 455 - 451 + endif # ATM
+12 -4
drivers/net/Kconfig
··· 1898 1898 # Gigabit Ethernet 1899 1899 # 1900 1900 1901 - menu "Ethernet (1000 Mbit)" 1901 + menuconfig NETDEV_1000 1902 + bool "Ethernet (1000 Mbit)" 1902 1903 depends on !UML 1904 + default y 1905 + 1906 + if NETDEV_1000 1903 1907 1904 1908 config ACENIC 1905 1909 tristate "Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support" ··· 2330 2326 To compile this driver as a module, choose M here. The module 2331 2327 will be called atl1. 2332 2328 2333 - endmenu 2329 + endif # NETDEV_1000 2334 2330 2335 2331 # 2336 2332 # 10 Gigabit Ethernet 2337 2333 # 2338 2334 2339 - menu "Ethernet (10000 Mbit)" 2335 + menuconfig NETDEV_10000 2336 + bool "Ethernet (10000 Mbit)" 2340 2337 depends on !UML 2338 + default y 2339 + 2340 + if NETDEV_10000 2341 2341 2342 2342 config CHELSIO_T1 2343 2343 tristate "Chelsio 10Gb Ethernet support" ··· 2515 2507 debug_level module parameter (which can also be set after 2516 2508 the driver is loaded through sysfs). 2517 2509 2518 - endmenu 2510 + endif # NETDEV_10000 2519 2511 2520 2512 source "drivers/net/tokenring/Kconfig" 2521 2513
+1 -1
drivers/net/mlx4/eq.c
··· 623 623 priv->eq_table.eq[MLX4_EQ_CATAS].have_irq = 1; 624 624 } else { 625 625 err = request_irq(dev->pdev->irq, mlx4_interrupt, 626 - SA_SHIRQ, DRV_NAME, dev); 626 + IRQF_SHARED, DRV_NAME, dev); 627 627 if (err) 628 628 goto err_out_async; 629 629
+1 -1
drivers/net/netxen/netxen_nic_main.c
··· 735 735 } 736 736 adapter->irq = adapter->ahw.pdev->irq; 737 737 err = request_irq(adapter->ahw.pdev->irq, netxen_intr, 738 - SA_SHIRQ | SA_SAMPLE_RANDOM, netdev->name, 738 + IRQF_SHARED|IRQF_SAMPLE_RANDOM, netdev->name, 739 739 adapter); 740 740 if (err) { 741 741 printk(KERN_ERR "request_irq failed with: %d\n", err);
+7 -16
drivers/net/pcmcia/Kconfig
··· 2 2 # PCMCIA Network device configuration 3 3 # 4 4 5 - menu "PCMCIA network device support" 6 - depends on NETDEVICES && PCMCIA!=n 7 - 8 - config NET_PCMCIA 5 + menuconfig NET_PCMCIA 9 6 bool "PCMCIA network device support" 7 + depends on PCMCIA 10 8 ---help--- 11 9 Say Y if you would like to include support for any PCMCIA or CardBus 12 10 network adapters, then say Y to the driver for your particular card ··· 19 21 20 22 If unsure, say N. 21 23 24 + if NET_PCMCIA 25 + 22 26 config PCMCIA_3C589 23 27 tristate "3Com 3c589 PCMCIA support" 24 - depends on NET_PCMCIA && PCMCIA 25 28 help 26 29 Say Y here if you intend to attach a 3Com 3c589 or compatible PCMCIA 27 30 (PC-card) Ethernet card to your computer. ··· 32 33 33 34 config PCMCIA_3C574 34 35 tristate "3Com 3c574 PCMCIA support" 35 - depends on NET_PCMCIA && PCMCIA 36 36 help 37 37 Say Y here if you intend to attach a 3Com 3c574 or compatible PCMCIA 38 38 (PC-card) Fast Ethernet card to your computer. ··· 41 43 42 44 config PCMCIA_FMVJ18X 43 45 tristate "Fujitsu FMV-J18x PCMCIA support" 44 - depends on NET_PCMCIA && PCMCIA 45 46 select CRC32 46 47 help 47 48 Say Y here if you intend to attach a Fujitsu FMV-J18x or compatible ··· 51 54 52 55 config PCMCIA_PCNET 53 56 tristate "NE2000 compatible PCMCIA support" 54 - depends on NET_PCMCIA && PCMCIA 55 57 select CRC32 56 58 help 57 59 Say Y here if you intend to attach an NE2000 compatible PCMCIA ··· 61 65 62 66 config PCMCIA_NMCLAN 63 67 tristate "New Media PCMCIA support" 64 - depends on NET_PCMCIA && PCMCIA 65 68 help 66 69 Say Y here if you intend to attach a New Media Ethernet or LiveWire 67 70 PCMCIA (PC-card) Ethernet card to your computer. ··· 70 75 71 76 config PCMCIA_SMC91C92 72 77 tristate "SMC 91Cxx PCMCIA support" 73 - depends on NET_PCMCIA && PCMCIA 74 78 select CRC32 75 79 select MII 76 80 help ··· 81 87 82 88 config PCMCIA_XIRC2PS 83 89 tristate "Xircom 16-bit PCMCIA support" 84 - depends on NET_PCMCIA && PCMCIA 85 90 help 86 91 Say Y here if you intend to attach a Xircom 16-bit PCMCIA (PC-card) 87 92 Ethernet or Fast Ethernet card to your computer. ··· 90 97 91 98 config PCMCIA_AXNET 92 99 tristate "Asix AX88190 PCMCIA support" 93 - depends on NET_PCMCIA && PCMCIA 94 100 ---help--- 95 101 Say Y here if you intend to attach an Asix AX88190-based PCMCIA 96 102 (PC-card) Fast Ethernet card to your computer. These cards are ··· 101 109 102 110 config ARCNET_COM20020_CS 103 111 tristate "COM20020 ARCnet PCMCIA support" 104 - depends on NET_PCMCIA && ARCNET_COM20020 && PCMCIA 112 + depends on ARCNET_COM20020 105 113 help 106 114 Say Y here if you intend to attach this type of ARCnet PCMCIA card 107 115 to your computer. ··· 111 119 112 120 config PCMCIA_IBMTR 113 121 tristate "IBM PCMCIA tokenring adapter support" 114 - depends on NET_PCMCIA && IBMTR!=y && TR && PCMCIA && !64BIT 122 + depends on IBMTR!=y && TR && !64BIT 115 123 help 116 124 Say Y here if you intend to attach this type of Token Ring PCMCIA 117 125 card to your computer. You then also need to say Y to "Token Ring ··· 120 128 To compile this driver as a module, choose M here: the module will be 121 129 called ibmtr_cs. 122 130 123 - endmenu 124 - 131 + endif # NET_PCMCIA
+6 -16
drivers/net/phy/Kconfig
··· 2 2 # PHY Layer Configuration 3 3 # 4 4 5 - menu "PHY device support" 6 - depends on !S390 7 - 8 - config PHYLIB 5 + menuconfig PHYLIB 9 6 tristate "PHY Device support and infrastructure" 7 + depends on !S390 10 8 depends on NET_ETHERNET && (BROKEN || !S390) 11 9 help 12 10 Ethernet controllers are usually attached to PHY 13 11 devices. This option provides infrastructure for 14 12 managing PHY devices. 15 13 14 + if PHYLIB 15 + 16 16 comment "MII PHY device drivers" 17 - depends on PHYLIB 18 17 19 18 config MARVELL_PHY 20 19 tristate "Drivers for Marvell PHYs" 21 - depends on PHYLIB 22 20 ---help--- 23 21 Currently has a driver for the 88E1011S 24 22 25 23 config DAVICOM_PHY 26 24 tristate "Drivers for Davicom PHYs" 27 - depends on PHYLIB 28 25 ---help--- 29 26 Currently supports dm9161e and dm9131 30 27 31 28 config QSEMI_PHY 32 29 tristate "Drivers for Quality Semiconductor PHYs" 33 - depends on PHYLIB 34 30 ---help--- 35 31 Currently supports the qs6612 36 32 37 33 config LXT_PHY 38 34 tristate "Drivers for the Intel LXT PHYs" 39 - depends on PHYLIB 40 35 ---help--- 41 36 Currently supports the lxt970, lxt971 42 37 43 38 config CICADA_PHY 44 39 tristate "Drivers for the Cicada PHYs" 45 - depends on PHYLIB 46 40 ---help--- 47 41 Currently supports the cis8204 42 + 48 43 config VITESSE_PHY 49 44 tristate "Drivers for the Vitesse PHYs" 50 - depends on PHYLIB 51 45 ---help--- 52 46 Currently supports the vsc8244 53 47 54 48 config SMSC_PHY 55 49 tristate "Drivers for SMSC PHYs" 56 - depends on PHYLIB 57 50 ---help--- 58 51 Currently supports the LAN83C185 PHY 59 52 60 53 config BROADCOM_PHY 61 54 tristate "Drivers for Broadcom PHYs" 62 - depends on PHYLIB 63 55 ---help--- 64 56 Currently supports the BCM5411, BCM5421 and BCM5461 PHYs. 65 57 66 58 config FIXED_PHY 67 59 tristate "Drivers for PHY emulation on fixed speed/link" 68 - depends on PHYLIB 69 60 ---help--- 70 61 Adds the driver to PHY layer to cover the boards that do not have any PHY bound, 71 62 but with the ability to manipulate the speed/link in software. The relevant MII ··· 71 80 bool "Emulation for 100M Fdx fixed PHY behavior" 72 81 depends on FIXED_PHY 73 82 74 - endmenu 75 - 83 + endif # PHYLIB
+26 -8
drivers/net/phy/davicom.c
··· 139 139 return (err < 0) ? err : 0; 140 140 } 141 141 142 - static struct phy_driver dm9161_driver = { 142 + static struct phy_driver dm9161e_driver = { 143 143 .phy_id = 0x0181b880, 144 144 .name = "Davicom DM9161E", 145 145 .phy_id_mask = 0x0ffffff0, ··· 147 147 .config_init = dm9161_config_init, 148 148 .config_aneg = dm9161_config_aneg, 149 149 .read_status = genphy_read_status, 150 - .driver = { .owner = THIS_MODULE,}, 150 + .driver = { .owner = THIS_MODULE,}, 151 + }; 152 + 153 + static struct phy_driver dm9161a_driver = { 154 + .phy_id = 0x0181b8a0, 155 + .name = "Davicom DM9161A", 156 + .phy_id_mask = 0x0ffffff0, 157 + .features = PHY_BASIC_FEATURES, 158 + .config_init = dm9161_config_init, 159 + .config_aneg = dm9161_config_aneg, 160 + .read_status = genphy_read_status, 161 + .driver = { .owner = THIS_MODULE,}, 151 162 }; 152 163 153 164 static struct phy_driver dm9131_driver = { ··· 171 160 .read_status = genphy_read_status, 172 161 .ack_interrupt = dm9161_ack_interrupt, 173 162 .config_intr = dm9161_config_intr, 174 - .driver = { .owner = THIS_MODULE,}, 163 + .driver = { .owner = THIS_MODULE,}, 175 164 }; 176 165 177 166 static int __init davicom_init(void) 178 167 { 179 168 int ret; 180 169 181 - ret = phy_driver_register(&dm9161_driver); 170 + ret = phy_driver_register(&dm9161e_driver); 182 171 if (ret) 183 172 goto err1; 184 173 185 - ret = phy_driver_register(&dm9131_driver); 174 + ret = phy_driver_register(&dm9161a_driver); 186 175 if (ret) 187 176 goto err2; 177 + 178 + ret = phy_driver_register(&dm9131_driver); 179 + if (ret) 180 + goto err3; 188 181 return 0; 189 182 190 - err2: 191 - phy_driver_unregister(&dm9161_driver); 183 + err3: 184 + phy_driver_unregister(&dm9161a_driver); 185 + err2: 186 + phy_driver_unregister(&dm9161e_driver); 192 187 err1: 193 188 return ret; 194 189 } 195 190 196 191 static void __exit davicom_exit(void) 197 192 { 198 - phy_driver_unregister(&dm9161_driver); 193 + phy_driver_unregister(&dm9161e_driver); 194 + phy_driver_unregister(&dm9161a_driver); 199 195 phy_driver_unregister(&dm9131_driver); 200 196 } 201 197
+321 -47
drivers/net/s2io.c
··· 84 84 #include "s2io.h" 85 85 #include "s2io-regs.h" 86 86 87 - #define DRV_VERSION "2.0.22.1" 87 + #define DRV_VERSION "2.0.23.1" 88 88 89 89 /* S2io Driver name & version. */ 90 90 static char s2io_driver_name[] = "Neterion"; ··· 281 281 ("lro_out_of_sequence_pkts"), 282 282 ("lro_flush_due_to_max_pkts"), 283 283 ("lro_avg_aggr_pkts"), 284 + ("mem_alloc_fail_cnt"), 285 + ("watchdog_timer_cnt"), 286 + ("mem_allocated"), 287 + ("mem_freed"), 288 + ("link_up_cnt"), 289 + ("link_down_cnt"), 290 + ("link_up_time"), 291 + ("link_down_time"), 292 + ("tx_tcode_buf_abort_cnt"), 293 + ("tx_tcode_desc_abort_cnt"), 294 + ("tx_tcode_parity_err_cnt"), 295 + ("tx_tcode_link_loss_cnt"), 296 + ("tx_tcode_list_proc_err_cnt"), 297 + ("rx_tcode_parity_err_cnt"), 298 + ("rx_tcode_abort_cnt"), 299 + ("rx_tcode_parity_abort_cnt"), 300 + ("rx_tcode_rda_fail_cnt"), 301 + ("rx_tcode_unkn_prot_cnt"), 302 + ("rx_tcode_fcs_err_cnt"), 303 + ("rx_tcode_buf_size_err_cnt"), 304 + ("rx_tcode_rxd_corrupt_cnt"), 305 + ("rx_tcode_unkn_err_cnt") 284 306 }; 285 307 286 308 #define S2IO_XENA_STAT_LEN sizeof(ethtool_xena_stats_keys)/ ETH_GSTRING_LEN ··· 512 490 513 491 struct mac_info *mac_control; 514 492 struct config_param *config; 493 + unsigned long long mem_allocated = 0; 515 494 516 495 mac_control = &nic->mac_control; 517 496 config = &nic->config; ··· 542 519 "Malloc failed for list_info\n"); 543 520 return -ENOMEM; 544 521 } 522 + mem_allocated += list_holder_size; 545 523 memset(mac_control->fifos[i].list_info, 0, list_holder_size); 546 524 } 547 525 for (i = 0; i < config->tx_fifo_num; i++) { ··· 589 565 DBG_PRINT(INFO_DBG, "failed for TxDL\n"); 590 566 return -ENOMEM; 591 567 } 568 + mem_allocated += PAGE_SIZE; 592 569 } 593 570 while (k < lst_per_page) { 594 571 int l = (j * lst_per_page) + k; ··· 607 582 nic->ufo_in_band_v = kcalloc(size, sizeof(u64), GFP_KERNEL); 608 583 if (!nic->ufo_in_band_v) 609 584 return -ENOMEM; 585 + mem_allocated += (size * sizeof(u64)); 610 586 611 587 /* Allocation and initialization of RXDs in Rings */ 612 588 size = 0; ··· 665 639 rx_blocks->block_virt_addr = tmp_v_addr; 666 640 return -ENOMEM; 667 641 } 642 + mem_allocated += size; 668 643 memset(tmp_v_addr, 0, size); 669 644 rx_blocks->block_virt_addr = tmp_v_addr; 670 645 rx_blocks->block_dma_addr = tmp_p_addr; ··· 674 647 GFP_KERNEL); 675 648 if (!rx_blocks->rxds) 676 649 return -ENOMEM; 650 + mem_allocated += 651 + (sizeof(struct rxd_info)* rxd_count[nic->rxd_mode]); 677 652 for (l=0; l<rxd_count[nic->rxd_mode];l++) { 678 653 rx_blocks->rxds[l].virt_addr = 679 654 rx_blocks->block_virt_addr + ··· 718 689 GFP_KERNEL); 719 690 if (!mac_control->rings[i].ba) 720 691 return -ENOMEM; 692 + mem_allocated +=(sizeof(struct buffAdd *) * blk_cnt); 721 693 for (j = 0; j < blk_cnt; j++) { 722 694 int k = 0; 723 695 mac_control->rings[i].ba[j] = ··· 727 697 GFP_KERNEL); 728 698 if (!mac_control->rings[i].ba[j]) 729 699 return -ENOMEM; 700 + mem_allocated += (sizeof(struct buffAdd) * \ 701 + (rxd_count[nic->rxd_mode] + 1)); 730 702 while (k != rxd_count[nic->rxd_mode]) { 731 703 ba = &mac_control->rings[i].ba[j][k]; 732 704 ··· 736 704 (BUF0_LEN + ALIGN_SIZE, GFP_KERNEL); 737 705 if (!ba->ba_0_org) 738 706 return -ENOMEM; 707 + mem_allocated += 708 + (BUF0_LEN + ALIGN_SIZE); 739 709 tmp = (unsigned long)ba->ba_0_org; 740 710 tmp += ALIGN_SIZE; 741 711 tmp &= ~((unsigned long) ALIGN_SIZE); ··· 747 713 (BUF1_LEN + ALIGN_SIZE, GFP_KERNEL); 748 714 if (!ba->ba_1_org) 749 715 return -ENOMEM; 716 + mem_allocated 717 + += (BUF1_LEN + ALIGN_SIZE); 750 718 tmp = (unsigned long) ba->ba_1_org; 751 719 tmp += ALIGN_SIZE; 752 720 tmp &= ~((unsigned long) ALIGN_SIZE); ··· 772 736 */ 773 737 return -ENOMEM; 774 738 } 739 + mem_allocated += size; 775 740 mac_control->stats_mem_sz = size; 776 741 777 742 tmp_v_addr = mac_control->stats_mem; ··· 780 743 memset(tmp_v_addr, 0, size); 781 744 DBG_PRINT(INIT_DBG, "%s:Ring Mem PHY: 0x%llx\n", dev->name, 782 745 (unsigned long long) tmp_p_addr); 783 - 746 + mac_control->stats_info->sw_stat.mem_allocated += mem_allocated; 784 747 return SUCCESS; 785 748 } 786 749 ··· 794 757 static void free_shared_mem(struct s2io_nic *nic) 795 758 { 796 759 int i, j, blk_cnt, size; 760 + u32 ufo_size = 0; 797 761 void *tmp_v_addr; 798 762 dma_addr_t tmp_p_addr; 799 763 struct mac_info *mac_control; 800 764 struct config_param *config; 801 765 int lst_size, lst_per_page; 802 766 struct net_device *dev = nic->dev; 767 + int page_num = 0; 803 768 804 769 if (!nic) 805 770 return; ··· 813 774 lst_per_page = PAGE_SIZE / lst_size; 814 775 815 776 for (i = 0; i < config->tx_fifo_num; i++) { 816 - int page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len, 817 - lst_per_page); 777 + ufo_size += config->tx_cfg[i].fifo_len; 778 + page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len, 779 + lst_per_page); 818 780 for (j = 0; j < page_num; j++) { 819 781 int mem_blks = (j * lst_per_page); 820 782 if (!mac_control->fifos[i].list_info) ··· 830 790 mac_control->fifos[i]. 831 791 list_info[mem_blks]. 832 792 list_phy_addr); 793 + nic->mac_control.stats_info->sw_stat.mem_freed 794 + += PAGE_SIZE; 833 795 } 834 796 /* If we got a zero DMA address during allocation, 835 797 * free the page now ··· 845 803 dev->name); 846 804 DBG_PRINT(INIT_DBG, "Virtual address %p\n", 847 805 mac_control->zerodma_virt_addr); 806 + nic->mac_control.stats_info->sw_stat.mem_freed 807 + += PAGE_SIZE; 848 808 } 849 809 kfree(mac_control->fifos[i].list_info); 810 + nic->mac_control.stats_info->sw_stat.mem_freed += 811 + (nic->config.tx_cfg[i].fifo_len *sizeof(struct list_info_hold)); 850 812 } 851 813 852 814 size = SIZE_OF_BLOCK; ··· 865 819 break; 866 820 pci_free_consistent(nic->pdev, size, 867 821 tmp_v_addr, tmp_p_addr); 822 + nic->mac_control.stats_info->sw_stat.mem_freed += size; 868 823 kfree(mac_control->rings[i].rx_blocks[j].rxds); 824 + nic->mac_control.stats_info->sw_stat.mem_freed += 825 + ( sizeof(struct rxd_info)* rxd_count[nic->rxd_mode]); 869 826 } 870 827 } 871 828 ··· 885 836 struct buffAdd *ba = 886 837 &mac_control->rings[i].ba[j][k]; 887 838 kfree(ba->ba_0_org); 839 + nic->mac_control.stats_info->sw_stat.\ 840 + mem_freed += (BUF0_LEN + ALIGN_SIZE); 888 841 kfree(ba->ba_1_org); 842 + nic->mac_control.stats_info->sw_stat.\ 843 + mem_freed += (BUF1_LEN + ALIGN_SIZE); 889 844 k++; 890 845 } 891 846 kfree(mac_control->rings[i].ba[j]); 847 + nic->mac_control.stats_info->sw_stat.mem_freed += (sizeof(struct buffAdd) * 848 + (rxd_count[nic->rxd_mode] + 1)); 892 849 } 893 850 kfree(mac_control->rings[i].ba); 851 + nic->mac_control.stats_info->sw_stat.mem_freed += 852 + (sizeof(struct buffAdd *) * blk_cnt); 894 853 } 895 854 } 896 855 ··· 907 850 mac_control->stats_mem_sz, 908 851 mac_control->stats_mem, 909 852 mac_control->stats_mem_phy); 853 + nic->mac_control.stats_info->sw_stat.mem_freed += 854 + mac_control->stats_mem_sz; 910 855 } 911 - if (nic->ufo_in_band_v) 856 + if (nic->ufo_in_band_v) { 912 857 kfree(nic->ufo_in_band_v); 858 + nic->mac_control.stats_info->sw_stat.mem_freed 859 + += (ufo_size * sizeof(u64)); 860 + } 913 861 } 914 862 915 863 /** ··· 2184 2122 2185 2123 for (i = 0; i < config->tx_fifo_num; i++) { 2186 2124 for (j = 0; j < config->tx_cfg[i].fifo_len - 1; j++) { 2187 - txdp = (struct TxD *) mac_control->fifos[i].list_info[j]. 2188 - list_virt_addr; 2125 + txdp = (struct TxD *) \ 2126 + mac_control->fifos[i].list_info[j].list_virt_addr; 2189 2127 skb = s2io_txdl_getskb(&mac_control->fifos[i], txdp, j); 2190 2128 if (skb) { 2129 + nic->mac_control.stats_info->sw_stat.mem_freed 2130 + += skb->truesize; 2191 2131 dev_kfree_skb(skb); 2192 2132 cnt++; 2193 2133 } ··· 2250 2186 /* skb_shinfo(skb)->frag_list will have L4 data payload */ 2251 2187 skb_shinfo(skb)->frag_list = dev_alloc_skb(dev->mtu + ALIGN_SIZE); 2252 2188 if (skb_shinfo(skb)->frag_list == NULL) { 2189 + nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; 2253 2190 DBG_PRINT(INFO_DBG, "%s: dev_alloc_skb failed\n ", dev->name); 2254 2191 return -ENOMEM ; 2255 2192 } 2256 2193 frag_list = skb_shinfo(skb)->frag_list; 2257 2194 skb->truesize += frag_list->truesize; 2195 + nic->mac_control.stats_info->sw_stat.mem_allocated 2196 + += frag_list->truesize; 2258 2197 frag_list->next = NULL; 2259 2198 tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1); 2260 2199 frag_list->data = tmp; ··· 2386 2319 wmb(); 2387 2320 first_rxdp->Control_1 |= RXD_OWN_XENA; 2388 2321 } 2322 + nic->mac_control.stats_info->sw_stat. \ 2323 + mem_alloc_fail_cnt++; 2389 2324 return -ENOMEM ; 2390 2325 } 2326 + nic->mac_control.stats_info->sw_stat.mem_allocated 2327 + += skb->truesize; 2391 2328 if (nic->rxd_mode == RXD_MODE_1) { 2392 2329 /* 1 buffer mode - normal operation mode */ 2393 2330 memset(rxdp, 0, sizeof(struct RxD1)); ··· 2399 2328 ((struct RxD1*)rxdp)->Buffer0_ptr = pci_map_single 2400 2329 (nic->pdev, skb->data, size - NET_IP_ALIGN, 2401 2330 PCI_DMA_FROMDEVICE); 2402 - rxdp->Control_2 = SET_BUFFER0_SIZE_1(size - NET_IP_ALIGN); 2331 + rxdp->Control_2 = 2332 + SET_BUFFER0_SIZE_1(size - NET_IP_ALIGN); 2403 2333 2404 2334 } else if (nic->rxd_mode >= RXD_MODE_3A) { 2405 2335 /* ··· 2414 2342 * payload 2415 2343 */ 2416 2344 2417 - /* save the buffer pointers to avoid frequent dma mapping */ 2345 + /* save buffer pointers to avoid frequent dma mapping */ 2418 2346 Buffer0_ptr = ((struct RxD3*)rxdp)->Buffer0_ptr; 2419 2347 Buffer1_ptr = ((struct RxD3*)rxdp)->Buffer1_ptr; 2420 2348 memset(rxdp, 0, sizeof(struct RxD3)); ··· 2436 2364 PCI_DMA_FROMDEVICE); 2437 2365 else 2438 2366 pci_dma_sync_single_for_device(nic->pdev, 2439 - (dma_addr_t) ((struct RxD3*)rxdp)->Buffer0_ptr, 2367 + (dma_addr_t) ((struct RxD3*)rxdp)->Buffer0_ptr, 2440 2368 BUF0_LEN, PCI_DMA_FROMDEVICE); 2441 2369 rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN); 2442 2370 if (nic->rxd_mode == RXD_MODE_3B) { ··· 2463 2391 } else { 2464 2392 /* 3 buffer mode */ 2465 2393 if (fill_rxd_3buf(nic, rxdp, skb) == -ENOMEM) { 2394 + nic->mac_control.stats_info->sw_stat.\ 2395 + mem_freed += skb->truesize; 2466 2396 dev_kfree_skb_irq(skb); 2467 2397 if (first_rxdp) { 2468 2398 wmb(); ··· 2565 2491 PCI_DMA_FROMDEVICE); 2566 2492 memset(rxdp, 0, sizeof(struct RxD3)); 2567 2493 } 2494 + sp->mac_control.stats_info->sw_stat.mem_freed += skb->truesize; 2568 2495 dev_kfree_skb(skb); 2569 2496 atomic_dec(&sp->rx_bufs_left[ring_no]); 2570 2497 } ··· 2895 2820 nic->mac_control.stats_info->sw_stat. 2896 2821 parity_err_cnt++; 2897 2822 } 2898 - if ((err >> 48) == 0xA) { 2899 - DBG_PRINT(TX_DBG, "TxD returned due \ 2900 - to loss of link\n"); 2901 - } 2902 - else { 2903 - DBG_PRINT(ERR_DBG, "***TxD error %llx\n", err); 2904 - } 2823 + 2824 + /* update t_code statistics */ 2825 + err >>= 48; 2826 + switch(err) { 2827 + case 2: 2828 + nic->mac_control.stats_info->sw_stat. 2829 + tx_buf_abort_cnt++; 2830 + break; 2831 + 2832 + case 3: 2833 + nic->mac_control.stats_info->sw_stat. 2834 + tx_desc_abort_cnt++; 2835 + break; 2836 + 2837 + case 7: 2838 + nic->mac_control.stats_info->sw_stat. 2839 + tx_parity_err_cnt++; 2840 + break; 2841 + 2842 + case 10: 2843 + nic->mac_control.stats_info->sw_stat. 2844 + tx_link_loss_cnt++; 2845 + break; 2846 + 2847 + case 15: 2848 + nic->mac_control.stats_info->sw_stat. 2849 + tx_list_proc_err_cnt++; 2850 + break; 2851 + } 2905 2852 } 2906 2853 2907 2854 skb = s2io_txdl_getskb(fifo_data, txdlp, get_info.offset); ··· 2936 2839 2937 2840 /* Updating the statistics block */ 2938 2841 nic->stats.tx_bytes += skb->len; 2842 + nic->mac_control.stats_info->sw_stat.mem_freed += skb->truesize; 2939 2843 dev_kfree_skb_irq(skb); 2940 2844 2941 2845 get_info.offset++; ··· 3412 3314 u16 subid, pci_cmd; 3413 3315 int i; 3414 3316 u16 val16; 3415 - unsigned long long reset_cnt = 0; 3317 + unsigned long long up_cnt, down_cnt, up_time, down_time, reset_cnt; 3318 + unsigned long long mem_alloc_cnt, mem_free_cnt, watchdog_cnt; 3319 + 3416 3320 DBG_PRINT(INIT_DBG,"%s - Resetting XFrame card %s\n", 3417 3321 __FUNCTION__, sp->dev->name); 3418 3322 ··· 3480 3380 3481 3381 /* Reset device statistics maintained by OS */ 3482 3382 memset(&sp->stats, 0, sizeof (struct net_device_stats)); 3483 - /* save reset count */ 3383 + 3384 + up_cnt = sp->mac_control.stats_info->sw_stat.link_up_cnt; 3385 + down_cnt = sp->mac_control.stats_info->sw_stat.link_down_cnt; 3386 + up_time = sp->mac_control.stats_info->sw_stat.link_up_time; 3387 + down_time = sp->mac_control.stats_info->sw_stat.link_down_time; 3484 3388 reset_cnt = sp->mac_control.stats_info->sw_stat.soft_reset_cnt; 3389 + mem_alloc_cnt = sp->mac_control.stats_info->sw_stat.mem_allocated; 3390 + mem_free_cnt = sp->mac_control.stats_info->sw_stat.mem_freed; 3391 + watchdog_cnt = sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt; 3392 + /* save link up/down time/cnt, reset/memory/watchdog cnt */ 3485 3393 memset(sp->mac_control.stats_info, 0, sizeof(struct stat_block)); 3486 - /* restore reset count */ 3394 + /* restore link up/down time/cnt, reset/memory/watchdog cnt */ 3395 + sp->mac_control.stats_info->sw_stat.link_up_cnt = up_cnt; 3396 + sp->mac_control.stats_info->sw_stat.link_down_cnt = down_cnt; 3397 + sp->mac_control.stats_info->sw_stat.link_up_time = up_time; 3398 + sp->mac_control.stats_info->sw_stat.link_down_time = down_time; 3487 3399 sp->mac_control.stats_info->sw_stat.soft_reset_cnt = reset_cnt; 3400 + sp->mac_control.stats_info->sw_stat.mem_allocated = mem_alloc_cnt; 3401 + sp->mac_control.stats_info->sw_stat.mem_freed = mem_free_cnt; 3402 + sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt = watchdog_cnt; 3488 3403 3489 3404 /* SXE-002: Configure link and activity LED to turn it off */ 3490 3405 subid = sp->pdev->subsystem_device; ··· 3787 3672 nic->entries = kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct msix_entry), 3788 3673 GFP_KERNEL); 3789 3674 if (nic->entries == NULL) { 3790 - DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", __FUNCTION__); 3675 + DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", \ 3676 + __FUNCTION__); 3677 + nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; 3791 3678 return -ENOMEM; 3792 3679 } 3793 - memset(nic->entries, 0, MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); 3680 + nic->mac_control.stats_info->sw_stat.mem_allocated 3681 + += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); 3682 + memset(nic->entries, 0,MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); 3794 3683 3795 3684 nic->s2io_entries = 3796 3685 kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry), 3797 3686 GFP_KERNEL); 3798 3687 if (nic->s2io_entries == NULL) { 3799 - DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", __FUNCTION__); 3688 + DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", 3689 + __FUNCTION__); 3690 + nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; 3800 3691 kfree(nic->entries); 3692 + nic->mac_control.stats_info->sw_stat.mem_freed 3693 + += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); 3801 3694 return -ENOMEM; 3802 3695 } 3696 + nic->mac_control.stats_info->sw_stat.mem_allocated 3697 + += (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); 3803 3698 memset(nic->s2io_entries, 0, 3804 3699 MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); 3805 3700 ··· 3833 3708 rx_mat = readq(&bar0->rx_mat); 3834 3709 for (j=0; j<nic->config.rx_ring_num; j++, msix_indx++) { 3835 3710 rx_mat |= RX_MAT_SET(j, msix_indx); 3836 - nic->s2io_entries[msix_indx].arg = &nic->mac_control.rings[j]; 3711 + nic->s2io_entries[msix_indx].arg 3712 + = &nic->mac_control.rings[j]; 3837 3713 nic->s2io_entries[msix_indx].type = MSIX_RING_TYPE; 3838 3714 nic->s2io_entries[msix_indx].in_use = MSIX_FLG; 3839 3715 } ··· 3843 3717 tx_mat = readq(&bar0->tx_mat0_n[7]); 3844 3718 for (j=0; j<nic->config.rx_ring_num; j++, msix_indx++) { 3845 3719 tx_mat |= TX_MAT_SET(i, msix_indx); 3846 - nic->s2io_entries[msix_indx].arg = &nic->mac_control.rings[j]; 3720 + nic->s2io_entries[msix_indx].arg 3721 + = &nic->mac_control.rings[j]; 3847 3722 nic->s2io_entries[msix_indx].type = MSIX_RING_TYPE; 3848 3723 nic->s2io_entries[msix_indx].in_use = MSIX_FLG; 3849 3724 } ··· 3861 3734 if (ret) { 3862 3735 DBG_PRINT(ERR_DBG, "%s: Enabling MSIX failed\n", nic->dev->name); 3863 3736 kfree(nic->entries); 3737 + nic->mac_control.stats_info->sw_stat.mem_freed 3738 + += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); 3864 3739 kfree(nic->s2io_entries); 3740 + nic->mac_control.stats_info->sw_stat.mem_freed 3741 + += (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); 3865 3742 nic->entries = NULL; 3866 3743 nic->s2io_entries = NULL; 3867 3744 nic->avail_msix_vectors = 0; ··· 3933 3802 3934 3803 hw_init_failed: 3935 3804 if (sp->intr_type == MSI_X) { 3936 - if (sp->entries) 3805 + if (sp->entries) { 3937 3806 kfree(sp->entries); 3938 - if (sp->s2io_entries) 3807 + sp->mac_control.stats_info->sw_stat.mem_freed 3808 + += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); 3809 + } 3810 + if (sp->s2io_entries) { 3939 3811 kfree(sp->s2io_entries); 3812 + sp->mac_control.stats_info->sw_stat.mem_freed 3813 + += (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); 3814 + } 3940 3815 } 3941 3816 return err; 3942 3817 } ··· 4003 3866 config = &sp->config; 4004 3867 4005 3868 DBG_PRINT(TX_DBG, "%s: In Neterion Tx routine\n", dev->name); 3869 + 3870 + if (unlikely(skb->len <= 0)) { 3871 + DBG_PRINT(TX_DBG, "%s:Buffer has no data..\n", dev->name); 3872 + dev_kfree_skb_any(skb); 3873 + return 0; 3874 + } 3875 + 4006 3876 spin_lock_irqsave(&sp->tx_lock, flags); 4007 3877 if (atomic_read(&sp->card_state) == CARD_DOWN) { 4008 3878 DBG_PRINT(TX_DBG, "%s: Card going down for reset\n", ··· 4020 3876 } 4021 3877 4022 3878 queue = 0; 4023 - 4024 3879 /* Get Fifo number to Transmit based on vlan priority */ 4025 3880 if (sp->vlgrp && vlan_tx_tag_present(skb)) { 4026 3881 vlan_tag = vlan_tx_tag_get(skb); ··· 4038 3895 ((put_off+1) == queue_len ? 0 : (put_off+1)) == get_off) { 4039 3896 DBG_PRINT(TX_DBG, "Error in xmit, No free TXDs.\n"); 4040 3897 netif_stop_queue(dev); 4041 - dev_kfree_skb(skb); 4042 - spin_unlock_irqrestore(&sp->tx_lock, flags); 4043 - return 0; 4044 - } 4045 - 4046 - /* A buffer with no data will be dropped */ 4047 - if (!skb->len) { 4048 - DBG_PRINT(TX_DBG, "%s:Buffer has no data..\n", dev->name); 4049 3898 dev_kfree_skb(skb); 4050 3899 spin_unlock_irqrestore(&sp->tx_lock, flags); 4051 3900 return 0; ··· 4138 4003 put_off, get_off); 4139 4004 netif_stop_queue(dev); 4140 4005 } 4141 - 4006 + mac_control->stats_info->sw_stat.mem_allocated += skb->truesize; 4142 4007 dev->trans_start = jiffies; 4143 4008 spin_unlock_irqrestore(&sp->tx_lock, flags); 4144 4009 ··· 4910 4775 return 0; 4911 4776 } 4912 4777 4778 + static void s2io_ethtool_gringparam(struct net_device *dev, 4779 + struct ethtool_ringparam *ering) 4780 + { 4781 + struct s2io_nic *sp = dev->priv; 4782 + int i,tx_desc_count=0,rx_desc_count=0; 4783 + 4784 + if (sp->rxd_mode == RXD_MODE_1) 4785 + ering->rx_max_pending = MAX_RX_DESC_1; 4786 + else if (sp->rxd_mode == RXD_MODE_3B) 4787 + ering->rx_max_pending = MAX_RX_DESC_2; 4788 + else if (sp->rxd_mode == RXD_MODE_3A) 4789 + ering->rx_max_pending = MAX_RX_DESC_3; 4790 + 4791 + ering->tx_max_pending = MAX_TX_DESC; 4792 + for (i = 0 ; i < sp->config.tx_fifo_num ; i++) { 4793 + tx_desc_count += sp->config.tx_cfg[i].fifo_len; 4794 + } 4795 + DBG_PRINT(INFO_DBG,"\nmax txds : %d\n",sp->config.max_txds); 4796 + ering->tx_pending = tx_desc_count; 4797 + rx_desc_count = 0; 4798 + for (i = 0 ; i < sp->config.rx_ring_num ; i++) { 4799 + rx_desc_count += sp->config.rx_cfg[i].num_rxd; 4800 + } 4801 + ering->rx_pending = rx_desc_count; 4802 + 4803 + ering->rx_mini_max_pending = 0; 4804 + ering->rx_mini_pending = 0; 4805 + if(sp->rxd_mode == RXD_MODE_1) 4806 + ering->rx_jumbo_max_pending = MAX_RX_DESC_1; 4807 + else if (sp->rxd_mode == RXD_MODE_3B) 4808 + ering->rx_jumbo_max_pending = MAX_RX_DESC_2; 4809 + ering->rx_jumbo_pending = rx_desc_count; 4810 + } 4811 + 4913 4812 /** 4914 4813 * s2io_ethtool_getpause_data -Pause frame frame generation and reception. 4915 4814 * @sp : private member of the device structure, which is a pointer to the ··· 5150 4981 strcpy(nic->serial_num, "NOT AVAILABLE"); 5151 4982 5152 4983 vpd_data = kmalloc(256, GFP_KERNEL); 5153 - if (!vpd_data) 4984 + if (!vpd_data) { 4985 + nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; 5154 4986 return; 4987 + } 4988 + nic->mac_control.stats_info->sw_stat.mem_allocated += 256; 5155 4989 5156 4990 for (i = 0; i < 256; i +=4 ) { 5157 4991 pci_write_config_byte(nic->pdev, (vpd_addr + 2), i); ··· 5194 5022 memcpy(nic->product_name, &vpd_data[3], vpd_data[1]); 5195 5023 } 5196 5024 kfree(vpd_data); 5025 + nic->mac_control.stats_info->sw_stat.mem_freed += 256; 5197 5026 } 5198 5027 5199 5028 /** ··· 5915 5742 } 5916 5743 else 5917 5744 tmp_stats[i++] = 0; 5745 + tmp_stats[i++] = stat_info->sw_stat.mem_alloc_fail_cnt; 5746 + tmp_stats[i++] = stat_info->sw_stat.watchdog_timer_cnt; 5747 + tmp_stats[i++] = stat_info->sw_stat.mem_allocated; 5748 + tmp_stats[i++] = stat_info->sw_stat.mem_freed; 5749 + tmp_stats[i++] = stat_info->sw_stat.link_up_cnt; 5750 + tmp_stats[i++] = stat_info->sw_stat.link_down_cnt; 5751 + tmp_stats[i++] = stat_info->sw_stat.link_up_time; 5752 + tmp_stats[i++] = stat_info->sw_stat.link_down_time; 5753 + 5754 + tmp_stats[i++] = stat_info->sw_stat.tx_buf_abort_cnt; 5755 + tmp_stats[i++] = stat_info->sw_stat.tx_desc_abort_cnt; 5756 + tmp_stats[i++] = stat_info->sw_stat.tx_parity_err_cnt; 5757 + tmp_stats[i++] = stat_info->sw_stat.tx_link_loss_cnt; 5758 + tmp_stats[i++] = stat_info->sw_stat.tx_list_proc_err_cnt; 5759 + 5760 + tmp_stats[i++] = stat_info->sw_stat.rx_parity_err_cnt; 5761 + tmp_stats[i++] = stat_info->sw_stat.rx_abort_cnt; 5762 + tmp_stats[i++] = stat_info->sw_stat.rx_parity_abort_cnt; 5763 + tmp_stats[i++] = stat_info->sw_stat.rx_rda_fail_cnt; 5764 + tmp_stats[i++] = stat_info->sw_stat.rx_unkn_prot_cnt; 5765 + tmp_stats[i++] = stat_info->sw_stat.rx_fcs_err_cnt; 5766 + tmp_stats[i++] = stat_info->sw_stat.rx_buf_size_err_cnt; 5767 + tmp_stats[i++] = stat_info->sw_stat.rx_rxd_corrupt_cnt; 5768 + tmp_stats[i++] = stat_info->sw_stat.rx_unkn_err_cnt; 5918 5769 } 5919 5770 5920 5771 static int s2io_ethtool_get_regs_len(struct net_device *dev) ··· 6051 5854 .get_eeprom_len = s2io_get_eeprom_len, 6052 5855 .get_eeprom = s2io_ethtool_geeprom, 6053 5856 .set_eeprom = s2io_ethtool_seeprom, 5857 + .get_ringparam = s2io_ethtool_gringparam, 6054 5858 .get_pauseparam = s2io_ethtool_getpause_data, 6055 5859 .set_pauseparam = s2io_ethtool_setpause_data, 6056 5860 .get_rx_csum = s2io_ethtool_get_rx_csum, ··· 6160 5962 if (ret == -ENOMEM) { 6161 5963 DBG_PRINT(INFO_DBG, "%s: Out of ", 6162 5964 dev->name); 6163 - DBG_PRINT(ERR_DBG, "memory in tasklet\n"); 5965 + DBG_PRINT(INFO_DBG, "memory in tasklet\n"); 6164 5966 break; 6165 5967 } else if (ret == -EFILL) { 6166 5968 DBG_PRINT(INFO_DBG, ··· 6275 6077 *skb = dev_alloc_skb(size); 6276 6078 if (!(*skb)) { 6277 6079 DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name); 6278 - DBG_PRINT(INFO_DBG, "memory to allocate SKBs\n"); 6080 + DBG_PRINT(INFO_DBG, "memory to allocate "); 6081 + DBG_PRINT(INFO_DBG, "1 buf mode SKBs\n"); 6082 + sp->mac_control.stats_info->sw_stat. \ 6083 + mem_alloc_fail_cnt++; 6279 6084 return -ENOMEM ; 6280 6085 } 6086 + sp->mac_control.stats_info->sw_stat.mem_allocated 6087 + += (*skb)->truesize; 6281 6088 /* storing the mapped addr in a temp variable 6282 6089 * such it will be used for next rxd whose 6283 6090 * Host Control is NULL ··· 6302 6099 } else { 6303 6100 *skb = dev_alloc_skb(size); 6304 6101 if (!(*skb)) { 6305 - DBG_PRINT(INFO_DBG, "%s: dev_alloc_skb failed\n", 6306 - dev->name); 6102 + DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name); 6103 + DBG_PRINT(INFO_DBG, "memory to allocate "); 6104 + DBG_PRINT(INFO_DBG, "2 buf mode SKBs\n"); 6105 + sp->mac_control.stats_info->sw_stat. \ 6106 + mem_alloc_fail_cnt++; 6307 6107 return -ENOMEM; 6308 6108 } 6109 + sp->mac_control.stats_info->sw_stat.mem_allocated 6110 + += (*skb)->truesize; 6309 6111 ((struct RxD3*)rxdp)->Buffer2_ptr = *temp2 = 6310 6112 pci_map_single(sp->pdev, (*skb)->data, 6311 6113 dev->mtu + 4, ··· 6334 6126 } else { 6335 6127 *skb = dev_alloc_skb(size); 6336 6128 if (!(*skb)) { 6337 - DBG_PRINT(INFO_DBG, "%s: dev_alloc_skb failed\n", 6338 - dev->name); 6129 + DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name); 6130 + DBG_PRINT(INFO_DBG, "memory to allocate "); 6131 + DBG_PRINT(INFO_DBG, "3 buf mode SKBs\n"); 6132 + sp->mac_control.stats_info->sw_stat. \ 6133 + mem_alloc_fail_cnt++; 6339 6134 return -ENOMEM; 6340 6135 } 6136 + sp->mac_control.stats_info->sw_stat.mem_allocated 6137 + += (*skb)->truesize; 6341 6138 ((struct RxD3*)rxdp)->Buffer0_ptr = *temp0 = 6342 6139 pci_map_single(sp->pdev, ba->ba_0, BUF0_LEN, 6343 6140 PCI_DMA_FROMDEVICE); ··· 6360 6147 if (skb_shinfo(*skb)->frag_list == NULL) { 6361 6148 DBG_PRINT(ERR_DBG, "%s: dev_alloc_skb \ 6362 6149 failed\n ", dev->name); 6150 + sp->mac_control.stats_info->sw_stat. \ 6151 + mem_alloc_fail_cnt++; 6363 6152 return -ENOMEM ; 6364 6153 } 6365 6154 frag_list = skb_shinfo(*skb)->frag_list; 6366 6155 frag_list->next = NULL; 6156 + sp->mac_control.stats_info->sw_stat.mem_allocated 6157 + += frag_list->truesize; 6367 6158 /* 6368 6159 * Buffer-2 receives L4 data payload 6369 6160 */ ··· 6783 6566 struct s2io_nic *sp = dev->priv; 6784 6567 6785 6568 if (netif_carrier_ok(dev)) { 6569 + sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt++; 6786 6570 schedule_work(&sp->rst_timer_task); 6787 6571 sp->mac_control.stats_info->sw_stat.soft_reset_cnt++; 6788 6572 } ··· 6824 6606 if (err & 0x1) { 6825 6607 sp->mac_control.stats_info->sw_stat.parity_err_cnt++; 6826 6608 } 6609 + err >>= 48; 6610 + switch(err) { 6611 + case 1: 6612 + sp->mac_control.stats_info->sw_stat. 6613 + rx_parity_err_cnt++; 6614 + break; 6827 6615 6616 + case 2: 6617 + sp->mac_control.stats_info->sw_stat. 6618 + rx_abort_cnt++; 6619 + break; 6620 + 6621 + case 3: 6622 + sp->mac_control.stats_info->sw_stat. 6623 + rx_parity_abort_cnt++; 6624 + break; 6625 + 6626 + case 4: 6627 + sp->mac_control.stats_info->sw_stat. 6628 + rx_rda_fail_cnt++; 6629 + break; 6630 + 6631 + case 5: 6632 + sp->mac_control.stats_info->sw_stat. 6633 + rx_unkn_prot_cnt++; 6634 + break; 6635 + 6636 + case 6: 6637 + sp->mac_control.stats_info->sw_stat. 6638 + rx_fcs_err_cnt++; 6639 + break; 6640 + 6641 + case 7: 6642 + sp->mac_control.stats_info->sw_stat. 6643 + rx_buf_size_err_cnt++; 6644 + break; 6645 + 6646 + case 8: 6647 + sp->mac_control.stats_info->sw_stat. 6648 + rx_rxd_corrupt_cnt++; 6649 + break; 6650 + 6651 + case 15: 6652 + sp->mac_control.stats_info->sw_stat. 6653 + rx_unkn_err_cnt++; 6654 + break; 6655 + } 6828 6656 /* 6829 6657 * Drop the packet if bad transfer code. Exception being 6830 6658 * 0x5, which could be due to unsupported IPv6 extension header. ··· 6878 6614 * Note that in this case, since checksum will be incorrect, 6879 6615 * stack will validate the same. 6880 6616 */ 6881 - if (err && ((err >> 48) != 0x5)) { 6617 + if (err != 0x5) { 6882 6618 DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%llx\n", 6883 6619 dev->name, err); 6884 6620 sp->stats.rx_crc_errors++; 6621 + sp->mac_control.stats_info->sw_stat.mem_freed 6622 + += skb->truesize; 6885 6623 dev_kfree_skb(skb); 6886 6624 atomic_dec(&sp->rx_bufs_left[ring_no]); 6887 6625 rxdp->Host_Control = 0; ··· 6893 6627 6894 6628 /* Updating statistics */ 6895 6629 rxdp->Host_Control = 0; 6896 - sp->stats.rx_packets++; 6897 6630 if (sp->rxd_mode == RXD_MODE_1) { 6898 6631 int len = RXD_GET_BUFFER0_SIZE_1(rxdp->Control_2); 6899 6632 ··· 6996 6731 } else { 6997 6732 skb->ip_summed = CHECKSUM_NONE; 6998 6733 } 6999 - 6734 + sp->mac_control.stats_info->sw_stat.mem_freed += skb->truesize; 7000 6735 if (!sp->lro) { 7001 6736 skb->protocol = eth_type_trans(skb, dev); 7002 6737 if ((sp->vlgrp && RXD_GET_VLAN_TAG(rxdp->Control_2) && ··· 7045 6780 if (link == LINK_DOWN) { 7046 6781 DBG_PRINT(ERR_DBG, "%s: Link down\n", dev->name); 7047 6782 netif_carrier_off(dev); 6783 + if(sp->mac_control.stats_info->sw_stat.link_up_cnt) 6784 + sp->mac_control.stats_info->sw_stat.link_up_time = 6785 + jiffies - sp->start_time; 6786 + sp->mac_control.stats_info->sw_stat.link_down_cnt++; 7048 6787 } else { 7049 6788 DBG_PRINT(ERR_DBG, "%s: Link Up\n", dev->name); 6789 + if (sp->mac_control.stats_info->sw_stat.link_down_cnt) 6790 + sp->mac_control.stats_info->sw_stat.link_down_time = 6791 + jiffies - sp->start_time; 6792 + sp->mac_control.stats_info->sw_stat.link_up_cnt++; 7050 6793 netif_carrier_on(dev); 7051 6794 } 7052 6795 } 7053 6796 sp->last_link_state = link; 6797 + sp->start_time = jiffies; 7054 6798 } 7055 6799 7056 6800 /**
+32
drivers/net/s2io.h
··· 95 95 unsigned long long flush_max_pkts; 96 96 unsigned long long sum_avg_pkts_aggregated; 97 97 unsigned long long num_aggregations; 98 + /* Other statistics */ 99 + unsigned long long mem_alloc_fail_cnt; 100 + unsigned long long watchdog_timer_cnt; 101 + unsigned long long mem_allocated; 102 + unsigned long long mem_freed; 103 + unsigned long long link_up_cnt; 104 + unsigned long long link_down_cnt; 105 + unsigned long long link_up_time; 106 + unsigned long long link_down_time; 107 + 108 + /* Transfer Code statistics */ 109 + unsigned long long tx_buf_abort_cnt; 110 + unsigned long long tx_desc_abort_cnt; 111 + unsigned long long tx_parity_err_cnt; 112 + unsigned long long tx_link_loss_cnt; 113 + unsigned long long tx_list_proc_err_cnt; 114 + 115 + unsigned long long rx_parity_err_cnt; 116 + unsigned long long rx_abort_cnt; 117 + unsigned long long rx_parity_abort_cnt; 118 + unsigned long long rx_rda_fail_cnt; 119 + unsigned long long rx_unkn_prot_cnt; 120 + unsigned long long rx_fcs_err_cnt; 121 + unsigned long long rx_buf_size_err_cnt; 122 + unsigned long long rx_rxd_corrupt_cnt; 123 + unsigned long long rx_unkn_err_cnt; 98 124 }; 99 125 100 126 /* Xpak releated alarm and warnings */ ··· 333 307 334 308 #define MAX_TX_FIFOS 8 335 309 #define MAX_RX_RINGS 8 310 + 311 + #define MAX_RX_DESC_1 (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 127 ) 312 + #define MAX_RX_DESC_2 (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 85 ) 313 + #define MAX_RX_DESC_3 (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 85 ) 314 + #define MAX_TX_DESC (MAX_AVAILABLE_TXDS) 336 315 337 316 /* FIFO mappings for all possible number of fifos configured */ 338 317 static int fifo_map[][MAX_TX_FIFOS] = { ··· 850 819 #define LINK_UP 2 851 820 852 821 int task_flag; 822 + unsigned long long start_time; 853 823 #define CARD_DOWN 1 854 824 #define CARD_UP 2 855 825 atomic_t card_state;
+9
drivers/net/skge.c
··· 3802 3802 struct skge_hw *hw = pci_get_drvdata(pdev); 3803 3803 int i, err, wol = 0; 3804 3804 3805 + if (!hw) 3806 + return 0; 3807 + 3805 3808 err = pci_save_state(pdev); 3806 3809 if (err) 3807 3810 return err; ··· 3832 3829 { 3833 3830 struct skge_hw *hw = pci_get_drvdata(pdev); 3834 3831 int i, err; 3832 + 3833 + if (!hw) 3834 + return 0; 3835 3835 3836 3836 err = pci_set_power_state(pdev, PCI_D0); 3837 3837 if (err) ··· 3873 3867 { 3874 3868 struct skge_hw *hw = pci_get_drvdata(pdev); 3875 3869 int i, wol = 0; 3870 + 3871 + if (!hw) 3872 + return; 3876 3873 3877 3874 for (i = 0; i < hw->ports; i++) { 3878 3875 struct net_device *dev = hw->dev[i];
+41 -12
drivers/net/sky2.c
··· 40 40 #include <linux/if_vlan.h> 41 41 #include <linux/prefetch.h> 42 42 #include <linux/mii.h> 43 + #include <linux/dmi.h> 43 44 44 45 #include <asm/irq.h> 45 46 ··· 131 130 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */ 132 131 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4369) }, /* 88EC042 */ 133 132 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436A) }, /* 88E8058 */ 134 - { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436B) }, /* 88E8071 */ 133 + // { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436B) }, /* 88E8071 */ 135 134 { 0 } 136 135 }; 137 136 ··· 150 149 "EC", /* 0xb6 */ 151 150 "FE", /* 0xb7 */ 152 151 }; 152 + 153 + static int dmi_blacklisted; 153 154 154 155 /* Access to external PHY */ 155 156 static int gm_phy_write(struct sky2_hw *hw, unsigned port, u16 reg, u16 val) ··· 2534 2531 return -EOPNOTSUPP; 2535 2532 } 2536 2533 2534 + 2535 + /* Some Gigabyte motherboards have 88e8056 but cause problems 2536 + * There is some unresolved hardware related problem that causes 2537 + * descriptor errors and receive data corruption. 2538 + */ 2539 + if (hw->chip_id == CHIP_ID_YUKON_EC_U && dmi_blacklisted) { 2540 + dev_err(&hw->pdev->dev, 2541 + "88E8056 on this motherboard not supported\n"); 2542 + return -EOPNOTSUPP; 2543 + } 2544 + 2537 2545 hw->pmd_type = sky2_read8(hw, B2_PMD_TYP); 2538 2546 hw->ports = 1; 2539 2547 t8 = sky2_read8(hw, B2_Y2_HW_RES); ··· 3592 3578 goto err_out; 3593 3579 } 3594 3580 3595 - /* Some Gigabyte motherboards have 88e8056 but cause problems 3596 - * There is some unresolved hardware related problem that causes 3597 - * descriptor errors and receive data corruption. 3598 - */ 3599 - if (pdev->vendor == PCI_VENDOR_ID_MARVELL && 3600 - pdev->device == 0x4364 && pdev->subsystem_vendor == 0x1458) { 3601 - dev_err(&pdev->dev, 3602 - "88E8056 on Gigabyte motherboards not supported\n"); 3603 - goto err_out_disable; 3604 - } 3605 - 3606 3581 err = pci_request_regions(pdev, DRV_NAME); 3607 3582 if (err) { 3608 3583 dev_err(&pdev->dev, "cannot obtain PCI resources\n"); ··· 3735 3732 err_out_disable: 3736 3733 pci_disable_device(pdev); 3737 3734 err_out: 3735 + pci_set_drvdata(pdev, NULL); 3738 3736 return err; 3739 3737 } 3740 3738 ··· 3788 3784 struct sky2_hw *hw = pci_get_drvdata(pdev); 3789 3785 int i, wol = 0; 3790 3786 3787 + if (!hw) 3788 + return 0; 3789 + 3791 3790 del_timer_sync(&hw->idle_timer); 3792 3791 netif_poll_disable(hw->dev[0]); 3793 3792 ··· 3821 3814 { 3822 3815 struct sky2_hw *hw = pci_get_drvdata(pdev); 3823 3816 int i, err; 3817 + 3818 + if (!hw) 3819 + return 0; 3824 3820 3825 3821 err = pci_set_power_state(pdev, PCI_D0); 3826 3822 if (err) ··· 3871 3861 struct sky2_hw *hw = pci_get_drvdata(pdev); 3872 3862 int i, wol = 0; 3873 3863 3864 + if (!hw) 3865 + return; 3866 + 3874 3867 del_timer_sync(&hw->idle_timer); 3875 3868 netif_poll_disable(hw->dev[0]); 3876 3869 ··· 3910 3897 .shutdown = sky2_shutdown, 3911 3898 }; 3912 3899 3900 + static struct dmi_system_id __initdata broken_dmi_table[] = { 3901 + { 3902 + .ident = "Gigabyte 965P-S3", 3903 + .matches = { 3904 + DMI_MATCH(DMI_SYS_VENDOR, "Gigabyte Technology Co., Ltd."), 3905 + DMI_MATCH(DMI_PRODUCT_NAME, "965P-S3"), 3906 + 3907 + }, 3908 + }, 3909 + { } 3910 + }; 3911 + 3913 3912 static int __init sky2_init_module(void) 3914 3913 { 3914 + /* Look for sick motherboards */ 3915 + if (dmi_check_system(broken_dmi_table)) 3916 + dmi_blacklisted = 1; 3917 + 3915 3918 return pci_register_driver(&sky2_driver); 3916 3919 } 3917 3920
+3 -5
drivers/net/spider_net.c
··· 175 175 { 176 176 struct mii_phy *phy = &card->phy; 177 177 u32 advertise = 0; 178 - u16 bmcr, bmsr, stat1000, estat; 178 + u16 bmsr, estat; 179 179 180 - bmcr = spider_net_read_phy(card->netdev, phy->mii_id, MII_BMCR); 181 - bmsr = spider_net_read_phy(card->netdev, phy->mii_id, MII_BMSR); 182 - stat1000 = spider_net_read_phy(card->netdev, phy->mii_id, MII_STAT1000); 183 - estat = spider_net_read_phy(card->netdev, phy->mii_id, MII_ESTATUS); 180 + bmsr = spider_net_read_phy(card->netdev, phy->mii_id, MII_BMSR); 181 + estat = spider_net_read_phy(card->netdev, phy->mii_id, MII_ESTATUS); 184 182 185 183 if (bmsr & BMSR_10HALF) 186 184 advertise |= ADVERTISED_10baseT_Half;
+15 -19
drivers/net/wan/Kconfig
··· 2 2 # wan devices configuration 3 3 # 4 4 5 - menu "Wan interfaces" 6 - depends on NETDEVICES 7 - 8 - config WAN 5 + menuconfig WAN 9 6 bool "Wan interfaces support" 10 7 ---help--- 11 8 Wide Area Networks (WANs), such as X.25, Frame Relay and leased ··· 20 23 21 24 If unsure, say N. 22 25 26 + if WAN 27 + 23 28 # There is no way to detect a comtrol sv11 - force it modular for now. 24 29 config HOSTESS_SV11 25 30 tristate "Comtrol Hostess SV-11 support" 26 - depends on WAN && ISA && m && ISA_DMA_API && INET 31 + depends on ISA && m && ISA_DMA_API && INET 27 32 help 28 33 Driver for Comtrol Hostess SV-11 network card which 29 34 operates on low speed synchronous serial links at up to ··· 37 38 # The COSA/SRP driver has not been tested as non-modular yet. 38 39 config COSA 39 40 tristate "COSA/SRP sync serial boards support" 40 - depends on WAN && ISA && m && ISA_DMA_API 41 + depends on ISA && m && ISA_DMA_API 41 42 ---help--- 42 43 Driver for COSA and SRP synchronous serial boards. 43 44 ··· 61 62 # 62 63 config LANMEDIA 63 64 tristate "LanMedia Corp. SSI/V.35, T1/E1, HSSI, T3 boards" 64 - depends on WAN && PCI 65 + depends on PCI 65 66 ---help--- 66 67 Driver for the following Lan Media family of serial boards: 67 68 ··· 88 89 # There is no way to detect a Sealevel board. Force it modular 89 90 config SEALEVEL_4021 90 91 tristate "Sealevel Systems 4021 support" 91 - depends on WAN && ISA && m && ISA_DMA_API && INET 92 + depends on ISA && m && ISA_DMA_API && INET 92 93 help 93 94 This is a driver for the Sealevel Systems ACB 56 serial I/O adapter. 94 95 ··· 98 99 # Generic HDLC 99 100 config HDLC 100 101 tristate "Generic HDLC layer" 101 - depends on WAN 102 102 help 103 103 Say Y to this option if your Linux box contains a WAN (Wide Area 104 104 Network) card supported by this driver and you are planning to ··· 165 167 If unsure, say N. 166 168 167 169 comment "X.25/LAPB support is disabled" 168 - depends on WAN && HDLC && (LAPB!=m || HDLC!=m) && LAPB!=y 170 + depends on HDLC && (LAPB!=m || HDLC!=m) && LAPB!=y 169 171 170 172 config PCI200SYN 171 173 tristate "Goramo PCI200SYN support" ··· 228 230 Multilink PPP over the PC300 synchronous communication boards. 229 231 230 232 comment "Cyclades-PC300 MLPPP support is disabled." 231 - depends on WAN && HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP) 233 + depends on HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP) 232 234 233 235 comment "Refer to the file README.mlppp, provided by PC300 package." 234 - depends on WAN && HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP) 236 + depends on HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP) 235 237 236 238 config PC300TOO 237 239 tristate "Cyclades PC300 RSV/X21 alternative support" ··· 336 338 337 339 config DLCI 338 340 tristate "Frame Relay DLCI support" 339 - depends on WAN 340 341 ---help--- 341 342 Support for the Frame Relay protocol. 342 343 ··· 382 385 # Wan router core. 383 386 config WAN_ROUTER_DRIVERS 384 387 tristate "WAN router drivers" 385 - depends on WAN && WAN_ROUTER 388 + depends on WAN_ROUTER 386 389 ---help--- 387 390 Connect LAN to WAN via Linux box. 388 391 ··· 437 440 # X.25 network drivers 438 441 config LAPBETHER 439 442 tristate "LAPB over Ethernet driver (EXPERIMENTAL)" 440 - depends on WAN && LAPB && X25 443 + depends on LAPB && X25 441 444 ---help--- 442 445 Driver for a pseudo device (typically called /dev/lapb0) which allows 443 446 you to open an LAPB point-to-point connection to some other computer ··· 453 456 454 457 config X25_ASY 455 458 tristate "X.25 async driver (EXPERIMENTAL)" 456 - depends on WAN && LAPB && X25 459 + depends on LAPB && X25 457 460 ---help--- 458 461 Send and receive X.25 frames over regular asynchronous serial 459 462 lines such as telephone lines equipped with ordinary modems. ··· 468 471 469 472 config SBNI 470 473 tristate "Granch SBNI12 Leased Line adapter support" 471 - depends on WAN && X86 474 + depends on X86 472 475 ---help--- 473 476 Driver for ISA SBNI12-xx cards which are low cost alternatives to 474 477 leased line modems. ··· 494 497 495 498 If unsure, say N. 496 499 497 - endmenu 498 - 500 + endif # WAN
-9
drivers/net/wireless/libertas/Makefile
··· 1 - # EXTRA_CFLAGS += -Wpacked 2 - 3 1 usb8xxx-objs := main.o fw.o wext.o \ 4 2 rx.o tx.o cmd.o \ 5 3 cmdresp.o scan.o \ ··· 5 7 ioctl.o debugfs.o \ 6 8 ethtool.o assoc.o 7 9 8 - ifeq ($(CONFIG_LIBERTAS_USB_DEBUG), y) 9 - EXTRA_CFLAGS += -DDEBUG -DPROC_DEBUG 10 - endif 11 - 12 - 13 - # This is needed to support the newer boot2 bootloader (v >= 3104) 14 - EXTRA_CFLAGS += -DSUPPORT_BOOT_COMMAND 15 10 usb8xxx-objs += if_bootcmd.o 16 11 usb8xxx-objs += if_usb.o 17 12
-516
drivers/net/wireless/libertas/README
··· 40 40 SYNOPSIS 41 41 iwpriv <ethX> <command> [sub-command] ... 42 42 43 - iwpriv ethX version 44 - iwpriv ethX scantype [sub-command] 45 - iwpriv ethX getSNR <n> 46 - iwpriv ethX getNF <n> 47 - iwpriv ethX getRSSI <n> 48 - iwpriv ethX setrxant <n> 49 - iwpriv ethX getrxant 50 - iwpriv ethX settxant <n> 51 - iwpriv ethX gettxant 52 - iwpriv ethX authalgs <n> 53 - iwpriv ethX pre-TBTT <n> 54 - iwpriv ethX 8021xauthalgs <n> 55 - iwpriv ethX encryptionmode <n> 56 43 iwpriv ethX setregioncode <n> 57 44 iwpriv ethX getregioncode 58 - iwpriv ethX setbcnavg <n> 59 - iwpriv ethX getbcnavg 60 - iwpriv ethX setdataavg <n> 61 - iwpriv ethX setlisteninter <n> 62 - iwpriv ethX getlisteninter 63 - iwpriv ethX setmultipledtim <n> 64 - iwpriv ethX getmultipledtim 65 - iwpriv ethX atimwindow <n> 66 - iwpriv ethX deauth 67 - iwpriv ethX adhocstop 68 - iwpriv ethX radioon 69 - iwpriv ethX radiooff 70 - iwpriv ethX reasso-on 71 - iwpriv ethX reasso-off 72 - iwpriv ethX scanmode [sub-command] 73 - iwpriv ethX setwpaie <n> 74 - iwpriv ethX wlanidle-off 75 - iwpriv ethX wlanidle-on 76 - iwpriv ethX getcis 77 - iwpriv ethX getlog 78 - iwpriv ethX getadhocstatus 79 - iwpriv ethX adhocgrate <n> 80 - 81 - Version 4 Command: 82 - iwpriv ethX inactvityto <n> 83 - iwpriv ethX sleeppd <n> 84 - iwpriv ethX enable11d <n> 85 - iwpriv ethX tpccfg <n> 86 - iwpriv ethX powercfg <n> 87 - iwpriv ethX setafc <n> 88 - iwpriv ethX getafc 89 45 90 46 Version 5 Command: 91 47 iwpriv ethX ledgpio <n> 92 - iwpriv ethX scanprobes <n> 93 - iwpriv ethX lolisteninter <n> 94 - iwpriv ethX rateadapt <n> <m> 95 - iwpriv ethX txcontrol <n> 96 - iwpriv ethX psnullinterval <n> 97 - iwpriv ethX prescan <n> 98 - iwpriv ethX getrxinfo 99 - iwpriv ethX gettxrate 100 - iwpriv ethX beaconinterval 101 48 102 49 BT Commands: 103 50 The blinding table (BT) contains a list of mac addresses that should be ··· 97 150 The ethX parameter specifies the network device that is to be used to 98 151 perform this command on. it could be eth0, eth1 etc. 99 152 100 - version 101 - This is used to get the current version of the driver and the firmware. 102 - 103 - scantype 104 - This command is used to set the scan type to be used by the driver in 105 - the scan command. This setting will not be used while performing a scan 106 - for a specific SSID, as it is always done with scan type being active. 107 - 108 - where the sub-commands are: - 109 - active -- to set the scan type to active 110 - passive -- to set the scan type to passive 111 - get -- to get the scan type set in the driver 112 - 113 - getSNR 114 - This command gets the average and non average value of Signal to Noise 115 - Ratio of Beacon and Data. 116 - 117 - where value is:- 118 - 0 -- Beacon non-average. 119 - 1 -- Beacon average. 120 - 2 -- Data non-average. 121 - 3 -- Data average. 122 - 123 - If no value is given, all four values are returned in the order mentioned 124 - above. 125 - 126 - Note: This command is available only when STA is connected. 127 - 128 - getRSSI 129 - This command gets the average and non average value os Receive Signal 130 - Strength of Beacon and Data. 131 - 132 - where value is:- 133 - 0 -- Beacon non-average. 134 - 1 -- Beacon average. 135 - 2 -- Data non-average. 136 - 3 -- Data average. 137 - 138 - Note: This command is available only when STA is connected. 139 - 140 - getNF 141 - This command gets the average and non average value of Noise Floor of 142 - Beacon and Data. 143 - 144 - where value is:- 145 - 0 -- Beacon non-average. 146 - 1 -- Beacon average. 147 - 2 -- Data non-average. 148 - 3 -- Data average. 149 - 150 - Note: This command is available only when STA is connected. 151 - 152 - setrxant 153 - This command is used to set the mode for Rx antenna. 154 - 155 - The options that can be sent are:- 156 - 1 -- Antenna 1. 157 - 2 -- Antenna 2. 158 - 0xFFFF -- Diversity. 159 - 160 - Usage: 161 - iwpriv ethX setrxant 0x01: select Antenna 1. 162 - 163 - getrxant 164 - This command is used to get the mode for Rx antenna. 165 - 166 - 167 - settxant 168 - This command is used to set the mode for Tx antenna. 169 - The options that can be sent are:- 170 - 1 -- Antenna 1. 171 - 2 -- Antenna 2. 172 - 0xFFFF -- Diversity. 173 - Usage: 174 - iwpriv ethX settxant 0x01: select Antenna 1. 175 - 176 - gettxant 177 - This command is used to get the mode for Tx antenna. 178 - 179 - authalgs 180 - This command is used by the WPA supplicant to set the authentication 181 - algorithms in the station. 182 - 183 - 8021xauthalgs 184 - This command is used by the WPA supplicant to set the 8021.x authentication algorithm type 185 - station. 186 - 187 - where values can be:- 188 - 1 -- None 189 - 2 -- LEAP 190 - 4 -- TLS 191 - 8 -- TTLs 192 - 16 -- MD5 193 - 194 - 195 - encryptionmode 196 - This command is used by the WPA supplicant to set the encryption algorithm. 197 - 198 - where values can be:- 199 - 0 -- NONE 200 - 1 -- WEP40 201 - 2 -- TKIP 202 - 3 -- CCMP 203 - 4 -- WEP104 204 - 205 - pre-TBTT 206 - This command is used to set pre-TBTT time period where value is in microseconds. 207 - 208 153 setregioncode 209 154 This command is used to set the region code in the station. 210 155 where value is 'region code' for various regions like ··· 108 269 getregioncode 109 270 This command is used to get the region code information set in the 110 271 station. 111 - 112 - setbcnavg 113 - Set the weighting factor for calculating RSSI. 114 - 115 - getbcnavg 116 - Get weighting factor for calculating RSSI. 117 - 118 - setdataavg 119 - Set the weighting factor for calculating SNR. 120 - 121 - setlisteninter 122 - This command is used to set the listen interval in the 123 - station. 124 - 125 - where the value ranges between 1 - 255 126 - 127 - getlisteninter 128 - This command is used to get the listen interval value set in the 129 - station. 130 - 131 - setmultipledtim 132 - This command is used to set the multiple dtim value in the 133 - station. 134 - where the value is 1,2,3,4,5,0xfffe 135 - 0xfffe means the firmware will use listen interval in association 136 - command for waking up 137 - 138 - getmultipledtim 139 - This command is used to get the multiple dtim value set in the station. 140 - 141 - atimwindow 142 - This command is used to set the atim value in the 143 - station. 144 - 145 - where the value ranges between 0 - 50 146 - 147 - deauth 148 - This command is used to send the de-authentication to the AP with which 149 - the station is associated. This command is valid only when 150 - station is in Infrastructure mode. 151 - 152 - Note: This command is available only when STA is connected. 153 - 154 - adhocstop 155 - This command is used to stop beacon transmission from the station and 156 - go into idle state in ad-hoc mode. 157 - 158 - Note: This command is available only when STA is connected. 159 - 160 - radioon 161 - This command is used to turn on the RF antenna. 162 - 163 - radiooff 164 - This command is sued to turn off the RF antenna. 165 - 166 - scanmode 167 - This command is used to set the station to scan for either IBSS 168 - networks or BSS networks or both BSS and IBSS networks. This 169 - command can be used with sub commands, 170 - 171 - where the value for 172 - bss -- Scan All the BSS networks. 173 - ibss -- Scan All the IBSS networks. 174 - any -- Scan both BSS and IBSS networks. 175 - 176 - 177 - 178 - setwpaie 179 - This command is used by WPA supplicant to send the WPA-IE to the driver. 180 - 181 - wlanidle-off 182 - This command is used to get into idle state. 183 - 184 - Note: This command is available only when STA is connected. 185 - 186 - wlanidle-on 187 - This command is used to get off the idle state. 188 - 189 - Note: This command is available only when STA is connected. 190 - 191 - 192 - getlog 193 - This command is used to get the 802.11 statistics available in the 194 - station. 195 - 196 - Note: This command is available only when STA is connected. 197 - 198 - getadhocstatus 199 - This command is used to get the ad-hoc Network Status. 200 - 201 - The various status codes are: 202 - AdhocStarted 203 - AdhocJoined 204 - AdhocIdle 205 - InfraMode 206 - AutoUnknownMode 207 - 208 - Note: This command is available only when STA is connected. 209 - 210 - adhocgrate 211 - This command is used to enable(1) g_rate, Disable(0) g_rate 212 - and request(2) the status which g_rate is disabled/enabled, 213 - for Ad-hoc creator. 214 - 215 - where value is:- 216 - 0 -- Disabled 217 - 1 -- Enabled 218 - 2 -- Get 219 272 220 273 ledgpio 221 274 This command is used to set/get LEDs. ··· 130 399 131 400 Note: LED0 is invalid 132 401 Note: Maximum Number of LEDs are 16. 133 - 134 - inactivityto 135 - This command is used by the host to set/get the inactivity timeout value, 136 - which specifies when WLAN device is put to sleep. 137 - 138 - Usage: 139 - iwpriv ethX inactivityto [<timeout>] 140 - 141 - where the parameter are: 142 - timeout: timeout value in milliseconds. 143 - 144 - Example: 145 - iwpriv eth1 inactivityto 146 - "get the timeout value" 147 - 148 - iwpriv eth1 inactivityto X 149 - "set timeout value to X ms" 150 - 151 - 152 - sleeppd 153 - This command is used to configure the sleep period of the WLAN device. 154 - 155 - Usage: 156 - iwpriv ethX sleeppd [<sleep period>] 157 - 158 - where the parameter are: 159 - Period: sleep period in milliseconds. Range 10~60. 160 - 161 - Example: 162 - iwpriv eth1 sleeppd 10 163 - "set period as 10 ms" 164 - iwpriv eth1 sleeppd 165 - "get the sleep period configuration" 166 - 167 - enable11d 168 - This command is used to control 11d 169 - where value is:- 170 - 1 -- Enabled 171 - 0 -- Disabled 172 - 2 -- Get 173 - 174 - 175 - 176 - 177 - tpccfg 178 - Enables or disables automatic transmit power control. 179 - 180 - The first parameter turns this feature on (1) or off (0). When turning 181 - on, the user must also supply four more parameters in the following 182 - order: 183 - -UseSNR (Use SNR (in addition to PER) for TPC algorithm), 184 - -P0 (P0 power level for TPC), 185 - -P1 (P1 power level for TPC), 186 - -P2 (P2 power level for TPC). 187 - 188 - Usage: 189 - iwpriv ethX tpccfg: Get current configuration 190 - iwpriv ethX tpccfg 0: disable auto TPC 191 - iwpriv ethX tpccfg 0x01 0x00 0x05 0x0a 0x0d: enable auto TPC; do not use SNR; 192 - P0=0x05; P1=0x0a; P2=0x0d; 193 - iwpriv ethX tpccfg 0x01 0x01 0x05 0x0a 0x0d: enable auto TPC; use SNR; 194 - P0=0x05; P1=0x0a; P2=0x0d. 195 - 196 - powercfg 197 - Enables or disables power adaptation. 198 - 199 - The first parameter turns this feature on (1) or off (0). When turning 200 - on, the user must also supply three more parameters in the following 201 - order: 202 - -P0 (P0 power level for Power Adaptation), 203 - -P1 (P1 power level for Power Adaptation), 204 - -P2 (P2 power level for Power Adaptation). 205 - 206 - Usage: 207 - iwpriv ethX powercfg: Get current configuration 208 - iwpriv ethX powercfg 0: disable power adaptation 209 - iwpriv ethX powercfg 1 0x0d 0x0f 0x12: enable power adaptation; 210 - P0=0x0d; P1=0x0f; P2=0x12. 211 - 212 - getafc 213 - This command returns automatic frequency control parameters. It returns 214 - three integers: 215 - -P0: automatic is on (1), or off (0), 216 - -P1: current timing offset in PPM (part per million), and 217 - -P2: current frequency offset in PPM. 218 - 219 - setafc 220 - Set automatic frequency control options. 221 - 222 - The first parameter turns automatic on (1) or off (0). 223 - The user must supply two more parameters in either case, in the following 224 - order: 225 - 226 - When auto is on: 227 - 228 - -P0 (automatic adjustment frequency threshold in PPM), 229 - -P1 (automatic adjustment period in beacon period), 230 - 231 - When auto is off: 232 - 233 - -P0 (manual adjustment timing offset in PPM), and 234 - -P1 (manual adjustment frequency offset in PPM). 235 - 236 - Usage: 237 - iwpriv ethX setafc 0 10 10: manual adjustment, both timing and frequcncy 238 - offset are 10 PPM. 239 - 240 - iwpriv ethX setafc 1 10 10 enable afc, automatic adjustment, 241 - frequency threshold 10 PPM, for every 10 beacon periods. 242 - 243 - 244 - 245 - scanprobes 246 - This command sets number of probe requests per channel. 247 - 248 - Usage: 249 - iwpriv ethX scanprobes 3 (set scan probes to 3) 250 - iwpriv ethX scanprobes (get scan probes) 251 - 252 - lolisteninter 253 - This command sets the value of listen interval. 254 - 255 - Usage: 256 - iwpriv ethX lolisteninter 234 (set the lolisteninter to 234) 257 - iwpriv ethX lolisteninter (get the lolisteninter value) 258 - 259 - rateadapt 260 - This command sets the data rates bitmap. 261 - Where <n> 262 - 0: Disable auto rate adapt 263 - 1: Enable auto rate adapt 264 - 265 - <m> 266 - data rate bitmap 267 - Bit Data rate 268 - 0 1 Mbps 269 - 1 2 Mbps 270 - 2 5.5 Mbps 271 - 3 11 Mbps 272 - 4 Reserved 273 - 5 6 Mbps 274 - 6 9 Mbps 275 - 7 12 Mbps 276 - 8 18 Mbps 277 - 9 24 Mbps 278 - 10 36 Mbps 279 - 11 48 Mbps 280 - 12 54 Mbps 281 - 12-15 Reserved 282 - 283 - Usage: 284 - iwpriv ethX rateadapt 285 - read the currect data rate setting 286 - iwpriv ethX rateadapt 1 0x07 287 - enable auto data rate adapt and 288 - data rates are 1Mbps, 2Mbsp and 5.5Mbps 289 - 290 - 291 - txcontrol 292 - This command is used to set the Tx rate, ack policy, and retry limit on a per packet basis. 293 - 294 - Where value <n> is: 295 - if bit[4] == 1: 296 - bit[3:0] -- 0 1 2 3 4 5 6 7 8 9 10 11 12 13-16 297 - Data Rate(Mbps) -- 1 2 5.5 11 Rsv 6 9 12 18 24 36 48 54 Rsv 298 - 299 - bit[12:8] 300 - if bit[12] == 1, bit[11:8] specifies the Tx retry limit. 301 - 302 - bit[14:13] specifies per packet ack policy: 303 - bit[14:13] 304 - 1 0 use immediate ack policy for this packet 305 - 1 1 use no ack policy for this packet 306 - 0 x use the per-packet ack policy setting 307 - 308 - Usage: 309 - iwpriv ethX txcontrol 0x7513 310 - Use no-ack policy, 5 retires for Tx, 11Mbps rate 311 - 312 - 313 - 314 - psnullinterval 315 - This command is used to set/request NULL package interval for Power Save 316 - under infrastructure mode. 317 - 318 - where value is:- 319 - -1 -- Disabled 320 - n>0 -- Set interval as n (seconds) 321 - 322 - prescan 323 - This command is used to enable (1)/disable(0) auto prescan before assoicate to the ap 324 - 325 - where value is:- 326 - 0 -- Disabled 327 - 1 -- Enabled 328 - 2 -- Get 329 - 330 - getrxinfo 331 - This command gets non average value of Signal to Noise Ratio of Data and rate index. 332 - 333 - The following table shows RateIndex and Rate 334 - 335 - RateIndex Data rate 336 - 0 1 Mbps 337 - 1 2 Mbps 338 - 2 5.5 Mbps 339 - 3 11 Mbps 340 - 4 Reserved 341 - 5 6 Mbps 342 - 6 9 Mbps 343 - 7 12 Mbps 344 - 8 18 Mbps 345 - 9 24 Mbps 346 - 10 36 Mbps 347 - 11 48 Mbps 348 - 12 54 Mbps 349 - 13-15 Reserved 350 - 351 - gettxrate 352 - This command gets current Tx rate index of the first packet associated with Rate Adaptation. 353 - 354 - The following table shows RateIndex and Rate 355 - 356 - RateIndex Data rate 357 - 0 1 Mbps 358 - 1 2 Mbps 359 - 2 5.5 Mbps 360 - 3 11 Mbps 361 - 4 Reserved 362 - 5 6 Mbps 363 - 6 9 Mbps 364 - 7 12 Mbps 365 - 8 18 Mbps 366 - 9 24 Mbps 367 - 10 36 Mbps 368 - 11 48 Mbps 369 - 12 54 Mbps 370 - 13-15 Reserved 371 - 372 - bcninterval 373 - This command is used to sets beacon interval in adhoc mode when an argument is given, and gets current adhoc 374 - beacon interval when no argument is given. The valid beacon interval is between 20 - 1000, 375 - default beacon interval is 100. 376 - 377 - Usage: 378 - iwpriv ethX bcninterval 100 (set adhoc beacon interval to 100) 379 - iwpriv ethX bcninterval (get adhoc beacon interval) 380 402 381 403 fwt_add 382 404 This command is used to insert an entry into the FWT table. The list of
+20 -21
drivers/net/wireless/libertas/assoc.c
··· 23 23 ENTER(); 24 24 25 25 lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid); 26 - if (assoc_req->mode == wlan802_11infrastructure) { 26 + if (assoc_req->mode == IW_MODE_INFRA) { 27 27 if (adapter->prescan) { 28 28 libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1); 29 29 } 30 30 31 31 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, 32 - NULL, wlan802_11infrastructure); 32 + NULL, IW_MODE_INFRA); 33 33 if (i >= 0) { 34 34 lbs_pr_debug(1, 35 35 "SSID found in scan list ... associating...\n"); ··· 44 44 lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n", 45 45 assoc_req->ssid.ssid); 46 46 } 47 - } else if (assoc_req->mode == wlan802_11ibss) { 47 + } else if (assoc_req->mode == IW_MODE_ADHOC) { 48 48 /* Scan for the network, do not save previous results. Stale 49 49 * scan data will cause us to join a non-existant adhoc network 50 50 */ ··· 52 52 53 53 /* Search for the requested SSID in the scan table */ 54 54 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, 55 - wlan802_11ibss); 55 + IW_MODE_ADHOC); 56 56 if (i >= 0) { 57 57 lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret); 58 58 libertas_join_adhoc_network(priv, &adapter->scantable[i]); ··· 90 90 goto out; 91 91 } 92 92 93 - if (assoc_req->mode == wlan802_11infrastructure) { 93 + if (assoc_req->mode == IW_MODE_INFRA) { 94 94 ret = wlan_associate(priv, &adapter->scantable[i]); 95 95 lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret); 96 - } else if (assoc_req->mode == wlan802_11ibss) { 96 + } else if (assoc_req->mode == IW_MODE_ADHOC) { 97 97 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 98 98 } 99 99 memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid, ··· 142 142 143 143 ENTER(); 144 144 145 - if (assoc_req->mode == adapter->inframode) { 145 + if (assoc_req->mode == adapter->mode) { 146 146 LEAVE(); 147 147 return 0; 148 148 } 149 149 150 - if (assoc_req->mode == wlan802_11infrastructure) { 150 + if (assoc_req->mode == IW_MODE_INFRA) { 151 151 if (adapter->psstate != PS_STATE_FULL_POWER) 152 152 libertas_ps_wakeup(priv, cmd_option_waitforrsp); 153 153 adapter->psmode = wlan802_11powermodecam; 154 154 } 155 155 156 - adapter->inframode = assoc_req->mode; 156 + adapter->mode = assoc_req->mode; 157 157 ret = libertas_prepare_and_send_command(priv, 158 158 cmd_802_11_snmp_mib, 159 159 0, cmd_option_waitforrsp, 160 160 OID_802_11_INFRASTRUCTURE_MODE, 161 - (void *) assoc_req->mode); 161 + (void *) (size_t) assoc_req->mode); 162 162 163 163 LEAVE(); 164 164 return ret; ··· 196 196 goto out; 197 197 198 198 /* enable/disable the MAC's WEP packet filter */ 199 - if (assoc_req->secinfo.WEPstatus == wlan802_11WEPenabled) 199 + if (assoc_req->secinfo.wep_enabled) 200 200 adapter->currentpacketfilter |= cmd_act_mac_wep_enable; 201 201 else 202 202 adapter->currentpacketfilter &= ~cmd_act_mac_wep_enable; ··· 300 300 } 301 301 302 302 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { 303 - if (adapter->secinfo.authmode != 304 - assoc_req->secinfo.authmode) { 303 + if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) { 305 304 lbs_pr_debug(1, "Deauthenticating due to updated security " 306 305 "info in configuration request.\n"); 307 306 return 1; ··· 315 316 316 317 /* FIXME: deal with 'auto' mode somehow */ 317 318 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 318 - if (assoc_req->mode != wlan802_11infrastructure) 319 + if (assoc_req->mode != IW_MODE_INFRA) 319 320 return 1; 320 321 } 321 322 ··· 332 333 if (adapter->curbssparams.ssid.ssidlength != assoc_req->ssid.ssidlength) 333 334 return 1; 334 335 if (memcmp(adapter->curbssparams.ssid.ssid, assoc_req->ssid.ssid, 335 - sizeof(struct WLAN_802_11_SSID))) 336 + adapter->curbssparams.ssid.ssidlength)) 336 337 return 1; 337 338 338 339 /* FIXME: deal with 'auto' mode somehow */ 339 340 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 340 - if (assoc_req->mode != wlan802_11ibss) 341 + if (assoc_req->mode != IW_MODE_ADHOC) 341 342 return 1; 342 343 } 343 344 ··· 381 382 } 382 383 383 384 if (find_any_ssid) { 384 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE new_mode; 385 + u8 new_mode; 385 386 386 387 ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid, 387 388 assoc_req->mode, &new_mode); ··· 392 393 } 393 394 394 395 /* Ensure we switch to the mode of the AP */ 395 - if (assoc_req->mode == wlan802_11autounknown) { 396 + if (assoc_req->mode == IW_MODE_AUTO) { 396 397 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); 397 398 assoc_req->mode = new_mode; 398 399 } ··· 402 403 * Check if the attributes being changing require deauthentication 403 404 * from the currently associated infrastructure access point. 404 405 */ 405 - if (adapter->inframode == wlan802_11infrastructure) { 406 + if (adapter->mode == IW_MODE_INFRA) { 406 407 if (should_deauth_infrastructure(adapter, assoc_req)) { 407 408 ret = libertas_send_deauthentication(priv); 408 409 if (ret) { ··· 411 412 ret); 412 413 } 413 414 } 414 - } else if (adapter->inframode == wlan802_11ibss) { 415 + } else if (adapter->mode == IW_MODE_ADHOC) { 415 416 if (should_stop_adhoc(adapter, assoc_req)) { 416 417 ret = libertas_stop_adhoc_network(priv); 417 418 if (ret) { ··· 542 543 assoc_req->channel = adapter->curbssparams.channel; 543 544 544 545 if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) 545 - assoc_req->mode = adapter->inframode; 546 + assoc_req->mode = adapter->mode; 546 547 547 548 if (!test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { 548 549 memcpy(&assoc_req->bssid, adapter->curbssparams.bssid,
+12 -11
drivers/net/wireless/libertas/cmd.c
··· 381 381 switch (cmd_oid) { 382 382 case OID_802_11_INFRASTRUCTURE_MODE: 383 383 { 384 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode = 385 - (enum WLAN_802_11_NETWORK_INFRASTRUCTURE) pdata_buf; 384 + u8 mode = (u8) (size_t) pdata_buf; 386 385 pSNMPMIB->querytype = cpu_to_le16(cmd_act_set); 387 386 pSNMPMIB->oid = cpu_to_le16((u16) desired_bsstype_i); 388 387 pSNMPMIB->bufsize = sizeof(u8); 389 - if (mode == wlan802_11infrastructure) 390 - ucTemp = SNMP_MIB_VALUE_INFRA; 391 - else 388 + if (mode == IW_MODE_ADHOC) { 392 389 ucTemp = SNMP_MIB_VALUE_ADHOC; 390 + } else { 391 + /* Infra and Auto modes */ 392 + ucTemp = SNMP_MIB_VALUE_INFRA; 393 + } 393 394 394 395 memmove(pSNMPMIB->value, &ucTemp, sizeof(u8)); 395 396 ··· 948 947 949 948 spin_unlock_irqrestore(&adapter->driver_lock, flags); 950 949 951 - lbs_pr_debug(1, "QUEUE_CMD: Inserted node=0x%x, cmd=0x%x in cmdpendingq\n", 952 - (u32) cmdnode, 950 + lbs_pr_debug(1, "QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n", 951 + cmdnode, 953 952 ((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command); 954 953 955 954 done: ··· 977 976 ENTER(); 978 977 979 978 if (!adapter || !cmdnode) { 980 - lbs_pr_debug(1, "DNLD_CMD: adapter = %#x, cmdnode = %#x\n", 981 - (int)adapter, (int)cmdnode); 979 + lbs_pr_debug(1, "DNLD_CMD: adapter = %p, cmdnode = %p\n", 980 + adapter, cmdnode); 982 981 if (cmdnode) { 983 982 spin_lock_irqsave(&adapter->driver_lock, flags); 984 983 __libertas_cleanup_and_insert_cmd(priv, cmdnode); ··· 1175 1174 1176 1175 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 1177 1176 1178 - lbs_pr_debug(1, "PREP_CMD: Val of cmd ptr =0x%x, command=0x%X\n", 1179 - (u32) cmdptr, cmd_no); 1177 + lbs_pr_debug(1, "PREP_CMD: Val of cmd ptr=%p, command=0x%X\n", 1178 + cmdptr, cmd_no); 1180 1179 1181 1180 if (!cmdptr) { 1182 1181 lbs_pr_debug(1, "PREP_CMD: bufvirtualaddr of cmdnode is NULL\n");
+1 -3
drivers/net/wireless/libertas/cmdresp.c
··· 72 72 adapter->secinfo.WPAenabled = 0; 73 73 adapter->secinfo.WPA2enabled = 0; 74 74 adapter->wpa_ie_len = 0; 75 - adapter->secinfo.auth1xalg = WLAN_1X_AUTH_ALG_NONE; 76 - adapter->secinfo.Encryptionmode = CIPHER_NONE; 77 75 78 76 adapter->connect_status = libertas_disconnected; 79 77 ··· 809 811 if (result) { 810 812 lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n", 811 813 resp->result); 812 - if (adapter->inframode == wlan802_11ibss) { 814 + if (adapter->mode == IW_MODE_ADHOC) { 813 815 /* 814 816 * We should not re-try enter-ps command in 815 817 * ad-hoc mode. It takes place in
+13 -18
drivers/net/wireless/libertas/debugfs.c
··· 7 7 #include "dev.h" 8 8 #include "decl.h" 9 9 #include "host.h" 10 + #include "debugfs.h" 10 11 11 12 static struct dentry *libertas_dir = NULL; 12 13 static char *szStates[] = { ··· 277 276 if (!end) 278 277 end = buf + count - 1; 279 278 280 - size = min(IW_ESSID_MAX_SIZE, end - hold); 279 + size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold)); 281 280 strncpy(scan_cfg->specificSSID, hold, size); 282 281 283 282 return; ··· 1649 1648 struct file_operations fops; 1650 1649 }; 1651 1650 1652 - struct libertas_debugfs_files debugfs_files[] = { 1651 + static struct libertas_debugfs_files debugfs_files[] = { 1653 1652 { "info", 0444, FOPS(libertas_dev_info, write_file_dummy), }, 1654 1653 { "getscantable", 0444, FOPS(libertas_getscantable, 1655 1654 write_file_dummy), }, ··· 1659 1658 { "setuserscan", 0600, FOPS(NULL, libertas_setuserscan), }, 1660 1659 }; 1661 1660 1662 - struct libertas_debugfs_files debugfs_events_files[] = { 1661 + static struct libertas_debugfs_files debugfs_events_files[] = { 1663 1662 {"low_rssi", 0644, FOPS(libertas_lowrssi_read, 1664 1663 libertas_lowrssi_write), }, 1665 1664 {"low_snr", 0644, FOPS(libertas_lowsnr_read, ··· 1674 1673 libertas_highsnr_write), }, 1675 1674 }; 1676 1675 1677 - struct libertas_debugfs_files debugfs_regs_files[] = { 1676 + static struct libertas_debugfs_files debugfs_regs_files[] = { 1678 1677 {"rdmac", 0644, FOPS(libertas_rdmac_read, libertas_rdmac_write), }, 1679 1678 {"wrmac", 0600, FOPS(NULL, libertas_wrmac_write), }, 1680 1679 {"rdbbp", 0644, FOPS(libertas_rdbbp_read, libertas_rdbbp_write), }, ··· 1779 1778 struct debug_data { 1780 1779 char name[32]; 1781 1780 u32 size; 1782 - u32 addr; 1781 + size_t addr; 1783 1782 }; 1784 1783 1785 1784 /* To debug any member of wlan_adapter, simply add one line here. ··· 1826 1825 val = *((u16 *) d[i].addr); 1827 1826 else if (d[i].size == 4) 1828 1827 val = *((u32 *) d[i].addr); 1828 + else if (d[i].size == 8) 1829 + val = *((u64 *) d[i].addr); 1829 1830 1830 1831 pos += sprintf(p + pos, "%s=%d\n", d[i].name, val); 1831 1832 } ··· 1847 1844 * @param data data to write 1848 1845 * @return number of data 1849 1846 */ 1850 - static int wlan_debugfs_write(struct file *f, const char __user *buf, 1847 + static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf, 1851 1848 size_t cnt, loff_t *ppos) 1852 1849 { 1853 1850 int r, i; ··· 1889 1886 *((u16 *) d[i].addr) = (u16) r; 1890 1887 else if (d[i].size == 4) 1891 1888 *((u32 *) d[i].addr) = (u32) r; 1889 + else if (d[i].size == 8) 1890 + *((u64 *) d[i].addr) = (u64) r; 1892 1891 break; 1893 1892 } while (1); 1894 1893 } 1895 1894 kfree(pdata); 1896 1895 1897 - return cnt; 1896 + return (ssize_t)cnt; 1898 1897 } 1899 1898 1900 1899 static struct file_operations libertas_debug_fops = { ··· 1921 1916 return; 1922 1917 1923 1918 for (i = 0; i < num_of_items; i++) 1924 - items[i].addr += (u32) priv->adapter; 1919 + items[i].addr += (size_t) priv->adapter; 1925 1920 1926 1921 priv->debugfs_debug = debugfs_create_file("debug", 0644, 1927 1922 priv->debugfs_dir, &items[0], 1928 1923 &libertas_debug_fops); 1929 1924 } 1930 1925 1931 - /** 1932 - * @brief remove proc file 1933 - * 1934 - * @param priv pointer wlan_private 1935 - * @return N/A 1936 - */ 1937 - void libertas_debug_remove(wlan_private * priv) 1938 - { 1939 - debugfs_remove(priv->debugfs_debug); 1940 - }
+5 -47
drivers/net/wireless/libertas/defs.h
··· 9 9 10 10 extern unsigned int libertas_debug; 11 11 12 + #ifdef CONFIG_LIBERTAS_DEBUG 13 + #define DEBUG 14 + #define PROC_DEBUG 15 + #endif 16 + 12 17 #define DRV_NAME "usb8xxx" 13 18 14 19 #define lbs_pr_info(format, args...) \ ··· 228 223 MAX_TYPE_AVG 229 224 }; 230 225 231 - /** WLAN_802_11_AUTH_ALG*/ 232 - enum WLAN_802_11_AUTH_ALG { 233 - AUTH_ALG_OPEN_SYSTEM = 1, 234 - AUTH_ALG_SHARED_KEY = 2, 235 - AUTH_ALG_NETWORK_EAP = 8, 236 - }; 237 - 238 - /** WLAN_802_1X_AUTH_ALG */ 239 - enum WLAN_802_1X_AUTH_ALG { 240 - WLAN_1X_AUTH_ALG_NONE = 1, 241 - WLAN_1X_AUTH_ALG_LEAP = 2, 242 - WLAN_1X_AUTH_ALG_TLS = 4, 243 - WLAN_1X_AUTH_ALG_TTLS = 8, 244 - WLAN_1X_AUTH_ALG_MD5 = 16, 245 - }; 246 - 247 - /** WLAN_802_11_ENCRYPTION_MODE */ 248 - enum WLAN_802_11_ENCRYPTION_MODE { 249 - CIPHER_NONE, 250 - CIPHER_WEP40, 251 - CIPHER_TKIP, 252 - CIPHER_CCMP, 253 - CIPHER_WEP104, 254 - }; 255 - 256 226 /** WLAN_802_11_POWER_MODE */ 257 227 enum WLAN_802_11_POWER_MODE { 258 228 wlan802_11powermodecam, ··· 270 290 MVMS_CMD = 1, 271 291 MVMS_TXDONE = 2, 272 292 MVMS_EVENT 273 - }; 274 - 275 - /** WLAN_802_11_NETWORK_INFRASTRUCTURE */ 276 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE { 277 - wlan802_11ibss, 278 - wlan802_11infrastructure, 279 - wlan802_11autounknown, 280 - /*defined as upper bound */ 281 - wlan802_11infrastructuremax 282 - }; 283 - 284 - /** WLAN_802_11_AUTHENTICATION_MODE */ 285 - enum WLAN_802_11_AUTHENTICATION_MODE { 286 - wlan802_11authmodeopen = 0x00, 287 - wlan802_11authmodeshared = 0x01, 288 - wlan802_11authmodenetworkEAP = 0x80, 289 - }; 290 - 291 - /** WLAN_802_11_WEP_STATUS */ 292 - enum WLAN_802_11_WEP_STATUS { 293 - wlan802_11WEPenabled, 294 - wlan802_11WEPdisabled, 295 293 }; 296 294 297 295 /** SNMP_MIB_INDEX_e */
+6 -8
drivers/net/wireless/libertas/dev.h
··· 10 10 #include <linux/wireless.h> 11 11 #include <linux/ethtool.h> 12 12 #include <linux/debugfs.h> 13 + #include <net/ieee80211.h> 13 14 14 15 #include "defs.h" 15 16 #include "scan.h" ··· 57 56 struct wlan_802_11_security { 58 57 u8 WPAenabled; 59 58 u8 WPA2enabled; 60 - enum WLAN_802_11_WEP_STATUS WEPstatus; 61 - enum WLAN_802_11_AUTHENTICATION_MODE authmode; 62 - enum WLAN_802_1X_AUTH_ALG auth1xalg; 63 - enum WLAN_802_11_ENCRYPTION_MODE Encryptionmode; 59 + u8 wep_enabled; 60 + u8 auth_mode; 64 61 }; 65 62 66 63 /** Current Basic Service Set State Structure */ ··· 183 184 184 185 struct WLAN_802_11_SSID ssid; 185 186 u8 channel; 186 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode; 187 + u8 mode; 187 188 u8 bssid[ETH_ALEN]; 188 189 189 190 /** WEP keys */ ··· 197 198 struct wlan_802_11_security secinfo; 198 199 199 200 /** WPA Information Elements*/ 200 - #define MAX_WPA_IE_LEN 64 201 201 u8 wpa_ie[MAX_WPA_IE_LEN]; 202 202 u8 wpa_ie_len; 203 203 }; ··· 252 254 /** current ssid/bssid related parameters*/ 253 255 struct current_bss_params curbssparams; 254 256 255 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE inframode; 257 + /* IW_MODE_* */ 258 + u8 mode; 256 259 257 260 struct bss_descriptor *pattemptedbssdesc; 258 261 ··· 338 339 struct WLAN_802_11_KEY wpa_unicast_key; 339 340 340 341 /** WPA Information Elements*/ 341 - #define MAX_WPA_IE_LEN 64 342 342 u8 wpa_ie[MAX_WPA_IE_LEN]; 343 343 u8 wpa_ie_len; 344 344
+3 -6
drivers/net/wireless/libertas/fw.c
··· 194 194 adapter->scanmode = cmd_bss_type_any; 195 195 196 196 /* 802.11 specific */ 197 - adapter->secinfo.WEPstatus = wlan802_11WEPdisabled; 197 + adapter->secinfo.wep_enabled = 0; 198 198 for (i = 0; i < sizeof(adapter->wep_keys) / sizeof(adapter->wep_keys[0]); 199 199 i++) 200 200 memset(&adapter->wep_keys[i], 0, sizeof(struct WLAN_802_11_KEY)); 201 201 adapter->wep_tx_keyidx = 0; 202 - adapter->secinfo.WEPstatus = wlan802_11WEPdisabled; 203 - adapter->secinfo.authmode = wlan802_11authmodeopen; 204 - adapter->secinfo.auth1xalg = WLAN_1X_AUTH_ALG_NONE; 205 - adapter->secinfo.Encryptionmode = CIPHER_NONE; 206 - adapter->inframode = wlan802_11infrastructure; 202 + adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 203 + adapter->mode = IW_MODE_INFRA; 207 204 208 205 adapter->assoc_req = NULL; 209 206
+2 -3
drivers/net/wireless/libertas/if_usb.c
··· 388 388 usb_fill_bulk_urb(cardp->rx_urb, cardp->udev, 389 389 usb_rcvbulkpipe(cardp->udev, 390 390 cardp->bulk_in_endpointAddr), 391 - skb->tail + IPFIELD_ALIGN_OFFSET, 391 + (void *) (skb->tail + (size_t) IPFIELD_ALIGN_OFFSET), 392 392 MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn, 393 393 rinfo); 394 394 ··· 626 626 cardp->usb_event_cause); 627 627 if (cardp->usb_event_cause & 0xffff0000) { 628 628 libertas_send_tx_feedback(priv); 629 + spin_unlock(&priv->adapter->driver_lock); 629 630 break; 630 631 } 631 632 cardp->usb_event_cause = le32_to_cpu(cardp->usb_event_cause) << 3; ··· 776 775 return -1; 777 776 } 778 777 779 - #ifdef SUPPORT_BOOT_COMMAND 780 778 cardp->bootcmdresp = 0; 781 779 do { 782 780 int j = 0; ··· 796 796 } 797 797 return -1; 798 798 } 799 - #endif 800 799 801 800 i = 0; 802 801 priv->adapter->fw_ready = 0;
-2
drivers/net/wireless/libertas/if_usb.h
··· 12 12 #define USB8388_VID_2 0x05a3 13 13 #define USB8388_PID_2 0x8388 14 14 15 - #ifdef SUPPORT_BOOT_COMMAND 16 15 #define BOOT_CMD_FW_BY_USB 0x01 17 16 #define BOOT_CMD_FW_IN_EEPROM 0x02 18 17 #define BOOT_CMD_UPDATE_BOOT2 0x03 ··· 35 36 u8 u8result; 36 37 u8 au8dumy[2]; 37 38 }; 38 - #endif /* SUPPORT_BOOT_COMMAND */ 39 39 40 40 /* read callback private data */ 41 41 struct read_cb_info {
+10 -1519
drivers/net/wireless/libertas/ioctl.c
··· 27 27 28 28 #define WAIT_FOR_SCAN_RRESULT_MAX_TIME (10 * HZ) 29 29 30 - static int setrxantenna(wlan_private * priv, int mode) 31 - { 32 - int ret = 0; 33 - wlan_adapter *adapter = priv->adapter; 34 - 35 - if (mode != RF_ANTENNA_1 && mode != RF_ANTENNA_2 36 - && mode != RF_ANTENNA_AUTO) { 37 - return -EINVAL; 38 - } 39 - 40 - adapter->rxantennamode = mode; 41 - 42 - lbs_pr_debug(1, "SET RX Antenna mode to 0x%04x\n", adapter->rxantennamode); 43 - 44 - ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_antenna, 45 - cmd_act_set_rx, 46 - cmd_option_waitforrsp, 0, 47 - &adapter->rxantennamode); 48 - return ret; 49 - } 50 - 51 - static int settxantenna(wlan_private * priv, int mode) 52 - { 53 - int ret = 0; 54 - wlan_adapter *adapter = priv->adapter; 55 - 56 - if ((mode != RF_ANTENNA_1) && (mode != RF_ANTENNA_2) 57 - && (mode != RF_ANTENNA_AUTO)) { 58 - return -EINVAL; 59 - } 60 - 61 - adapter->txantennamode = mode; 62 - 63 - lbs_pr_debug(1, "SET TX Antenna mode to 0x%04x\n", adapter->txantennamode); 64 - 65 - ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_antenna, 66 - cmd_act_set_tx, 67 - cmd_option_waitforrsp, 0, 68 - &adapter->txantennamode); 69 - 70 - return ret; 71 - } 72 - 73 - static int getrxantenna(wlan_private * priv, char *buf) 74 - { 75 - int ret = 0; 76 - wlan_adapter *adapter = priv->adapter; 77 - 78 - // clear it, so we will know if the value 79 - // returned below is correct or not. 80 - adapter->rxantennamode = 0; 81 - 82 - ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_antenna, 83 - cmd_act_get_rx, 84 - cmd_option_waitforrsp, 0, NULL); 85 - 86 - if (ret) { 87 - LEAVE(); 88 - return ret; 89 - } 90 - 91 - lbs_pr_debug(1, "Get Rx Antenna mode:0x%04x\n", adapter->rxantennamode); 92 - 93 - return sprintf(buf, "0x%04x", adapter->rxantennamode) + 1; 94 - } 95 - 96 - static int gettxantenna(wlan_private * priv, char *buf) 97 - { 98 - int ret = 0; 99 - wlan_adapter *adapter = priv->adapter; 100 - 101 - // clear it, so we will know if the value 102 - // returned below is correct or not. 103 - adapter->txantennamode = 0; 104 - 105 - ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_antenna, 106 - cmd_act_get_tx, 107 - cmd_option_waitforrsp, 0, NULL); 108 - 109 - if (ret) { 110 - LEAVE(); 111 - return ret; 112 - } 113 - 114 - lbs_pr_debug(1, "Get Tx Antenna mode:0x%04x\n", adapter->txantennamode); 115 - 116 - return sprintf(buf, "0x%04x", adapter->txantennamode) + 1; 117 - } 118 - 119 30 static int wlan_set_region(wlan_private * priv, u16 region_code) 120 31 { 121 32 int i; ··· 52 141 return -EINVAL; 53 142 } 54 143 55 - return 0; 56 - } 57 - 58 - /** 59 - * @brief Get/Set Firmware wakeup method 60 - * 61 - * @param priv A pointer to wlan_private structure 62 - * @param wrq A pointer to user data 63 - * @return 0--success, otherwise fail 64 - */ 65 - static int wlan_txcontrol(wlan_private * priv, struct iwreq *wrq) 66 - { 67 - wlan_adapter *adapter = priv->adapter; 68 - int data; 69 - ENTER(); 70 - 71 - if ((int)wrq->u.data.length == 0) { 72 - if (copy_to_user 73 - (wrq->u.data.pointer, &adapter->pkttxctrl, sizeof(u32))) { 74 - lbs_pr_alert("copy_to_user failed!\n"); 75 - return -EFAULT; 76 - } 77 - } else { 78 - if ((int)wrq->u.data.length > 1) { 79 - lbs_pr_alert("ioctl too many args!\n"); 80 - return -EFAULT; 81 - } 82 - if (copy_from_user(&data, wrq->u.data.pointer, sizeof(int))) { 83 - lbs_pr_alert("Copy from user failed\n"); 84 - return -EFAULT; 85 - } 86 - 87 - adapter->pkttxctrl = (u32) data; 88 - } 89 - 90 - wrq->u.data.length = 1; 91 - 92 - LEAVE(); 93 - return 0; 94 - } 95 - 96 - /** 97 - * @brief Get/Set NULL Package generation interval 98 - * 99 - * @param priv A pointer to wlan_private structure 100 - * @param wrq A pointer to user data 101 - * @return 0--success, otherwise fail 102 - */ 103 - static int wlan_null_pkt_interval(wlan_private * priv, struct iwreq *wrq) 104 - { 105 - wlan_adapter *adapter = priv->adapter; 106 - int data; 107 - ENTER(); 108 - 109 - if ((int)wrq->u.data.length == 0) { 110 - data = adapter->nullpktinterval; 111 - 112 - if (copy_to_user(wrq->u.data.pointer, &data, sizeof(int))) { 113 - lbs_pr_alert( "copy_to_user failed!\n"); 114 - return -EFAULT; 115 - } 116 - } else { 117 - if ((int)wrq->u.data.length > 1) { 118 - lbs_pr_alert( "ioctl too many args!\n"); 119 - return -EFAULT; 120 - } 121 - if (copy_from_user(&data, wrq->u.data.pointer, sizeof(int))) { 122 - lbs_pr_debug(1, "Copy from user failed\n"); 123 - return -EFAULT; 124 - } 125 - 126 - adapter->nullpktinterval = data; 127 - } 128 - 129 - wrq->u.data.length = 1; 130 - 131 - LEAVE(); 132 - return 0; 133 - } 134 - 135 - static int wlan_get_rxinfo(wlan_private * priv, struct iwreq *wrq) 136 - { 137 - wlan_adapter *adapter = priv->adapter; 138 - int data[2]; 139 - ENTER(); 140 - data[0] = adapter->SNR[TYPE_RXPD][TYPE_NOAVG]; 141 - data[1] = adapter->rxpd_rate; 142 - if (copy_to_user(wrq->u.data.pointer, data, sizeof(int) * 2)) { 143 - lbs_pr_debug(1, "Copy to user failed\n"); 144 - return -EFAULT; 145 - } 146 - wrq->u.data.length = 2; 147 - LEAVE(); 148 - return 0; 149 - } 150 - 151 - static int wlan_get_snr(wlan_private * priv, struct iwreq *wrq) 152 - { 153 - int ret = 0; 154 - wlan_adapter *adapter = priv->adapter; 155 - int data[4]; 156 - 157 - ENTER(); 158 - memset(data, 0, sizeof(data)); 159 - if (wrq->u.data.length) { 160 - if (copy_from_user(data, wrq->u.data.pointer, 161 - min_t(size_t, wrq->u.data.length, 4) * sizeof(int))) 162 - return -EFAULT; 163 - } 164 - if ((wrq->u.data.length == 0) || (data[0] == 0) || (data[0] == 1)) { 165 - if (adapter->connect_status == libertas_connected) { 166 - ret = libertas_prepare_and_send_command(priv, 167 - cmd_802_11_rssi, 168 - 0, 169 - cmd_option_waitforrsp, 170 - 0, NULL); 171 - 172 - if (ret) { 173 - LEAVE(); 174 - return ret; 175 - } 176 - } 177 - } 178 - 179 - if (wrq->u.data.length == 0) { 180 - data[0] = adapter->SNR[TYPE_BEACON][TYPE_NOAVG]; 181 - data[1] = adapter->SNR[TYPE_BEACON][TYPE_AVG]; 182 - data[2] = adapter->SNR[TYPE_RXPD][TYPE_NOAVG]; 183 - data[3] = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; 184 - if (copy_to_user(wrq->u.data.pointer, data, sizeof(int) * 4)) 185 - return -EFAULT; 186 - wrq->u.data.length = 4; 187 - } else if (data[0] == 0) { 188 - data[0] = adapter->SNR[TYPE_BEACON][TYPE_NOAVG]; 189 - if (copy_to_user(wrq->u.data.pointer, data, sizeof(int))) 190 - return -EFAULT; 191 - wrq->u.data.length = 1; 192 - } else if (data[0] == 1) { 193 - data[0] = adapter->SNR[TYPE_BEACON][TYPE_AVG]; 194 - if (copy_to_user(wrq->u.data.pointer, data, sizeof(int))) 195 - return -EFAULT; 196 - wrq->u.data.length = 1; 197 - } else if (data[0] == 2) { 198 - data[0] = adapter->SNR[TYPE_RXPD][TYPE_NOAVG]; 199 - if (copy_to_user(wrq->u.data.pointer, data, sizeof(int))) 200 - return -EFAULT; 201 - wrq->u.data.length = 1; 202 - } else if (data[0] == 3) { 203 - data[0] = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; 204 - if (copy_to_user(wrq->u.data.pointer, data, sizeof(int))) 205 - return -EFAULT; 206 - wrq->u.data.length = 1; 207 - } else 208 - return -ENOTSUPP; 209 - 210 - LEAVE(); 211 - return 0; 212 - } 213 - 214 - static int wlan_beacon_interval(wlan_private * priv, struct iwreq *wrq) 215 - { 216 - int data; 217 - wlan_adapter *adapter = priv->adapter; 218 - 219 - if (wrq->u.data.length > 0) { 220 - if (copy_from_user(&data, wrq->u.data.pointer, sizeof(int))) 221 - return -EFAULT; 222 - 223 - lbs_pr_debug(1, "WLAN SET BEACON INTERVAL: %d\n", data); 224 - if ((data > MRVDRV_MAX_BEACON_INTERVAL) 225 - || (data < MRVDRV_MIN_BEACON_INTERVAL)) 226 - return -ENOTSUPP; 227 - adapter->beaconperiod = data; 228 - } 229 - data = adapter->beaconperiod; 230 - if (copy_to_user(wrq->u.data.pointer, &data, sizeof(int))) 231 - return -EFAULT; 232 - 233 - wrq->u.data.length = 1; 234 - 235 - return 0; 236 - } 237 - 238 - static int wlan_get_rssi(wlan_private * priv, struct iwreq *wrq) 239 - { 240 - int ret = 0; 241 - wlan_adapter *adapter = priv->adapter; 242 - int temp; 243 - int data = 0; 244 - int *val; 245 - 246 - ENTER(); 247 - data = SUBCMD_DATA(wrq); 248 - if ((data == 0) || (data == 1)) { 249 - ret = libertas_prepare_and_send_command(priv, 250 - cmd_802_11_rssi, 251 - 0, cmd_option_waitforrsp, 252 - 0, NULL); 253 - if (ret) { 254 - LEAVE(); 255 - return ret; 256 - } 257 - } 258 - 259 - switch (data) { 260 - case 0: 261 - 262 - temp = CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], 263 - adapter->NF[TYPE_BEACON][TYPE_NOAVG]); 264 - break; 265 - case 1: 266 - temp = CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG], 267 - adapter->NF[TYPE_BEACON][TYPE_AVG]); 268 - break; 269 - case 2: 270 - temp = CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_NOAVG], 271 - adapter->NF[TYPE_RXPD][TYPE_NOAVG]); 272 - break; 273 - case 3: 274 - temp = CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, 275 - adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); 276 - break; 277 - default: 278 - return -ENOTSUPP; 279 - } 280 - val = (int *)wrq->u.name; 281 - *val = temp; 282 - 283 - LEAVE(); 284 - return 0; 285 - } 286 - 287 - static int wlan_get_nf(wlan_private * priv, struct iwreq *wrq) 288 - { 289 - int ret = 0; 290 - wlan_adapter *adapter = priv->adapter; 291 - int temp; 292 - int data = 0; 293 - int *val; 294 - 295 - data = SUBCMD_DATA(wrq); 296 - if ((data == 0) || (data == 1)) { 297 - ret = libertas_prepare_and_send_command(priv, 298 - cmd_802_11_rssi, 299 - 0, cmd_option_waitforrsp, 300 - 0, NULL); 301 - 302 - if (ret) { 303 - LEAVE(); 304 - return ret; 305 - } 306 - } 307 - 308 - switch (data) { 309 - case 0: 310 - temp = adapter->NF[TYPE_BEACON][TYPE_NOAVG]; 311 - break; 312 - case 1: 313 - temp = adapter->NF[TYPE_BEACON][TYPE_AVG]; 314 - break; 315 - case 2: 316 - temp = adapter->NF[TYPE_RXPD][TYPE_NOAVG]; 317 - break; 318 - case 3: 319 - temp = adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; 320 - break; 321 - default: 322 - return -ENOTSUPP; 323 - } 324 - 325 - temp = CAL_NF(temp); 326 - 327 - lbs_pr_debug(1, "%s: temp = %d\n", __FUNCTION__, temp); 328 - val = (int *)wrq->u.name; 329 - *val = temp; 330 - return 0; 331 - } 332 - 333 - static int wlan_get_txrate_ioctl(wlan_private * priv, struct ifreq *req) 334 - { 335 - wlan_adapter *adapter = priv->adapter; 336 - int *pdata; 337 - struct iwreq *wrq = (struct iwreq *)req; 338 - int ret = 0; 339 - adapter->txrate = 0; 340 - lbs_pr_debug(1, "wlan_get_txrate_ioctl\n"); 341 - ret = libertas_prepare_and_send_command(priv, cmd_802_11_tx_rate_query, 342 - cmd_act_get, cmd_option_waitforrsp, 343 - 0, NULL); 344 - if (ret) 345 - return ret; 346 - 347 - pdata = (int *)wrq->u.name; 348 - *pdata = (int)adapter->txrate; 349 - return 0; 350 - } 351 - 352 - static int wlan_get_adhoc_status_ioctl(wlan_private * priv, struct iwreq *wrq) 353 - { 354 - char status[64]; 355 - wlan_adapter *adapter = priv->adapter; 356 - 357 - memset(status, 0, sizeof(status)); 358 - 359 - switch (adapter->inframode) { 360 - case wlan802_11ibss: 361 - if (adapter->connect_status == libertas_connected) { 362 - if (adapter->adhoccreate) 363 - memcpy(&status, "AdhocStarted", sizeof(status)); 364 - else 365 - memcpy(&status, "AdhocJoined", sizeof(status)); 366 - } else { 367 - memcpy(&status, "AdhocIdle", sizeof(status)); 368 - } 369 - break; 370 - case wlan802_11infrastructure: 371 - memcpy(&status, "Inframode", sizeof(status)); 372 - break; 373 - default: 374 - memcpy(&status, "AutoUnknownmode", sizeof(status)); 375 - break; 376 - } 377 - 378 - lbs_pr_debug(1, "status = %s\n", status); 379 - wrq->u.data.length = strlen(status) + 1; 380 - 381 - if (wrq->u.data.pointer) { 382 - if (copy_to_user(wrq->u.data.pointer, 383 - &status, wrq->u.data.length)) 384 - return -EFAULT; 385 - } 386 - 387 - LEAVE(); 388 - return 0; 389 - } 390 - 391 - /** 392 - * @brief Set/Get WPA IE 393 - * @param priv A pointer to wlan_private structure 394 - * @param req A pointer to ifreq structure 395 - * @return 0 --success, otherwise fail 396 - */ 397 - static int wlan_setwpaie_ioctl(wlan_private * priv, struct ifreq *req) 398 - { 399 - struct iwreq *wrq = (struct iwreq *)req; 400 - wlan_adapter *adapter = priv->adapter; 401 - int ret = 0; 402 - 403 - ENTER(); 404 - 405 - if (wrq->u.data.length) { 406 - if (wrq->u.data.length > sizeof(adapter->wpa_ie)) { 407 - lbs_pr_debug(1, "failed to copy WPA IE, too big \n"); 408 - return -EFAULT; 409 - } 410 - if (copy_from_user(adapter->wpa_ie, wrq->u.data.pointer, 411 - wrq->u.data.length)) { 412 - lbs_pr_debug(1, "failed to copy WPA IE \n"); 413 - return -EFAULT; 414 - } 415 - adapter->wpa_ie_len = wrq->u.data.length; 416 - lbs_pr_debug(1, "Set wpa_ie_len=%d IE=%#x\n", adapter->wpa_ie_len, 417 - adapter->wpa_ie[0]); 418 - lbs_dbg_hex("wpa_ie", adapter->wpa_ie, adapter->wpa_ie_len); 419 - if (adapter->wpa_ie[0] == WPA_IE) 420 - adapter->secinfo.WPAenabled = 1; 421 - else if (adapter->wpa_ie[0] == WPA2_IE) 422 - adapter->secinfo.WPA2enabled = 1; 423 - else { 424 - adapter->secinfo.WPAenabled = 0; 425 - adapter->secinfo.WPA2enabled = 0; 426 - } 427 - } else { 428 - memset(adapter->wpa_ie, 0, sizeof(adapter->wpa_ie)); 429 - adapter->wpa_ie_len = wrq->u.data.length; 430 - lbs_pr_debug(1, "Reset wpa_ie_len=%d IE=%#x\n", 431 - adapter->wpa_ie_len, adapter->wpa_ie[0]); 432 - adapter->secinfo.WPAenabled = 0; 433 - adapter->secinfo.WPA2enabled = 0; 434 - } 435 - 436 - // enable/disable RSN in firmware if WPA is enabled/disabled 437 - // depending on variable adapter->secinfo.WPAenabled is set or not 438 - ret = libertas_prepare_and_send_command(priv, cmd_802_11_enable_rsn, 439 - cmd_act_set, cmd_option_waitforrsp, 440 - 0, NULL); 441 - 442 - LEAVE(); 443 - return ret; 444 - } 445 - 446 - /** 447 - * @brief Set Auto prescan 448 - * @param priv A pointer to wlan_private structure 449 - * @param wrq A pointer to iwreq structure 450 - * @return 0 --success, otherwise fail 451 - */ 452 - static int wlan_subcmd_setprescan_ioctl(wlan_private * priv, struct iwreq *wrq) 453 - { 454 - int data; 455 - wlan_adapter *adapter = priv->adapter; 456 - int *val; 457 - 458 - data = SUBCMD_DATA(wrq); 459 - lbs_pr_debug(1, "WLAN_SUBCMD_SET_PRESCAN %d\n", data); 460 - adapter->prescan = data; 461 - 462 - val = (int *)wrq->u.name; 463 - *val = data; 464 - return 0; 465 - } 466 - 467 - static int wlan_set_multiple_dtim_ioctl(wlan_private * priv, struct ifreq *req) 468 - { 469 - struct iwreq *wrq = (struct iwreq *)req; 470 - u32 mdtim; 471 - int idata; 472 - int ret = -EINVAL; 473 - 474 - ENTER(); 475 - 476 - idata = SUBCMD_DATA(wrq); 477 - mdtim = (u32) idata; 478 - if (((mdtim >= MRVDRV_MIN_MULTIPLE_DTIM) 479 - && (mdtim <= MRVDRV_MAX_MULTIPLE_DTIM)) 480 - || (mdtim == MRVDRV_IGNORE_MULTIPLE_DTIM)) { 481 - priv->adapter->multipledtim = mdtim; 482 - ret = 0; 483 - } 484 - if (ret) 485 - lbs_pr_debug(1, "Invalid parameter, multipledtim not changed.\n"); 486 - 487 - LEAVE(); 488 - return ret; 489 - } 490 - 491 - /** 492 - * @brief Set authentication mode 493 - * @param priv A pointer to wlan_private structure 494 - * @param req A pointer to ifreq structure 495 - * @return 0 --success, otherwise fail 496 - */ 497 - static int wlan_setauthalg_ioctl(wlan_private * priv, struct ifreq *req) 498 - { 499 - int alg; 500 - struct iwreq *wrq = (struct iwreq *)req; 501 - wlan_adapter *adapter = priv->adapter; 502 - 503 - if (wrq->u.data.flags == 0) { 504 - //from iwpriv subcmd 505 - alg = SUBCMD_DATA(wrq); 506 - } else { 507 - //from wpa_supplicant subcmd 508 - if (copy_from_user(&alg, wrq->u.data.pointer, sizeof(alg))) { 509 - lbs_pr_debug(1, "Copy from user failed\n"); 510 - return -EFAULT; 511 - } 512 - } 513 - 514 - lbs_pr_debug(1, "auth alg is %#x\n", alg); 515 - 516 - switch (alg) { 517 - case AUTH_ALG_SHARED_KEY: 518 - adapter->secinfo.authmode = wlan802_11authmodeshared; 519 - break; 520 - case AUTH_ALG_NETWORK_EAP: 521 - adapter->secinfo.authmode = 522 - wlan802_11authmodenetworkEAP; 523 - break; 524 - case AUTH_ALG_OPEN_SYSTEM: 525 - default: 526 - adapter->secinfo.authmode = wlan802_11authmodeopen; 527 - break; 528 - } 529 - return 0; 530 - } 531 - 532 - /** 533 - * @brief Set 802.1x authentication mode 534 - * @param priv A pointer to wlan_private structure 535 - * @param req A pointer to ifreq structure 536 - * @return 0 --success, otherwise fail 537 - */ 538 - static int wlan_set8021xauthalg_ioctl(wlan_private * priv, struct ifreq *req) 539 - { 540 - int alg; 541 - struct iwreq *wrq = (struct iwreq *)req; 542 - 543 - if (wrq->u.data.flags == 0) { 544 - //from iwpriv subcmd 545 - alg = SUBCMD_DATA(wrq); 546 - } else { 547 - //from wpa_supplicant subcmd 548 - if (copy_from_user(&alg, wrq->u.data.pointer, sizeof(int))) { 549 - lbs_pr_debug(1, "Copy from user failed\n"); 550 - return -EFAULT; 551 - } 552 - } 553 - lbs_pr_debug(1, "802.1x auth alg is %#x\n", alg); 554 - priv->adapter->secinfo.auth1xalg = alg; 555 - return 0; 556 - } 557 - 558 - static int wlan_setencryptionmode_ioctl(wlan_private * priv, struct ifreq *req) 559 - { 560 - int mode; 561 - struct iwreq *wrq = (struct iwreq *)req; 562 - 563 - ENTER(); 564 - 565 - if (wrq->u.data.flags == 0) { 566 - //from iwpriv subcmd 567 - mode = SUBCMD_DATA(wrq); 568 - } else { 569 - //from wpa_supplicant subcmd 570 - if (copy_from_user(&mode, wrq->u.data.pointer, sizeof(int))) { 571 - lbs_pr_debug(1, "Copy from user failed\n"); 572 - return -EFAULT; 573 - } 574 - } 575 - lbs_pr_debug(1, "encryption mode is %#x\n", mode); 576 - priv->adapter->secinfo.Encryptionmode = mode; 577 - 578 - LEAVE(); 579 - return 0; 580 - } 581 - 582 - static void adjust_mtu(wlan_private * priv) 583 - { 584 - int mtu_increment = 0; 585 - 586 - if (priv->adapter->linkmode == WLAN_LINKMODE_802_11) 587 - mtu_increment += sizeof(struct ieee80211_hdr_4addr); 588 - 589 - if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) 590 - mtu_increment += max(sizeof(struct tx_radiotap_hdr), 591 - sizeof(struct rx_radiotap_hdr)); 592 - priv->wlan_dev.netdev->mtu = ETH_FRAME_LEN 593 - - sizeof(struct ethhdr) 594 - + mtu_increment; 595 - } 596 - 597 - /** 598 - * @brief Set Link-Layer Layer mode 599 - * @param priv A pointer to wlan_private structure 600 - * @param req A pointer to ifreq structure 601 - * @return 0 --success, otherwise fail 602 - */ 603 - static int wlan_set_linkmode_ioctl(wlan_private * priv, struct ifreq *req) 604 - { 605 - int mode; 606 - 607 - mode = (int)((struct ifreq *)((u8 *) req + 4))->ifr_data; 608 - 609 - switch (mode) { 610 - case WLAN_LINKMODE_802_3: 611 - priv->adapter->linkmode = mode; 612 - break; 613 - case WLAN_LINKMODE_802_11: 614 - priv->adapter->linkmode = mode; 615 - break; 616 - default: 617 - lbs_pr_info("usb8388-5: invalid link-layer mode (%#x)\n", 618 - mode); 619 - return -EINVAL; 620 - break; 621 - } 622 - lbs_pr_debug(1, "usb8388-5: link-layer mode is %#x\n", mode); 623 - 624 - adjust_mtu(priv); 625 - 626 - return 0; 627 - } 628 - 629 - /** 630 - * @brief Set Radio header mode 631 - * @param priv A pointer to wlan_private structure 632 - * @param req A pointer to ifreq structure 633 - * @return 0 --success, otherwise fail 634 - */ 635 - static int wlan_set_radiomode_ioctl(wlan_private * priv, struct ifreq *req) 636 - { 637 - int mode; 638 - 639 - mode = (int)((struct ifreq *)((u8 *) req + 4))->ifr_data; 640 - 641 - switch (mode) { 642 - case WLAN_RADIOMODE_NONE: 643 - priv->adapter->radiomode = mode; 644 - break; 645 - case WLAN_RADIOMODE_RADIOTAP: 646 - priv->adapter->radiomode = mode; 647 - break; 648 - default: 649 - lbs_pr_debug(1, "usb8388-5: invalid radio header mode (%#x)\n", 650 - mode); 651 - return -EINVAL; 652 - } 653 - lbs_pr_debug(1, "usb8388-5: radio-header mode is %#x\n", mode); 654 - 655 - adjust_mtu(priv); 656 - return 0; 657 - } 658 - 659 - /** 660 - * @brief Set Debug header mode 661 - * @param priv A pointer to wlan_private structure 662 - * @param req A pointer to ifreq structure 663 - * @return 0 --success, otherwise fail 664 - */ 665 - static int wlan_set_debugmode_ioctl(wlan_private * priv, struct ifreq *req) 666 - { 667 - priv->adapter->debugmode = (int)((struct ifreq *) 668 - ((u8 *) req + 4))->ifr_data; 669 - return 0; 670 - } 671 - 672 - static int wlan_subcmd_getrxantenna_ioctl(wlan_private * priv, 673 - struct ifreq *req) 674 - { 675 - int len; 676 - char buf[8]; 677 - struct iwreq *wrq = (struct iwreq *)req; 678 - 679 - lbs_pr_debug(1, "WLAN_SUBCMD_GETRXANTENNA\n"); 680 - len = getrxantenna(priv, buf); 681 - 682 - wrq->u.data.length = len; 683 - if (wrq->u.data.pointer) { 684 - if (copy_to_user(wrq->u.data.pointer, &buf, len)) { 685 - lbs_pr_debug(1, "CopyToUser failed\n"); 686 - return -EFAULT; 687 - } 688 - } 689 - 690 - return 0; 691 - } 692 - 693 - static int wlan_subcmd_gettxantenna_ioctl(wlan_private * priv, 694 - struct ifreq *req) 695 - { 696 - int len; 697 - char buf[8]; 698 - struct iwreq *wrq = (struct iwreq *)req; 699 - 700 - lbs_pr_debug(1, "WLAN_SUBCMD_GETTXANTENNA\n"); 701 - len = gettxantenna(priv, buf); 702 - 703 - wrq->u.data.length = len; 704 - if (wrq->u.data.pointer) { 705 - if (copy_to_user(wrq->u.data.pointer, &buf, len)) { 706 - lbs_pr_debug(1, "CopyToUser failed\n"); 707 - return -EFAULT; 708 - } 709 - } 710 - return 0; 711 - } 712 - 713 - /** 714 - * @brief Get the MAC TSF value from the firmware 715 - * 716 - * @param priv A pointer to wlan_private structure 717 - * @param wrq A pointer to iwreq structure containing buffer 718 - * space to store a TSF value retrieved from the firmware 719 - * 720 - * @return 0 if successful; IOCTL error code otherwise 721 - */ 722 - static int wlan_get_tsf_ioctl(wlan_private * priv, struct iwreq *wrq) 723 - { 724 - u64 tsfval; 725 - int ret; 726 - 727 - ret = libertas_prepare_and_send_command(priv, 728 - cmd_get_tsf, 729 - 0, cmd_option_waitforrsp, 0, &tsfval); 730 - 731 - lbs_pr_debug(1, "IOCTL: Get TSF = 0x%016llx\n", tsfval); 732 - 733 - if (ret != 0) { 734 - lbs_pr_debug(1, "IOCTL: Get TSF; command exec failed\n"); 735 - ret = -EFAULT; 736 - } else { 737 - if (copy_to_user(wrq->u.data.pointer, 738 - &tsfval, 739 - min_t(size_t, wrq->u.data.length, 740 - sizeof(tsfval))) != 0) { 741 - 742 - lbs_pr_debug(1, "IOCTL: Get TSF; Copy to user failed\n"); 743 - ret = -EFAULT; 744 - } else { 745 - ret = 0; 746 - } 747 - } 748 - return ret; 749 - } 750 - 751 - /** 752 - * @brief Get/Set adapt rate 753 - * @param priv A pointer to wlan_private structure 754 - * @param wrq A pointer to iwreq structure 755 - * @return 0 --success, otherwise fail 756 - */ 757 - static int wlan_adapt_rateset(wlan_private * priv, struct iwreq *wrq) 758 - { 759 - int ret; 760 - wlan_adapter *adapter = priv->adapter; 761 - int data[2]; 762 - 763 - memset(data, 0, sizeof(data)); 764 - if (!wrq->u.data.length) { 765 - lbs_pr_debug(1, "Get ADAPT RATE SET\n"); 766 - ret = libertas_prepare_and_send_command(priv, 767 - cmd_802_11_rate_adapt_rateset, 768 - cmd_act_get, 769 - cmd_option_waitforrsp, 0, NULL); 770 - data[0] = adapter->enablehwauto; 771 - data[1] = adapter->ratebitmap; 772 - if (copy_to_user(wrq->u.data.pointer, data, sizeof(int) * 2)) { 773 - lbs_pr_debug(1, "Copy to user failed\n"); 774 - return -EFAULT; 775 - } 776 - #define GET_TWO_INT 2 777 - wrq->u.data.length = GET_TWO_INT; 778 - } else { 779 - lbs_pr_debug(1, "Set ADAPT RATE SET\n"); 780 - if (wrq->u.data.length > 2) 781 - return -EINVAL; 782 - if (copy_from_user 783 - (data, wrq->u.data.pointer, 784 - sizeof(int) * wrq->u.data.length)) { 785 - lbs_pr_debug(1, "Copy from user failed\n"); 786 - return -EFAULT; 787 - } 788 - 789 - adapter->enablehwauto = data[0]; 790 - adapter->ratebitmap = data[1]; 791 - ret = libertas_prepare_and_send_command(priv, 792 - cmd_802_11_rate_adapt_rateset, 793 - cmd_act_set, 794 - cmd_option_waitforrsp, 0, NULL); 795 - } 796 - return ret; 797 - } 798 - 799 - /** 800 - * @brief Get/Set inactivity timeout 801 - * @param priv A pointer to wlan_private structure 802 - * @param wrq A pointer to iwreq structure 803 - * @return 0 --success, otherwise fail 804 - */ 805 - static int wlan_inactivity_timeout(wlan_private * priv, struct iwreq *wrq) 806 - { 807 - int ret; 808 - int data = 0; 809 - u16 timeout = 0; 810 - 811 - ENTER(); 812 - if (wrq->u.data.length > 1) 813 - return -ENOTSUPP; 814 - 815 - if (wrq->u.data.length == 0) { 816 - /* Get */ 817 - ret = libertas_prepare_and_send_command(priv, 818 - cmd_802_11_inactivity_timeout, 819 - cmd_act_get, 820 - cmd_option_waitforrsp, 0, 821 - &timeout); 822 - data = timeout; 823 - if (copy_to_user(wrq->u.data.pointer, &data, sizeof(int))) { 824 - lbs_pr_debug(1, "Copy to user failed\n"); 825 - return -EFAULT; 826 - } 827 - } else { 828 - /* Set */ 829 - if (copy_from_user(&data, wrq->u.data.pointer, sizeof(int))) { 830 - lbs_pr_debug(1, "Copy from user failed\n"); 831 - return -EFAULT; 832 - } 833 - 834 - timeout = data; 835 - ret = libertas_prepare_and_send_command(priv, 836 - cmd_802_11_inactivity_timeout, 837 - cmd_act_set, 838 - cmd_option_waitforrsp, 0, 839 - &timeout); 840 - } 841 - 842 - wrq->u.data.length = 1; 843 - 844 - LEAVE(); 845 - return ret; 846 - } 847 - 848 - static int wlan_do_getlog_ioctl(wlan_private * priv, struct iwreq *wrq) 849 - { 850 - int ret; 851 - char buf[GETLOG_BUFSIZE - 1]; 852 - wlan_adapter *adapter = priv->adapter; 853 - 854 - lbs_pr_debug(1, " GET STATS\n"); 855 - 856 - ret = libertas_prepare_and_send_command(priv, cmd_802_11_get_log, 857 - 0, cmd_option_waitforrsp, 0, NULL); 858 - 859 - if (ret) { 860 - return ret; 861 - } 862 - 863 - if (wrq->u.data.pointer) { 864 - sprintf(buf, "\n mcasttxframe %u failed %u retry %u " 865 - "multiretry %u framedup %u " 866 - "rtssuccess %u rtsfailure %u ackfailure %u\n" 867 - "rxfrag %u mcastrxframe %u fcserror %u " 868 - "txframe %u wepundecryptable %u ", 869 - adapter->logmsg.mcasttxframe, 870 - adapter->logmsg.failed, 871 - adapter->logmsg.retry, 872 - adapter->logmsg.multiretry, 873 - adapter->logmsg.framedup, 874 - adapter->logmsg.rtssuccess, 875 - adapter->logmsg.rtsfailure, 876 - adapter->logmsg.ackfailure, 877 - adapter->logmsg.rxfrag, 878 - adapter->logmsg.mcastrxframe, 879 - adapter->logmsg.fcserror, 880 - adapter->logmsg.txframe, 881 - adapter->logmsg.wepundecryptable); 882 - wrq->u.data.length = strlen(buf) + 1; 883 - if (copy_to_user(wrq->u.data.pointer, buf, wrq->u.data.length)) { 884 - lbs_pr_debug(1, "Copy to user failed\n"); 885 - return -EFAULT; 886 - } 887 - } 888 - 889 - return 0; 890 - } 891 - 892 - static int wlan_scan_type_ioctl(wlan_private * priv, struct iwreq *wrq) 893 - { 894 - u8 buf[12]; 895 - u8 *option[] = { "active", "passive", "get", }; 896 - int i, max_options = (sizeof(option) / sizeof(option[0])); 897 - int ret = 0; 898 - wlan_adapter *adapter = priv->adapter; 899 - 900 - if (priv->adapter->enable11d) { 901 - lbs_pr_debug(1, "11D: Cannot set scantype when 11D enabled\n"); 902 - return -EFAULT; 903 - } 904 - 905 - memset(buf, 0, sizeof(buf)); 906 - 907 - if (copy_from_user(buf, wrq->u.data.pointer, min_t(size_t, sizeof(buf), 908 - wrq->u.data.length))) 909 - return -EFAULT; 910 - 911 - lbs_pr_debug(1, "Scan type Option = %s\n", buf); 912 - 913 - buf[sizeof(buf) - 1] = '\0'; 914 - 915 - for (i = 0; i < max_options; i++) { 916 - if (!strcmp(buf, option[i])) 917 - break; 918 - } 919 - 920 - switch (i) { 921 - case 0: 922 - adapter->scantype = cmd_scan_type_active; 923 - break; 924 - case 1: 925 - adapter->scantype = cmd_scan_type_passive; 926 - break; 927 - case 2: 928 - wrq->u.data.length = strlen(option[adapter->scantype]) + 1; 929 - 930 - if (copy_to_user(wrq->u.data.pointer, 931 - option[adapter->scantype], 932 - wrq->u.data.length)) { 933 - lbs_pr_debug(1, "Copy to user failed\n"); 934 - ret = -EFAULT; 935 - } 936 - 937 - break; 938 - default: 939 - lbs_pr_debug(1, "Invalid Scan type Ioctl Option\n"); 940 - ret = -EINVAL; 941 - break; 942 - } 943 - 944 - return ret; 945 - } 946 - 947 - static int wlan_scan_mode_ioctl(wlan_private * priv, struct iwreq *wrq) 948 - { 949 - wlan_adapter *adapter = priv->adapter; 950 - u8 buf[12]; 951 - u8 *option[] = { "bss", "ibss", "any", "get" }; 952 - int i, max_options = (sizeof(option) / sizeof(option[0])); 953 - int ret = 0; 954 - 955 - ENTER(); 956 - 957 - memset(buf, 0, sizeof(buf)); 958 - 959 - if (copy_from_user(buf, wrq->u.data.pointer, min_t(size_t, sizeof(buf), 960 - wrq->u.data.length))) { 961 - lbs_pr_debug(1, "Copy from user failed\n"); 962 - return -EFAULT; 963 - } 964 - 965 - lbs_pr_debug(1, "Scan mode Option = %s\n", buf); 966 - 967 - buf[sizeof(buf) - 1] = '\0'; 968 - 969 - for (i = 0; i < max_options; i++) { 970 - if (!strcmp(buf, option[i])) 971 - break; 972 - } 973 - 974 - switch (i) { 975 - 976 - case 0: 977 - adapter->scanmode = cmd_bss_type_bss; 978 - break; 979 - case 1: 980 - adapter->scanmode = cmd_bss_type_ibss; 981 - break; 982 - case 2: 983 - adapter->scanmode = cmd_bss_type_any; 984 - break; 985 - case 3: 986 - 987 - wrq->u.data.length = strlen(option[adapter->scanmode - 1]) + 1; 988 - 989 - lbs_pr_debug(1, "Get Scan mode Option = %s\n", 990 - option[adapter->scanmode - 1]); 991 - 992 - lbs_pr_debug(1, "Scan mode length %d\n", wrq->u.data.length); 993 - 994 - if (copy_to_user(wrq->u.data.pointer, 995 - option[adapter->scanmode - 1], 996 - wrq->u.data.length)) { 997 - lbs_pr_debug(1, "Copy to user failed\n"); 998 - ret = -EFAULT; 999 - } 1000 - lbs_pr_debug(1, "GET Scan type Option after copy = %s\n", 1001 - (char *)wrq->u.data.pointer); 1002 - 1003 - break; 1004 - 1005 - default: 1006 - lbs_pr_debug(1, "Invalid Scan mode Ioctl Option\n"); 1007 - ret = -EINVAL; 1008 - break; 1009 - } 1010 - 1011 - LEAVE(); 1012 - return ret; 1013 - } 1014 - 1015 - /** 1016 - * @brief Get/Set Adhoc G Rate 1017 - * 1018 - * @param priv A pointer to wlan_private structure 1019 - * @param wrq A pointer to user data 1020 - * @return 0--success, otherwise fail 1021 - */ 1022 - static int wlan_do_set_grate_ioctl(wlan_private * priv, struct iwreq *wrq) 1023 - { 1024 - wlan_adapter *adapter = priv->adapter; 1025 - int data, data1; 1026 - int *val; 1027 - 1028 - ENTER(); 1029 - 1030 - data1 = SUBCMD_DATA(wrq); 1031 - switch (data1) { 1032 - case 0: 1033 - adapter->adhoc_grate_enabled = 0; 1034 - break; 1035 - case 1: 1036 - adapter->adhoc_grate_enabled = 1; 1037 - break; 1038 - case 2: 1039 - break; 1040 - default: 1041 - return -EINVAL; 1042 - } 1043 - data = adapter->adhoc_grate_enabled; 1044 - val = (int *)wrq->u.name; 1045 - *val = data; 1046 - LEAVE(); 1047 144 return 0; 1048 145 } 1049 146 ··· 680 1761 */ 681 1762 static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req) 682 1763 { 1764 + struct iwreq *wrq = (struct iwreq *)req; 683 1765 static struct cmd_ds_fwt_access fwt_access; 684 1766 int ret; 685 1767 ··· 696 1776 (void *)&fwt_access); 697 1777 698 1778 if (ret == 0) 699 - req->ifr_data = (char *)(le32_to_cpu(fwt_access.references)); 1779 + wrq->u.param.value = le32_to_cpu(fwt_access.references); 700 1780 else 701 1781 return -EFAULT; 702 1782 ··· 712 1792 */ 713 1793 static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req) 714 1794 { 1795 + struct iwreq *wrq = (struct iwreq *)req; 715 1796 static struct cmd_ds_fwt_access fwt_access; 716 1797 int ret; 717 1798 ··· 728 1807 (void *)&fwt_access); 729 1808 730 1809 if (ret == 0) 731 - req->ifr_data = (char *)(le32_to_cpu(fwt_access.references)); 1810 + wrq->u.param.value = le32_to_cpu(fwt_access.references); 732 1811 else 733 1812 return -EFAULT; 734 1813 ··· 744 1823 */ 745 1824 static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req) 746 1825 { 1826 + struct iwreq *wrq = (struct iwreq *)req; 747 1827 struct cmd_ds_mesh_access mesh_access; 748 1828 int ret; 749 1829 ··· 757 1835 cmd_option_waitforrsp, 0, 758 1836 (void *)&mesh_access); 759 1837 760 - if (ret == 0) { 761 - req->ifr_data = (char *)(le32_to_cpu(mesh_access.data[0])); 762 - } 1838 + if (ret == 0) 1839 + wrq->u.param.value = le32_to_cpu(mesh_access.data[0]); 763 1840 else 764 1841 return -EFAULT; 765 1842 ··· 819 1898 820 1899 lbs_pr_debug(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd); 821 1900 switch (cmd) { 822 - case WLANSCAN_TYPE: 823 - lbs_pr_debug(1, "Scan type Ioctl\n"); 824 - ret = wlan_scan_type_ioctl(priv, wrq); 825 - break; 826 - 827 1901 case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */ 828 1902 switch (wrq->u.data.flags) { 829 - case WLANDEAUTH: 830 - lbs_pr_debug(1, "Deauth\n"); 831 - libertas_send_deauth(priv); 832 - break; 833 - 834 - case WLANADHOCSTOP: 835 - lbs_pr_debug(1, "Adhoc stop\n"); 836 - ret = libertas_do_adhocstop_ioctl(priv); 837 - break; 838 - 839 - case WLANRADIOON: 840 - wlan_radio_ioctl(priv, 1); 841 - break; 842 - 843 - case WLANRADIOOFF: 844 - wlan_radio_ioctl(priv, 0); 845 - break; 846 - case WLANWLANIDLEON: 847 - libertas_idle_on(priv); 848 - break; 849 - case WLANWLANIDLEOFF: 850 - libertas_idle_off(priv); 851 - break; 852 1903 case WLAN_SUBCMD_BT_RESET: /* bt_reset */ 853 1904 wlan_bt_reset_ioctl(priv); 854 1905 break; ··· 830 1937 } /* End of switch */ 831 1938 break; 832 1939 833 - case WLANSETWPAIE: 834 - ret = wlan_setwpaie_ioctl(priv, req); 835 - break; 836 - case WLAN_SETINT_GETINT: 837 - /* The first 4 bytes of req->ifr_data is sub-ioctl number 838 - * after 4 bytes sits the payload. 839 - */ 840 - subcmd = (int)req->ifr_data; //from iwpriv subcmd 841 - switch (subcmd) { 842 - case WLANNF: 843 - ret = wlan_get_nf(priv, wrq); 844 - break; 845 - case WLANRSSI: 846 - ret = wlan_get_rssi(priv, wrq); 847 - break; 848 - case WLANENABLE11D: 849 - ret = libertas_cmd_enable_11d(priv, wrq); 850 - break; 851 - case WLANADHOCGRATE: 852 - ret = wlan_do_set_grate_ioctl(priv, wrq); 853 - break; 854 - case WLAN_SUBCMD_SET_PRESCAN: 855 - ret = wlan_subcmd_setprescan_ioctl(priv, wrq); 856 - break; 857 - } 858 - break; 859 - 860 - case WLAN_SETONEINT_GETONEINT: 861 - switch (wrq->u.data.flags) { 862 - case WLAN_BEACON_INTERVAL: 863 - ret = wlan_beacon_interval(priv, wrq); 864 - break; 865 - 866 - case WLAN_LISTENINTRVL: 867 - if (!wrq->u.data.length) { 868 - int data; 869 - lbs_pr_debug(1, "Get locallisteninterval value\n"); 870 - #define GET_ONE_INT 1 871 - data = adapter->locallisteninterval; 872 - if (copy_to_user(wrq->u.data.pointer, 873 - &data, sizeof(int))) { 874 - lbs_pr_debug(1, "Copy to user failed\n"); 875 - return -EFAULT; 876 - } 877 - 878 - wrq->u.data.length = GET_ONE_INT; 879 - } else { 880 - int data; 881 - if (copy_from_user 882 - (&data, wrq->u.data.pointer, sizeof(int))) { 883 - lbs_pr_debug(1, "Copy from user failed\n"); 884 - return -EFAULT; 885 - } 886 - 887 - lbs_pr_debug(1, "Set locallisteninterval = %d\n", 888 - data); 889 - #define MAX_U16_VAL 65535 890 - if (data > MAX_U16_VAL) { 891 - lbs_pr_debug(1, "Exceeds U16 value\n"); 892 - return -EINVAL; 893 - } 894 - adapter->locallisteninterval = data; 895 - } 896 - break; 897 - case WLAN_TXCONTROL: 898 - ret = wlan_txcontrol(priv, wrq); //adds for txcontrol ioctl 899 - break; 900 - 901 - case WLAN_NULLPKTINTERVAL: 902 - ret = wlan_null_pkt_interval(priv, wrq); 903 - break; 904 - 905 - default: 906 - ret = -EOPNOTSUPP; 907 - break; 908 - } 909 - break; 910 - 911 1940 case WLAN_SETONEINT_GETNONE: 912 1941 /* The first 4 bytes of req->ifr_data is sub-ioctl number 913 1942 * after 4 bytes sits the payload. 914 1943 */ 915 - subcmd = wrq->u.data.flags; //from wpa_supplicant subcmd 916 - 1944 + subcmd = wrq->u.data.flags; 917 1945 if (!subcmd) 918 - subcmd = (int)req->ifr_data; //from iwpriv subcmd 1946 + subcmd = (int)wrq->u.param.value; 919 1947 920 1948 switch (subcmd) { 921 - case WLAN_SUBCMD_SETRXANTENNA: /* SETRXANTENNA */ 922 - idata = SUBCMD_DATA(wrq); 923 - ret = setrxantenna(priv, idata); 924 - break; 925 - case WLAN_SUBCMD_SETTXANTENNA: /* SETTXANTENNA */ 926 - idata = SUBCMD_DATA(wrq); 927 - ret = settxantenna(priv, idata); 928 - break; 929 - case WLAN_SET_ATIM_WINDOW: 930 - adapter->atimwindow = SUBCMD_DATA(wrq); 931 - adapter->atimwindow = min_t(__u16, adapter->atimwindow, 50); 932 - break; 933 - case WLANSETBCNAVG: 934 - adapter->bcn_avg_factor = SUBCMD_DATA(wrq); 935 - if (adapter->bcn_avg_factor == 0) 936 - adapter->bcn_avg_factor = 937 - DEFAULT_BCN_AVG_FACTOR; 938 - if (adapter->bcn_avg_factor > DEFAULT_BCN_AVG_FACTOR) 939 - adapter->bcn_avg_factor = 940 - DEFAULT_BCN_AVG_FACTOR; 941 - break; 942 - case WLANSETDATAAVG: 943 - adapter->data_avg_factor = SUBCMD_DATA(wrq); 944 - if (adapter->data_avg_factor == 0) 945 - adapter->data_avg_factor = 946 - DEFAULT_DATA_AVG_FACTOR; 947 - if (adapter->data_avg_factor > DEFAULT_DATA_AVG_FACTOR) 948 - adapter->data_avg_factor = 949 - DEFAULT_DATA_AVG_FACTOR; 950 - break; 951 1949 case WLANSETREGION: 952 1950 idata = SUBCMD_DATA(wrq); 953 1951 ret = wlan_set_region(priv, (u16) idata); 954 1952 break; 955 - 956 - case WLAN_SET_LISTEN_INTERVAL: 957 - idata = SUBCMD_DATA(wrq); 958 - adapter->listeninterval = (u16) idata; 959 - break; 960 - 961 - case WLAN_SET_MULTIPLE_DTIM: 962 - ret = wlan_set_multiple_dtim_ioctl(priv, req); 963 - break; 964 - 965 - case WLANSETAUTHALG: 966 - ret = wlan_setauthalg_ioctl(priv, req); 967 - break; 968 - 969 - case WLANSET8021XAUTHALG: 970 - ret = wlan_set8021xauthalg_ioctl(priv, req); 971 - break; 972 - 973 - case WLANSETENCRYPTIONMODE: 974 - ret = wlan_setencryptionmode_ioctl(priv, req); 975 - break; 976 - 977 - case WLAN_SET_LINKMODE: 978 - ret = wlan_set_linkmode_ioctl(priv, req); 979 - break; 980 - 981 - case WLAN_SET_RADIOMODE: 982 - ret = wlan_set_radiomode_ioctl(priv, req); 983 - break; 984 - 985 - case WLAN_SET_DEBUGMODE: 986 - ret = wlan_set_debugmode_ioctl(priv, req); 987 - break; 988 - 989 1953 case WLAN_SUBCMD_MESH_SET_TTL: 990 1954 idata = SUBCMD_DATA(wrq); 991 1955 ret = wlan_mesh_set_ttl_ioctl(priv, idata); ··· 855 2105 856 2106 break; 857 2107 858 - case WLAN_SETNONE_GETTWELVE_CHAR: /* Get Antenna settings */ 859 - /* 860 - * We've not used IW_PRIV_TYPE_FIXED so sub-ioctl number is 861 - * in flags of iwreq structure, otherwise it will be in 862 - * mode member of iwreq structure. 863 - */ 864 - switch ((int)wrq->u.data.flags) { 865 - case WLAN_SUBCMD_GETRXANTENNA: /* Get Rx Antenna */ 866 - ret = wlan_subcmd_getrxantenna_ioctl(priv, req); 867 - break; 868 - 869 - case WLAN_SUBCMD_GETTXANTENNA: /* Get Tx Antenna */ 870 - ret = wlan_subcmd_gettxantenna_ioctl(priv, req); 871 - break; 872 - 873 - case WLAN_GET_TSF: 874 - ret = wlan_get_tsf_ioctl(priv, wrq); 875 - break; 876 - } 877 - break; 878 - 879 2108 case WLAN_SET128CHAR_GET128CHAR: 880 2109 switch ((int)wrq->u.data.flags) { 881 - 882 - case WLANSCAN_MODE: 883 - lbs_pr_debug(1, "Scan mode Ioctl\n"); 884 - ret = wlan_scan_mode_ioctl(priv, wrq); 885 - break; 886 - 887 - case WLAN_GET_ADHOC_STATUS: 888 - ret = wlan_get_adhoc_status_ioctl(priv, wrq); 889 - break; 890 2110 case WLAN_SUBCMD_BT_ADD: 891 2111 ret = wlan_bt_add_ioctl(priv, req); 892 2112 break; ··· 888 2168 break; 889 2169 890 2170 case WLAN_SETNONE_GETONEINT: 891 - switch ((int)req->ifr_data) { 892 - case WLANGETBCNAVG: 893 - pdata = (int *)wrq->u.name; 894 - *pdata = (int)adapter->bcn_avg_factor; 895 - break; 896 - 2171 + switch (wrq->u.param.value) { 897 2172 case WLANGETREGION: 898 2173 pdata = (int *)wrq->u.name; 899 2174 *pdata = (int)adapter->regioncode; 900 - break; 901 - 902 - case WLAN_GET_LISTEN_INTERVAL: 903 - pdata = (int *)wrq->u.name; 904 - *pdata = (int)adapter->listeninterval; 905 - break; 906 - 907 - case WLAN_GET_LINKMODE: 908 - req->ifr_data = (char *)((u32) adapter->linkmode); 909 - break; 910 - 911 - case WLAN_GET_RADIOMODE: 912 - req->ifr_data = (char *)((u32) adapter->radiomode); 913 - break; 914 - 915 - case WLAN_GET_DEBUGMODE: 916 - req->ifr_data = (char *)((u32) adapter->debugmode); 917 - break; 918 - 919 - case WLAN_GET_MULTIPLE_DTIM: 920 - pdata = (int *)wrq->u.name; 921 - *pdata = (int)adapter->multipledtim; 922 - break; 923 - case WLAN_GET_TX_RATE: 924 - ret = wlan_get_txrate_ioctl(priv, req); 925 2175 break; 926 2176 case WLAN_SUBCMD_FWT_CLEANUP: /* fwt_cleanup */ 927 2177 ret = wlan_fwt_cleanup_ioctl(priv, req); ··· 912 2222 913 2223 break; 914 2224 915 - case WLANGETLOG: 916 - ret = wlan_do_getlog_ioctl(priv, wrq); 917 - break; 918 - 919 2225 case WLAN_SET_GET_SIXTEEN_INT: 920 2226 switch ((int)wrq->u.data.flags) { 921 - case WLAN_TPCCFG: 922 - { 923 - int data[5]; 924 - struct cmd_ds_802_11_tpc_cfg cfg; 925 - memset(&cfg, 0, sizeof(cfg)); 926 - if ((wrq->u.data.length > 1) 927 - && (wrq->u.data.length != 5)) 928 - return -1; 929 - 930 - if (wrq->u.data.length == 0) { 931 - cfg.action = 932 - cpu_to_le16 933 - (cmd_act_get); 934 - } else { 935 - if (copy_from_user 936 - (data, wrq->u.data.pointer, 937 - sizeof(int) * 5)) { 938 - lbs_pr_debug(1, 939 - "Copy from user failed\n"); 940 - return -EFAULT; 941 - } 942 - 943 - cfg.action = 944 - cpu_to_le16 945 - (cmd_act_set); 946 - cfg.enable = data[0]; 947 - cfg.usesnr = data[1]; 948 - cfg.P0 = data[2]; 949 - cfg.P1 = data[3]; 950 - cfg.P2 = data[4]; 951 - } 952 - 953 - ret = 954 - libertas_prepare_and_send_command(priv, 955 - cmd_802_11_tpc_cfg, 956 - 0, 957 - cmd_option_waitforrsp, 958 - 0, (void *)&cfg); 959 - 960 - data[0] = cfg.enable; 961 - data[1] = cfg.usesnr; 962 - data[2] = cfg.P0; 963 - data[3] = cfg.P1; 964 - data[4] = cfg.P2; 965 - if (copy_to_user 966 - (wrq->u.data.pointer, data, 967 - sizeof(int) * 5)) { 968 - lbs_pr_debug(1, "Copy to user failed\n"); 969 - return -EFAULT; 970 - } 971 - 972 - wrq->u.data.length = 5; 973 - } 974 - break; 975 - 976 - case WLAN_POWERCFG: 977 - { 978 - int data[4]; 979 - struct cmd_ds_802_11_pwr_cfg cfg; 980 - memset(&cfg, 0, sizeof(cfg)); 981 - if ((wrq->u.data.length > 1) 982 - && (wrq->u.data.length != 4)) 983 - return -1; 984 - if (wrq->u.data.length == 0) { 985 - cfg.action = 986 - cpu_to_le16 987 - (cmd_act_get); 988 - } else { 989 - if (copy_from_user 990 - (data, wrq->u.data.pointer, 991 - sizeof(int) * 4)) { 992 - lbs_pr_debug(1, 993 - "Copy from user failed\n"); 994 - return -EFAULT; 995 - } 996 - 997 - cfg.action = 998 - cpu_to_le16 999 - (cmd_act_set); 1000 - cfg.enable = data[0]; 1001 - cfg.PA_P0 = data[1]; 1002 - cfg.PA_P1 = data[2]; 1003 - cfg.PA_P2 = data[3]; 1004 - } 1005 - ret = 1006 - libertas_prepare_and_send_command(priv, 1007 - cmd_802_11_pwr_cfg, 1008 - 0, 1009 - cmd_option_waitforrsp, 1010 - 0, (void *)&cfg); 1011 - data[0] = cfg.enable; 1012 - data[1] = cfg.PA_P0; 1013 - data[2] = cfg.PA_P1; 1014 - data[3] = cfg.PA_P2; 1015 - if (copy_to_user 1016 - (wrq->u.data.pointer, data, 1017 - sizeof(int) * 4)) { 1018 - lbs_pr_debug(1, "Copy to user failed\n"); 1019 - return -EFAULT; 1020 - } 1021 - 1022 - wrq->u.data.length = 4; 1023 - } 1024 - break; 1025 - case WLAN_AUTO_FREQ_SET: 1026 - { 1027 - int data[3]; 1028 - struct cmd_ds_802_11_afc afc; 1029 - memset(&afc, 0, sizeof(afc)); 1030 - if (wrq->u.data.length != 3) 1031 - return -1; 1032 - if (copy_from_user 1033 - (data, wrq->u.data.pointer, 1034 - sizeof(int) * 3)) { 1035 - lbs_pr_debug(1, "Copy from user failed\n"); 1036 - return -EFAULT; 1037 - } 1038 - afc.afc_auto = data[0]; 1039 - 1040 - if (afc.afc_auto != 0) { 1041 - afc.threshold = data[1]; 1042 - afc.period = data[2]; 1043 - } else { 1044 - afc.timing_offset = data[1]; 1045 - afc.carrier_offset = data[2]; 1046 - } 1047 - ret = 1048 - libertas_prepare_and_send_command(priv, 1049 - cmd_802_11_set_afc, 1050 - 0, 1051 - cmd_option_waitforrsp, 1052 - 0, (void *)&afc); 1053 - } 1054 - break; 1055 - case WLAN_AUTO_FREQ_GET: 1056 - { 1057 - int data[3]; 1058 - struct cmd_ds_802_11_afc afc; 1059 - memset(&afc, 0, sizeof(afc)); 1060 - ret = 1061 - libertas_prepare_and_send_command(priv, 1062 - cmd_802_11_get_afc, 1063 - 0, 1064 - cmd_option_waitforrsp, 1065 - 0, (void *)&afc); 1066 - data[0] = afc.afc_auto; 1067 - data[1] = afc.timing_offset; 1068 - data[2] = afc.carrier_offset; 1069 - if (copy_to_user 1070 - (wrq->u.data.pointer, data, 1071 - sizeof(int) * 3)) { 1072 - lbs_pr_debug(1, "Copy to user failed\n"); 1073 - return -EFAULT; 1074 - } 1075 - 1076 - wrq->u.data.length = 3; 1077 - } 1078 - break; 1079 - case WLAN_SCANPROBES: 1080 - { 1081 - int data; 1082 - if (wrq->u.data.length > 0) { 1083 - if (copy_from_user 1084 - (&data, wrq->u.data.pointer, 1085 - sizeof(int))) { 1086 - lbs_pr_debug(1, 1087 - "Copy from user failed\n"); 1088 - return -EFAULT; 1089 - } 1090 - 1091 - adapter->scanprobes = data; 1092 - } else { 1093 - data = adapter->scanprobes; 1094 - if (copy_to_user 1095 - (wrq->u.data.pointer, &data, 1096 - sizeof(int))) { 1097 - lbs_pr_debug(1, 1098 - "Copy to user failed\n"); 1099 - return -EFAULT; 1100 - } 1101 - } 1102 - wrq->u.data.length = 1; 1103 - } 1104 - break; 1105 2227 case WLAN_LED_GPIO_CTRL: 1106 2228 { 1107 2229 int i; ··· 977 2475 wrq->u.data.length = gpio->header.len; 978 2476 } 979 2477 break; 980 - case WLAN_ADAPT_RATESET: 981 - ret = wlan_adapt_rateset(priv, wrq); 982 - break; 983 - case WLAN_INACTIVITY_TIMEOUT: 984 - ret = wlan_inactivity_timeout(priv, wrq); 985 - break; 986 - case WLANSNR: 987 - ret = wlan_get_snr(priv, wrq); 988 - break; 989 - case WLAN_GET_RXINFO: 990 - ret = wlan_get_rxinfo(priv, wrq); 991 2478 } 992 2479 break; 993 2480
+34 -160
drivers/net/wireless/libertas/join.c
··· 15 15 #include "join.h" 16 16 #include "dev.h" 17 17 18 + #define AD_HOC_CAP_PRIVACY_ON 1 19 + 18 20 /** 19 21 * @brief This function finds out the common rates between rate1 and rate2. 20 22 * ··· 87 85 wlan_adapter *adapter = priv->adapter; 88 86 int ret = 0; 89 87 90 - if (adapter->inframode == wlan802_11infrastructure && 88 + if (adapter->mode == IW_MODE_INFRA && 91 89 adapter->connect_status == libertas_connected) 92 90 ret = libertas_send_deauthentication(priv); 93 - else 94 - ret = -ENOTSUPP; 95 - 96 - return ret; 97 - } 98 - 99 - int libertas_do_adhocstop_ioctl(wlan_private * priv) 100 - { 101 - wlan_adapter *adapter = priv->adapter; 102 - int ret = 0; 103 - 104 - if (adapter->inframode == wlan802_11ibss && 105 - adapter->connect_status == libertas_connected) 106 - ret = libertas_stop_adhoc_network(priv); 107 91 else 108 92 ret = -ENOTSUPP; 109 93 ··· 195 207 /* check if the requested SSID is already joined */ 196 208 if (adapter->curbssparams.ssid.ssidlength 197 209 && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid) 198 - && (adapter->curbssparams.bssdescriptor.inframode == 199 - wlan802_11ibss)) { 210 + && (adapter->mode == IW_MODE_ADHOC)) { 200 211 201 212 lbs_pr_debug(1, 202 213 "ADHOC_J_CMD: New ad-hoc SSID is the same as current, " ··· 248 261 } 249 262 250 263 /** 251 - * @brief Set Idle Off 252 - * 253 - * @param priv A pointer to wlan_private structure 254 - * @return 0 --success, otherwise fail 255 - */ 256 - int libertas_idle_off(wlan_private * priv) 257 - { 258 - wlan_adapter *adapter = priv->adapter; 259 - int ret = 0; 260 - const u8 zeromac[] = { 0, 0, 0, 0, 0, 0 }; 261 - int i; 262 - 263 - ENTER(); 264 - 265 - if (adapter->connect_status == libertas_disconnected) { 266 - if (adapter->inframode == wlan802_11infrastructure) { 267 - if (memcmp(adapter->previousbssid, zeromac, 268 - sizeof(zeromac)) != 0) { 269 - 270 - lbs_pr_debug(1, "Previous SSID = %s\n", 271 - adapter->previousssid.ssid); 272 - lbs_pr_debug(1, "Previous BSSID = " 273 - "%02x:%02x:%02x:%02x:%02x:%02x:\n", 274 - adapter->previousbssid[0], 275 - adapter->previousbssid[1], 276 - adapter->previousbssid[2], 277 - adapter->previousbssid[3], 278 - adapter->previousbssid[4], 279 - adapter->previousbssid[5]); 280 - 281 - i = libertas_find_SSID_in_list(adapter, 282 - &adapter->previousssid, 283 - adapter->previousbssid, 284 - adapter->inframode); 285 - 286 - if (i < 0) { 287 - libertas_send_specific_BSSID_scan(priv, 288 - adapter-> 289 - previousbssid, 290 - 1); 291 - i = libertas_find_SSID_in_list(adapter, 292 - &adapter-> 293 - previousssid, 294 - adapter-> 295 - previousbssid, 296 - adapter-> 297 - inframode); 298 - } 299 - 300 - if (i < 0) { 301 - /* If the BSSID could not be found, try just the SSID */ 302 - i = libertas_find_SSID_in_list(adapter, 303 - &adapter-> 304 - previousssid, NULL, 305 - adapter-> 306 - inframode); 307 - } 308 - 309 - if (i < 0) { 310 - libertas_send_specific_SSID_scan(priv, 311 - &adapter-> 312 - previousssid, 313 - 1); 314 - i = libertas_find_SSID_in_list(adapter, 315 - &adapter-> 316 - previousssid, NULL, 317 - adapter-> 318 - inframode); 319 - } 320 - 321 - if (i >= 0) { 322 - ret = 323 - wlan_associate(priv, 324 - &adapter-> 325 - scantable[i]); 326 - } 327 - } 328 - } else if (adapter->inframode == wlan802_11ibss) { 329 - ret = libertas_prepare_and_send_command(priv, 330 - cmd_802_11_ad_hoc_start, 331 - 0, 332 - cmd_option_waitforrsp, 333 - 0, &adapter->previousssid); 334 - } 335 - } 336 - /* else it is connected */ 337 - 338 - lbs_pr_debug(1, "\nwlanidle is off"); 339 - LEAVE(); 340 - return ret; 341 - } 342 - 343 - /** 344 - * @brief Set Idle On 345 - * 346 - * @param priv A pointer to wlan_private structure 347 - * @return 0 --success, otherwise fail 348 - */ 349 - int libertas_idle_on(wlan_private * priv) 350 - { 351 - wlan_adapter *adapter = priv->adapter; 352 - int ret = 0; 353 - 354 - if (adapter->connect_status == libertas_connected) { 355 - if (adapter->inframode == wlan802_11infrastructure) { 356 - lbs_pr_debug(1, "Previous SSID = %s\n", 357 - adapter->previousssid.ssid); 358 - memmove(&adapter->previousssid, 359 - &adapter->curbssparams.ssid, 360 - sizeof(struct WLAN_802_11_SSID)); 361 - libertas_send_deauth(priv); 362 - 363 - } else if (adapter->inframode == wlan802_11ibss) { 364 - ret = libertas_stop_adhoc_network(priv); 365 - } 366 - 367 - } 368 - 369 - lbs_pr_debug(1, "\nwlanidle is on"); 370 - 371 - return ret; 372 - } 373 - 374 - /** 375 264 * @brief This function prepares command of authenticate. 376 265 * 377 266 * @param priv A pointer to wlan_private structure ··· 261 398 void *pdata_buf) 262 399 { 263 400 wlan_adapter *adapter = priv->adapter; 264 - struct cmd_ds_802_11_authenticate *pauthenticate = 265 - &cmd->params.auth; 401 + struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth; 402 + int ret = -1; 266 403 u8 *bssid = pdata_buf; 267 404 268 405 cmd->command = cpu_to_le16(cmd_802_11_authenticate); 269 - cmd->size = 270 - cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate) 271 - + S_DS_GEN); 406 + cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate) 407 + + S_DS_GEN); 272 408 273 - pauthenticate->authtype = adapter->secinfo.authmode; 409 + /* translate auth mode to 802.11 defined wire value */ 410 + switch (adapter->secinfo.auth_mode) { 411 + case IW_AUTH_ALG_OPEN_SYSTEM: 412 + pauthenticate->authtype = 0x00; 413 + break; 414 + case IW_AUTH_ALG_SHARED_KEY: 415 + pauthenticate->authtype = 0x01; 416 + break; 417 + case IW_AUTH_ALG_LEAP: 418 + pauthenticate->authtype = 0x80; 419 + break; 420 + default: 421 + lbs_pr_debug(1, "AUTH_CMD: invalid auth alg 0x%X\n", 422 + adapter->secinfo.auth_mode); 423 + goto out; 424 + } 425 + 274 426 memcpy(pauthenticate->macaddr, bssid, ETH_ALEN); 275 427 276 428 lbs_pr_debug(1, "AUTH_CMD: Bssid is : %x:%x:%x:%x:%x:%x\n", 277 429 bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]); 430 + ret = 0; 278 431 279 - return 0; 432 + out: 433 + return ret; 280 434 } 281 435 282 436 int libertas_cmd_80211_deauthenticate(wlan_private * priv, ··· 430 550 lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len); 431 551 432 552 /* set IBSS field */ 433 - if (pbssdesc->inframode == wlan802_11infrastructure) { 553 + if (pbssdesc->mode == IW_MODE_INFRA) { 434 554 #define CAPINFO_ESS_MODE 1 435 555 passo->capinfo.ess = CAPINFO_ESS_MODE; 436 556 } ··· 504 624 505 625 /* set the BSS type */ 506 626 adhs->bsstype = cmd_bss_type_ibss; 507 - pbssdesc->inframode = wlan802_11ibss; 627 + pbssdesc->mode = IW_MODE_ADHOC; 508 628 adhs->beaconperiod = adapter->beaconperiod; 509 629 510 630 /* set Physical param set */ ··· 546 666 adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); 547 667 548 668 /* set up privacy in adapter->scantable[i] */ 549 - if (adapter->secinfo.WEPstatus == wlan802_11WEPenabled) { 550 - 551 - #define AD_HOC_CAP_PRIVACY_ON 1 552 - lbs_pr_debug(1, "ADHOC_S_CMD: WEPstatus set, privacy to WEP\n"); 669 + if (adapter->secinfo.wep_enabled) { 670 + lbs_pr_debug(1, "ADHOC_S_CMD: WEP enabled, setting privacy on\n"); 553 671 pbssdesc->privacy = wlan802_11privfilter8021xWEP; 554 672 adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON; 555 673 } else { 556 - lbs_pr_debug(1, "ADHOC_S_CMD: WEPstatus NOT set, Setting " 557 - "privacy to ACCEPT ALL\n"); 674 + lbs_pr_debug(1, "ADHOC_S_CMD: WEP disabled, setting privacy off\n"); 558 675 pbssdesc->privacy = wlan802_11privfilteracceptall; 559 676 } 560 677 ··· 663 786 padhocjoin->bssdescriptor.BSSID[5], 664 787 padhocjoin->bssdescriptor.SSID); 665 788 666 - lbs_pr_debug(1, "ADHOC_J_CMD: Data Rate = %x\n", 667 - (u32) padhocjoin->bssdescriptor.datarates); 668 - 669 789 /* failtimeout */ 670 790 padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); 671 791 ··· 706 832 padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow = 707 833 cpu_to_le16(pbssdesc->atimwindow); 708 834 709 - if (adapter->secinfo.WEPstatus == wlan802_11WEPenabled) { 835 + if (adapter->secinfo.wep_enabled) { 710 836 padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON; 711 837 } 712 838
-7
drivers/net/wireless/libertas/join.h
··· 1 - /* -*- mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ 2 - /* vi: set expandtab shiftwidth=4 tabstop=4 textwidth=78: */ 3 - 4 1 /** 5 2 * Interface for the wlan infrastructure and adhoc join routines 6 3 * ··· 37 40 extern int libertas_ret_80211_associate(wlan_private * priv, 38 41 struct cmd_ds_command *resp); 39 42 40 - extern int libertas_idle_on(wlan_private * priv); 41 - extern int libertas_idle_off(wlan_private * priv); 42 - 43 - extern int libertas_do_adhocstop_ioctl(wlan_private * priv); 44 43 extern int libertas_reassociation_thread(void *data); 45 44 46 45 struct WLAN_802_11_SSID;
+7
drivers/net/wireless/libertas/main.c
··· 21 21 #include "debugfs.h" 22 22 #include "assoc.h" 23 23 24 + #define DRIVER_RELEASE_VERSION "320.p0" 25 + const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION 26 + #ifdef DEBUG 27 + "-dbg" 28 + #endif 29 + ""; 30 + 24 31 #ifdef ENABLE_PM 25 32 static struct pm_dev *wlan_pm_dev = NULL; 26 33 #endif
+2 -2
drivers/net/wireless/libertas/rx.c
··· 210 210 goto done; 211 211 } 212 212 213 - lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %d = %d\n", 213 + lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n", 214 214 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); 215 215 216 216 lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr, ··· 364 364 priv->stats.rx_errors++; 365 365 } 366 366 367 - lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %d = %d\n", 367 + lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n", 368 368 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); 369 369 370 370 /* create the exported radio header */
+82 -121
drivers/net/wireless/libertas/scan.c
··· 1 - /* -*- mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ 2 - /* vi: set expandtab shiftwidth=4 tabstop=4 textwidth=78: */ 3 - 4 1 /** 5 2 * Functions implementing wlan scan IOCTL and firmware command APIs 6 3 * ··· 84 87 * 85 88 * @return Index in scantable, or error code if negative 86 89 */ 87 - static int is_network_compatible(wlan_adapter * adapter, int index, int mode) 90 + static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode) 88 91 { 89 92 ENTER(); 90 93 91 - if (adapter->scantable[index].inframode == mode) { 92 - if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 94 + if (adapter->scantable[index].mode == mode) { 95 + if ( !adapter->secinfo.wep_enabled 93 96 && !adapter->secinfo.WPAenabled 94 97 && !adapter->secinfo.WPA2enabled 95 - && adapter->scantable[index].wpa_supplicant.wpa_ie[0] != 96 - WPA_IE 97 - && adapter->scantable[index].wpa2_supplicant.wpa_ie[0] != 98 - WPA2_IE && adapter->secinfo.Encryptionmode == CIPHER_NONE 98 + && adapter->scantable[index].wpa_ie[0] != WPA_IE 99 + && adapter->scantable[index].rsn_ie[0] != WPA2_IE 99 100 && !adapter->scantable[index].privacy) { 100 101 /* no security */ 101 102 LEAVE(); 102 103 return index; 103 - } else if (adapter->secinfo.WEPstatus == wlan802_11WEPenabled 104 + } else if ( adapter->secinfo.wep_enabled 104 105 && !adapter->secinfo.WPAenabled 105 106 && !adapter->secinfo.WPA2enabled 106 107 && adapter->scantable[index].privacy) { 107 108 /* static WEP enabled */ 108 109 LEAVE(); 109 110 return index; 110 - } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 111 + } else if ( !adapter->secinfo.wep_enabled 111 112 && adapter->secinfo.WPAenabled 112 113 && !adapter->secinfo.WPA2enabled 113 - && (adapter->scantable[index].wpa_supplicant. 114 - wpa_ie[0] 115 - == WPA_IE) 114 + && (adapter->scantable[index].wpa_ie[0] == WPA_IE) 116 115 /* privacy bit may NOT be set in some APs like LinkSys WRT54G 117 116 && adapter->scantable[index].privacy */ 118 117 ) { 119 118 /* WPA enabled */ 120 - lbs_pr_debug(1, 119 + lbs_pr_debug(1, 121 120 "is_network_compatible() WPA: index=%d wpa_ie=%#x " 122 - "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " 121 + "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " 123 122 "privacy=%#x\n", index, 124 - adapter->scantable[index].wpa_supplicant. 125 - wpa_ie[0], 126 - adapter->scantable[index].wpa2_supplicant. 127 - wpa_ie[0], 128 - (adapter->secinfo.WEPstatus == 129 - wlan802_11WEPenabled) ? "e" : "d", 130 - (adapter->secinfo.WPAenabled) ? "e" : "d", 131 - (adapter->secinfo.WPA2enabled) ? "e" : "d", 132 - adapter->secinfo.Encryptionmode, 123 + adapter->scantable[index].wpa_ie[0], 124 + adapter->scantable[index].rsn_ie[0], 125 + adapter->secinfo.wep_enabled ? "e" : "d", 126 + adapter->secinfo.WPAenabled ? "e" : "d", 127 + adapter->secinfo.WPA2enabled ? "e" : "d", 133 128 adapter->scantable[index].privacy); 134 129 LEAVE(); 135 130 return index; 136 - } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 131 + } else if ( !adapter->secinfo.wep_enabled 137 132 && !adapter->secinfo.WPAenabled 138 133 && adapter->secinfo.WPA2enabled 139 - && (adapter->scantable[index].wpa2_supplicant. 140 - wpa_ie[0] 141 - == WPA2_IE) 134 + && (adapter->scantable[index].rsn_ie[0] == WPA2_IE) 142 135 /* privacy bit may NOT be set in some APs like LinkSys WRT54G 143 136 && adapter->scantable[index].privacy */ 144 137 ) { 145 138 /* WPA2 enabled */ 146 - lbs_pr_debug(1, 139 + lbs_pr_debug(1, 147 140 "is_network_compatible() WPA2: index=%d wpa_ie=%#x " 148 - "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " 141 + "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " 149 142 "privacy=%#x\n", index, 150 - adapter->scantable[index].wpa_supplicant. 151 - wpa_ie[0], 152 - adapter->scantable[index].wpa2_supplicant. 153 - wpa_ie[0], 154 - (adapter->secinfo.WEPstatus == 155 - wlan802_11WEPenabled) ? "e" : "d", 156 - (adapter->secinfo.WPAenabled) ? "e" : "d", 157 - (adapter->secinfo.WPA2enabled) ? "e" : "d", 158 - adapter->secinfo.Encryptionmode, 143 + adapter->scantable[index].wpa_ie[0], 144 + adapter->scantable[index].rsn_ie[0], 145 + adapter->secinfo.wep_enabled ? "e" : "d", 146 + adapter->secinfo.WPAenabled ? "e" : "d", 147 + adapter->secinfo.WPA2enabled ? "e" : "d", 159 148 adapter->scantable[index].privacy); 160 149 LEAVE(); 161 150 return index; 162 - } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 151 + } else if ( !adapter->secinfo.wep_enabled 163 152 && !adapter->secinfo.WPAenabled 164 153 && !adapter->secinfo.WPA2enabled 165 - && (adapter->scantable[index].wpa_supplicant. 166 - wpa_ie[0] 167 - != WPA_IE) 168 - && (adapter->scantable[index].wpa2_supplicant. 169 - wpa_ie[0] 170 - != WPA2_IE) 171 - && adapter->secinfo.Encryptionmode != CIPHER_NONE 154 + && (adapter->scantable[index].wpa_ie[0] != WPA_IE) 155 + && (adapter->scantable[index].rsn_ie[0] != WPA2_IE) 172 156 && adapter->scantable[index].privacy) { 173 157 /* dynamic WEP enabled */ 174 - lbs_pr_debug(1, 158 + lbs_pr_debug(1, 175 159 "is_network_compatible() dynamic WEP: index=%d " 176 - "wpa_ie=%#x wpa2_ie=%#x Encmode=%#x privacy=%#x\n", 160 + "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n", 177 161 index, 178 - adapter->scantable[index].wpa_supplicant. 179 - wpa_ie[0], 180 - adapter->scantable[index].wpa2_supplicant. 181 - wpa_ie[0], adapter->secinfo.Encryptionmode, 162 + adapter->scantable[index].wpa_ie[0], 163 + adapter->scantable[index].rsn_ie[0], 182 164 adapter->scantable[index].privacy); 183 165 LEAVE(); 184 166 return index; 185 167 } 186 168 187 169 /* security doesn't match */ 188 - lbs_pr_debug(1, 170 + lbs_pr_debug(1, 189 171 "is_network_compatible() FAILED: index=%d wpa_ie=%#x " 190 - "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x privacy=%#x\n", 172 + "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n", 191 173 index, 192 - adapter->scantable[index].wpa_supplicant.wpa_ie[0], 193 - adapter->scantable[index].wpa2_supplicant.wpa_ie[0], 194 - (adapter->secinfo.WEPstatus == 195 - wlan802_11WEPenabled) ? "e" : "d", 196 - (adapter->secinfo.WPAenabled) ? "e" : "d", 197 - (adapter->secinfo.WPA2enabled) ? "e" : "d", 198 - adapter->secinfo.Encryptionmode, 174 + adapter->scantable[index].wpa_ie[0], 175 + adapter->scantable[index].rsn_ie[0], 176 + adapter->secinfo.wep_enabled ? "e" : "d", 177 + adapter->secinfo.WPAenabled ? "e" : "d", 178 + adapter->secinfo.WPA2enabled ? "e" : "d", 199 179 adapter->scantable[index].privacy); 200 180 LEAVE(); 201 181 return -ECONNREFUSED; ··· 898 924 u8 founddatarateie; 899 925 int bytesleftforcurrentbeacon; 900 926 901 - struct WPA_SUPPLICANT *pwpa_supplicant; 902 - struct WPA_SUPPLICANT *pwpa2_supplicant; 903 927 struct IE_WPA *pIe; 904 928 const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 }; 905 929 ··· 933 961 *bytesleft -= beaconsize; 934 962 935 963 bytesleftforcurrentbeacon = beaconsize; 936 - 937 - pwpa_supplicant = &pBSSEntry->wpa_supplicant; 938 - pwpa2_supplicant = &pBSSEntry->wpa2_supplicant; 939 964 940 965 memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN); 941 966 lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n", ··· 996 1027 } 997 1028 998 1029 if (pcap->ibss == 1) { 999 - pBSSEntry->inframode = wlan802_11ibss; 1030 + pBSSEntry->mode = IW_MODE_ADHOC; 1000 1031 } else { 1001 - pBSSEntry->inframode = wlan802_11infrastructure; 1032 + pBSSEntry->mode = IW_MODE_INFRA; 1002 1033 } 1003 1034 1004 1035 /* process variable IE */ ··· 1085 1116 sizeof(pcountryinfo->countrycode) 1086 1117 || pcountryinfo->len > 254) { 1087 1118 lbs_pr_debug(1, "InterpretIE: 11D- Err " 1088 - "CountryInfo len =%d min=%d max=254\n", 1119 + "CountryInfo len =%d min=%zd max=254\n", 1089 1120 pcountryinfo->len, 1090 1121 sizeof(pcountryinfo->countrycode)); 1091 1122 LEAVE(); ··· 1129 1160 #define IE_ID_LEN_FIELDS_BYTES 2 1130 1161 pIe = (struct IE_WPA *)pcurrentptr; 1131 1162 1132 - if (!memcmp(pIe->oui, oui01, sizeof(oui01))) { 1133 - pwpa_supplicant->wpa_ie_len 1134 - = min_t(size_t, elemlen + IE_ID_LEN_FIELDS_BYTES, 1135 - sizeof(pwpa_supplicant->wpa_ie)); 1136 - memcpy(pwpa_supplicant->wpa_ie, 1137 - pcurrentptr, 1138 - pwpa_supplicant->wpa_ie_len); 1139 - lbs_dbg_hex("InterpretIE: Resp WPA_IE", 1140 - pwpa_supplicant->wpa_ie, elemlen); 1141 - } 1163 + if (memcmp(pIe->oui, oui01, sizeof(oui01))) 1164 + break; 1165 + 1166 + pBSSEntry->wpa_ie_len = min_t(size_t, 1167 + elemlen + IE_ID_LEN_FIELDS_BYTES, 1168 + sizeof(pBSSEntry->wpa_ie)); 1169 + memcpy(pBSSEntry->wpa_ie, pcurrentptr, 1170 + pBSSEntry->wpa_ie_len); 1171 + lbs_dbg_hex("InterpretIE: Resp WPA_IE", 1172 + pBSSEntry->wpa_ie, elemlen); 1142 1173 break; 1143 1174 case WPA2_IE: 1144 1175 pIe = (struct IE_WPA *)pcurrentptr; 1145 - pwpa2_supplicant->wpa_ie_len 1146 - = min_t(size_t, elemlen + IE_ID_LEN_FIELDS_BYTES, 1147 - sizeof(pwpa2_supplicant->wpa_ie)); 1148 - memcpy(pwpa2_supplicant->wpa_ie, 1149 - pcurrentptr, pwpa2_supplicant->wpa_ie_len); 1150 1176 1177 + pBSSEntry->rsn_ie_len = min_t(size_t, 1178 + elemlen + IE_ID_LEN_FIELDS_BYTES, 1179 + sizeof(pBSSEntry->rsn_ie)); 1180 + memcpy(pBSSEntry->rsn_ie, pcurrentptr, 1181 + pBSSEntry->rsn_ie_len); 1151 1182 lbs_dbg_hex("InterpretIE: Resp WPA2_IE", 1152 - pwpa2_supplicant->wpa_ie, elemlen); 1183 + pBSSEntry->rsn_ie, elemlen); 1153 1184 break; 1154 1185 case TIM: 1155 1186 break; ··· 1196 1227 * 1197 1228 * @return index in BSSID list, or error return code (< 0) 1198 1229 */ 1199 - int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode) 1230 + int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode) 1200 1231 { 1201 1232 int ret = -ENETUNREACH; 1202 1233 int i; ··· 1216 1247 for (i = 0; ret < 0 && i < adapter->numinscantable; i++) { 1217 1248 if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) { 1218 1249 switch (mode) { 1219 - case wlan802_11infrastructure: 1220 - case wlan802_11ibss: 1250 + case IW_MODE_INFRA: 1251 + case IW_MODE_ADHOC: 1221 1252 ret = is_network_compatible(adapter, i, mode); 1222 1253 break; 1223 1254 default: ··· 1241 1272 * @return index in BSSID list 1242 1273 */ 1243 1274 int libertas_find_SSID_in_list(wlan_adapter * adapter, 1244 - struct WLAN_802_11_SSID *ssid, u8 * bssid, int mode) 1275 + struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode) 1245 1276 { 1246 1277 int net = -ENETUNREACH; 1247 1278 u8 bestrssi = 0; ··· 1256 1287 !memcmp(adapter->scantable[i]. 1257 1288 macaddress, bssid, ETH_ALEN))) { 1258 1289 switch (mode) { 1259 - case wlan802_11infrastructure: 1260 - case wlan802_11ibss: 1290 + case IW_MODE_INFRA: 1291 + case IW_MODE_ADHOC: 1261 1292 j = is_network_compatible(adapter, i, mode); 1262 1293 1263 1294 if (j >= 0) { ··· 1280 1311 } 1281 1312 } 1282 1313 break; 1283 - case wlan802_11autounknown: 1314 + case IW_MODE_AUTO: 1284 1315 default: 1285 1316 if (SCAN_RSSI(adapter->scantable[i].rssi) 1286 1317 > bestrssi) { ··· 1307 1338 * 1308 1339 * @return index in BSSID list 1309 1340 */ 1310 - int libertas_find_best_SSID_in_list(wlan_adapter * adapter, 1311 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode) 1341 + int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode) 1312 1342 { 1313 1343 int bestnet = -ENETUNREACH; 1314 1344 u8 bestrssi = 0; ··· 1319 1351 1320 1352 for (i = 0; i < adapter->numinscantable; i++) { 1321 1353 switch (mode) { 1322 - case wlan802_11infrastructure: 1323 - case wlan802_11ibss: 1354 + case IW_MODE_INFRA: 1355 + case IW_MODE_ADHOC: 1324 1356 if (is_network_compatible(adapter, i, mode) >= 0) { 1325 1357 if (SCAN_RSSI(adapter->scantable[i].rssi) > 1326 1358 bestrssi) { ··· 1331 1363 } 1332 1364 } 1333 1365 break; 1334 - case wlan802_11autounknown: 1366 + case IW_MODE_AUTO: 1335 1367 default: 1336 1368 if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) { 1337 1369 bestrssi = ··· 1356 1388 */ 1357 1389 int libertas_find_best_network_SSID(wlan_private * priv, 1358 1390 struct WLAN_802_11_SSID *pSSID, 1359 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE preferred_mode, 1360 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE *out_mode) 1391 + u8 preferred_mode, u8 *out_mode) 1361 1392 { 1362 1393 wlan_adapter *adapter = priv->adapter; 1363 1394 int ret = 0; ··· 1381 1414 preqbssid = &adapter->scantable[i]; 1382 1415 memcpy(pSSID, &preqbssid->ssid, 1383 1416 sizeof(struct WLAN_802_11_SSID)); 1384 - *out_mode = preqbssid->inframode; 1417 + *out_mode = preqbssid->mode; 1385 1418 1386 1419 if (!pSSID->ssidlength) { 1387 1420 ret = -1; ··· 1551 1584 for (i = 0; i < adapter->numinscantable; i++) { 1552 1585 if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) { 1553 1586 lbs_pr_debug(1, "i=%d break out: current_ev=%p end_buf=%p " 1554 - "MAX_SCAN_CELL_SIZE=%d\n", 1587 + "MAX_SCAN_CELL_SIZE=%zd\n", 1555 1588 i, current_ev, end_buf, MAX_SCAN_CELL_SIZE); 1556 1589 break; 1557 1590 } ··· 1599 1632 1600 1633 //Add mode 1601 1634 iwe.cmd = SIOCGIWMODE; 1602 - iwe.u.mode = adapter->scantable[i].inframode + 1; 1635 + iwe.u.mode = adapter->scantable[i].mode; 1603 1636 iwe.len = IW_EV_UINT_LEN; 1604 1637 current_ev = 1605 1638 iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len); ··· 1633 1666 iwe.u.qual.noise = 1634 1667 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); 1635 1668 } 1636 - if ((adapter->inframode == wlan802_11ibss) && 1669 + if ((adapter->mode == IW_MODE_ADHOC) && 1637 1670 !libertas_SSID_cmp(&adapter->curbssparams.ssid, 1638 1671 &adapter->scantable[i].ssid) 1639 1672 && adapter->adhoccreate) { ··· 1698 1731 end_buf, &iwe, iwe.len); 1699 1732 1700 1733 } 1701 - if ((adapter->scantable[i].inframode == wlan802_11ibss) 1734 + if ((adapter->scantable[i].mode == IW_MODE_ADHOC) 1702 1735 && !libertas_SSID_cmp(&adapter->curbssparams.ssid, 1703 1736 &adapter->scantable[i].ssid) 1704 1737 && adapter->adhoccreate) { ··· 1712 1745 /* Add new value to event */ 1713 1746 current_val = current_ev + IW_EV_LCP_LEN; 1714 1747 1715 - if (adapter->scantable[i].wpa2_supplicant.wpa_ie[0] == WPA2_IE) { 1748 + if (adapter->scantable[i].rsn_ie[0] == WPA2_IE) { 1716 1749 memset(&iwe, 0, sizeof(iwe)); 1717 1750 memset(buf, 0, sizeof(buf)); 1718 - memcpy(buf, adapter->scantable[i]. 1719 - wpa2_supplicant.wpa_ie, 1720 - adapter->scantable[i].wpa2_supplicant. 1721 - wpa_ie_len); 1751 + memcpy(buf, adapter->scantable[i].rsn_ie, 1752 + adapter->scantable[i].rsn_ie_len); 1722 1753 iwe.cmd = IWEVGENIE; 1723 - iwe.u.data.length = adapter->scantable[i]. 1724 - wpa2_supplicant.wpa_ie_len; 1754 + iwe.u.data.length = adapter->scantable[i].rsn_ie_len; 1725 1755 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; 1726 1756 current_ev = iwe_stream_add_point(current_ev, end_buf, 1727 1757 &iwe, buf); 1728 1758 } 1729 - if (adapter->scantable[i].wpa_supplicant.wpa_ie[0] == WPA_IE) { 1759 + if (adapter->scantable[i].wpa_ie[0] == WPA_IE) { 1730 1760 memset(&iwe, 0, sizeof(iwe)); 1731 1761 memset(buf, 0, sizeof(buf)); 1732 - memcpy(buf, adapter->scantable[i]. 1733 - wpa_supplicant.wpa_ie, 1734 - adapter->scantable[i].wpa_supplicant. 1735 - wpa_ie_len); 1762 + memcpy(buf, adapter->scantable[i].wpa_ie, 1763 + adapter->scantable[i].wpa_ie_len); 1736 1764 iwe.cmd = IWEVGENIE; 1737 - iwe.u.data.length = adapter->scantable[i]. 1738 - wpa_supplicant.wpa_ie_len; 1765 + iwe.u.data.length = adapter->scantable[i].wpa_ie_len; 1739 1766 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; 1740 1767 current_ev = iwe_stream_add_point(current_ev, end_buf, 1741 1768 &iwe, buf);
+10 -12
drivers/net/wireless/libertas/scan.h
··· 1 - /* -*- mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ 2 - /* vi: set expandtab shiftwidth=4 tabstop=4 textwidth=78: */ 3 - 4 1 /** 5 2 * Interface for the wlan network scan routines 6 3 * ··· 7 10 #ifndef _WLAN_SCAN_H 8 11 #define _WLAN_SCAN_H 9 12 13 + #include <net/ieee80211.h> 10 14 #include "hostcmd.h" 11 15 12 16 /** ··· 153 155 154 156 u32 atimwindow; 155 157 156 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE inframode; 158 + u8 mode; 157 159 u8 libertas_supported_rates[WLAN_SUPPORTED_RATES]; 158 160 159 161 int extra_ie; ··· 168 170 169 171 struct ieeetypes_countryinfofullset countryinfo; 170 172 171 - struct WPA_SUPPLICANT wpa_supplicant; 172 - struct WPA_SUPPLICANT wpa2_supplicant; 173 - 173 + u8 wpa_ie[MAX_WPA_IE_LEN]; 174 + size_t wpa_ie_len; 175 + u8 rsn_ie[MAX_WPA_IE_LEN]; 176 + size_t rsn_ie_len; 174 177 }; 175 178 176 179 extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, 177 180 struct WLAN_802_11_SSID *ssid2); 178 181 extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid, 179 - u8 * bssid, int mode); 180 - int libertas_find_best_SSID_in_list(wlan_adapter * adapter, enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode); 181 - extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode); 182 + u8 * bssid, u8 mode); 183 + int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode); 184 + extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode); 182 185 183 186 int libertas_find_best_network_SSID(wlan_private * priv, 184 187 struct WLAN_802_11_SSID *pSSID, 185 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE preferred_mode, 186 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE *out_mode); 188 + u8 preferred_mode, u8 *out_mode); 187 189 188 190 extern int libertas_send_specific_SSID_scan(wlan_private * priv, 189 191 struct WLAN_802_11_SSID *prequestedssid,
+1 -1
drivers/net/wireless/libertas/tx.c
··· 78 78 min_t(unsigned int, skb->len, 100)); 79 79 80 80 if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { 81 - lbs_pr_debug(1, "Tx error: Bad skb length %d : %d\n", 81 + lbs_pr_debug(1, "Tx error: Bad skb length %d : %zd\n", 82 82 skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); 83 83 ret = -1; 84 84 goto done;
-7
drivers/net/wireless/libertas/version.h
··· 1 - #define DRIVER_RELEASE_VERSION "320.p0" 2 - const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION 3 - #ifdef DEBUG 4 - "-dbg" 5 - #endif 6 - ""; 7 - 8 1
+51 -397
drivers/net/wireless/libertas/wext.c
··· 17 17 #include "defs.h" 18 18 #include "dev.h" 19 19 #include "join.h" 20 - #include "version.h" 21 20 #include "wext.h" 22 21 #include "assoc.h" 23 22 ··· 232 233 233 234 // find out the BSSID that matches the current SSID 234 235 i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL, 235 - wlan802_11ibss); 236 + IW_MODE_ADHOC); 236 237 237 238 if (i >= 0) { 238 239 lbs_pr_debug(1, "SSID found at %d in List," ··· 315 316 ENTER(); 316 317 317 318 if (adapter->connect_status != libertas_connected) { 318 - if (adapter->inframode == wlan802_11infrastructure) { 319 - //Infra. mode 319 + if (adapter->mode == IW_MODE_INFRA) { 320 320 lbs_pr_debug(1, "Infra\n"); 321 321 k = copyrates(rates, k, libertas_supported_rates, 322 322 sizeof(libertas_supported_rates)); 323 323 } else { 324 - //ad-hoc mode 325 324 lbs_pr_debug(1, "Adhoc G\n"); 326 325 k = copyrates(rates, k, libertas_adhoc_rates_g, 327 326 sizeof(libertas_adhoc_rates_g)); ··· 583 586 584 587 ENTER(); 585 588 586 - switch (adapter->inframode) { 587 - case wlan802_11ibss: 588 - *uwrq = IW_MODE_ADHOC; 589 - break; 590 - 591 - case wlan802_11infrastructure: 592 - *uwrq = IW_MODE_INFRA; 593 - break; 594 - 595 - default: 596 - case wlan802_11autounknown: 597 - *uwrq = IW_MODE_AUTO; 598 - break; 599 - } 589 + *uwrq = adapter->mode; 600 590 601 591 LEAVE(); 602 592 return 0; ··· 986 1002 /* 987 1003 * { cmd, set_args, get_args, name } 988 1004 */ 989 - { 990 - WLANSCAN_TYPE, 991 - IW_PRIV_TYPE_CHAR | 8, 992 - IW_PRIV_TYPE_CHAR | 8, 993 - "scantype"}, 994 - 995 - { 996 - WLAN_SETINT_GETINT, 997 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 998 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 999 - ""}, 1000 - { 1001 - WLANNF, 1002 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1003 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1004 - "getNF"}, 1005 - { 1006 - WLANRSSI, 1007 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1008 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1009 - "getRSSI"}, 1010 - { 1011 - WLANENABLE11D, 1012 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1013 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1014 - "enable11d"}, 1015 - { 1016 - WLANADHOCGRATE, 1017 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1018 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1019 - "adhocgrate"}, 1020 - 1021 - { 1022 - WLAN_SUBCMD_SET_PRESCAN, 1023 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1024 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1025 - "prescan"}, 1026 - { 1027 - WLAN_SETONEINT_GETONEINT, 1028 - IW_PRIV_TYPE_INT | 1, 1029 - IW_PRIV_TYPE_INT | 1, 1030 - ""}, 1031 - { 1032 - WLAN_BEACON_INTERVAL, 1033 - IW_PRIV_TYPE_INT | 1, 1034 - IW_PRIV_TYPE_INT | 1, 1035 - "bcninterval"}, 1036 - { 1037 - WLAN_LISTENINTRVL, 1038 - IW_PRIV_TYPE_INT | 1, 1039 - IW_PRIV_TYPE_INT | 1, 1040 - "lolisteninter"}, 1041 - { 1042 - WLAN_TXCONTROL, 1043 - IW_PRIV_TYPE_INT | 1, 1044 - IW_PRIV_TYPE_INT | 1, 1045 - "txcontrol"}, 1046 - { 1047 - WLAN_NULLPKTINTERVAL, 1048 - IW_PRIV_TYPE_INT | 1, 1049 - IW_PRIV_TYPE_INT | 1, 1050 - "psnullinterval"}, 1051 1005 /* Using iwpriv sub-command feature */ 1052 1006 { 1053 1007 WLAN_SETONEINT_GETNONE, /* IOCTL: 24 */ 1054 1008 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1055 1009 IW_PRIV_TYPE_NONE, 1056 1010 ""}, 1057 - 1058 - { 1059 - WLAN_SUBCMD_SETRXANTENNA, 1060 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1061 - IW_PRIV_TYPE_NONE, 1062 - "setrxant"}, 1063 - { 1064 - WLAN_SUBCMD_SETTXANTENNA, 1065 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1066 - IW_PRIV_TYPE_NONE, 1067 - "settxant"}, 1068 - { 1069 - WLANSETAUTHALG, 1070 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1071 - IW_PRIV_TYPE_NONE, 1072 - "authalgs", 1073 - }, 1074 - { 1075 - WLANSET8021XAUTHALG, 1076 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1077 - IW_PRIV_TYPE_NONE, 1078 - "8021xauthalgs", 1079 - }, 1080 - { 1081 - WLANSETENCRYPTIONMODE, 1082 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1083 - IW_PRIV_TYPE_NONE, 1084 - "encryptionmode", 1085 - }, 1086 1011 { 1087 1012 WLANSETREGION, 1088 1013 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1089 1014 IW_PRIV_TYPE_NONE, 1090 1015 "setregioncode"}, 1091 - { 1092 - WLAN_SET_LISTEN_INTERVAL, 1093 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1094 - IW_PRIV_TYPE_NONE, 1095 - "setlisteninter"}, 1096 - { 1097 - WLAN_SET_MULTIPLE_DTIM, 1098 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1099 - IW_PRIV_TYPE_NONE, 1100 - "setmultipledtim"}, 1101 - { 1102 - WLAN_SET_ATIM_WINDOW, 1103 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1104 - IW_PRIV_TYPE_NONE, 1105 - "atimwindow"}, 1106 - { 1107 - WLANSETBCNAVG, 1108 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1109 - IW_PRIV_TYPE_NONE, 1110 - "setbcnavg"}, 1111 - { 1112 - WLANSETDATAAVG, 1113 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1114 - IW_PRIV_TYPE_NONE, 1115 - "setdataavg"}, 1116 - { 1117 - WLAN_SET_LINKMODE, 1118 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1119 - IW_PRIV_TYPE_NONE, 1120 - "linkmode"}, 1121 - { 1122 - WLAN_SET_RADIOMODE, 1123 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1124 - IW_PRIV_TYPE_NONE, 1125 - "radiomode"}, 1126 - { 1127 - WLAN_SET_DEBUGMODE, 1128 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1129 - IW_PRIV_TYPE_NONE, 1130 - "debugmode"}, 1131 1016 { 1132 1017 WLAN_SUBCMD_MESH_SET_TTL, 1133 1018 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, ··· 1013 1160 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1014 1161 "getregioncode"}, 1015 1162 { 1016 - WLAN_GET_LISTEN_INTERVAL, 1017 - IW_PRIV_TYPE_NONE, 1018 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1019 - "getlisteninter"}, 1020 - { 1021 - WLAN_GET_MULTIPLE_DTIM, 1022 - IW_PRIV_TYPE_NONE, 1023 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1024 - "getmultipledtim"}, 1025 - { 1026 - WLAN_GET_TX_RATE, 1027 - IW_PRIV_TYPE_NONE, 1028 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1029 - "gettxrate"}, 1030 - { 1031 - WLANGETBCNAVG, 1032 - IW_PRIV_TYPE_NONE, 1033 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1034 - "getbcnavg"}, 1035 - { 1036 - WLAN_GET_LINKMODE, 1037 - IW_PRIV_TYPE_NONE, 1038 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1039 - "get_linkmode"}, 1040 - { 1041 - WLAN_GET_RADIOMODE, 1042 - IW_PRIV_TYPE_NONE, 1043 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1044 - "get_radiomode"}, 1045 - { 1046 - WLAN_GET_DEBUGMODE, 1047 - IW_PRIV_TYPE_NONE, 1048 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1049 - "get_debugmode"}, 1050 - { 1051 1163 WLAN_SUBCMD_FWT_CLEANUP, 1052 1164 IW_PRIV_TYPE_NONE, 1053 1165 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, ··· 1028 1210 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1029 1211 "mesh_get_ttl"}, 1030 1212 { 1031 - WLAN_SETNONE_GETTWELVE_CHAR, 1032 - IW_PRIV_TYPE_NONE, 1033 - IW_PRIV_TYPE_CHAR | 12, 1034 - ""}, 1035 - { 1036 - WLAN_SUBCMD_GETRXANTENNA, 1037 - IW_PRIV_TYPE_NONE, 1038 - IW_PRIV_TYPE_CHAR | 12, 1039 - "getrxant"}, 1040 - { 1041 - WLAN_SUBCMD_GETTXANTENNA, 1042 - IW_PRIV_TYPE_NONE, 1043 - IW_PRIV_TYPE_CHAR | 12, 1044 - "gettxant"}, 1045 - { 1046 - WLAN_GET_TSF, 1047 - IW_PRIV_TYPE_NONE, 1048 - IW_PRIV_TYPE_CHAR | 12, 1049 - "gettsf"}, 1050 - { 1051 1213 WLAN_SETNONE_GETNONE, 1052 1214 IW_PRIV_TYPE_NONE, 1053 1215 IW_PRIV_TYPE_NONE, 1054 1216 ""}, 1055 - { 1056 - WLANDEAUTH, 1057 - IW_PRIV_TYPE_NONE, 1058 - IW_PRIV_TYPE_NONE, 1059 - "deauth"}, 1060 - { 1061 - WLANADHOCSTOP, 1062 - IW_PRIV_TYPE_NONE, 1063 - IW_PRIV_TYPE_NONE, 1064 - "adhocstop"}, 1065 - { 1066 - WLANRADIOON, 1067 - IW_PRIV_TYPE_NONE, 1068 - IW_PRIV_TYPE_NONE, 1069 - "radioon"}, 1070 - { 1071 - WLANRADIOOFF, 1072 - IW_PRIV_TYPE_NONE, 1073 - IW_PRIV_TYPE_NONE, 1074 - "radiooff"}, 1075 - { 1076 - WLANWLANIDLEON, 1077 - IW_PRIV_TYPE_NONE, 1078 - IW_PRIV_TYPE_NONE, 1079 - "wlanidle-on"}, 1080 - { 1081 - WLANWLANIDLEOFF, 1082 - IW_PRIV_TYPE_NONE, 1083 - IW_PRIV_TYPE_NONE, 1084 - "wlanidle-off"}, 1085 1217 { 1086 1218 WLAN_SUBCMD_FWT_RESET, 1087 1219 IW_PRIV_TYPE_NONE, ··· 1095 1327 IW_PRIV_TYPE_CHAR | 128, 1096 1328 "fwt_list_route"}, 1097 1329 { 1098 - WLANSCAN_MODE, 1099 - IW_PRIV_TYPE_CHAR | 128, 1100 - IW_PRIV_TYPE_CHAR | 128, 1101 - "scanmode"}, 1102 - { 1103 - WLAN_GET_ADHOC_STATUS, 1104 - IW_PRIV_TYPE_CHAR | 128, 1105 - IW_PRIV_TYPE_CHAR | 128, 1106 - "getadhocstatus"}, 1107 - { 1108 - WLAN_SETNONE_GETWORDCHAR, 1109 - IW_PRIV_TYPE_NONE, 1110 - IW_PRIV_TYPE_CHAR | 128, 1111 - ""}, 1112 - { 1113 - WLANSETWPAIE, 1114 - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 24, 1115 - IW_PRIV_TYPE_NONE, 1116 - "setwpaie"}, 1117 - { 1118 - WLANGETLOG, 1119 - IW_PRIV_TYPE_NONE, 1120 - IW_PRIV_TYPE_CHAR | GETLOG_BUFSIZE, 1121 - "getlog"}, 1122 - { 1123 1330 WLAN_SET_GET_SIXTEEN_INT, 1124 1331 IW_PRIV_TYPE_INT | 16, 1125 1332 IW_PRIV_TYPE_INT | 16, 1126 1333 ""}, 1127 1334 { 1128 - WLAN_TPCCFG, 1129 - IW_PRIV_TYPE_INT | 16, 1130 - IW_PRIV_TYPE_INT | 16, 1131 - "tpccfg"}, 1132 - { 1133 - WLAN_POWERCFG, 1134 - IW_PRIV_TYPE_INT | 16, 1135 - IW_PRIV_TYPE_INT | 16, 1136 - "powercfg"}, 1137 - { 1138 - WLAN_AUTO_FREQ_SET, 1139 - IW_PRIV_TYPE_INT | 16, 1140 - IW_PRIV_TYPE_INT | 16, 1141 - "setafc"}, 1142 - { 1143 - WLAN_AUTO_FREQ_GET, 1144 - IW_PRIV_TYPE_INT | 16, 1145 - IW_PRIV_TYPE_INT | 16, 1146 - "getafc"}, 1147 - { 1148 - WLAN_SCANPROBES, 1149 - IW_PRIV_TYPE_INT | 16, 1150 - IW_PRIV_TYPE_INT | 16, 1151 - "scanprobes"}, 1152 - { 1153 1335 WLAN_LED_GPIO_CTRL, 1154 1336 IW_PRIV_TYPE_INT | 16, 1155 1337 IW_PRIV_TYPE_INT | 16, 1156 1338 "ledgpio"}, 1157 - { 1158 - WLAN_ADAPT_RATESET, 1159 - IW_PRIV_TYPE_INT | 16, 1160 - IW_PRIV_TYPE_INT | 16, 1161 - "rateadapt"}, 1162 - { 1163 - WLAN_INACTIVITY_TIMEOUT, 1164 - IW_PRIV_TYPE_INT | 16, 1165 - IW_PRIV_TYPE_INT | 16, 1166 - "inactivityto"}, 1167 - { 1168 - WLANSNR, 1169 - IW_PRIV_TYPE_INT | 16, 1170 - IW_PRIV_TYPE_INT | 16, 1171 - "getSNR"}, 1172 - { 1173 - WLAN_GET_RATE, 1174 - IW_PRIV_TYPE_INT | 16, 1175 - IW_PRIV_TYPE_INT | 16, 1176 - "getrate"}, 1177 - { 1178 - WLAN_GET_RXINFO, 1179 - IW_PRIV_TYPE_INT | 16, 1180 - IW_PRIV_TYPE_INT | 16, 1181 - "getrxinfo"}, 1182 1339 }; 1183 1340 1184 1341 static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) ··· 1127 1434 1128 1435 ENTER(); 1129 1436 1130 - priv->wstats.status = adapter->inframode; 1437 + priv->wstats.status = adapter->mode; 1131 1438 1132 1439 /* If we're not associated, all quality values are meaningless */ 1133 1440 if (adapter->connect_status != libertas_connected) ··· 1261 1568 if (!cfp) { 1262 1569 rc = -EINVAL; 1263 1570 } else { 1264 - if (adapter->inframode == wlan802_11ibss) { 1571 + if (adapter->mode == IW_MODE_ADHOC) { 1265 1572 rc = changeadhocchannel(priv, channel); 1266 1573 /* If station is WEP enabled, send the 1267 1574 * command to set WEP in firmware 1268 1575 */ 1269 - if (adapter->secinfo.WEPstatus == 1270 - wlan802_11WEPenabled) { 1576 + if (adapter->secinfo.wep_enabled) { 1271 1577 lbs_pr_debug(1, "set_freq: WEP enabled\n"); 1272 1578 ret = libertas_prepare_and_send_command(priv, 1273 1579 cmd_802_11_set_wep, ··· 1408 1716 wlan_private *priv = dev->priv; 1409 1717 wlan_adapter *adapter = priv->adapter; 1410 1718 struct assoc_request * assoc_req; 1411 - enum WLAN_802_11_NETWORK_INFRASTRUCTURE new_mode; 1412 1719 1413 1720 ENTER(); 1414 1721 1415 - switch (*uwrq) { 1416 - case IW_MODE_ADHOC: 1417 - lbs_pr_debug(1, "Wanted mode is ad-hoc: current datarate=%#x\n", 1418 - adapter->datarate); 1419 - new_mode = wlan802_11ibss; 1420 - adapter->adhocchannel = DEFAULT_AD_HOC_CHANNEL; 1421 - break; 1422 - 1423 - case IW_MODE_INFRA: 1424 - lbs_pr_debug(1, "Wanted mode is Infrastructure\n"); 1425 - new_mode = wlan802_11infrastructure; 1426 - break; 1427 - 1428 - case IW_MODE_AUTO: 1429 - lbs_pr_debug(1, "Wanted mode is Auto\n"); 1430 - new_mode = wlan802_11autounknown; 1431 - break; 1432 - 1433 - default: 1434 - lbs_pr_debug(1, "Wanted mode is Unknown: 0x%x\n", *uwrq); 1435 - return -EINVAL; 1722 + if ( (*uwrq != IW_MODE_ADHOC) 1723 + && (*uwrq != IW_MODE_INFRA) 1724 + && (*uwrq != IW_MODE_AUTO)) { 1725 + lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq); 1726 + ret = -EINVAL; 1727 + goto out; 1436 1728 } 1437 1729 1438 1730 mutex_lock(&adapter->lock); 1439 1731 assoc_req = wlan_get_association_request(adapter); 1440 1732 if (!assoc_req) { 1441 1733 ret = -ENOMEM; 1734 + wlan_cancel_association_work(priv); 1442 1735 } else { 1443 - assoc_req->mode = new_mode; 1444 - } 1445 - 1446 - if (ret == 0) { 1736 + assoc_req->mode = *uwrq; 1447 1737 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); 1448 1738 wlan_postpone_association_work(priv); 1449 - } else { 1450 - wlan_cancel_association_work(priv); 1739 + lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq); 1451 1740 } 1452 1741 mutex_unlock(&adapter->lock); 1453 1742 1743 + out: 1454 1744 LEAVE(); 1455 1745 return ret; 1456 1746 } ··· 1463 1789 dwrq->flags = 0; 1464 1790 1465 1791 /* Authentication method */ 1466 - switch (adapter->secinfo.authmode) { 1467 - case wlan802_11authmodeopen: 1792 + switch (adapter->secinfo.auth_mode) { 1793 + case IW_AUTH_ALG_OPEN_SYSTEM: 1468 1794 dwrq->flags = IW_ENCODE_OPEN; 1469 1795 break; 1470 1796 1471 - case wlan802_11authmodeshared: 1472 - case wlan802_11authmodenetworkEAP: 1797 + case IW_AUTH_ALG_SHARED_KEY: 1798 + case IW_AUTH_ALG_LEAP: 1473 1799 dwrq->flags = IW_ENCODE_RESTRICTED; 1474 1800 break; 1475 1801 default: ··· 1477 1803 break; 1478 1804 } 1479 1805 1480 - if ((adapter->secinfo.WEPstatus == wlan802_11WEPenabled) 1481 - || adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) { 1806 + if ( adapter->secinfo.wep_enabled 1807 + || adapter->secinfo.WPAenabled 1808 + || adapter->secinfo.WPA2enabled) { 1482 1809 dwrq->flags &= ~IW_ENCODE_DISABLED; 1483 1810 } else { 1484 1811 dwrq->flags |= IW_ENCODE_DISABLED; ··· 1493 1818 if (index < 0) 1494 1819 index = adapter->wep_tx_keyidx; 1495 1820 1496 - if ((adapter->wep_keys[index].len) && 1497 - (adapter->secinfo.WEPstatus == wlan802_11WEPenabled)) { 1821 + if ((adapter->wep_keys[index].len) && adapter->secinfo.wep_enabled) { 1498 1822 memcpy(extra, adapter->wep_keys[index].key, 1499 1823 adapter->wep_keys[index].len); 1500 1824 dwrq->length = adapter->wep_keys[index].len; ··· 1577 1903 assoc_req->wep_tx_keyidx = index; 1578 1904 } 1579 1905 1580 - assoc_req->secinfo.WEPstatus = wlan802_11WEPenabled; 1906 + assoc_req->secinfo.wep_enabled = 1; 1581 1907 1582 1908 LEAVE(); 1583 1909 return 0; ··· 1606 1932 int i; 1607 1933 1608 1934 /* Set Open System auth mode */ 1609 - assoc_req->secinfo.authmode = wlan802_11authmodeopen; 1935 + assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 1610 1936 1611 1937 /* Clear WEP keys and mark WEP as disabled */ 1612 - assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 1938 + assoc_req->secinfo.wep_enabled = 0; 1613 1939 for (i = 0; i < 4; i++) 1614 1940 assoc_req->wep_keys[i].len = 0; 1615 1941 ··· 1661 1987 /* If WEP isn't enabled, or if there is no key data but a valid 1662 1988 * index, set the TX key. 1663 1989 */ 1664 - if ((assoc_req->secinfo.WEPstatus != wlan802_11WEPenabled) 1665 - || (dwrq->length == 0 && !is_default)) 1990 + if (!assoc_req->secinfo.wep_enabled || (dwrq->length == 0 && !is_default)) 1666 1991 set_tx_key = 1; 1667 1992 1668 1993 ret = wlan_set_wep_key(assoc_req, extra, dwrq->length, index, set_tx_key); ··· 1674 2001 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); 1675 2002 1676 2003 if (dwrq->flags & IW_ENCODE_RESTRICTED) { 1677 - assoc_req->secinfo.authmode = wlan802_11authmodeshared; 2004 + assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; 1678 2005 } else if (dwrq->flags & IW_ENCODE_OPEN) { 1679 - assoc_req->secinfo.authmode = wlan802_11authmodeopen; 2006 + assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 1680 2007 } 1681 2008 1682 2009 out: ··· 1729 2056 1730 2057 if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY && 1731 2058 ext->alg != IW_ENCODE_ALG_WEP) { 1732 - if (index != 0 || adapter->inframode != wlan802_11infrastructure) 2059 + if (index != 0 || adapter->mode != IW_MODE_INFRA) 1733 2060 goto out; 1734 2061 } 1735 2062 1736 2063 dwrq->flags = index + 1; 1737 2064 memset(ext, 0, sizeof(*ext)); 1738 2065 1739 - if ((adapter->secinfo.WEPstatus == wlan802_11WEPdisabled) 1740 - && !adapter->secinfo.WPAenabled && !adapter->secinfo.WPA2enabled) { 2066 + if ( !adapter->secinfo.wep_enabled 2067 + && !adapter->secinfo.WPAenabled 2068 + && !adapter->secinfo.WPA2enabled) { 1741 2069 ext->alg = IW_ENCODE_ALG_NONE; 1742 2070 ext->key_len = 0; 1743 2071 dwrq->flags |= IW_ENCODE_DISABLED; 1744 2072 } else { 1745 2073 u8 *key = NULL; 1746 2074 1747 - if ((adapter->secinfo.WEPstatus == wlan802_11WEPenabled) 2075 + if ( adapter->secinfo.wep_enabled 1748 2076 && !adapter->secinfo.WPAenabled 1749 2077 && !adapter->secinfo.WPA2enabled) { 1750 2078 ext->alg = IW_ENCODE_ALG_WEP; 1751 2079 ext->key_len = adapter->wep_keys[index].len; 1752 2080 key = &adapter->wep_keys[index].key[0]; 1753 - } else if ((adapter->secinfo.WEPstatus == wlan802_11WEPdisabled) && 1754 - (adapter->secinfo.WPAenabled || 1755 - adapter->secinfo.WPA2enabled)) { 2081 + } else if ( !adapter->secinfo.wep_enabled 2082 + && (adapter->secinfo.WPAenabled || 2083 + adapter->secinfo.WPA2enabled)) { 1756 2084 /* WPA */ 1757 2085 ext->alg = IW_ENCODE_ALG_TKIP; 1758 2086 ext->key_len = 0; ··· 1823 2149 /* If WEP isn't enabled, or if there is no key data but a valid 1824 2150 * index, or if the set-TX-key flag was passed, set the TX key. 1825 2151 */ 1826 - if ((assoc_req->secinfo.WEPstatus != wlan802_11WEPenabled) 2152 + if ( !assoc_req->secinfo.wep_enabled 1827 2153 || (dwrq->length == 0 && !is_default) 1828 2154 || (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) 1829 2155 set_tx_key = 1; ··· 1835 2161 goto out; 1836 2162 1837 2163 if (dwrq->flags & IW_ENCODE_RESTRICTED) { 1838 - assoc_req->secinfo.authmode = 1839 - wlan802_11authmodeshared; 2164 + assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; 1840 2165 } else if (dwrq->flags & IW_ENCODE_OPEN) { 1841 - assoc_req->secinfo.authmode = 1842 - wlan802_11authmodeopen; 2166 + assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 1843 2167 } 1844 2168 1845 2169 /* Mark the various WEP bits as modified */ ··· 2022 2350 } 2023 2351 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { 2024 2352 assoc_req->secinfo.WPAenabled = 1; 2025 - assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 2026 - assoc_req->secinfo.authmode = 2027 - wlan802_11authmodeopen; 2353 + assoc_req->secinfo.wep_enabled = 0; 2354 + assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 2028 2355 } 2029 2356 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA2) { 2030 2357 assoc_req->secinfo.WPA2enabled = 1; 2031 - assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 2032 - assoc_req->secinfo.authmode = 2033 - wlan802_11authmodeopen; 2358 + assoc_req->secinfo.wep_enabled = 0; 2359 + assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 2034 2360 } 2035 2361 updated = 1; 2036 2362 break; ··· 2046 2376 2047 2377 case IW_AUTH_80211_AUTH_ALG: 2048 2378 if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) { 2049 - assoc_req->secinfo.authmode = 2050 - wlan802_11authmodeshared; 2379 + assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; 2051 2380 } else if (dwrq->value & IW_AUTH_ALG_OPEN_SYSTEM) { 2052 - assoc_req->secinfo.authmode = 2053 - wlan802_11authmodeopen; 2381 + assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 2054 2382 } else if (dwrq->value & IW_AUTH_ALG_LEAP) { 2055 - assoc_req->secinfo.authmode = 2056 - wlan802_11authmodenetworkEAP; 2383 + assoc_req->secinfo.auth_mode = IW_AUTH_ALG_LEAP; 2057 2384 } else { 2058 2385 ret = -EINVAL; 2059 2386 } ··· 2063 2396 !assoc_req->secinfo.WPA2enabled) { 2064 2397 assoc_req->secinfo.WPAenabled = 1; 2065 2398 assoc_req->secinfo.WPA2enabled = 1; 2066 - assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 2067 - assoc_req->secinfo.authmode = 2068 - wlan802_11authmodeopen; 2399 + assoc_req->secinfo.wep_enabled = 0; 2400 + assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 2069 2401 } 2070 2402 } else { 2071 2403 assoc_req->secinfo.WPAenabled = 0; ··· 2121 2455 break; 2122 2456 2123 2457 case IW_AUTH_80211_AUTH_ALG: 2124 - switch (adapter->secinfo.authmode) { 2125 - case wlan802_11authmodeshared: 2126 - dwrq->value = IW_AUTH_ALG_SHARED_KEY; 2127 - break; 2128 - case wlan802_11authmodeopen: 2129 - dwrq->value = IW_AUTH_ALG_OPEN_SYSTEM; 2130 - break; 2131 - case wlan802_11authmodenetworkEAP: 2132 - dwrq->value = IW_AUTH_ALG_LEAP; 2133 - break; 2134 - default: 2135 - break; 2136 - } 2458 + dwrq->value = adapter->secinfo.auth_mode; 2137 2459 break; 2138 2460 2139 2461 case IW_AUTH_WPA_ENABLED:
-85
drivers/net/wireless/libertas/wext.h
··· 10 10 /** PRIVATE CMD ID */ 11 11 #define WLANIOCTL SIOCIWFIRSTPRIV 12 12 13 - #define WLANSETWPAIE (WLANIOCTL + 0) 14 - 15 - #define WLAN_SETINT_GETINT (WLANIOCTL + 7) 16 - #define WLANNF 1 17 - #define WLANRSSI 2 18 - #define WLANENABLE11D 5 19 - #define WLANADHOCGRATE 6 20 - #define WLAN_SUBCMD_SET_PRESCAN 11 21 - 22 13 #define WLAN_SETNONE_GETNONE (WLANIOCTL + 8) 23 - #define WLANDEAUTH 1 24 - #define WLANRADIOON 2 25 - #define WLANRADIOOFF 3 26 - #define WLANREMOVEADHOCAES 4 27 - #define WLANADHOCSTOP 5 28 - #define WLANCIPHERTEST 6 29 - #define WLANCRYPTOTEST 7 30 - 31 - #define WLANWLANIDLEON 10 32 - #define WLANWLANIDLEOFF 11 33 14 #define WLAN_SUBCMD_BT_RESET 13 34 15 #define WLAN_SUBCMD_FWT_RESET 14 35 16 36 - #define WLANGETLOG (WLANIOCTL + 9) 37 - #define GETLOG_BUFSIZE 300 38 - 39 - #define WLANSCAN_TYPE (WLANIOCTL + 11) 40 - 41 17 #define WLAN_SETNONE_GETONEINT (WLANIOCTL + 15) 42 18 #define WLANGETREGION 1 43 - #define WLAN_GET_LISTEN_INTERVAL 2 44 - #define WLAN_GET_MULTIPLE_DTIM 3 45 - #define WLAN_GET_TX_RATE 4 46 - #define WLANGETBCNAVG 5 47 19 48 - #define WLAN_GET_LINKMODE 6 49 - #define WLAN_GET_RADIOMODE 7 50 - #define WLAN_GET_DEBUGMODE 8 51 20 #define WLAN_SUBCMD_FWT_CLEANUP 15 52 21 #define WLAN_SUBCMD_FWT_TIME 16 53 22 #define WLAN_SUBCMD_MESH_GET_TTL 17 54 23 55 - #define WLANREGCFRDWR (WLANIOCTL + 18) 56 - 57 - #define WLAN_SETNONE_GETTWELVE_CHAR (WLANIOCTL + 19) 58 - #define WLAN_SUBCMD_GETRXANTENNA 1 59 - #define WLAN_SUBCMD_GETTXANTENNA 2 60 - #define WLAN_GET_TSF 3 61 - 62 - #define WLAN_SETNONE_GETWORDCHAR (WLANIOCTL + 21) 63 - #define WLANGETADHOCAES 1 64 - 65 - #define WLAN_SETONEINT_GETONEINT (WLANIOCTL + 23) 66 - #define WLAN_BEACON_INTERVAL 1 67 - #define WLAN_LISTENINTRVL 4 68 - 69 - #define WLAN_TXCONTROL 6 70 - #define WLAN_NULLPKTINTERVAL 7 71 - 72 24 #define WLAN_SETONEINT_GETNONE (WLANIOCTL + 24) 73 - #define WLAN_SUBCMD_SETRXANTENNA 1 74 - #define WLAN_SUBCMD_SETTXANTENNA 2 75 - #define WLANSETAUTHALG 5 76 - #define WLANSET8021XAUTHALG 6 77 - #define WLANSETENCRYPTIONMODE 7 78 25 #define WLANSETREGION 8 79 - #define WLAN_SET_LISTEN_INTERVAL 9 80 - 81 - #define WLAN_SET_MULTIPLE_DTIM 10 82 - #define WLAN_SET_ATIM_WINDOW 11 83 - #define WLANSETBCNAVG 13 84 - #define WLANSETDATAAVG 14 85 - #define WLAN_SET_LINKMODE 15 86 - #define WLAN_SET_RADIOMODE 16 87 - #define WLAN_SET_DEBUGMODE 17 88 26 #define WLAN_SUBCMD_MESH_SET_TTL 18 89 27 90 28 #define WLAN_SET128CHAR_GET128CHAR (WLANIOCTL + 25) 91 - #define WLANSCAN_MODE 6 92 - 93 - #define WLAN_GET_ADHOC_STATUS 9 94 - 95 29 #define WLAN_SUBCMD_BT_ADD 18 96 30 #define WLAN_SUBCMD_BT_DEL 19 97 31 #define WLAN_SUBCMD_BT_LIST 20 ··· 37 103 #define WLAN_SUBCMD_FWT_LIST_ROUTE 26 38 104 39 105 #define WLAN_SET_GET_SIXTEEN_INT (WLANIOCTL + 29) 40 - #define WLAN_TPCCFG 1 41 - #define WLAN_POWERCFG 2 42 - 43 - #define WLAN_AUTO_FREQ_SET 3 44 - #define WLAN_AUTO_FREQ_GET 4 45 106 #define WLAN_LED_GPIO_CTRL 5 46 - #define WLAN_SCANPROBES 6 47 - #define WLAN_ADAPT_RATESET 8 48 - #define WLAN_INACTIVITY_TIMEOUT 9 49 - #define WLANSNR 10 50 - #define WLAN_GET_RATE 11 51 - #define WLAN_GET_RXINFO 12 52 107 53 - #define WLANCMD52RDWR (WLANIOCTL + 30) 54 - #define WLANCMD53RDWR (WLANIOCTL + 31) 55 - #define CMD53BUFLEN 32 56 - 57 - #define REG_MAC 0x19 58 - #define REG_BBP 0x1a 59 - #define REG_RF 0x1b 60 - #define REG_EEPROM 0x59 61 108 #define WLAN_LINKMODE_802_3 0 62 109 #define WLAN_LINKMODE_802_11 2 63 110 #define WLAN_RADIOMODE_NONE 0