History log of /freebsd-11-stable/sys/dev/wi/if_wi.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 300292 20-May-2016 avos

wi: fix a typo.

The max size of bitmask is IEEE80211_MODE_BYTES, not IEEE80211_MODE_MAX.

Reuse it in bwn(4) while I'm here.

Noticed by: kevlo


# 300238 19-May-2016 avos

wi: switch to ieee80211_add_channel()

- Convert to ieee80211_add_channel().
- Add ic_getradiocaps() method.

Differential Revision: https://reviews.freebsd.org/D6235


# 299083 04-May-2016 avos

wi: fix a comment (0x1fff has 13 bits set).


# 298955 03-May-2016 pfg

sys/dev: minor spelling fixes.

Most affect comments, very few have user-visible effects.


# 296137 27-Feb-2016 jhibbits

Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere().

Most calls to bus_alloc_resource() use "anywhere" as the range, with a given
count. Migrate these to use the new bus_alloc_resource_anywhere() API.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D5370


# 295126 01-Feb-2016 glebius

These files were getting sys/malloc.h and vm/uma.h with header pollution
via sys/mbuf.h


# 289165 12-Oct-2015 adrian

net80211: move ieee80211_free_node() call on error from ic_raw_xmit() to ieee80211_raw_output().

This doesn't free the mbuf upon error; the driver ic_raw_xmit method is still
doing that.

Submitted by: <s3erios@gmail.com>
Differential Revision: https://reviews.freebsd.org/D3774


# 287197 27-Aug-2015 glebius

Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.

Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.

Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:

- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.

Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.

Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.

Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# 286865 17-Aug-2015 adrian

Convert more ifp->if_softc -> ic->ic_softc.

These should be a big no-op.

Tested:

* make universe


# 286437 07-Aug-2015 adrian

Revert the wifi ifnet changes until things are more baked and tested.

* 286410
* 286413
* 286416

The initial commit broke a variety of debug and features that aren't
in the GENERIC kernels but are enabled in other platforms.


# 286410 07-Aug-2015 glebius

Change KPI of how device drivers that provide wireless connectivity interact
with the net80211 stack.

Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.

Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:

- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.

Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.

Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to Olivier Cochard, gjb@, mmoll@,
op@ and lev@, who also participated in testing. Details here:

https://wiki.freebsd.org/projects/ifnet/net80211

Still, drivers: ndis, wtap, mwl, ipw, bwn, wi, upgt, uath were not
tested. Changes to mwl, ipw, bwn, wi, upgt are trivial and chances
of problems are low. The wtap wasn't compilable even before this change.
But the ndis driver is complex, and it is likely to be broken with this
commit. Help with testing and debugging it is appreciated.

Differential Revision: D2655, D2740
Sponsored by: Nginx, Inc.
Sponsored by: Netflix


# 283540 25-May-2015 glebius

Change three methods in struct ieee80211com, namely ic_updateslot,
ic_update_mcast and ic_update_promisc, to pass pointer to the ieee80211com,
not to the ifnet.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# 283537 25-May-2015 glebius

Set ic_softc in all 802.11 drivers. Not required right now, but will be
used quite soon.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# 283535 25-May-2015 adrian

Begin plumbing ieee80211_rx_stats through the receive path.

Smart NICs with firmware (eg wpi, iwn, the new atheros parts, the intel 7260
series, etc) support doing a lot of things in firmware. This includes but
isn't limited to things like scanning, sending probe requests and receiving
probe responses. However, net80211 doesn't know about any of this - it still
drives the whole scan/probe infrastructure itself.

In order to move towards suppoting smart NICs, the receive path needs to
know about the channel/details for each received packet. In at least
the iwn and 7260 firmware (and I believe wpi, but I haven't tried it yet)
it will do the scanning, power-save and off-channel buffering for you -
all you need to do is handle receiving beacons and probe responses on
channels that aren't what you're currently on. However the whole receive
path is peppered with ic->ic_curchan and manual scan/powersave handling.
The beacon parsing code also checks ic->ic_curchan to determine if the
received beacon is on the correct channel or not.[1]

So:

* add freq/ieee values to ieee80211_rx_stats;
* change ieee80211_parse_beacon() to accept the 'current' channel
as an argument;
* modify the iv_input() and iv_recv_mgmt() methods to include the rx_stats;
* add a new method - ieee80211_lookup_channel_rxstats() - that looks up
a channel based on the contents of ieee80211_rx_stats;
* if it exists, use it in the mgmt path to switch the current channel
(which still defaults to ic->ic_curchan) over to something determined
by rx_stats.

This is enough to kick-start scan offload support in the Intel 7260
driver that Rui/I are working on. It also is a good start for scan
offload support for a handful of existing NICs (wpi, iwn, some USB
parts) and it'll very likely dramatically improve stability/performance
there. It's not the whole thing - notably, we don't need to do powersave,
we should not scan all channels, and we should leave probe request sending
to the firmware and not do it ourselves. But, this allows for continued
development on the above features whilst actually having a somewhat
working NIC.

TODO:

* Finish tidying up how the net80211 input path works.
Right now ieee80211_input / ieee80211_input_all act as the top-level
that everything feeds into; it should change so the MIMO input routines
are those and the legacy routines are phased out.

* The band selection should be done by the driver, not by the net80211
layer.

* ieee80211_lookup_channel_rxstats() only determines 11b or 11g channels
for now - this is enough for scanning, but not 100% true in all cases.
If we ever need to handle off-channel scan support for things like
static-40MHz or static-80MHz, or turbo-G, or half/quarter rates,
then we should extend this.

[1] This is a side effect of frequency-hopping and CCK modes - you
can receive beacons when you think you're on a different channel.
In particular, CCK (which is used by the low 11b rates, eg beacons!)
is decodable from adjacent channels - just at a low SNR.
FH is a side effect of having the hardware/firmware do the frequency
hopping - it may pick up beacons transmitted from other FH networks
that are in a different phase of hopping frequencies.


# 283527 25-May-2015 glebius

Make net80211 drivers supply their device name to the net80211 layer, so
that the latter doesn't need to go through struct ifnet to get their name.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# 272068 24-Sep-2014 glebius

- Provide wi_get_counter() to return counters that are not collected,
but taken from hardware.
- Mechanically convert to if_inc_counter() the rest of counters.


# 260444 08-Jan-2014 kevlo

Rename definition of IEEE80211_FC1_WEP to IEEE80211_FC1_PROTECTED.

The origin of WEP comes from IEEE Std 802.11-1997 where it defines
whether the frame body of MAC frame has been encrypted using WEP
algorithm or not.
IEEE Std. 802.11-2007 changes WEP to Protected Frame, indicates
whether the frame is protected by a cryptographic encapsulation
algorithm.

Reviewed by: adrian, rpaulo


# 257176 26-Oct-2013 glebius

The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare
to this event, adding if_var.h to files that do need it. Also, include
all includes that now are included due to implicit pollution via if_var.h

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# 253756 29-Jul-2013 jhibbits

Use the streaming functions for reading/writing the BAP fields on wi(4). This
fixes wi(4) device access on big endian architectures.

PR: kern/164499
Reviewed by: adrian
Obtained from: NetBSD


# 243857 04-Dec-2012 glebius

Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags in sys/dev.


# 232147 25-Feb-2012 adrian

If an interrupt is received with no vap attached, just fail LINK events.

This fixes a NULL pointer dereference which occurs if the vap list is
empty but someone brings up the wi0 interface.


# 230562 26-Jan-2012 adrian

Include opt_wlan.h before net80211 includes; so IEEE80211_* configuration
flags are correctly handled.

This is required for this to load when IEEE80211_DEBUG_REFCNT is
defined.


# 228621 17-Dec-2011 bschmidt

Fix some net80211 enum nits:
- ic_vap_create() uses an ieee80211_opmode argument
- ieee80211_rate2media() takes an ieee80211_phymode argument
- ieee80211_plcp2rate() takes an ieee80211_phytype argument
- cast to enum ieee80211_protmode and ieee80211_roamingmode to silence
compiler warnings

Submitted by: arundel@


# 227309 07-Nov-2011 ed

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.


# 217586 19-Jan-2011 mdf

sysctl(8) should use the CTLTYPE to determine the type of data when
reading. (This was already done for writing to a sysctl). This
requires all SYSCTL setups to specify a type. Most of them are now
checked at compile-time.

Remove SYSCTL_*X* sysctl additions as the print being in hex should be
controlled by the -x flag to sysctl(8).

Succested by: bde


# 207554 03-May-2010 sobomax

Add new tunable 'net.link.ifqmaxlen' to set default send interface
queue length. The default value for this parameter is 50, which is
quite low for many of today's uses and the only way to modify this
parameter right now is to edit if_var.h file. Also add read-only
sysctl with the same name, so that it's possible to retrieve the
current value.

MFC after: 1 month


# 196970 08-Sep-2009 phk

Revert previous commit and add myself to the list of people who should
know better than to commit with a cat in the area.


# 196969 08-Sep-2009 phk

Add necessary include.


# 195049 26-Jun-2009 rwatson

Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/
IF_ADDR_UNLOCK() across network device drivers when accessing the
per-interface multicast address list, if_multiaddrs. This will
allow us to change the locking strategy without affecting our driver
programming interface or binary interface.

For two wireless drivers, remove unnecessary locking, since they
don't actually access the multicast address list.

Approved by: re (kib)
MFC after: 6 weeks


# 194023 11-Jun-2009 avg

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)


