linux-kernel-test/drivers/net/wireless/libertas
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
..
assoc.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
assoc.h
cfg.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
cfg.h
cmd.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
cmd.h libertas: move mesh-related definitions into mesh.h 2009-12-22 13:37:13 -05:00
cmdresp.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
debugfs.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
debugfs.h
decl.h libertas: moveing mesh-related functions into mesh.c 2009-11-28 15:04:57 -05:00
defs.h libertas: use priv->mesh_tlv instead of priv->mesh_fw_ver 2009-12-22 13:37:12 -05:00
dev.h Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 2010-02-14 17:45:59 -08:00
ethtool.c libertas: make mesh configurable 2009-12-22 13:44:02 -05:00
host.h
if_cs.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
if_sdio.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
if_sdio.h
if_spi.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
if_spi.h
if_usb.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
if_usb.h
Kconfig libertas: make mesh configurable 2009-12-22 13:44:02 -05:00
LICENSE
main.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
Makefile libertas: make mesh configurable 2009-12-22 13:44:02 -05:00
mesh.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-01-10 22:55:03 -08:00
mesh.h libertas: make mesh configurable 2009-12-22 13:44:02 -05:00
radiotap.h
README
rx.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
scan.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
scan.h
tx.c libertas: add access functions for mesh open/connect status 2009-12-22 13:38:29 -05:00
types.h
wext.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
wext.h libertas: introduce mesh.h 2009-11-28 15:04:56 -05:00

================================================================================
			README for Libertas

 (c) Copyright © 2003-2006, Marvell International Ltd.
 All Rights Reserved

 This software file (the "File") is distributed by Marvell International
 Ltd. under the terms of the GNU General Public License Version 2, June 1991
 (the "License").  You may use, redistribute and/or modify this File in
 accordance with the terms and conditions of the License, a copy of which
 is available along with the File in the license.txt file or by writing to
 the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 02111-1307 or on the worldwide web at http://www.gnu.org/licenses/gpl.txt.

 THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
 IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
 this warranty disclaimer.
================================================================================

=====================
DRIVER LOADING
=====================

	o. Copy the firmware image (e.g. usb8388.bin) to /lib/firmware/

	o. Load driver by using the following command:

		insmod usb8388.ko [fw_name=usb8388.bin]

=========================
ETHTOOL
=========================


Use the -i option to retrieve version information from the driver.

# ethtool -i eth0
driver: libertas
version: COMM-USB8388-318.p4
firmware-version: 5.110.7
bus-info:

Use the -e option to read the EEPROM contents of the card.

	Usage:
	ethtool -e ethX [raw on|off] [offset N] [length N]

       -e     retrieves and prints an EEPROM dump for the  specified  ethernet
              device.   When raw is enabled, then it dumps the raw EEPROM data
              to stdout. The length and offset parameters allow  dumping  cer-
              tain portions of the EEPROM.  Default is to dump the entire EEP-
              ROM.

# ethtool -e eth0 offset 0 length 16
Offset          Values
------          ------
0x0000          38 33 30 58 00 00 34 f4 00 00 10 00 00 c4 17 00

========================
DEBUGFS COMMANDS
========================

those commands are used via debugfs interface

===========
rdmac
rdbbp
rdrf
	These commands are used to read the MAC, BBP and RF registers from the
	card.  These commands take one parameter that specifies the offset
	location that is to be read.  This parameter must be specified in
	hexadecimal (its possible to preceed preceding the number with a "0x").

	Path: /sys/kernel/debug/libertas_wireless/ethX/registers/

	Usage:
		echo "0xa123" > rdmac ; cat rdmac
		echo "0xa123" > rdbbp ; cat rdbbp
		echo "0xa123" > rdrf ; cat rdrf
wrmac
wrbbp
wrrf
	These commands are used to write the MAC, BBP and RF registers in the
	card.  These commands take two parameters that specify the offset
	location and the value that is to be written. This parameters must
	be specified in hexadecimal (its possible to preceed the number
	with a "0x").

	Usage:
		echo "0xa123 0xaa" > wrmac
		echo "0xa123 0xaa" > wrbbp
		echo "0xa123 0xaa" > wrrf

sleepparams
	This command is used to set the sleepclock configurations

	Path: /sys/kernel/debug/libertas_wireless/ethX/

	Usage:
		cat sleepparams: reads the current sleepclock configuration

		echo "p1 p2 p3 p4 p5 p6" > sleepparams: writes the sleepclock configuration.

		where:
			p1 is Sleep clock error in ppm (0-65535)
			p2 is Wakeup offset in usec (0-65535)
			p3 is Clock stabilization time in usec (0-65535)
			p4 is Control periodic calibration (0-2)
			p5 is Control the use of external sleep clock (0-2)
			p6 is reserved for debug (0-65535)

