History log of /netbsd-current/sys/dev/ic/wivar.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.67 05-Oct-2019 mrg

remove __packed attribute from struct ieee80211_radiotap_header
and all the structures that include it.

this should not change anything while avoiding packed vs alignment
warnings from GCC 8, and potentially pessimised code generation
due to the packed marker (there are no misaligned members, just
that the per-device parts may end unaligned.)

all consumers of these members are done from the properly aligned
packet members directly, or, as a union with a 64 byte member,
also properly aligned. codegen didn't appear to change, except
for the definition of sizeof(struct driver_[rt]x_radiotap_header)
in debug info, which is not directly used anywhere.


Revision tags: netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204
# 1.66 02-Feb-2017 nonaka

wlan interfaces make interrupt routine running on softint context.

see http://mail-index.netbsd.org/tech-kern/2016/12/06/msg021281.html

tested device:
* ath at pci: AR5212, AR5424
* athn at pci: AR9287
* ipw at pci: 2100BG
* iwi at pci: 2915ABG
* iwm at pci: 3165, 7260, 8260
* iwn at pci: 4945, 6235
* ral at pci: RT2560
* rtwn at pci: RTL8192CE


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.65 15-Aug-2011 dyoung

branches: 1.65.12; 1.65.30; 1.65.34; 1.65.38;
Use a recursive lock to ensure that only on thread is in wi_ioctl() at
one time. It's a recursive lock because sometimes wi_ioctl() recurses
through the network stack (ick).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.64 23-Nov-2010 christos

split if_wi


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.63 17-Jan-2010 pooka

branches: 1.63.4;
Forward declare struct bpf_if and use that as the type for bpf_if
instead of "void *". Buys us oo times the type-safety for 0 times
the price.
(no functional change)


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase jym-xensuspend-base
# 1.62 12-May-2009 cegger

struct device * -> device_t, no functional changes intended.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase mjf-devfs2-base nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.61 25-Dec-2007 perry

branches: 1.61.10; 1.61.24;
Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.60 09-Dec-2007 jmcneill

branches: 1.60.2;
Merge jmcneill-pm branch.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base jmcneill-pm-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base
# 1.59 04-Mar-2007 christos

branches: 1.59.14; 1.59.16; 1.59.22; 1.59.24; 1.59.26;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 1.58 18-Nov-2005 skrll

branches: 1.58.26;
Adapt drivers to the new net80211(9).

Most of this is from dyoung@. Thanks!


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.57 25-Jun-2005 dyoung

branches: 1.57.2; 1.57.8;
Bug fix: fix WEP by managing keys & crypto in the style of the new
net80211. It was especially important to zero the IEEE80211_F_DROPUNENC
(discard unencrypted packets) flag in operating modes where the
firmware decrypts for us. Otherwise, the 802.11 layer discarded
all received frames. See wi_mend_flags. From FreeBSD, with
improvements by me.

For better compliance with the "net80211 way":
set sc_cnfauthmode from ic->ic_bss->ni_authmode. Enter
the RUN state through ieee80211_create_ibss instead of
ieee80211_new_state(IEEE80211_S_RUN). To sync BSSID in ad hoc
mode, use ieee80211_sta_join() instead of
ieee80211_new_state(IEEE80211_S_RUN). From FreeBSD.

Configure the firmware to obey IEEE80211_F_DROPUNENC.

As we change to state RUN in STA mode, generate a link-status
message on the routing socket with a call to ieee80211_notify_node_join()
instead of calling rt_ifmsg directly.

Run normal net80211 processing (ieee80211_newstate) on the ->RUN
transition.


# 1.56 22-Jun-2005 dyoung

Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD. Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]). Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.


# 1.55 30-May-2005 christos

- add missing const
- fix variable shadowing
- remove unneeded casts


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.54 27-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.53 13-Dec-2004 dyoung

branches: 1.53.2; 1.53.4;
Bug fix: synchronize Transmit commands with all other commands.

Following Charles Hannum's wi(4) optimizations, there could be a
Transmit command outstanding after wi_tx_intr or wi_start returns.
The driver would blithely issue a second command [*] before the
first command was finished, taking the first command's WI_EV_CMD
indication to mean the second command had finished. The driver
would be dreadfully confused when the second command's results did
not meet its expectations (e.g., a RID mismatch error would occur).
The packet transmit section of the code would never read the
WI_EV_CMD it expected, so transmissions would cease.

This patch counts the outstanding transmit commands (there can be
only one) and, if a transmit command is outstanding at the top of
wi_cmd(), wi_cmd waits for the command to complete. If there was
a transmit command outstanding when wi_cmd begins, it calls
wi_cmd_intr() on its way out.

I have tested this on an Orinoco card. Previously, the card would
stop transmitting or the kernel would panic as desynchronization
occurred. Now it works beautifully.

[*] A second command could be issued by wi_ioctl or else by
wi_intr->wi_info_intr->wi_newstate->wi_read_xrid->wi_read_rid.


Revision tags: kent-audio1-base
# 1.52 28-Sep-2004 dyoung

Simplify the BSSID synchronization code.


# 1.51 07-Aug-2004 mycroft

Be much more robust with RID values during attach:
* If the device returns a length too short to even contain the RID number,
flag it as not supported and return EOPNOTSUPP, rather than returning a
length of -2 and trying to use the value anyway.
* Check the returned lengths to see if we actually got anything.
* If we get no rate list, fail the attach, so we don't just blow up later.
Allow the frontend to pass in a MAC address.