# 192517 21-May-2009 sam

force type match


# 192492 20-May-2009 imp

Revert last junk...


# 192468 20-May-2009 sam

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


# 192450 20-May-2009 imp

We no longer need to use d_thread_t, migrate to struct thread *.


# 191746 02-May-2009 thompsa

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


# 190579 30-Mar-2009 sam

Hoist 802.11 encapsulation up into net80211:
o call ieee80211_encap in ieee80211_start so frames passed down to drivers
are already encapsulated
o remove ieee80211_encap calls in drivers
o fixup wi so it recreates the 802.3 head it requires from the 802.11
header contents
o move fast-frame aggregation from ath to net80211 (conditional on
IEEE80211_SUPPORT_SUPERG):
- aggregation is now done in ieee80211_start; it is enabled when the
packets/sec exceeds ieee80211_ffppsmin (net.wlan.ffppsmin) and frames
are held on a staging queue according to ieee80211_ffagemax
(net.wlan.ffagemax) to wait for a frame to combine with
- drivers must call back to age/flush the staging queue (ath does this
on tx done, at swba, and on rx according to the state of the tx queues
and/or the contents of the staging queue)
- remove fast-frame-related data structures from ath
- add ieee80211_ff_node_init and ieee80211_ff_node_cleanup to handle
per-node fast-frames state (we reuse 11n tx ampdu state)
o change ieee80211_encap calling convention to include an explicit vap
so frames coming through a WDS vap are recognized w/o setting M_WDS

With these changes any device able to tx/rx 3Kbyte+ frames can use fast-frames.

Reviewed by: thompsa, rpaulo, avatar, imp, sephe


# 190574 30-Mar-2009 sam

fake the association id so packets are not rejected in the tx path


# 190526 29-Mar-2009 sam

Eliminate ic_myaddr so changing the mac address of a device works correctly:
o remove ic_myaddr from ieee80211com
o change ieee80211_ifattach to take the mac address of the physical device
and use that to setup the lladdr.
o replace all references to ic_myaddr in drivers by IF_LLADDR
o related cleanups (e.g. kill dead code)

PR: kern/133178
Reviewed by: thompsa, rpaulo


# 181210 02-Aug-2008 imp

Report what kind of chip only under bootverbose since that's now
exported via a sysctl.


# 180919 28-Jul-2008 imp

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.


# 180826 26-Jul-2008 imp

Register the interrupt handler at the end of wi_attach rather than at
the beginning. There's a race in the shared interrutp case. If
another interrupt happens after the interrupt is setup, then we'd try
to lock an uninitialized mutex. In addition, if we bailed out due to
a too old version of firmware, we'd leave the interrupt enabled with
all the fun that ensues....


# 178957 11-May-2008 sam

Minor cleanup of vap create work:
o add IEEE80211_C_STA capability to indicate sta mode is supported
(was previously assumed) and mark drivers as capable
o add ieee80211_opcap array to map an opmode to the equivalent capability bit
o move IEEE80211_C_OPMODE definition to where capabilities are defined so it's
clear it should be kept in sync (on future additions)
o check device capabilities in clone create before trying to create a vap;
this makes driver checks unneeded
o make error codes return on failed clone request unique
o temporarily add console printfs on clone request failures to aid in
debugging; these will move under DIAGNOSTIC or similar before release


# 178931 10-May-2008 thompsa

Only start the vaps if the init routine completed.


# 178704 01-May-2008 thompsa

Unify all the wifi *_ioctl routines
- Limit grabbing the lock to SIOCSIFFLAGS.
- Move ieee80211_start_all() to SIOCSIFFLAGS.
- Remove SIOCSIFMEDIA as it is not useful.
- Limit ether_ioctl to only SIOCGIFADDR. SIOCSIFADDR and SIOCSIFMTU have no
affect as there is no input/output path in the vap parent. The vap code
will handle the reinit of the mac address changes.
- Split off ndis_ioctl_80211 as it was getting too different to wired devices.

This fixes a copyout while locked and a lock recursion.

Reviewed by: sam


# 178354 20-Apr-2008 sam

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)


# 172200 16-Sep-2007 thompsa

Make wi_set_channel() actually change the channel in hardware so that hostap
mode works properly, previously the hostap channel could not be changed off #3.

Fix an ifp/sc misuse while I am here.

Reported by: many
Approved by: re (bmah)


# 172058 05-Sep-2007 sam

o add 802.11 state machine states for DFS and client-side power save
o fixup drivers to ignore new states

Reviewed by: avatar (?)
Approved by: re (blanket wireless)


# 171796 09-Aug-2007 avatar

MFP4(123963): Fixing a possible NULL pointer dereference by making
the actual assignment after the NULL check.

Found by: Coverity Prevent(tm)
CID: 2303 (run 4156)
Reviewed by: sam
Approved by: re (bmah)


# 171376 11-Jul-2007 thompsa

Now that wicontrol has been removed from the base system the corresponding
ioctls can be removed. These have been #ifdef'd out and left as a reference in
case any of the RIDs need to be turned into sysctls at a later date.

Reviewed by: sam, avatar
Approved by: re (kensmith)


# 171125 30-Jun-2007 thompsa

Fix scanning issues since the new net80211 code went in
- provide dummy routines for ic_scan_curchan and ic_scan_mindwell, we do not support those operations.
- add ieee80211_scan_done() to tell the scanning module that all channels have been scanned.
- pass IEEE80211_S_SCAN state off to net80211 so it can initiate scanning
- fix overflow in the rates array
- scale the rate value passed back from the firmware scan to the units that net80211 uses.

Submitted by: Token
Reviewed by: sam, avatar
Approved by: re (kensmith)


# 171124 30-Jun-2007 thompsa

Change the channel number in the scan results struct to be a pointer to the
operating channel and use this in the scan cache rather than directly using
ic_curchan. Some firmware cards can only do a full scan and so ic_curchan does
not have the correct value.

Also add IEEE80211_CHAN2IEEE to directly dereference ic_ieee from the channel
to be used in the fast path.

Reviewed by: sam, sephe
Approved by: re (kensmith)


# 171123 30-Jun-2007 thompsa

Fix the channel reporting when the card is associated. The channel array used
to be index by IEEE channel number but that is no longer the case and it needs
to be searched for.

Submitted by: avatar
Reviewed by: sam
Approved by: re (kensmith)


# 170530 11-Jun-2007 sam

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.


# 168860 19-Apr-2007 sephe

- Fix mbuf/node leakage in drivers' raw_xmit().
- For ural(4):
o Fix node leakage in ural_start(), if ural_tx_mgt() fails.
o Fix mbuf leakage in ural_tx_{mgt,data}(), if usbd_transfer() fails.
o In ural_tx_{mgt,data}(), set ural_tx_data.{m,ni} to NULL, if
usbd_transfer() fails, so they will not be freed again in ural_stop().

Approved by: sam (mentor)


# 166901 23-Feb-2007 piso

o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@


# 165089 10-Dec-2006 sam

