dect
/
linux-2.6
Archived
13
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/drivers/staging/rtl8192su/ieee80211
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
..
Makefile Staging: rtl8192su: remove ENABLE_DOT11D ifdefs 2009-09-15 12:01:37 -07:00
dot11d.c Staging: rtl8192su: make private ieee80211 stack really private 2009-09-15 12:01:42 -07:00
dot11d.h Staging: rtl8192su: remove ENABLE_DOT11D ifdefs 2009-09-15 12:01:37 -07:00
ieee80211.h Staging: merge staging patches into Linus's main branch 2010-03-04 08:39:02 -08:00
ieee80211_crypt.c Staging: rtl8192su: use list_for_each_safe() in ieee80211_crypto_deinit 2010-03-03 16:43:05 -08:00
ieee80211_crypt.h Staging: rtl8192su: remove kernel version compatibility wrappers 2009-09-15 12:01:28 -07:00
ieee80211_crypt_ccmp.c Staging: rtl8187x: Use %pM for mac address output 2010-03-03 16:42:29 -08:00
ieee80211_crypt_tkip.c Staging: rtl8187x: Use %pM for mac address output 2010-03-03 16:42:29 -08:00
ieee80211_crypt_wep.c Staging: rtl8192su/ieee80211: remove OPENSUSE_SLED ifdefs 2009-09-15 12:01:42 -07:00
ieee80211_module.c Staging: rtl8192su, rtl8192u: use min_t() in store_debug_level() 2010-03-03 16:42:38 -08:00
ieee80211_r8192s.h staging: rtl8192su: fix compile error from wireless-testing commit 2010-02-19 15:52:41 -05:00
ieee80211_rx.c Staging: merge staging patches into Linus's main branch 2010-03-04 08:39:02 -08:00
ieee80211_softmac.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
ieee80211_softmac_wx.c Staging: rtl8192su: make private ieee80211 stack really private 2009-09-15 12:01:42 -07:00
ieee80211_tx.c Staging: rtl8187x: Use %pM for mac address output 2010-03-03 16:42:29 -08:00
ieee80211_wx.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
readme Staging: fix assorted typos all over the place 2009-12-11 12:23:20 -08:00
rtl819x_BA.h
rtl819x_BAProc.c Staging: merge staging patches into Linus's main branch 2010-03-04 08:39:02 -08:00
rtl819x_HT.h Staging: rtl8192su: remove USB_TX_DRIVER_AGGREGATION_ENABLE ifdefs 2009-09-15 12:01:37 -07:00
rtl819x_HTProc.c staging: Fix misspelling of "should" and "shouldn't" in comments. 2010-03-03 16:42:31 -08:00
rtl819x_Qos.h Staging: rtl8192su: remove dead code 2009-09-15 12:01:40 -07:00
rtl819x_TS.h
rtl819x_TSProc.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

readme

What this layer should do

- It mantain the old mechanism as alternative, so the
  ipw2100 driver works with really few changes.
- Encapsulate / Decapsulate ieee80211 packet
- Handle fragmentation
- Optionally provide an alterantive mechanism for netif queue stop/wake,
  so that the ieee80211 layer will pass one fragment per time instead of
  one txb struct per time. so the driver can stop the queue in the middle
  of a packet.
- Provide two different TX interfaces for cards that can handle management
  frames on one HW queue, and data on another, and for cards that have only
  one HW queue  (the latter untested and very, very rough).
- Optionally provide the logic for handling IBSS/MASTER/MONITOR/BSS modes
  and for the channel, essid and wap get/set wireless extension requests.
  so that the driver has only to change channel when the ieee stack tell it.
- Optionally provide a scanning mechanism so that the driver has not to
  worry about this, just implement the set channel calback and pass
  frames to the upper layer
- Optionally provide the bss client protocol handshaking (just with open
  authentication)
- Optionally provide the probe request send mechanism
- Optionally provide the bss master mode logic to handle association
  protocol (only open authentication) and probe responses.
- SW wep encryption (with open authentication)
- It collects some stats
- It provides beacons to the card when it ask for them

