Home | History | Annotate | Download | only in nubus
History log of /src/sys/arch/mac68k/nubus/if_netdock_nubus.c
RevisionDateAuthorComments
 1.35  18-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.34  04-Feb-2020  skrll Trailing whitespace
 1.33  04-Feb-2020  skrll Adopt <net/if_stats.h>
 1.32  29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.31  21-Oct-2019  msaitoh branches: 1.31.2;
if_percpuq(9) automatically increments if_ipackets, so don't increment it in
the driver itself to prevent double count.
 1.30  13-Sep-2019  msaitoh if_flags is neither int nor short. It's unsigned short.
 1.29  05-Feb-2019  msaitoh branches: 1.29.4;
Remove very old IFF_NOTRAILERS flag.
 1.28  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.27  26-Jun-2018  msaitoh branches: 1.27.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.26  29-Jul-2017  riastradh branches: 1.26.2;
Avoid memory leak in netdock_get.

If top is null, this is the first time through and nothing else will
free m.

From Ilja Van Sprundel.
 1.25  15-Dec-2016  ozaki-r branches: 1.25.8;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

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

Proposed on tech-kern and tech-net
 1.24  10-Jun-2016  ozaki-r branches: 1.24.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.
 1.23  09-Feb-2016  ozaki-r Introduce softint-based if_input

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

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

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

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

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.22  27-Oct-2012  chs branches: 1.22.12; 1.22.14; 1.22.16; 1.22.20;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.21  05-Apr-2010  joerg branches: 1.21.8; 1.21.14; 1.21.18; 1.21.20; 1.21.22;
Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.20  19-Jan-2010  pooka branches: 1.20.2; 1.20.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.
 1.19  07-Nov-2008  dyoung *** Summary ***

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

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

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

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

Return consistent, appropriate error codes from network drivers.

Improve readability. KNF.

*** Details ***

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Let ifioctl_common() handle SIOCGIFADDR.

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

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

bzero -> memset. Delete unnecessary casts to void *. Use
sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with
NULL instead of "testing truth". Replace some instances of (type
*)0 with NULL. Change some K&R prototypes to ANSI C, and join
lines.
 1.18  04-Apr-2008  hauke branches: 1.18.4; 1.18.10; 1.18.12;
Go all the way, and use the new accessor function for the device_xname field.
 1.17  02-Apr-2008  hauke Fall-out from splitting device_t and softc for the dp8390 softc.
 1.16  17-Oct-2007  garbled branches: 1.16.16;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.15  01-Sep-2007  jmmv Fix build after dyoung's changes.
 1.14  01-Sep-2007  dyoung Change a bazillion occurrences of code resembling this,

error = (cmd == SIOCADDMULTI) ?
ether_addmulti(ifr, &sc->sc_ec) :
ether_delmulti(ifr, &sc->sc_ec);

