Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/if_sip.c
RevisionDateAuthorComments
 1.193  05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@
 1.192  29-Jun-2024  riastradh if_stats(9): Add ifp argument to if_stat..._ref.

This will enable us to pass the ifp through to a dtrace probe inside.

No functional change intended in this change, but this is an API
change visible to modules so it shouldn't be pulled up.

PR kern/58377
 1.191  10-Feb-2024  andvar s/alloted/allotted/ in comments.
 1.190  02-Jun-2023  andvar follow the steps of Andrew Doran (ad) commit and fix more s/loose/lose/ typos.
also s/beyound/beyond/ and few others along the way, mainly in comments.
 1.189  24-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.188  11-Sep-2022  ryo Packets larger than 1518 bytes (1522 bytes if VLAN tag is included) are no longer received.
Previously, those packets were received as truncated (incomplete) packets.
 1.187  06-Aug-2022  riastradh sip(4): Tidy up DMA syncs.

- No membar_producer in sip_init_rxdesc -- use bus_dmamap_sync with
BUS_DMASYNC_PREWRITE to order updates to the DMA descriptors.

- Omit needless membar_producer in sip_init_txdesc -- the hardware
will not look at any of these descriptors until we set CMDSTS_OWN
on the first one in the sequence, which is done later in the
caller, sipcom_start.

- In gsip_rxintr, make sure to read cmdsts _before_ extsts, by
separating them with BUS_DMASYNC_PREREAD. Otherwise, the CPU might
reorder the loads and read a stale extsts first before witnessing
an updated cmdsts with the CMDSTS_OWN bit that transfers ownership
of the rx packet to us.
 1.186  24-May-2022  andvar fix various typos in comment, documentation and log messages.
 1.185  16-Feb-2022  andvar fix various typos, mainly in comments.
 1.184  31-Dec-2021  riastradh sys: Use if_init wrapper function.

Exception: Not in kern_pmf.c, for the kind of silly reason that it
avoids having kern_pmf.c refer to symbols defined only in net; this
avoids a pain in the rump.
 1.183  21-Oct-2021  andvar fix various typos, mainly in comments, but also in man pages and log messages.
 1.182  16-Mar-2020  thorpej Do the "have transmit resources available" check before checking that
there is a packet in the send queue.
 1.181  15-Mar-2020  thorpej Don't bother with IFF_OACTIVE.
 1.180  13-Mar-2020  thorpej Adjust the logic for enabling the 64-bit data path when a 64-bit slot
