Home | History | Annotate | only in /src/sys/altq
History log of /src/sys/altq
RevisionDateAuthorComments
 1.3 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.2 26-Nov-2002  lukem branches: 1.2.22; 1.2.44; 1.2.52; 1.2.54;
Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.1 15-Dec-2000  thorpej branches: 1.1.2; 1.1.4;
Install ALTQ header files.
 1.1.4.1 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 15-Dec-2000  bouyer file Makefile was added on branch thorpej_scsipi on 2001-01-05 17:39:35 +0000
 1.2.54.1 22-Oct-2006  yamt sync with head
 1.2.52.1 18-Nov-2006  ad Sync with head.
 1.2.44.1 18-Mar-2006  peter Add altq_jobs.h.
 1.2.22.1 30-Dec-2006  yamt sync with head.
 1.5 24-Dec-2024  ozaki-r altq, cbq: support 10 Gbps bandwidth

Mostly just s/u_int/uint64_t/ for bandwidth and rate variables.
 1.4 12-Oct-2006  peter branches: 1.4.178;
Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.3 02-Nov-2002  perry branches: 1.3.22; 1.3.44; 1.3.52; 1.3.54;
/*CONTCOND*/ while (0)'ed macros
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.1 11-Nov-2002  nathanw Catch up to -current
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq.h was added on branch thorpej_scsipi on 2001-01-05 17:39:35 +0000
 1.3.54.1 22-Oct-2006  yamt sync with head
 1.3.52.1 18-Nov-2006  ad Sync with head.
 1.3.44.1 18-Mar-2006  peter Sync with KAME.
 1.3.22.1 30-Dec-2006  yamt sync with head.
 1.4.178.1 02-Aug-2025  perseant Sync with HEAD
 1.25 14-Jan-2025  joe refac: remove parens from return statements
 1.24 14-Jan-2025  joe handle duplication: extract address family interface lookup
 1.23 31-Dec-2021  riastradh branches: 1.23.10;
altq(9): Fix missing IFNET_LOCK around if_ioctl.
 1.22 31-Dec-2021  riastradh sys: Use if_ioctl wrapper function.
 1.21 21-Sep-2021  christos Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.20 20-Mar-2014  christos kill sprintf
 1.19 07-Nov-2008  dyoung branches: 1.19.16; 1.19.26; 1.19.30;
*** 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-Mar-2007  christos branches: 1.18.36; 1.18.40; 1.18.46; 1.18.50;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 16-Nov-2006  christos branches: 1.17.4;
__unused removal on arguments; approved by core.
 1.16 20-Oct-2006  elad Kill some KAUTH_GENERIC_ISSUSER.
 1.15 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 21-Jul-2006  ad branches: 1.13.4; 1.13.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.12 15-May-2006  christos kauth fallout
 1.11 14-May-2006  elad integrate kauth.
 1.10 23-Apr-2006  christos Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.9 11-Dec-2005  christos branches: 1.9.4; 1.9.6; 1.9.8; 1.9.10; 1.9.12;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 21-Apr-2004  itojun branches: 1.7.4; 1.7.6;
kill sprintf, use snprintf
 1.6 09-Nov-2003  christos - kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.5 15-Nov-2001  lukem branches: 1.5.16;
don't need <sys/types.h> when including <sys/param.h>
 1.4 12-Nov-2001  lukem add RCSIDs
 1.3 13-Apr-2001  thorpej branches: 1.3.2; 1.3.4;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_afmap.c was added on branch thorpej_scsipi on 2001-01-05 17:39:35 +0000
 1.3.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.16.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.16.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.16.3 18-Sep-2004  skrll Sync with HEAD.
 1.5.16.2 12-Aug-2004  skrll Adapt to new world order.
 1.5.16.1 03-Aug-2004  skrll Sync with HEAD
 1.7.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.8.4.3 03-Sep-2007  yamt sync with head.
 1.8.4.2 30-Dec-2006  yamt sync with head.
 1.8.4.1 21-Jun-2006  yamt sync with head.
 1.9.12.3 25-Sep-2006  peter sync with head.
 1.9.12.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.9.12.1 18-Mar-2006  peter Sync with KAME.
 1.9.10.3 11-May-2006  elad sync with head
 1.9.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.9.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.9.8.2 11-Aug-2006  yamt sync with head
 1.9.8.1 24-May-2006  yamt sync with head.
 1.9.6.1 01-Jun-2006  kardel Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.13.6.2 10-Dec-2006  yamt sync with head.
 1.13.6.1 22-Oct-2006  yamt sync with head
 1.13.4.1 18-Nov-2006  ad Sync with head.
 1.17.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.18.50.1 19-Jan-2009  skrll Sync with HEAD.
 1.18.46.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.18.40.1 04-May-2009  yamt sync with head.
 1.18.36.1 17-Jan-2009  mjf Sync with HEAD.
 1.19.30.1 18-May-2014  rmind sync with head
 1.19.26.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.16.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.23.10.1 02-Aug-2025  perseant Sync with HEAD
 1.4 14-Jan-2025  joe handle duplication: extract address family interface lookup
 1.3 12-Oct-2006  peter branches: 1.3.178;
Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.42; 1.2.64; 1.2.72; 1.2.74;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.74.1 22-Oct-2006  yamt sync with head
 1.2.72.1 18-Nov-2006  ad Sync with head.
 1.2.64.1 18-Mar-2006  peter Sync with KAME.
 1.2.42.1 30-Dec-2006  yamt sync with head.
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_afmap.h was added on branch thorpej_scsipi on 2001-01-05 17:39:35 +0000
 1.3.178.1 02-Aug-2025  perseant Sync with HEAD
 1.27 08-Jan-2025  joe return: remove parenthesis from return statements
 1.26 21-Sep-2021  christos branches: 1.26.6; 1.26.8;
Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.25 26-Dec-2019  msaitoh s/lenght/length/
 1.24 20-Apr-2016  knakahara branches: 1.24.18;
IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
 1.23 19-Nov-2011  tls branches: 1.23.8; 1.23.26;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

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

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

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

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

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

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

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

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

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

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

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

Manual pages for the new kernel interfaces are forthcoming.
 1.22 04-Mar-2007  christos branches: 1.22.76;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.21 16-Nov-2006  christos branches: 1.21.4;
__unused removal on arguments; approved by core.
 1.20 20-Oct-2006  elad Kill some KAUTH_GENERIC_ISSUSER.
 1.19 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.18 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.17 21-Jul-2006  ad branches: 1.17.4; 1.17.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.16 15-May-2006  christos kauth fallout
 1.15 14-May-2006  elad integrate kauth.
 1.14 23-Apr-2006  christos Complete the FREE -> free transition and add more NULL checks for malloc
returns. Although these cannot happen because M_WAITOK, the rest of the
code does them already, so this is good for consistency. From Mindaugas
 1.13 23-Apr-2006  christos Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6; 1.12.8; 1.12.10; 1.12.12;
merge ktrace-lwp.
 1.11 26-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 26-Jun-2004  abs branches: 1.10.4; 1.10.6;
Fix URL to Wu-chang Feng's BLUE
 1.9 13-Feb-2004  wiz branches: 1.9.2;
Spell length with h after t. Inspired by a commit by brad@openbsd.
 1.8 09-Nov-2003  christos - kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.7 07-Oct-2003  mycroft There is NO reason to use arc4random() here, and it needlessly slows down the
forwarding path, so goodbye.
 1.6 05-Sep-2003  itojun use arc4random. sync w/ kame
 1.5 05-Mar-2002  itojun branches: 1.5.14;
