Home | History | Annotate | Download | only in ic
History log of /src/sys/dev/ic/atwvar.h
RevisionDateAuthorComments
 1.40  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.
 1.39  19-Apr-2018  christos branches: 1.39.2;
s/static inline/static __inline/g for consistency.
 1.38  02-Feb-2017  nonaka branches: 1.38.12;
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
 1.37  14-Mar-2010  dyoung branches: 1.37.20; 1.37.38; 1.37.42; 1.37.46;
Use device_suspensor_t instead of struct device_suspensor.
 1.36  24-Feb-2010  dyoung A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.35  17-Jan-2010  pooka branches: 1.35.2;
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)
 1.34  08-Jan-2010  dyoung Expand PMF_FN_* macros.
 1.33  16-Sep-2009  dyoung In pmf(9), improve the implementation of device self-suspension
and make suspension by self, by drvctl(8), and by ACPI system sleep
play nice together. Start solidifying some temporary API changes.

1. Extract a new header file, <sys/device_if.h>, from <sys/device.h> and
#include it from <sys/pmf.h> instead of <sys/device.h> to break the
circular dependency between <sys/device.h> and <sys/pmf.h>.

2. Introduce pmf_qual_t, an aggregate of qualifications on a PMF
suspend/resume call. Start to replace instances of PMF_FN_PROTO,
PMF_FN_ARGS, et cetera, with a pmf_qual_t.

3. Introduce the notion of a "suspensor," an entity that holds a
device in suspension. More than one suspensor may hold a device
at once. A device stays suspended as long as at least one
suspensor holds it. A device resumes when the last suspensor
releases it.

Currently, the kernel defines three suspensors,

3a the system-suspensor: for system suspension, initiated
by 'sysctl -w machdep.sleep_state=3', by lid closure, by
power-button press, et cetera,

3b the drvctl-suspensor: for device suspension by /dev/drvctl
ioctl, e.g., drvctl -S sip0.

3c the system self-suspensor: for device drivers that suspend
themselves and their children. Several drivers for network
interfaces put the network device to sleep while it is not
administratively up, that is, after the kernel calls if_stop(,
1). The self-suspensor should not be used directly. See
the description of suspensor delegates, below.

A suspensor can have one or more "delegates". A suspensor can
release devices that its delegates hold suspended. Right now,
only the system self-suspensor has delegates. For each device
that a self-suspending driver attaches, it creates the device's
self-suspensor, a delegate of the system self-suspensor.

Suspensors stop a system-wide suspend/resume cycle from waking
devices that the operator put to sleep with drvctl before the cycle.
They also help self-suspension to work more simply, safely, and in
accord with expectations.

4. Add the notion of device activation level, devact_level_t,
and a routine for checking the current activation level,
device_activation(). Current activation levels are DEVACT_LEVEL_BUS,
DEVACT_LEVEL_DRIVER, and DEVACT_LEVEL_CLASS, which respectively
indicate that the device's bus is active, that the bus and device are
active, and that the bus, device, and the functions of the device's
class (network, audio) are active.

Suspend/resume calls can be qualified with a devact_level_t.
The power-management framework treats a devact_level_t that
qualifies a device suspension as the device's current activation
level; it only runs hooks to reduce the activation level from
the presumed current level to the fully suspended state. The
framework treats a devact_level_t qualifying device resumption
as the target activation level; it only runs hooks to raise the
activation level to the target.

5. Use pmf_qual_t, devact_level_t, and self-suspensors in several
drivers.

6. Temporarily add an unused power-management workqueue that I will
remove or replace, soon.
 1.32  13-Sep-2009  dyoung Experimental support for fragmentation and RTS/CTS.

Delete unused atw_voodoo and constants.

Export Tx/Rx statistics with evcnt(9).

Correct the Short Inter-Frame Space (SIFS) that we write to ADM8211's
registers; I do not recall if that corrected the SIFS that I observed
"on the air." Use the constant IEEE80211_DUR_DS_EIFS to configure
the ADM8211's EIFS, instead of writing the same "magic" number,
0x64, that my reference driver wrote.