replace if_watchdog w/ a private callout

MFC after: 1 month


# 165088 10-Dec-2006 sam

drop softc lock when passing rx frames up the stack

MFC after: 1 month


# 165087 10-Dec-2006 sam

split wi_start int locked+unlocked variants and use the unlocked
one from the isr to eliminate a recursive lock

MFC after: 1 month


# 165086 10-Dec-2006 sam

nuke compatibility cruft

MFC after: 1 month


# 164033 06-Nov-2006 rwatson

Sweep kernel replacing suser(9) calls with priv(9) calls, assigning
specific privilege names to a broad range of privileges. These may
require some future tweaking.

Sponsored by: nCircle Network Security, Inc.
Obtained from: TrustedBSD Project
Discussed on: arch@
Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri,
Alex Lyashkov <umka at sevcity dot net>,
Skip Ford <skip dot ford at verizon dot net>,
Antoine Brodin <antoine dot brodin at laposte dot net>


# 160991 05-Aug-2006 sam

raw 802.11 packet transmit support

Submitted by: Andrea Bittau <a.bittau@cs.ucl.ac.uk>


# 159320 05-Jun-2006 avatar

Really fix the typo this time: it should be sc->sc_drvbpf to be verified,
not ic->ic_drvbpf.


# 159319 05-Jun-2006 avatar

Fixing a typo in rev1.196.


# 159180 02-Jun-2006 csjp

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


# 158651 16-May-2006 phk

Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.


# 152315 11-Nov-2005 ru

- Store pointer to the link-level address right in "struct ifnet"
rather than in ifindex_table[]; all (except one) accesses are
through ifp anyway. IF_LLADDR() works faster, and all (except
one) ifaddr_byindex() users were converted to use ifp->if_addr.

- Stop storing a (pointer to) Ethernet address in "struct arpcom",
and drop the IFP2ENADDR() macro; all users have been converted
to use IF_LLADDR() instead.


# 150798 02-Oct-2005 avatar

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


# 150797 02-Oct-2005 avatar

Honouring ic->ic_dtim_period.

Submitted by: sam
MFC after: 3 days


# 150678 28-Sep-2005 ru

Fix "taskqueue_drain with the following non-sleepable locks held"
witness(9) warning on detach.


# 150306 19-Sep-2005 imp

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.


# 149601 29-Aug-2005 scottl

Correct previous commit.


# 149581 29-Aug-2005 imp

Eliminate bogus seatbelt in wi_cmd. This may have been appropriate
for the spl-era locking, but now that we can have multiple, concurrent
interrupts for multiple wi devices, having a global check to make sure
at most one of them was in wi_cmd no longer makes sense.

MFC After: 2 decifortnight


# 149007 12-Aug-2005 sam

fix media_status so devd recognizes the device as an 802.11 interface

Submitted by: Robert C. Noland III


# 148936 10-Aug-2005 sam

Clarify/fix handling of the current channel:
o add ic_curchan and use it uniformly for specifying the current
channel instead of overloading ic->ic_bss->ni_chan (or in some
drivers ic_ibss_chan)
o add ieee80211_scanparams structure to encapsulate scanning-related
state captured for rx frames
o move rx beacon+probe response frame handling into separate routines
o change beacon+probe response handling to treat the scan table
more like a scan cache--look for an existing entry before adding
a new one; this combined with ic_curchan use corrects handling of
stations that were previously found at a different channel
o move adhoc neighbor discovery by beacon+probe response frames to
a new ieee80211_add_neighbor routine

Reviewed by: avatar
Tested by: avatar, Michal Mertl
MFC after: 2 weeks


# 148887 09-Aug-2005 rwatson

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


# 148843 08-Aug-2005 sam

Cleanup beacon/listen interval handling:
o separate configured beacon interval from listen interval; this
avoids potential use of one value for the other (e.g. setting
powersavesleep to 0 clobbers the beacon interval used in hostap
or ibss mode)
o bounds check the beacon interval received in probe response and
beacon frames and drop frames with bogus settings; not clear
if we should instead clamp the value as any alteration would
result in mismatched sta+ap configuration and probably be more
confusing (don't want to log to the console but perhaps ok with
rate limiting)
o while here up max beacon interval to reflect WiFi standard

Noticed by: Martin <nakal@nurfuerspam.de>
MFC after: 1 week


# 148714 05-Aug-2005 imp

When the MAC address is reported all zeros, then error is necessarily
0. This means that we 'succeed' the attach, even after we've freed
the internal data bits. This leads to a panic when you eject the card
with this problem.

Set error = ENXIO in the mac read zeros case.


# 148654 02-Aug-2005 rwatson

Modify device drivers supporting multicast addresses to lock if_addr_mtx
over iteration of their multicast address lists when synchronizing the
hardware address filter with the network stack-maintained list.