is detected:
- If DATA64_EN isn't set in CFG after a reset, don't use 64-bit data path
at all (it's been disabled by an EEPROM setting).
- Provide a hook for force-disabling the 64-bit data path.
- Otherwise, perform the "known 64-bit cards" check as done previously
(because dodgy-vendor-EEPROM-settings still applies).
 1.179  08-Mar-2020  thorpej Support 64-bit DMA addressing on the DP83820, used only when a 64-bit
DMA tag is available.
 1.178  07-Feb-2020  thorpej Use callout_setfunc() / callout_schedule().
 1.177  04-Feb-2020  thorpej Use ifmedia_fini().
 1.176  30-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.175  13-Sep-2019  msaitoh branches: 1.175.2;
if_flags is neither int nor short. It's unsigned short.
 1.174  09-Jul-2019  msaitoh Don't automatically set ec_capenable's ETHERCAP_VLAN_HWTAGGING bit in
vlan_config() to make it user-controllable. Instead, set the bit in
xxx_attach().
 1.173  28-May-2019  msaitoh Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.172  23-May-2019  msaitoh No functional change:
- Simplify MII structure initialization and reference.
- u_int*_t -> uint*_t.
- KNF
 1.171  26-Apr-2019  msaitoh No functional change:
- u_int_{8,16,32}_t -> uint_{8,16,32}_t
- KNF.
- Tabify.
- Remove extra space.
 1.170  26-Apr-2019  msaitoh Fix a bug that read value of MII_EXTSR register on TBI mode always fails.
This bug was added in rev. 1.169.
 1.169  22-Jan-2019  msaitoh Change MII PHY read/write API from:

int (*mii_readreg_t)(device_t, int, int);
void (*mii_writereg_t)(device_t, int, int, int);
to:

int (*mii_readreg_t)(device_t, int, int, uint16_t *);
int (*mii_writereg_t)(device_t, int, int, uint16_t);

Now we can test if a read/write operation failed or not by the return value.

In 802.3 spec says that the PHY shall not respond to read/write transaction
to the unimplemented register(22.2.4.3). Detecting timeout can be used to
check whether a register is implemented or not (if the register conforms to
the spec). ukphy(4) can be used this for MII_MMDACR and MII_MMDAADR.

Note that I noticed that the following code do infinite loop in the
read/wirte function. If it accesses unimplemented PHY register, it will hang.
It should be fixed:

arm/at91/at91emac.c
arm/ep93xx/epe.c
arm/omap/omapl1x_emac.c
mips/ralink/ralink_eth.c
arch/powerpc/booke/dev/pq3etsec.c(read)
dev/cadence/if_cemac.c <- hkenken
dev/ic/lan9118.c


Tested with the following device:

axe+ukphy
axe+rgephy
axen+rgephy (tested by Andrius V)
wm+atphy
wm+ukphy
wm+igphy
wm+ihphy
wm+makphy
sk+makphy
sk+brgphy
sk+gentbi
msk+makphy
sip+icsphy
sip+ukphy
re+rgephy
bge+brgphy
bnx+brgphy
gsip+gphyter
rtk+rlphy
fxp+inphy (tested by Andrius V)
tlp+acphy
ex+exphy
epic+qsphy
vge+ciphy (tested by Andrius V)
vr+ukphy (tested by Andrius V)
vte+ukphy (tested by Andrius V)

Not tested (MAC):
arm:at91emac
arm:cemac
arm:epe
arm:geminigmac
arm:enet
arm:cpsw
arm:emac(omac)
arm:emac(sunxi)
arm:npe
evbppc:temac
macppc:bm
macppc:gm
mips:aumac
mips:ae
mips:cnmac
mips:reth
mips:sbmac
playstation2:smap
powerpc:tsec
powerpc:emac(ibm4xx)
sgimips:mec
sparc:be
sf
ne(ax88190, dl10019)
awge
ep
gem
hme
smsh
mtd
sm
age
alc
ale
bce
cas
et
jme
lii
nfe
pcn
ste
stge
tl
xi
aue
mue
smsc
udav
url

Not tested (PHY):
amhphy
bmtphy
dmphy
etphy
glxtphy
ikphy
iophy
lxtphy
nsphyter
pnaphy
rdcphy
sqphy
tlphy
tqphy
urlphy
 1.168  26-Jun-2018  msaitoh branches: 1.168.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.167  26-Sep-2017  knakahara branches: 1.167.2;
VLAN ID uses pkthdr instead of mtag now. Contributed by s-yamaguchi@IIJ.

I just commit by proxy. Reviewed by joerg@n.o and christos@n.o, thanks.
See http://mail-index.netbsd.org/tech-net/2017/09/26/msg006459.html

XXX need pullup to -8 branch
 1.166  10-May-2017  msaitoh branches: 1.166.2;
Use pci_intr_establish_xname().
 1.165  15-Dec-2016  ozaki-r branches: 1.165.6;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.164  08-Dec-2016  ozaki-r Apply deferred if_start framework

if_schedule_deferred_start checks if the if_snd queue contains packets,
so drivers don't need to check it by themselves.
 1.163  14-Jul-2016  msaitoh branches: 1.163.2;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.162  07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.161  10-Jun-2016  ozaki-r Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.160  09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.159  13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.158  10-Aug-2014  tls branches: 1.158.4;
Merge tls-earlyentropy branch into HEAD.
 1.157  29-Mar-2014  christos branches: 1.157.2;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.156  30-Mar-2013  christos branches: 1.156.4;
remove trailing whitespace
 1.155  23-Sep-2012  chs match some more devices.
 1.154  22-Jul-2012  matt branches: 1.154.2;
Fix mii_statchg to take a 'struct ifnet *' instead of device_t. This fixes
problem with a common MDIO bus used for multiple interfaces.
Some drivers converted to CFATTACL_DECL_NEW.
 1.153  02-Feb-2012  tls branches: 1.153.2;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.152  12-Dec-2011  jakllsch Using BUS_DMA_NOCACHE for bus_dmamem_map() causes issues on (at least) sparc64.
 1.151  19-Nov-2011  tls branches: 1.151.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.150  15-Oct-2011  dholland branches: 1.150.2;
"return f();" where both f and the enclosing function return void is
sometimes convenient. But, it's not standard, so don't do it.
 1.149  13-Nov-2010  uebayasi Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.148  05-Apr-2010  joerg Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.147  24-Feb-2010  dyoung branches: 1.147.2;
Use device_suspensor_t.
 1.146  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.145  19-Jan-2010  pooka branches: 1.145.2;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.144  08-Jan-2010  dyoung Expand PMF_FN_* macros.
 1.143  26-Nov-2009  njoly Cleanup interrupt establish error messages. Do not mix
aprint_error/aprint_normal/printf calls for a single line.
 1.142  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.141  05-Sep-2009  tsutsui Invert logic around nested pmf(9) registrations for readability.
 1.140  05-May-2009  dyoung Change struct cfdata * to cfdata_t. No functional change intended.
 1.139  05-May-2009  cegger device_t/softc split
tested by and ok dyoung@
 1.138  02-Apr-2009  dyoung During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.
 1.137  27-Mar-2009  dyoung If a sip(4) is powered down, then so is its PHY, so don't try to read
media status from the PHY.
 1.136  07-Mar-2009  dyoung Don't try to write the registers of the NIC to stop it if it is
already powered down. This change prevents PCI bus exceptions
(indicated by NMI) when, for example, I detach the whole device
tree on a Soekris net4521:

com1: detached
NMI ... going to debugger
Stopped in pid 0.1 (system) at netbsd:sipcom_stop+0x4d: pushl $0
db{0}> continue
NMI ... going to debugger
Stopped in pid 0.1 (system) at netbsd:sipcom_stop+0x149: addl $0x10,%e
sp
db{0}> continue
sip0: detached

(On the AMD Elan SC520, the NMI occurs at the instruction after
the write or, if the write was posted, at either that instruction
or some later one.)
 1.135  07-Nov-2008  dyoung branches: 1.135.4;
*** Summary ***

When a link-layer address changes (e.g., ifconfig ex0 link
02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address. (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior. Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability. KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR. In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr. That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR. In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR. For example, pull ..._init() out of any switch
statement that looks like this:

switch (...->sa_family) {
case ...:
..._init();
...
break;
...
default:
..._init();
...
break;
}

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

switch (x & (IFF_UP|IFF_RUNNING)) {
case 0:
...
break;
case IFF_RUNNING:
...
break;
case IFF_UP:
...
break;
case IFF_UP|IFF_RUNNING:
...
break;
}

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure. Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls. In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source. In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively. Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset. Delete unnecessary casts to void *. Use
sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with
NULL instead of "testing truth". Replace some instances of (type
*)0 with NULL. Change some K&R prototypes to ANSI C, and join
lines.
 1.134  05-May-2008  dyoung branches: 1.134.6; 1.134.8;
Make PCI power re-activation DTRT: pass pci_activate_null instead
of NULL to pci_activate()

Call the variable where we store the PCI Command & Status Register
'csr' instead of 'pmreg'.

In sipcom_intr(), get out if the device is inactive. Otherwise
sip(4) may inadvertently try to handle a shared interrupt before
the driver state is completely set up.
 1.133  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.132  10-Apr-2008  cegger branches: 1.132.2; 1.132.4;
use aprint_*_dev and device_xname
 1.131  21-Mar-2008  dyoung pci_activate() expects for its void * argument to be a device_t,
so change the type of the argument to device_t. Update each use
of pci_activate().

Use device_t and accessors. Use aprint_*_dev().
 1.130  12-Mar-2008  dyoung Use device_t and its accessors throughout. Use aprint_*_dev().

Improve PMF-ability.

Add a 'flags' argument to suspend/resume handlers and
callers such as pmf_system_suspend().

Define a flag, PMF_F_SELF, which indicates to PMF that a
device is suspending/resuming itself. Add helper routines,
pmf_device_suspend_self(dev) and pmf_device_resume_self(dev),
that call pmf_device_suspend(dev, PMF_F_SELF) and
pmf_device_resume(dev, PMF_F_SELF), respectively. Use
PMF_F_SELF to suspend/resume self in ath(4), audio(4),
rtw(4), and sip(4).

In ath(4) and in rtw(4), replace the icky sc_enable/sc_disable
callbacks, provided by the bus front-end, with
self-suspension/resumption. Also, clean up the bus
front-ends. Make sure that the interrupt handler is
disestablished during suspension. Get rid of driver-private
flags (e.g., RTW_F_ENABLED, ath_softc->sc_invalid); use
device_is_active()/device_has_power() calls, instead.

In the network-class suspend handler, call if_stop(, 0)
instead of if_stop(, 1), because the latter is superfluous
(bus- and driver-suspension hooks will 'disable' the NIC),
and it may cause recursion.

In the network-class resume handler, prevent infinite
recursion through if_init() by getting out early if we are
self-suspending (PMF_F_SELF).

rtw(4) improvements:

Destroy rtw(4) callouts when we detach it. Make rtw at
pci detachable. Print some more information with the "rx
frame too long" warning.

Remove activate() methods:

Get rid of rtw_activate() and ath_activate(). The device
activate() methods are not good for much these days.

Make ath at cardbus resume with crypto functions intact:

Introduce a boolean device property, "pmf-powerdown". If
pmf-powerdown is present and false, it indicates that a
bus back-end should not remove power from a device.

Honor this property in cardbus_child_suspend().

Set this property to 'false' in ath_attach(), since removing
power from an ath at cardbus seems to lobotomize the WPA
crypto engine. XXX Should the pmf-powerdown property
propagate toward the root of the device tree?

Miscellaneous ath(4) changes:

Warn if ath(4) tries to write crypto keys to suspended
hardware.

Reduce differences between FreeBSD and NetBSD in ath(4)
multicast filter setup.

Make ath_printrxbuf() print an rx descriptor's status &
key index, to help debug crypto errors.

Shorten a staircase in ath_ioctl(). Don't check for
ieee80211_ioctl() return code ERESTART, it never happens.
 1.129  11-Mar-2008  dyoung Use device_t and accessors.
 1.128  29-Feb-2008  dyoung Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.127  07-Feb-2008  dyoung branches: 1.127.2; 1.127.6;
Start patching up the kernel so that a network driver always has
the opportunity to handle an ioctl before generic ifioctl handling
occurs. This will ease extending the kernel and sharing of code
between drivers.

First steps: Make the signature of ifioctl_common() match struct
ifinet->if_ioctl. Convert SIOCSIFCAP and SIOCSIFMTU to the new
ifioctl() regime, throughout the kernel.
 1.126  19-Jan-2008  dyoung Let ether_ioctl() handle default SIOCSIFMEDIA/SIOCGIFMEDIA actions.
 1.125  10-Jan-2008  dyoung Re-use ether_mediachange(), ether_mediastatus(). Stop using
shutdownhook_establish(9).
 1.124  16-Dec-2007  dyoung Convert many macros to inline subroutines. Some of the subroutines
probably should not be inline.
 1.123  15-Dec-2007  dyoung sip_copy_small and gsip_copy_small should not be static any longer.
Make it so.
 1.122  15-Dec-2007  he Only declare sip_copy_small under __NO_STRICT_ALIGNMENT, to afoid
a "defined but not used" warning turned into error by compiler options.
 1.121  15-Dec-2007  dyoung Take care to release all resources. Now I can 'drvctl -d sip0;
drvctl -r pci0' to to detach / re-attach a sip0.
 1.120  15-Dec-2007  dyoung Finish making the sip(4) and gsip(4) drivers share compiled code.
 1.119  15-Dec-2007  dyoung Attach sip to 10/100 variants, gsip to gigabit variants. Thanks
Izumi Tsutsui for the bug report.
 1.118  14-Dec-2007  dogcow fix KDASSERTs by defining ifp
 1.117  14-Dec-2007  dyoung Simplify suspend/resume using device_has_power().
 1.116  14-Dec-2007  dyoung Take a step toward sharing compiled code between sip(4) and gsip(4):
get rid of SIP_DECL() and reduce #ifdef DP83820 code. Next step
is to move a bunch of shared code to a new file (if_sipcom.c, say)
and compile it *once*.

While I am here, add suspend/resume handling to sip(4) and to
gsip(4).

Tested with the NatSemi sip(4) on the Soekris net4521. I don't
have any gsip(4) to test with, and it seems that the few holders
of gsip(4) in the world keep them in their attic, anyway.
 1.115  19-Oct-2007  ad branches: 1.115.2; 1.115.4; 1.115.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.114  29-Aug-2007  dyoung branches: 1.114.4;
Constify: LLADDR() -> CLLADDR().
 1.113  09-Jul-2007  ad branches: 1.113.2; 1.113.6; 1.113.8;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.112  04-Mar-2007  yamt branches: 1.112.2; 1.112.4;
fix fallout from caddr_t changes.
 1.111  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.110  16-Nov-2006  christos branches: 1.110.4;
__unused removal on arguments; approved by core.
 1.109  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.108  17-Jun-2006  christos branches: 1.108.4; 1.108.6;
re-factor the pci powestate api. reviewed by gimpy
 1.107  18-Apr-2006  pavel branches: 1.107.2; 1.107.4;
VLAN tags were sent byte-swapped by the gsip driver, because the driver
forgets to convert them from the host to the network byte order. Use
bswap16 to convert them. (Not htons, because on a big-endian machine, they
are in the correct byte order initially, but then, they are byte-swapped
by a htole32 call when written to the transmit descriptor. So
byte-swapping is needed in this case too, to compensate for this htole32
call.)

For a similar reason, tags were seen byte-swapped when received on a
big-endian machine. Replace ntohs by bswap16 in the input path too.
(Again, it is needed to compensate for a le32toh call when the receive
descriptor is read.)

Fixes PR 32644.

Tested on 3.0/i386, 3.0/sgimips and current/alpha.

OK by martin@.
 1.106  10-Apr-2006  pavel In rev. 1.98, the ioctl method of the (g)sip drivers was optimized for
SIOCSIFFLAGS: it compares the new flags with the old flags and avoids
reset if there are only certain changes. This was done to fix PR 29126.

It does not take into account, though, that there is other state which
can change and SIOCSIFFLAGS is called to inform about it. Namely,
if_capenable, ec_capenable and ec_nvlans. For all three, the _init
method must program the hardware specially. Not doing it resulted in:
- VLAN frames getting truncated
- hw checksumming not working
- outgoing VLAN frames not being tagged when they should
- incoming VLAN frames being treated as untagged.

Fix by keeping all the old state in the softc and initializing the
hardware if any of it changes.

Tested on gsip. Also tested by Nino Dehne and Martin J. Laubach
on sip, thanks.

Fixes PRs 32900 and 33216.

Approved by martin@ .
 1.105  27-Mar-2006  bouyer MCLAIM() mbufs allocated here.
 1.104  07-Feb-2006  thorpej branches: 1.104.2; 1.104.4; 1.104.6;
In the receive interrupt handler, compute the packet length before resetting
m to point to the first buffer in the packet. The bug would cause the
length of jumbo frames to be incorrect.
 1.103  11-Dec-2005  christos branches: 1.103.2; 1.103.4; 1.103.6;
merge ktrace-lwp.
 1.102  02-May-2005  yamt branches: 1.102.2;
split IFCAP_CSUM_xxx to IFCAP_CSUM_xxx_Rx and IFCAP_CSUM_xxx_Tx.
 1.101  27-Feb-2005  perry branches: 1.101.2;
nuke trailing whitespace
 1.100  20-Feb-2005  jdolecek use VLAN_* macros for VLAN tag extraction/addition
 1.99  06-Feb-2005  cube Initialize 'error' in all cases in ioctl handler, otherwise it doesn't
compile (and of course might return garbage). [hi kim!]
 1.98  06-Feb-2005  kim If the interface is up and running, only modify the receive filter
when setting promiscuous or debug mode. This avoids resetting the
chip unnecessarily.

Fixes PR kern/29126.
 1.97  30-Jan-2005  thorpej - Fix some logic errors in multi-descriptor packet reception case for
DP83820.
- Eliminate use of M_HASFCS.
 1.96  30-Oct-2004  thorpej branches: 1.96.4; 1.96.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.95  21-Aug-2004  thorpej Use ANSI function decls and make use of static.
 1.94  15-May-2004  thorpej Add PAUSE-related event counters for sip(4) and gsip(4), slightly modified
from a patch supplied by HITOSHI Osada.
 1.93  15-May-2004  thorpej Patch from HITOSHI Osada:
* On the DP83820, don't set PCR_PS_DA if the PAUSE packet address is
not registered in the multicast filter.
 1.92  15-May-2004  thorpej Patch from HITOSHI Osada:
* SiS900 chips require the address of the PAUSE packet to be registered
in the multicast filter.
 1.91  09-May-2004  fair Two changes:
1. ifdef out the restriction that the SiS 900 has only one PHY
This is demonstrably false; the SiS 960 super south bridge in
PR 18590 has a SiS 900 rev 1 core in it.

2. bitbang the MII for all versions of the SiS 900; this is the
only way that the PHYs on this system answer.

Also, I suspect that SIS900_REV_960 constant in if_sipreg.h is
incorrectly labelled - there were later revisions of the super
south bridge (e.g. the 961, 962, and 963), and I suspect the
SiS 900 revision code there refers to one of those.
 1.90  22-Apr-2004  enami If defined(DP83820), (always) drop IFF_OACTIVE if we got txintr.
Otherwise, the driver simply stuck once we face tx resource shortage.
 1.89  11-Apr-2004  thorpej Flow control support for DP83820 and SiS900. From HITOSHI Osada.
 1.88  11-Apr-2004  thorpej Improvements to DP83820 support, from HITOSHI Osada:
- Fix jumbo frame support.
- Disable interrupts at the chip in sip_intr().
- Disable checksum offloading if MTU > 8109 - the hardware is broken
in this case.
- Use the interrupt hold-off timer.
- Correct the Tx FIFO size.
- Add Pause Control/Status register definitions.
 1.87  11-Jan-2004  cube branches: 1.87.2;
The limitation for TX/RX DMA of rev. 900B and 635 os the SiS chips also
applies to rev. 0x91 for 96x chipsets. Needed to fix PR 24043, but more
stressing testing has to be performed before closing it.
 1.86  05-Dec-2003  cube Remove bitbang code that was taken from FreeBSD to support recent SiS
chipsets and use mii_bitbang interface instead. Reflect sip dependency in
the config file.

Support for SiS96x needs broader testing.
 1.85  04-Dec-2003  keihan netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.84  03-Dec-2003  cube o Add support for accessing the PHY through MDIO for recent SiS chips
o Add support for the recent SiS96x chipsets that have a new revision.
That includes a new bit of code to access the EEPROM, since it is
shared with the ieee1394 controller on those chipsets.

Mostly taken from FreeBSD (rev. 1.62 and 1.64 of sys/pci/if_sip.c). I
tried to make the code look less ugly, but couldn't invent documentation.

Fix PR #23481. Thanks to Stephane ENGEL <sengel AT melshake DOT com> for
the report and the cheerful testing.
 1.83  29-Oct-2003  mycroft Fix the real cause of the uninitialized warning -- we were looking for the VLAN
tag in the wrong place!
 1.82  25-Oct-2003  christos Fix uninitialized variable warnings
 1.81  30-Sep-2003  martin Fix typo (DP83020 -> DP83820) from HITOSHI Osada in PR kern/23023.
 1.80  25-Aug-2003  itojun KNF
 1.79  15-Aug-2003  itojun accept 1518-byte frames (needed for vlan). Valtteri Vuorikoski
 1.78  23-Mar-2003  thorpej branches: 1.78.2;
Add a work-around for the "short cable problem" that some DP83815
revisions have, as discussed on the soekris-tech mailing list a
while ago, whereby one can experience excessive recieve erros when
using < 30m cables. The patch detects overflow in a DSP filter
parameter, and corrects it by writing a known good value.
 1.77  13-Mar-2003  briggs Detect SMC EZ Card as 64-bit. Patch from Pavel Cahyna in kern/20680.
 1.76  17-Jan-2003  itojun switch from kame-based m_aux mbuf auxiliary data, to openbsd m_tag
implementation. it will simplify porting across *bsd (such as kame/altq),
and make us more synchronized. from Joel Wilsson
 1.75  23-Dec-2002  tsutsui Replace magic numbers for power management control with PCI_PMCSR* macros.

XXX Should we use pci_get_powerstate() and pci_set_powerstate() in pci.c?
 1.74  24-Nov-2002  scw Fix uninitialised variable warnings.
 1.73  17-Oct-2002  fair Change the "dontcare" bits argument of ifmedia_init() to IFM_IMASK,
so that PHY instance is not siginificant in ifmedia_match(). This
is done to support multiple PHYs on the MII. Without this change,
ifmedia_set() would panic the system when no PHYs were matched.

I ran into this on an AMD EasyNow PC, which is built around SiS
system chips with an embedded SiS 900 core, and an external AMD
Am79c901 PHY, which presents two PHYs on the MII: one for HomePNA,
and one for standard 10base-T. The 10base-T PHY ends up with instance
number 1...
 1.72  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.71  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.70  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.69  26-Aug-2002  thorpej * The Netgear GA-621 is a 64-bit card, so add it to the 64-bit
quirk table.
* We want to hardwire BMSR_EXTSTAT, not BMSR_EXTCAP, when reading
the TBI BMSR.
* Fetch the GPIO bits from the GPIOR register after an auto-load,
rather than reading from the EEPROM directly.
 1.68  26-Aug-2002  itojun need to set wantinit variable
 1.67  26-Aug-2002  itojun suppress some of debugging output (IFF_DEBUG will re-enable it). PR 18069
 1.66  21-Aug-2002  itojun use RND_ENABLED() to avoid unneeded function call. should help if_gsip case.
 1.65  20-Aug-2002  itojun attach random number source.
 1.64  16-Aug-2002  thorpej * Hard-code EXTSR_1000XFDX|EXTSR_1000XHDX for reads of the MII_EXTSR
in the TBI case.
* Force BMSR_ANEG | BMSR_EXTCAP to be returned for reads of the MII_BMSR
in the TBI case.
 1.63  10-Aug-2002  thorpej Preliminary support for the ten-bit interface on the DP83820. This
code needs more testing, and more bug fixing.
 1.62  10-Aug-2002  thorpej Don't treat the "reset complete" interrupts as errors. Doing so
causes us to go into a reset/interrupt/reset/... loop.
 1.61  11-Jul-2002  thorpej Add 64-bit quirk for the Accton EN1407-T/Planex GN-1000TE. IDs provided
by SAITOH Masanobu <msaitoh@netbsd.org>.
 1.60  30-Jun-2002  thorpej Add a table of known-64-bit DP83820-based cards. Use this table
to enable 64-bit data transfers on 64-bit cards when plugged into
a 64-bit slot. Right know the Asante GigaNIX is listed in that
table.

Sigh, there is an EEPROM bit that can be used to detect 64-bit vs
32-bit cards. Unfortunately, at least 2 vendors of 32-bit cards
fail to clear the "DATA64_EN" bit in the EEPROM, which causes the
card to lose badly, because it still manages to detect that it's
plugged into a 64-bit PCI slot. Yay, stupid hardware vendors.
 1.59  30-Jun-2002  thorpej Load configuration data from the EEPROM on the DP83820 differently: rather
than grovel the EEPROM directly, initiate an "EEPROM load" in the PCI
test register, and fetch the values from the CFG register.
 1.58  30-Jun-2002  thorpej Update the TODO list: We have some Tx interrupt mitigation now, so
we need to do Rx interrupt mitigation next.
 1.57  30-Jun-2002  thorpej Be more aggressive in giving descriptors to the chip in the transmit
path: Instead of waiting for the if_snd queue to be drained before
giving ownership of the frist descriptor to the chip, do it after
sync'ing all the descriptors for a single packet.
 1.56  30-Jun-2002  thorpej Implement a sliding interrupt delay window for Tx interrupts.
 1.55  30-Jun-2002  thorpej * Give symbolic names to the CFG bits in the EEPROM.
* Get CFG_M64ADDR, CFG_T64ADDR, and CFG_DATA64_EN from the EEPROM.
Note, we still disable CFG_M64ADDR and CFG_T64ADDR later (XXX need
PCI bus capability flags for these).
* Print a message if we're in a 64-bit slot and 64-bit data is
disabled in the EEPROM. Make sure CFG_DATA64_EN is disabled if
we're not in a 64-bit slot.
 1.54  01-Jun-2002  lukem SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n),
this mirrors the functionality of SLIST_REMOVE() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
 1.53  28-May-2002  tron Set initial transmit drain threshold to 1504 to avoid the problem
described in PR kern/16070. Change approved by Jason Thorpe.

XXX We'll should try to find a better adaptive scheme for the next
NetBSD release.
 1.52  03-May-2002  thorpej branches: 1.52.2; 1.52.4;
Bump the number of Tx DMA segments from 8 to 16 (the zero-copy socket
code sometimes sees more than 8).
 1.51  27-Mar-2002  briggs Erf. Actually use the symbolic name for the 630ET instead of a constant.
 1.50  27-Mar-2002  briggs Print the chip revision in the attach function.
Treat revision 0x84 of the SiS like other SIS630 variants.
Call revision 0x84 the 630ET (name from OpenBSD).
 1.49  24-Mar-2002  is use the right endian ether_crc32 function in the multicast hash table computation
 1.48  28-Feb-2002  thorpej If the upper layer says Write/Invalidate is okay, then make sure
it's enabled in the PCI CSR.
 1.47  28-Feb-2002  thorpej Change the default Rx FIFO drain threshold to 128 bytes; this
reduces the likelihood of Rx FIFO overruns on machines with wimpy
PCI busses, while still allowing the interface to burst with a
reasonable size.
 1.46  28-Feb-2002  thorpej * On the DP83820, make sure to make the Tx DMA map large enough for
jumbo frames.
* Work around broken PXE firmware on some boards, which leave the ROM
BAR enabled even after the PXE stack has been unloaded.
* Set up the initial values for sc_tx_fill_thresh, sc_tx_drain_thresh, and
sc_rx_drain_thresh in sip_attach(), rather than in sip_init().
 1.45  09-Feb-2002  thorpej Fix problems associated with the SiS 635/735 on-board Ethernet,
from Stephen Degler <sdegler@degler.net>, port-i386/15261.
 1.44  20-Dec-2001  thorpej Fetch the MAC address from the NVRAM on the SiS 630 built-in Ethernet.

Based on PR 14665, Stephen Borrill <netbsd@precedence.co.uk>.
 1.43  13-Nov-2001  lukem add RCSID
 1.42  23-Jul-2001  thorpej Make sure to initialize the all Rx descriptors properly in *_init()
even if mbufs for them are already allocated.
 1.41  19-Jul-2001  thorpej Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.
 1.40  08-Jul-2001  thorpej branches: 1.40.2;
Some cosmetic shuffling.
 1.39  08-Jul-2001  thorpej Fix a very, very dumb mistake that broke multicast on the dp83815
and dp83820.
 1.38  07-Jul-2001  thorpej Change the structure of dp83815_set_filter ever so slightly.
 1.37  07-Jul-2001  thorpej bcmp -> memcmp
 1.36  07-Jul-2001  thorpej Add support for jumbo Ethernet frames on the DP83820.
 1.35  30-Jun-2001  thorpej Split the receive interrupt handler into two versions, one for the
SiS900/DP83815, one for the DP83820. In preparation for changes
to the DP83820 version for handling jumbo Ethernet frames.
 1.34  18-Jun-2001  simonb Make error checking/reporting a little more correct.
 1.33  12-Jun-2001  thorpej Don't need INET or NS includes here.
 1.32  03-Jun-2001  thorpej Clarify a historical comment.
 1.31  02-Jun-2001  thorpej Implement support for IP/TCP/UDP checksum offloading provided by
network interfaces. This works by pre-computing the pseudo-header
checksum and caching it, delaying the actual checksum to ip_output()
if the hardware cannot perform the sum for us. In-bound checksums
can either be fully-checked by hardware, or summed up for final
verification by software. This method was modeled after how this
is done in FreeBSD, although the code is significantly different in
most places.

We don't delay checksums for IPv6/TCP, but we do take advantage of the
cached pseudo-header checksum.

Note: hardware-assisted checksumming defaults to "off". It is
enabled with ifconfig(8). See the manual page for details.

Implement hardware-assisted checksumming on the DP83820 Gigabit Ethernet,
3c90xB/3c90xC 10/100 Ethernet, and Alteon Tigon/Tigon2 Gigabit Ethernet.
 1.30  18-May-2001  thorpej - Add some instrumentation which can be enabled by defining
SIP_EVENT_COUNTERS.
- Decrease SIP_NTXSEGS to 8 and increase SIP_TXQUEUELEN to 256.
This gives us 256 transmit jobs with only twice the descriptor
memory footprint. This prevents stalling transmissions due to
lack of transmit jobs under heavy load.
- Increase SIP_NRXDESC to 128 so we don't run out of receive descriptors
under extreme load.
- As recommended by the manual, leave one descriptor in the transmit ring
with OWN clear to prevent wrap-around.
- Even though the manual claims that driver software must initialize
TXDP if there are no pending transmissions when a new transmission
is to be initialized, doing so causes serious performance degredation
on the DP83820 under heavy load. Not initializing TXDP also increases
performance on the DP83815.

All of this gets us up to ~90Mb/s on both the DP83820 and DP83815 when
connected to a 100base network.
 1.29  18-May-2001  thorpej Add a driver for the National Semiconductor DP83820 Gigabit Ethernet
chip. This is found on the NetGear GA-622 and Asante FriendlyNet
GigaNIX.
 1.28  15-May-2001  thorpej Encapsulate name declarations in macros in preparation for adding
conditionally-compiled code for the DP83820.
 1.27  24-Mar-2001  briggs There is no need to accept all ARP packets (regardless of destination
address) on the DP83815. Noted by Shiva Shenoy <shiva@riverstonenet.com>
in private correspondence.
 1.26  09-Mar-2001  briggs More fixes for the DP83815...
- Set the destination address register properly for "perfect match" mode
in the receive filter setup.
- Do not enable multicast receipt unless we are configured for some multicast.
- Use the "recommended settings" (which set undocumented registers and
documented-as-reserved fields) for the silicon revision 302h (not 203h,
as documented in one of the two places in the manual) because the
documentation is unclear and because those settings fix the card's
behavior in "perfect match" mode. Without those settings, the card
was generating random CRC/invalid symbol errors and generally not
working unless it was set to be promiscuous.

With these changes, this week's version of the Netgear FA311 works for me.
 1.25  09-Mar-2001  briggs Add a variant hook to read the ethernet MAC address from EEPROM differently
for the SiS 900 and the DP83815. Also add some configuration suggested by
the DP83815 documentation for one model of the DP83815.
 1.24  06-Feb-2001  thorpej branches: 1.24.2;
Gack, fix a stupid bug in the DP83815 multicast setup code.
 1.23  28-Dec-2000  sommerfeld Change pci_intr_map to get interrupt source information from a "struct
pci_attach_args *" instead of from four separate parameters which in
all cases were extracted from the same "struct pci_attach_args".

This both simplifies the driver api, and allows for alternate PCI
interrupt mapping schemes, such as one using the tables described in
the Intel Multiprocessor Spec which describe interrupt wirings for
devices behind pci-pci bridges based on the device's location rather
the bridge's location.

Tested on alpha and i386; welcome to 1.5Q
 1.22  19-Dec-2000  thorpej Fix a problem with the ALTQ changes that can cause bogus memory
refernces. Problem reported by Luke Mewburn.
 1.21  14-Dec-2000  thorpej ALTQ'ify.
 1.20  15-Nov-2000  thorpej Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().
 1.19  28-Oct-2000  tsutsui Increase initial Tx drain threshold to 512 bytes.
My macppc complains about transmit FIFO underrun every time.
 1.18  15-Oct-2000  thorpej Don't trim off the FCS, pass it up.
 1.17  11-Oct-2000  thorpej Use ether_ioctl().
 1.16  01-Oct-2000  thorpej Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).
 1.15  20-Sep-2000  thorpej Preliminary support for the National Semiconductor DP83815 10/100
Ethernet chip, which is based on the SiS 900 core, but with differences
in the PHY and filter programming interface, and different WoL and
802.3x flow control programming.

This chip appears on new NetGear FA-312TX cards. Thank goodness
they're finally ditching the LiteOn chips.
 1.14  12-Aug-2000  tsutsui - Check CR_RST rather than ISR_TXRCMP and ISR_RXRCMP in sip_reset()
- Add more delay after reset
- "Big endian mode" on SiS 900 seems broken so don't enable it;
use htole32()/le32toh() instead
- Don't cast u_int16_t array to u_int8_t pointer
- Add some delay() to FILTER_EMIT macro in sip_set_filter()

Now SiS 900 works on my macppc.
 1.13  04-Aug-2000  tsutsui Add one more delay() to sip_read_eeprom().
 1.12  28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.11  12-May-2000  thorpej branches: 1.11.4;
Use ether_crc32_le().
 1.10  23-Mar-2000  mycroft Rather than guessing at the location of the PMCSR, use the pointer returned by
pci_get_capability(). (This is, after all, a standardized interface...)
 1.9  23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.8  06-Mar-2000  thorpej No longer necessary to futz with ifp->if_baudrate here.
 1.7  02-Feb-2000  thorpej Don't dry to diving MIIF_NOISOLATE in the PHY drivers. Instead, pass
flags down from the parent to child vi mii_attach().
 1.6  02-Feb-2000  thorpej Bring some order to the chaos which was the MII code function naming
"conventions".
 1.5  31-Jan-2000  thorpej Add support for the SiS 7016.
 1.4  12-Nov-1999  thorpej Call mii_down() as appropriate.
 1.3  04-Nov-1999  thorpej Adapt to mii_phy_probe() change.
 1.2  03-Aug-1999  thorpej branches: 1.2.2; 1.2.4; 1.2.8;
Be a little nicer about memory usage:
* Don't allocate receive buffers until the interface is actually brought
up, and release all of them if the interface is taken down.
* Add a knob (defaults to off) which will copy an incoming packet to
a single header mbuf if it is small enough to fit in one, rather than
burning an entire cluster on it. Note that this change will be mostly
moot if/when sbcompress() it changed to handle compressing clusters.
 1.1  01-Jun-1999  thorpej branches: 1.1.2;
Device driver for the Silicon Integrated Systems SiS900 10/100 Ethernet
chip, found on the IBM Netstation.
 1.1.2.1  21-Jun-1999  thorpej Sync w/ -current.
 1.2.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.4.1  15-Nov-1999  fvdl Sync with -current
 1.2.2.6  27-Mar-2001  bouyer Sync with HEAD.
 1.2.2.5  12-Mar-2001  bouyer Sync with HEAD.
 1.2.2.4  11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.3  05-Jan-2001  bouyer Sync with HEAD
 1.2.2.2  22-Nov-2000  bouyer Sync with HEAD.
 1.2.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.11.4.9  08-Sep-2003  msaitoh Pull up revision 1.79 via patch (requested by itojun in ticket #69):
Accept 1518-byte frames (needed for vlan). Valtteri Vuorikoski
 1.11.4.8  27-Mar-2002  he Pull up revision 1.49 (via patch, requested by is):
Fix multicast reception on DP83815. Fixes PR#15998.
 1.11.4.7  09-Mar-2002  he Apply patch (requested by bouyer):
Fix an uninitialized pointer in sip_start(), which might eventually
lead to a crash, especially if bpf is used.
 1.11.4.6  27-Oct-2001  he Apply patch (requested by briggs):
Adjust receive and transmit descriptor list structures,
sip_start(), and sip_txintr() to be more similar to the current
development version. Fixes periodic device timeouts.
Tested by briggs with a Netgear FA311TX on i386.
 1.11.4.5  13-Mar-2001  he Pull up revisions 1.25-1.26 (requested by briggs):
Fix support for the DP83815 so that it works properly with the
current crop of Netgear FA311 10/100 cards.
 1.11.4.4  26-Feb-2001  he Pull up revision 1.24 (requested by thorpej):
Fix a bug in the DP83815 multicast setup code.
 1.11.4.3  30-Oct-2000  tv Pullup 1.19 [thorpej/tsutsui]:
Increase initial Tx drain threshold to 512 bytes.
My macppc complains about transmit FIFO underrun every time.
 1.11.4.2  28-Sep-2000  thorpej Sync with trunk: Add support for the DP83815 10/100 Ethernet,
found on new NetGear cards.
 1.11.4.1  12-Aug-2000  tsutsui Pull up rev 1.13 and 1.14 (approved by thorpej):

revision 1.13:
- Add one more delay() to sip_read_eeprom()

revision 1.14:
- Check CR_RST rather than ISR_TXRCMP and ISR_RXRCMP in sip_reset()
- Add more delay after reset
- "Big endian mode" on SiS 900 seems broken so don't enable it;
use htole32()/le32toh() instead
- Don't cast u_int16_t array to u_int8_t pointer
- Add some delay() to FILTER_EMIT macro in sip_set_filter()
 1.24.2.16  17-Jan-2003  thorpej Sync with HEAD.
 1.24.2.15  29-Dec-2002  thorpej Sync with HEAD.
 1.24.2.14  11-Dec-2002  thorpej Sync with HEAD.
 1.24.2.13  11-Nov-2002  nathanw Catch up to -current
 1.24.2.12  18-Oct-2002  nathanw Catch up to -current.
 1.24.2.11  27-Aug-2002  nathanw Catch up to -current.
 1.24.2.10  13-Aug-2002  nathanw Catch up to -current.
 1.24.2.9  01-Aug-2002  nathanw Catch up to -current.
 1.24.2.8  20-Jun-2002  nathanw Catch up to -current.
 1.24.2.7  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.24.2.6  28-Feb-2002  nathanw Catch up to -current.
 1.24.2.5  08-Jan-2002  nathanw Catch up to -current.
 1.24.2.4  14-Nov-2001  nathanw Catch up to -current.
 1.24.2.3  24-Aug-2001  nathanw Catch up with -current.
 1.24.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.24.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.40.2.6  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.40.2.5  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.40.2.4  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.40.2.3  16-Mar-2002  jdolecek Catch up with -current.
 1.40.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.40.2.1  03-Aug-2001  lukem update to -current
 1.52.4.10  02-Oct-2003  tron Pull up revision 1.81 (requested by martin in ticket #1490):
Fix typo (DP83020 -> DP83820) from HITOSHI Osada in PR kern/23023.
 1.52.4.9  15-Aug-2003  tron Pull up revision 1.79 (requested by itojun in ticket #1413):
accept 1518-byte frames (needed for vlan). Valtteri Vuorikoski
 1.52.4.8  15-Jun-2003  tron Pull up revision 1.78 (requested by thorpej in ticket #1228):
Add a work-around for the "short cable problem" that some DP83815
revisions have, as discussed on the soekris-tech mailing list a
while ago, whereby one can experience excessive recieve erros when
using < 30m cables. The patch detects overflow in a DSP filter
parameter, and corrects it by writing a known good value.
 1.52.4.7  21-Nov-2002  he Pull up revision 1.62 (requested by tls in ticket #1007):
Do not treat the ``reset complete'' interrupts as errors.
Doing so causes us to go into a reset/interrupt/reset loop.
 1.52.4.6  01-Nov-2002  tron Pull up revision 1.60 (requested by thorpej in ticket #415):
Add a table of known-64-bit DP83820-based cards. Use this table
to enable 64-bit data transfers on 64-bit cards when plugged into
a 64-bit slot. Right know the Asante GigaNIX is listed in that
table.
Sigh, there is an EEPROM bit that can be used to detect 64-bit vs
32-bit cards. Unfortunately, at least 2 vendors of 32-bit cards
fail to clear the "DATA64_EN" bit in the EEPROM, which causes the
card to lose badly, because it still manages to detect that it's
plugged into a 64-bit PCI slot. Yay, stupid hardware vendors.
 1.52.4.5  01-Nov-2002  tron Pull up revision 1.59 (requested by thorpej in ticket #414):
Load configuration data from the EEPROM on the DP83820 differently: rather
than grovel the EEPROM directly, initiate an "EEPROM load" in the PCI
test register, and fetch the values from the CFG register.
 1.52.4.4  01-Nov-2002  tron Pull up revision 1.58 (requested by thorpej in ticket #413):
Update the TODO list: We have some Tx interrupt mitigation now, so
we need to do Rx interrupt mitigation next.
 1.52.4.3  01-Nov-2002  tron Pull up revision 1.56 (requested by thorpej in ticket #412):
Implement a sliding interrupt delay window for Tx interrupts.
 1.52.4.2  01-Nov-2002  tron Pull up revision 1.55 (requested by thorpej in ticket #411):
* Give symbolic names to the CFG bits in the EEPROM.
* Get CFG_M64ADDR, CFG_T64ADDR, and CFG_DATA64_EN from the EEPROM.
Note, we still disable CFG_M64ADDR and CFG_T64ADDR later (XXX need
PCI bus capability flags for these).
* Print a message if we're in a 64-bit slot and 64-bit data is
disabled in the EEPROM. Make sure CFG_DATA64_EN is disabled if
we're not in a 64-bit slot.
 1.52.4.1  28-May-2002  tv Pull up revision 1.53 (requested by tron in ticket #50):
Set initial transmit drain threshold to 1504 to avoid the problem
described in PR kern/16070. Change approved by Jason Thorpe.
XXX We'll should try to find a better adaptive scheme for the next
NetBSD release.
 1.52.2.4  29-Aug-2002  gehenna catch up with -current.
 1.52.2.3  15-Jul-2002  gehenna catch up with -current.
 1.52.2.2  20-Jun-2002  gehenna catch up with -current.
 1.52.2.1  30-May-2002  gehenna Catch up with -current.
 1.78.2.10  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.78.2.9  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.78.2.8  06-Feb-2005  skrll Sync with HEAD.
 1.78.2.7  06-Feb-2005  skrll Sync with HEAD.
 1.78.2.6  04-Feb-2005  skrll Sync with HEAD.
 1.78.2.5  02-Nov-2004  skrll Sync with HEAD.
 1.78.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.78.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.78.2.2  25-Aug-2004  skrll Sync with HEAD.
 1.78.2.1  03-Aug-2004  skrll Sync with HEAD
 1.87.2.1  28-May-2004  tron branches: 1.87.2.1.2;
Pull up revision 1.91 (requested by fair in ticket #296):
Two changes:
1. ifdef out the restriction that the SiS 900 has only one PHY
This is demonstrably false; the SiS 960 super south bridge in
PR 18590 has a SiS 900 rev 1 core in it.
2. bitbang the MII for all versions of the SiS 900; this is the
only way that the PHYs on this system answer.
Also, I suspect that SIS900_REV_960 constant in if_sipreg.h is
incorrectly labelled - there were later revisions of the super
south bridge (e.g. the 961, 962, and 963), and I suspect the
SiS 900 revision code there refers to one of those.
 1.87.2.1.2.1  24-Jan-2005  he Pull up revision 1.96 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.96.6.2  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.96.6.1  12-Feb-2005  yamt sync with head.
 1.96.4.1  29-Apr-2005  kent sync with -current
 1.101.2.3  21-Apr-2006  tron Pull up following revision(s) (requested by pavel in ticket #1280):
sys/dev/pci/if_sip.c: revision 1.106
In rev. 1.98, the ioctl method of the (g)sip drivers was optimized for
SIOCSIFFLAGS: it compares the new flags with the old flags and avoids
reset if there are only certain changes. This was done to fix PR 29126.
It does not take into account, though, that there is other state which
can change and SIOCSIFFLAGS is called to inform about it. Namely,
if_capenable, ec_capenable and ec_nvlans. For all three, the _init
method must program the hardware specially. Not doing it resulted in:
- VLAN frames getting truncated
- hw checksumming not working
- outgoing VLAN frames not being tagged when they should
- incoming VLAN frames being treated as untagged.
Fix by keeping all the old state in the softc and initializing the
hardware if any of it changes.
Tested on gsip. Also tested by Nino Dehne and Martin J. Laubach
on sip, thanks.
Fixes PRs 32900 and 33216.
Approved by martin@ .
 1.101.2.2  21-Apr-2006  tron Pull up following revision(s) (requested by pavel in ticket #1279):
sys/dev/pci/if_sip.c: revision 1.107
VLAN tags were sent byte-swapped by the gsip driver, because the driver
forgets to convert them from the host to the network byte order. Use
bswap16 to convert them. (Not htons, because on a big-endian machine, they
are in the correct byte order initially, but then, they are byte-swapped
by a htole32 call when written to the transmit descriptor. So
byte-swapping is needed in this case too, to compensate for this htole32
call.)
For a similar reason, tags were seen byte-swapped when received on a
big-endian machine. Replace ntohs by bswap16 in the input path too.
(Again, it is needed to compensate for a le32toh call when the receive
descriptor is read.)
Fixes PR 32644.
Tested on 3.0/i386, 3.0/sgimips and current/alpha.
OK by martin@.
 1.101.2.1  08-Feb-2006  tron Pull up following revision(s) (requested by thorpej in ticket #1161):
sys/dev/pci/if_wm.c: revision 1.111
sys/dev/pci/if_sip.c: revision 1.104
In the receive interrupt handler, compute the packet length before
resetting
m to point to the first buffer in the packet. The bug would cause the
length of jumbo frames to be incorrect.
 1.102.2.8  24-Mar-2008  yamt sync with head.
 1.102.2.7  17-Mar-2008  yamt sync with head.
 1.102.2.6  11-Feb-2008  yamt sync with head.
 1.102.2.5  21-Jan-2008  yamt sync with head
 1.102.2.4  27-Oct-2007  yamt sync with head.
 1.102.2.3  03-Sep-2007  yamt sync with head.
 1.102.2.2  30-Dec-2006  yamt sync with head.
 1.102.2.1  21-Jun-2006  yamt sync with head.
 1.103.6.1  22-Apr-2006  simonb Sync with head.
 1.103.4.1  09-Sep-2006  rpaulo sync with head
 1.103.2.1  18-Feb-2006  yamt sync with head.
 1.104.6.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.104.6.1  28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.104.4.1  19-Apr-2006  elad sync with head.
 1.104.2.4  26-Jun-2006  yamt sync with head.
 1.104.2.3  24-May-2006  yamt sync with head.
 1.104.2.2  11-Apr-2006  yamt sync with head
 1.104.2.1  01-Apr-2006  yamt sync with head.
 1.107.4.1  13-Jul-2006  gdamore Merge from HEAD.
 1.107.2.1  19-Jun-2006  chap Sync with head.
 1.108.6.2  10-Dec-2006  yamt sync with head.
 1.108.6.1  22-Oct-2006  yamt sync with head
 1.108.4.1  18-Nov-2006  ad Sync with head.
 1.110.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.112.4.1  11-Jul-2007  mjf Sync with head.
 1.112.2.3  23-Oct-2007  ad Sync with head.
 1.112.2.2  09-Oct-2007  ad Sync with head.
 1.112.2.1  01-Jul-2007  ad Adapt to callout API change.
 1.113.8.3  23-Mar-2008  matt sync with HEAD
 1.113.8.2  09-Jan-2008  matt sync with HEAD
 1.113.8.1  06-Nov-2007  matt sync with HEAD
 1.113.6.2  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.113.6.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.113.2.1  03-Sep-2007  skrll Sync with HEAD.
 1.114.4.1  25-Oct-2007  bouyer Sync with HEAD.
 1.115.8.3  20-Jan-2008  bouyer Sync with HEAD
 1.115.8.2  10-Jan-2008  bouyer Sync with HEAD
 1.115.8.1  02-Jan-2008  bouyer Sync with HEAD
 1.115.4.1  26-Dec-2007  ad Sync with head.
 1.115.2.1  18-Feb-2008  mjf Sync with HEAD.
 1.127.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.127.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.127.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.127.2.1  24-Mar-2008  keiichi sync with head.
 1.132.4.6  11-Aug-2010  yamt sync with head.
 1.132.4.5  11-Mar-2010  yamt sync with head
 1.132.4.4  16-Sep-2009  yamt sync with head
 1.132.4.3  16-May-2009  yamt sync with head
 1.132.4.2  04-May-2009  yamt sync with head.
 1.132.4.1  16-May-2008  yamt sync with head.
 1.132.2.1  18-May-2008  yamt sync with head.
 1.134.8.2  28-Apr-2009  skrll Sync with HEAD.
 1.134.8.1  19-Jan-2009  skrll Sync with HEAD.
 1.134.6.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.135.4.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.145.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.147.2.2  05-Mar-2011  rmind sync with head
 1.147.2.1  30-May-2010  rmind sync with head
 1.150.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.150.2.2  30-Oct-2012  yamt sync with head
 1.150.2.1  17-Apr-2012  yamt sync with head
 1.151.2.1  18-Feb-2012  mrg merge to -current.
 1.153.2.1  22-Nov-2012  riz Pull up following revision(s) (requested by chs in ticket #691):
sys/dev/pci/aac_pci.c: revision 1.34
sys/dev/pci/if_sip.c: revision 1.155
sys/dev/pci/if_tlp_pci.c: revision 1.122
sys/dev/pci/if_an_pci.c: revision 1.34
match some more devices.
 1.154.2.4  03-Dec-2017  jdolecek update from HEAD
 1.154.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.154.2.2  23-Jun-2013  tls resync from head
 1.154.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.156.4.1  18-May-2014  rmind sync with head
 1.157.2.1  07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.158.4.6  28-Aug-2017  skrll Sync with HEAD
 1.158.4.5  05-Feb-2017  skrll Sync with HEAD
 1.158.4.4  05-Oct-2016  skrll Sync with HEAD
 1.158.4.3  09-Jul-2016  skrll Sync with HEAD
 1.158.4.2  19-Mar-2016  skrll Sync with HEAD
 1.158.4.1  06-Jun-2015  skrll Sync with HEAD
 1.163.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.165.6.1  11-May-2017  pgoyette Sync with HEAD
 1.166.2.1  24-Oct-2017  snj Pull up following revision(s) (requested by knakahara in ticket #302):
sys/arch/powerpc/booke/dev/pq3etsec.c: 1.30-1.31
sys/arch/x86/pci/if_vmx.c: 1.20
sys/dev/ic/i82557.c: 1.148
sys/dev/ic/rtl8169.c: 1.152
sys/dev/pci/cxgb/cxgb_sge.c: 1.5
sys/dev/pci/if_age.c: 1.51
sys/dev/pci/if_alc.c: 1.25
sys/dev/pci/if_ale.c: 1.23
sys/dev/pci/if_bge.c: 1.311
sys/dev/pci/if_bge.c: 1.312
sys/dev/pci/if_bnx.c: 1.62
sys/dev/pci/if_jme.c: 1.32
sys/dev/pci/if_nfe.c: 1.64
sys/dev/pci/if_sip.c: 1.167
sys/dev/pci/if_stge.c: 1.63-1.64
sys/dev/pci/if_ti.c: 1.102
sys/dev/pci/if_txp.c: 1.48
sys/dev/pci/if_vge.c: 1.61
sys/dev/pci/if_wm.c: 1.538
sys/dev/pci/ixgbe/ix_txrx.c: 1.29 via patch
sys/net/agr/if_agrether_hash.c: 1.4
sys/net/if_ether.h: 1.67-1.68
sys/net/if_ethersubr.c: 1.244
sys/net/if_vlan.c: 1.100
sys/net80211/ieee80211_input.c: 1.89
sys/net80211/ieee80211_output.c: 1.59
sys/sys/mbuf.h: 1.171
VLAN ID uses pkthdr instead of mtag now. Contributed by s-yamaguchi@IIJ.
I just commit by proxy. Reviewed by joerg@n.o and christos@n.o, thanks.
See http://mail-index.netbsd.org/tech-net/2017/09/26/msg006459.html
--
only get vtag when we have vtag like the other drivers.
--
- only get the vtag if we have it like the other drivers
- mask the hardware vlan tag
--
- add a constant for the vlan mask.
- enforce that we have a tag before we get it.
only get vtag when we have vtag like the other drivers.
like if_bge.c:1.312 and if_stge.c:1.64.
fixed by s-yamaguchi@IIJ, thanks.
 1.167.2.2  26-Jan-2019  pgoyette Sync with HEAD
 1.167.2.1  28-Jul-2018  pgoyette Sync with HEAD
 1.168.2.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.168.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.168.2.1  10-Jun-2019  christos Sync with HEAD
 1.175.2.1  29-Feb-2020  ad Sync with head.

RSS XML Feed