History log of /netbsd-current/sys/dev/ic/dp83932.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: perseant-exfatfs-base
# 1.50 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


Revision tags: netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base
# 1.49 25-Sep-2022 thorpej

Remove unnecessary include of <sys/malloc.h>.


# 1.48 25-Jun-2022 tsutsui

Pass proper status values to rnd_add_uint32(9) as rnd(9) man page claims.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.47 20-Feb-2021 rin

sn(4): Add rnd(9) support.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.46 15-Mar-2020 thorpej

branches: 1.46.4;
Don't bother with IFF_OACTIVE.


Revision tags: is-mlppp-base ad-namecache-base3
# 1.45 29-Jan-2020 thorpej

Adopt <net/if_stats.h>.


Revision tags: netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.44 28-May-2019 msaitoh

branches: 1.44.4;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.


# 1.43 23-May-2019 msaitoh

-No functional change:
- KNF
- u_int*_t -> uint*_t.


Revision tags: isaki-audio2-base 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 phil-wifi-base
# 1.42 26-Jun-2018 msaitoh

branches: 1.42.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.


Revision tags: pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.41 29-Jul-2017 riastradh

branches: 1.41.2;
Plug mbuf leak on MCLGET failure in sonic_rxintr.

From Ilja Van Sprundel.


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.40 23-May-2017 ozaki-r

branches: 1.40.2;
Apply deferred if_start to more drivers

And annotate some XXX_start as it runs in softint to clarify that
it doesn't need deferred if_start.


Revision tags: 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 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 10-Jun-2016 ozaki-r

branches: 1.38.2;
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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.4; 1.36.6; 1.36.8; 1.36.12;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.14; 1.35.18; 1.35.20; 1.35.22; 1.35.28;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).


# 1.49 25-Sep-2022 thorpej

Remove unnecessary include of <sys/malloc.h>.


# 1.48 25-Jun-2022 tsutsui

Pass proper status values to rnd_add_uint32(9) as rnd(9) man page claims.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.47 20-Feb-2021 rin

sn(4): Add rnd(9) support.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.46 15-Mar-2020 thorpej

branches: 1.46.4;
Don't bother with IFF_OACTIVE.


Revision tags: is-mlppp-base ad-namecache-base3
# 1.45 29-Jan-2020 thorpej

Adopt <net/if_stats.h>.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.44 28-May-2019 msaitoh

branches: 1.44.4;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.


# 1.43 23-May-2019 msaitoh

-No functional change:
- KNF
- u_int*_t -> uint*_t.


Revision tags: isaki-audio2-base 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 phil-wifi-base
# 1.42 26-Jun-2018 msaitoh

branches: 1.42.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.


Revision tags: pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.41 29-Jul-2017 riastradh

branches: 1.41.2;
Plug mbuf leak on MCLGET failure in sonic_rxintr.

From Ilja Van Sprundel.


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.40 23-May-2017 ozaki-r

branches: 1.40.2;
Apply deferred if_start to more drivers

And annotate some XXX_start as it runs in softint to clarify that
it doesn't need deferred if_start.


Revision tags: 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 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 10-Jun-2016 ozaki-r

branches: 1.38.2;
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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.4; 1.36.6; 1.36.8; 1.36.12;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.14; 1.35.18; 1.35.20; 1.35.22; 1.35.28;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).


# 1.48 25-Jun-2022 tsutsui

Pass proper status values to rnd_add_uint32(9) as rnd(9) man page claims.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.47 20-Feb-2021 rin

sn(4): Add rnd(9) support.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.46 15-Mar-2020 thorpej

branches: 1.46.4;
Don't bother with IFF_OACTIVE.


Revision tags: is-mlppp-base ad-namecache-base3
# 1.45 29-Jan-2020 thorpej

Adopt <net/if_stats.h>.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.44 28-May-2019 msaitoh

branches: 1.44.4;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.


# 1.43 23-May-2019 msaitoh

-No functional change:
- KNF
- u_int*_t -> uint*_t.


Revision tags: isaki-audio2-base 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 phil-wifi-base
# 1.42 26-Jun-2018 msaitoh

branches: 1.42.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.


Revision tags: pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.41 29-Jul-2017 riastradh