# 1.50 05-Aug-2004 mycroft

Put unadulterated dB values in the radiotap header, not the converted dBm
values.


# 1.49 22-Jul-2004 mycroft

Add sc_txstart and sc_txstarted, to keep track of the current FID we want to
start and the number we've started that have not been alloced yet. Currently
sc_txstarted is constained to 0 or 1 because of the way we start the next
packet, but this will change.


# 1.48 22-Jul-2004 mycroft

Non-functional changes: add comments, remove a structure name.


# 1.47 22-Jul-2004 mycroft

Keep a count of packets written to the chip but not yet initiated. This
simplifies some logic, and is needed for later changes.


# 1.46 22-Jul-2004 mycroft

Change some names.
sc_txnext -> sc_txalloc
sc_txcur -> sc_txqueue


# 1.45 22-Jul-2004 mycroft

Keep a count of FIDs allocated, rather than storing a packet length in the
ring.


# 1.44 22-Jul-2004 mycroft

Rework the rate-lowering hack:
* Update sc_txpending[] when a packet is written, even before we issue the TX
command, since it may be active when we issue the TX command for the
following packet.
* Do not lower the rate in ni_txrate or id_rateidx, because these are used to
keep track of sc_txpending[], and could cause us to get "stuck" at the lower
rate.


Revision tags: netbsd-2-0-base
# 1.43 10-Feb-2004 dyoung

branches: 1.43.2;
Disable rate-adaptation for Lucent firmware version 8.42.1, per a
bug report from Simon Burge: the firmware seems to lock up.

If rate-adaptation is disabled on a Lucent card, then do all the
rate-adaptation work *except* for writing the new transmit rate,
since I suspect that is what locks-up the firmware.


# 1.42 10-Feb-2004 dyoung

Factor out the initialization/reset of RSS descriptors, making
wi_rssdescs_init, wi_rssdescs_reset, which I will use to receover
when the firmware botches up the RSS descriptor index.


# 1.41 07-Dec-2003 dyoung

Enable RSSI-based rate-adaptation for wi(4). This enables wi(4)-based
APs to run at "full speed" where before they ran at just 1 or 2Mb/s.
The AP will adapt the data rate for each client based on packet
losses and the received signal strength.

I have also enabled rate adaptation for STA mode and for IBSS mode,
but the hardware gives us less control over the data rate in those
modes.


# 1.40 07-Dec-2003 dyoung

Updates to 802.11 radiotap. The _DB_ flags were used everywhere to
denote a signed dBm Rx power, so rename them to _DBM_ and change
the signedness. Add new _DB_ flags for unsigned Rx power measured
from an arbitrary reference.

Try to synchronize net80211/ieee80211_radiotap.h with my tcpdump
sources (which public tcpdump has not seen, yet) and with FreeBSD.


# 1.39 16-Nov-2003 dyoung

Add data-link type DLT_IEEE802_11_RADIO to wi and atw. DLT_IEEE802_11_RADIO
lets you monitor radio stats like received signal strength, which
diversity antenna was used, channel/frequency, modulation, and data
rate.


# 1.38 16-Oct-2003 dyoung

The upper & lower bounds on wi RSSI are completely bogus, AFAICT.


# 1.37 13-Oct-2003 dyoung

Switch wi(4) to the new 802.11 layer.


# 1.36 06-Jul-2003 dyoung

Still more consolidation of 802.11 media-handling, moving moving
common code from awi and wi into the 802.11 framework. Inspired by
Sam Leffler's patches to FreeBSD.


# 1.35 06-Jul-2003 dyoung

Improved RSSI->dBm conversion, especially for Lucent cards, for
which I borrowed some conversion constants from the Linux orinoco_cs
driver.


# 1.34 20-May-2003 dyoung

branches: 1.34.2;
Stop wi panics on card ejection in Powerbook in both the enabled
and disabled states. This should fix an x86 panic somebody reported
on icb.


# 1.33 16-May-2003 dyoung

IEEE80211_LOCK and WI_LOCK conceal enormous differences in locking
semantics on FreeBSD and NetBSD, so I am backing them out until
the macro set is enriched.


# 1.32 13-May-2003 dyoung

Begin synchronization with FreeBSD:

1 Add channel mask, transmit rate-mask arguments to wi_scan_ap.
2 Adopt the macros WI_LOCK/WI_UNLOCK for synchronization. FreeBSD
uses a different synchronization mechanism.
3 In wi_cmd, adopt constants WI_DELAY/WI_TIMEOUT for timing.
4 Pull debug messages from into wi_read_nicid from FreeBSD.
5 Bug fix: if IFF_ALLMULTI, don't filter any multicasts.
6 Count and report TX exceptions, but don't generate any additional
interrupts.


# 1.31 13-May-2003 dyoung

Misc changes to wi_stop. First, block interrupts in wi_stop. (From
FreeBSD.)

Fix a bug in wi_stop where ejecting from the Powerbook crashes the
system. Essentially, the patch makes sure we write *no* registers
when we are no longer attached.

Also, for consistency w/ FreeBSD, use sc_portnum throughout wi,
instead of hard-coding WI_PORT0 .


# 1.30 27-Mar-2003 dyoung

Cosmetic: move sc_reset closer to its siblings sc_disable and sc_enable.


# 1.29 27-Mar-2003 dyoung

Introduced sc_reset to wi_softc. The bus-specific front-end gets
to fill this.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.28 09-Jan-2003 dyoung

