From: Olivier Matz <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH v2 02/20] mbuf: enhance the API documentation of offload flags
Date: Wed, 4 Feb 2015 10:25:07 +0100 [thread overview]
Message-ID: <1423041925-26956-3-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1423041925-26956-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Based on http://dpdk.org/ml/archives/dev/2015-January/011127.html
Also adapt the csum forward engine code to the API.
Signed-off-by: Olivier Matz <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
---
app/test-pmd/csumonly.c | 6 +++---
lib/librte_mbuf/rte_mbuf.h | 43 ++++++++++++++++++++++++++++++++++++-------
2 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 41711fd..4b438d1 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -183,16 +183,15 @@ process_inner_cksums(void *l3_hdr, uint16_t ethertype, uint16_t l3_len,
ipv4_hdr = l3_hdr;
ipv4_hdr->hdr_checksum = 0;
+ ol_flags |= PKT_TX_IPV4;
if (tso_segsz != 0 && l4_proto == IPPROTO_TCP) {
ol_flags |= PKT_TX_IP_CKSUM;
} else {
if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM)
ol_flags |= PKT_TX_IP_CKSUM;
- else {
+ else
ipv4_hdr->hdr_checksum =
rte_ipv4_cksum(ipv4_hdr);
- ol_flags |= PKT_TX_IPV4;
- }
}
} else if (ethertype == _htons(ETHER_TYPE_IPv6))
ol_flags |= PKT_TX_IPV6;
@@ -261,6 +260,7 @@ process_outer_cksums(void *outer_l3_hdr, uint16_t outer_ethertype,
if (outer_ethertype == _htons(ETHER_TYPE_IPv4)) {
ipv4_hdr->hdr_checksum = 0;
+ ol_flags |= PKT_TX_OUTER_IPV4;
if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM)
ol_flags |= PKT_TX_OUTER_IP_CKSUM;
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a554247..191a42c 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -141,24 +141,53 @@ extern "C" {
#define PKT_TX_UDP_CKSUM (3ULL << 52) /**< UDP cksum of TX pkt. computed by NIC. */
#define PKT_TX_L4_MASK (3ULL << 52) /**< Mask for L4 cksum offload request. */
-#define PKT_TX_IP_CKSUM (1ULL << 54) /**< IP cksum of TX pkt. computed by NIC. */
+/**
+ * Offload the IP checksum in the hardware. The flag PKT_TX_IPV4 should
+ * also be set by the application, altough a PMD will only check
+ * PKT_TX_IP_CKSUM.
+ * - set the IP checksum field in the packet to 0
+ * - fill the mbuf offload information: l2_len, l3_len
+ */
+#define PKT_TX_IP_CKSUM (1ULL << 54)
-/** Packet is IPv4 without requiring IP checksum offload. */
+/**
+ * Packet is IPv4. This flag must be set when using any offload feature
+ * (TSO, L3 or L4 checksum) to tell the NIC that the packet is an IPv4
+ * packet.
+ */
#define PKT_TX_IPV4 (1ULL << 55)
-/** Tell the NIC it's an IPv6 packet.*/
+/**
+ * Packet is IPv6. This flag must be set when using an offload feature
+ * (TSO or L4 checksum) to tell the NIC that the packet is an IPv6
+ * packet.
+ */
#define PKT_TX_IPV6 (1ULL << 56)
#define PKT_TX_VLAN_PKT (1ULL << 57) /**< TX packet is a 802.1q VLAN packet. */
-/** Outer IP checksum of TX packet, computed by NIC for tunneling packet.
- * The tunnel type must also be specified, ex: PKT_TX_UDP_TUNNEL_PKT. */
+/**
+ * Offload the IP checksum of an external header in the hardware. The
+ * flag PKT_TX_OUTER_IPV4 should also be set by the application, altough
+ * a PMD will only check PKT_TX_IP_CKSUM. The IP checksum field in the
+ * packet must be set to 0.
+ * - set the outer IP checksum field in the packet to 0
+ * - fill the mbuf offload information: outer_l2_len, outer_l3_len
+ */
#define PKT_TX_OUTER_IP_CKSUM (1ULL << 58)
-/** Packet is outer IPv4 without requiring IP checksum offload for tunneling packet. */
+/**
+ * Packet outer header is IPv4. This flag must be set when using any
+ * outer offload feature (L3 or L4 checksum) to tell the NIC that the
+ * packet is an IPv4 packet.
+ */
#define PKT_TX_OUTER_IPV4 (1ULL << 59)
-/** Tell the NIC it's an outer IPv6 packet for tunneling packet */
+/**
+ * Packet outer header is IPv6. This flag must be set when using any
+ * outer offload feature (L4 checksum) to tell the NIC that the packet
+ * is an IPv6 packet.
+ */
#define PKT_TX_OUTER_IPV6 (1ULL << 60)
/* Use final bit of flags to indicate a control mbuf */
--
2.1.4
next prev parent reply other threads:[~2015-02-04 9:25 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-21 23:36 [RFC 00/16] enhance checksum offload API Olivier Matz
[not found] ` <1421883395-27235-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-21 23:36 ` [RFC 01/16] mbuf: remove PKT_TX_IPV4_CSUM Olivier Matz
2015-01-21 23:36 ` [RFC 02/16] mbuf: enhance the API documentation of offload flags Olivier Matz
2015-01-21 23:36 ` [RFC 03/16] i40e: call i40e_txd_enable_checksum only for offloaded packets Olivier Matz
2015-01-21 23:36 ` [RFC 04/16] i40e: remove the use of PKT_TX_UDP_TUNNEL_PKT flag Olivier Matz
[not found] ` <1421883395-27235-5-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-23 8:06 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DB631A-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-23 8:47 ` Zhang, Helin
[not found] ` <F35DEAC7BCE34641BA9FAC6BCA4A12E70A7ECFC1-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-23 9:06 ` Olivier MATZ
2015-01-21 23:36 ` [RFC 05/16] mbuf: remove " Olivier Matz
2015-01-21 23:36 ` [RFC 06/16] ethdev: add outer IP offload capability flag Olivier Matz
2015-01-21 23:36 ` [RFC 07/16] i40e: advertise outer IPv4 checksum capability Olivier Matz
2015-01-21 23:36 ` [RFC 08/16] testpmd: replace tx_checksum command by csum Olivier Matz
2015-01-21 23:36 ` [RFC 09/16] testpmd: move csum_show in a function Olivier Matz
[not found] ` <1421883395-27235-10-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-23 11:03 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DB63D6-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-23 17:53 ` Olivier MATZ
2015-01-21 23:36 ` [RFC 10/16] testpmd: add csum parse_tunnel command Olivier Matz
2015-01-21 23:36 ` [RFC 11/16] testpmd: rename vxlan in outer_ip in csum commands Olivier Matz
[not found] ` <1421883395-27235-12-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-23 11:21 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DB6402-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-23 17:49 ` Olivier MATZ
2015-01-21 23:36 ` [RFC 12/16] testpmd: introduce parse_ipv* in csum fwd engine Olivier Matz
2015-01-21 23:36 ` [RFC 13/16] testpmd: use a structure to store offload info " Olivier Matz
2015-01-21 23:36 ` [RFC 14/16] testpmd: introduce parse_vxlan " Olivier Matz
2015-01-21 23:36 ` [RFC 15/16] testpmd: support gre tunnels " Olivier Matz
2015-01-21 23:36 ` [RFC 16/16] testpmd: support ipip tunnel in csum forward engine Olivier Matz
2015-01-21 23:41 ` [RFC 00/16] enhance checksum offload API Olivier MATZ
[not found] ` <54C0390F.3040004-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-22 10:00 ` Thomas Monjalon
2015-01-22 1:01 ` Stephen Hemminger
2015-01-23 9:52 ` Olivier MATZ
2015-01-23 7:54 ` Liu, Jijiang
2015-01-30 13:15 ` [PATCH 00/20] enhance tx " Olivier Matz
[not found] ` <1422623775-8050-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-30 13:15 ` [PATCH 01/20] mbuf: remove PKT_TX_IPV4_CSUM Olivier Matz
2015-01-30 13:15 ` [PATCH 02/20] mbuf: enhance the API documentation of offload flags Olivier Matz
2015-01-30 13:15 ` [PATCH 03/20] i40e: call i40e_txd_enable_checksum only for offloaded packets Olivier Matz
2015-01-30 13:15 ` [PATCH 04/20] i40e: remove the use of PKT_TX_UDP_TUNNEL_PKT flag Olivier Matz
2015-01-30 13:16 ` [PATCH 05/20] mbuf: remove " Olivier Matz
2015-01-30 13:16 ` [PATCH 06/20] testpmd: replace tx_checksum command by csum Olivier Matz
2015-01-30 13:16 ` [PATCH 07/20] testpmd: move csum_show in a function Olivier Matz
2015-01-30 13:16 ` [PATCH 08/20] testpmd: add csum parse_tunnel command Olivier Matz
2015-01-30 13:16 ` [PATCH 09/20] testpmd: rename vxlan in outer_ip in csum commands Olivier Matz
2015-01-30 13:16 ` [PATCH 10/20] testpmd: introduce parse_ipv* in csum fwd engine Olivier Matz
2015-01-30 13:16 ` [PATCH 11/20] testpmd: use a structure to store offload info " Olivier Matz
2015-01-30 13:16 ` [PATCH 12/20] testpmd: introduce parse_vxlan " Olivier Matz
[not found] ` <1422623775-8050-13-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-02 1:49 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DC963B-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-02 12:42 ` Olivier MATZ
2015-01-30 13:16 ` [PATCH 13/20] testpmd: support gre tunnels " Olivier Matz
[not found] ` <1422623775-8050-14-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-02 3:04 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DC9728-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-02 12:55 ` Olivier MATZ
[not found] ` <54CF73B7.1020104-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-02 13:16 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DCAA13-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-02 13:30 ` Olivier MATZ
2015-01-30 13:16 ` [PATCH 14/20] testpmd: support ipip tunnel in csum forward engine Olivier Matz
2015-01-30 13:16 ` [PATCH 15/20] ethdev: add outer IP offload capability flag Olivier Matz
2015-01-30 13:16 ` [PATCH 16/20] i40e: advertise outer IPv4 checksum capability Olivier Matz
2015-01-30 13:16 ` [PATCH 17/20] testpmd: add a warning if outer ip cksum requested but not supported Olivier Matz
2015-01-30 13:16 ` [PATCH 18/20] testpmd: fix TSO when using outer checksum offloads Olivier Matz
2015-01-30 13:16 ` [PATCH 19/20] i40e: fix offloading of outer checksum for ip in ip tunnels Olivier Matz
2015-01-30 13:16 ` [PATCH 20/20] i40e: add debug logs for tx context descriptors Olivier Matz
2015-02-04 9:25 ` [PATCH v2 00/20] enhance tx checksum offload API Olivier Matz
[not found] ` <1423041925-26956-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-04 9:25 ` [PATCH v2 01/20] mbuf: remove PKT_TX_IPV4_CSUM Olivier Matz
2015-02-04 9:25 ` Olivier Matz [this message]
[not found] ` <1423041925-26956-3-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-10 5:38 ` [PATCH v2 02/20] mbuf: enhance the API documentation of offload flags Zhang, Helin
[not found] ` <F35DEAC7BCE34641BA9FAC6BCA4A12E70A806563-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-10 16:54 ` Olivier MATZ
2015-02-11 7:15 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DDA2CF-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-11 15:15 ` Olivier MATZ
2015-02-04 9:25 ` [PATCH v2 03/20] i40e: call i40e_txd_enable_checksum only for offloaded packets Olivier Matz
[not found] ` <1423041925-26956-4-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-10 6:03 ` Zhang, Helin
[not found] ` <F35DEAC7BCE34641BA9FAC6BCA4A12E70A8065D4-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-10 17:06 ` Olivier MATZ
[not found] ` <54DA3AB0.3040500-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-11 5:32 ` Zhang, Helin
[not found] ` <F35DEAC7BCE34641BA9FAC6BCA4A12E70A806F1F-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-11 17:13 ` Olivier MATZ
[not found] ` <54DB8DC0.500-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-13 2:25 ` Zhang, Helin
[not found] ` <F35DEAC7BCE34641BA9FAC6BCA4A12E70A807E67-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-13 8:41 ` Olivier MATZ
2015-02-04 9:25 ` [PATCH v2 04/20] i40e: remove the use of PKT_TX_UDP_TUNNEL_PKT flag Olivier Matz
[not found] ` <1423041925-26956-5-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-10 6:40 ` Zhang, Helin
[not found] ` <F35DEAC7BCE34641BA9FAC6BCA4A12E70A806631-0J0gbvR4kTg/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-10 17:08 ` Olivier MATZ
2015-02-04 9:25 ` [PATCH v2 05/20] mbuf: remove " Olivier Matz
2015-02-04 9:25 ` [PATCH v2 06/20] testpmd: replace tx_checksum command by csum Olivier Matz
2015-02-04 9:25 ` [PATCH v2 07/20] testpmd: move csum_show in a function Olivier Matz
2015-02-04 9:25 ` [PATCH v2 08/20] testpmd: add csum parse_tunnel command Olivier Matz
2015-02-04 9:25 ` [PATCH v2 09/20] testpmd: rename vxlan in outer_ip in csum commands Olivier Matz
2015-02-04 9:25 ` [PATCH v2 10/20] testpmd: introduce parse_ipv* in csum fwd engine Olivier Matz
2015-02-04 9:25 ` [PATCH v2 11/20] testpmd: use a structure to store offload info " Olivier Matz
2015-02-04 9:25 ` [PATCH v2 12/20] testpmd: introduce parse_vxlan " Olivier Matz
2015-02-04 9:25 ` [PATCH v2 13/20] testpmd: support gre tunnels " Olivier Matz
2015-02-04 9:25 ` [PATCH v2 14/20] testpmd: support ipip tunnel in csum forward engine Olivier Matz
2015-02-04 9:25 ` [PATCH v2 15/20] ethdev: add outer IP offload capability flag Olivier Matz
2015-02-04 9:25 ` [PATCH v2 16/20] i40e: advertise outer IPv4 checksum capability Olivier Matz
2015-02-04 9:25 ` [PATCH v2 17/20] testpmd: add a warning if outer ip cksum requested but not supported Olivier Matz
2015-02-04 9:25 ` [PATCH v2 18/20] testpmd: fix TSO when using outer checksum offloads Olivier Matz
2015-02-04 9:25 ` [PATCH v2 19/20] i40e: fix offloading of outer checksum for ip in ip tunnels Olivier Matz
2015-02-04 9:25 ` [PATCH v2 20/20] i40e: add debug logs for tx context descriptors Olivier Matz
2015-02-09 1:10 ` [PATCH v2 00/20] enhance tx checksum offload API Liu, Jijiang
2015-02-13 9:22 ` [PATCH v3 " Olivier Matz
[not found] ` <1423819371-24222-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-13 9:22 ` [PATCH v3 01/20] mbuf: remove PKT_TX_IPV4_CSUM Olivier Matz
2015-02-13 9:22 ` [PATCH v3 02/20] mbuf: enhance the API documentation of offload flags Olivier Matz
2015-02-13 9:22 ` [PATCH v3 03/20] i40e: call i40e_txd_enable_checksum only for offloaded packets Olivier Matz
2015-02-13 9:22 ` [PATCH v3 04/20] i40e: remove the use of PKT_TX_UDP_TUNNEL_PKT flag Olivier Matz
2015-02-13 9:22 ` [PATCH v3 05/20] mbuf: remove " Olivier Matz
2015-02-13 9:22 ` [PATCH v3 06/20] testpmd: replace tx_checksum command by csum Olivier Matz
2015-02-13 9:22 ` [PATCH v3 07/20] testpmd: move csum_show in a function Olivier Matz
2015-02-13 9:22 ` [PATCH v3 08/20] testpmd: add csum parse_tunnel command Olivier Matz
2015-02-13 9:22 ` [PATCH v3 09/20] testpmd: rename vxlan in outer_ip in csum commands Olivier Matz
2015-02-13 9:22 ` [PATCH v3 10/20] testpmd: introduce parse_ipv* in csum fwd engine Olivier Matz
2015-02-13 9:22 ` [PATCH v3 11/20] testpmd: use a structure to store offload info " Olivier Matz
2015-02-13 9:22 ` [PATCH v3 12/20] testpmd: introduce parse_vxlan " Olivier Matz
2015-02-13 9:22 ` [PATCH v3 13/20] testpmd: support gre tunnels " Olivier Matz
2015-02-13 9:22 ` [PATCH v3 14/20] testpmd: support ipip tunnel in csum forward engine Olivier Matz
2015-02-13 9:22 ` [PATCH v3 15/20] ethdev: add outer IP offload capability flag Olivier Matz
2015-02-13 9:22 ` [PATCH v3 16/20] i40e: advertise outer IPv4 checksum capability Olivier Matz
2015-02-13 9:22 ` [PATCH v3 17/20] testpmd: add a warning if outer ip cksum requested but not supported Olivier Matz
2015-02-13 9:22 ` [PATCH v3 18/20] testpmd: fix TSO when using outer checksum offloads Olivier Matz
2015-02-13 9:22 ` [PATCH v3 19/20] i40e: fix offloading of outer checksum for ip in ip tunnels Olivier Matz
2015-02-13 9:22 ` [PATCH v3 20/20] i40e: add debug logs for tx context descriptors Olivier Matz
2015-02-15 6:22 ` [PATCH v3 00/20] enhance tx checksum offload API Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DDC8F1-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-16 18:23 ` Thomas Monjalon
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=1423041925-26956-3-git-send-email-olivier.matz@6wind.com \
--to=olivier.matz-pdr9zngts4eavxtiumwx3w@public.gmane.org \
--cc=dev-VfR2kkLFssw@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.