__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<!DOCTYPE html>
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>struct sk_buff — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=3918102e" />
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="SMC Sysctl" href="smc-sysctl.html" />
<link rel="prev" title="Seg6 Sysfs variables" href="seg6-sysctl.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#human-interfaces">Human interfaces</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../subsystem-apis.html#networking-interfaces">Networking interfaces</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="index.html">Networking</a></li>
<li class="toctree-l3"><a class="reference internal" href="../netlabel/index.html">NetLabel</a></li>
<li class="toctree-l3"><a class="reference internal" href="../infiniband/index.html">InfiniBand</a></li>
<li class="toctree-l3"><a class="reference internal" href="../isdn/index.html">ISDN</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mhi/index.html">MHI</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#storage-interfaces">Storage interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#other-subsystems">Other subsystems</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/networking/skbuff.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="struct-sk-buff">
<h1>struct sk_buff<a class="headerlink" href="#struct-sk-buff" title="Link to this heading">¶</a></h1>
<p><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff</span></code></a> is the main networking structure representing
a packet.</p>
<section id="basic-sk-buff-geometry">
<h2>Basic sk_buff geometry<a class="headerlink" href="#basic-sk-buff-geometry" title="Link to this heading">¶</a></h2>
<p><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-struct docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sk_buff</span></code></a> itself is a metadata structure and does not hold any packet
data. All the data is held in associated buffers.</p>
<p><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.head</span></code></a> points to the main “head” buffer. The head buffer is divided
into two parts:</p>
<blockquote>
<div><ul class="simple">
<li><p>data buffer, containing headers and sometimes payload;
this is the part of the skb operated on by the common helpers
such as <a class="reference internal" href="kapi.html#c.skb_put" title="skb_put"><code class="xref c c-func docutils literal notranslate"><span class="pre">skb_put()</span></code></a> or <a class="reference internal" href="kapi.html#c.skb_pull" title="skb_pull"><code class="xref c c-func docutils literal notranslate"><span class="pre">skb_pull()</span></code></a>;</p></li>
<li><p>shared info (<code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">skb_shared_info</span></code>) which holds an array of pointers
to read-only data in the (page, offset, length) format.</p></li>
</ul>
</div></blockquote>
<p>Optionally <code class="xref c c-type docutils literal notranslate"><span class="pre">skb_shared_info.frag_list</span></code> may point to another skb.</p>
<p>Basic diagram may look like this:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> ---------------
| sk_buff |
---------------
,--------------------------- + head
/ ,----------------- + data
/ / ,----------- + tail
| | | , + end
| | | |
v v v v
-----------------------------------------------
| headroom | data | tailroom | skb_shared_info |
-----------------------------------------------
+ [page frag]
+ [page frag]
+ [page frag]
+ [page frag] ---------
+ frag_list --> | sk_buff |
---------
</pre></div>
</div>
</section>
<section id="shared-skbs-and-skb-clones">
<h2>Shared skbs and skb clones<a class="headerlink" href="#shared-skbs-and-skb-clones" title="Link to this heading">¶</a></h2>
<p><code class="xref c c-member docutils literal notranslate"><span class="pre">sk_buff.users</span></code> is a simple refcount allowing multiple entities
to keep a <a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-struct docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sk_buff</span></code></a> alive. skbs with a <code class="docutils literal notranslate"><span class="pre">sk_buff.users</span> <span class="pre">!=</span> <span class="pre">1</span></code> are referred
to as shared skbs (see <a class="reference internal" href="kapi.html#c.skb_shared" title="skb_shared"><code class="xref c c-func docutils literal notranslate"><span class="pre">skb_shared()</span></code></a>).</p>
<p><a class="reference internal" href="kapi.html#c.skb_clone" title="skb_clone"><code class="xref c c-func docutils literal notranslate"><span class="pre">skb_clone()</span></code></a> allows for fast duplication of skbs. None of the data buffers
get copied, but caller gets a new metadata struct (<a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-struct docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sk_buff</span></code></a>).
&skb_shared_info.refcount indicates the number of skbs pointing at the same
packet data (i.e. clones).</p>
</section>
<section id="dataref-and-headerless-skbs">
<h2>dataref and headerless skbs<a class="headerlink" href="#dataref-and-headerless-skbs" title="Link to this heading">¶</a></h2>
<p>Transport layers send out clones of payload skbs they hold for
retransmissions. To allow lower layers of the stack to prepend their headers
we split <code class="xref c c-type docutils literal notranslate"><span class="pre">skb_shared_info.dataref</span></code> into two halves.
The lower 16 bits count the overall number of references.
The higher 16 bits indicate how many of the references are payload-only.
<a class="reference internal" href="kapi.html#c.skb_header_cloned" title="skb_header_cloned"><code class="xref c c-func docutils literal notranslate"><span class="pre">skb_header_cloned()</span></code></a> checks if skb is allowed to add / write the headers.</p>
<p>The creator of the skb (e.g. TCP) marks its skb as <a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.nohdr</span></code></a>
(via <a class="reference internal" href="kapi.html#c.__skb_header_release" title="__skb_header_release"><code class="xref c c-func docutils literal notranslate"><span class="pre">__skb_header_release()</span></code></a>). Any clone created from marked skb will get
<a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.hdr_len</span></code></a> populated with the available headroom.
If there’s the only clone in existence it’s able to modify the headroom
at will. The sequence of calls inside the transport layer is:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span><alloc skb>
skb_reserve()
__skb_header_release()
skb_clone()
// send the clone down the stack
</pre></div>
</div>
<p>This is not a very generic construct and it depends on the transport layers
doing the right thing. In practice there’s usually only one payload-only skb.
Having multiple payload-only skbs with different lengths of hdr_len is not
possible. The payload-only skbs should never leave their owner.</p>
</section>
<section id="checksum-information">
<h2>Checksum information<a class="headerlink" href="#checksum-information" title="Link to this heading">¶</a></h2>
<p>The interface for checksum offload between the stack and networking drivers
is as follows...</p>
<section id="ip-checksum-related-features">
<h3>IP checksum related features<a class="headerlink" href="#ip-checksum-related-features" title="Link to this heading">¶</a></h3>
<p>Drivers 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.</p>
<table class="docutils align-default" id="id1">
<caption><span class="caption-text">Checksum related device features</span><a class="headerlink" href="#id1" title="Link to this table">¶</a></caption>
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">NETIF_F_HW_CSUM</span></code></p></td>
<td><p>The 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).</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">NETIF_F_IP_CSUM</span></code></p></td>
<td><p>Driver (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).</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">NETIF_F_IPV6_CSUM</span></code></p></td>
<td><p>Driver (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).</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">NETIF_F_RXCSUM</span></code></p></td>
<td><p>Driver (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.</p></td>
</tr>
</tbody>
</table>
</section>
<section id="checksumming-of-received-packets-by-device">
<h3>Checksumming of received packets by device<a class="headerlink" href="#checksumming-of-received-packets-by-device" title="Link to this heading">¶</a></h3>
<p>Indication of checksum verification is set in <a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.ip_summed</span></code></a>.
Possible values are:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">CHECKSUM_NONE</span></code></p>
<p>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.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CHECKSUM_UNNECESSARY</span></code></p>
<p>The hardware you’re dealing with doesn’t calculate the full checksum
(as in <code class="docutils literal notranslate"><span class="pre">CHECKSUM_COMPLETE</span></code>), but it does parse headers and verify checksums
for specific protocols. For such packets it will set <code class="docutils literal notranslate"><span class="pre">CHECKSUM_UNNECESSARY</span></code>
if their checksums are okay. <a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.csum</span></code></a> 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.</p>
<p><code class="docutils literal notranslate"><span class="pre">CHECKSUM_UNNECESSARY</span></code> is applicable to following protocols:</p>
<blockquote>
<div><ul class="simple">
<li><p>TCP: IPv6 and IPv4.</p></li>
<li><p>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.</p></li>
<li><p>GRE: only if the checksum is present in the header.</p></li>
<li><p>SCTP: indicates the CRC in SCTP header has been validated.</p></li>
<li><p>FCOE: indicates the CRC in FC frame has been validated.</p></li>
</ul>
</div></blockquote>
<p><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.csum_level</span></code></a> indicates the number of consecutive checksums found in
the packet minus one that have been verified as <code class="docutils literal notranslate"><span class="pre">CHECKSUM_UNNECESSARY</span></code>.
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, <a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.csum_level</span></code></a> 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).</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CHECKSUM_COMPLETE</span></code></p>
<p>This is the most generic way. The device supplied checksum of the _whole_
packet as seen by <a class="reference internal" href="kapi.html#c.netif_rx" title="netif_rx"><code class="xref c c-func docutils literal notranslate"><span class="pre">netif_rx()</span></code></a> and fills in <a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.csum</span></code></a>. This means the
hardware doesn’t need to parse L3/L4 headers to implement this.</p>
<p>Notes:</p>
<ul class="simple">
<li><p>Even if device supports only some protocols, but is able to produce
skb->csum, it MUST use CHECKSUM_COMPLETE, not CHECKSUM_UNNECESSARY.</p></li>
<li><p>CHECKSUM_COMPLETE is not applicable to SCTP and FCoE protocols.</p></li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CHECKSUM_PARTIAL</span></code></p>
<p>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.</p>
</li>
</ul>
</section>
<section id="checksumming-on-transmit-for-non-gso">
<h3>Checksumming on transmit for non-GSO<a class="headerlink" href="#checksumming-on-transmit-for-non-gso" title="Link to this heading">¶</a></h3>
<p>The stack requests checksum offload in the <a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.ip_summed</span></code></a> for a packet.
Values are:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">CHECKSUM_PARTIAL</span></code></p>
<p>The driver is required to checksum the packet as seen by <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">hard_start_xmit()</span></code>
from <a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.csum_start</span></code></a> up to the end, and to record/write the checksum at
offset <a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.csum_start</span></code></a> + <a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.csum_offset</span></code></a>.
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.</p>
<p>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).</p>
<p><code class="docutils literal notranslate"><span class="pre">NETIF_F_IP_CSUM</span></code> and <code class="docutils literal notranslate"><span class="pre">NETIF_F_IPV6_CSUM</span></code> are being deprecated in favor of
<code class="docutils literal notranslate"><span class="pre">NETIF_F_HW_CSUM</span></code>. New devices should use <code class="docutils literal notranslate"><span class="pre">NETIF_F_HW_CSUM</span></code> to indicate
checksum offload capability.
<code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">skb_csum_hwoffload_help()</span></code> can be called to resolve <code class="docutils literal notranslate"><span class="pre">CHECKSUM_PARTIAL</span></code> based
on network device checksumming capabilities: if a packet does not match
them, <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">skb_checksum_help()</span></code> or <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">skb_crc32c_help()</span></code> (depending on the value of
<a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.csum_not_inet</span></code></a>, see <a class="reference internal" href="#crc"><span class="std std-ref">Non-IP checksum (CRC) offloads</span></a>)
is called to resolve the checksum.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CHECKSUM_NONE</span></code></p>
<p>The skb was already checksummed by the protocol, or a checksum is not
required.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CHECKSUM_UNNECESSARY</span></code></p>
<p>This has the same meaning as CHECKSUM_NONE for checksum offload on
output.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CHECKSUM_COMPLETE</span></code></p>
<p>Not used in checksum output. If a driver observes a packet with this value
set in skbuff, it should treat the packet as if <code class="docutils literal notranslate"><span class="pre">CHECKSUM_NONE</span></code> were set.</p>
</li>
</ul>
</section>
<section id="non-ip-checksum-crc-offloads">
<span id="crc"></span><h3>Non-IP checksum (CRC) offloads<a class="headerlink" href="#non-ip-checksum-crc-offloads" title="Link to this heading">¶</a></h3>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">NETIF_F_SCTP_CRC</span></code></p></td>
<td><p>This 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
<code class="docutils literal notranslate"><span class="pre">CHECKSUM_PARTIAL</span></code> and set csum_not_inet to 1, to provide an indication
in the skbuff that the <code class="docutils literal notranslate"><span class="pre">CHECKSUM_PARTIAL</span></code> 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 <a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><code class="xref c c-type docutils literal notranslate"><span class="pre">sk_buff.csum_not_inet</span></code></a>; <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">skb_crc32c_csum_help()</span></code> is provided to
resolve <code class="docutils literal notranslate"><span class="pre">CHECKSUM_PARTIAL</span></code> on skbs where csum_not_inet is set to 1.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">NETIF_F_FCOE_CRC</span></code></p></td>
<td><p>This 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 <code class="docutils literal notranslate"><span class="pre">CHECKSUM_PARTIAL</span></code> and set csum_start and csum_offset
accordingly. Note that there is no indication in the skbuff that the
<code class="docutils literal notranslate"><span class="pre">CHECKSUM_PARTIAL</span></code> 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.</p></td>
</tr>
</tbody>
</table>
</section>
<section id="checksumming-on-output-with-gso">
<h3>Checksumming on output with GSO<a class="headerlink" href="#checksumming-on-output-with-gso" title="Link to this heading">¶</a></h3>
<p>In the case of a GSO packet (<code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">skb_is_gso()</span></code> is true), checksum offload
is implied by the SKB_GSO_* flags in gso_type. Most obviously, if the
gso_type is <code class="docutils literal notranslate"><span class="pre">SKB_GSO_TCPV4</span></code> or <code class="docutils literal notranslate"><span class="pre">SKB_GSO_TCPV6</span></code>, TCP checksum offload as
part of the GSO operation is implied. If a checksum is being offloaded
with GSO then ip_summed is <code class="docutils literal notranslate"><span class="pre">CHECKSUM_PARTIAL</span></code>, 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).</p>
</section>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../_sources/networking/skbuff.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| caif | Folder | 0755 |
|
|
| device_drivers | Folder | 0755 |
|
|
| devlink | Folder | 0755 |
|
|
| diagnostic | Folder | 0755 |
|
|
| dsa | Folder | 0755 |
|
|
| mac80211_hwsim | Folder | 0755 |
|
|
| net_cachelines | Folder | 0755 |
|
|
| pse-pd | Folder | 0755 |
|
|
| 6lowpan.html | File | 9.97 KB | 0644 |
|
| 6pack.html | File | 18.06 KB | 0644 |
|
| af_xdp.html | File | 71.08 KB | 0644 |
|
| alias.html | File | 9.71 KB | 0644 |
|
| arcnet-hardware.html | File | 153.3 KB | 0644 |
|
| arcnet.html | File | 37.48 KB | 0644 |
|
| atm.html | File | 8.24 KB | 0644 |
|
| ax25.html | File | 8.75 KB | 0644 |
|
| bareudp.html | File | 10.56 KB | 0644 |
|
| batman-adv.html | File | 16.81 KB | 0644 |
|
| bonding.html | File | 140.89 KB | 0644 |
|
| bridge.html | File | 53.36 KB | 0644 |
|
| can.html | File | 120.11 KB | 0644 |
|
| can_ucan_protocol.html | File | 25.27 KB | 0644 |
|
| cdc_mbim.html | File | 25.28 KB | 0644 |
|
| checksum-offloads.html | File | 16.15 KB | 0644 |
|
| dctcp.html | File | 10.32 KB | 0644 |
|
| devmem.html | File | 24.33 KB | 0644 |
|
| dns_resolver.html | File | 15.11 KB | 0644 |
|
| driver.html | File | 20.41 KB | 0644 |
|
| eql.html | File | 31.48 KB | 0644 |
|
| ethtool-netlink.html | File | 274 KB | 0644 |
|
| failover.html | File | 8.43 KB | 0644 |
|
| fib_trie.html | File | 16.04 KB | 0644 |
|
| filter.html | File | 42.43 KB | 0644 |
|
| gen_stats.html | File | 14.2 KB | 0644 |
|
| generic-hdlc.html | File | 14.67 KB | 0644 |
|
| generic_netlink.html | File | 8.11 KB | 0644 |
|
| gtp.html | File | 20.55 KB | 0644 |
|
| ieee802154.html | File | 25.03 KB | 0644 |
|
| ila.html | File | 21.79 KB | 0644 |
|
| index.html | File | 108.18 KB | 0644 |
|
| ioam6-sysctl.html | File | 8.48 KB | 0644 |
|
| iou-zcrx.html | File | 16.63 KB | 0644 |
|
| ip-sysctl.html | File | 154.81 KB | 0644 |
|
| ip_dynaddr.html | File | 9.97 KB | 0644 |
|
| ipsec.html | File | 9.71 KB | 0644 |
|
| ipv6.html | File | 9.87 KB | 0644 |
|
| ipvlan.html | File | 16.87 KB | 0644 |
|
| ipvs-sysctl.html | File | 20.73 KB | 0644 |
|
| iso15765-2.html | File | 39.91 KB | 0644 |
|
| j1939.html | File | 99.33 KB | 0644 |
|
| kapi.html | File | 1.78 MB | 0644 |
|
| kcm.html | File | 21.67 KB | 0644 |
|
| l2tp.html | File | 47.74 KB | 0644 |
|
| lapb-module.html | File | 22.56 KB | 0644 |
|
| mac80211-injection.html | File | 12.37 KB | 0644 |
|
| mctp.html | File | 35.16 KB | 0644 |
|
| mpls-sysctl.html | File | 9.64 KB | 0644 |
|
| mptcp-sysctl.html | File | 13.33 KB | 0644 |
|
| mptcp.html | File | 19.74 KB | 0644 |
|
| msg_zerocopy.html | File | 19.72 KB | 0644 |
|
| multi-pf-netdev.html | File | 17.48 KB | 0644 |
|
| multiqueue.html | File | 13.21 KB | 0644 |
|
| napi.html | File | 43.36 KB | 0644 |
|
| net_dim.html | File | 76.45 KB | 0644 |
|
| net_failover.html | File | 16.3 KB | 0644 |
|
| netconsole.html | File | 31.44 KB | 0644 |
|
| netdev-features.html | File | 17.75 KB | 0644 |
|
| netdevices.html | File | 43.33 KB | 0644 |
|
| netfilter-sysctl.html | File | 8.43 KB | 0644 |
|
| netif-msg.html | File | 12.93 KB | 0644 |
|
| netmem.html | File | 14.84 KB | 0644 |
|
| nexthop-group-resilient.html | File | 24.56 KB | 0644 |
|
| nf_conntrack-sysctl.html | File | 15.77 KB | 0644 |
|
| nf_flowtable.html | File | 21.24 KB | 0644 |
|
| nfc.html | File | 13.73 KB | 0644 |
|
| oa-tc6-framework.html | File | 39.07 KB | 0644 |
|
| openvswitch.html | File | 21.15 KB | 0644 |
|
| operstates.html | File | 18.28 KB | 0644 |
|
| packet_mmap.html | File | 55.34 KB | 0644 |
|
| page_pool.html | File | 59.25 KB | 0644 |
|
| phonet.html | File | 16.92 KB | 0644 |
|
| phy-link-topology.html | File | 15.77 KB | 0644 |
|
| phy.html | File | 40.5 KB | 0644 |
|
| pktgen.html | File | 24.97 KB | 0644 |
|
| plip.html | File | 18.56 KB | 0644 |
|
| ppp_generic.html | File | 37.23 KB | 0644 |
|
| proc_net_tcp.html | File | 11.13 KB | 0644 |
|
| psp.html | File | 18.66 KB | 0644 |
|
| radiotap-headers.html | File | 14.73 KB | 0644 |
|
| rds.html | File | 29.39 KB | 0644 |
|
| regulatory.html | File | 18.44 KB | 0644 |
|
| representors.html | File | 25.79 KB | 0644 |
|
| rxrpc.html | File | 130.88 KB | 0644 |
|
| scaling.html | File | 40.25 KB | 0644 |
|
| sctp.html | File | 9.73 KB | 0644 |
|
| secid.html | File | 8.42 KB | 0644 |
|
| seg6-sysctl.html | File | 9.53 KB | 0644 |
|
| segmentation-offloads.html | File | 17.81 KB | 0644 |
|
| sfp-phylink.html | File | 41.09 KB | 0644 |
|
| skbuff.html | File | 29.22 KB | 0644 |
|
| smc-sysctl.html | File | 10.42 KB | 0644 |
|
| snmp_counter.html | File | 91.51 KB | 0644 |
|
| sriov.html | File | 9.46 KB | 0644 |
|
| statistics.html | File | 31.78 KB | 0644 |
|
| strparser.html | File | 19.15 KB | 0644 |
|
| switchdev.html | File | 39.55 KB | 0644 |
|
| sysfs-tagging.html | File | 10.95 KB | 0644 |
|
| tc-actions-env-rules.html | File | 8.87 KB | 0644 |
|
| tc-queue-filters.html | File | 9.33 KB | 0644 |
|
| tcp-thin.html | File | 10.33 KB | 0644 |
|
| tcp_ao.html | File | 35.85 KB | 0644 |
|
| team.html | File | 7.93 KB | 0644 |
|
| timestamping.html | File | 59.83 KB | 0644 |
|
| tipc.html | File | 384.61 KB | 0644 |
|
| tls-handshake.html | File | 21.18 KB | 0644 |
|
| tls-offload.html | File | 42.72 KB | 0644 |
|
| tls.html | File | 39.38 KB | 0644 |
|
| tproxy.html | File | 13.18 KB | 0644 |
|
| tuntap.html | File | 19 KB | 0644 |
|
| udplite.html | File | 23.04 KB | 0644 |
|
| vrf.html | File | 28.46 KB | 0644 |
|
| vxlan.html | File | 11.95 KB | 0644 |
|
| x25-iface.html | File | 10.9 KB | 0644 |
|
| x25.html | File | 10.07 KB | 0644 |
|
| xdp-rx-metadata.html | File | 27.46 KB | 0644 |
|
| xfrm_device.html | File | 19.14 KB | 0644 |
|
| xfrm_proc.html | File | 11.37 KB | 0644 |
|
| xfrm_sync.html | File | 15.85 KB | 0644 |
|
| xfrm_sysctl.html | File | 8.07 KB | 0644 |
|
| xsk-tx-metadata.html | File | 18.64 KB | 0644 |
|