Problem reported by: Ed Maste (emaste at phaedrus dot sandvine dot ca>
MFC after: 1 week


# 148290 22-Jul-2005 sam

diff reduction against p4: define IEEE80211_FIXED_RATE_NONE and use
it instead of -1


# 147256 10-Jun-2005 brooks

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


# 146884 01-Jun-2005 avatar

Honouring current authmode setting. With this patch, my wi card can now
associate to an AP which uses shared WEP key authentication.

Tested with: "ifconfig wi0 authmode shared"
Reviewed by: imp, sam


# 144986 13-Apr-2005 mdodd

Invert conditional and use continue to reduce nesting.


# 144167 26-Mar-2005 sam

correct logic so we recognize timeout on alloc

Noticed by: Coverity Prevent analysis tool


# 143299 08-Mar-2005 sam

reclaim mbuf chain when ieee80211_crypto_encap fails

Noticed by: David Young


# 139749 05-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


# 139542 01-Jan-2005 sam

Eliminate some of the egregious bypass of the 802.11 state
machine; instead use the intended entry points. There's still
too much incestuous knowledge about the internals of the
802.11 layer but this at least fixes adhoc mode.


# 138988 17-Dec-2004 mdodd

Diff reduce wi_write_wep() relative to revision 1.168


# 138952 17-Dec-2004 sam

Fix wep operation for station mode:
o don't encapsulate on tx; the chip expect a raw frame w/o the crypto header
o clear the WEP bit in the 802.11 header on rx so the 802.11 layer doesn't
try to strip the crypto header
o clobber the "drop unencoded frames" state bit when privacy is enabled so
rx'd frames we pass up to the 802.11 layer are not discarded as unencrypted

This stuff will need to be redone if anyone decides to add WPA support.


# 138951 17-Dec-2004 sam

set ic_ibss_chan when entering RUN state to match ic_bss so the channel
reported when associated to an AP is correct


# 138949 17-Dec-2004 sam

remove power save logic from the tx path; the driver isn't ready to support
it so don't mislead folks


# 138571 08-Dec-2004 sam

o Update for net80211 changes
o Import some minor fixes from netbsd


# 132986 01-Aug-2004 mlaier

Second part of ALTQ driver modifications, covering:
an(4), ath(4), hme(4), ndis(4), vr(4) and wi(4)

Please help testing: http://people.freebsd.org/~mlaier/ALTQ_driver/

Tested by: Vaidas Damosevicius (an, ath, wi)
Roman Divacky (vr)
Submitted by: yongari (hme)


# 130416 13-Jun-2004 mlaier

Link ALTQ to the build and break with ABI for struct ifnet. Please recompile
your (network) modules as well as any userland that might make sense of
sizeof(struct ifnet).
This does not change the queueing yet. These changes will follow in a
seperate commit. Same with the driver changes, which need case by case
evaluation.

__FreeBSD_version bump will follow.

Tested-by: (i386)LINT


# 127698 31-Mar-2004 sam

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


# 127697 31-Mar-2004 sam

correct xmit-side radiotap collection by tap'ing the frame before
prepending the h/w header


# 127237 20-Mar-2004 mdodd

Don't announce MAC addresses twice.
(ieee80211_ifattach() calls ether_ifattach().)


# 127148 17-Mar-2004 green

Eliminate bogus usage of WI_RSSI_TO_DBM(). Not only does it bogusly
clip/destroy the dB value contained in the wi(4)'s receive frames,
it doesn't match with the flag set in the radiotap header
(unperturbed dB versus dBm).


# 127135 17-Mar-2004 njl

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


# 123927 28-Dec-2003 sam

update radiotap support to reflect recent changes:

o add xmit rate
o drop rx time
o add rx flags


# 123922 28-Dec-2003 sam

o eliminate widespread on-stack mbuf use for bpf by introducing
a new bpf_mtap2 routine that does the right thing for an mbuf
and a variable-length chunk of data that should be prepended.
o while we're sweeping the drivers, use u_int32_t uniformly when
when prepending the address family (several places were assuming
sizeof(int) was 4)
o return M_ASSERTVALID to BPF_MTAP* now that all stack-allocated
mbufs have been eliminated; this may better be moved to the bpf
routines

Reviewed by: arch@ and several others


# 123339 09-Dec-2003 imp

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.


# 123098 02-Dec-2003 imp

Fix Lucent cards.
o Back out workaround for not resetting lucent cards more than once. With
these fixes, it appaers they are no longer necessary.
o Set wi_gone when the card goes awol: typically when we get 0xffff back from
the card. Also, don't interact with a card that's gone, so we fail in
seconds rather than minutes. Also reduce amount of time we wait to .5s
in wi_cmd.
o clear wi_gone on ifconfig down to give some cards a chance after they wedge
(this appears to unwedge one of my prism cards with old firmware). ifconfig
up will fail quickly enough if the card really is out to lunch.
o Add delay in wi_init of 100ms.
o wi_stop(ifp, 0->1) changes so that we clear sc_enabled so that we
exit out of the interrupt routine by just acking the interrupt

Submitted by: iedowse
Approved by: re@ (scottl)

# after the freeze I'll fix some of the minor style issues that reviewers
# of this patch have told me about.


# 122087 04-Nov-2003 green

Truly fix the lockup mentioned in 1.153. The PRISM hardware is not
capable of functioning in HostAP mode with a zero-length SSID, so
use " " if one is not set.


# 122083 04-Nov-2003 green

Despite making the card not lock up, thae workaround from 1.153 didn't
actually make hostap mode work again. Back it out while I try to find
a solution.


# 122015 03-Nov-2003 green

Fix wi(4)'s WI_RID_SCAN_RES ioctl (wicontrol -L). The wrong length
is computed, so the user thinks that for non-PRISM cards there are
more APs represented than exist.


# 122014 03-Nov-2003 green

On my ZoomAir-branded Intersil PRISM2 cards, if you try to set the
operating mode to HostAP, the card will lock up indefinitely (but
the wi(4) driver can recover if you eject the card). The problem is
that the card needs to be "reset" in a way before you even change the
media to hostap. In practice this isn't as noticeable because you
probably do some operation beforehand which prevents the lock-up
before you enable hostap mode.

e.g.:
"ifconfig wi0 up media autoselect mediaopt hostap" will lock up
(if you just inserted the card).
"ifconfig wi0 up ssid foo media autoselect mediaopt hostap" won't lock up.


# 121816 31-Oct-2003 brooks

Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By: re (in principle)
Reviewed By: njl, imp
Tested On: i386, amd64, sparc64
Obtained From: NetBSD (if_xname)


# 121697 29-Oct-2003 sam

mark interrupt handlers MPSAFE


# 119784 05-Sep-2003 sam

o add experimental radiotap capture format
o add netbsd logic to convert rssi to device-independent values

Obtained from: NetBSD (rssi conversion code)


# 119150 19-Aug-2003 sam

MFp4 changes to fix locking issues and correct reference
count handling of station entries in hostap mode:

Input path:

o driver is now expected to find the node associated with the
sender of a received frame; use ic_bss if none is located
o driver passes the (referenced) node into ieee80211_input for
use within the wlan module and is responsible for cleaning up
on return
o the antenna state is no longer passed up with each frame; this
is now considered driver-private state and drivers are responsible
for keeping it in the driver-private part of a node

Output path:

Revamp output path for management frames to eliminate redundant
locking that causes problems and to correct reference counting
bogosity that occurs when stations are timed out due to inactivity
(in AP mode). On output the refcnt'd node is stashed in the pkthdr's
recvif field (yech) and retrieved by the driver. This eliminates
an unref/ref scenario and related node table unlock/lock due to the
driver looking up the node. This is particularly important when
stations are timed out as this causes a lock order reversal that
can result in a deadlock. As a byproduct we also reduce the overhead
for sending management frames (minimal). Additional fallout from
this is a change to ieee80211_encap to return a refcn't node for
tieing to the outbound frame. Node refcnts are not reclaimed until
after a frame is completely processed (e.g. in the tx interrupt
handler). This is especially important for timed out stations as
this deref will be the final one causing the node entry to be
reclaimed.

Additional semi-related changes:
o replace m_copym use with m_copypacket (optimization)
o add assert to verify ic_bss is never free'd during normal operation
o add comments explaining calling conventions by drivers for frames
going in each direction
o remove extraneous code that "cannot be executed" (e.g. because
pointers may never be null)


# 117855 21-Jul-2003 sam

o Add monitor mode support. This tested fine with prism cards but may require
newer lucent/hermes firmware than indicated (investigating). I'm committing
this now since it shouldn't hurt anything.
o Vaguely related, add bogus frame length check from netbsd.

Obtained from: netbsd


# 117812 20-Jul-2003 sam

track changes to 802.11 code:

o override new_state method per new model
o use ieee80211_state_name instead of private copy


# 117194 03-Jul-2003 scottl

Revert the previous commit, it snuck in by accident.

Submitted by: ru


# 117126 01-Jul-2003 scottl

Mega busdma API commit.

Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma. At the moment, this is used for the
asynchronous busdma_swi and callback mechanism. Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg. dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create(). The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms. The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by: tmm, gibbs


# 117042 29-Jun-2003 sam

catch failure to fetch the card's "own channel"; this should not happen


# 116951 28-Jun-2003 sam

update for new 802.11 support


# 116898 26-Jun-2003 sam

Return support needed by dstumbler:

o add back rx monitor support
o make WI_RID_SCAN_RES DTRT
o fix a bug handling zero-length RID requests (used by dstumbler to set
a zero-length SSID)
o make RID_SCAN_REQ DTRT
o add back WI_RID_OWN_SSID
o fix wi_scan_ap to take a channel mask and txrate (for prism cards)

These changes fix dstumbler -o (monitor mode). A minor change to dstumbler
is needed to get normal AP scanning mode to work right; this is preferred to
modifying the driver.

PR: kern/53187
Reviewed by: Bruce M Simpson <bms@spc.org>


# 116276 12-Jun-2003 imp

As a workaround for the latest problems, don't init hermes cards more
than once. This appears to work around the hanging issues, at the
expense of warnings about bad RID allocations. I'm not sure this is a
permanant workaround, but does appear to help in the tests that I've
done here.


# 116206 11-Jun-2003 imp

Minor tweaks that are effectively all style tweaks.


# 114190 29-Apr-2003 imp

Don't hold a driver lock across bus_teardown_intr. Jhb points out
that one cannot generally hold a lock and call bus_teardown_intr.
This is race free with wi_intr because bus_teardown_intr won't allow
wi_intr to be called after it returns.

# jeff hsu points out that there might be a race between this unlock
# and wi_start. While that may be true also, it won't impact this commit.

Submitted by: jhb


# 114138 27-Apr-2003 imp

Initialize error.


# 114124 27-Apr-2003 imp

Make 2/3 of my symbol cards work again. The 3rd symbol card card has
firmware 1.50.12, but 2.20.1 and 3.10.4 work. The 1.50.12 card gets
past doing dhclient, but hangs on transmit a little after the ip
address is set. The 1.50.12 card has always been 'cranky' and Bill
Paul's tearing it apart at FreeBSD '99 hasn't helped.

sc_reset and sc_enable are subtlely different things. sc_reset means
exactly "WI_CMD_INI has happened." sc_enabled means "WI_CMD_ENABLE
has been sent to the card without a WI_CMD_DISABLE following." This
is a little different than what they mean on NetBSD (where both of
these concepts are comingled). NetBSD will try to only enable symbol
cards once, while FreeBSD only sends the WI_CMD_INI once.

Also, only try once to reset the card on a symbol.

This makes the lucent cards no worse than before, but apparently not
much better either. I got fewer hangs in my testing than I have in
the past, but I don't know if it is statistically significant or not.


# 113327 10-Apr-2003 imp

Fix interrupt race.

From NetBSD


# 113038 03-Apr-2003 obrien

Use __FBSDID rather than rcsid[].


# 112501 22-Mar-2003 imp

MFP4 27224 and 27225:

Change 27224 by imp@imp_hammer on 2003/03/22 00:16:22
Put what I think are the correct TX RATE translation tables
in place for LUCENT firmware. This is based on the 4.x driver.
Maybe it should be table driven?

ifconfig wi0 media DS/11Mbps still fails, but it fails before
we even get to the txrate stuff, so other things are wrong.

Change 27225 by imp@imp_hammer on 2003/03/22 00:45:11
Default ic_fixed_rate to -1. This is the same thing as autoselect.
There really should be a #define for this...


# 112363 18-Mar-2003 imp

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.


# 112362 18-Mar-2003 imp

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


# 112343 17-Mar-2003 imp

Remove bogus KASSERT. The 802.11 layer and the resume from suspend
code both seem to call wi_start (directly or via the if_start pointer)
without checking to see if OACTIVE is 0. In addition, I think that
with the use of 3 transmit buffers this routine can be called with
OACTIVE set, but I might be mistaken about that (and it doesn't
matter).

Reviewed by: sam
Noticed by: imp, alfred, ambrisko


# 112096 11-Mar-2003 imp

Remove bogus UNLOCK in if_wi.c. Since we no longer WILOCK() in the
attach routine, calling WIUNLOCK in the error case of one of the ifs
for that routine is now bogus. This should have been removed when the
WILOCK() was removed, but wasn't.

Submitted by: "Harti Brandt" <brandt@fokus.fraunhofer.de>


# 111559 26-Feb-2003 sam

Change default setting of hw.wi.txerate to zero so that tx error msgs are
ignored (as before). This was the original setting but a bug in ppsratecheck
made me do stupid things.


# 111119 19-Feb-2003 imp

Back out M_* changes, per decision of the TRB.

Approved by: trb


# 110224 02-Feb-2003 imp

Unlock the mutex in the error case in wi_init. Otherwise we can return
from an ioctl with the lock held.

Submitted by: iedowse (by way of sam)


# 109623 21-Jan-2003 alfred

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


# 109593 20-Jan-2003 sam

correct default setting of hw.wi.txerate; it must be -1, not zero,
to silence all msgs (like the old driver)


# 109592 20-Jan-2003 sam

correct sysctl names and move them to hw.wi: hw.wi.txerate controls the rate
at which tx errors are printed (default to 0); hw.wi.debug control the debug
msgs and is only present when WI_DEBUG is defined at compile time (the default
for the moment)

Requested by: imp


# 109585 20-Jan-2003 sam

gc dead code


# 109545 19-Jan-2003 sam

default tx error rate limiting to 0 to disable tx error msgs; this is
consistent with how the old driver worked


# 109396 16-Jan-2003 imp

Restore a comment that was lost in the shuffle.


# 109323 15-Jan-2003 sam

new wi driver that uses the 802.11 link layer code

Reviewed by: imp
Obtained from: NetBSD (originally)


# 109259 14-Jan-2003 mdodd

Suspend/resume support (mostly for MiniPCI Prism2.5 boards).

Reviewed by: imp


# 108259 24-Dec-2002 rwatson

Require privilege to flush the signal cache on if_an and if_wi 802.11
cards.

Reviewed by: imp (if_wi)


# 106937 14-Nov-2002 sam

network interface driver changes:

o don't strip the Ethernet header from inbound packets; pass packets
up the stack intact (required significant changes to some drivers)
o reference common definitions in net/ethernet.h (e.g. ETHER_ALIGN)
o track ether_ifattach/ether_ifdetach API changes
o track bpf changes (use BPF_TAP and BPF_MTAP)
o track vlan changes (ifnet capabilities, revised processing scheme, etc.)
o use if_input to pass packets "up"
o call ether_ioctl for default handling of ioctls

Reviewed by: many
Approved by: re


# 105076 13-Oct-2002 imp

o Comment out the symbol download code for 4.x.
o Add hooks for doing power management of the output signal.
o Minor hacks to make flexlint happy wrt staticness of functions.


# 104147 29-Sep-2002 imp

Limit the TX key to a valid range

PR: 39960, 39961 (patches here pointed out problem, but didn't quite fix it)


# 102208 21-Aug-2002 imp

When setting the WI_RID_ENCRYPTION mode, we have to conditionally
set EXCLUDE_UNENCRYPTED if we're not in OPEN mode (or if we are a
symbol card).

Obtained from: OpenBSD (looks like a millert@ special)


# 102206 21-Aug-2002 imp

comment about the magic number -149


# 102204 21-Aug-2002 imp

Treat IBSS the same as ADHOC in wi_get_cur_ssid. This makes ifconfig
work better, but might not make ibss actually work on the prism2 cards
that I have (this is the first time I've tried ibss in a long time).


# 101903 15-Aug-2002 imp

Move the symbol firmware loading routines into if_wi.
Define some basic firmware downloading commands.


# 101665 11-Aug-2002 imp

Follow NetBSD's lead and use WI_PORTTYPE_HOSTAP instead of _AP, since
_AP might be used in the future for cards with firmware that does AP in
firmware.


# 101355 05-Aug-2002 imp

Differentiate between AT45DB011 compatible large serial flash parts
and the AT24C08 small serial flash parts. We still report these as
the same part (since we group things already), but now we recognize
the small serial versions as well.


# 101139 01-Aug-2002 imp

Don't set the IFF_PROMISC bit when in hostap mode like the previous
commit bogusly did. Instead, don't set PROMSIC in the hardware if
we're in hostap mode. This matches more closely what openbsd did as
well.


# 100876 29-Jul-2002 imp

If we are in hostap mode, do not go into promisc mode. This causes
problems with the firmware and will result in a) poor performance and
b) the inability to associate certain types of cards (most notibly
cisco).