branches: 1.41.2;
Plug mbuf leak on MCLGET failure in sonic_rxintr.

From Ilja Van Sprundel.


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.40 23-May-2017 ozaki-r

branches: 1.40.2;
Apply deferred if_start to more drivers

And annotate some XXX_start as it runs in softint to clarify that
it doesn't need deferred if_start.


Revision tags: 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 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 10-Jun-2016 ozaki-r

branches: 1.38.2;
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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.4; 1.36.6; 1.36.8; 1.36.12;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.14; 1.35.18; 1.35.20; 1.35.22; 1.35.28;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).


# 1.47 20-Feb-2021 rin

sn(4): Add rnd(9) support.


Revision tags: thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.46 15-Mar-2020 thorpej

Don't bother with IFF_OACTIVE.


Revision tags: is-mlppp-base ad-namecache-base3
# 1.45 29-Jan-2020 thorpej

Adopt <net/if_stats.h>.


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.44 28-May-2019 msaitoh

branches: 1.44.4;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.


# 1.43 23-May-2019 msaitoh

-No functional change:
- KNF
- u_int*_t -> uint*_t.


Revision tags: isaki-audio2-base 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 phil-wifi-base
# 1.42 26-Jun-2018 msaitoh

branches: 1.42.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.


Revision tags: pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.41 29-Jul-2017 riastradh

branches: 1.41.2;
Plug mbuf leak on MCLGET failure in sonic_rxintr.

From Ilja Van Sprundel.


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.40 23-May-2017 ozaki-r

branches: 1.40.2;
Apply deferred if_start to more drivers

And annotate some XXX_start as it runs in softint to clarify that
it doesn't need deferred if_start.


Revision tags: 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 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 10-Jun-2016 ozaki-r

branches: 1.38.2;
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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.4; 1.36.6; 1.36.8; 1.36.12;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.14; 1.35.18; 1.35.20; 1.35.22; 1.35.28;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).


# 1.46 15-Mar-2020 thorpej

Don't bother with IFF_OACTIVE.


Revision tags: ad-namecache-base3
# 1.45 29-Jan-2020 thorpej

Adopt <net/if_stats.h>.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.44 28-May-2019 msaitoh

branches: 1.44.4;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.


# 1.43 23-May-2019 msaitoh

-No functional change:
- KNF
- u_int*_t -> uint*_t.


Revision tags: isaki-audio2-base 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 phil-wifi-base
# 1.42 26-Jun-2018 msaitoh

branches: 1.42.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.


Revision tags: pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.41 29-Jul-2017 riastradh

branches: 1.41.2;
Plug mbuf leak on MCLGET failure in sonic_rxintr.

From Ilja Van Sprundel.


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.40 23-May-2017 ozaki-r

branches: 1.40.2;
Apply deferred if_start to more drivers

And annotate some XXX_start as it runs in softint to clarify that
it doesn't need deferred if_start.


Revision tags: 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 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 10-Jun-2016 ozaki-r

branches: 1.38.2;
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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.4; 1.36.6; 1.36.8; 1.36.12;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.14; 1.35.18; 1.35.20; 1.35.22; 1.35.28;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).


# 1.45 29-Jan-2020 thorpej

Adopt <net/if_stats.h>.


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.44 28-May-2019 msaitoh

Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.


# 1.43 23-May-2019 msaitoh

-No functional change:
- KNF
- u_int*_t -> uint*_t.


Revision tags: isaki-audio2-base 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 phil-wifi-base
# 1.42 26-Jun-2018 msaitoh

branches: 1.42.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.


Revision tags: pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.41 29-Jul-2017 riastradh

branches: 1.41.2;
Plug mbuf leak on MCLGET failure in sonic_rxintr.

From Ilja Van Sprundel.


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.40 23-May-2017 ozaki-r

branches: 1.40.2;
Apply deferred if_start to more drivers

And annotate some XXX_start as it runs in softint to clarify that
it doesn't need deferred if_start.


Revision tags: 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 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 10-Jun-2016 ozaki-r

branches: 1.38.2;
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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.4; 1.36.6; 1.36.8; 1.36.12;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.14; 1.35.18; 1.35.20; 1.35.22; 1.35.28;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).


# 1.44 28-May-2019 msaitoh

Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.