wi_start: write an mbuf chain to the driver using wi_mwrite_bap,
which is safer than the loop there used to be here.

wi_mwrite_bap: if wi_write_bap fails, don't keep on going: this
way you avoid writing garbage to the radio. First time you see
an odd-length mbuf, copy the remainder of the chain to sc_txbuf
and from there to the MAC. This way, you do not read an mbuf past
the end of its data (occasionally you will cross a page doing
that!) and you avoid expensive, excess seeks in the radio's own
buffer chain.

wi_rx_intr: clamp the frame length told to us by the driver to the
most bytes we can fit in our mbuf cluster.

I am still getting e-mails from my testers telling me how much
better this makes things.


Revision tags: fvdl_fs64_base
# 1.27 01-Jan-2003 dyoung

A Prism firmware participating in an IBSS network will not send a
LINK_STAT notification for every change of BSSID, so the firmware's
BSSID and the driver's BSSID will get out of sync. This has two
bad affects. First, because the 802.11 framework filters received
packets based on BSSID, many packets can be dropped before the
driver adopts the firmware's BSSID. Second, ifconfig's tells a
misleading BSSID to the operator.

This problem is most apparent in networks where every station does
not hear every other. I reproduce these conditions in an office by
removing/replacing the antennas on my 802.11 cards.

As a solution, in IBSS mode, the driver will ask the firmware for
the BSSID every five seconds. Also, whenever the driver receives
a frame carrying a different BSSID than the driver's BSSID, then
the driver asks the firmware for the BSSID before handing the frame
to ieee80211_input.


# 1.26 27-Dec-2002 dyoung

The RID for the RSSI->dBm adjustment is not supported by Prism
station firmware version <= 1.1.1.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.25 18-Nov-2002 dyoung

Only Prism is known to support WI_RID_FRAG_THRESH.


# 1.24 16-Nov-2002 dyoung

Support two new RIDs.

WI_RID_DBM_ADJUST: In preparation for capturing Prism packets
containing received signal strength indications (RSSI), read the
constant for conversion from RSSI to dBm (decibels relative to
a milliwatt).

WI_RID_FRAG_THRESH: Get/set the packet fragmentation threshold
on Lucent/Prism.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.23 04-Oct-2002 onoe

Handle of AP_IN_RANGE/AP_OUT_RANGE, to fix a problem once the station
is out of ragen, it never comes up again.
For HostAP, prohibit sending DATA frame to an unassociated but authenticated
station.


Revision tags: kqueue-base
# 1.22 30-Sep-2002 onoe

old lucent adhoc-demo mode (adhoc,flag0 or wiconfig -p 3) wasn't handled
correctly. To avoid massive extra code in each driver, now if_iee80211subr.c
also handles non-standard old lucent adhoc-demo mode.
This also fixes PR 14227.


# 1.21 30-Sep-2002 onoe

Jumbo commit for wi driver.
- Eliminate wi_hostap.c since most of the code are duplicated with
net/if_ieee80211subr.c
- Station for Infrastructure network and IBSS also use service functions
as much as possible to be consistent with other wireless drivers.
Now WEP works for station/ibss/hostap.


# 1.20 30-Sep-2002 onoe

Nuke unneeded member sc_ifp and use #define sc_if instead,
to prepare jumbo commit for wi.c


# 1.19 23-Sep-2002 thorpej

Jumbo patch, from David Young <dyoung@ojctech.com>, with small tweaks
by me:
* Speed up reading/writing buffers from the hardware by avoiding
slow forward seeks. In preparation to use the optimization, do
not read overlapping bytes. This is currently disabled, but can
be enabled with OPTIMIZE_RW_DATA.
* Hand 802.11 and Prism-specific frames to BPF. User can watch these
frames by specifying an alternate DLT to e.g. tcpdump(8).
* Add support for SIOC[SG]80211BSSID and SIOC[SG]80211CHANNEL.
* Issue join requests and track join/create state through link-status
notifications.
* Split wi_rxeof into separate routines for receiving Ethernet II,
802.11 data, and 802.11 management frames.
* Bug fix: Account for aligning m_data to a word boundary in the Rx
buffer size check.
* Bug fix: Check for LLC/SNAP even if the firmware tells us the frame
is Ethernet II, as the firmware sometimes gets this wrong.
* Process as many events as possible when we get an interrupt, using
a simple heuristic to avoid reprocessing an event (which can have
bad side-effects). Clamp the time spent in the interrupt handler
to 4ms.
* Redo the timeout loops to be consistent and less prone to error.
* Add delays to timeout loops which were missing them, so that a
fast CPU won't win the race.
* Borrow some timeout loop values from the linux-wlan-ng driver,
which seems to reflect a high level of clue (due to direct support
from Intersil).
* Get rid of silly wi_read_data(..., len + 2) idiom; simply round up
in wi_read_data() and wi_write_data(). Also, protect against a
length of 0.
* Name some frequently-used constants. Correct spelling. Other style nits.
* Bug fix: On Prism, set Create IBSS register to 0 *always*. The meaning
of Create IBSS == 1 is join an IBSS or *ESS*, and we do not want to
join an ESS, because that would put us in an inconsistent state. 0
is the right value for Prism.
* Bug fix: Clean up state at the top of wi_init(), in the event that
we don't reach the bottom.
* Simplify wi_start() by always providing an RFC1042-encoded 802.11
frame to the firmware.
* Larval powersave support for HostAP mode, enabled by WI_HOSTAP_POWERSAVE.
* Bug fix: Call wi_stop() from wi_shutdown().
* Bug fix: sync media options with HostAP mode in wi_sync_media().
* In wi_media_status(), inquire firmware for current media state if
media == auto. From FreeBSD.
* Clean up the way buffer lengths are computed by using pointer
arithmetic rather than magic constants.
* Swap the order of comparisons in addr_cmp() for speed.
* Bug fix: Send ReAssoc Response instead of Assoc Response to a
ReAssoc Request.
* Bug fix: Copy SSID using the correct size.
* Give more meaningful names to offsets in a wi_frame.
* Bug fix: Assign the right values to the named constants for
Rx frame encoding.
* Get rid of useless SNAP constants.