Do not clear OACTIVE in atw_init(), because atw_stop() cleared it
previously by calling atw_txdrain().

Use the net80211 short-preamble flag and instead of ATW_SHPREAMBLE.

Add an ADM8211 workaround from the reference driver, atw_workaround1(),
but don't compile it right now.

In at_intr(), don't stop processing the interrupt status after
restarting the receive ring, but process Tx interrupt status. If
a packet's Tx lifetime is exceeded, reinitialize the device to get
packets moving again. If the Tx FIFO underflows, restart the
transmitter, not the receiver!

Avoid losing synchronization with the Rx ring by replicating one
of Charles Hannum's fixes to rtw(4) here: receiving a management
packet may, as a side-effect, reset the Rx ring, so refer to the
softc's Rx ring pointer, sc_rxptr, every time through the loop in
atw_rxintr(), instead of refering to a pointer on the stack, i.

Re-synchronize DMA after reading the OWN bit on an Rx/Tx descriptor.
XXX This needs more work.

Reset sc_tx_timer as Tx descriptors are reclaimed from the device.

Shorten staircases in atw_watchdog().

Remove from softc an unused member, sc_intr_ack.
 1.31  12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.30  09-Jul-2008  joerg branches: 1.30.8;
- device/softc split
 1.29  04-May-2008  martin branches: 1.29.2; 1.29.4; 1.29.6;
Move to standard TNF 2 clause license
 1.28  07-Mar-2008  dyoung branches: 1.28.2; 1.28.4;
Use device_t and accessors. Use PMF instead of legacy power
management. Establish the shutdown hook using PMF.
 1.27  25-Dec-2007  perry branches: 1.27.2; 1.27.6;
Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.26  16-Nov-2007  dyoung branches: 1.26.2; 1.26.6;
Count received frames, Rx PLCP errors, Rx FCS (CRC32) errors, and
Rx ICV errors using evcnt(9).

In promiscuous mode, and when scanning (hmm), ask the NIC for bad
packets (e.g., those that do not pass CRC32). Pass bad packets to
radiotap listeners. Pass packets to radiotap listeners before
stripping FCS. Re-order operations in atw_rxintr() to accomplish
all of this without passing bad packets up to net80211.

Set radiotap channel once in atw_tune() instead of in atw_rxintr().

Fix an endianness bug: it_len is little-endian, but bpf_mtap2()'s
argument needs to be in host order.
 1.25  16-Nov-2007  dyoung Use uintXX_t instead of u_intXX_t.
 1.24  16-Nov-2007  dyoung Replace some magic numbers with HFA3861A register names.

Do not alias the Rx descriptor word ar_ctl to ar_rssi with a #define.
Instead, call the member ar_ctlrssi.

Convert the ugly macro ATW_RXDESC_INIT() to an inline subroutine,
atw_rxdesc_init().

Do not load an empty IEEE80211_RADIOTAP_FLAGS field into the Tx
radiotap header.
 1.23  04-Mar-2007  christos branches: 1.23.14; 1.23.16; 1.23.20; 1.23.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.22  31-Aug-2006  dyoung branches: 1.22.8;
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).

Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.

Define __PRIxBIT and __PRIxBITS printf(3) format strings.
 1.21  08-Mar-2006  dyoung Change macro names to avoid collisions:

BIT -> __BIT
BITS -> __BITS
 1.20  08-Mar-2006  dyoung Move my bit-twiddling macros to libkern.h from my drivers, where
I had duplicated them. Improve the macros' names. Simplify their
implementation.

A brief description of each macro is below.

BIT(n): Return a bitmask with bit m set, where the least
significant bit is bit 0.

BITS(m, n): Return a bitmask with bits m through n, inclusive,
set. It does not matter whether m>n or m<=n.
The least significant bit is bit 0.