# 1.43 23-May-2019 msaitoh

-No functional change:
- KNF
- u_int*_t -> uint*_t.


Revision tags: isaki-audio2-base 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 phil-wifi-base
# 1.42 26-Jun-2018 msaitoh

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.


Revision tags: pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.41 29-Jul-2017 riastradh

branches: 1.41.2;
Plug mbuf leak on MCLGET failure in sonic_rxintr.

From Ilja Van Sprundel.


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.40 23-May-2017 ozaki-r

branches: 1.40.2;
Apply deferred if_start to more drivers

And annotate some XXX_start as it runs in softint to clarify that
it doesn't need deferred if_start.


Revision tags: 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 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 10-Jun-2016 ozaki-r

branches: 1.38.2;
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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.4; 1.36.6; 1.36.8; 1.36.12;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.14; 1.35.18; 1.35.20; 1.35.22; 1.35.28;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).


# 1.43 23-May-2019 msaitoh

-No functional change:
- KNF
- u_int*_t -> uint*_t.


Revision tags: isaki-audio2-base 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 phil-wifi-base
# 1.42 26-Jun-2018 msaitoh

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.


Revision tags: pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.41 29-Jul-2017 riastradh

branches: 1.41.2;
Plug mbuf leak on MCLGET failure in sonic_rxintr.

From Ilja Van Sprundel.


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.40 23-May-2017 ozaki-r

branches: 1.40.2;
Apply deferred if_start to more drivers

And annotate some XXX_start as it runs in softint to clarify that
it doesn't need deferred if_start.


Revision tags: 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 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 10-Jun-2016 ozaki-r

branches: 1.38.2;
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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.4; 1.36.6; 1.36.8; 1.36.12;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.14; 1.35.18; 1.35.20; 1.35.22; 1.35.28;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).


Revision tags: isaki-audio2-base 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 phil-wifi-base
# 1.42 26-Jun-2018 msaitoh

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.


Revision tags: pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.41 29-Jul-2017 riastradh

branches: 1.41.2;
Plug mbuf leak on MCLGET failure in sonic_rxintr.

From Ilja Van Sprundel.


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.40 23-May-2017 ozaki-r

branches: 1.40.2;
Apply deferred if_start to more drivers

And annotate some XXX_start as it runs in softint to clarify that
it doesn't need deferred if_start.


Revision tags: 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 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 10-Jun-2016 ozaki-r

branches: 1.38.2;
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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.4; 1.36.6; 1.36.8; 1.36.12;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.14; 1.35.18; 1.35.20; 1.35.22; 1.35.28;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).


# 1.41 29-Jul-2017 riastradh

Plug mbuf leak on MCLGET failure in sonic_rxintr.

From Ilja Van Sprundel.


Revision tags: perseant-stdc-iso10646-base netbsd-8-base
# 1.40 23-May-2017 ozaki-r

Apply deferred if_start to more drivers

And annotate some XXX_start as it runs in softint to clarify that
it doesn't need deferred if_start.


Revision tags: 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 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 10-Jun-2016 ozaki-r

branches: 1.38.2;
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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.6;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.18; 1.35.22;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).


# 1.40 23-May-2017 ozaki-r

Apply deferred if_start to more drivers

And annotate some XXX_start as it runs in softint to clarify that
it doesn't need deferred if_start.


Revision tags: 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 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 10-Jun-2016 ozaki-r

branches: 1.38.2;
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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.6;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.18; 1.35.22;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).


# 1.39 15-Dec-2016 ozaki-r

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


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.38 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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.37 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!


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE 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-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.36 25-Oct-2013 martin

branches: 1.36.6;
Remove unused stuff


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-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 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 rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.35 13-Nov-2010 uebayasi

branches: 1.35.8; 1.35.18; 1.35.22;
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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.34 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.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.33 19-Jan-2010 pooka

branches: 1.33.2; 1.33.4;
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.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.32 02-Sep-2009 tsutsui

Use a proper local variable.


# 1.31 02-Sep-2009 tsutsui

Make local functions static.


# 1.30 02-Sep-2009 tsutsui

Invert logic around nested pmf(9) registrations for readability.


# 1.29 01-Sep-2009 tsutsui

Also call pmf_class_network_register(9).


