Commit Graph

39 Commits

Author SHA1 Message Date
Sam Leffler
bb98624ad5 set default beacon miss threshold to 10 beacons
Submitted by:	Henrik Brix Andersen <henrik@brixandersen.dk>
MFC after:	2 weeks
2006-07-26 03:09:32 +00:00
Sam Leffler
ff046a6c6b add missed calls to bpf_peers_present 2006-06-02 23:14:40 +00:00
Christian S.J. Peron
16d878cc99 Fix the following bpf(4) race condition which can result in a panic:
(1) bpf peer attaches to interface netif0
	(2) Packet is received by netif0
	(3) ifp->if_bpf pointer is checked and handed off to bpf
	(4) bpf peer detaches from netif0 resulting in ifp->if_bpf being
	    initialized to NULL.
	(5) ifp->if_bpf is dereferenced by bpf machinery
	(6) Kaboom

This race condition likely explains the various different kernel panics
reported around sending SIGINT to tcpdump or dhclient processes. But really
this race can result in kernel panics anywhere you have frequent bpf attach
and detach operations with high packet per second load.

Summary of changes:

- Remove the bpf interface's "driverp" member
- When we attach bpf interfaces, we now set the ifp->if_bpf member to the
  bpf interface structure. Once this is done, ifp->if_bpf should never be
  NULL. [1]
- Introduce bpf_peers_present function, an inline operation which will do
  a lockless read bpf peer list associated with the interface. It should
  be noted that the bpf code will pickup the bpf_interface lock before adding
  or removing bpf peers. This should serialize the access to the bpf descriptor
  list, removing the race.
- Expose the bpf_if structure in bpf.h so that the bpf_peers_present function
  can use it. This also removes the struct bpf_if; hack that was there.
- Adjust all consumers of the raw if_bpf structure to use bpf_peers_present

Now what happens is:

	(1) Packet is received by netif0
	(2) Check to see if bpf descriptor list is empty
	(3) Pickup the bpf interface lock
	(4) Hand packet off to process

From the attach/detach side:

	(1) Pickup the bpf interface lock
	(2) Add/remove from bpf descriptor list

Now that we are storing the bpf interface structure with the ifnet, there is
is no need to walk the bpf interface list to locate the correct bpf interface.
We now simply look up the interface, and initialize the pointer. This has a
nice side effect of changing a bpf interface attach operation from O(N) (where
N is the number of bpf interfaces), to O(1).

[1] From now on, we can no longer check ifp->if_bpf to tell us whether or
    not we have any bpf peers that might be interested in receiving packets.

In collaboration with:	sam@
MFC after:	1 month
2006-06-02 19:59:33 +00:00
Poul-Henning Kamp
c40da00ca3 Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.
2006-05-16 14:37:58 +00:00
Max Laier
c10b140011 MFp4: reworked iwi-driver
Changelog towards if_iwi.c 1.26 (some changes have been committed separately
in the mean time):

- add led support
- add firmware loading on demand
 - auto-restart firmware when it crashes
 - serialize operations sent to the firmware to reduce firmware crashes
- add power save operation support
 - remove incorrect specification of tx power control capability
- add radio on/off switch support

- improve net80211 state machine operation
 - recognize and handle beacon miss
 - handle authentication and association failures better
 - add shared key authentication
 - fix ibss mode (many changes)
 - fix wme (many changes)
- correct radiotap support (many changes)
- correct bus dma setup of s/g
- correct various locking issues
- fix monitor mode
- fix scanning (many changes)
 - recover from wedged scan requests
 - respect active channel list
- eliminate cases where interface was marked down on error
- don't treat parity errors as fatal
- reclaim mgt frames immediately from tx queue
- correct interrupt handling, ack early (from NetBSD)
- fix short/long preamble handling

Committed with RELENG_6 compat #if's, should compile in RELENG_6.  Requires
net/iwi-firmware-kmod to function.

Much work done by:	sam
Tested by:		many (freebsd-net), ume, luigi
MFC after:		4 weeks
2006-04-27 21:43:37 +00:00
Damien Bergamini
1b996b2a23 o don't use '-' characters in firmware names
o call firmware_put() early to release the firmware module
o on firmware panics or watchdog timeouts, schedule a task to reinitialize
  the interface (we may sleep in iwi_init())
