Commit Graph

38 Commits

Author SHA1 Message Date
Andriy Gapon
c0e55e3b65 strict kobj sigs: fix assortment of device_detach and device_shutdown impls
with common issue of having void return type instead of int

Reviewed by:	imp, current@
Approved by:	jhb (mentor)
2009-06-11 17:14:28 +00:00
Warner Losh
68fc5ce70b Revert last junk... 2009-05-20 22:28:55 +00:00
Sam Leffler
5463c4a485 Overhaul monitor mode handling:
o replace DLT_IEEE802_11 support in net80211 with DLT_IEEE802_11_RADIO
  and remove explicit bpf support from wireless drivers; drivers now
  use ieee80211_radiotap_attach to setup shared data structures that
  hold the radiotap header for each packet tx/rx
o remove rx timestamp from the rx path; it was used only by the tdma support
  for debugging and was mostly useless due to it being 32-bits and mostly
  unavailable
o track DLT_IEEE80211_RADIO bpf attachments and maintain per-vap and
  per-com state when there are active taps
o track the number of monitor mode vaps
o use bpf tap and monitor mode vap state to decide when to collect radiotap
  state and dispatch frames; drivers no longer explicitly directly check
  bpf state or use bpf calls to tap frames
o handle radiotap state updates on channel change in net80211; drivers
  should not do this (unless they bypass net80211 which is almost always
  a mistake)
o update various drivers to be more consistent/correct in handling radiotap
o update ral to include TSF in radiotap'd frames
o add promisc mode callback to wi

Reviewed by:	cbzimmer, rpaulo, thompsa
2009-05-20 20:00:40 +00:00
Warner Losh
00b4e54ae7 We no longer need to use d_thread_t, migrate to struct thread *. 2009-05-20 17:29:21 +00:00
Andrew Thompson
5efea30f03 Create a taskqueue for each wireless interface which provides a serialised
sleepable context for net80211 driver callbacks. This removes the need for USB
and firmware based drivers to roll their own code to defer the chip programming
for state changes, scan requests, channel changes and mcast/promisc updates.
When a driver callback completes the hardware state is now guaranteed to have
been updated and is in sync with net80211 layer.

This nukes around 1300 lines of code from the wireless device drivers making
them more readable and less race prone.

The net80211 layer has been updated as follows
 - all state/channel changes are serialised on the taskqueue.
 - ieee80211_new_state() always queues and can now be called from any context
 - scanning runs from a single taskq function and executes to completion. driver
   callbacks are synchronous so the channel, phy mode and rx filters are
   guaranteed to be set in hardware before probe request frames are
   transmitted.

Help and contributions from Sam Leffler.

Reviewed by:	sam
2009-05-02 15:14:18 +00:00
Warner Losh
0c5544bb64 Export the hardware type (as number and name), the secondary firmware
revision and (on Prism cards) the primary firmware revision via
sysctl.  Move the printing of this information under bootverbose,
since it is relatively easy to get to it now.
2008-07-28 17:00:37 +00:00
Sam Leffler
b032f27c36 Multi-bss (aka vap) support for 802.11 devices.
Note this includes changes to all drivers and moves some device firmware
loading to use firmware(9) and a separate module (e.g. ral).  Also there
no longer are separate wlan_scan* modules; this functionality is now
bundled into the wlan module.

Supported by:	Hobnob and Marvell
Reviewed by:	many
Obtained from:	Atheros (some bits)
2008-04-20 20:35:46 +00:00
Sam Leffler
68e8e04e93 Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
  fully enumerated and uniquely identify the operating characteristics;
  these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
  background scanning and roaming
