DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, ferruh.yigit@amd.com, stable@dpdk.org,
	Olivier Matz <olivier.matz@6wind.com>,
	Jijiang Liu <jijiang.liu@intel.com>
Subject: [PATCH 3/8] mbuf: fix Tx checksum offload examples
Date: Fri,  5 Apr 2024 14:49:42 +0200	[thread overview]
Message-ID: <20240405125039.897933-4-david.marchand@redhat.com> (raw)
In-Reply-To: <20240405125039.897933-1-david.marchand@redhat.com>

Mandate use of rte_eth_tx_prepare() in the mbuf Tx checksum offload
examples.

Remove unneeded resetting of checksums to align with the mbuf
API doxygen.

Clarify the case when requesting "inner" checksum offload with
lack of outer L4 checksum offload.

Fixes: f00dcb7b0a74 ("mbuf: fix Tx checksum offload API doc")
Fixes: 609dd68ef14f ("mbuf: enhance the API documentation of offload flags")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/prog_guide/mbuf_lib.rst | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/doc/guides/prog_guide/mbuf_lib.rst b/doc/guides/prog_guide/mbuf_lib.rst
index 049357c755..4e285c0aab 100644
--- a/doc/guides/prog_guide/mbuf_lib.rst
+++ b/doc/guides/prog_guide/mbuf_lib.rst
@@ -126,6 +126,9 @@ processing to the hardware if it supports it. For instance, the
 RTE_MBUF_F_TX_IP_CKSUM flag allows to offload the computation of the IPv4
 checksum.
 
+Support for such processing by the hardware is advertised through RTE_ETH_TX_OFFLOAD_* capabilities.
+Please note that a call to ``rte_eth_tx_prepare`` is needed to handle driver specific requirements such as resetting some checksum fields.
+
 The following examples explain how to configure different TX offloads on
 a vxlan-encapsulated tcp packet:
 ``out_eth/out_ip/out_udp/vxlan/in_eth/in_ip/in_tcp/payload``
@@ -135,7 +138,6 @@ a vxlan-encapsulated tcp packet:
     mb->l2_len = len(out_eth)
     mb->l3_len = len(out_ip)
     mb->ol_flags |= RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IP_CSUM
-    set out_ip checksum to 0 in the packet
 
   This is supported on hardware advertising RTE_ETH_TX_OFFLOAD_IPV4_CKSUM.
 
@@ -144,8 +146,6 @@ a vxlan-encapsulated tcp packet:
     mb->l2_len = len(out_eth)
     mb->l3_len = len(out_ip)
     mb->ol_flags |= RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IP_CSUM | RTE_MBUF_F_TX_UDP_CKSUM
-    set out_ip checksum to 0 in the packet
-    set out_udp checksum to pseudo header using rte_ipv4_phdr_cksum()
 
   This is supported on hardware advertising RTE_ETH_TX_OFFLOAD_IPV4_CKSUM
   and RTE_ETH_TX_OFFLOAD_UDP_CKSUM.
@@ -155,7 +155,6 @@ a vxlan-encapsulated tcp packet:
     mb->l2_len = len(out_eth + out_ip + out_udp + vxlan + in_eth)
     mb->l3_len = len(in_ip)
     mb->ol_flags |= RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IP_CSUM
-    set in_ip checksum to 0 in the packet
 
   This is similar to case 1), but l2_len is different. It is supported
   on hardware advertising RTE_ETH_TX_OFFLOAD_IPV4_CKSUM.
@@ -166,8 +165,6 @@ a vxlan-encapsulated tcp packet:
     mb->l2_len = len(out_eth + out_ip + out_udp + vxlan + in_eth)
     mb->l3_len = len(in_ip)
     mb->ol_flags |= RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IP_CSUM | RTE_MBUF_F_TX_TCP_CKSUM
-    set in_ip checksum to 0 in the packet
-    set in_tcp checksum to pseudo header using rte_ipv4_phdr_cksum()
 
   This is similar to case 2), but l2_len is different. It is supported
   on hardware advertising RTE_ETH_TX_OFFLOAD_IPV4_CKSUM and
@@ -181,9 +178,6 @@ a vxlan-encapsulated tcp packet:
     mb->l4_len = len(in_tcp)
     mb->ol_flags |= RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_TCP_CKSUM |
       RTE_MBUF_F_TX_TCP_SEG;
-    set in_ip checksum to 0 in the packet
-    set in_tcp checksum to pseudo header without including the IP
-      payload length using rte_ipv4_phdr_cksum()
 
   This is supported on hardware advertising RTE_ETH_TX_OFFLOAD_TCP_TSO.
   Note that it can only work if outer L4 checksum is 0.
@@ -196,12 +190,10 @@ a vxlan-encapsulated tcp packet:
     mb->l3_len = len(in_ip)
     mb->ol_flags |= RTE_MBUF_F_TX_OUTER_IPV4 | RTE_MBUF_F_TX_OUTER_IP_CKSUM  | \
       RTE_MBUF_F_TX_IP_CKSUM |  RTE_MBUF_F_TX_TCP_CKSUM;