if (error == ENETRESET) {

to this,

if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {

which does the same thing.

(A bazillion is a very large number. This seems to make the i386
ALL kernel smaller by 3kB to 4kB.)

Use ifreq_getaddr() twice in es(4).

Whitespace nits.
 1.13  05-Mar-2007  he branches: 1.13.2; 1.13.10; 1.13.14; 1.13.18; 1.13.20;
Use a char* for pointer arithmetic.
 1.12  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11  24-Dec-2005  perry branches: 1.11.26;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.10  24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.9  11-Dec-2005  christos merge ktrace-lwp.
 1.8  03-Jun-2005  rjs branches: 1.8.2;
Add const.
 1.7  30-Jan-2005  thorpej Eliminate use of M_HASFCS.
 1.6  15-Jan-2005  chs branches: 1.6.2; 1.6.4;
de-__P, remove register, ansify, b* -> mem*.
 1.5  30-Oct-2004  thorpej When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.4  15-Jul-2003  lukem branches: 1.4.4;
__KERNEL_RCSID()
 1.3  02-Oct-2002  thorpej branches: 1.3.6;
Use CFATTACH_DECL().
 1.2  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1  19-Jun-2002  itojun branches: 1.1.2; 1.1.4; 1.1.6;
netdock* - ethernet driver for Asante NetDock/Newer Ether MicroDock.
by Daishi Kato <daishi@axlight.com>
test/stabilization by Takeo Kuwata <tkuwata@virus.kyoto-u.ac.jp>
 1.1.6.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.6.2  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1  19-Jun-2002  jdolecek file if_netdock_nubus.c was added on branch kqueue on 2002-09-06 08:36:58 +0000
 1.1.4.3  18-Oct-2002  nathanw Catch up to -current.
 1.1.4.2  01-Aug-2002  nathanw Catch up to -current.
 1.1.4.1  19-Jun-2002  nathanw file if_netdock_nubus.c was added on branch nathanw_sa on 2002-08-01 02:42:22 +0000
 1.1.2.2  16-Jul-2002  gehenna catch up with -current.
 1.1.2.1  19-Jun-2002  gehenna file if_netdock_nubus.c was added on branch gehenna-devsw on 2002-07-16 08:40:11 +0000
 1.3.6.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.6.6  04-Feb-2005  skrll Sync with HEAD.
 1.3.6.5  17-Jan-2005  skrll Sync with HEAD.
 1.3.6.4  02-Nov-2004  skrll Sync with HEAD.
 1.3.6.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.6.2  18-Sep-2004  skrll Sync with HEAD.
 1.3.6.1  03-Aug-2004  skrll Sync with HEAD
 1.4.4.1  24-Jan-2005  he Pull up revision 1.5 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.6.4.1  12-Feb-2005  yamt sync with head.
 1.6.2.1  29-Apr-2005  kent sync with -current
 1.8.2.2  03-Sep-2007  yamt sync with head.
 1.8.2.1  21-Jun-2006  yamt sync with head.
 1.11.26.1  12-Mar-2007  rmind Sync with HEAD.
 1.13.20.1  06-Nov-2007  matt sync with HEAD
 1.13.18.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.13.14.1  03-Sep-2007  skrll Sync with HEAD.
 1.13.10.1  03-Oct-2007  garbled Sync with HEAD
 1.13.2.1  09-Oct-2007  ad Sync with head.
 1.16.16.3  17-Jan-2009  mjf Sync with HEAD.
 1.16.16.2  02-Jun-2008  mjf Sync with HEAD.
 1.16.16.1  03-Apr-2008  mjf Sync with HEAD.
 1.18.12.1  19-Jan-2009  skrll Sync with HEAD.
 1.18.10.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.18.4.3  11-Aug-2010  yamt sync with head.
 1.18.4.2  11-Mar-2010  yamt sync with head
 1.18.4.1  04-May-2009  yamt sync with head.
 1.20.4.1  30-May-2010  rmind sync with head
 1.20.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.21.22.1  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1472):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.21.20.1  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1472):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.21.18.2  03-Dec-2017  jdolecek update from HEAD
 1.21.18.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.21.14.1  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1472):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.21.8.1  30-Oct-2012  yamt sync with head
 1.22.20.1  11-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1468):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.22.16.1  11-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1468):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.22.14.4  28-Aug-2017  skrll Sync with HEAD
 1.22.14.3  05-Feb-2017  skrll Sync with HEAD
 1.22.14.2  09-Jul-2016  skrll Sync with HEAD
 1.22.14.1  19-Mar-2016  skrll Sync with HEAD
 1.22.12.1  11-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1468):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.24.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.25.8.2  24-Oct-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1416):

sys/dev/ic/i82586.c: revision 1.86
sys/arch/arm/ep93xx/epe.c: revision 1.45
sys/dev/pcmcia/if_cnw.c: revision 1.66
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.31
sys/dev/qbus/if_il.c: revision 1.36
sys/dev/pcmcia/if_ray.c: revision 1.95
sys/dev/qbus/if_qt.c: revision 1.24

if_percpuq(9) automatically increments if_ipackets, so don't increment it in
the driver itself to prevent double count.
 1.25.8.1  05-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #181):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.26.2.2  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.26.2.1  28-Jul-2018  pgoyette Sync with HEAD
 1.27.2.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.27.2.1  10-Jun-2019  christos Sync with HEAD
 1.29.4.1  23-Oct-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #371):

sys/dev/ic/i82586.c: revision 1.86
sys/arch/arm/ep93xx/epe.c: revision 1.45
sys/dev/pcmcia/if_cnw.c: revision 1.66
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.31
sys/arch/arm/sunxi/sunxi_can.c: revision 1.2
sys/dev/qbus/if_il.c: revision 1.36
sys/dev/pcmcia/if_ray.c: revision 1.95
sys/dev/qbus/if_qt.c: revision 1.24

if_ipackets is incremented in can_input(), so don't increment it in
sunxi_can_rx_intr to prevent double count. OK'd by bouyer@.

if_percpuq(9) automatically increments if_ipackets, so don't increment it in
the driver itself to prevent double count.
 1.31.2.1  29-Feb-2020  ad Sync with head.

RSS XML Feed