sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget0/translations/zh_CN/networking/checksum-offloadsmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/zh_TW/networking/checksum-offloadsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/it_IT/networking/checksum-offloadsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ja_JP/networking/checksum-offloadsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ko_KR/networking/checksum-offloadsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/pt_BR/networking/checksum-offloadsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/sp_SP/networking/checksum-offloadsmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhJ/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads.rsthKubhsection)}(hhh](htitle)}(hChecksum Offloadsh]hChecksum Offloads}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Introductionh]h Introduction}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh paragraph)}(hThis document describes a set of techniques in the Linux networking stack to take advantage of checksum offload capabilities of various NICs.h]hThis document describes a set of techniques in the Linux networking stack to take advantage of checksum offload capabilities of various NICs.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(h)The following technologies are described:h]h)The following technologies are described:}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh bullet_list)}(hhh](h list_item)}(hTX Checksum Offloadh]h)}(hjh]hTX Checksum Offload}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hLCO: Local Checksum Offloadh]h)}(hj,h]hLCO: Local Checksum Offload}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj*ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hRCO: Remote Checksum Offload h]h)}(hRCO: Remote Checksum Offloadh]hRCO: Remote Checksum Offload}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjAubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]bullet*uh1j hhhKhhhhubh)}(h5Things that should be documented here but aren't yet:h]h7Things that should be documented here but aren’t yet:}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubj )}(hhh]j)}(h!CHECKSUM_UNNECESSARY conversion h]h)}(hCHECKSUM_UNNECESSARY conversionh]hCHECKSUM_UNNECESSARY conversion}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjrubah}(h]h ]h"]h$]h&]uh1jhjohhhhhNubah}(h]h ]h"]h$]h&]j_j`uh1j hhhKhhhhubeh}(h] introductionah ]h"] introductionah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hTX Checksum Offloadh]hTX Checksum Offload}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXeIn brief, Tx checksum offload allows to request the device fill in a single ones-complement checksum defined by the sk_buff fields skb->csum_start and skb->csum_offset. The device should compute the 16-bit ones-complement checksum (i.e. the 'IP-style' checksum) from csum_start to the end of the packet, and fill in the result at (csum_start + csum_offset).h]hXiIn brief, Tx checksum offload allows to request the device fill in a single ones-complement checksum defined by the sk_buff fields skb->csum_start and skb->csum_offset. The device should compute the 16-bit ones-complement checksum (i.e. the ‘IP-style’ checksum) from csum_start to the end of the packet, and fill in the result at (csum_start + csum_offset).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXBecause csum_offset cannot be negative, this ensures that the previous value of the checksum field is included in the checksum computation, thus it can be used to supply any needed corrections to the checksum (such as the sum of the pseudo-header for UDP or TCP).h]hXBecause csum_offset cannot be negative, this ensures that the previous value of the checksum field is included in the checksum computation, thus it can be used to supply any needed corrections to the checksum (such as the sum of the pseudo-header for UDP or TCP).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hjhhubh)}(hThis interface only allows a single checksum to be offloaded. Where encapsulation is used, the packet may have multiple checksum fields in different header layers, and the rest will have to be handled by another mechanism such as LCO or RCO.h]hThis interface only allows a single checksum to be offloaded. Where encapsulation is used, the packet may have multiple checksum fields in different header layers, and the rest will have to be handled by another mechanism such as LCO or RCO.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hjhhubh)}(hXSCTP CRC32c can also be offloaded using this interface, by means of filling skb->csum_start and skb->csum_offset as described above, setting skb->csum_not_inet, and advertising NETIF_F_SCTP_CRC. Drivers must not treat ordinary IP checksum offload as SCTP CRC32c support.h]hXSCTP CRC32c can also be offloaded using this interface, by means of filling skb->csum_start and skb->csum_offset as described above, setting skb->csum_not_inet, and advertising NETIF_F_SCTP_CRC. Drivers must not treat ordinary IP checksum offload as SCTP CRC32c support.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hjhhubh)}(hNo offloading of the IP header checksum is performed; it is always done in software. This is OK because when we build the IP header, we obviously have it in cache, so summing it isn't expensive. It's also rather short.h]hNo offloading of the IP header checksum is performed; it is always done in software. This is OK because when we build the IP header, we obviously have it in cache, so summing it isn’t expensive. It’s also rather short.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK2hjhhubh)}(hThe requirements for GSO are more complicated, because when segmenting an encapsulated packet both the inner and outer checksums may need to be edited or recomputed for each resulting segment.h]hThe requirements for GSO are more complicated, because when segmenting an encapsulated packet both the inner and outer checksums may need to be edited or recomputed for each resulting segment.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK6hjhhubh)}(hXA driver declares its offload capabilities in netdev->hw_features; see Documentation/networking/netdev-features.rst for more. NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are restricted legacy features and are being deprecated in favor of NETIF_F_HW_CSUM. New devices should use NETIF_F_HW_CSUM to advertise generic checksum offload. The skb_csum_hwoffload_help() helper can resolve CHECKSUM_PARTIAL according to the device's advertised checksum capabilities, falling back to software when needed.h]hXA driver declares its offload capabilities in netdev->hw_features; see Documentation/networking/netdev-features.rst for more. NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are restricted legacy features and are being deprecated in favor of NETIF_F_HW_CSUM. New devices should use NETIF_F_HW_CSUM to advertise generic checksum offload. The skb_csum_hwoffload_help() helper can resolve CHECKSUM_PARTIAL according to the device’s advertised checksum capabilities, falling back to software when needed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hjhhubh)}(hX@The stack should, for the most part, assume that checksum offload is supported by the underlying device. The only place that should check is validate_xmit_skb(), and the functions it calls directly or indirectly. That function compares the offload features requested by the SKB (which may include other offloads besides TX Checksum Offload) and, if they are not supported or enabled on the device (determined by netdev->features), performs the corresponding offload in software. In the case of TX Checksum Offload, that means calling skb_csum_hwoffload_help(skb, features).h]hX@The stack should, for the most part, assume that checksum offload is supported by the underlying device. The only place that should check is validate_xmit_skb(), and the functions it calls directly or indirectly. That function compares the offload features requested by the SKB (which may include other offloads besides TX Checksum Offload) and, if they are not supported or enabled on the device (determined by netdev->features), performs the corresponding offload in software. In the case of TX Checksum Offload, that means calling skb_csum_hwoffload_help(skb, features).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKBhjhhubeh}(h]tx-checksum-offloadah ]h"]tx checksum offloadah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hLCO: Local Checksum Offloadh]hLCO: Local Checksum Offload}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj!hhhhhKMubh)}(hLCO is a technique for efficiently computing the outer checksum of an encapsulated datagram when the inner checksum is due to be offloaded.h]hLCO is a technique for efficiently computing the outer checksum of an encapsulated datagram when the inner checksum is due to be offloaded.}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKOhj!hhubh)}(hXThe ones-complement sum of a correctly checksummed TCP or UDP packet is equal to the complement of the sum of the pseudo header, because everything else gets 'cancelled out' by the checksum field. This is because the sum was complemented before being written to the checksum field.h]hXThe ones-complement sum of a correctly checksummed TCP or UDP packet is equal to the complement of the sum of the pseudo header, because everything else gets ‘cancelled out’ by the checksum field. This is because the sum was complemented before being written to the checksum field.}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKRhj!hhubh)}(hMore generally, this holds in any case where the 'IP-style' ones complement checksum is used, and thus any checksum that TX Checksum Offload supports.h]hMore generally, this holds in any case where the ‘IP-style’ ones complement checksum is used, and thus any checksum that TX Checksum Offload supports.}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKWhj!hhubh)}(hXThat is, if we have set up TX Checksum Offload with a start/offset pair, we know that after the device has filled in that checksum, the ones complement sum from csum_start to the end of the packet will be equal to the complement of whatever value we put in the checksum field beforehand. This allows us to compute the outer checksum without looking at the payload: we simply stop summing when we get to csum_start, then add the complement of the 16-bit word at (csum_start + csum_offset).h]hXThat is, if we have set up TX Checksum Offload with a start/offset pair, we know that after the device has filled in that checksum, the ones complement sum from csum_start to the end of the packet will be equal to the complement of whatever value we put in the checksum field beforehand. This allows us to compute the outer checksum without looking at the payload: we simply stop summing when we get to csum_start, then add the complement of the 16-bit word at (csum_start + csum_offset).}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKZhj!hhubh)}(hThen, when the true inner checksum is filled in (either by hardware or by skb_checksum_help()), the outer checksum will become correct by virtue of the arithmetic.h]hThen, when the true inner checksum is filled in (either by hardware or by skb_checksum_help()), the outer checksum will become correct by virtue of the arithmetic.}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKbhj!hhubh)}(hLCO is performed by the stack when constructing an outer UDP header for an encapsulation such as VXLAN or GENEVE, in udp_set_csum(). Similarly for the IPv6 equivalents, in udp6_set_csum().h]hLCO is performed by the stack when constructing an outer UDP header for an encapsulation such as VXLAN or GENEVE, in udp_set_csum(). Similarly for the IPv6 equivalents, in udp6_set_csum().}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKfhj!hhubh)}(hIt is also performed when constructing GRE headers with the shared gre_build_header() helper in include/net/gre.h, which is used by both IPv4 and IPv6 GRE.h]hIt is also performed when constructing GRE headers with the shared gre_build_header() helper in include/net/gre.h, which is used by both IPv4 and IPv6 GRE.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKjhj!hhubh)}(h[All of the LCO implementations use a helper function lco_csum(), in include/linux/skbuff.h.h]h[All of the LCO implementations use a helper function lco_csum(), in include/linux/skbuff.h.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhj!hhubh)}(hXELCO can safely be used for nested encapsulations; in this case, the outer encapsulation layer will sum over both its own header and the 'middle' header. This does mean that the 'middle' header will get summed multiple times, but there doesn't seem to be a way to avoid that without incurring bigger costs (e.g. in SKB bloat).h]hXOLCO can safely be used for nested encapsulations; in this case, the outer encapsulation layer will sum over both its own header and the ‘middle’ header. This does mean that the ‘middle’ header will get summed multiple times, but there doesn’t seem to be a way to avoid that without incurring bigger costs (e.g. in SKB bloat).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKqhj!hhubeh}(h]lco-local-checksum-offloadah ]h"]lco: local checksum offloadah$]h&]uh1hhhhhhhhKMubh)}(hhh](h)}(hRCO: Remote Checksum Offloadh]hRCO: Remote Checksum Offload}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKyubh)}(hXRCO is a technique for eliding the inner checksum of an encapsulated datagram, allowing the outer checksum to be offloaded. It does, however, involve a change to the encapsulation protocols, which the receiver must also support. For this reason, it is disabled by default.h]hXRCO is a technique for eliding the inner checksum of an encapsulated datagram, allowing the outer checksum to be offloaded. It does, however, involve a change to the encapsulation protocols, which the receiver must also support. For this reason, it is disabled by default.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK{hjhhubh)}(h1RCO is detailed in the following Internet-Drafts:h]h1RCO is detailed in the following Internet-Drafts:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj )}(hhh](j)}(h>https://tools.ietf.org/html/draft-herbert-remotecsumoffload-00h]h)}(hjh]h reference)}(hjh]h>https://tools.ietf.org/html/draft-herbert-remotecsumoffload-00}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jhjubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h7https://tools.ietf.org/html/draft-herbert-vxlan-rco-00 h]h)}(h6https://tools.ietf.org/html/draft-herbert-vxlan-rco-00h]j)}(hjh]h6https://tools.ietf.org/html/draft-herbert-vxlan-rco-00}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jhjubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]j_j`uh1j hhhKhjhhubh)}(hIn Linux, RCO is implemented individually in each encapsulation protocol, and most tunnel types have flags controlling its use. For instance, VXLAN has the configuration flag VXLAN_F_REMCSUM_TX to indicate that RCO should be used when transmitting.h]hIn Linux, RCO is implemented individually in each encapsulation protocol, and most tunnel types have flags controlling its use. For instance, VXLAN has the configuration flag VXLAN_F_REMCSUM_TX to indicate that RCO should be used when transmitting.}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]rco-remote-checksum-offloadah ]h"]rco: remote checksum offloadah$]h&]uh1hhhhhhhhKyubh)}(hhh](h)}(hRX Checksum Offloadh]hRX Checksum Offload}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjIhhhhhKubh)}(hXRX checksum offload is controlled via NETIF_F_RXCSUM. When disabled the driver must not set skb->ip_summed on ingress packets. As mentioned, IPv4 checksum is not offloaded, the RXCSUM feature controls the offload of verification of transport layer checksums.h]hXRX checksum offload is controlled via NETIF_F_RXCSUM. When disabled the driver must not set skb->ip_summed on ingress packets. As mentioned, IPv4 checksum is not offloaded, the RXCSUM feature controls the offload of verification of transport layer checksums.}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjIhhubh)}(hXNote that packets with bad TCP/UDP checksums must still be passed to the stack. skb->ip_summed of such packets can be set to ``CHECKSUM_COMPLETE`` or left at ``CHECKSUM_NONE``. Drivers **must not discard** packets with bad TCP/UDP checksum and must not configure the device to drop them. Checksum validation is relatively inexpensive and having bad packets reflected in SNMP counters is crucial for network monitoring.h](h}Note that packets with bad TCP/UDP checksums must still be passed to the stack. skb->ip_summed of such packets can be set to }(hjhhhhNhNubhliteral)}(h``CHECKSUM_COMPLETE``h]hCHECKSUM_COMPLETE}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1jphjhubh or left at }(hjhhhhNhNubjq)}(h``CHECKSUM_NONE``h]h CHECKSUM_NONE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jphjhubh . Drivers }(hjhhhhNhNubhstrong)}(h**must not discard**h]hmust not discard}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjhubh packets with bad TCP/UDP checksum and must not configure the device to drop them. Checksum validation is relatively inexpensive and having bad packets reflected in SNMP counters is crucial for network monitoring.}(hjhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjIhhubeh}(h]rx-checksum-offloadah ]h"]rx checksum offloadah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hskb checksum documentationh]hskb checksum documentation}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(h\The interface for checksum offload between the stack and networking drivers is as follows...h]h\The interface for checksum offload between the stack and networking drivers is as follows...}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhK,hjhhubh)}(hhh](h)}(hIP checksum related featuresh]hIP checksum related features}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhNhNubh)}(hDrivers advertise checksum offload capabilities in the features of a device. From the stack's point of view these are capabilities offered by the driver. A driver typically only advertises features that it is capable of offloading to its device.h]hDrivers advertise checksum offload capabilities in the features of a device. From the stack’s point of view these are capabilities offered by the driver. A driver typically only advertises features that it is capable of offloading to its device.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhK2hjubhtable)}(hhh](h)}(h Checksum related device featuresh]h Checksum related device features}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhK7hjubhtgroup)}(hhh](hcolspec)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthK uh1jhjubhtbody)}(hhh](hrow)}(hhh](hentry)}(hhh]h)}(h``NETIF_F_HW_CSUM``h]jq)}(hj8h]hNETIF_F_HW_CSUM}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj6ubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhK:hj3ubah}(h]h ]h"]h$]h&]uh1j1hj.ubj2)}(hhh]h)}(hThe driver (or its device) is able to compute one IP (one's complement) checksum for any combination of protocols or protocol layering. The checksum is computed and set in a packet per the CHECKSUM_PARTIAL interface (see below).h]hThe driver (or its device) is able to compute one IP (one’s complement) checksum for any combination of protocols or protocol layering. The checksum is computed and set in a packet per the CHECKSUM_PARTIAL interface (see below).}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhK;hjTubah}(h]h ]h"]h$]h&]uh1j1hj.ubeh}(h]h ]h"]h$]h&]uh1j,hj)ubj-)}(hhh](j2)}(hhh]h)}(h``NETIF_F_IP_CSUM``h]jq)}(hjzh]hNETIF_F_IP_CSUM}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1jphjxubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKAhjuubah}(h]h ]h"]h$]h&]uh1j1hjrubj2)}(hhh]h)}(hXDriver (device) is only able to checksum plain TCP or UDP packets over IPv4. These are specifically unencapsulated packets of the form IPv4|TCP or IPv4|UDP where the Protocol field in the IPv4 header is TCP or UDP. The IPv4 header may contain IP options. This feature cannot be set in features for a device with NETIF_F_HW_CSUM also set. This feature is being DEPRECATED (see below).h]hXDriver (device) is only able to checksum plain TCP or UDP packets over IPv4. These are specifically unencapsulated packets of the form IPv4|TCP or IPv4|UDP where the Protocol field in the IPv4 header is TCP or UDP. The IPv4 header may contain IP options. This feature cannot be set in features for a device with NETIF_F_HW_CSUM also set. This feature is being DEPRECATED (see below).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKBhjubah}(h]h ]h"]h$]h&]uh1j1hjrubeh}(h]h ]h"]h$]h&]uh1j,hj)ubj-)}(hhh](j2)}(hhh]h)}(h``NETIF_F_IPV6_CSUM``h]jq)}(hjh]hNETIF_F_IPV6_CSUM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKKhjubah}(h]h ]h"]h$]h&]uh1j1hjubj2)}(hhh]h)}(hXDriver (device) is only able to checksum plain TCP or UDP packets over IPv6. These are specifically unencapsulated packets of the form IPv6|TCP or IPv6|UDP where the Next Header field in the IPv6 header is either TCP or UDP. IPv6 extension headers are not supported with this feature. This feature cannot be set in features for a device with NETIF_F_HW_CSUM also set. This feature is being DEPRECATED (see below).h]hXDriver (device) is only able to checksum plain TCP or UDP packets over IPv6. These are specifically unencapsulated packets of the form IPv6|TCP or IPv6|UDP where the Next Header field in the IPv6 header is either TCP or UDP. IPv6 extension headers are not supported with this feature. This feature cannot be set in features for a device with NETIF_F_HW_CSUM also set. This feature is being DEPRECATED (see below).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKLhjubah}(h]h ]h"]h$]h&]uh1j1hjubeh}(h]h ]h"]h$]h&]uh1j,hj)ubj-)}(hhh](j2)}(hhh]h)}(h``NETIF_F_RXCSUM``h]jq)}(hjh]hNETIF_F_RXCSUM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKVhjubah}(h]h ]h"]h$]h&]uh1j1hjubj2)}(hhh]h)}(hDriver (device) performs receive checksum offload. This flag is only used to disable the RX checksum feature for a device. The stack will accept receive checksum indication in packets received on a device regardless of whether NETIF_F_RXCSUM is set.h]hDriver (device) performs receive checksum offload. This flag is only used to disable the RX checksum feature for a device. The stack will accept receive checksum indication in packets received on a device regardless of whether NETIF_F_RXCSUM is set.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKWhjubah}(h]h ]h"]h$]h&]uh1j1hjubeh}(h]h ]h"]h$]h&]uh1j,hj)ubeh}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]colsKuh1j hjubeh}(h]id1ah ]h"]h$]h&]uh1jhjubeh}(h]ip-checksum-related-featuresah ]h"]ip checksum related featuresah$]h&]uh1hhjhhhNhNubh)}(hhh](h)}(h*Checksumming of received packets by deviceh]h*Checksumming of received packets by device}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjThNhNubh)}(hiIndication of checksum verification is set in :c:type:`sk_buff.ip_summed `. Possible values are:h](h.Indication of checksum verification is set in }(hjehhhNhNubh)}(h%:c:type:`sk_buff.ip_summed `h]jq)}(hjoh]hsk_buff.ip_summed}(hjqhhhNhNubah}(h]h ](xrefcc-typeeh"]h$]h&]uh1jphjmubah}(h]h ]h"]h$]h&]refdocnetworking/checksum-offloads refdomainj|reftypetype refexplicitrefwarn reftargetsk_buffuh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhK`hjeubh. Possible values are:}(hjehhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjhK`hjTubj )}(hhh](j)}(h``CHECKSUM_NONE`` Device did not checksum this packet e.g. due to lack of capabilities. The packet contains full (though not verified) checksum in packet but not in skb->csum. Thus, skb->csum is undefined in this case. h](h)}(h``CHECKSUM_NONE``h]jq)}(hjh]h CHECKSUM_NONE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKchjubh)}(hDevice did not checksum this packet e.g. due to lack of capabilities. The packet contains full (though not verified) checksum in packet but not in skb->csum. Thus, skb->csum is undefined in this case.h]hDevice did not checksum this packet e.g. due to lack of capabilities. The packet contains full (though not verified) checksum in packet but not in skb->csum. Thus, skb->csum is undefined in this case.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKehjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hX``CHECKSUM_UNNECESSARY`` The hardware you're dealing with doesn't calculate the full checksum (as in ``CHECKSUM_COMPLETE``), but it does parse headers and verify checksums for specific protocols. For such packets it will set ``CHECKSUM_UNNECESSARY`` if their checksums are okay. :c:type:`sk_buff.csum ` is still undefined in this case though. A driver or device must never modify the checksum field in the packet even if checksum is verified. ``CHECKSUM_UNNECESSARY`` is applicable to following protocols: - TCP: IPv6 and IPv4. - UDP: IPv4 and IPv6. A device may apply CHECKSUM_UNNECESSARY to a zero UDP checksum for either IPv4 or IPv6, the networking stack may perform further validation in this case. - GRE: only if the checksum is present in the header. - SCTP: indicates the CRC in SCTP header has been validated. - FCOE: indicates the CRC in FC frame has been validated. :c:type:`sk_buff.csum_level ` indicates the number of consecutive checksums found in the packet minus one that have been verified as ``CHECKSUM_UNNECESSARY``. For instance if a device receives an IPv6->UDP->GRE->IPv4->TCP packet and a device is able to verify the checksums for UDP (possibly zero), GRE (checksum flag is set) and TCP, :c:type:`sk_buff.csum_level ` would be set to two. If the device were only able to verify the UDP checksum and not GRE, either because it doesn't support GRE checksum or because GRE checksum is bad, skb->csum_level would be set to zero (TCP checksum is not considered in this case). h](h)}(h``CHECKSUM_UNNECESSARY``h]jq)}(hjh]hCHECKSUM_UNNECESSARY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKihjubh)}(hXThe hardware you're dealing with doesn't calculate the full checksum (as in ``CHECKSUM_COMPLETE``), but it does parse headers and verify checksums for specific protocols. For such packets it will set ``CHECKSUM_UNNECESSARY`` if their checksums are okay. :c:type:`sk_buff.csum ` is still undefined in this case though. A driver or device must never modify the checksum field in the packet even if checksum is verified.h](hPThe hardware you’re dealing with doesn’t calculate the full checksum (as in }(hjhhhNhNubjq)}(h``CHECKSUM_COMPLETE``h]hCHECKSUM_COMPLETE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jphjubhg), but it does parse headers and verify checksums for specific protocols. For such packets it will set }(hjhhhNhNubjq)}(h``CHECKSUM_UNNECESSARY``h]hCHECKSUM_UNNECESSARY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jphjubh if their checksums are okay. }(hjhhhNhNubh)}(h :c:type:`sk_buff.csum `h]jq)}(hjh]h sk_buff.csum}(hjhhhNhNubah}(h]h ](j{j|c-typeeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainj|reftypetype refexplicitrefwarnjsk_buffuh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKkhjubh is still undefined in this case though. A driver or device must never modify the checksum field in the packet even if checksum is verified.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhj6hKkhjubh)}(h>``CHECKSUM_UNNECESSARY`` is applicable to following protocols:h](jq)}(h``CHECKSUM_UNNECESSARY``h]hCHECKSUM_UNNECESSARY}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1jphjAubh& is applicable to following protocols:}(hjAhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKrhjubh block_quote)}(hXw- TCP: IPv6 and IPv4. - UDP: IPv4 and IPv6. A device may apply CHECKSUM_UNNECESSARY to a zero UDP checksum for either IPv4 or IPv6, the networking stack may perform further validation in this case. - GRE: only if the checksum is present in the header. - SCTP: indicates the CRC in SCTP header has been validated. - FCOE: indicates the CRC in FC frame has been validated. h]j )}(hhh](j)}(hTCP: IPv6 and IPv4.h]h)}(hjih]hTCP: IPv6 and IPv4.}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKthjgubah}(h]h ]h"]h$]h&]uh1jhjdubj)}(hUDP: IPv4 and IPv6. A device may apply CHECKSUM_UNNECESSARY to a zero UDP checksum for either IPv4 or IPv6, the networking stack may perform further validation in this case.h]h)}(hUDP: IPv4 and IPv6. A device may apply CHECKSUM_UNNECESSARY to a zero UDP checksum for either IPv4 or IPv6, the networking stack may perform further validation in this case.h]hUDP: IPv4 and IPv6. A device may apply CHECKSUM_UNNECESSARY to a zero UDP checksum for either IPv4 or IPv6, the networking stack may perform further validation in this case.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKuhjubah}(h]h ]h"]h$]h&]uh1jhjdubj)}(h3GRE: only if the checksum is present in the header.h]h)}(hjh]h3GRE: only if the checksum is present in the header.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKxhjubah}(h]h ]h"]h$]h&]uh1jhjdubj)}(h:SCTP: indicates the CRC in SCTP header has been validated.h]h)}(hjh]h:SCTP: indicates the CRC in SCTP header has been validated.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKyhjubah}(h]h ]h"]h$]h&]uh1jhjdubj)}(h8FCOE: indicates the CRC in FC frame has been validated. h]h)}(h7FCOE: indicates the CRC in FC frame has been validated.h]h7FCOE: indicates the CRC in FC frame has been validated.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKzhjubah}(h]h ]h"]h$]h&]uh1jhjdubeh}(h]h ]h"]h$]h&]j_-uh1j hjxhKthj`ubah}(h]h ]h"]h$]h&]uh1j^hjxhKthjubh)}(hX{:c:type:`sk_buff.csum_level ` indicates the number of consecutive checksums found in the packet minus one that have been verified as ``CHECKSUM_UNNECESSARY``. For instance if a device receives an IPv6->UDP->GRE->IPv4->TCP packet and a device is able to verify the checksums for UDP (possibly zero), GRE (checksum flag is set) and TCP, :c:type:`sk_buff.csum_level ` would be set to two. If the device were only able to verify the UDP checksum and not GRE, either because it doesn't support GRE checksum or because GRE checksum is bad, skb->csum_level would be set to zero (TCP checksum is not considered in this case).h](h)}(h&:c:type:`sk_buff.csum_level `h]jq)}(hjh]hsk_buff.csum_level}(hjhhhNhNubah}(h]h ](j{j|c-typeeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainj|reftypetype refexplicitrefwarnjsk_buffuh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhK|hjubhh indicates the number of consecutive checksums found in the packet minus one that have been verified as }(hjhhhNhNubjq)}(h``CHECKSUM_UNNECESSARY``h]hCHECKSUM_UNNECESSARY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jphjubh. For instance if a device receives an IPv6->UDP->GRE->IPv4->TCP packet and a device is able to verify the checksums for UDP (possibly zero), GRE (checksum flag is set) and TCP, }(hjhhhNhNubh)}(h&:c:type:`sk_buff.csum_level `h]jq)}(hj*h]hsk_buff.csum_level}(hj,hhhNhNubah}(h]h ](j{j|c-typeeh"]h$]h&]uh1jphj(ubah}(h]h ]h"]h$]h&]refdocj refdomainj|reftypetype refexplicitrefwarnjsk_buffuh1hhjhK|hjubh would be set to two. If the device were only able to verify the UDP checksum and not GRE, either because it doesn’t support GRE checksum or because GRE checksum is bad, skb->csum_level would be set to zero (TCP checksum is not considered in this case).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjhK|hjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hX``CHECKSUM_COMPLETE`` This is the most generic way. The device supplied checksum of the _whole_ packet as seen by netif_rx() and fills in :c:type:`sk_buff.csum `. This means the hardware doesn't need to parse L3/L4 headers to implement this. Notes: - Even if device supports only some protocols, but is able to produce skb->csum, it MUST use CHECKSUM_COMPLETE, not CHECKSUM_UNNECESSARY. - CHECKSUM_COMPLETE is not applicable to SCTP and FCoE protocols. h](h)}(h``CHECKSUM_COMPLETE``h]jq)}(hj]h]hCHECKSUM_COMPLETE}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj[ubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhjWubh)}(hThis is the most generic way. The device supplied checksum of the _whole_ packet as seen by netif_rx() and fills in :c:type:`sk_buff.csum `. This means the hardware doesn't need to parse L3/L4 headers to implement this.h](htThis is the most generic way. The device supplied checksum of the _whole_ packet as seen by netif_rx() and fills in }(hjshhhNhNubh)}(h :c:type:`sk_buff.csum `h]jq)}(hj}h]h sk_buff.csum}(hjhhhNhNubah}(h]h ](j{j|c-typeeh"]h$]h&]uh1jphj{ubah}(h]h ]h"]h$]h&]refdocj refdomainj|reftypetype refexplicitrefwarnjsk_buffuh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhjsubhR. This means the hardware doesn’t need to parse L3/L4 headers to implement this.}(hjshhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjhKhjWubh)}(hNotes:h]hNotes:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhjWubj )}(hhh](j)}(hEven if device supports only some protocols, but is able to produce skb->csum, it MUST use CHECKSUM_COMPLETE, not CHECKSUM_UNNECESSARY.h]h)}(hEven if device supports only some protocols, but is able to produce skb->csum, it MUST use CHECKSUM_COMPLETE, not CHECKSUM_UNNECESSARY.h]hEven if device supports only some protocols, but is able to produce skb->csum, it MUST use CHECKSUM_COMPLETE, not CHECKSUM_UNNECESSARY.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h@CHECKSUM_COMPLETE is not applicable to SCTP and FCoE protocols. h]h)}(h?CHECKSUM_COMPLETE is not applicable to SCTP and FCoE protocols.h]h?CHECKSUM_COMPLETE is not applicable to SCTP and FCoE protocols.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]j_juh1j hjhKhjWubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hXY``CHECKSUM_PARTIAL`` A checksum is set up to be offloaded to a device as described in the output description for CHECKSUM_PARTIAL. This may occur on a packet received directly from another Linux OS, e.g., a virtualized Linux kernel on the same host, or it may be set in the input path in GRO or remote checksum offload. For the purposes of checksum verification, the checksum referred to by skb->csum_start + skb->csum_offset and any preceding checksums in the packet are considered verified. Any checksums in the packet that are after the checksum being offloaded are not considered to be verified. h](h)}(h``CHECKSUM_PARTIAL``h]jq)}(hjh]hCHECKSUM_PARTIAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhjubh)}(hXBA checksum is set up to be offloaded to a device as described in the output description for CHECKSUM_PARTIAL. This may occur on a packet received directly from another Linux OS, e.g., a virtualized Linux kernel on the same host, or it may be set in the input path in GRO or remote checksum offload. For the purposes of checksum verification, the checksum referred to by skb->csum_start + skb->csum_offset and any preceding checksums in the packet are considered verified. Any checksums in the packet that are after the checksum being offloaded are not considered to be verified.h]hXBA checksum is set up to be offloaded to a device as described in the output description for CHECKSUM_PARTIAL. This may occur on a packet received directly from another Linux OS, e.g., a virtualized Linux kernel on the same host, or it may be set in the input path in GRO or remote checksum offload. For the purposes of checksum verification, the checksum referred to by skb->csum_start + skb->csum_offset and any preceding checksums in the packet are considered verified. Any checksums in the packet that are after the checksum being offloaded are not considered to be verified.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]j_juh1j hjhKchjTubeh}(h]*checksumming-of-received-packets-by-deviceah ]h"]*checksumming of received packets by deviceah$]h&]uh1hhjhhhNhNubh)}(hhh](h)}(h$Checksumming on transmit for non-GSOh]h$Checksumming on transmit for non-GSO}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj4hNhNubh)}(hjThe stack requests checksum offload in the :c:type:`sk_buff.ip_summed ` for a packet. Values are:h](h+The stack requests checksum offload in the }(hjEhhhNhNubh)}(h%:c:type:`sk_buff.ip_summed `h]jq)}(hjOh]hsk_buff.ip_summed}(hjQhhhNhNubah}(h]h ](j{j|c-typeeh"]h$]h&]uh1jphjMubah}(h]h ]h"]h$]h&]refdocj refdomainj|reftypetype refexplicitrefwarnjsk_buffuh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhjEubh for a packet. Values are:}(hjEhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjlhKhj4ubj )}(hhh](j)}(hXw``CHECKSUM_PARTIAL`` The driver is required to checksum the packet as seen by hard_start_xmit() from :c:type:`sk_buff.csum_start ` up to the end, and to record/write the checksum at offset :c:type:`sk_buff.csum_start ` + :c:type:`sk_buff.csum_offset `. A driver may verify that the csum_start and csum_offset values are valid values given the length and offset of the packet, but it should not attempt to validate that the checksum refers to a legitimate transport layer checksum -- it is the purview of the stack to validate that csum_start and csum_offset are set correctly. When the stack requests checksum offload for a packet, the driver MUST ensure that the checksum is set correctly. A driver can either offload the checksum calculation to the device, or call skb_checksum_help (in the case that the device does not support offload for a particular checksum). ``NETIF_F_IP_CSUM`` and ``NETIF_F_IPV6_CSUM`` are being deprecated in favor of ``NETIF_F_HW_CSUM``. New devices should use ``NETIF_F_HW_CSUM`` to indicate checksum offload capability. skb_csum_hwoffload_help() can be called to resolve ``CHECKSUM_PARTIAL`` based on network device checksumming capabilities: if a packet does not match them, skb_checksum_help() or skb_crc32c_help() (depending on the value of :c:type:`sk_buff.csum_not_inet `, see :ref:`crc`) is called to resolve the checksum. h](h)}(h``CHECKSUM_PARTIAL``h]jq)}(hjh]hCHECKSUM_PARTIAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jphj~ubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhjzubh)}(hXFThe driver is required to checksum the packet as seen by hard_start_xmit() from :c:type:`sk_buff.csum_start ` up to the end, and to record/write the checksum at offset :c:type:`sk_buff.csum_start ` + :c:type:`sk_buff.csum_offset `. A driver may verify that the csum_start and csum_offset values are valid values given the length and offset of the packet, but it should not attempt to validate that the checksum refers to a legitimate transport layer checksum -- it is the purview of the stack to validate that csum_start and csum_offset are set correctly.h](hPThe driver is required to checksum the packet as seen by hard_start_xmit() from }(hjhhhNhNubh)}(h&:c:type:`sk_buff.csum_start `h]jq)}(hjh]hsk_buff.csum_start}(hjhhhNhNubah}(h]h ](j{j|c-typeeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainj|reftypetype refexplicitrefwarnjsk_buffuh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhjubh; up to the end, and to record/write the checksum at offset }(hjhhhNhNubh)}(h&:c:type:`sk_buff.csum_start `h]jq)}(hjh]hsk_buff.csum_start}(hjhhhNhNubah}(h]h ](j{j|c-typeeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainj|reftypetype refexplicitrefwarnjsk_buffuh1hhjhKhjubh + }(hjhhhNhNubh)}(h':c:type:`sk_buff.csum_offset `h]jq)}(hjh]hsk_buff.csum_offset}(hjhhhNhNubah}(h]h ](j{j|c-typeeh"]h$]h&]uh1jphjubah}(h]h ]h"]h$]h&]refdocj refdomainj|reftypetype refexplicitrefwarnjsk_buffuh1hhjhKhjubhXE. A driver may verify that the csum_start and csum_offset values are valid values given the length and offset of the packet, but it should not attempt to validate that the checksum refers to a legitimate transport layer checksum -- it is the purview of the stack to validate that csum_start and csum_offset are set correctly.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjhKhjzubh)}(hX!When the stack requests checksum offload for a packet, the driver MUST ensure that the checksum is set correctly. A driver can either offload the checksum calculation to the device, or call skb_checksum_help (in the case that the device does not support offload for a particular checksum).h]hX!When the stack requests checksum offload for a packet, the driver MUST ensure that the checksum is set correctly. A driver can either offload the checksum calculation to the device, or call skb_checksum_help (in the case that the device does not support offload for a particular checksum).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhjzubh)}(hX``NETIF_F_IP_CSUM`` and ``NETIF_F_IPV6_CSUM`` are being deprecated in favor of ``NETIF_F_HW_CSUM``. New devices should use ``NETIF_F_HW_CSUM`` to indicate checksum offload capability. skb_csum_hwoffload_help() can be called to resolve ``CHECKSUM_PARTIAL`` based on network device checksumming capabilities: if a packet does not match them, skb_checksum_help() or skb_crc32c_help() (depending on the value of :c:type:`sk_buff.csum_not_inet `, see :ref:`crc`) is called to resolve the checksum.h](jq)}(h``NETIF_F_IP_CSUM``h]hNETIF_F_IP_CSUM}(hj! hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubh and }(hj hhhNhNubjq)}(h``NETIF_F_IPV6_CSUM``h]hNETIF_F_IPV6_CSUM}(hj3 hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubh" are being deprecated in favor of }(hj hhhNhNubjq)}(h``NETIF_F_HW_CSUM``h]hNETIF_F_HW_CSUM}(hjE hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubh. New devices should use }(hj hhhNhNubjq)}(h``NETIF_F_HW_CSUM``h]hNETIF_F_HW_CSUM}(hjW hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubh] to indicate checksum offload capability. skb_csum_hwoffload_help() can be called to resolve }(hj hhhNhNubjq)}(h``CHECKSUM_PARTIAL``h]hCHECKSUM_PARTIAL}(hji hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubh based on network device checksumming capabilities: if a packet does not match them, skb_checksum_help() or skb_crc32c_help() (depending on the value of }(hj hhhNhNubh)}(h):c:type:`sk_buff.csum_not_inet `h]jq)}(hj} h]hsk_buff.csum_not_inet}(hj hhhNhNubah}(h]h ](j{j|c-typeeh"]h$]h&]uh1jphj{ ubah}(h]h ]h"]h$]h&]refdocj refdomainj|reftypetype refexplicitrefwarnjsk_buffuh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj ubh, see }(hj hhhNhNubh)}(h :ref:`crc`h]hinline)}(hj h]hcrc}(hj hhhNhNubah}(h]h ](j{stdstd-refeh"]h$]h&]uh1j hj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnjcrcuh1hhj hKhj ubh$) is called to resolve the checksum.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhj hKhjzubeh}(h]h ]h"]h$]h&]uh1jhjwubj)}(hc``CHECKSUM_NONE`` The skb was already checksummed by the protocol, or a checksum is not required. h](h)}(h``CHECKSUM_NONE``h]jq)}(hj h]h CHECKSUM_NONE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj ubh)}(hOThe skb was already checksummed by the protocol, or a checksum is not required.h]hOThe skb was already checksummed by the protocol, or a checksum is not required.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj ubeh}(h]h ]h"]h$]h&]uh1jhjwubj)}(he``CHECKSUM_UNNECESSARY`` This has the same meaning as CHECKSUM_NONE for checksum offload on output. h](h)}(h``CHECKSUM_UNNECESSARY``h]jq)}(hj h]hCHECKSUM_UNNECESSARY}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj ubh)}(hJThis has the same meaning as CHECKSUM_NONE for checksum offload on output.h]hJThis has the same meaning as CHECKSUM_NONE for checksum offload on output.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj ubeh}(h]h ]h"]h$]h&]uh1jhjwubj)}(h``CHECKSUM_COMPLETE`` Not used in checksum output. If a driver observes a packet with this value set in skbuff, it should treat the packet as if ``CHECKSUM_NONE`` were set. h](h)}(h``CHECKSUM_COMPLETE``h]jq)}(hj9 h]hCHECKSUM_COMPLETE}(hj; hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj7 ubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj3 ubh)}(hNot used in checksum output. If a driver observes a packet with this value set in skbuff, it should treat the packet as if ``CHECKSUM_NONE`` were set.h](h{Not used in checksum output. If a driver observes a packet with this value set in skbuff, it should treat the packet as if }(hjO hhhNhNubjq)}(h``CHECKSUM_NONE``h]h CHECKSUM_NONE}(hjW hhhNhNubah}(h]h ]h"]h$]h&]uh1jphjO ubh were set.}(hjO hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj3 ubeh}(h]h ]h"]h$]h&]uh1jhjwubeh}(h]h ]h"]h$]h&]j_juh1j hjhKhj4ubhtarget)}(h.. _crc:h]h}(h]h ]h"]h$]h&]refidcrcuh1j| hKhj4ubeh}(h]$checksumming-on-transmit-for-non-gsoah ]h"]$checksumming on transmit for non-gsoah$]h&]uh1hhjhhhNhNubh)}(hhh](h)}(hNon-IP checksum (CRC) offloadsh]hNon-IP checksum (CRC) offloads}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hNhNubj)}(hhh]j )}(hhh](j)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhj ubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthK uh1jhj ubj()}(hhh](j-)}(hhh](j2)}(hhh]h)}(h``NETIF_F_SCTP_CRC``h]jq)}(hj h]hNETIF_F_SCTP_CRC}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj ubah}(h]h ]h"]h$]h&]uh1j1hj ubj2)}(hhh]h)}(hXoThis feature indicates that a device is capable of offloading the SCTP CRC in a packet. To perform this offload the stack will set csum_start and csum_offset accordingly, set ip_summed to ``CHECKSUM_PARTIAL`` and set csum_not_inet to 1, to provide an indication in the skbuff that the ``CHECKSUM_PARTIAL`` refers to CRC32c. A driver that supports both IP checksum offload and SCTP CRC32c offload must verify which offload is configured for a packet by testing the value of :c:type:`sk_buff.csum_not_inet `; skb_crc32c_csum_help() is provided to resolve ``CHECKSUM_PARTIAL`` on skbs where csum_not_inet is set to 1.h](hThis feature indicates that a device is capable of offloading the SCTP CRC in a packet. To perform this offload the stack will set csum_start and csum_offset accordingly, set ip_summed to }(hj hhhNhNubjq)}(h``CHECKSUM_PARTIAL``h]hCHECKSUM_PARTIAL}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubhM and set csum_not_inet to 1, to provide an indication in the skbuff that the }(hj hhhNhNubjq)}(h``CHECKSUM_PARTIAL``h]hCHECKSUM_PARTIAL}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubh refers to CRC32c. A driver that supports both IP checksum offload and SCTP CRC32c offload must verify which offload is configured for a packet by testing the value of }(hj hhhNhNubh)}(h):c:type:`sk_buff.csum_not_inet `h]jq)}(hj h]hsk_buff.csum_not_inet}(hj hhhNhNubah}(h]h ](j{j|c-typeeh"]h$]h&]uh1jphj ubah}(h]h ]h"]h$]h&]refdocj refdomainj|reftypetype refexplicitrefwarnjsk_buffuh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj ubh0; skb_crc32c_csum_help() is provided to resolve }(hj hhhNhNubjq)}(h``CHECKSUM_PARTIAL``h]hCHECKSUM_PARTIAL}(hj7 hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubh) on skbs where csum_not_inet is set to 1.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhj2 hKhj ubah}(h]h ]h"]h$]h&]uh1j1hj ubeh}(h]h ]h"]h$]h&]uh1j,hj ubj-)}(hhh](j2)}(hhh]h)}(h``NETIF_F_FCOE_CRC``h]jq)}(hjc h]hNETIF_F_FCOE_CRC}(hje hhhNhNubah}(h]h ]h"]h$]h&]uh1jphja ubah}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj^ ubah}(h]h ]h"]h$]h&]uh1j1hj[ ubj2)}(hhh]h)}(hXThis feature indicates that a device is capable of offloading the FCOE CRC in a packet. To perform this offload the stack will set ip_summed to ``CHECKSUM_PARTIAL`` and set csum_start and csum_offset accordingly. Note that there is no indication in the skbuff that the ``CHECKSUM_PARTIAL`` refers to an FCOE checksum, so a driver that supports both IP checksum offload and FCOE CRC offload must verify which offload is configured for a packet, presumably by inspecting packet headers.h](hThis feature indicates that a device is capable of offloading the FCOE CRC in a packet. To perform this offload the stack will set ip_summed to }(hj hhhNhNubjq)}(h``CHECKSUM_PARTIAL``h]hCHECKSUM_PARTIAL}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubhi and set csum_start and csum_offset accordingly. Note that there is no indication in the skbuff that the }(hj hhhNhNubjq)}(h``CHECKSUM_PARTIAL``h]hCHECKSUM_PARTIAL}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubh refers to an FCOE checksum, so a driver that supports both IP checksum offload and FCOE CRC offload must verify which offload is configured for a packet, presumably by inspecting packet headers.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj ubah}(h]h ]h"]h$]h&]uh1j1hj[ ubeh}(h]h ]h"]h$]h&]uh1j,hj ubeh}(h]h ]h"]h$]h&]uh1j'hj ubeh}(h]h ]h"]h$]h&]colsKuh1j hj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h](non-ip-checksum-crc-offloadsj eh ]h"](non-ip checksum (crc) offloadscrceh$]h&]uh1hhjhhhNhNexpect_referenced_by_name}j j~ sexpect_referenced_by_id}j j~ subh)}(hhh](h)}(hChecksumming on output with GSOh]hChecksumming on output with GSO}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hNhNubh)}(hXIn the case of a GSO packet (skb_is_gso() is true), checksum offload is implied by the SKB_GSO_* flags in gso_type. Most obviously, if the gso_type is ``SKB_GSO_TCPV4`` or ``SKB_GSO_TCPV6``, TCP checksum offload as part of the GSO operation is implied. If a checksum is being offloaded with GSO then ip_summed is ``CHECKSUM_PARTIAL``, and both csum_start and csum_offset are set to refer to the outermost checksum being offloaded (two offloaded checksums are possible with UDP encapsulation).h](hIn the case of a GSO packet (skb_is_gso() is true), checksum offload is implied by the SKB_GSO_* flags in gso_type. Most obviously, if the gso_type is }(hj hhhNhNubjq)}(h``SKB_GSO_TCPV4``h]h SKB_GSO_TCPV4}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubh or }(hj hhhNhNubjq)}(h``SKB_GSO_TCPV6``h]h SKB_GSO_TCPV6}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubh|, TCP checksum offload as part of the GSO operation is implied. If a checksum is being offloaded with GSO then ip_summed is }(hj hhhNhNubjq)}(h``CHECKSUM_PARTIAL``h]hCHECKSUM_PARTIAL}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jphj ubh, and both csum_start and csum_offset are set to refer to the outermost checksum being offloaded (two offloaded checksums are possible with UDP encapsulation).}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhd/var/lib/git/docbuild/linux/Documentation/networking/checksum-offloads:157: ./include/linux/skbuff.hhKhj ubeh}(h]checksumming-on-output-with-gsoah ]h"]checksumming on output with gsoah$]h&]uh1hhjhhhNhNubeh}(h]skb-checksum-documentationah ]h"]skb checksum documentationah$]h&]uh1hhhhhhhhKubeh}(h]checksum-offloadsah ]h"]checksum offloadsah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksj1footnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjq error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourcehnj _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}j ]j~ asnameids}(jL jI jjjjjjjFjCjjjD jA jQjNj1j.j j j j j j j< j9 u nametypes}(jL jjjjFjjD jQj1j j j j< uh}(jI hjhjjjj!jCjjjIjA jjNjj.jTj j4j j j j j9 j jGju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}j KsRparse_messages]transform_messages]hsystem_message)}(hhh]h)}(hhh]h)Hyperlink target "crc" is not referenced.}hj sbah}(h]h ]h"]h$]h&]uh1hhj ubah}(h]h ]h"]h$]h&]levelKtypeINFOlineKsourcehuh1j uba transformerN include_log] decorationNhhub.