subscribed_events

	The subscribed_events directory contains the interface for the
	subscribed events API.

	Path: /sys/kernel/debug/libertas_wireless/ethX/subscribed_events/

	Each event is represented by a filename. Each filename consists of the
	following three fields:
	Value Frequency Subscribed

	To read the current values for a given event, do:
		cat event
	To set the current values, do:
		echo "60 2 1" > event

	Frequency field specifies the reporting frequency for this event.
	If it is set to 0, then the event is reported only once, and then
	automatically unsubscribed. If it is set to 1, then the event is
	reported every time it occurs. If it is set to N, then the event is
	reported every Nth time it occurs.

	beacon_missed
	Value field specifies the number of consecutive missing beacons which
	triggers the LINK_LOSS event. This event is generated only once after
	which the firmware resets its state. At initialization, the LINK_LOSS
	event is subscribed by default. The default value of MissedBeacons is
	60.

	failure_count
	Value field specifies the consecutive failure count threshold which
	triggers the generation of the MAX_FAIL event. Once this event is
	generated, the consecutive failure count is reset to 0.
	At initialization, the MAX_FAIL event is NOT subscribed by
	default.

	high_rssi
	This event is generated when the average received RSSI in beacons goes
	above a threshold, specified by Value.

	low_rssi
	This event is generated when the average received RSSI in beacons goes
	below a threshold, specified by Value.

	high_snr
	This event is generated when the average received SNR in beacons goes
	above a threshold, specified by Value.

	low_snr
	This event is generated when the average received SNR in beacons goes
	below a threshold, specified by Value.

extscan
	This command is used to do a specific scan.

	Path: /sys/kernel/debug/libertas_wireless/ethX/

	Usage: echo "SSID" > extscan

	Example:
		echo "LINKSYS-AP" > extscan

	To see the results of use getscantable command.

getscantable

	Display the current contents of the driver scan table (ie. get the
	scan results).

	Path: /sys/kernel/debug/libertas_wireless/ethX/

	Usage:
		cat getscantable

setuserscan
	Initiate a customized scan and retrieve the results


	Path: /sys/kernel/debug/libertas_wireless/ethX/

    Usage:
       echo "[ARGS]" > setuserscan

         where [ARGS]:

      bssid=xx:xx:xx:xx:xx:xx  specify a BSSID filter for the scan
      ssid="[SSID]"            specify a SSID filter for the scan
      keep=[0 or 1]            keep the previous scan results (1), discard (0)
      dur=[scan time]          time to scan for each channel in milliseconds
      type=[1,2,3]             BSS type: 1 (Infra), 2(Adhoc), 3(Any)

    Any combination of the above arguments can be supplied on the command
    line. If dur tokens are absent, the driver default setting will be used.
    The bssid and ssid fields, if blank, will produce an unfiltered scan.
    The type field will default to 3 (Any) and the keep field will default
    to 0 (Discard).

    Examples:
    1) Perform a passive scan on all channels for 20 ms per channel:
            echo "dur=20" > setuserscan

    2) Perform an active scan for a specific SSID:
            echo "ssid="TestAP"" > setuserscan

    3) Scan all available channels (B/G, A bands) for a specific BSSID, keep
       the current scan table intact, update existing or append new scan data:
            echo "bssid=00:50:43:20:12:82 keep=1" > setuserscan

    4) Scan for all infrastructure networks.
       Keep the previous scan table intact. Update any duplicate BSSID/SSID
       matches with the new scan data:
            echo "type=1 keep=1" > setuserscan

    All entries in the scan table (not just the new scan data when keep=1)
    will be displayed upon completion by use of the getscantable ioctl.

========================
IWCONFIG COMMANDS
========================
power period

	This command is used to configure the station in deep sleep mode /
	auto deep sleep mode.

	The timer is implemented to monitor the activities (command, event,
	etc.). When an activity is detected station will exit from deep
	sleep mode automatically and restart the timer. At timer expiry
	(no activity for defined time period) the deep sleep mode is entered
	automatically.

	Note: this command is for SDIO interface only.

	Usage:
	To enable deep sleep mode do:
		iwconfig wlan0 power period 0
	To enable auto deep sleep mode with idle time period 5 seconds do:
		iwconfig wlan0 power period 5
	To disable deep sleep/auto deep sleep mode do:
		iwconfig wlan0 power period -1

==============================================================================