Revision tags: gehenna-devsw-base
# 1.18 11-Aug-2002 thorpej

Remove an unused member from the softc.


# 1.17 11-Aug-2002 thorpej

Snapshot of work-in-progress: Add AP support for Prism2-based boards.
WEP for APs is not yet implemented, but without WEP, this works well
enough for my laptop to associate with an AP running this code.

Adapted from OpenBSD.


# 1.16 11-Aug-2002 thorpej

* Add "wi_flags" to the softc to indicate capabilities of the card. Fill
in this info based on firmware type and version. Replace "wi_has_wep"
with a flag.
* For cards which support IBSS, add "ibss" has a media option.
* For cards which support CREATE_IBSS, add "ibss-master" as a media
option.
* Use the "ibss" and "ibss-master" media options to determine if
we should go into IBSS mode and/or create the IBSS.
* Internally convert between the generic WI_PORTTYPE_IBSS and the
value the firmware wants to use for IBSS.
* When setting the IBSS name, if a desired-SSID is set, and we're
an ibss-master, write the desired-SSID into the own-SSID slot.
This ensures that "ifconfig wi0 nwid FOO" will do the expected
thing.
* Only set the roaming mode if the card supports roaming.

From OpenBSD.


# 1.15 11-Aug-2002 thorpej

Read supported rates from the card and report them. Only add
media types if that rate is supported.

Adapted from OpenBSD.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.14 05-Apr-2002 ichiro

branches: 1.14.2;
fix minor bugs for lucent cards. (point out from Warner Losh)


# 1.13 04-Apr-2002 jdolecek

move wi_pci_reset() from ic/wi.c to pci/if_wi_pci.c, where is belongs


# 1.12 04-Apr-2002 ichiro

using table driven for Prism2 family IDs/Names.


# 1.11 30-Mar-2002 ichiro

added sc_pri_firmware_ver, and print Primary/Station firmware versions.
cosmetic change.


# 1.10 27-Mar-2002 onoe

Fix to work Symbol firmware card, which cannot be initialized more than once.
Tested with 3Com 3CRWE737A and Intel Pro/Wireless 2011.


# 1.9 25-Mar-2002 dbj

changes from Warner Losh to read firmware version for non prism2 cards


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.8 21-Jan-2002 ichiro

"Association Faild" was added to "Link Stat" messages.
;
Implement wi_scan into wi.c.
forces if_wi to initiate one round of access point scan.
This code was written by jrb@cs.pdx.edu, modified and bug-fixed by ichiro@netbsd.org


# 1.7 05-Jan-2002 explorer

revert changes I made a long time ago. This should undo the changes which are causing problems on some non-x86 platforms. I'll probsably redo some of these changes, but after the next release branch.


Revision tags: thorpej-mips-cache-base
# 1.6 13-Oct-2001 ichiro

Add Intersil Prism2.5 Mini-PCI wavelan.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.5 22-Sep-2001 explorer

Implement two major items:

(1) Add an IOCTL to tell the Lucent based cards how often to
do an access point scan. These results are returned by
calling another IOCTL to get the most recent scan data.

This function works with prism2 cards as well, but the
data is returned in a different format, or perhaps it is
data only for the closest access point.

(2) For prism2 cards, add the ability to put it into LAN monitor
mode, where (via BPF) all packets can be received. This
mode works best with "wiconfig wi0 -p 3 -f ?" to put the
card into pseudo-IBSS mode (to keep it from channel-hopping
and scanning for access points) and to set the frequency of
the AP you wish to monitor.

The returned data has a partial wi_frame header (down to the
wi_dat_len field) followed by the raw data of the packet.
I have and will put up on http://www.flame.org/NetBSD/wireless/
some simple utilities which do some perhaps interesting things,
like scan for access points, capture packets, etc.


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 15-May-2001 ichiro

branches: 1.4.2; 1.4.4; 1.4.6;
getting prism2 firm ver routine to wi_get_id().
if firm ver is more than 0.8c3, promiscuous mode is off.

typo WI_RID_STA_IDENEITY -> WI_RID_STA_IDENTITY


# 1.3 15-May-2001 ichiro

It enabled it to control roaming mode and authentication mode.
Roaming mode can change value into 'firm mode' and disable.
Authentication mode can change into 'Open System authentication'
and 'Shared Key Authentication' with Prism2 chip.

wi_get_id() was introduced in order that chip might judge automatically
whether it is Prism2 chip. Therefore, a pp_prism2 entry in
"struct wi_pcmcia_product" became unnecessary.


# 1.2 08-May-2001 ichiro

change promisc mode in case of SIOCSIFFLAGS of wi_ioctl.
Fix indentation.


