Home | History | Annotate | Download | only in ieee1394
History log of /src/sys/dev/ieee1394/if_fwip.c
RevisionDateAuthorComments
 1.32  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.31  20-Aug-2022  thorpej branches: 1.31.10;
fwip_async_output(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" with
"IF_POLL() -> IF_DEQUEUE() on success".
 1.30  29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.29  15-Nov-2018  maxv branches: 1.29.6;
Remove the 't' argument from m_tag_find().
 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  10-Jun-2016  ozaki-r branches: 1.27.16; 1.27.18;
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.26  25-Feb-2014  pooka branches: 1.26.6;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.25  29-Apr-2012  dsl branches: 1.25.2; 1.25.4;
Change to consistently use M_FW for all malloc/free.
It probably doesn't matter any more, but the code doesn't appear to
have matched its mallocs and frees - so the stats would have been awol.
 1.24  23-May-2010  christos branches: 1.24.8; 1.24.12;
Revert all previous kmem_ commits. This needs to be done in a different way
because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
it.
 1.23  10-May-2010  kiyohara Use kmem(9) instead of malloc(9).
 1.22  29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.21  11-Mar-2010  mrg branches: 1.21.2;
various aprint_* fixes.
 1.20  06-Dec-2009  dyoung branches: 1.20.2;
Simplify device-activation hook.
 1.19  12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.18  18-Mar-2009  cegger bzero -> memset
 1.17  12-Nov-2008  ad branches: 1.17.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.16  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.15  24-Jun-2008  gmcgarry branches: 1.15.2; 1.15.4;
Replace gcc extension of comma-elimination variadic macros with aprint_debug_ifnet().
 1.14  29-Mar-2008  kiyohara branches: 1.14.4; 1.14.6; 1.14.8;
Split device_t/softc.
And cosmetic change.
 1.13  07-Feb-2008  dyoung branches: 1.13.6;
Start patching up the kernel so that a network driver always has
the opportunity to handle an ioctl before generic ifioctl handling
occurs. This will ease extending the kernel and sharing of code
between drivers.

First steps: Make the signature of ifioctl_common() match struct
ifinet->if_ioctl. Convert SIOCSIFCAP and SIOCSIFMTU to the new
ifioctl() regime, throughout the kernel.
 1.12  11-Dec-2007  lukem use __KERNEL_RCSID()
 1.11  09-Dec-2007  jmcneill branches: 1.11.2;
Merge jmcneill-pm branch.
 1.10  05-Nov-2007  kiyohara branches: 1.10.2; 1.10.4; 1.10.6;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.9  19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.8  21-Apr-2007  kiyohara branches: 1.8.6; 1.8.8; 1.8.12;
firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.7  04-Mar-2007  christos branches: 1.7.2; 1.7.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6  16-Nov-2006  christos branches: 1.6.4;
__unused removal on arguments; approved by core.
 1.5  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.4  24-Dec-2005  perry branches: 1.4.18; 1.4.22; 1.4.24;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3  11-Dec-2005  christos merge ktrace-lwp.
 1.2  23-Jul-2005  kiyohara branches: 1.2.6;
Since fwip_unicast_input_recycle() is called from interrupt context, one
can't sleep there.
 1.1  11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.2.6.2  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1  23-Jul-2005  skrll file if_fwip.c was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.4.24.2  10-Dec-2006  yamt sync with head.
 1.4.24.1  22-Oct-2006  yamt sync with head
 1.4.22.1  18-Nov-2006  ad Sync with head.
 1.4.18.7  11-Feb-2008  yamt sync with head.
 1.4.18.6  21-Jan-2008  yamt sync with head
 1.4.18.5  15-Nov-2007  yamt sync with head.
 1.4.18.4  27-Oct-2007  yamt sync with head.
 1.4.18.3  03-Sep-2007  yamt sync with head.
 1.4.18.2  21-Jun-2006  yamt sync with head.
 1.4.18.1  24-Dec-2005  yamt file if_fwip.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.6.4.2  07-May-2007  yamt sync with head.
 1.6.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.7.4.1  11-Jul-2007  mjf Sync with head.
 1.7.2.2  23-Oct-2007  ad Sync with head.
 1.7.2.1  27-May-2007  ad Sync with head.
 1.8.12.2  13-Nov-2007  bouyer Sync with HEAD
 1.8.12.1  25-Oct-2007  bouyer Sync with HEAD.
 1.8.8.3  23-Mar-2008  matt sync with HEAD
 1.8.8.2  09-Jan-2008  matt sync with HEAD
 1.8.8.1  06-Nov-2007  matt sync with HEAD
 1.8.6.4  08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.8.6.3  28-Nov-2007  jmcneill Register with power management framework.
 1.8.6.2  06-Nov-2007  joerg Sync with HEAD.
 1.8.6.1  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.10.6.1  11-Dec-2007  yamt sync with head.
 1.10.4.1  26-Dec-2007  ad Sync with head.
 1.10.2.1  18-Feb-2008  mjf Sync with HEAD.
 1.11.2.1  13-Dec-2007  bouyer Sync with HEAD
 1.13.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.13.6.2  29-Jun-2008  mjf Sync with HEAD.
 1.13.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.14.8.1  27-Jun-2008  simonb Sync with head.
 1.14.6.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.14.4.4  11-Aug-2010  yamt sync with head.
 1.14.4.3  11-Mar-2010  yamt sync with head
 1.14.4.2  16-May-2009  yamt sync with head
 1.14.4.1  04-May-2009  yamt sync with head.
 1.15.4.2  28-Apr-2009  skrll Sync with HEAD.
 1.15.4.1  19-Jan-2009  skrll Sync with HEAD.
 1.15.2.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.17.4.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.21.2.1  30-May-2010  rmind sync with head
 1.24.12.1  29-Apr-2012  mrg sync to latest -current.
 1.24.8.2  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.24.8.1  23-May-2012  yamt sync with head.
 1.25.4.1  18-May-2014  rmind sync with head
 1.25.2.2  03-Dec-2017  jdolecek update from HEAD
 1.25.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.6.1  09-Jul-2016  skrll Sync with HEAD
 1.27.18.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.27.18.1  10-Jun-2019  christos Sync with HEAD
 1.27.16.2  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.27.16.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.29.6.1  29-Feb-2020  ad Sync with head.
 1.31.10.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed