update libertas driver
[10.03/openwrt.git] / package / libertas / src / README
1 ================================================================================
2                         README for USB8388
3
4  (c) Copyright © 2003-2006, Marvell International Ltd.
5  All Rights Reserved
6
7  This software file (the "File") is distributed by Marvell International
8  Ltd. under the terms of the GNU General Public License Version 2, June 1991
9  (the "License").  You may use, redistribute and/or modify this File in
10  accordance with the terms and conditions of the License, a copy of which
11  is available along with the File in the license.txt file or by writing to
12  the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
13  02111-1307 or on the worldwide web at http://www.gnu.org/licenses/gpl.txt.
14
15  THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
16  IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
17  ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
18  this warranty disclaimer.
19 ================================================================================
20
21 =====================
22 DRIVER LOADING
23 =====================
24
25         o. Copy the firmware image (e.g. usb8388.bin) to /lib/firmware/
26
27         o. Load driver by using the following command:
28
29                 insmod usb8388.ko [fw_name=usb8388.bin]
30
31 =====================
32 IWPRIV COMMAND
33 =====================
34
35 NAME
36         This manual describes the usage of private commands used in Marvell WLAN
37         Linux Driver. All the commands available in Wlanconfig will not be available
38         in the iwpriv.
39
40 SYNOPSIS
41         iwpriv <ethX> <command> [sub-command] ...
42
43         iwpriv ethX setregioncode <n>
44         iwpriv ethX getregioncode
45
46 Version 5 Command:
47         iwpriv ethX ledgpio <n>
48
49 BT Commands:
50         The blinding table (BT) contains a list of mac addresses that will be,
51         by default, ignored by the firmware. It is also possible to invert this
52         behavior so that we will ignore all traffic except for the portion
53         coming from mac addresess in the list. It is primarily used for
54         debugging and testing networks.  It can be edited and inspected with
55         the following commands:
56
57         iwpriv ethX bt_reset
58         iwpriv ethX bt_add <mac_address>
59         iwpriv ethX bt_del <mac_address>
60         iwpriv ethX bt_list <id>
61         iwpriv ethX bt_get_invert <n>
62         iwpriv ethX bt_set_invert <n>
63
64 FWT Commands:
65         The forwarding table (FWT) is a feature used to manage mesh network
66         routing in the firmware.  The FWT is essentially a routing table that
67         associates a destination mac address (da) with a next hop receiver
68         address (ra).  The FWT can be inspected and edited with the following
69         iwpriv commands, which are described in greater detail below.
70         Eventually, the table will be automatically maintained by a custom
71         routing protocol.
72
73         NOTE: FWT commands replace the previous DFT commands.  What were the DFT
74         commands?, you might ask.  They were an earlier API to the firmware that
75         implemented a simple MAC-layer forwarding mechanism.  In the unlikely
76         event that you were using these commands, you must migrate to the new
77         FWT commands which can be used to achieve the same functionality.
78
79         iwpriv ethX fwt_add [parameters]
80         iwpriv ethX fwt_del [parameters]
81         iwpriv ethX fwt_lookup [parameters]
82         iwpriv ethX fwt_list [parameters]
83         iwpriv ethX fwt_list_route [parameters]
84         iwpriv ethX fwt_list_neigh [parameters]
85         iwpriv ethX fwt_reset [parameters]
86         iwpriv ethX fwt_cleanup
87         iwpriv ethX fwt_time
88
89 MESH Commands:
90
91         The MESH commands are used to configure various features of the mesh
92         routing protocol.  The following commands are supported:
93
94         iwpriv ethX mesh_get_ttl
95         iwpriv ethX mesh_set_ttl ttl
96         iwpriv ethX mesh_get_bcastr rate
97         iwpriv ethX mesh_set_bcastr rate
98         iwpriv ethX get_rreq_delay
99         iwpriv ethX set_rreq_delay delay
100         iwpriv ethX get_route_exp
101         iwpriv ethX set_route_exp time
102         iwpriv ethX get_link_costs
103         iwpriv ethX set_link_costs "cost54 cost36 cost11 cost1"
104
105 DESCRIPTION
106         Those commands are used to send additional commands to the Marvell WLAN
107         card via the Linux device driver.
108
109         The ethX parameter specifies the network device that is to be used to
110                 perform this command on. it could be eth0, eth1 etc.
111
112 setregioncode
113         This command is used to set the region code in the station.
114         where value is 'region code' for various regions like
115         USA FCC, Canada IC, Spain, France, Europe ETSI, Japan ...
116
117         Usage:
118                 iwpriv ethX setregioncode 0x10: set region code to USA (0x10).
119
120 getregioncode
121         This command is used to get the region code information set in the
122         station.
123
124 ledgpio
125         This command is used to set/get LEDs.
126
127         iwpriv ethX ledgpio <LEDs>
128                 will set the corresponding LED for the GPIO Line.
129
130         iwpriv ethX ledgpio
131                 will give u which LEDs are Enabled.
132
133         Usage:
134                 iwpriv eth1 ledgpio 1 0 2 1 3 4
135                         will enable
136                         LED 1 -> GPIO 0
137                         LED 2 -> GPIO 1
138                         LED 3 -> GPIO 4
139
140                 iwpriv eth1 ledgpio
141                         shows LED information in the format as mentioned above.
142
143         Note: LED0 is invalid
144         Note: Maximum Number of LEDs are 16.
145
146 bcn_control
147         This command is used to enable disable beacons. This can also be used
148         to set beacon interval.
149
150         Usage:
151                 iwpriv ethX bcn_control [enable] [beacon_interval]
152
153                 enable: 0 to disable beacon. 1 to enable beacon.
154                 beacon_interval: 20 - 1000ms.
155
156         Examples:
157                 1. iwpriv ethX bcn_control
158                    Returns (x, y), where x if 1, indicates beacon is enabled, y 
159                    beacon period.
160                 2. iwpriv ethX bcn_control 0
161                    Turns off beacon transmission.
162                 3. iwpriv ethX bcn_control 1 500
163                    Enable beacon with beacon interval 500ms.
164                 
165
166 ledbhv
167       Command iwpriv mshX ledbhv can be used to change default LEDs behaviors.
168       A given LED behavior can be on, off or blinking. The duty/cycle can be set
169       when behavior is programmed as blinking.
170
171       Usage:
172
173         1. To get default LED behavior
174            iwpriv mshX ledbhv <firmware state>
175
176         2. To set or change default LED behavior
177            iwpriv mshX ledbhv <firmware state> <lednum> <behavior> <arg>
178
179         firmware state: The following are some of the relevant states.
180           00: disconnected 
181           01: firmware is scanning
182           02: firmware is connected and awake
183           03: firmware is sleeping
184           04: connected deep sleep
185           06: firmware disconnected link lost 
186           07: firmware disconnected disassociated
187           09: data transfer while firmware is associated and not scanning. 
188               If firmware is already in this state, LED behavior does not change 
189               on this data transfer.
190           10: firmware idle, not scanning, not disconnected or disassociated.
191
192         lednum: 1 or 2 for first and second LED.
193   
194         behavior: 0 for steady ON, 1 - steady off and 2- blinking.
195
196         arg: It is used when behavior is 2 to set duty and cycle. It is defined as 
197              (duty << 4 | cycle). Here duty could be 0..4 and cycle 0..5 for 34, 
198              74, 149, 298, 596, 1192 ms respectively.
199
200       Examples:
201
202        1. To get default behavior for scan
203           iwpriv mshX ledbhv 1
204
205        2. To get default behavior while data transfer
206           iwpriv mshX ledbhv 9      
207  
208        3. To turn off LED 2
209           iwpriv mshX ledbhv 2 2 1 0
210           iwpriv mshX ledbhv 10 2 1 0
211
212        4. To enable LED 2 and blink LED 1 while data transfer.
213           iwpriv mshX ledbhv 9 2 0 0
214           iwpriv mshX ledbhv 9 1 2 4
215
216        5. To change duty cycle of LED 2 during data transfer
217           iwpriv mshX ledbhv 9 2 2 36
218
219        6. To turn ON LED 2 when firmware is disassociated/disconnected.
220           iwpriv mshX ledbhv 0 2 0 0
221         
222
223 fwt_add
224         This command is used to insert an entry into the FWT table. The list of
225         parameters must follow the following structure:
226
227         iwpriv ethX fwt_add da ra [metric dir rate ssn dsn hopcount ttl expiration sleepmode snr]
228
229         The parameters between brackets are optional, but they must appear in
230         the order specified.  For example, if you want to specify the metric,
231         you must also specify the dir, ssn, and dsn but you need not specify the
232         hopcount, expiration, sleepmode, or snr.  Any unspecified parameters
233         will be assigned the defaults specified below.
234
235         The different parameters are:-
236                 da              -- DA MAC address in the form 00:11:22:33:44:55
237                 ra              -- RA MAC address in the form 00:11:22:33:44:55
238                 metric          -- route metric (cost: smaller-metric routes are
239                                    preferred, default is 0)
240                 dir             -- direction (1 for direct, 0 for reverse,
241                                    default is 1)
242                 rate            -- data rate used for transmission to the RA,
243                                    as specified for the rateadapt command,
244                                    default is 3 (11Mbps)
245                 ssn             -- Source Sequence Number (time at the RA for
246                                    reverse routes.  Default is 0)
247                 dsn             -- Destination Sequence Number (time at the DA
248                                    for direct routes.  Default is 0)
249                 hopcount        -- hop count (currently unused, default is 0)
250                 ttl             -- TTL (Only used in reverse entries)
251                 expiration      -- entry expiration (in ticks, where a tick is
252                                    1024us, or ~ 1ms. Use 0 for an indefinite
253                                    entry, default is 0)
254                 sleepmode       -- RA's sleep mode (currently unused, default is
255                                    0)
256                 snr             -- SNR in the link to RA (currently unused,
257                                    default is 0)
258
259         The command does not return anything.
260
261 fwt_del
262         This command is used to remove an entry to the FWT table. The list of
263         parameters must follow the following structure:
264
265                 iwpriv ethX fwt_del da ra [dir]
266
267         where the different parameters are:-
268                 da              -- DA MAC address (in the form "00:11:22:33:44:55")
269                 ra              -- RA MAC address (in the form "00:11:22:33:44:55")
270                 dir             -- direction (1 for direct, 0 for reverse,
271                                    default is 1)
272
273         The command does not return anything.
274
275 fwt_lookup
276         This command is used to get the best route in the FWT table to a given
277         host. The only parameter is the MAC address of the host that is being
278         looked for.
279
280                 iwpriv ethX fwt_lookup da
281
282         where:-
283                 da              -- DA MAC address (in the form "00:11:22:33:44:55")
284
285         The command returns an output string identical to the one returned by
286         fwt_list described below.
287
288
289 fwt_list
290         This command is used to list a route from the FWT table. The only
291         parameter is the index into the table. If you want to list all the
292         routes in a table, start with index=0, and keep listing until you get a
293         "(null)" string.  Note that the indicies may change as the fwt is
294         updated.  It is expected that most users will not use fwt_list directly,
295         but that a utility similar to the traditional route command will be used
296         to invoke fwt_list over and over.
297
298                 iwpriv ethX fwt_list index
299
300         The output is a string of the following form:
301
302                 da ra valid metric dir rate ssn dsn hopcount ttl expiration
303                 sleepmode snr precursor
304
305         where the different fields are:-
306                 da              -- DA MAC address (in the form "00:11:22:33:44:55")
307                 ra              -- RA MAC address (in the form "00:11:22:33:44:55")
308                 valid           -- whether the route is valid (0 if not valid)
309                 metric          -- route metric (cost: smaller-metric routes are preferred)
310                 dir             -- direction (1 for direct, 0 for reverse)
311                 rate            -- data rate used for transmission to the RA,
312                                    as specified for the rateadapt command
313                 ssn             -- Source Sequence Number (time at the RA for reverse routes)
314                 dsn             -- Destination Sequence Number (time at the DA for direct routes)
315                 hopcount        -- hop count (currently unused)
316                 ttl             -- TTL (only used in reverse entries)
317                 expiration      -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry)
318                 sleepmode       -- RA's sleep mode (currently unused)
319                 snr             -- SNR in the link to RA (currently unused)
320                 precursor       -- predecessor in direct routes
321
322 fwt_list_route
323         This command is equivalent to fwt_list.
324
325 fwt_list_neigh
326         This command is used to list a neighbor from the FWT table. The only
327         parameter is the neighbor ID. If you want to list all the neighbors in a
328         table, start with nid=0, and keep incrementing nid until you get a
329         "(null)" string.  Note that the nid from a fwt_list_route command can be
330         used as an input to this command.  Also note that this command is meant
331         mostly for debugging.  It is expected that users will use fwt_lookup.
332         One important reason for this is that the neighbor id may change as the
333         neighbor table is altered.
334
335                 iwpriv ethX fwt_list_neigh nid
336
337         The output is a string of the following form:
338
339                 ra sleepmode snr references
340
341         where the different fields are:-
342                 ra              -- RA MAC address (in the form "00:11:22:33:44:55")
343                 sleepmode       -- RA's sleep mode (currently unused)
344                 snr             -- SNR in the link to RA (currently unused)
345                 references      -- RA's reference counter
346
347 fwt_reset
348         This command is used to reset the FWT table, getting rid of all the
349         entries. There are no input parameters.
350
351                 iwpriv ethX fwt_reset
352
353         The command does not return anything.
354
355 fwt_cleanup
356         This command is used to perform user-based garbage recollection. The
357         FWT table is checked, and all the entries that are expired or invalid
358         are cleaned. Note that this is exported to the driver for debugging
359         purposes, as garbage collection is also fired by the firmware when in
360         space problems. There are no input parameters.
361
362                 iwpriv ethX fwt_cleanup
363
364         The command does returns the number of invalid/expired routes deleted.
365
366 fwt_time
367         This command returns a card's internal time representation.  It is this
368         time that is used to represent the expiration times of FWT entries.  The
369         number is not consistent from card to card; it is simply a timer count.
370         The fwt_time command is used to inspect the timer so that expiration
371         times reported by fwt_list can be properly interpreted.
372
373                 iwpriv ethX fwt_time
374
375 mesh_get_ttl
376
377         The mesh ttl is the number of hops a mesh packet can traverse before it
378         is dropped.  This parameter is used to prevent infinite loops in the
379         mesh network.  The value returned by this function is the ttl assigned
380         to all mesh packets.  Currently there is no way to control the ttl on a
381         per packet or per socket basis.
382
383         iwpriv ethX mesh_get_ttl
384
385 mesh_set_ttl ttl
386
387         Set the ttl.  The argument must be between 0 and 255.
388
389         iwpriv ethX mesh_set_ttl <ttl>
390
391 mesh_get_bcastr
392
393         Shows the rate index used for mesh broadcast and multicast packets.
394         Rates are expressed in 2 * Mb/s, ie 11Mb/s is 22, 5.5Mb/s is 11, etc.
395
396         iwpriv ethX mesh_get_bcastr rate
397
398 mesh_set_bcastr rate
399
400         Sets the rate index for mesh broadcast and muticast packets. Rates are
401         expressed in expressed in 2 * Mb/s, ie 11Mb/s is 22, 5.5Mb/s is 11, etc.
402
403         iwpriv ethX mesh_set_bcastr rate
404
405 get_rreq_delay
406
407         Shows the delay to forward a RREQ frame. This delay allows the node to
408         forward just the best route in case the same RREQ arrives to the node
409         through different routes. The argument is shown in 1/100 seconds.
410
411         iwpriv ethX get_rreq_delay
412
413 set_rreq_delay delay
414
415         Sets the RREQ forward delay. The delay is interpreted as 1/100 seconds.
416
417         iwpriv ethX set_rreq_delay delay
418
419 get_route_exp
420
421         Shows the mesh route expiration time, in seconds.
422
423         iwpriv ethX get_route_exp
424
425 set_route_exp time
426
427         Gets the mesh route, expiration time, in seconds.
428
429         iwpriv ethX set_route_exp time
430
431 get_link_costs
432
433         Gets the mesh hop base cost for each used rate. The output gives us the
434         base cost for hops at 54Mbps, 36Mbps, 11Mbps and 1Mbps, in that order.
435         The base cost gets divided by a battery state factor to get the actual
436         cost. A cost of 0 means that rate is deactivated.
437
438         iwpriv ethX get_link_costs
439
440 set_link_costs "cost54 cost36 cost11 cost1"
441
442         Sets the mesh hop base cost for the used speeds. The input parameter
443         will specify the cost for hops at 54Mbps, 36Mbps, 11Mbps and 1Mbps, in
444         that order. A cost of 0 will disable a specific rate.
445
446         iwpriv ethX set_link_costs "cost54 cost36 cost11 cost1"
447
448 =========================
449 ETHTOOL
450 =========================
451
452
453 Use the -i option to retrieve version information from the driver.
454
455 # ethtool -i eth0
456 driver: libertas
457 version: COMM-USB8388-318.p4
458 firmware-version: 5.110.7
459 bus-info:
460
461 Use the -e option to read the EEPROM contents of the card.
462
463         Usage:
464         ethtool -e ethX [raw on|off] [offset N] [length N]
465
466        -e     retrieves and prints an EEPROM dump for the  specified  ethernet
467               device.   When raw is enabled, then it dumps the raw EEPROM data
468               to stdout. The length and offset parameters allow  dumping  cer-
469               tain portions of the EEPROM.  Default is to dump the entire EEP-
470               ROM.
471
472 # ethtool -e eth0 offset 0 length 16
473 Offset          Values
474 ------          ------
475 0x0000          38 33 30 58 00 00 34 f4 00 00 10 00 00 c4 17 00
476
477 ========================
478 DEBUGFS COMMANDS
479 ========================
480
481 those commands are used via debugfs interface
482
483 ===========
484 rdmac
485 rdbbp
486 rdrf
487         These commands are used to read the MAC, BBP and RF registers from the
488         card.  These commands take one parameter that specifies the offset
489         location that is to be read.  This parameter must be specified in
490         hexadecimal (its possible to preceed preceding the number with a "0x").
491
492         Path: /debugfs/libertas_wireless/ethX/registers/
493
494         Usage:
495                 echo "0xa123" > rdmac ; cat rdmac
496                 echo "0xa123" > rdbbp ; cat rdbbp
497                 echo "0xa123" > rdrf ; cat rdrf
498 wrmac
499 wrbbp
500 wrrf
501         These commands are used to write the MAC, BBP and RF registers in the
502         card.  These commands take two parameters that specify the offset
503         location and the value that is to be written. This parameters must
504         be specified in hexadecimal (its possible to preceed the number
505         with a "0x").
506
507         Usage:
508                 echo "0xa123 0xaa" > wrmac
509                 echo "0xa123 0xaa" > wrbbp
510                 echo "0xa123 0xaa" > wrrf
511
512 sleepparams
513         This command is used to set the sleepclock configurations
514
515         Path: /debugfs/libertas_wireless/ethX/
516
517         Usage:
518                 cat sleepparams: reads the current sleepclock configuration
519
520                 echo "p1 p2 p3 p4 p5 p6" > sleepparams: writes the sleepclock configuration.
521
522                 where:
523                         p1 is Sleep clock error in ppm (0-65535)
524                         p2 is Wakeup offset in usec (0-65535)
525                         p3 is Clock stabilization time in usec (0-65535)
526                         p4 is Control periodic calibration (0-2)
527                         p5 is Control the use of external sleep clock (0-2)
528                         p6 is reserved for debug (0-65535)
529
530 subscribed_events
531
532         The subscribed_events directory contains the interface for the
533         subscribed events API.
534
535         Path: /debugfs/libertas_wireless/ethX/subscribed_events/
536
537         Each event is represented by a filename. Each filename consists of the
538         following three fields:
539         Value Frequency Subscribed
540
541         To read the current values for a given event, do:
542                 cat event
543         To set the current values, do:
544                 echo "60 2 1" > event
545
546         Frequency field specifies the reporting frequency for this event.
547         If it is set to 0, then the event is reported only once, and then
548         automatically unsubscribed. If it is set to 1, then the event is
549         reported every time it occurs. If it is set to N, then the event is
550         reported every Nth time it occurs.
551
552         beacon_missed
553         Value field specifies the number of consecutive missing beacons which
554         triggers the LINK_LOSS event. This event is generated only once after
555         which the firmware resets its state. At initialization, the LINK_LOSS
556         event is subscribed by default. The default value of MissedBeacons is
557         60.
558
559         failure_count
560         Value field specifies the consecutive failure count threshold which
561         triggers the generation of the MAX_FAIL event. Once this event is
562         generated, the consecutive failure count is reset to 0.
563         At initialization, the MAX_FAIL event is NOT subscribed by
564         default.
565
566         high_rssi
567         This event is generated when the average received RSSI in beacons goes
568         above a threshold, specified by Value.
569
570         low_rssi
571         This event is generated when the average received RSSI in beacons goes
572         below a threshold, specified by Value.
573
574         high_snr
575         This event is generated when the average received SNR in beacons goes
576         above a threshold, specified by Value.
577
578         low_snr
579         This event is generated when the average received SNR in beacons goes
580         below a threshold, specified by Value.
581
582 extscan
583         This command is used to do a specific scan.
584
585         Path: /debugfs/libertas_wireless/ethX/
586
587         Usage: echo "SSID" > extscan
588
589         Example:
590                 echo "LINKSYS-AP" > extscan
591
592         To see the results of use getscantable command.
593
594 getscantable
595
596         Display the current contents of the driver scan table (ie. get the
597         scan results).
598
599         Path: /debugfs/libertas_wireless/ethX/
600
601         Usage:
602                 cat getscantable
603
604 setuserscan
605         Initiate a customized scan and retrieve the results
606
607
608         Path: /debugfs/libertas_wireless/ethX/
609
610     Usage:
611        echo "[ARGS]" > setuserscan
612
613          where [ARGS]:
614
615       bssid=xx:xx:xx:xx:xx:xx  specify a BSSID filter for the scan
616       ssid="[SSID]"            specify a SSID filter for the scan
617       keep=[0 or 1]            keep the previous scan results (1), discard (0)
618       dur=[scan time]          time to scan for each channel in milliseconds
619       type=[1,2,3]             BSS type: 1 (Infra), 2(Adhoc), 3(Any)
620
621     Any combination of the above arguments can be supplied on the command
622     line. If dur tokens are absent, the driver default setting will be used.
623     The bssid and ssid fields, if blank, will produce an unfiltered scan.
624     The type field will default to 3 (Any) and the keep field will default
625     to 0 (Discard).
626
627     Examples:
628     1) Perform a passive scan on all channels for 20 ms per channel:
629             echo "dur=20" > setuserscan
630
631     2) Perform an active scan for a specific SSID:
632             echo "ssid="TestAP"" > setuserscan
633
634     3) Scan all available channels (B/G, A bands) for a specific BSSID, keep
635        the current scan table intact, update existing or append new scan data:
636             echo "bssid=00:50:43:20:12:82 keep=1" > setuserscan
637
638     4) Scan for all infrastructure networks.
639        Keep the previous scan table intact. Update any duplicate BSSID/SSID
640        matches with the new scan data:
641             echo "type=1 keep=1" > setuserscan
642
643     All entries in the scan table (not just the new scan data when keep=1)
644     will be displayed upon completion by use of the getscantable ioctl.
645
646 ==============================================================================