]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/ng_checksum.4
Adjust ENA driver files to latest ena-com changes
[FreeBSD/FreeBSD.git] / share / man / man4 / ng_checksum.4
1 .\" Copyright (c) 2015 Dmitry Vagin <daemon.hammer@ya.ru>
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd October 29, 2015
28 .Dt NG_CHECKSUM 4
29 .Os
30 .Sh NAME
31 .Nm ng_checksum
32 .Nd reconstructing IP checksums node type
33 .Sh SYNOPSIS
34 .In netgraph/ng_checksum.h
35 .Sh DESCRIPTION
36 The
37 .Nm checksum
38 node can calculate, or prepare for calculation in hardware,
39 IPv4 header, TCP and UDP checksums.
40 .Sh HOOKS
41 This node type has two hooks:
42 .Bl -tag -width ".Va out"
43 .It Va in
44 Packets received on this hook are processed according to settings specified
45 in config and then forwarded to the
46 .Ar out
47 hook, if it exists and is connected.
48 Otherwise they are reflected back to the
49 .Ar in
50 hook.
51 .It Va out
52 Packets received on this hook are forwarded to the
53 .Ar in
54 hook without any changes.
55 .El
56 .Sh CONTROL MESSAGES
57 This node type supports the generic control messages, plus the following:
58 .Bl -tag -width foo
59 .It Dv NGM_CHECKSUM_SETDLT Pq Ic setdlt
60 Sets the data link type on the
61 .Va in
62 hook.
63 Currently, supported types are
64 .Cm DLT_RAW
65 (raw IP datagrams) and
66 .Cm DLT_EN10MB
67 (Ethernet). DLT_ definitions can be found in the
68 .In net/bpf.h
69 header.
70 Currently used values are
71 .Cm DLT_EN10MB
72 = 1 and
73 .Cm DLT_RAW
74 = 12.
75 .It Dv NGM_CHECKSUM_GETDLT Pq Ic getdlt
76 This control message obtains the data link type on the
77 .Va in
78 hook.
79 .It Dv NGM_CHECKSUM_SETCONFIG Pq Ic setconfig
80 Sets the node configuration.
81 The following
82 .Vt "struct ng_checksum_config"
83 must be supplied as an argument:
84 .Bd -literal -offset 4n
85 struct ng_checksum_config {
86         uint64_t        csum_flags;
87         uint64_t        csum_offload;
88 };
89 .Ed
90 .Pp
91 The
92 .Va csum_flags
93 can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6
94 (other values are ignored) for instructing the node to calculate the corresponding checksum.
95 .Pp
96 The
97 .Va csum_offload
98 value can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6
99 (other values are ignored) for instructing the node what checksums should be requested from the hardware.
100 .Pp
101 The node also takes into account any combination of
102 CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6 already
103 flagged on the mbuf.
104 .It Dv NGM_CHECKSUM_GETCONFIG Pq Ic getconfig
105 This control message obtains the current node configuration returned as a
106 .Vt "struct ng_checksum_config" .
107 .It Dv NGM_CHECKSUM_GET_STATS Pq Ic getstats
108 Returns node statistics as a
109 .Vt "struct ng_checksum_stats" .
110 .It Dv NGM_CHECKSUM_CLR_STATS Pq Ic clrstats
111 Clear the node statistics.
112 .It Dv NGM_CHECKSUM_GETCLR_STATS Pq Ic getclrstats
113 This command is identical to
114 .Dv NGM_CHECKSUM_GET_STATS ,
115 except that the statistics are also atomically cleared.
116 .El
117 .Sh SHUTDOWN
118 This node shuts down upon receipt of a
119 .Dv NGM_SHUTDOWN
120 control message, or when all hooks have been disconnected.
121 .Sh EXAMPLES
122 .Xr ngctl 8
123 script:
124 .Bd -literal -offset 4n
125 /usr/sbin/ngctl -f- <<-SEQ
126         msg checksum-1: setdlt 1
127         msg checksum-1: setconfig { csum_flags=0 csum_offload=6 }
128 SEQ
129 .Ed
130 .Pp
131 Set the data link type to
132 .Cm DLT_EN10MB
133 (Ethernet), do not set additional checksum flags
134 and request that the hardware calculate CSUM_IP_UDP|CSUM_IP_TCP.
135 .Sh SEE ALSO
136 .Xr netgraph 4 ,
137 .Xr ng_patch 4 ,
138 .Xr ngctl 8
139 .Sh HISTORY
140 The
141 .Nm
142 node type was implemented in
143 .Fx 10.2
144 and first submitted in
145 .Fx 12.0 .
146 .Sh AUTHORS
147 .An "Dmitry Vagin" Aq daemon.hammer@ya.ru .