Home | History | Annotate | Download | only in ic
History log of /src/sys/dev/ic/hd64570.c
RevisionDateAuthorComments
 1.62  14-Sep-2024  andvar s/intterupt/interrupt/ in comments.
 1.61  14-Sep-2024  andvar s/intrerrupt/interrupt/ in documentation and comments.
gpioirq(4) typo was accidentally restored in the last commit.
 1.60  05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

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

Compile-tested on amd64/ALL.

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

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

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

PR kern/58377
 1.58  10-Feb-2024  andvar s/indicies/indices/ in comments.
 1.57  03-Sep-2022  thorpej branches: 1.57.8;
Garbage-collect the remaining vestiges of netisr.
 1.56  17-Aug-2021  andvar fix multiplei repetitive typos in comments, messages and documentation. mainly because copy paste code big amount of files are affected.
 1.55  29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.54  26-Jun-2018  msaitoh branches: 1.54.2; 1.54.10;
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.53  20-Feb-2017  ozaki-r branches: 1.53.12;
Apply deferred if_start to more drivers
 1.52  24-Jan-2017  ozaki-r Defer bpf_mtap in Rx interrupt context to softint

bpf_mtap of some drivers is still called in hardware interrupt context.
We want to run them in softint as well as bpf_mtap of most drivers
(see if_percpuq_softint and if_input).

To this end, bpf_mtap_softint mechanism is implemented; it defers
bpf_mtap processing to a dedicated softint for a target driver.
By using the machanism, we can move bpf_mtap processing to softint
without changing target drivers much while it adds some overhead
on CPU and memory. Once target drivers are changed to softint-based,
we should return to normal bpf_mtap.

Proposed on tech-kern and tech-net
 1.51  15-Dec-2016  ozaki-r branches: 1.51.2;
Annotate bpf_mtap still running in Rx hardware interrupt with "XXX not in softint"
 1.50  10-Jun-2016  ozaki-r branches: 1.50.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.49  28-Apr-2016  ozaki-r Constify rtentry of if_output

We no longer need to change rtentry below if_output.

The change makes it clear where rtentries are changed (or not)
and helps forthcoming locking (os psrefing) rtentries.
 1.48  20-Apr-2016  knakahara IFQ_ENQUEUE refactor (3/3) : eliminate pktattr argument from IFQ_ENQUEUE caller
 1.47  05-Jun-2014  rmind branches: 1.47.4;
- Implement pktqueue interface for lockless IP input queue.
- Replace ipintrq and ip6intrq with the pktqueue mechanism.
- Eliminate kernel-lock from ipintr() and ip6intr().
- Some preparation work to push softnet_lock out of ipintr().

Discussed on tech-net.
 1.46  15-May-2014  msaitoh Save a NETISR_* value in a variable and call schednetisr() after enqueue
a packet for readability and future modification.
 1.45  14-Sep-2013  joerg branches: 1.45.2;
Put helper functions for debugging under the corresponding debug
options.
 1.44  01-Mar-2013  joerg branches: 1.44.6;
Retire OSI network stack. OK core@
 1.43  05-Apr-2010  joerg branches: 1.43.8; 1.43.18;
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.42  19-Jan-2010  pooka branches: 1.42.2; 1.42.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.41  14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.40  07-Nov-2008  dyoung branches: 1.40.4;
*** Summary ***

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

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

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

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

Return consistent, appropriate error codes from network drivers.

Improve readability. KNF.

*** Details ***

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Let ifioctl_common() handle SIOCGIFADDR.

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

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

bzero -> memset. Delete unnecessary casts to void *. Use
sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with
NULL instead of "testing truth". Replace some instances of (type
*)0 with NULL. Change some K&R prototypes to ANSI C, and join
lines.
 1.39  08-Apr-2008  cegger branches: 1.39.4; 1.39.10; 1.39.12;
use aprint_*_dev and device_xname
 1.38  19-Oct-2007  ad branches: 1.38.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.37  01-Sep-2007  dyoung branches: 1.37.4;
Use ifreq_setaddr(), ifreq_getaddr(), sockaddr_in_init(), and
sockaddr_copy(). Constify. Compare pointers with NULL, not 0.
Don't "test truth" of pointers, but compare with NULL.
 1.36  04-Mar-2007  christos branches: 1.36.2; 1.36.10; 1.36.14; 1.36.16;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.35  17-Feb-2007  dyoung KNF: de-__P, bzero -> memset, bcmp -> memcmp. Remove extraneous
parentheses in return statements.

Cosmetic: don't open-code TAILQ_FOREACH().

Cosmetic: change types of variables to avoid oodles of casts: in
in6_src.c, avoid casts by changing several route_in6 pointers
to struct route pointers. Remove unnecessary casts to caddr_t
elsewhere.