Idea obtained from OpenBSD, but I implemented it by clearing the
IFF_PROMISC flag rather than the refusing to honor it downstream.


# 100734 26-Jul-2002 imp

Only INTERSIL 0.8.3 and newer firmware is supported with hostap mode.
While earlier versions can be made to work, they require various work
arounds not in the driver right now.


# 98440 19-Jun-2002 imp

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).


# 97512 29-May-2002 phk

Add one copy of crc32() and crc32_tab[] in libkern, and remove it two other
places.

Comment out crc32 related definitions in zlib.h, we don't seem to have the
corresponding code in our kernel.


# 95706 29-Apr-2002 imp

Untimeout before calling timeout. I think that I have caught all the cases
where we were scheduling a timeout multiple times, but am not positive.


# 95534 26-Apr-2002 imp

Make this driver compile for -stable also to prep for MFC


# 95533 26-Apr-2002 mike

Move the new byte order function prototypes from <sys/param.h> to
<sys/endian.h>. This puts us in line with NetBSD and OpenBSD.


# 95031 19-Apr-2002 onoe

Some fixes for Symbol card.
- The version string doesn't need to start with 'V'.
- Symbol firmware doesn't support ROAMING_MODE nor MICROWAVE_OPEN.
Obtained from: NetBSD


# 94695 14-Apr-2002 brooks

Fix tx-rate setting for Lucent cards.

Submitted by: Eugene Perevyazko <john@pcs.dp.ua>


# 94490 12-Apr-2002 imp

After committing the forgotten IFM_IEEE80211_HOSTAP stuff to if_media.h,
no need for the ifdefs here anymore.


# 94486 12-Apr-2002 imp

unifdef -DWI_HOSTAP, like OpenBSD does


# 94484 12-Apr-2002 alfred

ifdef WI_HOSTAP some stuff that seems like it needs to be ifdef'd.


# 94472 12-Apr-2002 imp

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


# 94405 11-Apr-2002 imp

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.


# 94397 11-Apr-2002 imp

better init


# 93833 04-Apr-2002 imp

MFNetBSD:
1.60: Add range checking, but put it higher up in the food
chain than NetBSD (this should be fixed there as well).