What this layer doesn't do (yet)
- Perform shared authentication
- Have full support for master mode (the AP should loop back in the air
  frames from an associated client to another. This could be done easily
  with few lines of code, and it is done in my previous version of the
  stach, but a table of association must be keept and a disassociation
  policy must be decided and implemented.
- Handle cleanly the full ieee 802.11 protocol. In AP mode it never
  disassociate clients, and it is really prone to always allow access.
  In bss client mode it is a bit rough with AP deauth and disassoc requests.
- It has not any entry point to view the collected stats.
- Although it takes care of the card supported rates in the management frame
  it sends, support for rate changing on TXed packet is not complete.
- Give up once associated in bss client mode (it never detect a
  signal loss condition to disassociate and restart scanning)
- Provide a mechanism for enabling the TX in monitor mode, so
  userspace programs can TX raw packets.
- Provide a mechanism for cards that need that the SW take care of beacon
  TX completely, in sense that the SW has to enqueue by itself beacons
  to the card so it TX them (if any...)
APIs

Callback functions in the original stack has been mantained.
following has been added (from ieee80211.h)

	/* Softmac-generated frames (mamagement) are TXed via this
	 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
	 * not set. As some cards may have different HW queues that
	 * one might want to use for data and management frames
	 * the option to have two callbacks might be useful.
	 * This fucntion can't sleep.
	 */
	int (*softmac_hard_start_xmit)(struct sk_buff *skb,
			       struct net_device *dev);

	/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
	 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
	 * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
	 * then also management frames are sent via this callback.
	 * This function can't sleep.
	 */
	void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
			       struct net_device *dev);

	/* stops the HW queue for DATA frames. Useful to avoid
	 * waste time to TX data frame when we are reassociating
	 * This function can sleep.
	 */
	void (*data_hard_stop)(struct net_device *dev);

	/* OK this is complementar to data_poll_hard_stop */
	void (*data_hard_resume)(struct net_device *dev);

	/* ask to the driver to retune the radio .
	 * This function can sleep. the driver should ensure
	 * the radio has been swithced before return.
	 */
	void (*set_chan)(struct net_device *dev,short ch);

	/* These are not used if the ieee stack takes care of
	 * scanning (IEEE_SOFTMAC_SCAN feature set).
	 * In this case only the set_chan is used.
	 *
	 * The syncro version is similar to the start_scan but
	 * does not return until all channels has been scanned.
	 * this is called in user context and should sleep,
	 * it is called in a work_queue when swithcing to ad-hoc mode
	 * or in behalf of iwlist scan when the card is associated
	 * and root user ask for a scan.
	 * the fucntion stop_scan should stop both the syncro and
	 * background scanning and can sleep.
	 * The fucntion start_scan should initiate the background
	 * scanning and can't sleep.
	 */
	void (*scan_syncro)(struct net_device *dev);
	void (*start_scan)(struct net_device *dev);
	void (*stop_scan)(struct net_device *dev);

	/* indicate the driver that the link state is changed
	 * for example it may indicate the card is associated now.
	 * Driver might be interested in this to apply RX filter
	 * rules or simply light the LINK led
	 */
	void (*link_change)(struct net_device *dev);

Functions hard_data_[resume/stop] are optional and should not be used
if the driver decides to uses data+management frames enqueue in a
single HQ queue (thus using just the softmac_hard_data_start_xmit
callback).

Function that the driver can use are:

ieee80211_get_beacon             - this is called by the driver when
                                   the HW needs a beacon.
ieee80211_softmac_start_protocol - this should normally be called in the
                                   driver open function
ieee80211_softmac_stop_protocol  - the opposite of the above
ieee80211_wake_queue             - this is similar to netif_wake_queue
ieee80211_reset_queue            - this throw away fragments pending(if any)
ieee80211_stop_queue             - this is similar to netif_stop_queue


known BUGS:
- When performing syncro scan (possiblily when swithcing to ad-hoc mode
  and when running iwlist scan when associated) there is still an odd
  behaviour.. I have not looked in this more accurately (yet).

locking:
locking is done by means of three structures.
1- ieee->lock (by means of spin_[un]lock_irq[save/restore]
2- ieee->wx_sem
3- ieee->scan_sem

the lock 1 is what protect most of the critical sections in the ieee stack.
the lock 2 is used to avoid that more than one of the SET wireless extension
handlers (as well as start/stop protocol function) are running at the same time.
the lock 1 is used when we need to modify or read the shared data in the wx handlers.
In other words the lock 2 will prevent one SET action will run across another SET
action (by make sleep the 2nd one) but allow GET actions, while the lock 1
make atomic those little shared data access in both GET and SET operation.
So get operation will be never be delayed really: they will never sleep..
Furthermore in the top of some SET operations a flag is set before acquiring
the lock. This is an help to make the previous running SET operation to
finish faster if needed (just in case the second one will totally undo the
first, so there is not need to complete the 1st really.. ).
The background scanning mechaninsm is protected by the lock 1 except for the
workqueue. this wq is here just to let the set_chan callback sleep (I thinked it
might be appreciated by USB network card driver developer). In this case the lock 3
take its turn.
Thus the stop function needs both the locks.
Funny in the syncro scan the lock 2 play its role (as both the syncro_scan
function and the stop scan function are called with this semaphore held).