# 1.1 06-May-2001 ichiro

divided into PCMCIA attachment and common code of wi.
since if_wi_ieee.h does not depend for pcmcia,
sys/dev/pcmcia/if_wi_ieee.h was moved to sys/dev/ic/wi_ieee.h .


Revision tags: nick-nhusb-base-20170204
# 1.66 02-Feb-2017 nonaka

wlan interfaces make interrupt routine running on softint context.

see http://mail-index.netbsd.org/tech-kern/2016/12/06/msg021281.html

tested device:
* ath at pci: AR5212, AR5424
* athn at pci: AR9287
* ipw at pci: 2100BG
* iwi at pci: 2915ABG
* iwm at pci: 3165, 7260, 8260
* iwn at pci: 4945, 6235
* ral at pci: RT2560
* rtwn at pci: RTL8192CE


Revision tags: netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.65 15-Aug-2011 dyoung

branches: 1.65.30;
Use a recursive lock to ensure that only on thread is in wi_ioctl() at
one time. It's a recursive lock because sometimes wi_ioctl() recurses
through the network stack (ick).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.64 23-Nov-2010 christos

split if_wi


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.63 17-Jan-2010 pooka

branches: 1.63.4;
Forward declare struct bpf_if and use that as the type for bpf_if
instead of "void *". Buys us oo times the type-safety for 0 times
the price.
(no functional change)


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase jym-xensuspend-base
# 1.62 12-May-2009 cegger

struct device * -> device_t, no functional changes intended.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase mjf-devfs2-base nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.61 25-Dec-2007 perry

branches: 1.61.10; 1.61.24;
Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.60 09-Dec-2007 jmcneill

branches: 1.60.2;
Merge jmcneill-pm branch.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base jmcneill-pm-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base
# 1.59 04-Mar-2007 christos

branches: 1.59.14; 1.59.16; 1.59.22; 1.59.24; 1.59.26;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base yamt-readahead-base3 yamt-readahead-base2 ktrace-lwp-base
# 1.58 18-Nov-2005 skrll

branches: 1.58.26;
Adapt drivers to the new net80211(9).

Most of this is from dyoung@. Thanks!


Revision tags: yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.57 25-Jun-2005 dyoung

branches: 1.57.2; 1.57.8;
Bug fix: fix WEP by managing keys & crypto in the style of the new
net80211. It was especially important to zero the IEEE80211_F_DROPUNENC
(discard unencrypted packets) flag in operating modes where the
firmware decrypts for us. Otherwise, the 802.11 layer discarded
all received frames. See wi_mend_flags. From FreeBSD, with
improvements by me.

For better compliance with the "net80211 way":
set sc_cnfauthmode from ic->ic_bss->ni_authmode. Enter
the RUN state through ieee80211_create_ibss instead of
ieee80211_new_state(IEEE80211_S_RUN). To sync BSSID in ad hoc
mode, use ieee80211_sta_join() instead of
ieee80211_new_state(IEEE80211_S_RUN). From FreeBSD.

Configure the firmware to obey IEEE80211_F_DROPUNENC.

As we change to state RUN in STA mode, generate a link-status
message on the routing socket with a call to ieee80211_notify_node_join()
instead of calling rt_ifmsg directly.

Run normal net80211 processing (ieee80211_newstate) on the ->RUN
transition.


# 1.56 22-Jun-2005 dyoung

Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD. Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]). Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.


# 1.55 30-May-2005 christos

- add missing const
- fix variable shadowing
- remove unneeded casts


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.54 27-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge
# 1.53 13-Dec-2004 dyoung

branches: 1.53.2; 1.53.4;
Bug fix: synchronize Transmit commands with all other commands.

Following Charles Hannum's wi(4) optimizations, there could be a
Transmit command outstanding after wi_tx_intr or wi_start returns.
The driver would blithely issue a second command [*] before the
first command was finished, taking the first command's WI_EV_CMD
indication to mean the second command had finished. The driver
would be dreadfully confused when the second command's results did
not meet its expectations (e.g., a RID mismatch error would occur).
The packet transmit section of the code would never read the
WI_EV_CMD it expected, so transmissions would cease.

This patch counts the outstanding transmit commands (there can be
only one) and, if a transmit command is outstanding at the top of
wi_cmd(), wi_cmd waits for the command to complete. If there was
a transmit command outstanding when wi_cmd begins, it calls
wi_cmd_intr() on its way out.

I have tested this on an Orinoco card. Previously, the card would
stop transmitting or the kernel would panic as desynchronization
occurred. Now it works beautifully.

[*] A second command could be issued by wi_ioctl or else by
wi_intr->wi_info_intr->wi_newstate->wi_read_xrid->wi_read_rid.


Revision tags: kent-audio1-base
# 1.52 28-Sep-2004 dyoung

Simplify the BSSID synchronization code.


# 1.51 07-Aug-2004 mycroft

Be much more robust with RID values during attach:
* If the device returns a length too short to even contain the RID number,
flag it as not supported and return EOPNOTSUPP, rather than returning a
length of -2 and trying to use the value anyway.
* Check the returned lengths to see if we actually got anything.
* If we get no rate list, fail the attach, so we don't just blow up later.
Allow the frontend to pass in a MAC address.


# 1.50 05-Aug-2004 mycroft

Put unadulterated dB values in the radiotap header, not the converted dBm
values.


# 1.49 22-Jul-2004 mycroft