o discard oversized rx frames
2006-03-12 18:54:40 +00:00
Damien Bergamini
4f5d0153e4 add dependency with firmware module.
pointed out by Martin Wilke.
2006-03-11 13:30:21 +00:00
Ruslan Ermilov
0ec2de62a7 Fix build. 2006-03-11 08:36:15 +00:00
Damien Bergamini
389fb0b432 o acknowledge interrupts early in the interrupt handler
o stop processing interrupts after a firmware fatal error or a radio kill
o clarify the possible values for the 'antenna' sysctl.
o by default, let the firmware do antenna diversity.
  the  firmware will periodically switch to another antenna to evaluate the
  signal quality.
2006-03-10 20:35:09 +00:00
Damien Bergamini
bef9529d24 make use of the firmware(9) subsystem.
use intel's firmware version 3.0 layout.
2006-03-10 19:59:09 +00:00
Damien Bergamini
c56adf0a9a fix the locking. 2006-03-10 18:55:30 +00:00
Sam Leffler
b197bba53b correct check for whether wpa is enabled
MFC after:	3 days
2006-02-20 20:49:56 +00:00
Damien Bergamini
84f55b29e9 o Re-enable scatter/gather
o Change MEM_READ_1/MEM_READ_4 into macros (move them to if_iwireg.h)
o Add support for association LED
o Silently discard f/w notifications that are unknown (fixes spurious
  "unknown notification 15" in logs with latest firmware)
o Fix scanning of 5GHz channels
2006-01-29 12:03:03 +00:00
Damien Bergamini
a4f5ae8ad6 Don't use /etc/firmware. /etc is for configuration files only.
Use /boot to store firmware files instead.

Requested by:	Daniel O'Connor, Scott Long
2005-11-20 16:02:04 +00:00
Scott Long
e1000b3617 Fix compile on 64-bit platforms. 2005-11-20 04:27:24 +00:00
Damien Bergamini
408146ed57 Load firmware images directly from the filesystem (looks into /etc/firmware
directory by default) without requiring the user to load them by hand using
e.g iwicontrol.  Get rid of the old ioctl crud.
Updated iwi-firmware port coming soon.

Obtained from:	OpenBSD
2005-11-19 16:54:55 +00:00
Damien Bergamini
81e6343c3d Fix endianness issues. iwi now works on big endian architectures too.
Obtained from:	NetBSD (scw@)
MFC after:	2 weeks
2005-11-13 17:38:02 +00:00
Damien Bergamini
46c34436a3 Be more robust when handling Rx interrupts. If we can't allocate and DMA map
a new mbuf, just discard the received frame and reuse the old mbuf.
This should fix kernel panics on high network traffic.

Obtained from:  NetBSD (joerg@)
MFC after:      2 weeks
2005-11-13 17:16:06 +00:00
Damien Bergamini
71016a2499 Fixes my previous commit (rev 1.20)
MFC after:	1 day
2005-10-07 18:11:32 +00:00
Damien Bergamini
80e1a7127f o Use firmware extended scan command; this one doesn't crash when scanning
the 5GHz band.
o Enable 802.11a channels scanning for 2915ABG adapters.
o Fix a typo (negociated->negotiated).

With hints from NetBSD.

MFC after:	2 days
2005-10-06 20:11:01 +00:00
Damien Bergamini
28a380736d Use phk's kernel unit number allocator to associate unique ids to neighbors
in an IBSS.  Store ids directly into ieee80211_node's instead of managing
our own private association table.  Idea and code by Sam Leffler.

Submitted by:	sam
MFC after:	5 days
2005-09-19 18:59:04 +00:00
Damien Bergamini
7e47fb024c It's safe to wait for command completion in iwi_config().
MFC after:	5 days
2005-09-19 16:26:52 +00:00
Warner Losh
ad4f426ef6 Make sure that we call if_free(ifp) after bus_teardown_intr. Since we
could get an interrupt after we free the ifp, and the interrupt
handler depended on the ifp being still alive, this could, in theory,
cause a crash.  Eliminate this possibility by moving the if_free to
after the bus_teardown_intr() call.
2005-09-19 03:10:21 +00:00
Damien Bergamini
0b74a28506 o Add initial bits for IBSS support.
o Allow association with APs that do not broadcast SSID (with hints from
  Nick Hudson and Hajimu Umemoto).