o move scanning support into loadable modules based on the operating
  mode to enable different policies and reduce the memory footprint
  on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
  mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
  we use a simple algorithm to trigger a roam: we threshold the rssi
  and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
  drivers but is incomplete; it's included now to establish a baseline
  for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
  prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
  encapsulation (note this can be used with any card that can tx+rx
  large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
  authentication and association failures
o enable the addition of sta mode power save support for drivers that need
  net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
  results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
  index into the rate set; this needs to be extended to deal with
  multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing

Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
       dynamic turbo (lightly tested), 11n (sniffing only and needs
       new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
       rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested

This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others.  Much of the scanning work was supported by
Atheros.  The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
Sam Leffler
a5d62f191b replace if_watchdog w/ a private callout
MFC after:	1 month
2006-12-11 00:41:22 +00:00
Sam Leffler
f8f1546232 split wi_start int locked+unlocked variants and use the unlocked
one from the isr to eliminate a recursive lock

MFC after:	1 month
2006-12-11 00:35:51 +00:00
Sam Leffler
df64e1e4ef nuke compatibility cruft
MFC after:	1 month
2006-12-11 00:32:15 +00:00
Tai-hwa Liang
fec39060e2 Fixing WEP bustage in hostap mode since 5.2-RELEASE.
- WEP TX fix:

  The original code called software crypto, ieee80211_crypto_encap(),
which never worked since IEEE80211_KEY_SWCRYPT was never flagged due to
ieee80211_crypto_newkey() assumes that wi always supports hardware based
crypto regardless of operational mode(by virtue of IEEE80211_C_WEP).
This fix works around that issue by adding wi_key_alloc() to force
the use of s/w crypto.  Also if anyone ever decides to cleanup ioctl
handling where key changes wouldn't cause a call to wi_init() every time,
we'll need wi_key_alloc() to DTRT.

  In addition to that, this fix also adds code to wi_write_wep() to force
existing keys to be switched between h/w and s/w crypto such that an
operation mode change(sta <-> hostap) will flag IEEE80211_KEY_SWCRYPT
properly.

- WEP RX fix:

  Clear IEEE80211_F_DROPUNENC even in hostap mode.  Quote from Sam:

	"This is really gross but I don't see an easy way around it.
	By doing it we lose the ability to independently drop unencode
	frames (and support mixed wep/!wep use).  We should really be
	setting the EXCLUDE_UNENCRYPTED flag written in wi_write_wep
	based on IEEE80211_F_DROPUNENC but with our clearing it we can't
	depend on it being set properly."

Reported by:	Holm Tiffe <holm at freibergnet dot de>
Submitted by:	sam
MFC after:	3 days
2005-10-02 04:29:08 +00:00
Warner Losh
0ed03bc788 MFp4: save mac addr hint, eliminage OLDCARD shims 2005-09-22 05:11:50 +00:00
Brooks Davis
fc74a9f93a Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
 - Struct arpcom is no longer referenced in normal interface code.
   Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
   To enforce this ac_enaddr has been renamed to _ac_enaddr.
 - The second argument to ether_ifattach is now always the mac address
   from driver private storage rather than sometimes being ac_enaddr.

Reviewed by:	sobomax, sam
2005-06-10 16:49:24 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Sam Leffler
f48445578b o Update for net80211 changes
o Import some minor fixes from netbsd
2004-12-08 17:36:28 +00:00
Sam Leffler
2f1ad18b34 radiotap updates:
o force little-endian byte order for header
o pad header to 32-bit boundary to guard against applications that assume
  packet data alignment
2004-04-01 00:38:45 +00:00
Warner Losh
462fcd56a6 Older versions of the intersil firmware is a lot slower than newer
versions of the firmware.  It responds more slowly to commands, and we
bogusly failed them.  We assume that all versions of the intersil
firmware before 1.0 are 10 times slower and will give it 10x the time
to finish.

# for 5.2 we should always just assume 5s.
2003-12-09 07:41:07 +00:00
Sam Leffler
8df91fc8bc o add experimental radiotap capture format
o add netbsd logic to convert rssi to device-independent values

Obtained from:	NetBSD (rssi conversion code)
2003-09-05 22:29:30 +00:00
Sam Leffler
45bbf62fb5 track changes to 802.11 code:
o override new_state method per new model
o use ieee80211_state_name instead of private copy
2003-07-20 21:38:20 +00:00
Sam Leffler
2c71d3c795 update for new 802.11 support 2003-06-28 06:17:26 +00:00
Warner Losh
0e630ee24b o Lucent cards don't seem to like multiple buffers for tx. Use only
one tx buffer for these cards.  The old driver only used one.  We use
  1 for symbol, and 3 for prism cards.
o Don't do the maximum loops thing in the ISR.  In fact, revert to the
  old interrupt handler.  Lucent cards don't seem to work too well if
  you don't disable/enable interrupts from the card in the ISR.

Between these two changes, Lucent cards suck less.  They work in
autoselect mode only.  And seem to get 1Mbps or 2Mbps only.  Setting a
specific media speed doesn't work, and I've had a few issues even with
these patches.  They turn a former brick into a nearly useful card.

These patches work on the prism 2 and 2.5 PC Card cards that I have.
I've not tested this on PCI cards.  I suspect, but couldn't find
proof, that they were the reason that the ISR was changed so radically
from its FreeBSD roots in NetBSD.  We might need to have a variant ISR
if so.
2003-03-18 04:22:42 +00:00
Warner Losh
572ab50c54 Move symbol reset detection code back into wi_reset. This is a more
reliable way to detect if the symbol cards have been reset or not.
This makes symbol cards work better.

Submitted by: deischen
2003-03-18 02:54:39 +00:00
Sam Leffler
474b12ddf0 new wi driver that uses the 802.11 link layer code
Reviewed by:	imp
Obtained from:	NetBSD (originally)
2003-01-15 20:11:31 +00:00
Matthew N. Dodd
c94b6ebc27 Suspend/resume support (mostly for MiniPCI Prism2.5 boards).
Reviewed by:	 imp
2003-01-14 23:19:32 +00:00
Warner Losh
7f2907fd70 Limit the TX key to a valid range
PR: 39960, 39961 (patches here pointed out problem, but didn't quite fix it)
2002-09-29 18:40:35 +00:00
Warner Losh
6f6efa5165 Move the symbol firmware loading routines into if_wi.
Define some basic firmware downloading commands.
2002-08-15 07:13:17 +00:00
Warner Losh
ffd283ae15 Send a disassoc packet for a STA that we don't know about that claims to
be associated with us.  From millert@openbsd.org

Obtained from: OpenBSD (I think)
2002-07-26 22:56:04 +00:00
Warner Losh
f83c4a42ea IF_HANDOFF is no longer in -stable 2002-06-30 22:39:25 +00:00
Warner Losh
d5ca4da61e Add better mediaopt support for ibss and friends.
Now the driver is closer to matching the wi man page.

Submitted by: jhay (who obtained it from OpenBSD).
2002-06-19 17:37:34 +00:00
Warner Losh
3465a702f3 Make this driver compile for -stable also to prep for MFC 2002-04-26 23:11:23 +00:00
Warner Losh
c8e6c42caa Minor format nit 2002-04-16 07:39:25 +00:00
Warner Losh
b0152b2e40 unifdef -DWI_HOSTAP, like OpenBSD does 2002-04-12 06:01:28 +00:00
Warner Losh
e122b676e6 Replace the original host WEP implementation with the one in OpenBSD
(apparently by markus@, at least committed by him).  This has the
advantage of not using the bad IV's from Fluhrer/Mantin/Shamir as well
as bringing the drivers a little closer together.

Also use a few constants in place of magic numbers in one place.

Obtained from: OpenBSD 1.25, 1.28, 1.36, 1.38, 1.42
2002-04-12 03:42:37 +00:00
Warner Losh
1bd2b5b4cd Integrate the hostap stuff that Thomas Skibo <skibo@packbell.net>
wrote.  This code was for 4.5-release, so I've ported it to -current
and made a few minor tweaks.  The biggest non-style tweak was to not
make access point the default.

More changes will be needed to get this actually working, but I wanted
to get a relatively pure baseline.  This doesn't seem to break what
works now.
2002-04-11 07:21:16 +00:00
Warner Losh
dfdbc0533d MFNetBSD:
wi.c 1.64: Table driven IDs (ichiro)
	1.59: Don't use magic numbers (ichiro)
Also, added Sony, Lucent Embedded Ids and fix minor bugs for lucent
cards (and submit those changes back to ichiro-san)

Obtained from: NetBSD
2002-04-04 21:40:37 +00:00
Warner Losh
a19c104dd2 Four fixes from NetBSD:
1) Properly detect the Symbol based cards (The 3Com Airconnect and their
   ilk) and only reset them *ONCE* ever.  This appears to make them work,
   but more testing is needed.  The tests that would wedge up my machine
   completely now appear to work, but I have not real access points
   handy.
2) Report both the Station firmware and the Primary firmware on Prism
   based cards.  On Lucent based cards, only report the station firmware
   since that's all it supports.  On symbol cards, report the symbol
   specific firmware name as its station firmware.
3) Better Prism 2.5 and 3 family names.  We really need to go table
   driven for this.
4) Workaround for bugs in Intersil's firmware is only needed for at most
   0.8.2 and earlier, since 0.8.3 and later appear to work.

Obtained from: NetBSD
2002-04-03 19:44:17 +00:00
Warner Losh
dbab04ca39 First cut at breaking out the bus attachment from the bus independent
part of the driver.  Also, move the softc and some other stuff to
if_wivar.h from if_wireg.h to make future merging activities easier.
2002-04-02 02:38:35 +00:00