# 1.28 01-Sep-2009 tsutsui

Replace shutdownhook_establish(9) with pmf_device_register1(9).


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 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 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 jym-xensuspend-base 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 mjf-devfs2-base
# 1.27 23-Aug-2008 tsutsui

Fix typo in comment.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.26 28-Apr-2008 martin

branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.25 23-Apr-2008 tsutsui

branches: 1.25.2;
Split softc/device_t and misc cleanup for sn(4).


# 1.24 19-Apr-2008 tsutsui

The DP83932C manual says the CAM enable register (CER) can't be
accessed on normal operations and the CER should be set up
through the last entry in the CAM desciptor area and loaded
via LCAM command, so make our driver do so, though the previoius
code (writing CER directly) worked without problems.

Tested on sn at jazzio on arc (in 32bit mode) by me and
sn at nubus on mac68k (in 16bit mode) by Paul Ripke on port-mac68k.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.23 08-Apr-2008 cegger

branches: 1.23.2;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.22 14-Mar-2008 tsutsui

Enable ETHERCAP_VLAN_MTU.


# 1.21 12-Mar-2008 dyoung

sonic_stop: clear IFF_RUNNING before disabling.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base hpcarm-cleanup-base
# 1.20 19-Jan-2008 dyoung

branches: 1.20.2; 1.20.6;
There is really no use for switch when there is no case labels
except for the default, so remove the enclosing switch and the
default label.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.19 19-Oct-2007 ad

branches: 1.19.2; 1.19.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.18 26-Aug-2007 dyoung

branches: 1.18.2; 1.18.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.17 08-Jun-2007 tsutsui

branches: 1.17.2; 1.17.6;
Set DCR_TFT[01] and DCR_RFT[01] bits of DCR register for TX/RX thresholds
in each MD attachment since optimized values could be machine dependent.


# 1.16 02-Jun-2007 tsutsui

In sonic_reset(), make sure to stop TX, RX and timer
and clear and disable all interrupts.
Required by mac68k obio sonic cards, and
no bad side effect on arc jazzio sonic.


# 1.15 02-Jun-2007 tsutsui

Sync tda_status and rda_status DMA descriptors also after they are polled
in interrupt handlers for systems which don't have BUS_DMA_COHERENT support.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.14 04-Mar-2007 christos

branches: 1.14.2; 1.14.4;
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
# 1.13 11-Dec-2005 christos

branches: 1.13.26;
merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.12 27-Feb-2005 perry

branches: 1.12.4;
nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.11 31-Jan-2005 thorpej

Eliminate use of M_HASFCS.


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.10 30-Oct-2004 thorpej

branches: 1.10.4; 1.10.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.9 29-Oct-2003 tsutsui

branches: 1.9.4;
Fix bogus GCC uninitialized variable warning.


# 1.8 18-Jan-2003 tsutsui

branches: 1.8.2;
When the extra pad buffer is used, the number of TX segments
should be incremented than dm_nsegs.


# 1.7 18-Jan-2003 tsutsui

Fix pasto and typos.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.6 15-Jan-2003 bouyer

Use a properly zero'd buffer to pad the packet to ETHER_MIN_LEN-ETHER_CRC_LEN


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.5 13-Nov-2001 lukem

branches: 1.5.10;
add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.4 23-Jul-2001 tsutsui

branches: 1.4.2;
Make sure to initialize the all Rx descriptors properly in sonic_init()
even if mbuf for them are already allocated.
This fixes "receive descriptor exhausted" errors.


# 1.3 19-Jul-2001 thorpej

Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.


# 1.2 05-Jul-2001 thorpej

branches: 1.2.2;
Do a little manual CSE, taking unneeded comparisons out of loops,
and shrinking the object code somewhat. On an R4400:

Before:
text data bss dec hex filename
16248 16 0 16264 3f88 dp83932.o

Before:
text data bss dec hex filename
14424 16 0 14440 3868 dp83932.o


# 1.1 05-Jul-2001 thorpej

A new DP83932 ``SONIC'' driver, which uses bus_dma(9) and does I/O
directly to mbufs. Handles both 32-bit and 16-bit, big- and little-
endian configurations of the chip (we could squeeze out some conditionals
yet, though).