Add sc_txstart and sc_txstarted, to keep track of the current FID we want to
start and the number we've started that have not been alloced yet. Currently
sc_txstarted is constained to 0 or 1 because of the way we start the next
packet, but this will change.


# 1.48 22-Jul-2004 mycroft

Non-functional changes: add comments, remove a structure name.


# 1.47 22-Jul-2004 mycroft

Keep a count of packets written to the chip but not yet initiated. This
simplifies some logic, and is needed for later changes.


# 1.46 22-Jul-2004 mycroft

Change some names.
sc_txnext -> sc_txalloc
sc_txcur -> sc_txqueue


# 1.45 22-Jul-2004 mycroft

Keep a count of FIDs allocated, rather than storing a packet length in the
ring.


# 1.44 22-Jul-2004 mycroft

Rework the rate-lowering hack:
* Update sc_txpending[] when a packet is written, even before we issue the TX
command, since it may be active when we issue the TX command for the
following packet.
* Do not lower the rate in ni_txrate or id_rateidx, because these are used to
keep track of sc_txpending[], and could cause us to get "stuck" at the lower
rate.


Revision tags: netbsd-2-0-base
# 1.43 10-Feb-2004 dyoung

branches: 1.43.2;
Disable rate-adaptation for Lucent firmware version 8.42.1, per a
bug report from Simon Burge: the firmware seems to lock up.

If rate-adaptation is disabled on a Lucent card, then do all the
rate-adaptation work *except* for writing the new transmit rate,
since I suspect that is what locks-up the firmware.


# 1.42 10-Feb-2004 dyoung

Factor out the initialization/reset of RSS descriptors, making
wi_rssdescs_init, wi_rssdescs_reset, which I will use to receover
when the firmware botches up the RSS descriptor index.


# 1.41 07-Dec-2003 dyoung

Enable RSSI-based rate-adaptation for wi(4). This enables wi(4)-based
APs to run at "full speed" where before they ran at just 1 or 2Mb/s.
The AP will adapt the data rate for each client based on packet
losses and the received signal strength.

I have also enabled rate adaptation for STA mode and for IBSS mode,
but the hardware gives us less control over the data rate in those
modes.


# 1.40 07-Dec-2003 dyoung

Updates to 802.11 radiotap. The _DB_ flags were used everywhere to
denote a signed dBm Rx power, so rename them to _DBM_ and change
the signedness. Add new _DB_ flags for unsigned Rx power measured
from an arbitrary reference.

Try to synchronize net80211/ieee80211_radiotap.h with my tcpdump
sources (which public tcpdump has not seen, yet) and with FreeBSD.


# 1.39 16-Nov-2003 dyoung

Add data-link type DLT_IEEE802_11_RADIO to wi and atw. DLT_IEEE802_11_RADIO
lets you monitor radio stats like received signal strength, which
diversity antenna was used, channel/frequency, modulation, and data
rate.


# 1.38 16-Oct-2003 dyoung

The upper & lower bounds on wi RSSI are completely bogus, AFAICT.


# 1.37 13-Oct-2003 dyoung

Switch wi(4) to the new 802.11 layer.


# 1.36 06-Jul-2003 dyoung

Still more consolidation of 802.11 media-handling, moving moving
common code from awi and wi into the 802.11 framework. Inspired by
Sam Leffler's patches to FreeBSD.


# 1.35 06-Jul-2003 dyoung

Improved RSSI->dBm conversion, especially for Lucent cards, for
which I borrowed some conversion constants from the Linux orinoco_cs
driver.


# 1.34 20-May-2003 dyoung

branches: 1.34.2;
Stop wi panics on card ejection in Powerbook in both the enabled
and disabled states. This should fix an x86 panic somebody reported
on icb.


# 1.33 16-May-2003 dyoung

IEEE80211_LOCK and WI_LOCK conceal enormous differences in locking
semantics on FreeBSD and NetBSD, so I am backing them out until
the macro set is enriched.


# 1.32 13-May-2003 dyoung

Begin synchronization with FreeBSD:

1 Add channel mask, transmit rate-mask arguments to wi_scan_ap.
2 Adopt the macros WI_LOCK/WI_UNLOCK for synchronization. FreeBSD
uses a different synchronization mechanism.
3 In wi_cmd, adopt constants WI_DELAY/WI_TIMEOUT for timing.
4 Pull debug messages from into wi_read_nicid from FreeBSD.
5 Bug fix: if IFF_ALLMULTI, don't filter any multicasts.
6 Count and report TX exceptions, but don't generate any additional
interrupts.


# 1.31 13-May-2003 dyoung

Misc changes to wi_stop. First, block interrupts in wi_stop. (From
FreeBSD.)

Fix a bug in wi_stop where ejecting from the Powerbook crashes the
system. Essentially, the patch makes sure we write *no* registers
when we are no longer attached.

Also, for consistency w/ FreeBSD, use sc_portnum throughout wi,
instead of hard-coding WI_PORT0 .


# 1.30 27-Mar-2003 dyoung

Cosmetic: move sc_reset closer to its siblings sc_disable and sc_enable.


# 1.29 27-Mar-2003 dyoung

Introduced sc_reset to wi_softc. The bus-specific front-end gets
to fill this.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.28 09-Jan-2003 dyoung

wi_start: write an mbuf chain to the driver using wi_mwrite_bap,
which is safer than the loop there used to be here.