A "bitfield" is a span of consecutive bits defined by a
bitmask, where 1s select the bits in the bitfield. SHIFTIN,
SHIFTOUT, and SHIFTOUT_MASK help read and write bitfields
from device registers.

SHIFTIN(v, mask): Left-shift bits `v' into the bitfield
defined by `mask', and return them. No
side-effects.

SHIFTOUT(v, mask): Extract and return the bitfield selected
by `mask' from `v', right-shifting the
bits so that the rightmost selected bit
is at bit 0. No side-effects.

SHIFTOUT_MASK(mask): Right-shift the bits in `mask' so that
the rightmost non-zero bit is at bit
0. This is useful for finding the
greatest unsigned value that a bitfield
can hold. No side-effects. Note that
SHIFTOUT_MASK(m) = SHIFTOUT(m, m).

Examples:

/*
* Register definitions taken from the RFMD RF3000 manual.
*/
#define RF3000_GAINCTL 0x11 /* TX variable gain control */
#define RF3000_GAINCTL_TXVGC_MASK BITS(7, 2)
#define RF3000_GAINCTL_SCRAMBLER BIT(1)

/*
* Shift the transmit power into the transmit-power field of the
* gain-control register and write it to the baseband processor.
*/
atw_rf3000_write(sc, RF3000_GAINCTL,
SHIFTIN(txpower, RF3000_GAINCTL_TXVGC_MASK));


/*
* Register definitions taken from the ADMtek ADM8211 manual.
*
*/
#define ATW_RXSTAT_OWN BIT(31) /* 1: NIC may fill descriptor */
/* ... */
#define ATW_RXSTAT_DA1 BIT(17) /* DA bit 1, admin'd address */
#define ATW_RXSTAT_DA0 BIT(16) /* DA bit 0, group address */
#define ATW_RXSTAT_RXDR_MASK BITS(15,12) /* RX data rate */
#define ATW_RXSTAT_FL_MASK BITS(11,0) /* RX frame length, last
* descriptor only
*/

/* Extract the frame length from the Rx descriptor's
* status field.
*/
len = SHIFTOUT(rxstat, ATW_RXSTAT_FL_MASK);
 1.19  29-Dec-2005  dyoung branches: 1.19.4; 1.19.6; 1.19.8; 1.19.10;
Cosmetic: shift atw flags right by 4 bits.
 1.18  29-Dec-2005  dyoung In atw(4), use ieee80211_compute_duration() to compute IEEE 802.11
Duration and PLCP Length fields, and delete the abominable
atw_frame_setdurs() subroutine.

Make rtw(4) use the new ieee80211_compute_duration() calling
convention.

Add an ieee80211_key argument to ieee80211_compute_duration() and
lightly constify arguments. Get the crypto header length from the
key argument instead of blithely assuming a WEP header. Add some
inline documentation. Account for data padding (IEEE80211_F_DATAPAD).
 1.17  11-Dec-2005  christos merge ktrace-lwp.
 1.16  22-Jun-2005  dyoung branches: 1.16.2;
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.15  19-Dec-2004  dyoung Remove from atw(4) all of the 802.11 duration #defines that I just
moved to sys/net80211/ieee80211.h.
 1.14  24-Jul-2004  dyoung branches: 1.14.2;
Pull the IBSS merge logic out of atw and into net80211, since ath
will eventually share it.

In the IBSS merge logic, check conditions in a different order so
that they run faster in the common case---no merge. Fix the
rate-limiting on the debug outputs (enabled by IFF_LINK0).
 1.13  23-Jul-2004  dyoung Print and store Cardbus/PCI revision number.

Begin conditioning device configuration on revision number. Four
revisions are known:

1.1/1.5 -> ADM8211A,
2.0 -> ADM8211B,
3.0 -> ADM8211C.

The B and C parts, which are not supported yet, have AP capability.
 1.12  23-Jul-2004  dyoung Use the new SRAM size constants.
 1.11  15-Jul-2004  dyoung Simplify receive descriptor setup.
 1.10  15-Jul-2004  dyoung I'm not treating the lost beacon count specially any more. It is
kind of a dumb way to track the link condition, anyway....
 1.9  23-Jun-2004  dyoung The ADM8211C uses a different BBP type-number for RFMD parts than
the original ADM8211.
 1.8  29-Jan-2004  dyoung Get rid of __P.
 1.7  29-Jan-2004  dyoung Add atw_pci_enable, atw_pci_disable. Fixes a panic at "ifconfig
down" that was reported by Darren Reed.
 1.6  10-Jan-2004  dyoung Get rid of empty #if 0/#endif stanza.
 1.5  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.4  07-Dec-2003  dyoung Cosmetic: add some whitespace for readability.
 1.3  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.2  13-Oct-2003  dyoung Adapt atw(4) to the new 802.11 layer.

Simplify atw_start, atw_newstate.

Synchronize access to atw_start by bracketing the call to
ieee80211_next_scan in atw_next_scan with splnet()/splx().
 1.1  06-Jul-2003  dyoung Oops. Add the atw(4) sources, too.
 1.14.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.5  17-Jan-2005  skrll Sync with HEAD.
 1.14.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.14.2.2  03-Aug-2004  skrll Sync with HEAD
 1.14.2.1  24-Jul-2004  skrll file atwvar.h was added on branch ktrace-lwp on 2004-08-03 10:46:11 +0000
 1.16.2.6  17-Mar-2008  yamt sync with head.
 1.16.2.5  21-Jan-2008  yamt sync with head
 1.16.2.4  07-Dec-2007  yamt sync with head
 1.16.2.3  03-Sep-2007  yamt sync with head.
 1.16.2.2  30-Dec-2006  yamt sync with head.
 1.16.2.1  21-Jun-2006  yamt sync with head.
 1.19.10.1  19-Apr-2006  elad sync with head.
 1.19.8.2  03-Sep-2006  yamt sync with head.
 1.19.8.1  13-Mar-2006  yamt sync with head.
 1.19.6.1  22-Apr-2006  simonb Sync with head.
 1.19.4.1  09-Sep-2006  rpaulo sync with head
 1.22.8.1  12-Mar-2007  rmind Sync with HEAD.
 1.23.22.2  18-Feb-2008  mjf Sync with HEAD.
 1.23.22.1  19-Nov-2007  mjf Sync with HEAD.
 1.23.20.1  18-Nov-2007  bouyer Sync with HEAD
 1.23.16.2  23-Mar-2008  matt sync with HEAD
 1.23.16.1  09-Jan-2008  matt sync with HEAD
 1.23.14.1  21-Nov-2007  joerg Sync with HEAD.
 1.26.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.26.2.1  26-Dec-2007  ad Sync with head.
 1.27.6.3  28-Sep-2008  mjf Sync with HEAD.
 1.27.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.27.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.27.2.1  24-Mar-2008  keiichi sync with head.
 1.28.4.6  11-Aug-2010  yamt sync with head.
 1.28.4.5  11-Mar-2010  yamt sync with head
 1.28.4.4  16-Sep-2009  yamt sync with head
 1.28.4.3  16-May-2009  yamt sync with head
 1.28.4.2  04-May-2009  yamt sync with head.
 1.28.4.1  16-May-2008  yamt sync with head.
 1.28.2.1  18-May-2008  yamt sync with head.
 1.29.6.1  19-Oct-2008  haad Sync with HEAD.
 1.29.4.1  18-Jul-2008  simonb Sync with head.
 1.29.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.30.8.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.35.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.37.46.1  21-Apr-2017  bouyer Sync with HEAD
 1.37.42.1  20-Mar-2017  pgoyette Sync with HEAD
 1.37.38.1  05-Feb-2017  skrll Sync with HEAD
 1.37.20.1  03-Dec-2017  jdolecek update from HEAD
 1.38.12.1  22-Apr-2018  pgoyette Sync with HEAD
 1.39.2.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411

RSS XML Feed