€•Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ*/translations/zh_CN/networking/tls-offload”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/zh_TW/networking/tls-offload”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/it_IT/networking/tls-offload”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/ja_JP/networking/tls-offload”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/ko_KR/networking/tls-offload”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/pt_BR/networking/tls-offload”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/sp_SP/networking/tls-offload”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)�”}”(hŒ7SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)”h]”hŒ7SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒD/var/lib/git/docbuild/linux/Documentation/networking/tls-offload.rst”h´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒKernel TLS offload”h]”hŒKernel TLS offload”…”�”}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒKernel TLS operation”h]”hŒKernel TLS operation”…”�”}”(hhàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÝh²hh³hÇh´KubhŒ paragraph”“”)�”}”(hX_Linux kernel provides TLS connection offload infrastructure. Once a TCP connection is in ``ESTABLISHED`` state user space can enable the TLS Upper Layer Protocol (ULP) and install the cryptographic connection state. For details regarding the user-facing interface refer to the TLS documentation in :ref:`Documentation/networking/tls.rst `.”h]”(hŒYLinux kernel provides TLS connection offload infrastructure. Once a TCP connection is in ”…”�”}”(hhðh²hh³Nh´NubhŒliteral”“”)�”}”(hŒ``ESTABLISHED``”h]”hŒ ESTABLISHED”…”�”}”(hhúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhhðubhŒÂ state user space can enable the TLS Upper Layer Protocol (ULP) and install the cryptographic connection state. For details regarding the user-facing interface refer to the TLS documentation in ”…”�”}”(hhðh²hh³Nh´Nubh)�”}”(hŒ4:ref:`Documentation/networking/tls.rst `”h]”hŒinline”“”)�”}”(hjh]”hŒ Documentation/networking/tls.rst”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”(Œxref”Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”Œnetworking/tls-offload”Œ refdomain”jŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆŒ reftarget”Œ kernel_tls”uh1hh³hÇh´K hhðubhŒ.”…”�”}”(hhðh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K hhÝh²hubhï)�”}”(hŒ"``ktls`` can operate in two modes:”h]”(hù)�”}”(hŒ``ktls``”h]”hŒktls”…”�”}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj;ubhŒ can operate in two modes:”…”�”}”(hj;h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KhhÝh²hubhŒ block_quote”“”)�”}”(hX×* Software crypto mode (``TLS_SW``) - CPU handles the cryptography. In most basic cases only crypto operations synchronous with the CPU can be used, but depending on calling context CPU may utilize asynchronous crypto accelerators. The use of accelerators introduces extra latency on socket reads (decryption only starts when a read syscall is made) and additional I/O load on the system. * Packet-based NIC offload mode (``TLS_HW``) - the NIC handles crypto on a packet by packet basis, provided the packets arrive in order. This mode integrates best with the kernel stack and is described in detail in the remaining part of this document (``ethtool`` flags ``tls-hw-tx-offload`` and ``tls-hw-rx-offload``). ”h]”hŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hX‚Software crypto mode (``TLS_SW``) - CPU handles the cryptography. In most basic cases only crypto operations synchronous with the CPU can be used, but depending on calling context CPU may utilize asynchronous crypto accelerators. The use of accelerators introduces extra latency on socket reads (decryption only starts when a read syscall is made) and additional I/O load on the system.”h]”hï)�”}”(hX‚Software crypto mode (``TLS_SW``) - CPU handles the cryptography. In most basic cases only crypto operations synchronous with the CPU can be used, but depending on calling context CPU may utilize asynchronous crypto accelerators. The use of accelerators introduces extra latency on socket reads (decryption only starts when a read syscall is made) and additional I/O load on the system.”h]”(hŒSoftware crypto mode (”…”�”}”(hjhh²hh³Nh´Nubhù)�”}”(hŒ ``TLS_SW``”h]”hŒTLS_SW”…”�”}”(hjph²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjhubhXb) - CPU handles the cryptography. In most basic cases only crypto operations synchronous with the CPU can be used, but depending on calling context CPU may utilize asynchronous crypto accelerators. The use of accelerators introduces extra latency on socket reads (decryption only starts when a read syscall is made) and additional I/O load on the system.”…”�”}”(hjhh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khjdubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhj_ubjc)�”}”(hX>Packet-based NIC offload mode (``TLS_HW``) - the NIC handles crypto on a packet by packet basis, provided the packets arrive in order. This mode integrates best with the kernel stack and is described in detail in the remaining part of this document (``ethtool`` flags ``tls-hw-tx-offload`` and ``tls-hw-rx-offload``). ”h]”hï)�”}”(hX=Packet-based NIC offload mode (``TLS_HW``) - the NIC handles crypto on a packet by packet basis, provided the packets arrive in order. This mode integrates best with the kernel stack and is described in detail in the remaining part of this document (``ethtool`` flags ``tls-hw-tx-offload`` and ``tls-hw-rx-offload``).”h]”(hŒPacket-based NIC offload mode (”…”�”}”(hj’h²hh³Nh´Nubhù)�”}”(hŒ ``TLS_HW``”h]”hŒTLS_HW”…”�”}”(hjšh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj’ubhŒÑ) - the NIC handles crypto on a packet by packet basis, provided the packets arrive in order. This mode integrates best with the kernel stack and is described in detail in the remaining part of this document (”…”�”}”(hj’h²hh³Nh´Nubhù)�”}”(hŒ ``ethtool``”h]”hŒethtool”…”�”}”(hj¬h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj’ubhŒ flags ”…”�”}”(hj’h²hh³Nh´Nubhù)�”}”(hŒ``tls-hw-tx-offload``”h]”hŒtls-hw-tx-offload”…”�”}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj’ubhŒ and ”…”�”}”(hj’h²hh³Nh´Nubhù)�”}”(hŒ``tls-hw-rx-offload``”h]”hŒtls-hw-rx-offload”…”�”}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj’ubhŒ).”…”�”}”(hj’h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KhjŽubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhj_ubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ*”uh1j]h³hÇh´KhjYubah}”(h]”h ]”h"]”h$]”h&]”uh1jWh³hÇh´KhhÝh²hubhï)�”}”(hŒ™The operation mode is selected automatically based on device configuration, offload opt-in or opt-out on per-connection basis is not currently supported.”h]”hŒ™The operation mode is selected automatically based on device configuration, offload opt-in or opt-out on per-connection basis is not currently supported.”…”�”}”(hjüh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KhhÝh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒTX”h]”hŒTX”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj h²hh³hÇh´K"ubhï)�”}”(hXAt a high level user write requests are turned into a scatter list, the TLS ULP intercepts them, inserts record framing, performs encryption (in ``TLS_SW`` mode) and then hands the modified scatter list to the TCP layer. From this point on the TCP stack proceeds as normal.”h]”(hŒ‘At a high level user write requests are turned into a scatter list, the TLS ULP intercepts them, inserts record framing, performs encryption (in ”…”�”}”(hjh²hh³Nh´Nubhù)�”}”(hŒ ``TLS_SW``”h]”hŒTLS_SW”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjubhŒv mode) and then hands the modified scatter list to the TCP layer. From this point on the TCP stack proceeds as normal.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K$hj h²hubhï)�”}”(hX In ``TLS_HW`` mode the encryption is not performed in the TLS ULP. Instead packets reach a device driver, the driver will mark the packets for crypto offload based on the socket the packet is attached to, and send them to the device for encryption and transmission.”h]”(hŒIn ”…”�”}”(hj;h²hh³Nh´Nubhù)�”}”(hŒ ``TLS_HW``”h]”hŒTLS_HW”…”�”}”(hjCh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj;ubhŒü mode the encryption is not performed in the TLS ULP. Instead packets reach a device driver, the driver will mark the packets for crypto offload based on the socket the packet is attached to, and send them to the device for encryption and transmission.”…”�”}”(hj;h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K)hj h²hubeh}”(h]”Œtx”ah ]”h"]”h$]”Œtx”ah&]”uh1hÈhhÝh²hh³hÇh´K"Œ referenced”KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒRX”h]”hŒRX”…”�”}”(hjgh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjdh²hh³hÇh´K/ubhï)�”}”(hX:On the receive side, if the device handled decryption and authentication successfully, the driver will set the decrypted bit in the associated :c:type:`struct sk_buff `. The packets reach the TCP stack and are handled normally. ``ktls`` is informed when data is queued to the socket and the ``strparser`` mechanism is used to delineate the records. Upon read request, records are retrieved from the socket and passed to decryption routine. If device decrypted all the segments of the record the decryption is skipped, otherwise software path handles decryption.”h]”(hŒ�On the receive side, if the device handled decryption and authentication successfully, the driver will set the decrypted bit in the associated ”…”�”}”(hjuh²hh³Nh´Nubh)�”}”(hŒ":c:type:`struct sk_buff `”h]”hù)�”}”(hjh]”hŒstruct sk_buff”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”(jŒc”Œc-type”eh"]”h$]”h&]”uh1høhj}ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰j/Œsk_buff”uh1hh³hÇh´K1hjuubhŒ<. The packets reach the TCP stack and are handled normally. ”…”�”}”(hjuh²hh³Nh´Nubhù)�”}”(hŒ``ktls``”h]”hŒktls”…”�”}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjuubhŒ7 is informed when data is queued to the socket and the ”…”�”}”(hjuh²hh³Nh´Nubhù)�”}”(hŒ ``strparser``”h]”hŒ strparser”…”�”}”(hj³h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjuubhX mechanism is used to delineate the records. Upon read request, records are retrieved from the socket and passed to decryption routine. If device decrypted all the segments of the record the decryption is skipped, otherwise software path handles decryption.”…”�”}”(hjuh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K1hjdh²hubŒkfigure”Œ kernel_figure”“”)�”}”(hhh]”hŒfigure”“”)�”}”(hhh]”(hŒimage”“”)�”}”(hŒ™.. kernel-figure:: tls-offload-layers.svg :alt: TLS offload layers :align: center :figwidth: 28em Layers of Kernel TLS stack ”h]”h}”(h]”h ]”h"]”h$]”h&]”Œalt”ŒTLS offload layers”Œuri”Œ!networking/tls-offload-layers.svg”Œ candidates”}”jõjåsuh1jÖhjÓh³hÇh´KubhŒcaption”“”)�”}”(hŒLayers of Kernel TLS stack”h]”hŒLayers of Kernel TLS stack”…”�”}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jèh³hÇh´K?hjÓubeh}”(h]”Œid9”ah ]”h"]”h$]”h&]”Œwidth”Œ28em”Œalign”Œcenter”uh1jÑhjÎubah}”(h]”h ]”h"]”h$]”h&]”uh1jÌhjdh²hh³hÇh´Nubeh}”(h]”Œrx”ah ]”h"]”h$]”Œrx”ah&]”uh1hÈhhÝh²hh³hÇh´K/jcKubeh}”(h]”Œkernel-tls-operation”ah ]”h"]”Œkernel tls operation”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒDevice configuration”h]”hŒDevice configuration”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´KBubhï)�”}”(hŒýDuring driver initialization device sets the ``NETIF_F_HW_TLS_RX`` and ``NETIF_F_HW_TLS_TX`` features and installs its :c:type:`struct tlsdev_ops ` pointer in the :c:member:`tlsdev_ops` member of the :c:type:`struct net_device `.”h]”(hŒ-During driver initialization device sets the ”…”�”}”(hj*h²hh³Nh´Nubhù)�”}”(hŒ``NETIF_F_HW_TLS_RX``”h]”hŒNETIF_F_HW_TLS_RX”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj*ubhŒ and ”…”�”}”(hj*h²hh³Nh´Nubhù)�”}”(hŒ``NETIF_F_HW_TLS_TX``”h]”hŒNETIF_F_HW_TLS_TX”…”�”}”(hjDh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj*ubhŒ features and installs its ”…”�”}”(hj*h²hh³Nh´Nubh)�”}”(hŒ(:c:type:`struct tlsdev_ops `”h]”hù)�”}”(hjXh]”hŒstruct tlsdev_ops”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-type”eh"]”h$]”h&]”uh1høhjVubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰j/Œ tlsdev_ops”uh1hh³hÇh´KDhj*ubhŒ pointer in the ”…”�”}”(hj*h²hh³Nh´Nubh)�”}”(hŒ:c:member:`tlsdev_ops`”h]”hù)�”}”(hj{h]”hŒ tlsdev_ops”…”�”}”(hj}h²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-member”eh"]”h$]”h&]”uh1høhjyubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œmember”Œ refexplicit”‰Œrefwarn”‰j/Œ tlsdev_ops”uh1hh³hÇh´KDhj*ubhŒ member of the ”…”�”}”(hj*h²hh³Nh´Nubh)�”}”(hŒ(:c:type:`struct net_device `”h]”hù)�”}”(hjžh]”hŒstruct net_device”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-type”eh"]”h$]”h&]”uh1høhjœubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰j/Œ net_device”uh1hh³hÇh´KDhj*ubhŒ.”…”�”}”(hj*h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KDhjh²hubhï)�”}”(hX—When TLS cryptographic connection state is installed on a ``ktls`` socket (note that it is done twice, once for RX and once for TX direction, and the two are completely independent), the kernel checks if the underlying network device is offload-capable and attempts the offload. In case offload fails the connection is handled entirely in software using the same mechanism as if the offload was never tried.”h]”(hŒ:When TLS cryptographic connection state is installed on a ”…”�”}”(hjÅh²hh³Nh´Nubhù)�”}”(hŒ``ktls``”h]”hŒktls”…”�”}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjÅubhXU socket (note that it is done twice, once for RX and once for TX direction, and the two are completely independent), the kernel checks if the underlying network device is offload-capable and attempts the offload. In case offload fails the connection is handled entirely in software using the same mechanism as if the offload was never tried.”…”�”}”(hjÅh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KJhjh²hubhï)�”}”(hŒrOffload request is performed via the :c:member:`tls_dev_add` callback of :c:type:`struct tlsdev_ops `:”h]”(hŒ%Offload request is performed via the ”…”�”}”(hjåh²hh³Nh´Nubh)�”}”(hŒ:c:member:`tls_dev_add`”h]”hù)�”}”(hjïh]”hŒ tls_dev_add”…”�”}”(hjñh²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-member”eh"]”h$]”h&]”uh1høhjíubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œmember”Œ refexplicit”‰Œrefwarn”‰j/Œ tls_dev_add”uh1hh³hÇh´KQhjåubhŒ callback of ”…”�”}”(hjåh²hh³Nh´Nubh)�”}”(hŒ(:c:type:`struct tlsdev_ops `”h]”hù)�”}”(hjh]”hŒstruct tlsdev_ops”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-type”eh"]”h$]”h&]”uh1høhjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰j/Œ tlsdev_ops”uh1hh³hÇh´KQhjåubhŒ:”…”�”}”(hjåh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KQhjh²hubhŒ literal_block”“”)�”}”(hŒÛint (*tls_dev_add)(struct net_device *netdev, struct sock *sk, enum tls_offload_ctx_dir direction, struct tls_crypto_info *crypto_info, u32 start_offload_tcp_sn);”h]”hŒÛint (*tls_dev_add)(struct net_device *netdev, struct sock *sk, enum tls_offload_ctx_dir direction, struct tls_crypto_info *crypto_info, u32 start_offload_tcp_sn);”…”�”}”hj;sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”j‹Œhighlight_args”}”uh1j9h³hÇh´KThjh²hubhï)�”}”(hXˆ``direction`` indicates whether the cryptographic information is for the received or transmitted packets. Driver uses the ``sk`` parameter to retrieve the connection 5-tuple and socket family (IPv4 vs IPv6). Cryptographic information in ``crypto_info`` includes the key, iv, salt as well as TLS record sequence number. ``start_offload_tcp_sn`` indicates which TCP sequence number corresponds to the beginning of the record with sequence number from ``crypto_info``. The driver can add its state at the end of kernel structures (see :c:member:`driver_state` members in ``include/net/tls.h``) to avoid additional allocations and pointer dereferences.”h]”(hù)�”}”(hŒ ``direction``”h]”hŒ direction”…”�”}”(hjQh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjMubhŒm indicates whether the cryptographic information is for the received or transmitted packets. Driver uses the ”…”�”}”(hjMh²hh³Nh´Nubhù)�”}”(hŒ``sk``”h]”hŒsk”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjMubhŒm parameter to retrieve the connection 5-tuple and socket family (IPv4 vs IPv6). Cryptographic information in ”…”�”}”(hjMh²hh³Nh´Nubhù)�”}”(hŒ``crypto_info``”h]”hŒ crypto_info”…”�”}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjMubhŒC includes the key, iv, salt as well as TLS record sequence number. ”…”�”}”(hjMh²hh³Nh´Nubhù)�”}”(hŒ``start_offload_tcp_sn``”h]”hŒstart_offload_tcp_sn”…”�”}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjMubhŒj indicates which TCP sequence number corresponds to the beginning of the record with sequence number from ”…”�”}”(hjMh²hh³Nh´Nubhù)�”}”(hŒ``crypto_info``”h]”hŒ crypto_info”…”�”}”(hj™h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjMubhŒD. The driver can add its state at the end of kernel structures (see ”…”�”}”(hjMh²hh³Nh´Nubh)�”}”(hŒ:c:member:`driver_state`”h]”hù)�”}”(hj­h]”hŒ driver_state”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-member”eh"]”h$]”h&]”uh1høhj«ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œmember”Œ refexplicit”‰Œrefwarn”‰j/Œ driver_state”uh1hh³hÇh´K[hjMubhŒ members in ”…”�”}”(hjMh²hh³Nh´Nubhù)�”}”(hŒ``include/net/tls.h``”h]”hŒinclude/net/tls.h”…”�”}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjMubhŒ;) to avoid additional allocations and pointer dereferences.”…”�”}”(hjMh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K[hjh²hubhï)�”}”(hŒ�When the offloaded connection is destroyed the core calls the :c:member:`tls_dev_del` callback so the driver can release per-direction state:”h]”(hŒ>When the offloaded connection is destroyed the core calls the ”…”�”}”(hjæh²hh³Nh´Nubh)�”}”(hŒ:c:member:`tls_dev_del`”h]”hù)�”}”(hjðh]”hŒ tls_dev_del”…”�”}”(hjòh²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-member”eh"]”h$]”h&]”uh1høhjîubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œmember”Œ refexplicit”‰Œrefwarn”‰j/Œ tls_dev_del”uh1hh³hÇh´KfhjæubhŒ8 callback so the driver can release per-direction state:”…”�”}”(hjæh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kfhjh²hubj:)�”}”(hŒ”void (*tls_dev_del)(struct net_device *netdev, struct tls_context *ctx, enum tls_offload_ctx_dir direction);”h]”hŒ”void (*tls_dev_del)(struct net_device *netdev, struct tls_context *ctx, enum tls_offload_ctx_dir direction);”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjI‰jJj‹jK}”uh1j9h³hÇh´Kjhjh²hubhï)�”}”(hŒB``tls_dev_del`` is mandatory whenever ``tls_dev_add`` is provided.”h]”(hù)�”}”(hŒ``tls_dev_del``”h]”hŒ tls_dev_del”…”�”}”(hj*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj&ubhŒ is mandatory whenever ”…”�”}”(hj&h²hh³Nh´Nubhù)�”}”(hŒ``tls_dev_add``”h]”hŒ tls_dev_add”…”�”}”(hj<h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj&ubhŒ is provided.”…”�”}”(hj&h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kphjh²hubhï)�”}”(hŒ‰The third TLS device callback is :c:member:`tls_dev_resync`, called by the core to synchronize the TCP stream with the record boundaries:”h]”(hŒ!The third TLS device callback is ”…”�”}”(hjTh²hh³Nh´Nubh)�”}”(hŒ:c:member:`tls_dev_resync`”h]”hù)�”}”(hj^h]”hŒtls_dev_resync”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-member”eh"]”h$]”h&]”uh1høhj\ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œmember”Œ refexplicit”‰Œrefwarn”‰j/Œtls_dev_resync”uh1hh³hÇh´KrhjTubhŒN, called by the core to synchronize the TCP stream with the record boundaries:”…”�”}”(hjTh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Krhjh²hubj:)�”}”(hŒ§int (*tls_dev_resync)(struct net_device *netdev, struct sock *sk, u32 seq, u8 *rcd_sn, enum tls_offload_ctx_dir direction);”h]”hŒ§int (*tls_dev_resync)(struct net_device *netdev, struct sock *sk, u32 seq, u8 *rcd_sn, enum tls_offload_ctx_dir direction);”…”�”}”hj…sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjI‰jJj‹jK}”uh1j9h³hÇh´Kuhjh²hubhï)�”}”(hŒ/See the `Resync handling`_ section for details.”h]”(hŒSee the ”…”�”}”(hj”h²hh³Nh´NubhŒ reference”“”)�”}”(hŒ`Resync handling`_”h]”hŒResync handling”…”�”}”(hjžh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒResync handling”Œrefid”Œresync-handling”uh1jœhj”Œresolved”KubhŒ section for details.”…”�”}”(hj”h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K{hjh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒTX”h]”hŒTX”…”�”}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj»h²hh³hÇh´K~ubhï)�”}”(hŒÄAfter TX state is installed, the stack guarantees that the first segment of the stream will start exactly at the ``start_offload_tcp_sn`` sequence number, simplifying TCP sequence number matching.”h]”(hŒqAfter TX state is installed, the stack guarantees that the first segment of the stream will start exactly at the ”…”�”}”(hjÌh²hh³Nh´Nubhù)�”}”(hŒ``start_offload_tcp_sn``”h]”hŒstart_offload_tcp_sn”…”�”}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjÌubhŒ; sequence number, simplifying TCP sequence number matching.”…”�”}”(hjÌh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K€hj»h²hubhï)�”}”(hXZTX offload being fully initialized does not imply that all segments passing through the driver and which belong to the offloaded socket will be after the expected sequence number and will have kernel record information. In particular, already encrypted data may have been queued to the socket before installing the connection state in the kernel.”h]”hXZTX offload being fully initialized does not imply that all segments passing through the driver and which belong to the offloaded socket will be after the expected sequence number and will have kernel record information. In particular, already encrypted data may have been queued to the socket before installing the connection state in the kernel.”…”�”}”(hjìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K„hj»h²hubeh}”(h]”Œid1”ah ]”h"]”h$]”jaah&]”uh1hÈhjh²hh³hÇh´K~jcKubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒRX”h]”hŒRX”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´K‹ubhï)�”}”(hŒ¥In the RX direction, the local networking stack has little control over segmentation, so the initial records' TCP sequence number may be anywhere inside the segment.”h]”hŒ§In the RX direction, the local networking stack has little control over segmentation, so the initial records’ TCP sequence number may be anywhere inside the segment.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K�hjh²hubeh}”(h]”Œid2”ah ]”h"]”h$]”jah&]”uh1hÈhjh²hh³hÇh´K‹jcKubeh}”(h]”Œdevice-configuration”ah ]”h"]”Œdevice configuration”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KBubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒNormal operation”h]”hŒNormal operation”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj/h²hh³hÇh´K’ubhï)�”}”(hŒ_At the minimum the device maintains the following state for each connection, in each direction:”h]”hŒ_At the minimum the device maintains the following state for each connection, in each direction:”…”�”}”(hj@h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K”hj/h²hubjX)�”}”(hŒÏ* crypto secrets (key, iv, salt) * crypto processing state (partial blocks, partial authentication tag, etc.) * record metadata (sequence number, processing offset and length) * expected TCP sequence number ”h]”j^)�”}”(hhh]”(jc)�”}”(hŒcrypto secrets (key, iv, salt)”h]”hï)�”}”(hjWh]”hŒcrypto secrets (key, iv, salt)”…”�”}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K—hjUubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjRubjc)�”}”(hŒJcrypto processing state (partial blocks, partial authentication tag, etc.)”h]”hï)�”}”(hjnh]”hŒJcrypto processing state (partial blocks, partial authentication tag, etc.)”…”�”}”(hjph²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K˜hjlubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjRubjc)�”}”(hŒ?record metadata (sequence number, processing offset and length)”h]”hï)�”}”(hj…h]”hŒ?record metadata (sequence number, processing offset and length)”…”�”}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K™hjƒubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjRubjc)�”}”(hŒexpected TCP sequence number ”h]”hï)�”}”(hŒexpected TCP sequence number”h]”hŒexpected TCP sequence number”…”�”}”(hjžh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kšhjšubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjRubeh}”(h]”h ]”h"]”h$]”h&]”jôjõuh1j]h³hÇh´K—hjNubah}”(h]”h ]”h"]”h$]”h&]”uh1jWh³hÇh´K—hj/h²hubhï)�”}”(hX There are no guarantees on record length or record segmentation. In particular segments may start at any point of a record and contain any number of records. Assuming segments are received in order, the device should be able to perform crypto operations and authentication regardless of segmentation. For this to be possible, the device has to keep a small amount of segment-to-segment state. This includes at least:”h]”hX There are no guarantees on record length or record segmentation. In particular segments may start at any point of a record and contain any number of records. Assuming segments are received in order, the device should be able to perform crypto operations and authentication regardless of segmentation. For this to be possible, the device has to keep a small amount of segment-to-segment state. This includes at least:”…”�”}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kœhj/h²hubjX)�”}”(hŒí* partial headers (if a segment carried only a part of the TLS header) * partial data block * partial authentication tag (all data had been seen but part of the authentication tag has to be written or read from the subsequent segment) ”h]”j^)�”}”(hhh]”(jc)�”}”(hŒDpartial headers (if a segment carried only a part of the TLS header)”h]”hï)�”}”(hjÕh]”hŒDpartial headers (if a segment carried only a part of the TLS header)”…”�”}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K£hjÓubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjÐubjc)�”}”(hŒpartial data block”h]”hï)�”}”(hjìh]”hŒpartial data block”…”�”}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¤hjêubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjÐubjc)�”}”(hŒ�partial authentication tag (all data had been seen but part of the authentication tag has to be written or read from the subsequent segment) ”h]”hï)�”}”(hŒŒpartial authentication tag (all data had been seen but part of the authentication tag has to be written or read from the subsequent segment)”h]”hŒŒpartial authentication tag (all data had been seen but part of the authentication tag has to be written or read from the subsequent segment)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¥hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjÐubeh}”(h]”h ]”h"]”h$]”h&]”jôjõuh1j]h³hÇh´K£hjÌubah}”(h]”h ]”h"]”h$]”h&]”uh1jWh³hÇh´K£hj/h²hubhï)�”}”(hŒ¡Record reassembly is not necessary for TLS offload. If the packets arrive in order the device should be able to handle them separately and make forward progress.”h]”hŒ¡Record reassembly is not necessary for TLS offload. If the packets arrive in order the device should be able to handle them separately and make forward progress.”…”�”}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¨hj/h²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒTX”h]”hŒTX”…”�”}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj3h²hh³hÇh´K­ubhï)�”}”(hŒŠThe kernel stack performs record framing reserving space for the authentication tag and populating all other TLS header and tailer fields.”h]”hŒŠThe kernel stack performs record framing reserving space for the authentication tag and populating all other TLS header and tailer fields.”…”�”}”(hjDh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¯hj3h²hubhï)�”}”(hX­Both the device and the driver maintain expected TCP sequence numbers due to the possibility of retransmissions and the lack of software fallback once the packet reaches the device. For segments passed in order, the driver marks the packets with a connection identifier (note that a 5-tuple lookup is insufficient to identify packets requiring HW offload, see the :ref:`5tuple_problems` section) and hands them to the device. The device identifies the packet as requiring TLS handling and confirms the sequence number matches its expectation. The device performs encryption and authentication of the record data. It replaces the authentication tag and TCP checksum with correct values.”h]”(hXlBoth the device and the driver maintain expected TCP sequence numbers due to the possibility of retransmissions and the lack of software fallback once the packet reaches the device. For segments passed in order, the driver marks the packets with a connection identifier (note that a 5-tuple lookup is insufficient to identify packets requiring HW offload, see the ”…”�”}”(hjRh²hh³Nh´Nubh)�”}”(hŒ:ref:`5tuple_problems`”h]”j)�”}”(hj\h]”hŒ5tuple_problems”…”�”}”(hj^h²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhjZubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”jhŒreftype”Œref”Œ refexplicit”‰Œrefwarn”ˆj/Œ5tuple_problems”uh1hh³hÇh´K²hjRubhX+ section) and hands them to the device. The device identifies the packet as requiring TLS handling and confirms the sequence number matches its expectation. The device performs encryption and authentication of the record data. It replaces the authentication tag and TCP checksum with correct values.”…”�”}”(hjRh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K²hj3h²hubeh}”(h]”Œid3”ah ]”h"]”h$]”Œtx”ah&]”uh1hÈhj/h²hh³hÇh´K­jcKubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒRX”h]”hŒRX”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjŒh²hh³hÇh´K¾ubhï)�”}”(hXBefore a packet is DMAed to the host (but after NIC's embedded switching and packet transformation functions) the device validates the Layer 4 checksum and performs a 5-tuple lookup to find any TLS connection the packet may belong to (technically a 4-tuple lookup is sufficient - IP addresses and TCP port numbers, as the protocol is always TCP). If the packet is matched to a connection, the device confirms if the TCP sequence number is the expected one and proceeds to TLS handling (record delineation, decryption, authentication for each record in the packet). The device leaves the record framing unmodified, the stack takes care of record decapsulation. Device indicates successful handling of TLS offload in the per-packet context (descriptor) passed to the host.”h]”hXBefore a packet is DMAed to the host (but after NIC’s embedded switching and packet transformation functions) the device validates the Layer 4 checksum and performs a 5-tuple lookup to find any TLS connection the packet may belong to (technically a 4-tuple lookup is sufficient - IP addresses and TCP port numbers, as the protocol is always TCP). If the packet is matched to a connection, the device confirms if the TCP sequence number is the expected one and proceeds to TLS handling (record delineation, decryption, authentication for each record in the packet). The device leaves the record framing unmodified, the stack takes care of record decapsulation. Device indicates successful handling of TLS offload in the per-packet context (descriptor) passed to the host.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÀhjŒh²hubhï)�”}”(hX6Upon reception of a TLS offloaded packet, the driver sets the :c:member:`decrypted` mark in :c:type:`struct sk_buff ` corresponding to the segment. Networking stack makes sure decrypted and non-decrypted segments do not get coalesced (e.g. by GRO or socket layer) and takes care of partial decryption.”h]”(hŒ>Upon reception of a TLS offloaded packet, the driver sets the ”…”�”}”(hj«h²hh³Nh´Nubh)�”}”(hŒ:c:member:`decrypted`”h]”hù)�”}”(hjµh]”hŒ decrypted”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-member”eh"]”h$]”h&]”uh1høhj³ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œmember”Œ refexplicit”‰Œrefwarn”‰j/Œ decrypted”uh1hh³hÇh´KÌhj«ubhŒ mark in ”…”�”}”(hj«h²hh³Nh´Nubh)�”}”(hŒ":c:type:`struct sk_buff `”h]”hù)�”}”(hjØh]”hŒstruct sk_buff”…”�”}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-type”eh"]”h$]”h&]”uh1høhjÖubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰j/Œsk_buff”uh1hh³hÇh´KÌhj«ubhŒ¸ corresponding to the segment. Networking stack makes sure decrypted and non-decrypted segments do not get coalesced (e.g. by GRO or socket layer) and takes care of partial decryption.”…”�”}”(hj«h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÌhjŒh²hubeh}”(h]”Œid4”ah ]”h"]”h$]”Œrx”ah&]”uh1hÈhj/h²hh³hÇh´K¾jcKubeh}”(h]”Œnormal-operation”ah ]”h"]”Œnormal operation”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K’ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒResync handling”h]”hŒResync handling”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´KÓubhï)�”}”(hŒ¤In presence of packet drops or network packet reordering, the device may lose synchronization with the TLS stream, and require a resync with the kernel's TCP stack.”h]”hŒ¦In presence of packet drops or network packet reordering, the device may lose synchronization with the TLS stream, and require a resync with the kernel’s TCP stack.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÕhjh²hubhï)�”}”(hXONote that resync is only attempted for connections which were successfully added to the device table and are in TLS_HW mode. For example, if the table was full when cryptographic state was installed in the kernel, such connection will never get offloaded. Therefore the resync request does not carry any cryptographic connection state.”h]”hXONote that resync is only attempted for connections which were successfully added to the device table and are in TLS_HW mode. For example, if the table was full when cryptographic state was installed in the kernel, such connection will never get offloaded. Therefore the resync request does not carry any cryptographic connection state.”…”�”}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÙhjh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒTX”h]”hŒTX”…”�”}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj<h²hh³hÇh´Kàubhï)�”}”(hŒýSegments transmitted from an offloaded socket can get out of sync in similar ways to the receive side-retransmissions - local drops are possible, though network reorders are not. There are currently two mechanisms for dealing with out of order segments.”h]”hŒýSegments transmitted from an offloaded socket can get out of sync in similar ways to the receive side-retransmissions - local drops are possible, though network reorders are not. There are currently two mechanisms for dealing with out of order segments.”…”�”}”(hjMh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kâhj<h²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒCrypto state rebuilding”h]”hŒCrypto state rebuilding”…”�”}”(hj^h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj[h²hh³hÇh´Kèubhï)�”}”(hXWhenever an out of order segment is transmitted the driver provides the device with enough information to perform cryptographic operations. This means most likely that the part of the record preceding the current segment has to be passed to the device as part of the packet context, together with its TCP sequence number and TLS record number. The device can then initialize its crypto state, process and discard the preceding data (to be able to insert the authentication tag) and move onto handling the actual packet.”h]”hXWhenever an out of order segment is transmitted the driver provides the device with enough information to perform cryptographic operations. This means most likely that the part of the record preceding the current segment has to be passed to the device as part of the packet context, together with its TCP sequence number and TLS record number. The device can then initialize its crypto state, process and discard the preceding data (to be able to insert the authentication tag) and move onto handling the actual packet.”…”�”}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kêhj[h²hubhï)�”}”(hXÏIn this mode depending on the implementation the driver can either ask for a continuation with the crypto state and the new sequence number (next expected segment is the one after the out of order one), or continue with the previous stream state - assuming that the out of order segment was just a retransmission. The former is simpler, and does not require retransmission detection therefore it is the recommended method until such time it is proven inefficient.”h]”hXÏIn this mode depending on the implementation the driver can either ask for a continuation with the crypto state and the new sequence number (next expected segment is the one after the out of order one), or continue with the previous stream state - assuming that the out of order segment was just a retransmission. The former is simpler, and does not require retransmission detection therefore it is the recommended method until such time it is proven inefficient.”…”�”}”(hjzh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kóhj[h²hubeh}”(h]”Œcrypto-state-rebuilding”ah ]”h"]”Œcrypto state rebuilding”ah$]”h&]”uh1hÈhj<h²hh³hÇh´KèubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒNext record sync”h]”hŒNext record sync”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj�h²hh³hÇh´Küubhï)�”}”(hXŽWhenever an out of order segment is detected the driver requests that the ``ktls`` software fallback code encrypt it. If the segment's sequence number is lower than expected the driver assumes retransmission and doesn't change device state. If the segment is in the future, it may imply a local drop, the driver asks the stack to sync the device to the next record state and falls back to software.”h]”(hŒJWhenever an out of order segment is detected the driver requests that the ”…”�”}”(hj¡h²hh³Nh´Nubhù)�”}”(hŒ``ktls``”h]”hŒktls”…”�”}”(hj©h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj¡ubhX@ software fallback code encrypt it. If the segment’s sequence number is lower than expected the driver assumes retransmission and doesn’t change device state. If the segment is in the future, it may imply a local drop, the driver asks the stack to sync the device to the next record state and falls back to software.”…”�”}”(hj¡h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kþhj�h²hubhï)�”}”(hŒ!Resync request is indicated with:”h]”hŒ!Resync request is indicated with:”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj�h²hubj:)�”}”(hŒMvoid tls_offload_tx_resync_request(struct sock *sk, u32 got_seq, u32 exp_seq)”h]”hŒMvoid tls_offload_tx_resync_request(struct sock *sk, u32 got_seq, u32 exp_seq)”…”�”}”hjÏsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjI‰jJj‹jK}”uh1j9h³hÇh´Mhj�h²hubhï)�”}”(hŒÃUntil resync is complete driver should not access its expected TCP sequence number (as it will be updated from a different context). Following helper should be used to test if resync is complete:”h]”hŒÃUntil resync is complete driver should not access its expected TCP sequence number (as it will be updated from a different context). Following helper should be used to test if resync is complete:”…”�”}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M hj�h²hubj:)�”}”(hŒ3bool tls_offload_tx_resync_pending(struct sock *sk)”h]”hŒ3bool tls_offload_tx_resync_pending(struct sock *sk)”…”�”}”hjìsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjI‰jJj‹jK}”uh1j9h³hÇh´Mhj�h²hubhï)�”}”(hX Next time ``ktls`` pushes a record it will first send its TCP sequence number and TLS record number to the driver via the ``tls_dev_resync`` callback. The stack will also make sure that the new record will start on a segment boundary (like it does when the connection is initially added).”h]”(hŒ Next time ”…”�”}”(hjûh²hh³Nh´Nubhù)�”}”(hŒ``ktls``”h]”hŒktls”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjûubhŒh pushes a record it will first send its TCP sequence number and TLS record number to the driver via the ”…”�”}”(hjûh²hh³Nh´Nubhù)�”}”(hŒ``tls_dev_resync``”h]”hŒtls_dev_resync”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjûubhŒ” callback. The stack will also make sure that the new record will start on a segment boundary (like it does when the connection is initially added).”…”�”}”(hjûh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj�h²hubeh}”(h]”Œnext-record-sync”ah ]”h"]”Œnext record sync”ah$]”h&]”uh1hÈhj<h²hh³hÇh´Küubeh}”(h]”Œid5”ah ]”h"]”h$]”Œtx”ah&]”uh1hÈhjh²hh³hÇh´KàjcKubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒRX”h]”hŒRX”…”�”}”(hj@ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj= h²hh³hÇh´Mubhï)�”}”(hŒ­A small amount of RX reorder events may not require a full resynchronization. In particular the device should not lose synchronization when record boundary can be recovered:”h]”hŒ­A small amount of RX reorder events may not require a full resynchronization. In particular the device should not lose synchronization when record boundary can be recovered:”…”�”}”(hjN h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj= h²hubjÍ)�”}”(hhh]”jÒ)�”}”(hhh]”(j×)�”}”(hŒ˜.. kernel-figure:: tls-offload-reorder-good.svg :alt: reorder of non-header segment :align: center Reorder of non-header segment ”h]”h}”(h]”h ]”h"]”h$]”h&]”Œalt”Œreorder of non-header segment”Œuri”Œ'networking/tls-offload-reorder-good.svg”jæ}”jõjo suh1jÖhj_ h³hÇh´Kubjé)�”}”(hŒReorder of non-header segment”h]”hŒReorder of non-header segment”…”�”}”(hjq h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jèh³hÇh´M#hj_ ubeh}”(h]”Œid10”ah ]”h"]”h$]”h&]”jŒcenter”uh1jÑhj\ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jÌhj= h²hh³hÇh´Nubhï)�”}”(hŒ{Green segments are successfully decrypted, blue ones are passed as received on wire, red stripes mark start of new records.”h]”hŒ{Green segments are successfully decrypted, blue ones are passed as received on wire, red stripes mark start of new records.”…”�”}”(hj� h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M%hj= h²hubhï)�”}”(hX-In above case segment 1 is received and decrypted successfully. Segment 2 was dropped so 3 arrives out of order. The device knows the next record starts inside 3, based on record length in segment 1. Segment 3 is passed untouched, because due to lack of data from segment 2 the remainder of the previous record inside segment 3 cannot be handled. The device can, however, collect the authentication algorithm's state and partial block from the new record in segment 3 and when 4 and 5 arrive continue decryption. Finally when 2 arrives it's completely outside of expected window of the device so it's passed as is without special handling. ``ktls`` software fallback handles the decryption of record spanning segments 1, 2 and 3. The device did not get out of sync, even though two segments did not get decrypted.”h]”(hX†In above case segment 1 is received and decrypted successfully. Segment 2 was dropped so 3 arrives out of order. The device knows the next record starts inside 3, based on record length in segment 1. Segment 3 is passed untouched, because due to lack of data from segment 2 the remainder of the previous record inside segment 3 cannot be handled. The device can, however, collect the authentication algorithm’s state and partial block from the new record in segment 3 and when 4 and 5 arrive continue decryption. Finally when 2 arrives it’s completely outside of expected window of the device so it’s passed as is without special handling. ”…”�”}”(hj› h²hh³Nh´Nubhù)�”}”(hŒ``ktls``”h]”hŒktls”…”�”}”(hj£ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj› ubhŒ¥ software fallback handles the decryption of record spanning segments 1, 2 and 3. The device did not get out of sync, even though two segments did not get decrypted.”…”�”}”(hj› h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M(hj= h²hubhï)�”}”(hŒ’Kernel synchronization may be necessary if the lost segment contained a record header and arrived after the next record header has already passed:”h]”hŒ’Kernel synchronization may be necessary if the lost segment contained a record header and arrived after the next record header has already passed:”…”�”}”(hj» h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M5hj= h²hubjÍ)�”}”(hhh]”jÒ)�”}”(hhh]”(j×)�”}”(hŒš.. kernel-figure:: tls-offload-reorder-bad.svg :alt: reorder of header segment :align: center Reorder of segment with a TLS header ”h]”h}”(h]”h ]”h"]”h$]”h&]”Œalt”Œreorder of header segment”Œuri”Œ&networking/tls-offload-reorder-bad.svg”jæ}”jõjÜ suh1jÖhjÌ h³hÇh´Kubjé)�”}”(hŒ$Reorder of segment with a TLS header”h]”hŒ$Reorder of segment with a TLS header”…”�”}”(hjÞ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jèh³hÇh´M<hjÌ ubeh}”(h]”Œid11”ah ]”h"]”h$]”h&]”jŒcenter”uh1jÑhjÉ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jÌhj= h²hh³hÇh´Nubhï)�”}”(hX In this example segment 2 gets dropped, and it contains a record header. Device can only detect that segment 4 also contains a TLS header if it knows the length of the previous record from segment 2. In this case the device will lose synchronization with the stream.”h]”hX In this example segment 2 gets dropped, and it contains a record header. Device can only detect that segment 4 also contains a TLS header if it knows the length of the previous record from segment 2. In this case the device will lose synchronization with the stream.”…”�”}”(hjú h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M>hj= h²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒStream scan resynchronization”h]”hŒStream scan resynchronization”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj h²hh³hÇh´MDubhï)�”}”(hX+When the device gets out of sync and the stream reaches TCP sequence numbers more than a max size record past the expected TCP sequence number, the device starts scanning for a known header pattern. For example for TLS 1.2 and TLS 1.3 subsequent bytes of value ``0x03 0x03`` occur in the SSL/TLS version field of the header. Once pattern is matched the device continues attempting parsing headers at expected locations (based on the length fields at guessed locations). Whenever the expected location does not contain a valid header the scan is restarted.”h]”(hXWhen the device gets out of sync and the stream reaches TCP sequence numbers more than a max size record past the expected TCP sequence number, the device starts scanning for a known header pattern. For example for TLS 1.2 and TLS 1.3 subsequent bytes of value ”…”�”}”(hj h²hh³Nh´Nubhù)�”}”(hŒ ``0x03 0x03``”h]”hŒ 0x03 0x03”…”�”}”(hj! h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj ubhX occur in the SSL/TLS version field of the header. Once pattern is matched the device continues attempting parsing headers at expected locations (based on the length fields at guessed locations). Whenever the expected location does not contain a valid header the scan is restarted.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MFhj h²hubhï)�”}”(hŒÙWhen the header is matched the device sends a confirmation request to the kernel, asking if the guessed location is correct (if a TLS record really starts there), and which record sequence number the given header had.”h]”hŒÙWhen the header is matched the device sends a confirmation request to the kernel, asking if the guessed location is correct (if a TLS record really starts there), and which record sequence number the given header had.”…”�”}”(hj9 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MPhj h²hubhï)�”}”(hŒ•The asynchronous resync process is coordinated on the kernel side using struct tls_offload_resync_async, which tracks and manages the resync request.”h]”hŒ•The asynchronous resync process is coordinated on the kernel side using struct tls_offload_resync_async, which tracks and manages the resync request.”…”�”}”(hjG h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MThj h²hubhï)�”}”(hŒ;Helper functions to manage struct tls_offload_resync_async:”h]”hŒ;Helper functions to manage struct tls_offload_resync_async:”…”�”}”(hjU h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MWhj h²hubhï)�”}”(hŒ²``tls_offload_rx_resync_async_request_start()`` Initializes an asynchronous resync attempt by specifying the sequence range to monitor and resetting internal state in the struct.”h]”(hù)�”}”(hŒ/``tls_offload_rx_resync_async_request_start()``”h]”hŒ+tls_offload_rx_resync_async_request_start()”…”�”}”(hjg h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjc ubhŒƒ Initializes an asynchronous resync attempt by specifying the sequence range to monitor and resetting internal state in the struct.”…”�”}”(hjc h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MYhj h²hubhï)�”}”(hX``tls_offload_rx_resync_async_request_end()`` Retains the device's guessed TCP sequence number for comparison with current or future logged ones. It also clears the RESYNC_REQ_ASYNC flag from the resync request, indicating that the device has submitted its guessed sequence number.”h]”(hù)�”}”(hŒ-``tls_offload_rx_resync_async_request_end()``”h]”hŒ)tls_offload_rx_resync_async_request_end()”…”�”}”(hjƒ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj ubhŒî Retains the device’s guessed TCP sequence number for comparison with current or future logged ones. It also clears the RESYNC_REQ_ASYNC flag from the resync request, indicating that the device has submitted its guessed sequence number.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M]hj h²hubhï)�”}”(hŒt``tls_offload_rx_resync_async_request_cancel()`` Cancels any in-progress resync attempt, clearing the request state.”h]”(hù)�”}”(hŒ0``tls_offload_rx_resync_async_request_cancel()``”h]”hŒ,tls_offload_rx_resync_async_request_cancel()”…”�”}”(hjŸ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj› ubhŒD Cancels any in-progress resync attempt, clearing the request state.”…”�”}”(hj› h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mbhj h²hubhï)�”}”(hŒ“When the kernel processes an RX segment that begins a new TLS record, it examines the current status of the asynchronous resynchronization request.”h]”hŒ“When the kernel processes an RX segment that begins a new TLS record, it examines the current status of the asynchronous resynchronization request.”…”�”}”(hj· h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mehj h²hubhï)�”}”(hŒßIf the device is still waiting to provide its guessed TCP sequence number (the async state), the kernel records the sequence number of this segment so that it can later be compared once the device's guess becomes available.”h]”hŒáIf the device is still waiting to provide its guessed TCP sequence number (the async state), the kernel records the sequence number of this segment so that it can later be compared once the device’s guess becomes available.”…”�”}”(hjÅ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhhj h²hubhï)�”}”(hŒîIf the device has already submitted its guessed sequence number (the non-async state), the kernel now tries to match that guess against the sequence numbers of all TLS record headers that have been logged since the resync request started.”h]”hŒîIf the device has already submitted its guessed sequence number (the non-async state), the kernel now tries to match that guess against the sequence numbers of all TLS record headers that have been logged since the resync request started.”…”�”}”(hjÓ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mlhj h²hubhï)�”}”(hX–The kernel confirms the guessed location was correct and tells the device the record sequence number via the ``tls_dev_resync`` callback. Meanwhile, the device had been parsing and counting all records since the just-confirmed one, it adds the number of records it had seen to the record number provided by the kernel. At this point the device is in sync and can resume decryption at next segment boundary.”h]”(hŒmThe kernel confirms the guessed location was correct and tells the device the record sequence number via the ”…”�”}”(hjá h²hh³Nh´Nubhù)�”}”(hŒ``tls_dev_resync``”h]”hŒtls_dev_resync”…”�”}”(hjé h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjá ubhX callback. Meanwhile, the device had been parsing and counting all records since the just-confirmed one, it adds the number of records it had seen to the record number provided by the kernel. At this point the device is in sync and can resume decryption at next segment boundary.”…”�”}”(hjá h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mqhj h²hubhï)�”}”(hXFIn a pathological case the device may latch onto a sequence of matching headers and never hear back from the kernel (there is no negative confirmation from the kernel). The implementation may choose to periodically restart scan. Given how unlikely falsely-matching stream is, however, periodic restart is not deemed necessary.”h]”hXFIn a pathological case the device may latch onto a sequence of matching headers and never hear back from the kernel (there is no negative confirmation from the kernel). The implementation may choose to periodically restart scan. Given how unlikely falsely-matching stream is, however, periodic restart is not deemed necessary.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Myhj h²hubhï)�”}”(hŒ²Special care has to be taken if the confirmation request is passed asynchronously to the packet stream and record may get processed by the kernel before the confirmation request.”h]”hŒ²Special care has to be taken if the confirmation request is passed asynchronously to the packet stream and record may get processed by the kernel before the confirmation request.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj h²hubeh}”(h]”Œstream-scan-resynchronization”ah ]”h"]”Œstream scan resynchronization”ah$]”h&]”uh1hÈhj= h²hh³hÇh´MDubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒStack-driven resynchronization”h]”hŒStack-driven resynchronization”…”�”}”(hj( h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj% h²hh³hÇh´M„ubhï)�”}”(hXThe driver may also request the stack to perform resynchronization whenever it sees the records are no longer getting decrypted. If the connection is configured in this mode the stack automatically schedules resynchronization after it has received two completely encrypted records.”h]”hXThe driver may also request the stack to perform resynchronization whenever it sees the records are no longer getting decrypted. If the connection is configured in this mode the stack automatically schedules resynchronization after it has received two completely encrypted records.”…”�”}”(hj6 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M†hj% h²hubhï)�”}”(hX…The stack waits for the socket to drain and informs the device about the next expected record number and its TCP sequence number via the ``tls_dev_resync`` callback. If the records continue to be received fully encrypted stack retries the synchronization with an exponential back off (first after 2 encrypted records, then after 4 records, after 8, after 16... up until every 128 records).”h]”(hŒ‰The stack waits for the socket to drain and informs the device about the next expected record number and its TCP sequence number via the ”…”�”}”(hjD h²hh³Nh´Nubhù)�”}”(hŒ``tls_dev_resync``”h]”hŒtls_dev_resync”…”�”}”(hjL h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjD ubhŒê callback. If the records continue to be received fully encrypted stack retries the synchronization with an exponential back off (first after 2 encrypted records, then after 4 records, after 8, after 16... up until every 128 records).”…”�”}”(hjD h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MŒhj% h²hubeh}”(h]”Œstack-driven-resynchronization”ah ]”h"]”Œstack-driven resynchronization”ah$]”h&]”uh1hÈhj= h²hh³hÇh´M„ubeh}”(h]”Œid6”ah ]”h"]”h$]”Œrx”ah&]”uh1hÈhjh²hh³hÇh´MjcKubeh}”(h]”j¯ah ]”h"]”Œresync handling”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KÓjcKubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒRekey”h]”hŒRekey”…”�”}”(hj~ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj{ h²hh³hÇh´M•ubhï)�”}”(hŒ|Offload does not currently support TLS 1.3, therefore key rotation is not a concern for offloaded connections at this point.”h]”hŒ|Offload does not currently support TLS 1.3, therefore key rotation is not a concern for offloaded connections at this point.”…”�”}”(hjŒ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M—hj{ h²hubeh}”(h]”Œrekey”ah ]”h"]”Œrekey”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´M•ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒError handling”h]”hŒError handling”…”�”}”(hj¥ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj¢ h²hh³hÇh´M›ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒTX”h]”hŒTX”…”�”}”(hj¶ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj³ h²hh³hÇh´Mžubhï)�”}”(hX¯Packets may be redirected or rerouted by the stack to a different device than the selected TLS offload device. The stack will handle such condition using the :c:func:`sk_validate_xmit_skb` helper (TLS offload code installs :c:func:`tls_validate_xmit_skb` at this hook). Offload maintains information about all records until the data is fully acknowledged, so if skbs reach the wrong device they can be handled by software fallback.”h]”(hŒžPackets may be redirected or rerouted by the stack to a different device than the selected TLS offload device. The stack will handle such condition using the ”…”�”}”(hjÄ h²hh³Nh´Nubh)�”}”(hŒ:c:func:`sk_validate_xmit_skb`”h]”hù)�”}”(hjÎ h]”hŒsk_validate_xmit_skb()”…”�”}”(hjÐ h²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-func”eh"]”h$]”h&]”uh1høhjÌ ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰j/Œsk_validate_xmit_skb”uh1hh³hÇh´M hjÄ ubhŒ# helper (TLS offload code installs ”…”�”}”(hjÄ h²hh³Nh´Nubh)�”}”(hŒ:c:func:`tls_validate_xmit_skb`”h]”hù)�”}”(hjñ h]”hŒtls_validate_xmit_skb()”…”�”}”(hjó h²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-func”eh"]”h$]”h&]”uh1høhjï ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰j/Œtls_validate_xmit_skb”uh1hh³hÇh´M hjÄ ubhŒ± at this hook). Offload maintains information about all records until the data is fully acknowledged, so if skbs reach the wrong device they can be handled by software fallback.”…”�”}”(hjÄ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M hj³ h²hubhï)�”}”(hXAny device TLS offload handling error on the transmission side must result in the packet being dropped. For example if a packet got out of order due to a bug in the stack or the device, reached the device and can't be encrypted such packet must be dropped.”h]”hXAny device TLS offload handling error on the transmission side must result in the packet being dropped. For example if a packet got out of order due to a bug in the stack or the device, reached the device and can’t be encrypted such packet must be dropped.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M¨hj³ h²hubeh}”(h]”Œid7”ah ]”h"]”h$]”Œtx”ah&]”uh1hÈhj¢ h²hh³hÇh´MžjcKubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒRX”h]”hŒRX”…”�”}”(hj1 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj. h²hh³hÇh´M®ubhï)�”}”(hŒ£If the device encounters any problems with TLS offload on the receive side it should pass the packet to the host's networking stack as it was received on the wire.”h]”hŒ¥If the device encounters any problems with TLS offload on the receive side it should pass the packet to the host’s networking stack as it was received on the wire.”…”�”}”(hj? h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M°hj. h²hubhï)�”}”(hXFor example authentication failure for any record in the segment should result in passing the unmodified packet to the software fallback. This means packets should not be modified "in place". Splitting segments to handle partial decryption is not advised. In other words either all records in the packet had been handled successfully and authenticated or the packet has to be passed to the host's stack as it was on the wire (recovering original packet in the driver if device provides precise error is sufficient).”h]”hX For example authentication failure for any record in the segment should result in passing the unmodified packet to the software fallback. This means packets should not be modified “in placeâ€�. Splitting segments to handle partial decryption is not advised. In other words either all records in the packet had been handled successfully and authenticated or the packet has to be passed to the host’s stack as it was on the wire (recovering original packet in the driver if device provides precise error is sufficient).”…”�”}”(hjM h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M´hj. h²hubhï)�”}”(hŒ¼The Linux networking stack does not provide a way of reporting per-packet decryption and authentication errors, packets with errors must simply not have the :c:member:`decrypted` mark set.”h]”(hŒ�The Linux networking stack does not provide a way of reporting per-packet decryption and authentication errors, packets with errors must simply not have the ”…”�”}”(hj[ h²hh³Nh´Nubh)�”}”(hŒ:c:member:`decrypted`”h]”hù)�”}”(hje h]”hŒ decrypted”…”�”}”(hjg h²hh³Nh´Nubah}”(h]”h ]”(jj‹Œc-member”eh"]”h$]”h&]”uh1høhjc ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j)Œ refdomain”j‹Œreftype”Œmember”Œ refexplicit”‰Œrefwarn”‰j/Œ decrypted”uh1hh³hÇh´M¼hj[ ubhŒ mark set.”…”�”}”(hj[ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M¼hj. h²hubhï)�”}”(hŒZA packet should also not be handled by the TLS offload if it contains incorrect checksums.”h]”hŒZA packet should also not be handled by the TLS offload if it contains incorrect checksums.”…”�”}”(hjŒ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÀhj. h²hubeh}”(h]”Œid8”ah ]”h"]”h$]”Œrx”ah&]”uh1hÈhj¢ h²hh³hÇh´M®jcKubeh}”(h]”Œerror-handling”ah ]”h"]”Œerror handling”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´M›ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒPerformance metrics”h]”h•i†ŒPerformance metrics”…”�”}”(hj­ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjª h²hh³hÇh´MÄubhï)�”}”(hŒ@TLS offload can be characterized by the following basic metrics:”h]”hŒ@TLS offload can be characterized by the following basic metrics:”…”�”}”(hj» h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÆhjª h²hubjX)�”}”(hŒz* max connection count * connection installation rate * connection installation latency * total cryptographic performance ”h]”j^)�”}”(hhh]”(jc)�”}”(hŒmax connection count”h]”hï)�”}”(hjÒ h]”hŒmax connection count”…”�”}”(hjÔ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÈhjÐ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjÍ ubjc)�”}”(hŒconnection installation rate”h]”hï)�”}”(hjé h]”hŒconnection installation rate”…”�”}”(hjë h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÉhjç ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjÍ ubjc)�”}”(hŒconnection installation latency”h]”hï)�”}”(hj h]”hŒconnection installation latency”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÊhjþ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjÍ ubjc)�”}”(hŒ total cryptographic performance ”h]”hï)�”}”(hŒtotal cryptographic performance”h]”hŒtotal cryptographic performance”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MËhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjÍ ubeh}”(h]”h ]”h"]”h$]”h&]”jôjõuh1j]h³hÇh´MÈhjÉ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jWh³hÇh´MÈhjª h²hubhï)�”}”(hŒŒNote that each TCP connection requires a TLS session in both directions, the performance may be reported treating each direction separately.”h]”hŒŒNote that each TCP connection requires a TLS session in both directions, the performance may be reported treating each direction separately.”…”�”}”(hj9 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÍhjª h²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒMax connection count”h]”hŒMax connection count”…”�”}”(hjJ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjG h²hh³hÇh´MÑubhï)�”}”(hŒYThe number of connections device can support can be exposed via ``devlink resource`` API.”h]”(hŒ@The number of connections device can support can be exposed via ”…”�”}”(hjX h²hh³Nh´Nubhù)�”}”(hŒ``devlink resource``”h]”hŒdevlink resource”…”�”}”(hj` h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjX ubhŒ API.”…”�”}”(hjX h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÓhjG h²hubeh}”(h]”Œmax-connection-count”ah ]”h"]”Œmax connection count”ah$]”h&]”uh1hÈhjª h²hh³hÇh´MÑubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒTotal cryptographic performance”h]”hŒTotal cryptographic performance”…”�”}”(hjƒ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj€ h²hh³hÇh´M×ubhï)�”}”(hŒ:Offload performance may depend on segment and record size.”h]”hŒ:Offload performance may depend on segment and record size.”…”�”}”(hj‘ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÙhj€ h²hubhï)�”}”(hŒ~Overload of the cryptographic subsystem of the device should not have significant performance impact on non-offloaded streams.”h]”hŒ~Overload of the cryptographic subsystem of the device should not have significant performance impact on non-offloaded streams.”…”�”}”(hjŸ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÛhj€ h²hubeh}”(h]”Œtotal-cryptographic-performance”ah ]”h"]”Œtotal cryptographic performance”ah$]”h&]”uh1hÈhjª h²hh³hÇh´M×ubeh}”(h]”Œperformance-metrics”ah ]”h"]”Œperformance metrics”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´MÄubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Statistics”h]”hŒ Statistics”…”�”}”(hjÀ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj½ h²hh³hÇh´Mßubhï)�”}”(hŒQFollowing minimum set of TLS-related statistics should be reported by the driver:”h]”hŒQFollowing minimum set of TLS-related statistics should be reported by the driver:”…”�”}”(hjÎ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Máhj½ h²hubjX)�”}”(hX * ``rx_tls_decrypted_packets`` - number of successfully decrypted RX packets which were part of a TLS stream. * ``rx_tls_decrypted_bytes`` - number of TLS payload bytes in RX packets which were successfully decrypted. * ``rx_tls_ctx`` - number of TLS RX HW offload contexts added to device for decryption. * ``rx_tls_del`` - number of TLS RX HW offload contexts deleted from device (connection has finished). * ``rx_tls_resync_req_pkt`` - number of received TLS packets with a resync request. * ``rx_tls_resync_req_start`` - number of times the TLS async resync request was started. * ``rx_tls_resync_req_end`` - number of times the TLS async resync request properly ended with providing the HW tracked tcp-seq. * ``rx_tls_resync_req_skip`` - number of times the TLS async resync request procedure was started but not properly ended. * ``rx_tls_resync_res_ok`` - number of times the TLS resync response call to the driver was successfully handled. * ``rx_tls_resync_res_skip`` - number of times the TLS resync response call to the driver was terminated unsuccessfully. * ``rx_tls_err`` - number of RX packets which were part of a TLS stream but were not decrypted due to unexpected error in the state machine. * ``tx_tls_encrypted_packets`` - number of TX packets passed to the device for encryption of their TLS payload. * ``tx_tls_encrypted_bytes`` - number of TLS payload bytes in TX packets passed to the device for encryption. * ``tx_tls_ctx`` - number of TLS TX HW offload contexts added to device for encryption. * ``tx_tls_ooo`` - number of TX packets which were part of a TLS stream but did not arrive in the expected order. * ``tx_tls_skip_no_sync_data`` - number of TX packets which were part of a TLS stream and arrived out-of-order, but skipped the HW offload routine and went to the regular transmit flow as they were retransmissions of the connection handshake. * ``tx_tls_drop_no_sync_data`` - number of TX packets which were part of a TLS stream dropped, because they arrived out of order and associated record could not be found. * ``tx_tls_drop_bypass_req`` - number of TX packets which were part of a TLS stream dropped, because they contain both data that has been encrypted by software and data that expects hardware crypto offload. ”h]”j^)�”}”(hhh]”(jc)�”}”(hŒk``rx_tls_decrypted_packets`` - number of successfully decrypted RX packets which were part of a TLS stream.”h]”hï)�”}”(hŒk``rx_tls_decrypted_packets`` - number of successfully decrypted RX packets which were part of a TLS stream.”h]”(hù)�”}”(hŒ``rx_tls_decrypted_packets``”h]”hŒrx_tls_decrypted_packets”…”�”}”(hjë h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjç ubhŒO - number of successfully decrypted RX packets which were part of a TLS stream.”…”�”}”(hjç h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mähjã ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒi``rx_tls_decrypted_bytes`` - number of TLS payload bytes in RX packets which were successfully decrypted.”h]”hï)�”}”(hŒi``rx_tls_decrypted_bytes`` - number of TLS payload bytes in RX packets which were successfully decrypted.”h]”(hù)�”}”(hŒ``rx_tls_decrypted_bytes``”h]”hŒrx_tls_decrypted_bytes”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj ubhŒO - number of TLS payload bytes in RX packets which were successfully decrypted.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mæhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒU``rx_tls_ctx`` - number of TLS RX HW offload contexts added to device for decryption.”h]”hï)�”}”(hŒU``rx_tls_ctx`` - number of TLS RX HW offload contexts added to device for decryption.”h]”(hù)�”}”(hŒ``rx_tls_ctx``”h]”hŒ rx_tls_ctx”…”�”}”(hj7h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj3ubhŒG - number of TLS RX HW offload contexts added to device for decryption.”…”�”}”(hj3h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mèhj/ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒd``rx_tls_del`` - number of TLS RX HW offload contexts deleted from device (connection has finished).”h]”hï)�”}”(hŒd``rx_tls_del`` - number of TLS RX HW offload contexts deleted from device (connection has finished).”h]”(hù)�”}”(hŒ``rx_tls_del``”h]”hŒ rx_tls_del”…”�”}”(hj]h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjYubhŒV - number of TLS RX HW offload contexts deleted from device (connection has finished).”…”�”}”(hjYh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MêhjUubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒR``rx_tls_resync_req_pkt`` - number of received TLS packets with a resync request.”h]”hŒdefinition_list”“”)�”}”(hhh]”hŒdefinition_list_item”“”)�”}”(hŒQ``rx_tls_resync_req_pkt`` - number of received TLS packets with a resync request.”h]”(hŒterm”“”)�”}”(hŒH``rx_tls_resync_req_pkt`` - number of received TLS packets with a resync”h]”(hù)�”}”(hŒ``rx_tls_resync_req_pkt``”h]”hŒrx_tls_resync_req_pkt”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjŒubhŒ/ - number of received TLS packets with a resync”…”�”}”(hjŒh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÇh´Mìhj†ubhŒ definition”“”)�”}”(hhh]”hï)�”}”(hŒrequest.”h]”hŒrequest.”…”�”}”(hj­h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Míhjªubah}”(h]”h ]”h"]”h$]”h&]”uh1j¨hj†ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³hÇh´Mìhj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj{ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒX``rx_tls_resync_req_start`` - number of times the TLS async resync request was started.”h]”j€)�”}”(hhh]”j…)�”}”(hŒW``rx_tls_resync_req_start`` - number of times the TLS async resync request was started.”h]”(j‹)�”}”(hŒJ``rx_tls_resync_req_start`` - number of times the TLS async resync request”h]”(hù)�”}”(hŒ``rx_tls_resync_req_start``”h]”hŒrx_tls_resync_req_start”…”�”}”(hjâh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjÞubhŒ/ - number of times the TLS async resync request”…”�”}”(hjÞh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÇh´MîhjÚubj©)�”}”(hhh]”hï)�”}”(hŒ was started.”h]”hŒ was started.”…”�”}”(hjýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mïhjúubah}”(h]”h ]”h"]”h$]”h&]”uh1j¨hjÚubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³hÇh´Mîhj×ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÓubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒ``rx_tls_resync_req_end`` - number of times the TLS async resync request properly ended with providing the HW tracked tcp-seq.”h]”j€)�”}”(hhh]”j…)�”}”(hŒ~``rx_tls_resync_req_end`` - number of times the TLS async resync request properly ended with providing the HW tracked tcp-seq.”h]”(j‹)�”}”(hŒH``rx_tls_resync_req_end`` - number of times the TLS async resync request”h]”(hù)�”}”(hŒ``rx_tls_resync_req_end``”h]”hŒrx_tls_resync_req_end”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj.ubhŒ/ - number of times the TLS async resync request”…”�”}”(hj.h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÇh´Mðhj*ubj©)�”}”(hhh]”hï)�”}”(hŒ5properly ended with providing the HW tracked tcp-seq.”h]”hŒ5properly ended with providing the HW tracked tcp-seq.”…”�”}”(hjMh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MñhjJubah}”(h]”h ]”h"]”h$]”h&]”uh1j¨hj*ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³hÇh´Mðhj'ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj#ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒx``rx_tls_resync_req_skip`` - number of times the TLS async resync request procedure was started but not properly ended.”h]”j€)�”}”(hhh]”j…)�”}”(hŒw``rx_tls_resync_req_skip`` - number of times the TLS async resync request procedure was started but not properly ended.”h]”(j‹)�”}”(hŒI``rx_tls_resync_req_skip`` - number of times the TLS async resync request”h]”(hù)�”}”(hŒ``rx_tls_resync_req_skip``”h]”hŒrx_tls_resync_req_skip”…”�”}”(hj‚h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj~ubhŒ/ - number of times the TLS async resync request”…”�”}”(hj~h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÇh´Mòhjzubj©)�”}”(hhh]”hï)�”}”(hŒ-procedure was started but not properly ended.”h]”hŒ-procedure was started but not properly ended.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Móhjšubah}”(h]”h ]”h"]”h$]”h&]”uh1j¨hjzubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³hÇh´Mòhjwubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjsubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒp``rx_tls_resync_res_ok`` - number of times the TLS resync response call to the driver was successfully handled.”h]”j€)�”}”(hhh]”j…)�”}”(hŒo``rx_tls_resync_res_ok`` - number of times the TLS resync response call to the driver was successfully handled.”h]”(j‹)�”}”(hŒJ``rx_tls_resync_res_ok`` - number of times the TLS resync response call to”h]”(hù)�”}”(hŒ``rx_tls_resync_res_ok``”h]”hŒrx_tls_resync_res_ok”…”�”}”(hjÒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjÎubhŒ2 - number of times the TLS resync response call to”…”�”}”(hjÎh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÇh´MôhjÊubj©)�”}”(hhh]”hï)�”}”(hŒ$the driver was successfully handled.”h]”hŒ$the driver was successfully handled.”…”�”}”(hjíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mõhjêubah}”(h]”h ]”h"]”h$]”h&]”uh1j¨hjÊubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³hÇh´MôhjÇubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÃubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒw``rx_tls_resync_res_skip`` - number of times the TLS resync response call to the driver was terminated unsuccessfully.”h]”j€)�”}”(hhh]”j…)�”}”(hŒv``rx_tls_resync_res_skip`` - number of times the TLS resync response call to the driver was terminated unsuccessfully.”h]”(j‹)�”}”(hŒL``rx_tls_resync_res_skip`` - number of times the TLS resync response call to”h]”(hù)�”}”(hŒ``rx_tls_resync_res_skip``”h]”hŒrx_tls_resync_res_skip”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjubhŒ2 - number of times the TLS resync response call to”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³hÇh´Möhjubj©)�”}”(hhh]”hï)�”}”(hŒ)the driver was terminated unsuccessfully.”h]”hŒ)the driver was terminated unsuccessfully.”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M÷hj:ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¨hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³hÇh´Möhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒŠ``rx_tls_err`` - number of RX packets which were part of a TLS stream but were not decrypted due to unexpected error in the state machine.”h]”hï)�”}”(hŒŠ``rx_tls_err`` - number of RX packets which were part of a TLS stream but were not decrypted due to unexpected error in the state machine.”h]”(hù)�”}”(hŒ``rx_tls_err``”h]”hŒ rx_tls_err”…”�”}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjgubhŒ| - number of RX packets which were part of a TLS stream but were not decrypted due to unexpected error in the state machine.”…”�”}”(hjgh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Møhjcubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒm``tx_tls_encrypted_packets`` - number of TX packets passed to the device for encryption of their TLS payload.”h]”hï)�”}”(hŒm``tx_tls_encrypted_packets`` - number of TX packets passed to the device for encryption of their TLS payload.”h]”(hù)�”}”(hŒ``tx_tls_encrypted_packets``”h]”hŒtx_tls_encrypted_packets”…”�”}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj�ubhŒQ - number of TX packets passed to the device for encryption of their TLS payload.”…”�”}”(hj�h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Múhj‰ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒk``tx_tls_encrypted_bytes`` - number of TLS payload bytes in TX packets passed to the device for encryption.”h]”hï)�”}”(hŒk``tx_tls_encrypted_bytes`` - number of TLS payload bytes in TX packets passed to the device for encryption.”h]”(hù)�”}”(hŒ``tx_tls_encrypted_bytes``”h]”hŒtx_tls_encrypted_bytes”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj³ubhŒQ - number of TLS payload bytes in TX packets passed to the device for encryption.”…”�”}”(hj³h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mühj¯ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒU``tx_tls_ctx`` - number of TLS TX HW offload contexts added to device for encryption.”h]”hï)�”}”(hŒU``tx_tls_ctx`` - number of TLS TX HW offload contexts added to device for encryption.”h]”(hù)�”}”(hŒ``tx_tls_ctx``”h]”hŒ tx_tls_ctx”…”�”}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjÙubhŒG - number of TLS TX HW offload contexts added to device for encryption.”…”�”}”(hjÙh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MþhjÕubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒo``tx_tls_ooo`` - number of TX packets which were part of a TLS stream but did not arrive in the expected order.”h]”hï)�”}”(hŒo``tx_tls_ooo`` - number of TX packets which were part of a TLS stream but did not arrive in the expected order.”h]”(hù)�”}”(hŒ``tx_tls_ooo``”h]”hŒ tx_tls_ooo”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjÿubhŒa - number of TX packets which were part of a TLS stream but did not arrive in the expected order.”…”�”}”(hjÿh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjûubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒð``tx_tls_skip_no_sync_data`` - number of TX packets which were part of a TLS stream and arrived out-of-order, but skipped the HW offload routine and went to the regular transmit flow as they were retransmissions of the connection handshake.”h]”hï)�”}”(hŒð``tx_tls_skip_no_sync_data`` - number of TX packets which were part of a TLS stream and arrived out-of-order, but skipped the HW offload routine and went to the regular transmit flow as they were retransmissions of the connection handshake.”h]”(hù)�”}”(hŒ``tx_tls_skip_no_sync_data``”h]”hŒtx_tls_skip_no_sync_data”…”�”}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj%ubhŒÔ - number of TX packets which were part of a TLS stream and arrived out-of-order, but skipped the HW offload routine and went to the regular transmit flow as they were retransmissions of the connection handshake.”…”�”}”(hj%h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj!ubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒ¨``tx_tls_drop_no_sync_data`` - number of TX packets which were part of a TLS stream dropped, because they arrived out of order and associated record could not be found.”h]”hï)�”}”(hŒ¨``tx_tls_drop_no_sync_data`` - number of TX packets which were part of a TLS stream dropped, because they arrived out of order and associated record could not be found.”h]”(hù)�”}”(hŒ``tx_tls_drop_no_sync_data``”h]”hŒtx_tls_drop_no_sync_data”…”�”}”(hjOh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjKubhŒŒ - number of TX packets which were part of a TLS stream dropped, because they arrived out of order and associated record could not be found.”…”�”}”(hjKh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MhjGubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubjc)�”}”(hŒÍ``tx_tls_drop_bypass_req`` - number of TX packets which were part of a TLS stream dropped, because they contain both data that has been encrypted by software and data that expects hardware crypto offload. ”h]”hï)�”}”(hŒÌ``tx_tls_drop_bypass_req`` - number of TX packets which were part of a TLS stream dropped, because they contain both data that has been encrypted by software and data that expects hardware crypto offload.”h]”(hù)�”}”(hŒ``tx_tls_drop_bypass_req``”h]”hŒtx_tls_drop_bypass_req”…”�”}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhjqubhŒ² - number of TX packets which were part of a TLS stream dropped, because they contain both data that has been encrypted by software and data that expects hardware crypto offload.”…”�”}”(hjqh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M hjmubah}”(h]”h ]”h"]”h$]”h&]”uh1jbhjà ubeh}”(h]”h ]”h"]”h$]”h&]”jôjõuh1j]h³hÇh´MähjÜ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jWh³hÇh´Mähj½ h²hubeh}”(h]”Œ statistics”ah ]”h"]”Œ statistics”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´MßubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒubhï)�”}”(hXDropping packets is acceptable only in the event of catastrophic system errors and should never be used as an error handling mechanism in cases arising from normal operation. In other words, reliance on TCP retransmissions to handle corner cases is not acceptable.”h]”hXDropping packets is acceptable only in the event of catastrophic system errors and should never be used as an error handling mechanism in cases arising from normal operation. In other words, reliance on TCP retransmissions to handle corner cases is not acceptable.”…”�”}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M@hj¿h²hubeh}”(h]”Œ segment-drops”ah ]”h"]”Œ segment drops”ah$]”h&]”uh1hÈhj§h²hh³hÇh´M>ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒTLS device features”h]”hŒTLS device features”…”�”}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjæh²hh³hÇh´MFubhï)�”}”(hXDrivers should ignore the changes to the TLS device feature flags. These flags will be acted upon accordingly by the core ``ktls`` code. TLS device feature flags only control adding of new TLS connection offloads, old connections will remain active after flags are cleared.”h]”(hŒzDrivers should ignore the changes to the TLS device feature flags. These flags will be acted upon accordingly by the core ”…”�”}”(hj÷h²hh³Nh´Nubhù)�”}”(hŒ``ktls``”h]”hŒktls”…”�”}”(hjÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1høhj÷ubhŒ� code. TLS device feature flags only control adding of new TLS connection offloads, old connections will remain active after flags are cleared.”…”�”}”(hj÷h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MHhjæh²hubhï)�”}”(hXøTLS encryption cannot be offloaded to devices without checksum calculation offload. Hence, TLS TX device feature flag requires TX csum offload being set. Disabling the latter implies clearing the former. Disabling TX checksum offload should not affect old connections, and drivers should make sure checksum calculation does not break for them. Similarly, device-offloaded TLS decryption implies doing RXCSUM. If the user does not want to enable RX csum offload, TLS RX device feature is disabled as well.”h]”hXøTLS encryption cannot be offloaded to devices without checksum calculation offload. Hence, TLS TX device feature flag requires TX csum offload being set. Disabling the latter implies clearing the former. Disabling TX checksum offload should not affect old connections, and drivers should make sure checksum calculation does not break for them. Similarly, device-offloaded TLS decryption implies doing RXCSUM. If the user does not want to enable RX csum offload, TLS RX device feature is disabled as well.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MMhjæh²hubeh}”(h]”Œtls-device-features”ah ]”h"]”Œtls device features”ah$]”h&]”uh1hÈhj§h²hh³hÇh´MFubeh}”(h]”Œ;notable-corner-cases-exceptions-and-additional-requirements”ah ]”h"]”Œ