2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2016 Joyent, Inc.
20 .Nd get and set checksum information on message blocks
22 .In sys/mac_provider.h
48 structure that contains a frame.
50 The value or a pointer to it that contains the offset from the L3
51 header, generally IP, of the first byte that's covered by the checksum.
53 The value or a pointer to it that contains the offset from the L3 header
54 of where the L4 checksum is.
55 For example, if using IPv4 and TCP, this would contain the offset from the start
56 of the IPv4 header to the first byte of the TCP checksum.
58 The value or a pointer to it that contains the offset from the L3
59 header, generally IP, of the last byte that's covered by the checksum.
61 The value or a pointer to it that contains the actual value of the
64 A series of one or more flags that have bitwise inclusive ORed together.
65 The set of flags have different meanings depending on whether
67 is being transmitted or received.
74 functions are provided to device drivers to get and set checksum related
76 When a device driver indicates that it supports the
78 capability as part of its
80 entry point, then it is responsible for calling these functions
81 appropriately during the transmit and receive paths.
83 While both functions operate on an
85 this function should only be called on the first
87 that begins a given individual frame in a chain.
88 In other words, it only works on entries where it is the first of many possible
89 entries linked together by the
96 API or pointed to by a
98 pointer should be used.
100 When a device driver is receiving data, it is its responsibility to
102 checksum information when it has indicated that it supports the
105 Device drivers will call the
107 function to indicate what checksum information has occurred.
109 The proper values to set depend on the flags passed in.
110 The following flags are supported when receiving data, note that they may have
111 different meanings from when transmitting data.
112 The driver should set the
114 argument to the bitwise inclusive OR of the following values:
116 .It Sy HCK_IPV4_HDRCKSUM_OK
117 This flag indicates that the hardware has verified the IPv4 header is
118 correct and that the networking stack does not need to verify it.
119 .It Sy HCK_PARTIALCKSUM
120 This flag indicates that the hardware has computed a partial checksum.
121 When this flag is set, the driver is responsible for passing in the
122 partial checksum in the
124 argument as well as the start and ending bytes of the checksum in the
130 This flag indicates that the hardware has calculated the full L4 header
131 checksum; however, it wants the system to verify it.
132 The checksum should be passed in the
135 .It Sy HCK_FULLCKSUM_OK
136 This flag indicates that the hardware has calculated the full L4 header
137 checksum and verified that it is correct.
138 The networking stack does not need to verify it.
142 .Sy HCK_PARTIALCKSUM ,
146 flags are all mutually exclusive.
147 A device driver should only set one of the three flags.
149 If one of the arguments is not required based on the specified value of
151 then the device driver should set any remaining arguments to
153 .Ss Transmitting Data
154 When a device driver is transmitting data and it has advertised that it
157 capability, then it must call the
159 function to determine what hardware checksumming options are required to
160 be performed by the hardware.
161 While the device driver may need the other fields, it must check the
163 argument to determine what it is being requested to do.
164 The following values may be set in
167 .It Sy HCK_IPV4_HDRCKSUM
168 The device driver must compute the IPv4 header checksum.
169 No other fields have been filled in.
170 .It Sy HCK_PARTIALCKSUM
171 The device driver needs to compute the partial ones' complement of the
173 The system has filled in the
178 arguments to assist the device driver.
180 The device driver should compute the full L4 checksum.
181 No other fields have been filled in for the device driver.
184 The flags that the device driver will get will depend on what the device
185 driver has advertised that it supports in response to the
195 flags are mutually exclusive.
201 functions may be called from any context.
204 .Xr mac_getcapab 9E ,