Obtained From: NetBSD


# 93825 04-Apr-2002 imp

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


# 93818 04-Apr-2002 jhb

Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on: i386, alpha, sparc64


# 93756 04-Apr-2002 imp

o Reduce the gratuitous differences with NetBSD.
o OpenBSD's wiconfig tells me that a value of '2' is for sony wireless
cards, 1 is for lucent (which we already knew) and '5' is for embedded
lucent cards.
o Move some RID definitions to if_wavelan_ieee.h and use NetBSD names
more often.

# more work is still needed in this area.


# 93733 03-Apr-2002 imp

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


# 93611 02-Apr-2002 imp

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.


# 93593 01-Apr-2002 jhb

Change the suser() API to take advantage of td_ucred as well as do a
general cleanup of the API. The entire API now consists of two functions
similar to the pre-KSE API. The suser() function takes a thread pointer
as its only argument. The td_ucred member of this thread must be valid
so the only valid thread pointers are curthread and a few kernel threads
such as thread0. The suser_cred() function takes a pointer to a struct
ucred as its first argument and an integer flag as its second argument.
The flag is currently only used for the PRISON_ROOT flag.

Discussed on: smp@


# 93567 01-Apr-2002 imp

More diff reduction patches


# 93563 01-Apr-2002 imp

Fix type from last commit


# 93560 01-Apr-2002 imp

Add more ID's from the PRISM family. from wi.c 1.61 and wireg.h 1.26 by
ichiro@netbsd.org

Obtained from: NetBSD


# 93360 28-Mar-2002 imp

Identify PRISM 2.5 with ISL37300P

Obtained from: OpenBSD


# 93359 28-Mar-2002 imp

Integrate the air-tools 0.2 from dachb0den labs.
o This moves the common.h file into if_wavelan_ieee.h

Submitted by: h1kari@dachb0den.com


# 92457 16-Mar-2002 imp

o Rework the identify routine a little, merging it with NetBSD's wi.
o Add exerpimental support for identifying lucent cards. All of mine
come back with ID of 1, but NetBSD committed code for 5. So accept
both.
o rename wi_prism2_ver to wi_firmware_ver so that we could, if necessary,
do special things for lucent cards too.
o Bring in a small part of the changes from airtools: The wi_cmd function
now takes two additional arguments. I didn't bring in their ioctls yet.
o eliminate the use of LE16TOH, and remove its define.
o Print the firmware as if there were 100 versions instead of 10. This means
that 6.1 and 6.10 aren't confusing to people. We now print 6.01 in the
former case.

# A good junior hacker project would be to merge the NetBSD, FreeBSD, and
# OpenBSD drivers into one source base.


# 92117 11-Mar-2002 brooks

Add support for 3Com Airconnect PCI cards.

MFC after: 3 days


# 91695 05-Mar-2002 imp

Add roaming and microwave oven support. Some minor formatting nits.
Some buggy firmware workarounds. Fix some endian bugs.

These reduce the diffs from NetBSD, but NetBSD does have more changes since
my last manual merge.


# 91693 05-Mar-2002 imp

Remove __P to reduce diffs with NetBSD and my private tree.


# 91608 04-Mar-2002 imp

Add a bunch of cards from NetBSD and maybe other places.

Ericsson Wireless Lan
Simple Tech Spectrum 24 Alt
Socket LP WLAN CF
Symbol LA4100


# 91548 01-Mar-2002 brooks

Make 128-bit WEP (aka 104-bit WEP) work with Prism based cards.

Submitted by: Thomas Skibo <skibo@pacbell.net>
MFC after: 3 days


# 91394 27-Feb-2002 tmm

Add the following functions/macros to support byte order conversions and
device drivers for bus system with other endinesses than the CPU (using
interfaces compatible to NetBSD):

- bwap16() and bswap32(). These have optimized implementations on some
architectures; for those that don't, there exist generic implementations.
- macros to convert from a certain byte order to host byte order and vice
versa, using a naming scheme like le16toh(), htole16().
These are implemented using the bswap functions.
- stream bus space access functions, which do not perform a byte order
conversion (while the normal access functions would if the bus endianess
differs from the CPU endianess).

htons(), htonl(), ntohs() and ntohl() are implemented using the new
functions above for kernel usage. None of the above interfaces is currently
exported to user land.

Make use of the new functions in a few places where local implementations
of the same functionality existed.

Reviewed by: mike, bde
Tested on alpha by: mike


# 91318 26-Feb-2002 brooks

Add a missing field to the end of array marker in the pci_ids array.

Submitted by: sumikawa


# 90580 12-Feb-2002 brooks

Add support for the Linksys WMP-11, Prism 2.5, PCI adaptor.

Submitted by: Thomas Skibo <skibo@pacbell.net>
MFC after: 2 weeks


# 90027 31-Jan-2002 alfred

identify GLPRISM2 PCI WaveLAN/IEEE 802.11

Submitted by: Toni Andjelkovic <toni@soth.at>


# 89600 20-Jan-2002 brooks

Add support for Linksys WDT11 PCI adaptors.

Submitted by: Eric Liedtke <eliedtke@apogeetelecom.com>


# 88546 27-Dec-2001 alfred

put function return types on a line by themselves as per style(9)


# 87599 10-Dec-2001 obrien

Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.


# 87539 08-Dec-2001 alfred

Replace %i formatting characters with %d since printf(9) doesn't support %i.

Someone forgot the long flamefest I lost to add %i to kernel printf.


# 87383 05-Dec-2001 imp

Implement prism2 detection from NetBSD. This mostly obsoletes the
prism2 flag in pccard.conf, but I'm leaving it place for the moment in
case the small sample of PrismII cards that I've tried is not
representative.

MFC After: 30 days
Obtained from: NetBSD


# 87046 28-Nov-2001 imp

Add Buffalo AirStation 11Mbps CF WLAN card.

Obtained from: NetBSD (ichiro)


# 86579 19-Nov-2001 imp

Add Linksys Instant Wireless Network PC Card from NetBSD


# 86385 15-Nov-2001 imp

Hoist the Card/Card2 macros that I invented for the wi driver into
pccard layer and rename them PCMCIA_CARD and PCMCIA_CARD2 respectively
(note, this is being done with an eye towards NetBSD integreation so
it is easier to keep lists of cards between us and them in sync).

Use this in the an and wi drivers.


# 86277 11-Nov-2001 imp