wi_mwrite_bap: if wi_write_bap fails, don't keep on going: this
way you avoid writing garbage to the radio. First time you see
an odd-length mbuf, copy the remainder of the chain to sc_txbuf
and from there to the MAC. This way, you do not read an mbuf past
the end of its data (occasionally you will cross a page doing
that!) and you avoid expensive, excess seeks in the radio's own
buffer chain.

wi_rx_intr: clamp the frame length told to us by the driver to the
most bytes we can fit in our mbuf cluster.

I am still getting e-mails from my testers telling me how much
better this makes things.


Revision tags: fvdl_fs64_base
# 1.27 01-Jan-2003 dyoung

A Prism firmware participating in an IBSS network will not send a
LINK_STAT notification for every change of BSSID, so the firmware's
BSSID and the driver's BSSID will get out of sync. This has two
bad affects. First, because the 802.11 framework filters received
packets based on BSSID, many packets can be dropped before the
driver adopts the firmware's BSSID. Second, ifconfig's tells a
misleading BSSID to the operator.

This problem is most apparent in networks where every station does
not hear every other. I reproduce these conditions in an office by
removing/replacing the antennas on my 802.11 cards.

As a solution, in IBSS mode, the driver will ask the firmware for
the BSSID every five seconds. Also, whenever the driver receives
a frame carrying a different BSSID than the driver's BSSID, then
the driver asks the firmware for the BSSID before handing the frame
to ieee80211_input.


# 1.26 27-Dec-2002 dyoung

The RID for the RSSI->dBm adjustment is not supported by Prism
station firmware version <= 1.1.1.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.25 18-Nov-2002 dyoung

Only Prism is known to support WI_RID_FRAG_THRESH.


# 1.24 16-Nov-2002 dyoung

Support two new RIDs.

WI_RID_DBM_ADJUST: In preparation for capturing Prism packets
containing received signal strength indications (RSSI), read the
constant for conversion from RSSI to dBm (decibels relative to
a milliwatt).

WI_RID_FRAG_THRESH: Get/set the packet fragmentation threshold
on Lucent/Prism.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.23 04-Oct-2002 onoe

Handle of AP_IN_RANGE/AP_OUT_RANGE, to fix a problem once the station
is out of ragen, it never comes up again.
For HostAP, prohibit sending DATA frame to an unassociated but authenticated
station.


Revision tags: kqueue-base
# 1.22 30-Sep-2002 onoe

old lucent adhoc-demo mode (adhoc,flag0 or wiconfig -p 3) wasn't handled
correctly. To avoid massive extra code in each driver, now if_iee80211subr.c
also handles non-standard old lucent adhoc-demo mode.
This also fixes PR 14227.


# 1.21 30-Sep-2002 onoe

Jumbo commit for wi driver.
- Eliminate wi_hostap.c since most of the code are duplicated with
net/if_ieee80211subr.c
- Station for Infrastructure network and IBSS also use service functions
as much as possible to be consistent with other wireless drivers.
Now WEP works for station/ibss/hostap.


# 1.20 30-Sep-2002 onoe

Nuke unneeded member sc_ifp and use #define sc_if instead,
to prepare jumbo commit for wi.c


# 1.19 23-Sep-2002 thorpej

Jumbo patch, from David Young <dyoung@ojctech.com>, with small tweaks
by me:
* Speed up reading/writing buffers from the hardware by avoiding
slow forward seeks. In preparation to use the optimization, do
not read overlapping bytes. This is currently disabled, but can
be enabled with OPTIMIZE_RW_DATA.
* Hand 802.11 and Prism-specific frames to BPF. User can watch these
frames by specifying an alternate DLT to e.g. tcpdump(8).
* Add support for SIOC[SG]80211BSSID and SIOC[SG]80211CHANNEL.
* Issue join requests and track join/create state through link-status
notifications.
* Split wi_rxeof into separate routines for receiving Ethernet II,
802.11 data, and 802.11 management frames.
* Bug fix: Account for aligning m_data to a word boundary in the Rx
buffer size check.
* Bug fix: Check for LLC/SNAP even if the firmware tells us the frame
is Ethernet II, as the firmware sometimes gets this wrong.
* Process as many events as possible when we get an interrupt, using
a simple heuristic to avoid reprocessing an event (which can have
bad side-effects). Clamp the time spent in the interrupt handler
to 4ms.
* Redo the timeout loops to be consistent and less prone to error.
* Add delays to timeout loops which were missing them, so that a
fast CPU won't win the race.
* Borrow some timeout loop values from the linux-wlan-ng driver,
which seems to reflect a high level of clue (due to direct support
from Intersil).
* Get rid of silly wi_read_data(..., len + 2) idiom; simply round up
in wi_read_data() and wi_write_data(). Also, protect against a
length of 0.
* Name some frequently-used constants. Correct spelling. Other style nits.
* Bug fix: On Prism, set Create IBSS register to 0 *always*. The meaning
of Create IBSS == 1 is join an IBSS or *ESS*, and we do not want to
join an ESS, because that would put us in an inconsistent state. 0
is the right value for Prism.
* Bug fix: Clean up state at the top of wi_init(), in the event that
we don't reach the bottom.
* Simplify wi_start() by always providing an RFC1042-encoded 802.11
frame to the firmware.
* Larval powersave support for HostAP mode, enabled by WI_HOSTAP_POWERSAVE.
* Bug fix: Call wi_stop() from wi_shutdown().
* Bug fix: sync media options with HostAP mode in wi_sync_media().
* In wi_media_status(), inquire firmware for current media state if
media == auto. From FreeBSD.
* Clean up the way buffer lengths are computed by using pointer
arithmetic rather than magic constants.
* Swap the order of comparisons in addr_cmp() for speed.
* Bug fix: Send ReAssoc Response instead of Assoc Response to a
ReAssoc Request.
* Bug fix: Copy SSID using the correct size.
* Give more meaningful names to offsets in a wi_frame.
* Bug fix: Assign the right values to the named constants for
Rx frame encoding.
* Get rid of useless SNAP constants.