Pave the way for eliminating address family-specific route caches:
soon, struct route will not embed a sockaddr, but it will hold
a reference to an external sockaddr, instead. We will set the
destination sockaddr using rtcache_setdst(). (I created a stub
for it, but it isn't used anywhere, yet.) rtcache_free() will
free the sockaddr. I have extracted from rtcache_free() a helper
subroutine, rtcache_clear(). rtcache_clear() will "forget" a
cached route, but it will not forget the destination by releasing
the sockaddr. I use rtcache_clear() instead of rtcache_free()
in rtcache_update(), because rtcache_update() is not supposed
to forget the destination.

Constify:

1 Introduce const accessor for route->ro_dst, rtcache_getdst().

2 Constify the 'dst' argument to ifnet->if_output(). This
led me to constify a lot of code called by output routines.

3 Constify the sockaddr argument to protosw->pr_ctlinput. This
led me to constify a lot of code called by ctlinput routines.

4 Introduce const macros for converting from a generic sockaddr
to family-specific sockaddrs, e.g., sockaddr_in: satocsin6,
satocsin, et cetera.
 1.34  16-Nov-2006  christos branches: 1.34.4;
__unused removal on arguments; approved by core.
 1.33  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.32  07-Jun-2006  kardel branches: 1.32.6; 1.32.8;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.31  28-Mar-2006  thorpej branches: 1.31.2;
Use device_unit().
 1.30  11-Dec-2005  christos branches: 1.30.4; 1.30.6; 1.30.8; 1.30.10; 1.30.12;
merge ktrace-lwp.
 1.29  27-Feb-2005  perry branches: 1.29.4;
nuke trailing whitespace
 1.28  04-Feb-2005  perry de-__P
 1.27  22-Apr-2004  itojun branches: 1.27.4; 1.27.6;
sprintf -> snprintf
 1.26  24-Feb-2004  wiz becuase -> because. From Peter Postma.
 1.25  02-Nov-2003  wiz Fix some typos. From Tom Cosgrove via jmc@openbsd.
 1.24  30-Oct-2003  simonb Remove some assigned-to but otherwise unused variables.
 1.23  03-May-2003  wiz branches: 1.23.2;
DMA, not dma nor Dma.
 1.22  21-Feb-2003  tsutsui hz -> Hz
 1.21  05-Mar-2002  itojun bring in latest ALTQ from kjc. ALTQify some of the drivers.
 1.20  13-Nov-2001  lukem add/cleanup RCSID
 1.19  14-Aug-2001  mrg add (u_long) casts for sparc64.
 1.18  07-Jul-2001  thorpej branches: 1.18.2;
bcopy -> memcpy
 1.17  14-Jun-2001  itojun change the meaning of ifnet.if_lastchange to meet RFC1573 ifLastChange.
follows BSD/OS practice and ucd-snmp code (FreeBSD does it for specific
interfaces only).

was: if_lastchange get updated on every packet transmission/receipt.
now: if_lastchange get updated when IFF_UP is changed.
 1.16  12-Jun-2001  wiz underrun, not underun
 1.15  01-Mar-2001  itojun branches: 1.15.2;
IPv6 support, from fujiwara@rcac.tdi.co.jp
 1.14  17-Jan-2001  thorpej Fix a rather annoying problem where the sockaddr_dl which holds
the link level name for the interface (ifp->if_sadl) is allocated
before ifp->if_addrlen is initialized, which could lead to allocating
too little space for the link level address.

Do this by splitting allocation of the link level name out of
if_attach() and into if_alloc_sadl(), which is normally called
by functions like ether_ifattach(). Network interfaces which
don't have a link-specific attach routine must call if_alloc_sadl()
themselves (example: gif).

Link level names are freed by if_free_sadl(), which can be called
from e.g. ether_ifdetach(). Drivers never need call if_free_sadl()
themselves as if_detach() will do it if it is not already done.

While here, add the ability to pass an AF_LINK address to
SIOCSIFADDR in ether_ioctl() (this is what caused me to notice
the problem that the above fixes).
 1.13  18-Dec-2000  thorpej ALTQ'ify.
 1.12  12-Dec-2000  thorpej Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.
 1.11  09-Jan-2000  chopps remove unused llc from receive logic, protect use of llc header in tranmist
logic, fixes pr#9151
 1.10  09-Jan-2000  chopps rename hl_control to hl_ffb (friendly fudge byte) as per cisco insider
the belief is that this was used to align OSI clnp header fields better
 1.9  08-Jan-2000  chopps pass iso pdus to netiso
 1.8  04-Jan-2000  chopps convert to support non-dma IO (for the isa Riscom/N2).
allow the user to set and use the internal baud rate generator
fix the transmission ring logic to support more than 1 frame per interrupt
add autodetection of the base clock frequency.
cleanup the receive ring logic
support dynamically resizing the low-water mark on the fifo in response
to buffer underruns on transmit.
 1.7  23-Oct-1999  erh Add description of the hd64570 chip. Add brief description of this driver.
 1.6  19-Mar-1999  erh branches: 1.6.8; 1.6.10; 1.6.12;
Get the index on the buffer (in addition to the descriptor) correct.
 1.5  16-Mar-1999  erh Add a "+1" in sca_start which should fix the limit of 2 transmit buffers. Also, kill some duplicate code.
 1.4  09-Dec-1998  tls Fix bug that caused all ifp's to have if_xname ntwo0, which was rather inconvenient. Should use config_found on each port instead, but this works for the moment and it's quick.
 1.3  28-Oct-1998  kleink RCS Id police, canonicalize multiple-inclusion protection symbol names.
 1.2  08-Aug-1998  mycroft Use splnet, not splimp.
 1.1  26-Jul-1998  explorer add (hopefully) bus-independent hd64570 driver, for the Hitachi serial
controller chip.
 1.6.12.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.10.1  15-Nov-1999  fvdl Sync with -current
 1.6.8.5  12-Mar-2001  bouyer Sync with HEAD.
 1.6.8.4  18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.6.8.3  05-Jan-2001  bouyer Sync with HEAD
 1.6.8.2  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.6.8.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.2.4  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.15.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.15.2.2  24-Aug-2001  nathanw Catch up with -current.
 1.15.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.18.2.3  16-Mar-2002  jdolecek Catch up with -current.
 1.18.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.2.1  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.23.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.23.2.4  04-Feb-2005  skrll Sync with HEAD.
 1.23.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1  03-Aug-2004  skrll Sync with HEAD
 1.27.6.2  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.27.6.1  12-Feb-2005  yamt sync with head.
 1.27.4.1  29-Apr-2005  kent sync with -current
 1.29.4.5  27-Oct-2007  yamt sync with head.
 1.29.4.4  03-Sep-2007  yamt sync with head.
 1.29.4.3  26-Feb-2007  yamt sync with head.
 1.29.4.2  30-Dec-2006  yamt sync with head.
 1.29.4.1  21-Jun-2006  yamt sync with head.
 1.30.12.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.30.10.1  19-Apr-2006  elad sync with head.
 1.30.8.2  26-Jun-2006  yamt sync with head.
 1.30.8.1  01-Apr-2006  yamt sync with head.
 1.30.6.2  22-Apr-2006  simonb Sync with head.
 1.30.6.1  04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.30.4.1  09-Sep-2006  rpaulo sync with head
 1.31.2.1  19-Jun-2006  chap Sync with head.
 1.32.8.2  10-Dec-2006  yamt sync with head.
 1.32.8.1  22-Oct-2006  yamt sync with head
 1.32.6.1  18-Nov-2006  ad Sync with head.
 1.34.4.2  12-Mar-2007  rmind Sync with HEAD.
 1.34.4.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.36.16.1  06-Nov-2007  matt sync with HEAD
 1.36.14.2  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.36.14.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.36.10.1  03-Sep-2007  skrll Sync with HEAD.
 1.36.2.2  23-Oct-2007  ad Sync with head.
 1.36.2.1  09-Oct-2007  ad Sync with head.
 1.37.4.1  25-Oct-2007  bouyer Sync with HEAD.
 1.38.16.2  17-Jan-2009  mjf Sync with HEAD.
 1.38.16.1  02-Jun-2008  mjf Sync with HEAD.
 1.39.12.2  28-Apr-2009  skrll Sync with HEAD.
 1.39.12.1  19-Jan-2009  skrll Sync with HEAD.
 1.39.10.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.39.4.3  11-Aug-2010  yamt sync with head.
 1.39.4.2  11-Mar-2010  yamt sync with head
 1.39.4.1  04-May-2009  yamt sync with head.
 1.40.4.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.42.4.1  30-May-2010  rmind sync with head
 1.42.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.43.18.3  03-Dec-2017  jdolecek update from HEAD
 1.43.18.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.43.18.1  23-Jun-2013  tls resync from head
 1.43.8.1  22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.44.6.1  18-May-2014  rmind sync with head
 1.45.2.1  10-Aug-2014  tls Rebase.
 1.47.4.5  28-Aug-2017  skrll Sync with HEAD
 1.47.4.4  05-Feb-2017  skrll Sync with HEAD
 1.47.4.3  09-Jul-2016  skrll Sync with HEAD
 1.47.4.2  29-May-2016  skrll Sync with HEAD
 1.47.4.1  22-Apr-2016  skrll Sync with HEAD
 1.50.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.50.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.51.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.53.12.1  28-Jul-2018  pgoyette Sync with HEAD
 1.54.10.1  29-Feb-2020  ad Sync with head.
 1.54.2.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.57.8.1  16-Nov-2023  thorpej IFQ_CLASSIFY() -> ifq_classify_packet().

RSS XML Feed