-    set out_ip checksum to 0 in the packet
-    set in_ip checksum to 0 in the packet
-    set in_tcp checksum to pseudo header using rte_ipv4_phdr_cksum()
 
   This is supported on hardware advertising RTE_ETH_TX_OFFLOAD_IPV4_CKSUM,
   RTE_ETH_TX_OFFLOAD_UDP_CKSUM and RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM.
+  Note that it can only work if outer L4 checksum is 0.
 
 The list of flags and their precise meaning is described in the mbuf API
 documentation (rte_mbuf.h). Also refer to the testpmd source code
-- 
2.44.0


  parent reply	other threads:[~2024-04-05 12:51 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05 12:49 [PATCH 0/8] Fix outer UDP checksum for Intel nics David Marchand
2024-04-05 12:49 ` [PATCH 1/8] net/ice: fix check for outer UDP checksum offload David Marchand
2024-04-05 14:19   ` David Marchand
2024-04-05 12:49 ` [PATCH 2/8] net/ice: enhance debug when HW fails to transmit David Marchand
2024-04-05 12:49 ` David Marchand [this message]
2024-04-05 12:49 ` [PATCH 4/8] app/testpmd: fix outer IP checksum offload David Marchand
2024-04-05 12:49 ` [PATCH 5/8] net: fix outer UDP checksum in Intel prepare helper David Marchand
2024-04-05 12:49 ` [PATCH 6/8] net/i40e: fix outer UDP checksum offload for X710 David Marchand
2024-04-05 12:49 ` [PATCH 7/8] net/iavf: remove outer UDP checksum offload for X710 VF David Marchand
2024-04-05 12:49 ` [PATCH 8/8] net: clear outer UDP checksum in Intel prepare helper David Marchand
2024-04-05 14:45 ` [PATCH v2 0/8] Fix outer UDP checksum for Intel nics David Marchand
2024-04-05 14:45   ` [PATCH v2 1/8] net/ice: fix check for outer UDP checksum offload David Marchand
2024-04-08 15:05     ` Bruce Richardson
2024-04-05 14:45   ` [PATCH v2 2/8] net/ice: enhance debug when HW fails to transmit David Marchand
2024-04-08 15:23     ` Bruce Richardson
2024-04-11  8:30       ` David Marchand
2024-04-11  8:42         ` Bruce Richardson
2024-04-15  8:32           ` David Marchand
2024-04-05 14:45   ` [PATCH v2 3/8] mbuf: fix Tx checksum offload examples David Marchand
2024-04-05 16:20     ` Morten Brørup
2024-04-08 10:12       ` David Marchand
2024-04-09 13:38       ` Konstantin Ananyev
2024-04-09 14:44         ` Morten Brørup
2024-04-10 10:35           ` Konstantin Ananyev
2024-04-10 12:20             ` Morten Brørup
2024-04-12 12:46               ` Konstantin Ananyev
2024-04-12 14:44                 ` Morten Brørup
2024-04-12 15:17                   ` Konstantin Ananyev
2024-04-12 15:54                     ` Morten Brørup
2024-04-16  9:16                       ` Konstantin Ananyev
2024-04-16 11:36                         ` Konstantin Ananyev
2024-04-15 15:07                   ` Ferruh Yigit
2024-04-16  7:14                     ` Morten Brørup
2024-04-16  9:26                       ` Konstantin Ananyev
2024-04-05 14:45   ` [PATCH v2 4/8] app/testpmd: fix outer IP checksum offload David Marchand
2024-04-05 14:45   ` [PATCH v2 5/8] net: fix outer UDP checksum in Intel prepare helper David Marchand
2024-04-05 14:46   ` [PATCH v2 6/8] net/i40e: fix outer UDP checksum offload for X710 David Marchand
2024-04-05 14:46   ` [PATCH v2 7/8] net/iavf: remove outer UDP checksum offload for X710 VF David Marchand
2024-04-05 14:46   ` [PATCH v2 8/8] net: clear outer UDP checksum in Intel prepare helper David Marchand
2024-04-18  8:20 ` [PATCH v3 0/7] Fix outer UDP checksum for Intel nics David Marchand
2024-04-18  8:20   ` [PATCH v3 1/7] net/ice: fix check for outer UDP checksum offload David Marchand
2024-04-19 11:46     ` Morten Brørup
2024-04-18  8:20   ` [PATCH v3 2/7] net/ice: enhance debug when HW fails to transmit David Marchand
2024-04-18  8:20   ` [PATCH v3 3/7] app/testpmd: fix outer IP checksum offload David Marchand
2024-04-18  8:20   ` [PATCH v3 4/7] net: fix outer UDP checksum in Intel prepare helper David Marchand
2024-04-18  8:20   ` [PATCH v3 5/7] net/i40e: fix outer UDP checksum offload for X710 David Marchand
2024-04-18  8:20   ` [PATCH v3 6/7] net/iavf: remove outer UDP checksum offload for X710 VF David Marchand
2024-04-18  8:20   ` [PATCH v3 7/7] net: clear outer UDP checksum in Intel prepare helper David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240405125039.897933-4-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=jijiang.liu@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).