o IFQ_DRV_PREPEND mbuf when h/w ring is full so it can be sent later.
o Increment if_oerrors when appropriate.
o Did some cleanup while I'm here.

MFC after:	1 day
2005-09-17 12:41:05 +00:00
Damien Bergamini
fb533d55c6 Enhanced WME (802.11e) support. 2005-08-21 09:52:18 +00:00
Damien Bergamini
ec01dc2bbc Add some necessary bits for upcoming 802.11e support:
o management of multiple tx rings (up to 4)
o setting of WME IE in association requests

Some features are still missing though, like the possibility to override
the default cwmin/cwmax/asfn values of each tx queues.
2005-08-20 16:49:03 +00:00
Damien Bergamini
94a7a9a24d Export adapter's internal statistics sysctl even if IWI_DEBUG is not defined.
MFC after:	1 week
2005-08-20 14:34:54 +00:00
Damien Bergamini
e0454c269b Don't automatically start scanning in if_init() if IEEE80211_ROAMING_MANUAL
flag is set.

MFC after:	1 week
2005-08-20 14:28:37 +00:00
John Baldwin
45f3f78ced Catch up to ic_curchan changes by making the same change here that was made
in ipw(4) in the earlier ic_curchan mega commit.

Submitted by:	Øyvind Kolbu oyvind at kolbu dot ws
Tested by:	Stefan Ehmann shoesoft at gmx dot net
2005-08-17 14:08:52 +00:00
Robert Watson
13f4c340ae Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to
ifnet.if_drv_flags.  Device drivers are now responsible for
synchronizing access to these flags, as they are in if_drv_flags.  This
helps prevent races between the network stack and device driver in
maintaining the interface flags field.

Many __FreeBSD__ and __FreeBSD_version checks maintained and continued;
some less so.

Reviewed by:	pjd, bz
MFC after:	7 days
2005-08-09 10:20:02 +00:00
Sam Leffler
e4918ecdb9 simplify ieee80211_node_authorize and ieee80211_node_unauthorize api's
MFC after:	3 days
2005-07-22 17:36:12 +00:00
Sam Leffler
7c5636947b remove driver-private key allocators; use the default one instead
so wpa keys are handled properly

Reviewed by:	avatar
Approved by:	re (scottl)
2005-07-10 00:17:05 +00:00
Sam Leffler
0a5ae7ccb8 reclaim node reference when ieee80211_encap fails
Reviewed by:	avatar
Approved by:	re (scottl)
2005-07-08 16:31:19 +00:00
Sam Leffler
82145663e3 reclaim mbuf when ieee80211_crypto_encap fails
Approved by:	re (scottl)
Obtained from:	netbsd
2005-07-07 02:55:04 +00:00
Mike Silbersack
7940f7071b Fix a read mbuf-after-free error in the iwi driver that was provoked by
the trash allocator being used on mbufs.

Reviewed by:	damien
Approved by:	re (scottl)
2005-06-23 04:34:43 +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
Damien Bergamini
acea42415f o Clear device-specific PCI register 0x41 (Retry Timeout) during attach
and on resume (reported to fix issues with ACPI)
o Add monitor mode support
o Add WPA (802.11i) support (not tested extensively though!)
o Add a device specific sysctl to control the tx antenna (default to
  antenna diversity)
o Fix sensitivity setting
o Fix setting of the capinfo field when associating
o Temporarly disable 802.11a channels scanning that was causing firmware
  panics with 2915ABG adapters until I find a better fix.  This breaks
  802.11a support.
o Temporarly switch back to software WEP until I implement hardware
  encryption for AES and TKIP too.

Approved by:    silby (mentor)
2005-05-22 18:55:32 +00:00
Warner Losh
6b1fe67d59 Print a warning once when trying to bring up interface before firmware load. 2005-05-15 21:02:51 +00:00
Damien Bergamini
ceaec73d40 Initial import of ipw, iwi, ral and ural drivers:
ipw  - Intel PRO/Wireless 2100
iwi  - Intel PRO/Wireless 2200BG/2225BG/2915ABG
ral  - Ralink Technology RT2500
ural - Ralink Technology RT2500USB

Approved by:	silby (mentor)
2005-04-18 18:47:38 +00:00