Add a bunch of wireless cards for NEWBUS from NetBSD's list. I'm
trying something new with the macros here and will likely try to get
them adopted by NetBSD as well as moving them to other drivers. They
make the list more compact and easier to read, the price of rigid to a
schema for generating them (of course there are those that would argue
this isn't bad).

Obtained from: NetBSD's if_wi_pcmcia.c 1.9


# 86273 11-Nov-2001 imp

s/PCCARD_/PCMCIA_/g in NEWCARD device tables to enable easier NetBSD sharing


# 83366 12-Sep-2001 julian

KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after: ha ha ha ha


# 83130 06-Sep-2001 jlemon

Wrap array accesses in macros, which also happen to be lvalues:

ifnet_addrs[i - 1] -> ifaddr_byindex(i)
ifindex2ifnet[i] -> ifnet_byindex(i)

This is intended to ease the conversion to SMPng.


# 82453 28-Aug-2001 imp

Make this compile when there is no pci bus in your kernel.

Note: This should be multiple files, but since it is also broken in
stable, I thought I'd do a fix that could be MFC'd.

This is a MFC candidate.


# 82258 24-Aug-2001 nsayer

Get rid of redundant device_set_desc. Both the PCI and PCCARD versions
do this in the probe routine now.


# 82256 24-Aug-2001 nsayer

In order for the MA301 to pass interrupts from the PCCard, you must
go into the PLX 9052's interrupt control register and turn on the magic
interrupt enable bit.

Partial thanks are due to OpenBSD for pointing out that the chip is a
PLX 9052 and pointing me to the datasheet PDF.


# 82167 23-Aug-2001 nsayer

Oops. The new pci_ids array should be static.


# 82153 22-Aug-2001 nsayer

Add support for the Netgear MA301 PCI adapter for the MA401.

It appears that a number of PrismII card vendors seem to be doing the
same thing (that is, using the same PCI bridge chip) to support PCI,
but each with their own vendor/product ID. So rather than cut-n-paste
another if statement into the probe routine, it's probably better to
provide support for a table. Adding new devices will be a lot easier
that way.


# 77217 26-May-2001 phk

Currently, each wireless networking driver has it's own control program
despite the fact that most people want to set exactly the same settings
regardless of which card they have. It has been repeatidly suggested
that this configuration should be done via ifconfig. This patch
implements the required functionality in ifconfig and add support to the
wi and an drivers. It also provides partial, untested support for the
awi driver.

PR: 25577
Submitted by: Brooks Davis <brooks@one-eyed-alien.net>


# 76457 11-May-2001 grog

Fix world-breaking typo in previous commit.


# 76438 10-May-2001 wpaul

Try to read the station address twice during the probe. I've seen
a LinkSys card here in the office where reading the station address
fails the first time, but works find afterwards. Without this, the
probe fails. I don't think this will negatively impact any existing
cards, but I want to confirm this before MFC'ing.


# 75373 10-Apr-2001 alfred

Add more diagnostic output for failure.

s/1518/ETHER_MAX_LEN

Some style changes, add some braces, mostly residual from having
a lot of debug hooks added while working on this driver.

Bring in a plethora of changes from NetBSD:

revision 1.58
date: 2001/03/08 11:07:08; author: ichiro; state: Exp; lines: +17 -1
it wait until busy flag disappears.
it was able to prevent some cards with late initializing faling in wi_reset().

revision 1.41
date: 2000/10/13 19:15:08; author: jonathan; state: Exp; lines: +4 -2
Fix wi_intr() to avoid touching card registers during insert/remove events,
when sharing an interrupt with other devices:
check sc->sc_enabled, and drop the interrupt if its' off.

revision 1.30
date: 2000/08/18 04:11:48; author: jhawk; state: Exp; lines: +4 -4
Copy wi_{dst,src}_addr from struct wi_frame into faked-up ether_header
instead of addr1 and addr2. THis means that tcpdump -e will show the
correct MAC address for communications with access points instead of showing
the BSSID.

In the future there should be 802.11 support for bpf/libpcap/tcpdump,
but that is aways down the road.


# 75331 09-Apr-2001 imp

Two minor fixes:
o Change the number of init tries from 5 to a #define.
o Allow up to 5s rather than 2s for commands to complete. This
is still much less than 51 minutes, but makes my intel card init
with more reliability than before.


# 75276 06-Apr-2001 alfred

use correct contants (from net/ethernet.h)

ETHER_TYPE_LEN instead of sizeof(u_int16_t) when looking at an ethernet
header

ETHERTYPE_IP instead of 0x800


# 75275 06-Apr-2001 alfred

replace hardcoded 1518 with ETHER_MAX_LEN


# 75229 05-Apr-2001 alfred

test should be for == 0, not < 0


# 75227 05-Apr-2001 alfred

WI_TIMEOUT is 65536

65536 * 10msec == 10 minutes 55 seconds == hung machine

Instead wait for the busy bits for a max of ~2 seconds (200 * 10msec)


# 75219 05-Apr-2001 alfred

Don't leak resources:

Don't leak iospace when irq allocation fails. (call wi_free())

Call bus_release_resource() with the correct "rid" obtained from
bus_alloc_resource() that's saved in the softc instead of a hardcoded
0.


# 75199 04-Apr-2001 alfred

call a watchdog timeout like it is.


# 75150 04-Apr-2001 imp

Doh! Last second change introduced two compile warnings. Fix them.


# 75149 04-Apr-2001 imp

Try to INIT the cards up to 5 times in a row rather than just once.
It appears that some of the new PRISM2 cards need it.

Fail the probe if we fail to read the MAC address.

Fix a comment.

Delete the unload printf. The bus system now prints this message.


# 74998 29-Mar-2001 wpaul

Fix a couple style nits, no code changes. Turn one magic number into
a #defined constant, wrap a few long lines, etc... Also remove stupid
'all your base are belong to us' joke from comment that I don't really
care to see immortalized in the source tree.


# 74906 28-Mar-2001 alfred

Add support for the Addtron AWA100 PCI wireless card.

The AWA100 is a PCI board with a PLX 9052 chip that's used to talk to
the pccard inserted into the board.

Remove a redundant $FreeBSD while I'm here.


# 74838 27-Mar-2001 alfred

limit the amount of retries when sending data to prevent lockups.


# 74139 12-Mar-2001 assar

change default from adhoc mode to BSS (infrastructure)


# 72084 06-Feb-2001 phk

Convert if_multiaddrs from LIST to TAILQ so that it can be traversed
backwards in the three drivers which want to do that.

Reviewed by: mikeh


# 71962 03-Feb-2001 phk

Use LIST_FOREACH() to traverse ifp->if_multiaddrs list, instead of
<sys/queue.h> implementation details.

Created with: /usr/sbin/sed
Reviewed with: /sbin/md5


# 71336 21-Jan-2001 imp

wi has been converted to NEWCARD, so included it when pccard is
included.

Also, I forgot to update this to the new cis[] structure last night,
mainly due to the above omission.


# 71228 18-Jan-2001 bmilekic

Implement MTX_RECURSE flag for mtx_init().
All calls to mtx_init() for mutexes that recurse must now include
the MTX_RECURSE bit in the flag argument variable. This change is in
preparation for an upcoming (further) mutex API cleanup.
The witness code will call panic() if a lock is found to recurse but
the MTX_RECURSE bit was not set during the lock's initialization.

The old MTX_RECURSE "state" bit (in mtx_lock) has been renamed to
MTX_RECURSED, which is more appropriate given its meaning.

The following locks have been made "recursive," thus far:
eventhandler, Giant, callout, sched_lock, possibly some others declared
in the architecture-specific code, all of the network card driver locks
in pci/, as well as some other locks in dev/ stuff that I've found to
be recursive.

Reviewed by: jhb


# 71161 17-Jan-2001 peter

Add NEWCARD hooks. This seems to work just fine.


# 70808 08-Jan-2001 peter

Move if_wl.c from sys/i386/isa to dev/wi - it is not i386 (or even isa)
specific.


# 70173 18-Dec-2000 jhb

Attempt to read and verify the card's status in wi_stop() before sending it
the disable command. On some systems, writing to the card after it has
been ejected causes the machine to hang.

Reviewed by: wpaul


# 70073 15-Dec-2000 wpaul

Apply some contributed patches to reduce number of tx buffer allocation
failures and add some support for WEP on Prism II chip.

Submitted by: YAMAMOTO Shigeru <shigeru@iij.ad.jp>


# 69399 30-Nov-2000 alfred

remove unneded sys/ucred.h includes


# 67893 29-Oct-2000 phk

Move suser() and suser_xxx() prototypes and a related #define from
<sys/proc.h> to <sys/systm.h>.

Correctly document the #includes needed in the manpage.

Add one now needed #include of <sys/systm.h>.
Remove the consequent 48 unused #includes of <sys/proc.h>.


# 67164 15-Oct-2000 phk

Remove unneeded #include <machine/clock.h>


# 67092 13-Oct-2000 wpaul

Update the wi driver to use mutexes instead of spls.


# 65581 07-Sep-2000 wpaul

Close PR #20963. Do not pass encryption keys back to the caller via
wi_ioctl() unless they're the superuser.


# 63090 13-Jul-2000 archie

Make all Ethernet drivers attach using ether_ifattach() and detach using
ether_ifdetach().

The former consolidates the operations of if_attach(), ng_ether_attach(),
and bpfattach(). The latter consolidates the corresponding detach operations.

Reviewed by: julian, freebsd-net


# 61818 18-Jun-2000 roberto

Bring the an(4) fixes to wi(4):
- suser check
- splx() fix.

Reminded by: Aaron Campbell <aaron@openbsd.org>


# 60536 14-May-2000 archie

Move code to handle BPF and bridging for incoming Ethernet packets out
of the individual drivers and into the common routine ether_input().
Also, remove the (incomplete) hack for matching ethernet headers
in the ip_fw code.

The good news: net result of 1016 lines removed, and this should make
bridging now work with *all* Ethernet drivers.

The bad news: it's nearly impossible to test every driver, especially
for bridging, and I was unable to get much testing help on the mailing
lists.

Reviewed by: freebsd-net


# 59391 19-Apr-2000 phk

Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>


# 59328 17-Apr-2000 wpaul

When in infrastructure mode, use address 3 from the 802.11 header as the
source address when receiving frames (and keep using address 2 when in
pseudo-IBSS mode). This is apparently necessary in order to obtain the
true MAC address of the sending station which is needed for PPPoE.

Patch supplied by: Blaz Zupan <blaz@amis.net>


# 58274 19-Mar-2000 rwatson

Modify if_wi.c to call bpfdetach(ifp) before if_detach(ifp), so as to
prevent a page fault if the card is ejected while BPF is in use. This
could happen if DHCP or tcpdump was in use on that interface during
ejection. Other drivers may also require this modification.

Reviewed by: wes


# 56965 02-Feb-2000 wpaul

Add support for WEP (encryption) for silver and gold WaveLAN/IEEE turbo cards.
Also update wicontrol to enable/disable encryption, set WEP keys and set the
TX key index. Silver cards only have 40-bit keys. This is something of a quick
hack, but it works well enough for me to commit this from the LinuxWorld
exhibit floor.

The WEP support only shows up if you have a card that supports it.

Would have been approved by: jkh, if he hadn't wandered off somewhere
Approved in his place by: msmith, who's standing right here


# 55831 11-Jan-2000 wpaul

Correctly set the data length when transmitting 802.3 frames (we need to
subtract the length of the SNAP header).


# 54277 08-Dec-1999 wpaul

Fix invocation of bus_teardown_intr(). The last arg is supposed to be
sc->wi_intrhand, not &sc->wi_intrhand.


# 53702 25-Nov-1999 wpaul

Update the WaveLAN/IEEE driver:

- Convert to new bus attachment scheme. Thanks to Blaz Zupan for doing
the initial work here. One thing I changed was to have the attach
and detach routines work like the PCI drivers, which means that in
theory you should be able to load and unload the driver like the PCI
NIC drivers, however the pccard support for this hasn't settled down
yet so it doesn't quite work. Once the pccard work is done, I'll have
to revisit this.

- Add device wi0 to PCCARD. If we're lucky, people should be able to
install via their WaveLAN cards now.

- Add support for signal strength caching. The wicontrol utility has
also been updated to allow zeroing and displaying the signal strength
cache.

- Add a /sys/modules/wi directory and fix a Makefile to builf if_wi.ko.
Currently this module is only built for the i386 platform, though once
the pccard stuff is done it should be able to work on the alpha too.
(Theoretically you should be able to plug one of the WaveLAN/IEEE ISA
cards into an alpha with an ISA slot, but we'll see how that turns out.

- Update LINT to use only device wi0. There is no true ISA version of
the WaveLAN/IEEE so we'll never use an ISA attachment.

- Update files.i386 so that if_wi is dependent on card.


# 53356 18-Nov-1999 peter

Fix a warning.


# 52632 29-Oct-1999 imp

Disable old PCCARD_MODULE code.

This should fix LINT.

Prompted by: phk's explicit message about LINT breakage


# 51583 23-Sep-1999 wpaul

As suggested by phk, unconditionalize BPF support in these drivers. Since
there are stubs compiled into the kernel if BPF support is not enabled,
there aren't any problems with unresolved symbols. The modules in /modules
are compiled with BPF support enabled anyway, so the most this will do is
bloat GENERIC a little.


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 50135 21-Aug-1999 msmith

Clean up after removing sys/eventhandler.h from sys/systm.h at the last
minute. This should cover all of the missed cases (and should let LINT
build again).


# 50107 21-Aug-1999 msmith

Implement a new generic mechanism for attaching handler functions to
events, in order to pave the way for removing a number of the ad-hoc
implementations currently in use.

Retire the at_shutdown family of functions and replace them with
new event handler lists.

Rework kern_shutdown.c to take greater advantage of the use of event
handlers.

Reviewed by: green


# 48645 06-Jul-1999 des

Rename bpfilter to bpf.


# 48553 04-Jul-1999 wpaul

Patch the WaveLAN/IEEE driver to detect and reject oversized received
frames (or just insane received packet lengths generated due to errors
reading from the NIC's internal buffers). Anything too large to fit
safely into an mbuf cluster buffer is discarded and an error logged.

I have not observed this problem with my own cards, but on user has
reported it and adding the sanity test seems reasonable in any case.

Problem noted and patch provided by: Per Andersson <per@cdg.chalmers.se>


# 47789 06-Jun-1999 wpaul

Small optimization: use wi_seek() in wi_read_record() and wi_write_record()
instead of frobbing the buffer access path registers directly. Saves a
few lines of duplicated code.


# 47401 22-May-1999 wpaul

- Fix up some comments in if_wi.c (no code changes)
- Mention that the 6Mbps turbo adapters are supported in HARDWARE.TXT
and RELNOTES.TXT and the wi.4 man page
- Mention turbo adapters in the wicontrol.8 man page and provide a
complete table of available transmit speed settings


# 46611 07-May-1999 wpaul

Add support to wicontrol(8) and wi(4) for enabling and configuring
power management. This will only work on newer firmware revisions; older
firmware will silently ignore the attempts to turn power management on.

Patches supplied by: Brad Karp <karp@eecs.harvard.edu>


# 46563 06-May-1999 wpaul

Modify wicontrol(8) and wi(4) to allow setting the frequency of the
WaveLAN's radio modem. The default is whatever the NIC uses since NICs
sold in different countries may default to different frequencies. (The
Lose95/LoseNT software doesn't let you select the channel so it's probably
not really meant to be changed.)


# 46495 05-May-1999 wpaul

Add device driver support for the Lucent WaveLAN/IEEE 802.11 PCMCIA
adapter (and some workalikes). Also add man pages and a wicontrol
utility to manipulate some of the card parameters.

This driver was written using information gleaned from the Lucent HCF Light
library, though it does not use any of the HCF Light code itself, mainly
because it's contaminated by the GPL (but also because it's pretty gross).
The HCF Light lacks certain featurs from the full (but proprietary) HCF
library, including 802.11 frame encapsulation support, however it has
just enough register information about the Hermes chip to allow someone
with enough spare time and energy to implement a proper driver. (I would
have prefered getting my hands on the Hermes manual, but that's proprietary
too. For those who are wondering, the Linux driver uses the proprietary
HCF library, but it's provided in object code form only.)

Note that I do not have access to a WavePOINT access point, so I have
only been able to test ad-hoc mode. The wicontrol utility can turn on
BSS mode, but I don't know for certain that the NIC will associate with
an access point correctly. Testers are encouraged to send their results
to me so that I can find out if I screwed up or not.


# 46492 05-May-1999 wpaul

Add device driver support for the Lucent WaveLAN/IEEE 802.11 wireless
network adapters. These are all PCMCIA devices (the ISA version is a
PCMCIA to ISA bridge with a PCMCIA card plugged into it). Also add a
wicontrol utility to read and write some of the card's parameters.

Note: I do not have access to a WavePOINT access point, so I have only
been able to test this driver in ad-hoc (point to point) mode. The
wicontrol utility allows programming the desired service set name (SSID)
and enabling BSS mode, but I can't tell for sure if it works (I know the
card switches modes, but I can't verify that it joins a service set
correctly).

This driver was written using information gleaned from the Lucent HCF Light
library, which is an API library designed to simplify driver development
for devices based on the Lucent Hermes chip. Unfortunately, the HCF Light
is missing certain features (like 802.11 frame encapsulation!) which are
available only in the proprietary complete HCF code, which is not available
to the public. This driver uses none of the HCF Light code: it's very ugly
and contaminated by the GPL. IP and ARP packets are encapsulated as 802.11
frames, everything else is encapsulated as 802.3.

(It would be easier to just get the Hermes programming manual, but that's
not publically available either. For those who are wondering, the Linux
WaveLAN/IEEE driver uses the proprietary HCF code, which is provided in
object code form only. So much for supporting open source sofware.)

Multicast filter support is implemented, however it appears that the
filter doesn't work: programming in one IP mutlicast group enables them
all.