xref: /freebsd/share/man/man4/ng_car.4 (revision db5bc6794e7125fb9658a35773474afadc98c378)
1db5bc679SAlexander Motin.\" Copyright (c) 2005 Nuno Antunes <nuno.antunes@gmail.com>
2db5bc679SAlexander Motin.\" Copyright (c) 2007 Alexander Motin <mav@freebsd.org>
3db5bc679SAlexander Motin.\" All rights reserved.
4db5bc679SAlexander Motin.\"
5db5bc679SAlexander Motin.\" Redistribution and use in source and binary forms, with or without
6db5bc679SAlexander Motin.\" modification, are permitted provided that the following conditions
7db5bc679SAlexander Motin.\" are met:
8db5bc679SAlexander Motin.\" 1. Redistributions of source code must retain the above copyright
9db5bc679SAlexander Motin.\"    notice, this list of conditions and the following disclaimer.
10db5bc679SAlexander Motin.\" 2. Redistributions in binary form must reproduce the above copyright
11db5bc679SAlexander Motin.\"    notice, this list of conditions and the following disclaimer in the
12db5bc679SAlexander Motin.\"    documentation and/or other materials provided with the distribution.
13db5bc679SAlexander Motin.\"
14db5bc679SAlexander Motin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15db5bc679SAlexander Motin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16db5bc679SAlexander Motin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17db5bc679SAlexander Motin.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18db5bc679SAlexander Motin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19db5bc679SAlexander Motin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20db5bc679SAlexander Motin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21db5bc679SAlexander Motin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22db5bc679SAlexander Motin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23db5bc679SAlexander Motin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24db5bc679SAlexander Motin.\" SUCH DAMAGE.
25db5bc679SAlexander Motin.\"
26db5bc679SAlexander Motin.\" $FreeBSD$
27db5bc679SAlexander Motin.\"
28db5bc679SAlexander Motin.Dd March 11, 2007
29db5bc679SAlexander Motin.Dt NG_CAR 4
30db5bc679SAlexander Motin.Os
31db5bc679SAlexander Motin.Sh NAME
32db5bc679SAlexander Motin.Nm ng_car
33db5bc679SAlexander Motin.Nd Commited Access Rate netgraph node type
34db5bc679SAlexander Motin.Sh SYNOPSIS
35db5bc679SAlexander Motin.In netgraph/ng_car.h
36db5bc679SAlexander Motin.Sh DESCRIPTION
37db5bc679SAlexander MotinThe
38db5bc679SAlexander Motin.Nm car
39db5bc679SAlexander Motinnode type limits traffic flowing through it using:
40db5bc679SAlexander Motin.Pp
41db5bc679SAlexander Motin.Bl -bullet -compact
42db5bc679SAlexander Motin.It
43db5bc679SAlexander MotinSingle rate three color marker as described on RFC 2697,
44db5bc679SAlexander Motin.It
45db5bc679SAlexander MotinTwo rate three color marker as described on RFC 2698,
46db5bc679SAlexander Motin.It
47db5bc679SAlexander MotinRED-like rate limit algorithm used by Cisco,
48db5bc679SAlexander Motin.It
49db5bc679SAlexander MotinTraffic shaping with RED.
50db5bc679SAlexander Motin.El
51db5bc679SAlexander Motin.Sh HOOKS
52db5bc679SAlexander MotinThis node type supports the following hooks:
53db5bc679SAlexander Motin.Bl -tag -width indent
54db5bc679SAlexander Motin.It Va upper
55db5bc679SAlexander MotinHook leading to upper layer protocols.
56db5bc679SAlexander Motin.It Va lower
57db5bc679SAlexander MotinHook leading to lower layer protocols.
58db5bc679SAlexander Motin.El
59db5bc679SAlexander Motin.Pp
60db5bc679SAlexander MotinTraffic flowing from
61db5bc679SAlexander Motin.Va upper
62db5bc679SAlexander Motinto
63db5bc679SAlexander Motin.Va lower
64db5bc679SAlexander Motinis considered
65db5bc679SAlexander Motin.Sy downstream
66db5bc679SAlexander Motintraffic.
67db5bc679SAlexander MotinTraffic flowing from
68db5bc679SAlexander Motin.Va lower
69db5bc679SAlexander Motinto
70db5bc679SAlexander Motin.Va upper
71db5bc679SAlexander Motinis considered
72db5bc679SAlexander Motin.Sy upstream
73db5bc679SAlexander Motintraffic.
74db5bc679SAlexander Motin.Sh MODES OF OPERATION
75db5bc679SAlexander MotinEach hook can operate in one of modes:
76db5bc679SAlexander Motin.Bl -tag -width indent
77db5bc679SAlexander Motin.It Dv NG_CAR_SINGLE_RATE
78db5bc679SAlexander MotinSingle rate three color marker as described on RFC 2697.
79db5bc679SAlexander MotinCommitted burst packets are counted as green, extended burst packets are counted as yellow
80db5bc679SAlexander Motinand exceeding packets are counted as red. Committed burst getting refilled with cir speed.
81db5bc679SAlexander MotinWhen it is full, exceeded burst getting refilled.
82db5bc679SAlexander Motin.It Dv NG_CAR_DOUBLE_RATE
83db5bc679SAlexander MotinTwo rate three color marker as described on RFC 2698.
84db5bc679SAlexander MotinCommitted burst packets are counted as green, peak burst packets are counted as yellow
85db5bc679SAlexander Motinand exceeding packets are counted as red. Committed burst getting refilled with cir speed.
86db5bc679SAlexander MotinPeak burst getting refilled with pir speed at the same time.
87db5bc679SAlexander Motin.It Dv NG_CAR_RED
88db5bc679SAlexander MotinAlike to NG_CAR_SINGLE_RATE, but with different understanding of extended burst.
89db5bc679SAlexander MotinWhen normal burst exceeded and extended burst is used, packets are counted red with
90db5bc679SAlexander Motinprobability equal to part of extended burst consumed. Extended burst getting refilled first.
91db5bc679SAlexander MotinWhen it is full, committed burst getting refilled. This behavior is alike to RED
92db5bc679SAlexander Motinactive queue management algorithm.
93db5bc679SAlexander Motin.Pp
94db5bc679SAlexander MotinThis algorithm is more polite to the TCP traffic then NG_CAR_SINGLE_RATE.
95db5bc679SAlexander Motin.It Dv NG_CAR_SHAPE
96db5bc679SAlexander MotinCommitted burst packets are counted as green, exceeding packets are delayed
97db5bc679SAlexander Motinby queue with RED management and counted as yellow. Packets dropped by queue counted as red.
98db5bc679SAlexander MotinQueue parameters are hardcoded: length 99 packets, min_th 8 packets, max_p 100%.
99db5bc679SAlexander Motin.Pp
100db5bc679SAlexander MotinTraffic shaping is much more polite to the TCP traffic then rate limit on links with
101db5bc679SAlexander Motinbandwidth * delay product less then 6-8 TCP segments, but it consumes additional system
102db5bc679SAlexander Motinresources for queue processing.
103db5bc679SAlexander Motin.El
104db5bc679SAlexander Motin.Sh CONTROL MESSAGES
105db5bc679SAlexander MotinThis node type supports the generic control messages and the following
106db5bc679SAlexander Motinspecific messages.
107db5bc679SAlexander Motin.Bl -tag -width indent
108db5bc679SAlexander Motin.It Dv NGM_CAR_SET_CONF Pq Li setconf
109db5bc679SAlexander MotinSet node configuration to the specified at
110db5bc679SAlexander Motin.Vt "struct ng_car_bulkconf"
111db5bc679SAlexander Motin.It Dv NGM_CAR_GET_CONF Pq Li getconf
112db5bc679SAlexander MotinReturn current node configuration as
113db5bc679SAlexander Motin.Vt "struct ng_car_bulkconf"
114db5bc679SAlexander Motin.Bd -literal -offset 4n
115db5bc679SAlexander Motinstruct ng_car_hookconf {
116db5bc679SAlexander Motin	u_int64_t cbs;		/* Committed burst size (bytes) */
117db5bc679SAlexander Motin	u_int64_t ebs;		/* Exceeded/Peak burst size (bytes) */
118db5bc679SAlexander Motin	u_int64_t cir;		/* Committed information rate (bytes/s) */
119db5bc679SAlexander Motin	u_int64_t pir;		/* Peak information rate (bits/s) */
120db5bc679SAlexander Motin	u_int8_t green_action;	/* Action for green packets */
121db5bc679SAlexander Motin	u_int8_t yellow_action;	/* Action for yellow packets */
122db5bc679SAlexander Motin	u_int8_t red_action;	/* Action for red packets */
123db5bc679SAlexander Motin	u_int8_t mode;		/* single/double rate, ... */
124db5bc679SAlexander Motin	u_int8_t opt;		/* color-aware or color-blind */
125db5bc679SAlexander Motin};
126db5bc679SAlexander Motin
127db5bc679SAlexander Motinstruct ng_car_bulkconf {
128db5bc679SAlexander Motin	struct ng_car_hookconf upstream;
129db5bc679SAlexander Motin	struct ng_car_hookconf downstream;
130db5bc679SAlexander Motin};
131db5bc679SAlexander Motin.Ed
132db5bc679SAlexander Motin.It Dv NGM_CAR_GET_STATS Pq Li getstats
133db5bc679SAlexander MotinReturn node statistics as
134db5bc679SAlexander Motin.Vt "struct ng_car_bulkstats"
135db5bc679SAlexander Motin.Bd -literal -offset 4n
136db5bc679SAlexander Motinstruct ng_car_hookstats {
137db5bc679SAlexander Motin	u_int64_t passed_pkts;
138db5bc679SAlexander Motin	u_int64_t droped_pkts;
139db5bc679SAlexander Motin	u_int64_t green_pkts;
140db5bc679SAlexander Motin	u_int64_t yellow_pkts;
141db5bc679SAlexander Motin	u_int64_t red_pkts;
142db5bc679SAlexander Motin	u_int64_t errors;
143db5bc679SAlexander Motin};
144db5bc679SAlexander Motin
145db5bc679SAlexander Motinstruct ng_car_bulkstats {
146db5bc679SAlexander Motin	struct ng_car_hookstats upstream;
147db5bc679SAlexander Motin	struct ng_car_hookstats downstream;
148db5bc679SAlexander Motin};
149db5bc679SAlexander Motin.Ed
150db5bc679SAlexander Motin.It Dv NGM_CAR_CLR_STATS Pq Li clrstats
151db5bc679SAlexander MotinClear node statistics.
152db5bc679SAlexander Motin.It Dv NGM_CAR_GETCLR_STATS Pq Li getclrstats
153db5bc679SAlexander MotinAtomicaly return and clear node statistics.
154db5bc679SAlexander Motin.El
155db5bc679SAlexander Motin.Sh SHUTDOWN
156db5bc679SAlexander MotinThis node shuts down upon receipt of a
157db5bc679SAlexander Motin.Dv NGM_SHUTDOWN
158db5bc679SAlexander Motincontrol message, or when all hooks have been disconnected.
159db5bc679SAlexander Motin.Sh SEE ALSO
160db5bc679SAlexander Motin.Xr netgraph 4 ,
161db5bc679SAlexander Motin.Xr ngctl 8
162db5bc679SAlexander Motin.Rs
163db5bc679SAlexander Motin.%A J. Heinanen
164db5bc679SAlexander Motin.%T "A Single Rate Three Color Marker"
165db5bc679SAlexander Motin.%O RFC 2697
166db5bc679SAlexander Motin.Re
167db5bc679SAlexander Motin.Rs
168db5bc679SAlexander Motin.%A J. Heinanen
169db5bc679SAlexander Motin.%T "A Two Rate Three Color Marker"
170db5bc679SAlexander Motin.%O RFC 2698
171db5bc679SAlexander Motin.Re
172db5bc679SAlexander Motin.Sh AUTHORS
173db5bc679SAlexander Motin.An Nuno Antunes Aq nuno.antunes@gmail.com
174db5bc679SAlexander Motin.An Alexander Motin Aq mav@alkar.net
175db5bc679SAlexander Motin.Sh BUGS
176db5bc679SAlexander MotinFor this moment only DROP and FORWARD actions are implemented.
177