Home | History | Annotate | Download | only in altq
History log of /src/sys/altq/altq_rmclass.h
RevisionDateAuthorComments
 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.

RSS XML Feed