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