bring in latest ALTQ from kjc. ALTQify some of the drivers.
 1.4 12-Nov-2001  lukem add RCSIDs
 1.3 13-Apr-2001  thorpej branches: 1.3.2; 1.3.4;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_blue.c was added on branch thorpej_scsipi on 2001-01-05 17:39:35 +0000
 1.3.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.14.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.14.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.14.3 18-Sep-2004  skrll Sync with HEAD.
 1.5.14.2 12-Aug-2004  skrll Adapt to new world order.
 1.5.14.1 03-Aug-2004  skrll Sync with HEAD
 1.9.2.1 27-Jun-2004  he Pull up revision 1.10 (requested by abs in ticket #556):
Fix URL to Wu-chang Feng's BLUE.
 1.10.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.4.1 29-Apr-2005  kent sync with -current
 1.11.4.3 03-Sep-2007  yamt sync with head.
 1.11.4.2 30-Dec-2006  yamt sync with head.
 1.11.4.1 21-Jun-2006  yamt sync with head.
 1.12.12.3 25-Sep-2006  peter sync with head.
 1.12.12.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.12.12.1 18-Mar-2006  peter Sync with KAME.
 1.12.10.3 11-May-2006  elad sync with head
 1.12.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.12.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.12.8.2 11-Aug-2006  yamt sync with head
 1.12.8.1 24-May-2006  yamt sync with head.
 1.12.6.1 01-Jun-2006  kardel Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.17.6.2 10-Dec-2006  yamt sync with head.
 1.17.6.1 22-Oct-2006  yamt sync with head
 1.17.4.1 18-Nov-2006  ad Sync with head.
 1.21.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.76.1 17-Apr-2012  yamt sync with head
 1.23.26.1 22-Apr-2016  skrll Sync with HEAD
 1.23.8.1 03-Dec-2017  jdolecek update from HEAD
 1.24.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.26.8.1 02-Aug-2025  perseant Sync with HEAD
 1.26.6.1 11-Nov-2023  thorpej Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.5 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.4 11-Dec-2005  christos branches: 1.4.12; 1.4.20; 1.4.22;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.26; 1.2.34; 1.2.36;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.36.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.34.1 29-Apr-2005  kent sync with -current
 1.2.26.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_blue.h was added on branch thorpej_scsipi on 2001-01-05 17:39:35 +0000
 1.3.4.1 30-Dec-2006  yamt sync with head.
 1.4.22.1 22-Oct-2006  yamt sync with head
 1.4.20.1 18-Nov-2006  ad Sync with head.
 1.4.12.1 18-Mar-2006  peter Sync with KAME.
 1.42 08-Jan-2025  joe return: remove parenthesis from return statements
 1.41 26-Sep-2024  ozaki-r altq, cbq: fix default class assignment

Fix typo in v1.34.

Tested by me and manu@.
 1.40 26-Sep-2024  ozaki-r altq, cbq: fix NSEC_TO_PSEC

Pointed out by manu@, thanks.
 1.39 31-Dec-2021  andvar branches: 1.39.4; 1.39.6; 1.39.8;
fix few typos in comments, mainly in word "parameter".
 1.38 21-Sep-2021  christos Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.37 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.36 21-Jul-2021  ozaki-r altq: fix CBQ with RED and/or pf
 1.35 21-Jul-2021  ozaki-r altq, cbq: convert ns_per_byte to ps_per_byte

Also the type of variables of it is changed to u_long from int.

This change provides fine-grain resolution of bandwidth. For example
750 Mbps was treated as 800 Mbps internally because bandwidth was
represented as nanoseconds per byte. Converting the representation
to picoseconds per byte enables to treat 750 Mbps as-is.

PR kern/56319
 1.34 14-Jul-2021  ozaki-r altq, cbq: allow the root class to be default
 1.33 14-Jul-2021  ozaki-r altq, cbq: allow no control class
 1.32 15-Nov-2018  maxv branches: 1.32.16;
Remove the 't' argument from m_tag_find().
 1.31 28-Jul-2017  riastradh branches: 1.31.2; 1.31.4;
Zero buffers copied to userland to avoid stack disclosure.

From Ilja Van Sprundel.
 1.30 20-Jun-2016  knakahara branches: 1.30.10;
apply if_start_lock() to L2 callers which call ifp->if_start() of device derivers
 1.29 20-Apr-2016  knakahara IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
 1.28 18-Oct-2014  snj branches: 1.28.2;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.27 20-Mar-2014  christos branches: 1.27.4; 1.27.6; 1.27.10;
kill sprintf
 1.26 22-Nov-2009  mbalmer branches: 1.26.12; 1.26.18; 1.26.22; 1.26.24; 1.26.26; 1.26.32;
s/the the/the/
 1.25 18-Jun-2008  yamt merge yamt-pf42 branch.
(import newer pf from OpenBSD 4.2)

ok'ed by peter@. requested by core@
 1.24 04-Mar-2007  christos branches: 1.24.36; 1.24.38; 1.24.40; 1.24.42; 1.24.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 16-Nov-2006  christos branches: 1.23.4;
__unused removal on arguments; approved by core.
 1.22 28-Oct-2006  peter Don't allow to initialize an interface with MTU smaller than one.
This prevents a divide by zero and fixes PR #21474.

ok tron@
 1.21 20-Oct-2006  elad Kill some KAUTH_GENERIC_ISSUSER.
 1.20 13-Oct-2006  peter Only compile in pf specific code when pf is configured.
Fixes kernel build when ALTQ is configured and pf not.
 1.19 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.18 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.17 21-Jul-2006  ad branches: 1.17.4; 1.17.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.16 15-May-2006  christos kauth fallout
 1.15 14-May-2006  elad integrate kauth.
 1.14 23-Apr-2006  christos Complete the FREE -> free transition and add more NULL checks for malloc
returns. Although these cannot happen because M_WAITOK, the rest of the
code does them already, so this is good for consistency. From Mindaugas
 1.13 23-Apr-2006  christos Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6; 1.12.8; 1.12.10; 1.12.12;
merge ktrace-lwp.
 1.11 26-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 23-Apr-2004  simonb branches: 1.10.4; 1.10.6;
s/the the/the/ (only in sources that aren't regularly imported from
elsewhere).
 1.9 24-Feb-2004  wiz parameter with two es. From Peter Postma.
 1.8 09-Nov-2003  christos - kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.7 20-Aug-2003  itojun expose CBQ_MAXPRI to userland
 1.6 07-Oct-2002  itojun branches: 1.6.6;
fix a bug in a cbq list chasing.
this bug turns up only when 3 or more cbq instances are
created at a time.

sync w/kame
 1.5 12-Nov-2001  lukem add RCSIDs
 1.4 16-Sep-2001  wiz Spell 'occurred' with two 'r's.
 1.3 13-Apr-2001  thorpej branches: 1.3.2; 1.3.4;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.2.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_cbq.c was added on branch thorpej_scsipi on 2001-01-05 17:39:35 +0000
 1.3.4.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.6.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.3 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.2 12-Aug-2004  skrll Adapt to new world order.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.4.1 29-Apr-2005  kent sync with -current
 1.11.4.3 03-Sep-2007  yamt sync with head.
 1.11.4.2 30-Dec-2006  yamt sync with head.
 1.11.4.1 21-Jun-2006  yamt sync with head.
 1.12.12.4 25-Sep-2006  peter sync with head.
 1.12.12.3 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.12.12.2 18-Mar-2006  peter Fix a stupid typo.
 1.12.12.1 18-Mar-2006  peter Sync with KAME.
 1.12.10.3 11-May-2006  elad sync with head
 1.12.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.12.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.12.8.2 11-Aug-2006  yamt sync with head
 1.12.8.1 24-May-2006  yamt sync with head.
 1.12.6.1 01-Jun-2006  kardel Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.17.6.2 10-Dec-2006  yamt sync with head.
 1.17.6.1 22-Oct-2006  yamt sync with head
 1.17.4.1 18-Nov-2006  ad Sync with head.
 1.23.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.44.1 18-Jun-2008  simonb Sync with head.
 1.24.42.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.24.40.2 11-Mar-2010  yamt sync with head
 1.24.40.1 04-May-2009  yamt sync with head.
 1.24.38.1 24-Apr-2008  peter Add PACKET_TAG_ALTQ_QID and use it for pf/ALTQ. The ALTQ code compiles now.

ok yamt@
 1.24.36.1 29-Jun-2008  mjf Sync with HEAD.
 1.26.32.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.26.26.1 18-May-2014  rmind sync with head
 1.26.24.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.26.22.2 03-Dec-2017  jdolecek update from HEAD
 1.26.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.18.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.26.12.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.27.10.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.27.6.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.27.4.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.28.2.3 28-Aug-2017  skrll Sync with HEAD
 1.28.2.2 09-Jul-2016  skrll Sync with HEAD
 1.28.2.1 22-Apr-2016  skrll Sync with HEAD
 1.30.10.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #198):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.31.4.1 10-Jun-2019  christos Sync with HEAD
 1.31.2.1 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.32.16.1 01-Aug-2021  thorpej Sync with HEAD.
 1.39.8.1 02-Aug-2025  perseant Sync with HEAD
 1.39.6.1 11-Nov-2023  thorpej Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.39.4.1 03-Oct-2024  martin Pull up following revision(s) (requested by ozaki-r in ticket #917):

sys/altq/altq_cbq.c: revision 1.40
sys/altq/altq_cbq.c: revision 1.41

altq, cbq: fix NSEC_TO_PSEC
Pointed out by manu@, thanks.

altq, cbq: fix default class assignment
Fix typo in v1.34.
Tested by me and manu@.
 1.11 21-Jul-2021  ozaki-r altq, cbq: change long to uint64_t for ILP32 archs

PR kern/56319
 1.10 21-Jul-2021  ozaki-r altq, cbq: treat time in nanoseconds

Time granularity in microseconds is sometimes not enough to provide
accurate bandwidth control; actual bandwidth on a capped class
can exceed its limit considerably in some cases.

Treating time in nanoseconds requires the following changes:
- Use timespec instead of timeval
- Use nanotime(9) instead of microtime(9)
- Change the type of some variables, especially *idle, to long
 1.9 21-Jul-2021  ozaki-r altq, cbq: convert ns_per_byte to ps_per_byte

Also the type of variables of it is changed to u_long from int.

This change provides fine-grain resolution of bandwidth. For example
750 Mbps was treated as 800 Mbps internally because bandwidth was
represented as nanoseconds per byte. Converting the representation
to picoseconds per byte enables to treat 750 Mbps as-is.

PR kern/56319
 1.8 12-Oct-2006  peter branches: 1.8.158;
Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.7 11-Dec-2005  christos branches: 1.7.12; 1.7.20; 1.7.22;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 20-Aug-2003  itojun branches: 1.5.8; 1.5.10;
expose CBQ_MAXPRI to userland
 1.4 18-Jul-2002  wiz branches: 1.4.6;
Spell 'should' correctly.
 1.3 05-Jun-2001  thorpej branches: 1.3.2; 1.3.14;
HZ -> hz
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_cbq.h was added on branch thorpej_scsipi on 2001-01-05 17:39:35 +0000
 1.3.14.1 20-Jul-2002  gehenna catch up with -current.
 1.3.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.5.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.6.4.1 30-Dec-2006  yamt sync with head.
 1.7.22.1 22-Oct-2006  yamt sync with head
 1.7.20.1 18-Nov-2006  ad Sync with head.
 1.7.12.1 18-Mar-2006  peter Sync with KAME.
 1.8.158.1 01-Aug-2021  thorpej Sync with HEAD.
 1.23 08-Jan-2025  joe return: remove parenthesis from return statements
 1.22 21-Sep-2021  christos branches: 1.22.6; 1.22.8;
Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.21 10-Jun-2016  ozaki-r Avoid storing a pointer of an interface in a mbuf

Having a pointer of an interface in a mbuf isn't safe if we remove big
kernel locks; an interface object (ifnet) can be destroyed anytime in any
packet processing and accessing such object via a pointer is racy. Instead
we have to get an object from the interface collection (ifindex2ifnet) via
an interface index (if_index) that is stored to a mbuf instead of an
pointer.

The change provides two APIs: m_{get,put}_rcvif_psref that use psref(9)
for sleep-able critical sections and m_{get,put}_rcvif that use
pserialize(9) for other critical sections. The change also adds another
API called m_get_rcvif_NOMPSAFE, that is NOT MP-safe and for transition
moratorium, i.e., it is intended to be used for places where are not
planned to be MP-ified soon.

The change adds some overhead due to psref to performance sensitive paths,
however the overhead is not serious, 2% down at worst.

Proposed on tech-kern and tech-net.
 1.20 19-Nov-2011  tls branches: 1.20.8; 1.20.26;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

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

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

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

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

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

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

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

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

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

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

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

Manual pages for the new kernel interfaces are forthcoming.
 1.19 04-Mar-2007  christos branches: 1.19.76;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 16-Nov-2006  christos branches: 1.18.4;
__unused removal on arguments; approved by core.
 1.17 20-Oct-2006  elad Kill some KAUTH_GENERIC_ISSUSER.
 1.16 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.15 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.14 21-Jul-2006  ad branches: 1.14.4; 1.14.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.13 15-May-2006  christos kauth fallout
 1.12 14-May-2006  elad integrate kauth.
 1.11 23-Apr-2006  christos Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.6; 1.10.8; 1.10.10; 1.10.12;
merge ktrace-lwp.
 1.9 26-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 13-Feb-2004  wiz branches: 1.8.8; 1.8.10;
Uppercase CPU, plural is CPUs.
 1.7 09-Nov-2003  christos - kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.6 07-Oct-2003  mycroft There is NO reason to use arc4random() here, and it needlessly slows down the
forwarding path, so goodbye.
 1.5 05-Sep-2003  itojun use arc4random. sync w/ kame
 1.4 12-Nov-2001  lukem branches: 1.4.16;
add RCSIDs
 1.3 13-Apr-2001  thorpej branches: 1.3.2; 1.3.4;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_cdnr.c was added on branch thorpej_scsipi on 2001-01-05 17:39:36 +0000
 1.3.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.16.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.16.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.16.3 18-Sep-2004  skrll Sync with HEAD.
 1.4.16.2 12-Aug-2004  skrll Adapt to new world order.
 1.4.16.1 03-Aug-2004  skrll Sync with HEAD
 1.8.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.8.1 29-Apr-2005  kent sync with -current
 1.9.4.3 03-Sep-2007  yamt sync with head.
 1.9.4.2 30-Dec-2006  yamt sync with head.
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.10.12.3 25-Sep-2006  peter sync with head.
 1.10.12.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.10.12.1 18-Mar-2006  peter Sync with KAME.
 1.10.10.3 11-May-2006  elad sync with head
 1.10.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.10.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.10.8.2 11-Aug-2006  yamt sync with head
 1.10.8.1 24-May-2006  yamt sync with head.
 1.10.6.1 01-Jun-2006  kardel Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.14.6.2 10-Dec-2006  yamt sync with head.
 1.14.6.1 22-Oct-2006  yamt sync with head
 1.14.4.1 18-Nov-2006  ad Sync with head.
 1.18.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.76.1 17-Apr-2012  yamt sync with head
 1.20.26.1 09-Jul-2016  skrll Sync with HEAD
 1.20.8.1 03-Dec-2017  jdolecek update from HEAD
 1.22.8.1 02-Aug-2025  perseant Sync with HEAD
 1.22.6.1 11-Nov-2023  thorpej branches: 1.22.6.1.2;
Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.22.6.1.2.1 15-Nov-2023  thorpej Protect the ALTQ state that's exposed to the ifqueue if the ifq->ifq_lock.
This requires exposing some implementation details to ALTQ, which is guarded
by an __IFQ_PRIVATE define.
 1.5 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.4 11-Dec-2005  christos branches: 1.4.12; 1.4.20; 1.4.22;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.26; 1.2.34; 1.2.36;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.36.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.34.1 29-Apr-2005  kent sync with -current
 1.2.26.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_cdnr.h was added on branch thorpej_scsipi on 2001-01-05 17:39:36 +0000
 1.3.4.1 30-Dec-2006  yamt sync with head.
 1.4.22.1 22-Oct-2006  yamt sync with head
 1.4.20.1 18-Nov-2006  ad Sync with head.
 1.4.12.1 18-Mar-2006  peter Sync with KAME.
 1.12 22-Jan-2025  joe remove redundant and dead #ifdef _KERNEL branches and use cprng directly

the entire code is in a _KERNEL block. move the header decl in in the original _KERNEL block.
redefining _KERNEL to use cprng is purely a dead branch and we should either use random or cprng.
 1.11 18-Jan-2025  kre Half revert the previous.

Only use cprng_fast32() for in kernel (ie: #ifdef _KERNEL) usages,
leave rump (and anything else userland) doing it the old way.
 1.10 18-Jan-2025  joe coverity scan: use a more secure random generator when randomly selecting a packet in queue
 1.9 08-Jan-2025  joe return: remove parenthesis from return statements
 1.8 19-Apr-2018  christos branches: 1.8.38;
s/static inline/static __inline/g for consistency.
 1.7 12-Oct-2006  peter branches: 1.7.140;
Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.6 24-Dec-2005  perry branches: 1.6.12; 1.6.20; 1.6.22;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 06-Apr-2001  thorpej branches: 1.3.22; 1.3.30; 1.3.32;
From KAME:

kjc 2001/02/09 16:20:40 JST

Modified files:
kame/sys/altq altq_classq.h altq_rmclass.c
Log:
clear m_nextpkt at dequeueing a packet.

this is not needed in the current code but
requested by Lars Eggert <larse@ISI.EDU> for
their experiment to use altq for inbound processing.

Revision Changes Path
1.4 +4 -1 kame/kame/sys/altq/altq_classq.h
1.10 +4 -1 kame/kame/sys/altq/altq_rmclass.c
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_classq.h was added on branch thorpej_scsipi on 2001-01-05 17:39:36 +0000
 1.3.32.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.30.1 29-Apr-2005  kent sync with -current
 1.3.22.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.4.2 30-Dec-2006  yamt sync with head.
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.6.22.1 22-Oct-2006  yamt sync with head
 1.6.20.1 18-Nov-2006  ad Sync with head.
 1.6.12.1 18-Mar-2006  peter Sync with KAME.
 1.7.140.1 22-Apr-2018  pgoyette Sync with HEAD
 1.8.38.1 02-Aug-2025  perseant Sync with HEAD
 1.23 08-Jan-2025  joe return: remove parenthesis from return statements
 1.22 21-Sep-2021  christos branches: 1.22.6; 1.22.8;
Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.21 25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.20 16-Mar-2014  dholland branches: 1.20.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.19 04-Mar-2007  christos branches: 1.19.76; 1.19.86; 1.19.92;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 20-Oct-2006  elad branches: 1.18.4;
Kill some KAUTH_GENERIC_ISSUSER.
 1.17 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.16 03-Sep-2006  christos branches: 1.16.2; 1.16.4;
add missing initializer
 1.15 21-Jul-2006  ad - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.14 15-May-2006  christos kauth fallout
 1.13 14-May-2006  elad integrate kauth.
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6; 1.12.8; 1.12.10; 1.12.12;
merge ktrace-lwp.
 1.11 26-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 23-Oct-2002  jdolecek branches: 1.10.6; 1.10.14; 1.10.16;
merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.9 22-Sep-2002  jdolecek pull only "opt_altq_enabled.h" in if_altq.h, and include altqconf.h
explicitly in single file which implicitly needed it (altq_conf.c)

this avoids pulling in implicit dependency on <sys/conf.h> to every
file including <net/if.h> (which includes <altq/if_altq.h> to get altq
related structures)
 1.8 07-Sep-2002  gehenna make this compile.
 1.7 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.6 05-Mar-2002  itojun branches: 1.6.6;
bring in latest ALTQ from kjc. ALTQify some of the drivers.
 1.5 12-Nov-2001  lukem add RCSIDs
 1.4 14-Dec-2000  thorpej branches: 1.4.2; 1.4.4; 1.4.6; 1.4.8;
Saner glue into cdevsw.
 1.3 14-Dec-2000  thorpej No need to wrap these in #ifdef ALTQ -- they're not even included
if ALTQ is not configured into the kernel.
 1.2 14-Dec-2000  thorpej Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.4.8.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.4.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.4.6.2 16-Mar-2002  jdolecek Catch up with -current.
 1.4.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.4.5 11-Nov-2002  nathanw Catch up to -current
 1.4.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.4.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.4.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.4.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.4.2.1 14-Dec-2000  bouyer file altq_conf.c was added on branch thorpej_scsipi on 2001-01-05 17:39:36 +0000
 1.6.6.1 16-May-2002  gehenna Add the character device switch.
 1.10.16.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.14.1 29-Apr-2005  kent sync with -current
 1.10.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.6.1 12-Aug-2004  skrll Adapt to new world order.
 1.11.4.3 03-Sep-2007  yamt sync with head.
 1.11.4.2 30-Dec-2006  yamt sync with head.
 1.11.4.1 21-Jun-2006  yamt sync with head.
 1.12.12.3 25-Sep-2006  peter sync with head.
 1.12.12.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.12.12.1 18-Mar-2006  peter Sync with KAME.
 1.12.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.12.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.12.8.3 03-Sep-2006  yamt sync with head.
 1.12.8.2 11-Aug-2006  yamt sync with head
 1.12.8.1 24-May-2006  yamt sync with head.
 1.12.6.1 01-Jun-2006  kardel Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.16.4.1 22-Oct-2006  yamt sync with head
 1.16.2.1 18-Nov-2006  ad Sync with head.
 1.18.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.92.1 18-May-2014  rmind sync with head
 1.19.86.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.76.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.20.2.1 10-Aug-2014  tls Rebase.
 1.22.8.1 02-Aug-2025  perseant Sync with HEAD
 1.22.6.1 11-Nov-2023  thorpej Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.10 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 12-Oct-2006  peter branches: 1.9.4;
Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.8 11-Dec-2005  christos branches: 1.8.12; 1.8.20; 1.8.22;
merge ktrace-lwp.
 1.7 06-Jun-2005  christos branches: 1.7.2;
add a missing const.
 1.6 29-Jun-2003  fvdl branches: 1.6.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.5 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.4 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.3 29-Jan-2001  itojun branches: 1.3.2; 1.3.4; 1.3.16;
remove variable names from prototype. sync with kame.
 1.2 14-Dec-2000  thorpej branches: 1.2.2;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_conf.h was added on branch thorpej_scsipi on 2001-01-05 17:39:36 +0000
 1.3.16.1 16-May-2002  gehenna Fix compile conditions.
 1.3.4.1 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.3.2.1 17-Sep-2002  nathanw Catch up to -current.
 1.6.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.7.2.3 03-Sep-2007  yamt sync with head.
 1.7.2.2 30-Dec-2006  yamt sync with head.
 1.7.2.1 21-Jun-2006  yamt sync with head.
 1.8.22.1 22-Oct-2006  yamt sync with head
 1.8.20.1 18-Nov-2006  ad Sync with head.
 1.8.12.1 18-Mar-2006  peter Sync with KAME.
 1.9.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.19 08-Jan-2025  joe return: remove parenthesis from return statements
 1.18 21-Sep-2021  christos branches: 1.18.6; 1.18.8;
Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.17 20-Apr-2016  knakahara IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
 1.16 04-Mar-2007  christos branches: 1.16.86; 1.16.106;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.15 16-Nov-2006  christos branches: 1.15.4;
__unused removal on arguments; approved by core.
 1.14 20-Oct-2006  elad Kill some KAUTH_GENERIC_ISSUSER.
 1.13 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 21-Jul-2006  ad branches: 1.11.4; 1.11.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.10 15-May-2006  christos kauth fallout
 1.9 14-May-2006  elad integrate kauth.
 1.8 23-Apr-2006  christos Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6; 1.7.8; 1.7.10; 1.7.12;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 09-Nov-2003  christos branches: 1.5.8; 1.5.10;
- kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.4 12-Nov-2001  lukem branches: 1.4.16;
add RCSIDs
 1.3 13-Apr-2001  thorpej branches: 1.3.2; 1.3.4;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_fifoq.c was added on branch thorpej_scsipi on 2001-01-05 17:39:36 +0000
 1.3.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.16.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.16.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.16.3 18-Sep-2004  skrll Sync with HEAD.
 1.4.16.2 12-Aug-2004  skrll Adapt to new world order.
 1.4.16.1 03-Aug-2004  skrll Sync with HEAD
 1.5.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.6.4.3 03-Sep-2007  yamt sync with head.
 1.6.4.2 30-Dec-2006  yamt sync with head.
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.12.3 25-Sep-2006  peter sync with head.
 1.7.12.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.7.12.1 18-Mar-2006  peter Sync with KAME.
 1.7.10.3 11-May-2006  elad sync with head
 1.7.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.7.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.7.8.2 11-Aug-2006  yamt sync with head
 1.7.8.1 24-May-2006  yamt sync with head.
 1.7.6.1 01-Jun-2006  kardel Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.11.6.2 10-Dec-2006  yamt sync with head.
 1.11.6.1 22-Oct-2006  yamt sync with head
 1.11.4.1 18-Nov-2006  ad Sync with head.
 1.15.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.106.1 22-Apr-2016  skrll Sync with HEAD
 1.16.86.1 03-Dec-2017  jdolecek update from HEAD
 1.18.8.1 02-Aug-2025  perseant Sync with HEAD
 1.18.6.1 11-Nov-2023  thorpej Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.7 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.6 11-Dec-2005  christos branches: 1.6.12; 1.6.20; 1.6.22;
merge ktrace-lwp.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 22-Jun-2004  itojun branches: 1.4.4; 1.4.6;
hide in-kernel structure by _KERNEL
 1.3 13-Feb-2004  wiz Spell length with h after t. Inspired by a commit by brad@openbsd.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.26;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.26.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.26.1 03-Aug-2004  skrll Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_fifoq.h was added on branch thorpej_scsipi on 2001-01-05 17:39:36 +0000
 1.4.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.4.1 29-Apr-2005  kent sync with -current
 1.5.4.1 30-Dec-2006  yamt sync with head.
 1.6.22.1 22-Oct-2006  yamt sync with head
 1.6.20.1 18-Nov-2006  ad Sync with head.
 1.6.12.1 18-Mar-2006  peter Sync with KAME.
 1.4 05-Mar-2020  riastradh Need opt_inet.h for #ifdef INET, INET6.
 1.3 12-Oct-2006  peter branches: 1.3.142; 1.3.146;
Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.42; 1.2.64; 1.2.72; 1.2.74;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.74.1 22-Oct-2006  yamt sync with head
 1.2.72.1 18-Nov-2006  ad Sync with head.
 1.2.64.1 18-Mar-2006  peter Sync with KAME.
 1.2.42.1 30-Dec-2006  yamt sync with head.
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_flowvalve.h was added on branch thorpej_scsipi on 2001-01-05 17:39:36 +0000
 1.3.146.1 19-Mar-2020  martin Pull up following revision(s) (requested by riastradh in ticket #787):

sys/altq/altq_flowvalve.h: revision 1.4
sys/net/zlib.h: revision 1.15
sys/dist/pf/net/pfvar.h: revision 1.23
sys/external/bsd/drm2/dist/include/drm/drmP.h: revision 1.38
sys/external/bsd/drm2/dist/drm/drm_drv.c: revision 1.13
sys/net/slcompress.h: revision 1.20

Need opt_inet.h for #ifdef INET, INET6.

Avoid duplicate definition of internal_state struct.

Avoid struct inode.

This is an fs-independent structure in Linux. We don't actually use
it as such; it's just a dummy struct tag. But we do have an actual
struct inode in ufs and in lfs, and using the same struct tag here
confuses ctf leading to four copies of pretty much every drm data
structure.
 1.3.142.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.31 08-Jan-2025  joe return: remove parenthesis from return statements
 1.30 21-Sep-2021  christos branches: 1.30.6; 1.30.8;
Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.29 30-Aug-2021  riastradh sys/altq: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.28 15-Nov-2018  maxv branches: 1.28.4;
Remove the 't' argument from m_tag_find().
 1.27 28-Jul-2017  riastradh branches: 1.27.2; 1.27.4;
Zero buffers copied to userland to avoid stack disclosure.

From Ilja Van Sprundel.
 1.26 20-Apr-2016  knakahara branches: 1.26.10;
IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
 1.25 22-Jan-2016  christos Prevent interface deletion from running into an infinite loop when altq closes.
$ cat /etc/altq.conf
interface ppp0 bandwidth 10M priq
class priq ppp0 high_class_ppp NULL priority 1
class priq ppp0 low_class_ppp NULL priority 0 default
filter ppp0 high_class_ppp 0 0 0 0 1
$ ifconfig ppp0 create
$ /etc/rc.d/altqd onestart
$ ifconfig ppp0 destroy
$ pkill altqd
XXX: pullup-7
 1.24 18-Jun-2008  yamt branches: 1.24.36; 1.24.40; 1.24.42; 1.24.52; 1.24.58; 1.24.60; 1.24.62; 1.24.66;
merge yamt-pf42 branch.
(import newer pf from OpenBSD 4.2)

ok'ed by peter@. requested by core@
 1.23 04-Mar-2007  christos branches: 1.23.36; 1.23.38; 1.23.40; 1.23.42; 1.23.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.22 16-Nov-2006  christos branches: 1.22.4;
__unused removal on arguments; approved by core.
 1.21 20-Oct-2006  elad Kill some KAUTH_GENERIC_ISSUSER.
 1.20 13-Oct-2006  peter Only compile in pf specific code when pf is configured.
Fixes kernel build when ALTQ is configured and pf not.
 1.19 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.18 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.17 21-Jul-2006  ad branches: 1.17.4; 1.17.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.16 15-May-2006  christos kauth fallout
 1.15 14-May-2006  elad integrate kauth.
 1.14 23-Apr-2006  christos Complete the FREE -> free transition and add more NULL checks for malloc
returns. Although these cannot happen because M_WAITOK, the rest of the
code does them already, so this is good for consistency. From Mindaugas
 1.13 23-Apr-2006  christos Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.12 24-Dec-2005  perry branches: 1.12.4; 1.12.6; 1.12.8; 1.12.10; 1.12.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 26-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 13-Feb-2004  wiz branches: 1.9.8; 1.9.10;
Uppercase CPU, plural is CPUs.
 1.8 09-Nov-2003  christos - kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.7 06-Jan-2003  christos branches: 1.7.2;
avoid name collision [class_stats]
 1.6 18-May-2002  itojun sync with KAME.
- don't MALLOC() with M_WAITOK in the spl block.
move the allocation before splnet().
- when we reset vt of a class, reset the runtime service curve as well.
- don't use max() to compare 64 bit values.
 1.5 12-Nov-2001  lukem branches: 1.5.8;
add RCSIDs
 1.4 26-Oct-2001  itojun avoid divide-by-zero when the specified bandwidth is less than 8bps.
OpenBSD PR: kernel/2150
 1.3 13-Apr-2001  thorpej branches: 1.3.2; 1.3.4; 1.3.6;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.4 07-Jan-2003  thorpej Sync with HEAD.
 1.2.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_hfsc.c was added on branch thorpej_scsipi on 2001-01-05 17:39:36 +0000
 1.3.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.3.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.8.1 30-May-2002  gehenna Catch up with -current.
 1.7.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.2 12-Aug-2004  skrll Adapt to new world order.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.4.3 03-Sep-2007  yamt sync with head.
 1.10.4.2 30-Dec-2006  yamt sync with head.
 1.10.4.1 21-Jun-2006  yamt sync with head.
 1.12.12.3 25-Sep-2006  peter sync with head.
 1.12.12.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.12.12.1 18-Mar-2006  peter Sync with KAME.
 1.12.10.3 11-May-2006  elad sync with head
 1.12.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.12.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.12.8.2 11-Aug-2006  yamt sync with head
 1.12.8.1 24-May-2006  yamt sync with head.
 1.12.6.1 01-Jun-2006  kardel Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.17.6.2 10-Dec-2006  yamt sync with head.
 1.17.6.1 22-Oct-2006  yamt sync with head
 1.17.4.1 18-Nov-2006  ad Sync with head.
 1.22.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.23.44.1 18-Jun-2008  simonb Sync with head.
 1.23.42.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.23.40.1 04-May-2009  yamt sync with head.
 1.23.38.1 24-Apr-2008  peter Add PACKET_TAG_ALTQ_QID and use it for pf/ALTQ. The ALTQ code compiles now.

ok yamt@
 1.23.36.1 29-Jun-2008  mjf Sync with HEAD.
 1.24.66.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.24.62.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.24.60.3 28-Aug-2017  skrll Sync with HEAD
 1.24.60.2 22-Apr-2016  skrll Sync with HEAD
 1.24.60.1 19-Mar-2016  skrll Sync with HEAD
 1.24.58.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.24.52.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.24.42.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.24.40.1 03-Dec-2017  jdolecek update from HEAD
 1.24.36.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.26.10.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1831):

sys/altq/altq_hfsc.c: revision 1.29
sys/altq/altq_priq.c: revision 1.27

sys/altq: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.26.10.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #198):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.27.4.1 10-Jun-2019  christos Sync with HEAD
 1.27.2.1 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.28.4.1 03-Aug-2022  martin Pull up following revision(s) (requested by riastradh in ticket #1488):

sys/altq/altq_hfsc.c: revision 1.29
sys/altq/altq_priq.c: revision 1.27

sys/altq: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.30.8.1 02-Aug-2025  perseant Sync with HEAD
 1.30.6.1 11-Nov-2023  thorpej Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.8 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.7 11-Dec-2005  christos branches: 1.7.12; 1.7.20; 1.7.22;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 06-Jan-2003  christos branches: 1.5.2; 1.5.10; 1.5.12;
fix typo, from David Laight.
 1.4 06-Jan-2003  christos oops, forgot to rename two struct refs.
 1.3 06-Jan-2003  christos avoid name collision [class_stats]
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.1 07-Jan-2003  thorpej Sync with HEAD.
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_hfsc.h was added on branch thorpej_scsipi on 2001-01-05 17:39:36 +0000
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.1 30-Dec-2006  yamt sync with head.
 1.7.22.1 22-Oct-2006  yamt sync with head
 1.7.20.1 18-Nov-2006  ad Sync with head.
 1.7.12.1 18-Mar-2006  peter Sync with KAME.
 1.15 18-Aug-2025  andvar Fix various typos, mainly in comments:
s/invaid/invalid/
s/instad/instead/
s/wich/with/
s/tranform/transform/
s/tranmist/transmit/
s/tranceiver/transceiver/
s/Tranparent/Transparent/
s/tranlated/translated/
s/tranfer/transfer/
s/tranmissions/transmissions/
s/condtions/conditions/
s/Recient/Recent/
 1.14 08-Jan-2025  joe return: remove parenthesis from return statements
 1.13 03-Jan-2025  joe compile time: use right jobs interface and return value
 1.12 21-Sep-2021  christos branches: 1.12.6; 1.12.8;
Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.11 28-Jul-2017  riastradh Zero buffers copied to userland to avoid stack disclosure.

From Ilja Van Sprundel.
 1.10 21-Nov-2016  dholland branches: 1.10.8;
PR 51553 David Binderman: don't bother counting up backlogged classes
when not doing anything with the results.
 1.9 20-Apr-2016  knakahara branches: 1.9.2;
IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
 1.8 22-Jan-2016  christos Prevent interface deletion from running into an infinite loop when altq closes.
$ cat /etc/altq.conf
interface ppp0 bandwidth 10M priq
class priq ppp0 high_class_ppp NULL priority 1
class priq ppp0 low_class_ppp NULL priority 0 default
filter ppp0 high_class_ppp 0 0 0 0 1
$ ifconfig ppp0 create
$ /etc/rc.d/altqd onestart
$ ifconfig ppp0 destroy
$ pkill altqd
XXX: pullup-7
 1.7 18-Aug-2014  riastradh branches: 1.7.2;
Fix error branches to avoid leaks, noted by maxv@.
 1.6 09-Apr-2010  plunky branches: 1.6.14; 1.6.18; 1.6.20; 1.6.28; 1.6.34;
rename the altq-defined INFINITY symbol to ALTQ_INFINITY

- it is not infinity
- it is exposed to userland
- it causes confusion when #include <math.h> follows
(I don't know why GCC does not object to redefining the symbol)
 1.5 04-Mar-2007  christos branches: 1.5.40; 1.5.62; 1.5.64;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 16-Nov-2006  christos branches: 1.4.4; 1.4.6;
__unused removal on arguments; approved by core.
 1.3 20-Oct-2006  elad Kill another KAUTH_GENERIC_ISSUSER.
 1.2 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.1 18-Mar-2006  peter branches: 1.1.2; 1.1.6; 1.1.8;
file altq_jobs.c was initially added on branch peter-altq.
 1.1.8.2 10-Dec-2006  yamt sync with head.
 1.1.8.1 22-Oct-2006  yamt sync with head
 1.1.6.1 18-Nov-2006  ad Sync with head.
 1.1.2.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.1.2.1 18-Mar-2006  peter Sync with KAME.
 1.4.6.1 12-Mar-2007  rmind Sync with HEAD.
 1.4.4.3 03-Sep-2007  yamt sync with head.
 1.4.4.2 30-Dec-2006  yamt sync with head.
 1.4.4.1 16-Nov-2006  yamt file altq_jobs.c was added on branch yamt-lazymbuf on 2006-12-30 20:45:17 +0000
 1.5.64.1 30-May-2010  rmind sync with head
 1.5.62.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.5.40.1 11-Aug-2010  yamt sync with head.
 1.6.34.2 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.6.34.1 22-Aug-2014  martin branches: 1.6.34.1.2; 1.6.34.1.6;
Pull up following revision(s) (requested by riastradh in ticket #44):
sys/altq/altq_jobs.c 1.7
Fix error branches to avoid leaks, noted by maxv@.
sys/dev/ic/oosiop.c 1.14
Fix leaks in oosiop_alloc_cb error branches, noted by maxv@.
While here, avoid a sketchy pointer cast that probably falls afoul
of strict aliasing rules.
sys/dev/qbus/if_qe.c 1.73
Avoid leak in error branch, noted by maxv@, compile-tested for vax.
sys/dev/rasops/rasops.c 1.72
Don't leak f on failure. Noted by maxv@.
sys/dev/vme/if_ie_vme.c 1.31
Sizeof struct ievme, not sizeof size_t.
Noted by maxv@, compile-tested for sparc.
sys/net/if_gre.c 1.160
Don't leak in gre_clone_create error branch.
Noted by maxv@, compile-tested for amd64.
 1.6.34.1.6.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.6.34.1.2.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.6.28.2 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.6.28.1 03-Nov-2014  msaitoh Pull up following revision(s) (requested by riastradh in ticket #1117):
sys/dev/rasops/rasops.c: revision 1.72
sys/dev/vme/if_ie_vme.c: revision 1.31
sys/dev/qbus/if_qe.c: revision 1.73
sys/altq/altq_jobs.c: revision 1.7
sys/net/if_gre.c: revision 1.160
sys/dev/ic/oosiop.c: revision 1.14
- Fix error branches in altq_jobs.c to avoid leaks, noted by maxv@.
- Fix leaks in oosiop_alloc_cb error branches, noted by maxv@.
While here, avoid a sketchy pointer cast that probably falls afoul of
strict aliasing rules. Compile-tested only, with hppa.
- Don't leak f on failurein rasops.c. Noted by maxv@.
Compile-tested only, with zaurus.
- Avoid leak in error branch in if_qe.c, noted by maxv@, compile-tested for
vax.
- Sizeof struct ievme, not sizeof size_t in if_ie_vme.c.
Noted by maxv@, compile-tested for sparc.
- Don't leak in gre_clone_create error branch.
Noted by maxv@, compile-tested for amd64.
 1.6.20.2 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.6.20.1 03-Nov-2014  msaitoh Pull up following revision(s) (requested by riastradh in ticket #1117):
sys/dev/rasops/rasops.c: revision 1.72
sys/dev/vme/if_ie_vme.c: revision 1.31
sys/dev/qbus/if_qe.c: revision 1.73
sys/altq/altq_jobs.c: revision 1.7
sys/net/if_gre.c: revision 1.160
sys/dev/ic/oosiop.c: revision 1.14
- Fix error branches in altq_jobs.c to avoid leaks, noted by maxv@.
- Fix leaks in oosiop_alloc_cb error branches, noted by maxv@.
While here, avoid a sketchy pointer cast that probably falls afoul of
strict aliasing rules. Compile-tested only, with hppa.
- Don't leak f on failurein rasops.c. Noted by maxv@.
Compile-tested only, with zaurus.
- Avoid leak in error branch in if_qe.c, noted by maxv@, compile-tested for
vax.
- Sizeof struct ievme, not sizeof size_t in if_ie_vme.c.
Noted by maxv@, compile-tested for sparc.
- Don't leak in gre_clone_create error branch.
Noted by maxv@, compile-tested for amd64.
 1.6.18.1 03-Dec-2017  jdolecek update from HEAD
 1.6.14.2 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.6.14.1 03-Nov-2014  msaitoh Pull up following revision(s) (requested by riastradh in ticket #1117):
sys/dev/rasops/rasops.c: revision 1.72
sys/dev/vme/if_ie_vme.c: revision 1.31
sys/dev/qbus/if_qe.c: revision 1.73
sys/altq/altq_jobs.c: revision 1.7
sys/net/if_gre.c: revision 1.160
sys/dev/ic/oosiop.c: revision 1.14
- Fix error branches in altq_jobs.c to avoid leaks, noted by maxv@.
- Fix leaks in oosiop_alloc_cb error branches, noted by maxv@.
While here, avoid a sketchy pointer cast that probably falls afoul of
strict aliasing rules. Compile-tested only, with hppa.
- Don't leak f on failurein rasops.c. Noted by maxv@.
Compile-tested only, with zaurus.
- Avoid leak in error branch in if_qe.c, noted by maxv@, compile-tested for
vax.
- Sizeof struct ievme, not sizeof size_t in if_ie_vme.c.
Noted by maxv@, compile-tested for sparc.
- Don't leak in gre_clone_create error branch.
Noted by maxv@, compile-tested for amd64.
 1.7.2.4 28-Aug-2017  skrll Sync with HEAD
 1.7.2.3 05-Dec-2016  skrll Sync with HEAD
 1.7.2.2 22-Apr-2016  skrll Sync with HEAD
 1.7.2.1 19-Mar-2016  skrll Sync with HEAD
 1.9.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.10.8.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #198):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.12.8.1 02-Aug-2025  perseant Sync with HEAD
 1.12.6.1 11-Nov-2023  thorpej Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.6 10-Feb-2025  joe whitespace: clear trailing whitespaces
 1.5 09-Apr-2010  plunky branches: 1.5.96;
rename the altq-defined INFINITY symbol to ALTQ_INFINITY

- it is not infinity
- it is exposed to userland
- it causes confusion when #include <math.h> follows
(I don't know why GCC does not object to redefining the symbol)
 1.4 29-Aug-2008  gmcgarry branches: 1.4.14; 1.4.16;
Don't redefine INFINITY.
 1.3 12-Oct-2006  peter branches: 1.3.4; 1.3.50; 1.3.54; 1.3.56; 1.3.60;
Use another number for JOBS_CLEAR because it clashes with PRIQ_CLEAR.
 1.2 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.1 18-Mar-2006  peter branches: 1.1.2; 1.1.6; 1.1.8;
file altq_jobs.h was initially added on branch peter-altq.
 1.1.8.1 22-Oct-2006  yamt sync with head
 1.1.6.1 18-Nov-2006  ad Sync with head.
 1.1.2.1 18-Mar-2006  peter Sync with KAME.
 1.3.60.1 19-Oct-2008  haad Sync with HEAD.
 1.3.56.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.3.54.2 11-Aug-2010  yamt sync with head.
 1.3.54.1 04-May-2009  yamt sync with head.
 1.3.50.1 28-Sep-2008  mjf Sync with HEAD.
 1.3.4.2 30-Dec-2006  yamt sync with head.
 1.3.4.1 12-Oct-2006  yamt file altq_jobs.h was added on branch yamt-lazymbuf on 2006-12-30 20:45:17 +0000
 1.4.16.1 30-May-2010  rmind sync with head
 1.4.14.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.5.96.1 02-Aug-2025  perseant Sync with HEAD
 1.10 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 16-Nov-2006  christos branches: 1.9.4;
__unused removal on arguments; approved by core.
 1.8 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.7 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.6 11-Dec-2005  christos branches: 1.6.12; 1.6.20; 1.6.22;
merge ktrace-lwp.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 12-Nov-2001  lukem branches: 1.4.16; 1.4.24; 1.4.26;
add RCSIDs
 1.3 22-Aug-2001  itojun branches: 1.3.2;
copyright clarification (the skeleton file is in public domain)
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4; 1.2.6;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.6.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 21-Sep-2001  nathanw Catch up to -current.
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_localq.c was added on branch thorpej_scsipi on 2001-01-05 17:39:36 +0000
 1.3.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.4.26.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.24.1 29-Apr-2005  kent sync with -current
 1.4.16.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.16.1 12-Aug-2004  skrll Adapt to new world order.
 1.5.4.3 03-Sep-2007  yamt sync with head.
 1.5.4.2 30-Dec-2006  yamt sync with head.
 1.5.4.1 21-Jun-2006  yamt sync with head.
 1.6.22.2 10-Dec-2006  yamt sync with head.
 1.6.22.1 22-Oct-2006  yamt sync with head
 1.6.20.1 18-Nov-2006  ad Sync with head.
 1.6.12.1 18-Mar-2006  peter Sync with KAME.
 1.9.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.29 08-Jan-2025  joe return: remove parenthesis from return statements
 1.28 21-Sep-2021  christos branches: 1.28.6; 1.28.8;
Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.27 30-Aug-2021  riastradh sys/altq: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.26 15-Nov-2018  maxv branches: 1.26.4;
Remove the 't' argument from m_tag_find().
 1.25 15-Jun-2018  mrg branches: 1.25.2;
simplify priq_class_create(): if the alloc for cl_q fails,
then only clean up required to to free cl. delete all the
code at err_ret that was probably used in the past, and move
the free + return upon failure earlier.
 1.24 28-Jul-2017  riastradh branches: 1.24.2;
Zero buffers copied to userland to avoid stack disclosure.

From Ilja Van Sprundel.
 1.23 20-Apr-2016  knakahara branches: 1.23.10;
IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
 1.22 22-Jan-2016  christos Prevent interface deletion from running into an infinite loop when altq closes.
$ cat /etc/altq.conf
interface ppp0 bandwidth 10M priq
class priq ppp0 high_class_ppp NULL priority 1
class priq ppp0 low_class_ppp NULL priority 0 default
filter ppp0 high_class_ppp 0 0 0 0 1
$ ifconfig ppp0 create
$ /etc/rc.d/altqd onestart
$ ifconfig ppp0 destroy
$ pkill altqd
XXX: pullup-7
 1.21 14-Mar-2009  dsl branches: 1.21.18; 1.21.22; 1.21.24; 1.21.32; 1.21.38; 1.21.40; 1.21.42; 1.21.46;
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.20 18-Jun-2008  yamt branches: 1.20.4; 1.20.10;
merge yamt-pf42 branch.
(import newer pf from OpenBSD 4.2)

ok'ed by peter@. requested by core@
 1.19 04-Mar-2007  christos branches: 1.19.36; 1.19.38; 1.19.40; 1.19.42; 1.19.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 16-Nov-2006  christos branches: 1.18.4;
__unused removal on arguments; approved by core.
 1.17 20-Oct-2006  elad Kill some KAUTH_GENERIC_ISSUSER.
 1.16 13-Oct-2006  peter Only compile in pf specific code when pf is configured.
Fixes kernel build when ALTQ is configured and pf not.
 1.15 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 21-Jul-2006  ad branches: 1.13.4; 1.13.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.12 15-May-2006  christos kauth fallout
 1.11 14-May-2006  elad integrate kauth.
 1.10 23-Apr-2006  christos Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.9 11-Dec-2005  christos branches: 1.9.4; 1.9.6; 1.9.8; 1.9.10; 1.9.12;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 09-Nov-2003  christos branches: 1.7.8; 1.7.10;
- kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.6 06-Jan-2003  christos branches: 1.6.2;
avoid name collision [class_stats]
 1.5 12-Nov-2001  lukem add RCSIDs
 1.4 26-Oct-2001  itojun avoid divide-by-zero when the specified bandwidth is less than 8bps.
OpenBSD PR: kernel/2150
 1.3 13-Apr-2001  thorpej branches: 1.3.2; 1.3.4; 1.3.6;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.3 07-Jan-2003  thorpej Sync with HEAD.
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_priq.c was added on branch thorpej_scsipi on 2001-01-05 17:39:37 +0000
 1.3.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.3.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.2 12-Aug-2004  skrll Adapt to new world order.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.8.4.3 03-Sep-2007  yamt sync with head.
 1.8.4.2 30-Dec-2006  yamt sync with head.
 1.8.4.1 21-Jun-2006  yamt sync with head.
 1.9.12.3 25-Sep-2006  peter sync with head.
 1.9.12.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.9.12.1 18-Mar-2006  peter Sync with KAME.
 1.9.10.3 11-May-2006  elad sync with head
 1.9.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.9.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.9.8.2 11-Aug-2006  yamt sync with head
 1.9.8.1 24-May-2006  yamt sync with head.
 1.9.6.1 01-Jun-2006  kardel Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.13.6.2 10-Dec-2006  yamt sync with head.
 1.13.6.1 22-Oct-2006  yamt sync with head
 1.13.4.1 18-Nov-2006  ad Sync with head.
 1.18.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.44.1 18-Jun-2008  simonb Sync with head.
 1.19.42.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.19.40.1 04-May-2009  yamt sync with head.
 1.19.38.1 24-Apr-2008  peter Add PACKET_TAG_ALTQ_QID and use it for pf/ALTQ. The ALTQ code compiles now.

ok yamt@
 1.19.36.1 29-Jun-2008  mjf Sync with HEAD.
 1.20.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.21.46.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.21.42.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.21.40.3 28-Aug-2017  skrll Sync with HEAD
 1.21.40.2 22-Apr-2016  skrll Sync with HEAD
 1.21.40.1 19-Mar-2016  skrll Sync with HEAD
 1.21.38.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.21.32.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.21.24.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.21.22.1 03-Dec-2017  jdolecek update from HEAD
 1.21.18.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.23.10.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1831):

sys/altq/altq_hfsc.c: revision 1.29
sys/altq/altq_priq.c: revision 1.27

sys/altq: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.23.10.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #198):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.24.2.2 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.24.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.25.2.1 10-Jun-2019  christos Sync with HEAD
 1.26.4.1 03-Aug-2022  martin Pull up following revision(s) (requested by riastradh in ticket #1488):

sys/altq/altq_hfsc.c: revision 1.29
sys/altq/altq_priq.c: revision 1.27

sys/altq: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.28.8.1 02-Aug-2025  perseant Sync with HEAD
 1.28.6.1 11-Nov-2023  thorpej Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.7 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.6 11-Dec-2005  christos branches: 1.6.12; 1.6.20; 1.6.22;
merge ktrace-lwp.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 06-Jan-2003  christos branches: 1.4.2; 1.4.10; 1.4.12;
oops, forgot to rename two struct refs.
 1.3 06-Jan-2003  christos avoid name collision [class_stats]
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.1 07-Jan-2003  thorpej Sync with HEAD.
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_priq.h was added on branch thorpej_scsipi on 2001-01-05 17:39:37 +0000
 1.4.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.10.1 29-Apr-2005  kent sync with -current
 1.4.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.4.1 30-Dec-2006  yamt sync with head.
 1.6.22.1 22-Oct-2006  yamt sync with head
 1.6.20.1 18-Nov-2006  ad Sync with head.
 1.6.12.1 18-Mar-2006  peter Sync with KAME.
 1.36 08-Jan-2025  joe return: remove parenthesis from return statements
 1.35 05-Dec-2021  msaitoh branches: 1.35.6; 1.35.8;
s/failes/fails/ in comment.
 1.34 21-Sep-2021  christos Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.33 03-Sep-2021  andvar fix typos in comments, mainly s/extention/extension/ and s/sufficent/sufficient/
 1.32 26-Dec-2019  msaitoh s/lenght/length/
 1.31 15-Nov-2018  maxv Remove the 't' argument from m_tag_find().
 1.30 20-Apr-2016  knakahara branches: 1.30.16; 1.30.18;
IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
 1.29 19-Nov-2011  tls branches: 1.29.8; 1.29.26;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

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

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

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

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

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

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

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

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

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

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

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

Manual pages for the new kernel interfaces are forthcoming.
 1.28 18-Jun-2008  yamt branches: 1.28.30;
merge yamt-pf42 branch.
(import newer pf from OpenBSD 4.2)

ok'ed by peter@. requested by core@
 1.27 20-Jan-2008  joerg branches: 1.27.6; 1.27.8; 1.27.10; 1.27.12; 1.27.14;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.26 26-Mar-2007  hubertf branches: 1.26.10; 1.26.16; 1.26.22;
Remove duplicate #include <sys/kauth.h>
From: Slava Semushin <php-coder@altlinux.ru>
 1.25 04-Mar-2007  christos branches: 1.25.2; 1.25.4; 1.25.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.24 16-Nov-2006  christos branches: 1.24.4;
__unused removal on arguments; approved by core.
 1.23 20-Oct-2006  elad Kill some KAUTH_GENERIC_ISSUSER.
 1.22 13-Oct-2006  peter Only compile in pf specific code when pf is configured.
Fixes kernel build when ALTQ is configured and pf not.
 1.21 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.20 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.19 21-Jul-2006  ad branches: 1.19.4; 1.19.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.18 07-Jun-2006  christos fix timecounter fallout
 1.17 15-May-2006  christos branches: 1.17.2;
kauth fallout
 1.16 14-May-2006  elad integrate kauth.
 1.15 23-Apr-2006  christos Complete the FREE -> free transition and add more NULL checks for malloc
returns. Although these cannot happen because M_WAITOK, the rest of the
code does them already, so this is good for consistency. From Mindaugas
 1.14 23-Apr-2006  christos Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.13 24-Dec-2005  perry branches: 1.13.4; 1.13.6; 1.13.8; 1.13.10; 1.13.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 26-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 13-Feb-2004  wiz branches: 1.10.8; 1.10.10;
Spell length with h after t. Inspired by a commit by brad@openbsd.
 1.9 09-Nov-2003  christos - kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.8 07-Oct-2003  mycroft There is NO reason to use arc4random() here, and it needlessly slows down the
forwarding path, so goodbye.
 1.7 05-Sep-2003  itojun use arc4random. sync w/ kame
 1.6 05-Mar-2002  itojun branches: 1.6.14;
bring in latest ALTQ from kjc. ALTQify some of the drivers.
 1.5 12-Nov-2001  lukem add RCSIDs
 1.4 05-Jul-2001  toshii branches: 1.4.2; 1.4.4;
Fix typo. s/extention/extension/
 1.3 13-Apr-2001  thorpej Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.2 24-Aug-2001  nathanw Catch up with -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_red.c was added on branch thorpej_scsipi on 2001-01-05 17:39:37 +0000
 1.4.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.4.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.14.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.14.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.14.3 18-Sep-2004  skrll Sync with HEAD.
 1.6.14.2 12-Aug-2004  skrll Adapt to new world order.
 1.6.14.1 03-Aug-2004  skrll Sync with HEAD
 1.10.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.8.1 29-Apr-2005  kent sync with -current
 1.11.4.4 21-Jan-2008  yamt sync with head
 1.11.4.3 03-Sep-2007  yamt sync with head.
 1.11.4.2 30-Dec-2006  yamt sync with head.
 1.11.4.1 21-Jun-2006  yamt sync with head.
 1.13.12.4 25-Sep-2006  peter sync with head.
 1.13.12.3 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.13.12.2 18-Mar-2006  peter Put some old ALTQ code into #ifdef ALTQ3_COMPAT.
 1.13.12.1 18-Mar-2006  peter Sync with KAME.
 1.13.10.3 11-May-2006  elad sync with head
 1.13.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.13.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.13.8.3 11-Aug-2006  yamt sync with head
 1.13.8.2 26-Jun-2006  yamt sync with head.
 1.13.8.1 24-May-2006  yamt sync with head.
 1.13.6.1 01-Jun-2006  kardel Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.17.2.1 19-Jun-2006  chap Sync with head.
 1.19.6.2 10-Dec-2006  yamt sync with head.
 1.19.6.1 22-Oct-2006  yamt sync with head
 1.19.4.1 18-Nov-2006  ad Sync with head.
 1.24.4.2 15-Apr-2007  yamt sync with head.
 1.24.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.25.6.1 29-Mar-2007  reinoud Pullup to -current
 1.25.4.1 11-Jul-2007  mjf Sync with head.
 1.25.2.1 10-Apr-2007  ad Sync with head.
 1.26.22.1 23-Jan-2008  bouyer Sync with HEAD.
 1.26.16.1 18-Feb-2008  mjf Sync with HEAD.
 1.26.10.1 23-Mar-2008  matt sync with HEAD
 1.27.14.1 18-Jun-2008  simonb Sync with head.
 1.27.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.27.10.1 04-May-2009  yamt sync with head.
 1.27.8.1 24-Apr-2008  peter Add PACKET_TAG_ALTQ_QID and use it for pf/ALTQ. The ALTQ code compiles now.

ok yamt@
 1.27.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.28.30.1 17-Apr-2012  yamt sync with head
 1.29.26.1 22-Apr-2016  skrll Sync with HEAD
 1.29.8.1 03-Dec-2017  jdolecek update from HEAD
 1.30.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.30.18.1 10-Jun-2019  christos Sync with HEAD
 1.30.16.1 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.35.8.1 02-Aug-2025  perseant Sync with HEAD
 1.35.6.1 11-Nov-2023  thorpej Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.5 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.4 11-Dec-2005  christos branches: 1.4.12; 1.4.20; 1.4.22;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.26; 1.2.34; 1.2.36;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.36.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.34.1 29-Apr-2005  kent sync with -current
 1.2.26.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_red.h was added on branch thorpej_scsipi on 2001-01-05 17:39:37 +0000
 1.3.4.1 30-Dec-2006  yamt sync with head.
 1.4.22.1 22-Oct-2006  yamt sync with head
 1.4.20.1 18-Nov-2006  ad Sync with head.
 1.4.12.1 18-Mar-2006  peter Sync with KAME.
 1.26 08-Jan-2025  joe return: remove parenthesis from return statements
 1.25 21-Sep-2021  christos branches: 1.25.6; 1.25.8;
Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.24 26-Dec-2019  msaitoh s/lenght/length/
 1.23 16-May-2016  ozaki-r branches: 1.23.18;
Use M_GETCTX and M_SETCTX instead of open-coding rcvif

No functional change.
 1.22 20-Apr-2016  knakahara IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
 1.21 18-Apr-2009  tsutsui branches: 1.21.22; 1.21.40;
Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
 1.20 18-Mar-2009  cegger bcopy -> memcpy
 1.19 04-Mar-2007  christos branches: 1.19.40; 1.19.50; 1.19.56;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 24-Jan-2007  hubertf branches: 1.18.2;
Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

To verify that no nasty side effects of duplicate includes (or their
removal) have an effect here, I've compiled an i386/ALL kernel with
and without the patch, and the only difference in the resulting .o
files was in shifted line numbers in some assert() calls.
The comparison of the .o files was based on the output of "objdump -D".

Thanks to martin@ for the input on testing.
 1.17 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.16 20-Oct-2006  elad Kill some KAUTH_GENERIC_ISSUSER.
 1.15 13-Oct-2006  peter Only compile in pf specific code when pf is configured.
Fixes kernel build when ALTQ is configured and pf not.
 1.14 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.13 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.12 21-Jul-2006  ad branches: 1.12.4; 1.12.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.11 15-May-2006  christos kauth fallout
 1.10 14-May-2006  elad integrate kauth.
 1.9 23-Apr-2006  christos Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.8 11-Dec-2005  christos branches: 1.8.4; 1.8.6; 1.8.8; 1.8.10; 1.8.12;
merge ktrace-lwp.
 1.7 26-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 13-Feb-2004  wiz branches: 1.6.8; 1.6.10;
Spell length with h after t. Inspired by a commit by brad@openbsd.
 1.5 09-Nov-2003  christos - kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.4 12-Nov-2001  lukem branches: 1.4.16;
add RCSIDs
 1.3 13-Apr-2001  thorpej branches: 1.3.2; 1.3.4;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_rio.c was added on branch thorpej_scsipi on 2001-01-05 17:39:37 +0000
 1.3.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.16.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.16.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.16.3 18-Sep-2004  skrll Sync with HEAD.
 1.4.16.2 12-Aug-2004  skrll Adapt to new world order.
 1.4.16.1 03-Aug-2004  skrll Sync with HEAD
 1.6.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.8.1 29-Apr-2005  kent sync with -current
 1.7.4.4 03-Sep-2007  yamt sync with head.
 1.7.4.3 26-Feb-2007  yamt sync with head.
 1.7.4.2 30-Dec-2006  yamt sync with head.
 1.7.4.1 21-Jun-2006  yamt sync with head.
 1.8.12.3 25-Sep-2006  peter sync with head.
 1.8.12.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.8.12.1 18-Mar-2006  peter Sync with KAME.
 1.8.10.3 11-May-2006  elad sync with head
 1.8.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.8.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.8.8.2 11-Aug-2006  yamt sync with head
 1.8.8.1 24-May-2006  yamt sync with head.
 1.8.6.1 01-Jun-2006  kardel Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.12.6.2 10-Dec-2006  yamt sync with head.
 1.12.6.1 22-Oct-2006  yamt sync with head
 1.12.4.2 01-Feb-2007  ad Sync with head.
 1.12.4.1 18-Nov-2006  ad Sync with head.
 1.18.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.56.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.19.50.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.40.1 04-May-2009  yamt sync with head.
 1.21.40.2 29-May-2016  skrll Sync with HEAD
 1.21.40.1 22-Apr-2016  skrll Sync with HEAD
 1.21.22.1 03-Dec-2017  jdolecek update from HEAD
 1.23.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.25.8.1 02-Aug-2025  perseant Sync with HEAD
 1.25.6.1 11-Nov-2023  thorpej Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.5 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.4 11-Dec-2005  christos branches: 1.4.12; 1.4.20; 1.4.22;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.26; 1.2.34; 1.2.36;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.36.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.34.1 29-Apr-2005  kent sync with -current
 1.2.26.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_rio.h was added on branch thorpej_scsipi on 2001-01-05 17:39:37 +0000
 1.3.4.1 30-Dec-2006  yamt sync with head.
 1.4.22.1 22-Oct-2006  yamt sync with head
 1.4.20.1 18-Nov-2006  ad Sync with head.
 1.4.12.1 18-Mar-2006  peter Sync with KAME.
 1.32 08-Jan-2025  joe return: remove parenthesis from return statements
 1.31 01-Jul-2024  ozaki-r altq, cbq: take care of borrowed classes on sleeping

rmc_under_limit() determines if we can send a packet by checking
that a target class (or borrowing classes) is ready to send a
packet. cl->undertime_ indicates a time that the class can send
packets after the time. So if cl->undertime_ has passed
(i.e., now >= cl->undertime_), we can send packets through the class.

The treatment is important when a required delay period is shorten
than the minimum delay on the system (a tick), because in that case
the delay handler is too late to wake up to send a packet in time.
If there are traffic, rmc_under_limit() can save such a case.

Unfortunately, the old code didn't take care of bandwidth borrowing
on sleeping. So bandwidth borrowing didn't work well with high
bandwidths that require short delay actions.
 1.30 09-Feb-2024  andvar branches: 1.30.2;
fix spelling mistakes, mainly in comments and log messages.
 1.29 21-Jul-2021  ozaki-r branches: 1.29.10;
altq: fix CBQ with RED and/or pf
 1.28 21-Jul-2021  ozaki-r altq, cbq: apply tweaks for PPP to only PPP interfaces
 1.27 21-Jul-2021  ozaki-r altq, cbq: change long to uint64_t for ILP32 archs

PR kern/56319
 1.26 21-Jul-2021  ozaki-r altq, cbq: treat time in nanoseconds

Time granularity in microseconds is sometimes not enough to provide
accurate bandwidth control; actual bandwidth on a capped class
can exceed its limit considerably in some cases.

Treating time in nanoseconds requires the following changes:
- Use timespec instead of timeval
- Use nanotime(9) instead of microtime(9)
- Change the type of some variables, especially *idle, to long
 1.25 21-Jul-2021  ozaki-r altq, cbq: convert ns_per_byte to ps_per_byte

Also the type of variables of it is changed to u_long from int.

This change provides fine-grain resolution of bandwidth. For example
750 Mbps was treated as 800 Mbps internally because bandwidth was
represented as nanoseconds per byte. Converting the representation
to picoseconds per byte enables to treat 750 Mbps as-is.

PR kern/56319
 1.24 13-Jul-2021  ozaki-r altq, cbq: calculate a delay period based on a borrowed class

A delay period was calculated based on a suspended class even if the
class can borrow bandwidth from another class. In that case a delay
period should be calculated based on a borrowed class. Otherwise
a borrowing class can't borrow bandwidth correctly.
 1.23 13-Jul-2021  ozaki-r altq, cbq: don't increment the xmit counter of the root class twice wrongly
 1.22 19-Nov-2011  tls branches: 1.22.66;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

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

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

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

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

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

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

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

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

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

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

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

Manual pages for the new kernel interfaces are forthcoming.
 1.21 15-Jul-2008  christos branches: 1.21.28;
Use more timespecs internally. From Alexander Shishkin and me.
Welcome to 4.99.70, 30 more to go for 100.
 1.20 04-Mar-2007  christos branches: 1.20.36; 1.20.40; 1.20.42; 1.20.44; 1.20.46;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 20-Dec-2006  rpaulo branches: 1.19.2;
Comment out #ident.
 1.18 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.17 28-Oct-2006  peter Don't allow to initialize an interface with MTU smaller than one.
This prevents a divide by zero and fixes PR #21474.

ok tron@
 1.16 24-Oct-2006  mrg avoid shadowing "delay"
 1.15 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 23-Apr-2006  christos branches: 1.13.8; 1.13.10;
Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.12 25-Feb-2006  wiz branches: 1.12.2; 1.12.4; 1.12.6;
Fix some typos.
 1.11 11-Dec-2005  christos branches: 1.11.2; 1.11.4; 1.11.6;
merge ktrace-lwp.
 1.10 13-Jul-2005  mrg rename shadowing variable delay to nowdelay.
 1.9 26-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 09-Nov-2003  christos branches: 1.8.8; 1.8.10;
- kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.7 07-Oct-2003  mycroft There is NO reason to use arc4random() here, and it needlessly slows down the
forwarding path, so goodbye.
 1.6 05-Sep-2003  itojun use arc4random. sync w/ kame
 1.5 12-Nov-2001  lukem branches: 1.5.16;
add RCSIDs
 1.4 13-Apr-2001  thorpej branches: 1.4.2;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.3 06-Apr-2001  thorpej From KAME:

kjc 2001/02/09 16:20:40 JST

Modified files:
kame/sys/altq altq_classq.h altq_rmclass.c
Log:
clear m_nextpkt at dequeueing a packet.

this is not needed in the current code but
requested by Lars Eggert <larse@ISI.EDU> for
their experiment to use altq for inbound processing.

Revision Changes Path
1.4 +4 -1 kame/kame/sys/altq/altq_classq.h
1.10 +4 -1 kame/kame/sys/altq/altq_rmclass.c
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.2.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_rmclass.c was added on branch thorpej_scsipi on 2001-01-05 17:39:37 +0000
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.16.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.16.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.16.1 03-Aug-2004  skrll Sync with HEAD
 1.8.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.8.1 29-Apr-2005  kent sync with -current
 1.9.4.3 03-Sep-2007  yamt sync with head.
 1.9.4.2 30-Dec-2006  yamt sync with head.
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.11.6.2 01-Jun-2006  kardel Sync with head.
 1.11.6.1 22-Apr-2006  simonb Sync with head.
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.11.2.1 01-Mar-2006  yamt sync with head.
 1.12.6.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.12.6.1 18-Mar-2006  peter Sync with KAME.
 1.12.4.1 11-May-2006  elad sync with head
 1.12.2.1 24-May-2006  yamt sync with head.
 1.13.10.3 21-Dec-2006  yamt sync with head.
 1.13.10.2 10-Dec-2006  yamt sync with head.
 1.13.10.1 22-Oct-2006  yamt sync with head
 1.13.8.2 12-Jan-2007  ad Sync with head.
 1.13.8.1 18-Nov-2006  ad Sync with head.
 1.19.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.20.46.1 19-Oct-2008  haad Sync with HEAD.
 1.20.44.1 18-Jul-2008  simonb Sync with head.
 1.20.42.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.20.40.1 04-May-2009  yamt sync with head.
 1.20.36.1 28-Sep-2008  mjf Sync with HEAD.
 1.21.28.1 17-Apr-2012  yamt sync with head
 1.22.66.1 01-Aug-2021  thorpej Sync with HEAD.
 1.29.10.1 03-Jul-2024  martin Pull up following revision(s) (requested by ozaki-r in ticket #736):

sys/altq/altq_rmclass.c: revision 1.31

altq, cbq: take care of borrowed classes on sleeping

rmc_under_limit() determines if we can send a packet by checking
that a target class (or borrowing classes) is ready to send a
packet. cl->undertime_ indicates a time that the class can send
packets after the time. So if cl->undertime_ has passed
(i.e., now >=3D cl->undertime_), we can send packets through the class.

The treatment is important when a required delay period is shorten
than the minimum delay on the system (a tick), because in that case
the delay handler is too late to wake up to send a packet in time.

If there are traffic, rmc_under_limit() can save such a case.

Unfortunately, the old code didn't take care of bandwidth borrowing
on sleeping. So bandwidth borrowing didn't work well with high
bandwidths that require short delay actions.
 1.30.2.1 02-Aug-2025  perseant Sync with HEAD
 1.14 03-Feb-2025  ozaki-r altq, cbq: fix TS_ADD_DELTA on ILP32

TS_ADD_DELTA adds a nanosecond value, delta, to a timespec value while
delta is int64_t and tv_nsec is long. delta is guaranteed as positive
in ALTQ/CBQ. However, the original code used delta after casting it
into long. So it could be negative on ILP32 systems. TS_ADD_DELTA
didn't assume that delta was negative and resulting tv_nsec could be
negative unexpectedly.

This issue was likely to occur when bandwidth borrowing was used where
the borrowing class had a absolutely small bandwidth (e.g., less than
10 Mbps) or a relatively small bandwidth (e.g., 10 Mbps when the parent
class had 200 Mbps).

KASSERT has been added to guarantee resulting tv_nsec is always not
negative. Additionally, another KASSERT has been added to make it clear
that delta is assumed to be non-negative.
 1.13 24-May-2022  andvar branches: 1.13.4; 1.13.10;
fix various typos in comment, documentation and log messages.
 1.12 21-Jul-2021  ozaki-r altq, cbq: change long to uint64_t for ILP32 archs

PR kern/56319
 1.11 21-Jul-2021  ozaki-r altq, cbq: treat time in nanoseconds

Time granularity in microseconds is sometimes not enough to provide
accurate bandwidth control; actual bandwidth on a capped class
can exceed its limit considerably in some cases.

Treating time in nanoseconds requires the following changes:
- Use timespec instead of timeval
- Use nanotime(9) instead of microtime(9)
- Change the type of some variables, especially *idle, to long
 1.10 21-Jul-2021  ozaki-r altq, cbq: convert ns_per_byte to ps_per_byte

Also the type of variables of it is changed to u_long from int.

This change provides fine-grain resolution of bandwidth. For example
750 Mbps was treated as 800 Mbps internally because bandwidth was
represented as nanoseconds per byte. Converting the representation
to picoseconds per byte enables to treat 750 Mbps as-is.

PR kern/56319
 1.9 13-Jul-2021  ozaki-r altq, cbq: apply the do-while idiom to TV_* macros
 1.8 28-Oct-2006  peter branches: 1.8.158;
Don't allow to initialize an interface with MTU smaller than one.
This prevents a divide by zero and fixes PR #21474.

ok tron@
 1.7 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.6 11-Dec-2005  christos branches: 1.6.12; 1.6.20; 1.6.22;
merge ktrace-lwp.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 20-Aug-2003  itojun branches: 1.4.8; 1.4.10;
expose CBQ_MAXPRI to userland
 1.3 05-Mar-2002  itojun branches: 1.3.14;
bring in latest ALTQ from kjc. ALTQify some of the drivers.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4; 1.2.6;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.6.1 16-Mar-2002  jdolecek Catch up with -current.
 1.2.4.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_rmclass.h was added on branch thorpej_scsipi on 2001-01-05 17:39:37 +0000
 1.3.14.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.14.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.14.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.14.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.5.4.1 30-Dec-2006  yamt sync with head.
 1.6.22.2 10-Dec-2006  yamt sync with head.
 1.6.22.1 22-Oct-2006  yamt sync with head
 1.6.20.1 18-Nov-2006  ad Sync with head.
 1.6.12.1 18-Mar-2006  peter Sync with KAME.
 1.8.158.1 01-Aug-2021  thorpej Sync with HEAD.
 1.13.10.1 02-Aug-2025  perseant Sync with HEAD
 1.13.4.1 20-Feb-2025  martin Pull up following revision(s) (requested by ozaki-r in ticket #1049):

sys/altq/altq_rmclass.h: revision 1.14

altq, cbq: fix TS_ADD_DELTA on ILP32

TS_ADD_DELTA adds a nanosecond value, delta, to a timespec value while
delta is int64_t and tv_nsec is long. delta is guaranteed as positive
in ALTQ/CBQ. However, the original code used delta after casting it
into long. So it could be negative on ILP32 systems. TS_ADD_DELTA
didn't assume that delta was negative and resulting tv_nsec could be
negative unexpectedly.

This issue was likely to occur when bandwidth borrowing was used where
the borrowing class had a absolutely small bandwidth (e.g., less than
10 Mbps) or a relatively small bandwidth (e.g., 10 Mbps when the parent
class had 200 Mbps).

KASSERT has been added to guarantee resulting tv_nsec is always not
negative. Additionally, another KASSERT has been added to make it clear
that delta is assumed to be non-negative.
 1.7 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.6 11-Dec-2005  christos branches: 1.6.12; 1.6.20; 1.6.22;
merge ktrace-lwp.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 09-Nov-2003  christos branches: 1.4.8; 1.4.10;
- kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.3 13-Apr-2001  thorpej branches: 1.3.22;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_rmclass_debug.h was added on branch thorpej_scsipi on 2001-01-05 17:39:37 +0000
 1.3.22.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.22.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.5.4.1 30-Dec-2006  yamt sync with head.
 1.6.22.1 22-Oct-2006  yamt sync with head
 1.6.20.1 18-Nov-2006  ad Sync with head.
 1.6.12.1 18-Mar-2006  peter Sync with KAME.
 1.34 08-Jan-2025  joe return: remove parenthesis from return statements
 1.33 14-Mar-2017  ozaki-r branches: 1.33.46; 1.33.48;
Use if_acquire and if_release instead of using psref API directly

- Provide if_release for consistency to if_acquire
- Use if_acquire and if_release for ifp iterations
- Make ifnet_psref_class static
 1.32 20-Jun-2016  knakahara branches: 1.32.2; 1.32.4;
apply if_start_lock() to L2 callers which call ifp->if_start() of device derivers
 1.31 12-May-2016  ozaki-r Protect ifnet list with psz and psref

The change ensures that ifnet objects in the ifnet list aren't freed during
list iterations by using pserialize(9) and psref(9).

Note that the change adds a pslist(9) for ifnet but doesn't remove the
original ifnet list (ifnet_list) to avoid breaking kvm(3) users. We
shouldn't use the original list in the kernel anymore.
 1.30 20-Apr-2016  knakahara IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
 1.29 17-May-2014  rmind branches: 1.29.4;
- Move IFNET_*() macros under #ifdef _KERNEL.
- Replace TAILQ_FOREACH on ifnet with IFNET_FOREACH().
 1.28 04-Jan-2009  pooka branches: 1.28.24; 1.28.28; 1.28.38;
add braces for symmetry
 1.27 25-Nov-2008  tsutsui Use binuptime(9) and emulate 1GiHz (2^30) counter rather than
nanouptime(9) and 1GHz counter to avoid extra rescaling.
Suggested and reviewed by kardel@.
 1.26 25-Nov-2008  tsutsui In machclk functions always emulate 1GHz counter using nanotime(9)
since it has enough resolution via timecounter(9).
Using machine dependent cpu_counter() is not MP safe
and it won't work even on UP with Speedstep etc.

No particular comment on tech-kern, and also closes PR kern/39835.
 1.25 10-May-2008  ad branches: 1.25.4; 1.25.6; 1.25.8;
Use MI cpu_counter() interface.
 1.24 19-Oct-2007  ad branches: 1.24.16; 1.24.18; 1.24.20; 1.24.22;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.23 04-Sep-2007  pooka branches: 1.23.4;
init tbr_callout in all cases (hi ad!)
 1.22 09-Jul-2007  ad branches: 1.22.2; 1.22.6; 1.22.8;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.21 05-Mar-2007  he branches: 1.21.2; 1.21.4;
Use mtod(m, char*) when doing pointer arithmetic on the result.
Patch from Andreas Wrede.
 1.20 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 16-Nov-2006  christos branches: 1.19.4;
__unused removal on arguments; approved by core.
 1.18 15-Oct-2006  peter Don't enable ALTQ in altq_pfattach. Enabling/disabling of ALTQ is already
done in the pf(4) code (pf_ioctl.c).

From OpenBSD.
 1.17 13-Oct-2006  peter Only compile in pf specific code when pf is configured.
Fixes kernel build when ALTQ is configured and pf not.
 1.16 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.15 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.14 23-Apr-2006  christos branches: 1.14.8; 1.14.10;
Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.6; 1.13.8; 1.13.10; 1.13.12;
merge ktrace-lwp.
 1.12 26-Feb-2005  perry branches: 1.12.4;
nuke trailing whitespace
 1.11 13-Feb-2004  wiz branches: 1.11.8; 1.11.10;
Uppercase CPU, plural is CPUs.
 1.10 09-Nov-2003  christos - kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.9 09-Oct-2002  jdolecek branches: 1.9.6;
replace cpu_tsc_freq with curcpu()->ci_tsc_freq
 1.8 05-Mar-2002  itojun bring in latest ALTQ from kjc. ALTQify some of the drivers.
 1.7 12-Nov-2001  lukem add RCSIDs
 1.6 10-Sep-2001  itojun fix IPv4 fragment handling in the classifier.
report and fix by "Paul Koster" <list@kosteronline.net>
sync with kame
 1.5 13-Apr-2001  thorpej branches: 1.5.2; 1.5.4;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.4 14-Dec-2000  thorpej branches: 1.4.2; 1.4.4;
Don't need <vm/vm.h> (it doesn't exist in -current).
 1.3 14-Dec-2000  thorpej No need to wrap these in #ifdef ALTQ -- they're not even included
if ALTQ is not configured into the kernel.
 1.2 14-Dec-2000  thorpej Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.4.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.4.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.4.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.4.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.4.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.4.2.1 14-Dec-2000  bouyer file altq_subr.c was added on branch thorpej_scsipi on 2001-01-05 17:39:37 +0000
 1.5.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.5.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.5.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.9.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.1 03-Aug-2004  skrll Sync with HEAD
 1.11.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.8.1 29-Apr-2005  kent sync with -current
 1.12.4.4 27-Oct-2007  yamt sync with head.
 1.12.4.3 03-Sep-2007  yamt sync with head.
 1.12.4.2 30-Dec-2006  yamt sync with head.
 1.12.4.1 21-Jun-2006  yamt sync with head.
 1.13.12.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.13.12.1 18-Mar-2006  peter Sync with KAME.
 1.13.10.1 11-May-2006  elad sync with head
 1.13.8.1 24-May-2006  yamt sync with head.
 1.13.6.1 01-Jun-2006  kardel Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.14.10.2 10-Dec-2006  yamt sync with head.
 1.14.10.1 22-Oct-2006  yamt sync with head
 1.14.8.1 18-Nov-2006  ad Sync with head.
 1.19.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.4.1 11-Jul-2007  mjf Sync with head.
 1.21.2.3 23-Oct-2007  ad Sync with head.
 1.21.2.2 09-Oct-2007  ad Sync with head.
 1.21.2.1 01-Jul-2007  ad Adapt to callout API change.
 1.22.8.1 06-Nov-2007  matt sync with HEAD
 1.22.6.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.22.6.1 02-Oct-2007  joerg Sync with HEAD.
 1.22.2.1 10-Sep-2007  skrll Sync with HEAD.
 1.23.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.24.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.24.20.2 04-May-2009  yamt sync with head.
 1.24.20.1 16-May-2008  yamt sync with head.
 1.24.18.1 18-May-2008  yamt sync with head.
 1.24.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.24.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.8.2 01-Dec-2008  snj Pull up following revision(s) (requested by tsutsui in ticket #152):
sys/altq/altq_subr.c: revision 1.27
Use binuptime(9) and emulate 1GiHz (2^30) counter rather than
nanouptime(9) and 1GHz counter to avoid extra rescaling.
Suggested and reviewed by kardel@.
 1.25.8.1 01-Dec-2008  snj Pull up following revision(s) (requested by tsutsui in ticket #152):
sys/altq/altq_subr.c: revision 1.26
sys/altq/altq_var.h: revision 1.12
In machclk functions always emulate 1GHz counter using nanotime(9)
since it has enough resolution via timecounter(9).
Using machine dependent cpu_counter() is not MP safe
and it won't work even on UP with Speedstep etc.
No particular comment on tech-kern, and also closes PR kern/39835.
 1.25.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.25.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.28.38.1 10-Aug-2014  tls Rebase.
 1.28.28.1 17-Jul-2013  rmind Checkpoint work in progress:
- Move PCB structures under __INPCB_PRIVATE, adjust most of the callers
and thus make IPv4 PCB structures mostly opaque. Any volunteers for
merging in6pcb with inpcb (see rpaulo-netinet-merge-pcb branch)?
- Move various global vars to the modules where they belong, make them static.
- Some preliminary work for IPv4 PCB locking scheme.
- Make raw IP code mostly MP-safe. Simplify some of it.
- Rework "fast" IP forwarding (ipflow) code to be mostly MP-safe. It should
run from a software interrupt, rather than hard.
- Rework tun(4) pseudo interface to be MP-safe.
- Work towards making some other interfaces more strict.
 1.28.24.2 03-Dec-2017  jdolecek update from HEAD
 1.28.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.29.4.4 28-Aug-2017  skrll Sync with HEAD
 1.29.4.3 09-Jul-2016  skrll Sync with HEAD
 1.29.4.2 29-May-2016  skrll Sync with HEAD
 1.29.4.1 22-Apr-2016  skrll Sync with HEAD
 1.32.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.32.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.33.48.1 02-Aug-2025  perseant Sync with HEAD
 1.33.46.1 11-Nov-2023  thorpej branches: 1.33.46.1.2;
Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.33.46.1.2.1 15-Nov-2023  thorpej Protect the ALTQ state that's exposed to the ifqueue if the ifq->ifq_lock.
This requires exposing some implementation details to ALTQ, which is guarded
by an __IFQ_PRIVATE define.
 1.13 07-Dec-2024  andvar s/functiuon/function/ in comment.
 1.12 25-Nov-2008  tsutsui branches: 1.12.104;
In machclk functions always emulate 1GHz counter using nanotime(9)
since it has enough resolution via timecounter(9).
Using machine dependent cpu_counter() is not MP safe
and it won't work even on UP with Speedstep etc.

No particular comment on tech-kern, and also closes PR kern/39835.
 1.11 09-Jul-2007  ad branches: 1.11.28; 1.11.32; 1.11.38; 1.11.42; 1.11.44;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.10 15-Oct-2006  peter branches: 1.10.8; 1.10.10;
Don't enable ALTQ in altq_pfattach. Enabling/disabling of ALTQ is already
done in the pf(4) code (pf_ioctl.c).

From OpenBSD.
 1.9 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.8 16-Feb-2006  perry branches: 1.8.6; 1.8.14; 1.8.16;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.7 24-Dec-2005  perry branches: 1.7.2; 1.7.4; 1.7.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 09-Nov-2003  christos branches: 1.5.16;
- kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.4 02-Nov-2002  perry branches: 1.4.6;
/*CONTCOND*/ while (0)'ed macros
 1.3 31-May-2002  itojun define ALTQ_NOPCC if i386 and !I586_CPU and !I686_CPU.
otherwise, kernel fails to compile.
report by "Federico G. Schwindt" <fgsch@olimpo.com.br>
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4; 1.2.6; 1.2.18;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.18.1 20-Jun-2002  gehenna catch up with -current.
 1.2.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.2 11-Nov-2002  nathanw Catch up to -current
 1.2.4.1 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_var.h was added on branch thorpej_scsipi on 2001-01-05 17:39:38 +0000
 1.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.3 03-Sep-2007  yamt sync with head.
 1.5.16.2 30-Dec-2006  yamt sync with head.
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.7.6.1 22-Apr-2006  simonb Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.7.2.1 18-Feb-2006  yamt sync with head.
 1.8.16.1 22-Oct-2006  yamt sync with head
 1.8.14.1 18-Nov-2006  ad Sync with head.
 1.8.6.1 18-Mar-2006  peter Sync with KAME.
 1.10.10.1 11-Jul-2007  mjf Sync with head.
 1.10.8.1 01-Jul-2007  ad Adapt to callout API change.
 1.11.44.1 01-Dec-2008  snj Pull up following revision(s) (requested by tsutsui in ticket #152):
sys/altq/altq_subr.c: revision 1.26
sys/altq/altq_var.h: revision 1.12
In machclk functions always emulate 1GHz counter using nanotime(9)
since it has enough resolution via timecounter(9).
Using machine dependent cpu_counter() is not MP safe
and it won't work even on UP with Speedstep etc.
No particular comment on tech-kern, and also closes PR kern/39835.
 1.11.42.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.38.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.11.32.1 04-May-2009  yamt sync with head.
 1.11.28.1 17-Jan-2009  mjf Sync with HEAD.
 1.12.104.1 02-Aug-2025  perseant Sync with HEAD
 1.24 08-Jan-2025  joe return: remove parenthesis from return statements
 1.23 21-Sep-2021  christos branches: 1.23.6; 1.23.8;
Remove FreeBSD blocks that did not compile anyway, and use l->l_cred
consistently.
 1.22 28-Jul-2017  riastradh Reject negative indices.

(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)

From Ilja Van Sprundel.
 1.21 20-Apr-2016  knakahara branches: 1.21.10;
IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
 1.20 20-Mar-2014  christos branches: 1.20.4; 1.20.6; 1.20.8; 1.20.12;
kill sprintf
 1.19 11-Sep-2008  joerg branches: 1.19.28; 1.19.34; 1.19.38; 1.19.40; 1.19.44; 1.19.50;
Add support for source address hashhing in ALTQs WFQ. This allows to
easily distribute bandwidth for huge number of clients for incoming
traffic.
 1.18 04-Mar-2007  christos branches: 1.18.36; 1.18.40; 1.18.42; 1.18.46;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 16-Nov-2006  christos branches: 1.17.2; 1.17.4; 1.17.8;
__unused removal on arguments; approved by core.
 1.16 20-Oct-2006  elad Kill some KAUTH_GENERIC_ISSUSER.
 1.15 12-Oct-2006  peter Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 21-Jul-2006  ad branches: 1.13.4; 1.13.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.12 15-May-2006  christos kauth fallout
 1.11 14-May-2006  elad integrate kauth.
 1.10 23-Apr-2006  christos Use malloc/free instead of MALLOC/FREE and M_ZERO instead of memset.
 1.9 24-Dec-2005  perry branches: 1.9.4; 1.9.6; 1.9.8; 1.9.10; 1.9.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 26-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 09-Nov-2003  christos branches: 1.6.8; 1.6.10;
- kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.5 15-Nov-2001  lukem branches: 1.5.16;
don't need <sys/types.h> when including <sys/param.h>
 1.4 12-Nov-2001  lukem add RCSIDs
 1.3 13-Apr-2001  thorpej branches: 1.3.2; 1.3.4;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.4;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_wfq.c was added on branch thorpej_scsipi on 2001-01-05 17:39:38 +0000
 1.3.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.16.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.16.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.16.3 18-Sep-2004  skrll Sync with HEAD.
 1.5.16.2 12-Aug-2004  skrll Adapt to new world order.
 1.5.16.1 03-Aug-2004  skrll Sync with HEAD
 1.6.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.8.1 29-Apr-2005  kent sync with -current
 1.7.4.3 03-Sep-2007  yamt sync with head.
 1.7.4.2 30-Dec-2006  yamt sync with head.
 1.7.4.1 21-Jun-2006  yamt sync with head.
 1.9.12.3 25-Sep-2006  peter sync with head.
 1.9.12.2 09-Jun-2006  peter Merge 2006-05-24 NetBSD-current into the peter-altq branch.
 1.9.12.1 18-Mar-2006  peter Sync with KAME.
 1.9.10.3 11-May-2006  elad sync with head
 1.9.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.9.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.9.8.2 11-Aug-2006  yamt sync with head
 1.9.8.1 24-May-2006  yamt sync with head.
 1.9.6.1 01-Jun-2006  kardel Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.13.6.2 10-Dec-2006  yamt sync with head.
 1.13.6.1 22-Oct-2006  yamt sync with head
 1.13.4.1 18-Nov-2006  ad Sync with head.
 1.17.8.1 15-Sep-2008  skrll Sync with netbsd-4.
 1.17.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.2.1 14-Sep-2008  bouyer Pull up following revision(s) (requested by joerg in ticket #1197):
sys/altq/altq_wfq.c: revision 1.19
sys/altq/altq_wfq.h: revision 1.6
usr.sbin/altq/altqd/altq.conf.5: revision 1.12
usr.sbin/altq/libaltq/qop_wfq.c: revision 1.6
Add support for source address hashhing in ALTQs WFQ. This allows to
easily distribute bandwidth for huge number of clients for incoming
traffic.
 1.18.46.1 19-Oct-2008  haad Sync with HEAD.
 1.18.42.1 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.18.40.1 04-May-2009  yamt sync with head.
 1.18.36.1 28-Sep-2008  mjf Sync with HEAD.
 1.19.50.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.19.44.1 18-May-2014  rmind sync with head
 1.19.40.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.19.38.2 03-Dec-2017  jdolecek update from HEAD
 1.19.38.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.34.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1488):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.19.28.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.20.12.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.20.8.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.20.6.2 28-Aug-2017  skrll Sync with HEAD
 1.20.6.1 22-Apr-2016  skrll Sync with HEAD
 1.20.4.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1485):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.21.10.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #198):
sys/altq/altq_cbq.c: revision 1.31
sys/altq/altq_hfsc.c: revision 1.27
sys/altq/altq_jobs.c: revision 1.11
sys/altq/altq_priq.c: revision 1.24
sys/altq/altq_wfq.c: revision 1.22
Zero buffers copied to userland to avoid stack disclosure.
From Ilja Van Sprundel.
--
Reject negative indices.
(Would be nice to change the types too, and it's *probably* safe to
replace int by u_int, but I'm reluctant to touch the ioctl
definitions without at least a modicum more thought. Also one of
them is a u_long, because why not?)
From Ilja Van Sprundel.
 1.23.8.1 02-Aug-2025  perseant Sync with HEAD
 1.23.6.1 11-Nov-2023  thorpej Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.6 11-Sep-2008  joerg Add support for source address hashhing in ALTQs WFQ. This allows to
easily distribute bandwidth for huge number of clients for incoming
traffic.
 1.5 12-Oct-2006  peter branches: 1.5.2; 1.5.16; 1.5.48; 1.5.52; 1.5.54; 1.5.58;
Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.4 11-Dec-2005  christos branches: 1.4.12; 1.4.20; 1.4.22;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 14-Dec-2000  thorpej branches: 1.2.2; 1.2.26; 1.2.34; 1.2.36;
Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.2.36.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.34.1 29-Apr-2005  kent sync with -current
 1.2.26.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 14-Dec-2000  bouyer file altq_wfq.h was added on branch thorpej_scsipi on 2001-01-05 17:39:38 +0000
 1.3.4.1 30-Dec-2006  yamt sync with head.
 1.4.22.1 22-Oct-2006  yamt sync with head
 1.4.20.1 18-Nov-2006  ad Sync with head.
 1.4.12.1 18-Mar-2006  peter Sync with KAME.
 1.5.58.1 19-Oct-2008  haad Sync with HEAD.
 1.5.54.1 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.5.52.1 04-May-2009  yamt sync with head.
 1.5.48.1 28-Sep-2008  mjf Sync with HEAD.
 1.5.16.1 15-Sep-2008  skrll Sync with netbsd-4.
 1.5.2.1 14-Sep-2008  bouyer Pull up following revision(s) (requested by joerg in ticket #1197):
sys/altq/altq_wfq.c: revision 1.19
sys/altq/altq_wfq.h: revision 1.6
usr.sbin/altq/altqd/altq.conf.5: revision 1.12
usr.sbin/altq/libaltq/qop_wfq.c: revision 1.6
Add support for source address hashhing in ALTQs WFQ. This allows to
easily distribute bandwidth for huge number of clients for incoming
traffic.
 1.4 22-Sep-2002  jdolecek pull only "opt_altq_enabled.h" in if_altq.h, and include altqconf.h
explicitly in single file which implicitly needed it (altq_conf.c)

this avoids pulling in implicit dependency on <sys/conf.h> to every
file including <net/if.h> (which includes <altq/if_altq.h> to get altq
related structures)
 1.3 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.2 30-May-2001  mrg branches: 1.2.2; 1.2.14;
use _KERNEL_OPT
 1.1 14-Dec-2000  thorpej branches: 1.1.2; 1.1.4;
Saner glue into cdevsw.
 1.1.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 14-Dec-2000  bouyer file altqconf.h was added on branch thorpej_scsipi on 2001-01-05 17:39:38 +0000
 1.2.14.1 16-May-2002  gehenna Remove unnecessary macros.
 1.2.2.1 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.8 17-Nov-2014  uebayasi Build altq module.
 1.7 06-Dec-2009  dsl branches: 1.7.22;
Move BLUE_STATS to a commented out line since it is always enabled in
the source file. Fixes PR/35390.
 1.6 12-Oct-2006  peter branches: 1.6.52;
Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.5 19-Jun-2006  rpaulo branches: 1.5.4; 1.5.6;
Add ALTQ_PRIQ.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.8; 1.4.12; 1.4.16;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 09-Nov-2003  christos branches: 1.2.8; 1.2.10;
- kill bzero/bcopy
- defopt stats and settings, removing their definitions from the files
- make code compile by eliminating multicharacter constants!?! and rearranging
variable declarations so they are defined before used!?!
- help gcc with uninitialized variables
 1.1 16-Apr-2002  thorpej branches: 1.1.6; 1.1.8; 1.1.14;
Move ALTQ configuration definitions into altq/files.altq
 1.1.14.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.14.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.14.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.14.1 03-Aug-2004  skrll Sync with HEAD
 1.1.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1 16-Apr-2002  jdolecek file files.altq was added on branch kqueue on 2002-06-23 17:33:33 +0000
 1.1.6.2 20-Jun-2002  nathanw Catch up to -current.
 1.1.6.1 16-Apr-2002  nathanw file files.altq was added on branch nathanw_sa on 2002-06-20 03:37:17 +0000
 1.2.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.8.1 29-Apr-2005  kent sync with -current
 1.3.4.2 30-Dec-2006  yamt sync with head.
 1.3.4.1 21-Jun-2006  yamt sync with head.
 1.4.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.4.12.2 09-Jun-2006  peter Remove unused options: HFSC_PKTLOG, RED_RANDOM_LOOP.
 1.4.12.1 18-Mar-2006  peter defflag ALTQ_PRIQ ALTQ_JOBS
Add altq/altq_jobs.c.
 1.4.8.1 26-Jun-2006  yamt sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.6.1 22-Oct-2006  yamt sync with head
 1.5.4.1 18-Nov-2006  ad Sync with head.
 1.6.52.1 11-Mar-2010  yamt sync with head
 1.7.22.1 03-Dec-2017  jdolecek update from HEAD
 1.16 24-Oct-2022  msaitoh branches: 1.16.4;
Make ifq_drops in struct ifqueue and struct ifaltq 64 bit.
 1.15 20-Apr-2016  knakahara IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
 1.14 01-Jul-2014  ozaki-r branches: 1.14.4;
Lock IFQ operations when NET_MPSAFE

- Introduce NET_MPSAFE
- not defined by default
- Add ifq_lock to protect ifnet#if_snd
- Initialize ifq_lock and lock IFQ operations
when NET_MPSAFE

When NET_MPSAFE isn't defined, this modification
doesn't change its behavior and adds trivial
performance overheads.

Discussed with matt@ on tech-net
 1.13 18-Aug-2009  dyoung branches: 1.13.22; 1.13.36;
Remove code bracketed by #ifdef __FreeBSD__.
 1.12 04-Mar-2007  christos branches: 1.12.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 12-Oct-2006  peter branches: 1.11.4;
Merge the peter-altq branch.

(sync with KAME & add support for using ALTQ with pf(4)).
 1.10 11-Dec-2005  christos branches: 1.10.12; 1.10.20; 1.10.22;
merge ktrace-lwp.
 1.9 26-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 22-Sep-2002  jdolecek branches: 1.8.6; 1.8.14; 1.8.16;
pull only "opt_altq_enabled.h" in if_altq.h, and include altqconf.h
explicitly in single file which implicitly needed it (altq_conf.c)

this avoids pulling in implicit dependency on <sys/conf.h> to every
file including <net/if.h> (which includes <altq/if_altq.h> to get altq
related structures)
 1.7 05-Mar-2002  itojun bring in latest ALTQ from kjc. ALTQify some of the drivers.
 1.6 29-Jan-2001  itojun branches: 1.6.2; 1.6.4;
remove variable names from prototype. sync with kame.
 1.5 14-Dec-2000  thorpej branches: 1.5.2;
Saner glue into cdevsw.
 1.4 14-Dec-2000  thorpej Change the way ALTQ is enabled in the kernel, as there is an
annoying include file name clash.
 1.3 14-Dec-2000  thorpej "KERNEL" doesn't belong in headers.
 1.2 14-Dec-2000  thorpej Add NetBSD RCS IDs.
 1.1 14-Dec-2000  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1 14-Dec-2000  thorpej Import ALTQ from KAME.
 1.5.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.5.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.5.2.1 14-Dec-2000  bouyer file if_altq.h was added on branch thorpej_scsipi on 2001-01-05 17:39:38 +0000
 1.6.4.2 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.6.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.6.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.6.2.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.16.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.14.1 29-Apr-2005  kent sync with -current
 1.8.6.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.4.2 03-Sep-2007  yamt sync with head.
 1.9.4.1 30-Dec-2006  yamt sync with head.
 1.10.22.1 22-Oct-2006  yamt sync with head
 1.10.20.1 18-Nov-2006  ad Sync with head.
 1.10.12.1 18-Mar-2006  peter Sync with KAME.
 1.11.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.40.1 19-Aug-2009  yamt sync with head.
 1.13.36.1 10-Aug-2014  tls Rebase.
 1.13.22.2 03-Dec-2017  jdolecek update from HEAD
 1.13.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.4.1 22-Apr-2016  skrll Sync with HEAD
 1.16.4.1 11-Nov-2023  thorpej branches: 1.16.4.1.2;
Mostly de-tangle ifnet::if_snd from ifaltq, in a way that's minimally-
invasive to the ALTQ code itself.

The point of this is to lay the groundwork for future changes to ifqueue,
which among other benefits, will also hide the ALTQ ABI from drivers.
 1.16.4.1.2.1 16-Nov-2023  thorpej Clean up the locking protocol around altq_etherclassify(). It's no longer
required to acquire KERNEL_LOCK *just* because ALTQ is compiled into the
kernel; you only have to acquire it if ALTQ is enabled on the interface
in question.

RSS XML Feed