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