Revision tags: gehenna-devsw-base
# 1.18 11-Aug-2002 thorpej

Remove an unused member from the softc.


# 1.17 11-Aug-2002 thorpej

Snapshot of work-in-progress: Add AP support for Prism2-based boards.
WEP for APs is not yet implemented, but without WEP, this works well
enough for my laptop to associate with an AP running this code.

Adapted from OpenBSD.


# 1.16 11-Aug-2002 thorpej

* Add "wi_flags" to the softc to indicate capabilities of the card. Fill
in this info based on firmware type and version. Replace "wi_has_wep"
with a flag.
* For cards which support IBSS, add "ibss" has a media option.
* For cards which support CREATE_IBSS, add "ibss-master" as a media
option.
* Use the "ibss" and "ibss-master" media options to determine if
we should go into IBSS mode and/or create the IBSS.
* Internally convert between the generic WI_PORTTYPE_IBSS and the
value the firmware wants to use for IBSS.
* When setting the IBSS name, if a desired-SSID is set, and we're
an ibss-master, write the desired-SSID into the own-SSID slot.
This ensures that "ifconfig wi0 nwid FOO" will do the expected
thing.
* Only set the roaming mode if the card supports roaming.

From OpenBSD.


# 1.15 11-Aug-2002 thorpej

Read supported rates from the card and report them. Only add
media types if that rate is supported.

Adapted from OpenBSD.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.14 05-Apr-2002 ichiro

branches: 1.14.2;
fix minor bugs for lucent cards. (point out from Warner Losh)


# 1.13 04-Apr-2002 jdolecek

move wi_pci_reset() from ic/wi.c to pci/if_wi_pci.c, where is belongs


# 1.12 04-Apr-2002 ichiro

using table driven for Prism2 family IDs/Names.


# 1.11 30-Mar-2002 ichiro

added sc_pri_firmware_ver, and print Primary/Station firmware versions.
cosmetic change.


# 1.10 27-Mar-2002 onoe

Fix to work Symbol firmware card, which cannot be initialized more than once.
Tested with 3Com 3CRWE737A and Intel Pro/Wireless 2011.


# 1.9 25-Mar-2002 dbj

changes from Warner Losh to read firmware version for non prism2 cards


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.8 21-Jan-2002 ichiro

"Association Faild" was added to "Link Stat" messages.
;
Implement wi_scan into wi.c.
forces if_wi to initiate one round of access point scan.
This code was written by jrb@cs.pdx.edu, modified and bug-fixed by ichiro@netbsd.org


# 1.7 05-Jan-2002 explorer

revert changes I made a long time ago. This should undo the changes which are causing problems on some non-x86 platforms. I'll probsably redo some of these changes, but after the next release branch.


Revision tags: thorpej-mips-cache-base
# 1.6 13-Oct-2001 ichiro

Add Intersil Prism2.5 Mini-PCI wavelan.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2
# 1.5 22-Sep-2001 explorer

Implement two major items:

(1) Add an IOCTL to tell the Lucent based cards how often to
do an access point scan. These results are returned by
calling another IOCTL to get the most recent scan data.

This function works with prism2 cards as well, but the
data is returned in a different format, or perhaps it is
data only for the closest access point.

(2) For prism2 cards, add the ability to put it into LAN monitor
mode, where (via BPF) all packets can be received. This
mode works best with "wiconfig wi0 -p 3 -f ?" to put the
card into pseudo-IBSS mode (to keep it from channel-hopping
and scanning for access points) and to set the frequency of
the AP you wish to monitor.

The returned data has a partial wi_frame header (down to the
wi_dat_len field) followed by the raw data of the packet.
I have and will put up on http://www.flame.org/NetBSD/wireless/
some simple utilities which do some perhaps interesting things,
like scan for access points, capture packets, etc.


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 15-May-2001 ichiro

branches: 1.4.2; 1.4.4; 1.4.6;
getting prism2 firm ver routine to wi_get_id().
if firm ver is more than 0.8c3, promiscuous mode is off.

typo WI_RID_STA_IDENEITY -> WI_RID_STA_IDENTITY


# 1.3 15-May-2001 ichiro

It enabled it to control roaming mode and authentication mode.
Roaming mode can change value into 'firm mode' and disable.
Authentication mode can change into 'Open System authentication'
and 'Shared Key Authentication' with Prism2 chip.

wi_get_id() was introduced in order that chip might judge automatically
whether it is Prism2 chip. Therefore, a pp_prism2 entry in
"struct wi_pcmcia_product" became unnecessary.


# 1.2 08-May-2001 ichiro

change promisc mode in case of SIOCSIFFLAGS of wi_ioctl.
Fix indentation.


# 1.1 06-May-2001 ichiro

divided into PCMCIA attachment and common code of wi.
since if_wi_ieee.h does not depend for pcmcia,
sys/dev/pcmcia/if_wi_ieee.h was moved to sys/dev/ic/wi_ieee.h .