DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Bernard Iremonger <bernard.iremonger@intel.com>,
	John McNamara <john.mcnamara@intel.com>,
	Marko Kovacevic <marko.kovacevic@intel.com>
Cc: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@intel.com,
	arybchenko@solarflare.com, olivier.matz@6wind.com,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>
Subject: [dpdk-dev] [PATCH v4 3/4] app/testpmd: add outer UDP HW checksum support
Date: Mon,  8 Oct 2018 21:39:52 +0530	[thread overview]
Message-ID: <20181008160953.32510-3-jerin.jacob@caviumnetworks.com> (raw)
In-Reply-To: <20181008160953.32510-1-jerin.jacob@caviumnetworks.com>

Added outer-udp Tx HW checksum support for csum forward engine
if device supports DEV_TX_OFFLOAD_OUTER_UDP_CKSUM.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
---

v3:
- Added Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

v2:
- Added outer-udp support for csum engine
---
 app/test-pmd/cmdline.c                      | 24 ++++++++++++++++++---
 app/test-pmd/csumonly.c                     | 13 +++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  8 +++++--
 3 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0c5399dc4..2fd007423 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -397,12 +397,13 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"    Disable hardware insertion of a VLAN header in"
 			" packets sent on a port.\n\n"
 
-			"csum set (ip|udp|tcp|sctp|outer-ip) (hw|sw) (port_id)\n"
+			"csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)\n"
 			"    Select hardware or software calculation of the"
 			" checksum when transmitting a packet using the"
 			" csum forward engine.\n"
 			"    ip|udp|tcp|sctp always concern the inner layer.\n"
 			"    outer-ip concerns the outer IP layer in"
+			"    outer-udp concerns the outer UDP layer in"
 			" case the packet is recognized as a tunnel packet by"
 			" the forward engine (vxlan, gre and ipip are supported)\n"
 			"    Please check the NIC datasheet for HW limits.\n\n"
@@ -4177,6 +4178,8 @@ csum_show(int port_id)
 		(tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw");
 	printf("Outer-Ip checksum offload is %s\n",
 		(tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ? "hw" : "sw");
+	printf("Outer-Udp checksum offload is %s\n",
+		(tx_offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) ? "hw" : "sw");
 
 	/* display warnings if configuration is not supported by the NIC */
 	rte_eth_dev_info_get(port_id, &dev_info);
@@ -4205,6 +4208,12 @@ csum_show(int port_id)
 		printf("Warning: hardware outer IP checksum enabled but not "
 			"supported by port %d\n", port_id);
 	}
+	if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) &&
+		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM)
+			== 0) {
+		printf("Warning: hardware outer UDP checksum enabled but not "
+			"supported by port %d\n", port_id);
+	}
 }
 
 static void
@@ -4273,6 +4282,15 @@ cmd_csum_parsed(void *parsed_result,
 				printf("Outer IP checksum offload is not "
 				       "supported by port %u\n", res->port_id);
 			}
+		} else if (!strcmp(res->proto, "outer-udp")) {
+			if (hw == 0 || (dev_info.tx_offload_capa &
+					DEV_TX_OFFLOAD_OUTER_UDP_CKSUM)) {
+				csum_offloads |=
+						DEV_TX_OFFLOAD_OUTER_UDP_CKSUM;
+			} else {
+				printf("Outer UDP checksum offload is not "
+				       "supported by port %u\n", res->port_id);
+			}
 		}
 
 		if (hw) {
@@ -4296,7 +4314,7 @@ cmdline_parse_token_string_t cmd_csum_mode =
 				mode, "set");
 cmdline_parse_token_string_t cmd_csum_proto =
 	TOKEN_STRING_INITIALIZER(struct cmd_csum_result,
-				proto, "ip#tcp#udp#sctp#outer-ip");
+				proto, "ip#tcp#udp#sctp#outer-ip#outer-udp");
 cmdline_parse_token_string_t cmd_csum_hwsw =
 	TOKEN_STRING_INITIALIZER(struct cmd_csum_result,
 				hwsw, "hw#sw");
@@ -4307,7 +4325,7 @@ cmdline_parse_token_num_t cmd_csum_portid =
 cmdline_parse_inst_t cmd_csum_set = {
 	.f = cmd_csum_parsed,
 	.data = NULL,
-	.help_str = "csum set ip|tcp|udp|sctp|outer-ip hw|sw <port_id>: "
+	.help_str = "csum set ip|tcp|udp|sctp|outer-ip|outer-udp hw|sw <port_id>: "
 		"Enable/Disable hardware calculation of L3/L4 checksum when "
 		"using csum forward engine",
 	.tokens = {
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 494829266..ea5b112d6 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -468,10 +468,15 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,
 	if (info->outer_l4_proto != IPPROTO_UDP)
 		return ol_flags;
 
+	/* Skip SW outer UDP checksum generation if HW supports it */
+	if (tx_offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) {
+		ol_flags |= PKT_TX_OUTER_UDP_CKSUM;
+		return ol_flags;
+	}
+
 	udp_hdr = (struct udp_hdr *)((char *)outer_l3_hdr + info->outer_l3_len);
 
-	/* outer UDP checksum is done in software as we have no hardware
-	 * supporting it today, and no API for it. In the other side, for
+	/* outer UDP checksum is done in software. In the other side, for
 	 * UDP tunneling, like VXLAN or Geneve, outer UDP checksum can be
 	 * set to zero.
 	 *
@@ -826,6 +831,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 			if (info.tunnel_tso_segsz ||
 			    (tx_offloads &
 			     DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ||
+			    (tx_offloads &
+			     DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) ||
 			    (tx_ol_flags & PKT_TX_OUTER_IPV6)) {
 				m->outer_l2_len = info.outer_l2_len;
 				m->outer_l3_len = info.outer_l3_len;
@@ -898,6 +905,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 			if (info.is_tunnel == 1) {
 				if ((tx_offloads &
 				    DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ||
+				    (tx_offloads &
+				    DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) ||
 				    (tx_ol_flags & PKT_TX_OUTER_IPV6))
 					printf("tx: m->outer_l2_len=%d "
 						"m->outer_l3_len=%d\n",
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 3a73000a6..cfcabf6f0 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -857,7 +857,7 @@ csum set
 Select hardware or software calculation of the checksum when
 transmitting a packet using the ``csum`` forwarding engine::
 
-   testpmd> csum set (ip|udp|tcp|sctp|outer-ip) (hw|sw) (port_id)
+   testpmd> csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)
 
 Where:
 
@@ -867,6 +867,10 @@ Where:
   as a tunnel packet by the forwarding engine (vxlan, gre and ipip are
   supported). See also the ``csum parse-tunnel`` command.
 
+* ``outer-udp`` relates to the outer UDP layer in the case where the packet is recognized
+  as a tunnel packet by the forwarding engine (vxlan, vxlan-gpe are
+  supported). See also the ``csum parse-tunnel`` command.
+
 .. note::
 
    Check the NIC Datasheet for hardware limits.
@@ -940,7 +944,7 @@ Consider a packet in packet like the following::
 
 * If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
   command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), and the
-  ``outer-ip parameter`` relates to the outer headers (here ``ipv4_out``).
+  ``outer-ip|outer-udp`` parameter relates to the outer headers (here ``ipv4_out`` and ``udp_out``).
 
 * If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csum  set``
    command relate to the outer headers, here ``ipv4_out`` and ``udp_out``.
-- 
2.19.0

  parent reply	other threads:[~2018-10-08 16:10 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-13 13:47 [dpdk-dev] [PATCH 1/4] ethdev: add SCTP Rx checksum offload support Jerin Jacob
2018-09-13 13:47 ` [dpdk-dev] [PATCH 2/4] mbuf: fix Tx offload mask Jerin Jacob
2018-10-01 13:45   ` Ferruh Yigit
2018-10-01 15:53     ` Jerin Jacob
2018-10-01 16:13       ` Ferruh Yigit
2018-09-13 13:47 ` [dpdk-dev] [PATCH 3/4] ethdev: add Rx offload outer L4 checksum definitions Jerin Jacob
2018-09-13 17:24   ` Shahaf Shuler
2018-09-14  3:05     ` Jerin Jacob
2018-09-16  5:53       ` Shahaf Shuler
2018-09-16  9:32         ` Jerin Jacob
2018-09-13 13:47 ` [dpdk-dev] [PATCH 4/4] ethdev: add Tx " Jerin Jacob
2018-10-01 13:45   ` Ferruh Yigit
2018-10-02  9:52     ` Jerin Jacob
2018-10-01 13:45 ` [dpdk-dev] [PATCH 1/4] ethdev: add SCTP Rx checksum offload support Ferruh Yigit
2018-10-01 13:46 ` Ferruh Yigit
2018-10-01 15:59   ` Jerin Jacob
2018-10-01 16:11     ` Ferruh Yigit
2018-10-02  8:53       ` Jerin Jacob
2018-10-02  9:13     ` Ferruh Yigit
2018-10-02 10:51 ` [dpdk-dev] [PATCH v2 1/2] " Jerin Jacob
2018-10-02 10:51   ` [dpdk-dev] [PATCH v2 2/2] mbuf: fix Tx offload mask Jerin Jacob
2018-10-04  2:31     ` Hu, Jiayu
2018-10-04 16:05       ` Ferruh Yigit
2018-10-03 18:52   ` [dpdk-dev] [PATCH v2 1/2] ethdev: add SCTP Rx checksum offload support Ferruh Yigit
2018-10-02 19:24 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add Rx offload outer UDP checksum definition Jerin Jacob
2018-10-02 19:24   ` [dpdk-dev] [PATCH v2 2/4] ethdev: add Tx " Jerin Jacob
2018-10-03  7:41     ` Andrew Rybchenko
2018-10-03  7:58       ` Jerin Jacob
2018-10-03  8:02         ` Ferruh Yigit
2018-10-03  8:36           ` Thomas Monjalon
2018-10-03 10:52     ` Iremonger, Bernard
2018-10-02 19:24   ` [dpdk-dev] [PATCH v2 3/4] app/testpmd: add outer UDP HW checksum support Jerin Jacob
2018-10-03 13:23     ` Iremonger, Bernard
2018-10-02 19:24   ` [dpdk-dev] [PATCH v2 4/4] app/testpmd: collect bad outer L4 checksum for csum engine Jerin Jacob
2018-10-03  8:29     ` Andrew Rybchenko
2018-10-03  7:34   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add Rx offload outer UDP checksum definition Andrew Rybchenko
2018-10-03  7:57     ` Jerin Jacob
2018-10-03  8:35       ` Thomas Monjalon
2018-10-03  8:36         ` Andrew Rybchenko
2018-10-03 17:12       ` Jerin Jacob
2018-10-03 18:00         ` Andrew Rybchenko
2018-10-03 18:14           ` Jerin Jacob
2018-10-03 19:47             ` Andrew Rybchenko
2018-10-03 20:08               ` Thomas Monjalon
2018-10-04  5:59               ` Jerin Jacob
2018-10-05 19:48                 ` Ferruh Yigit
2018-10-05 20:04                 ` Ferruh Yigit
2018-10-05 22:44                   ` Thomas Monjalon
2018-10-06  8:15                     ` Jerin Jacob
2018-10-06 12:18                       ` Ananyev, Konstantin
2018-10-08  8:12                         ` Ferruh Yigit
2018-10-08  8:24                           ` Jerin Jacob
2018-10-08  9:04                             ` Thomas Monjalon
2018-10-08  9:37                               ` Jerin Jacob
2018-10-08 10:53                                 ` Ferruh Yigit
2018-10-08 11:55                                   ` Jerin Jacob
2018-10-08 12:13                                     ` Ferruh Yigit
2018-10-08 12:25                                       ` Jerin Jacob
2018-10-08 13:03                                         ` Thomas Monjalon
2018-10-08 13:08                                           ` Jerin Jacob
2018-10-03  8:53   ` Ananyev, Konstantin
2018-10-03  8:59     ` Jerin Jacob
2018-10-03  9:17       ` Ananyev, Konstantin
2018-10-03  9:22         ` Jerin Jacob
2018-10-03 10:16           ` Ananyev, Konstantin
2018-10-03 11:15             ` Jerin Jacob
2018-10-03 10:51   ` Iremonger, Bernard
2018-10-03 11:19     ` Jerin Jacob
2018-10-03 13:00       ` Iremonger, Bernard
2018-10-03 18:16 ` [dpdk-dev] [PATCH v3 " Jerin Jacob
2018-10-03 18:16   ` [dpdk-dev] [PATCH v3 2/4] ethdev: add Tx " Jerin Jacob
2018-10-03 18:16   ` [dpdk-dev] [PATCH v3 3/4] app/testpmd: add outer UDP HW checksum support Jerin Jacob
2018-10-03 18:16   ` [dpdk-dev] [PATCH v3 4/4] app/testpmd: collect bad outer L4 checksum for csum engine Jerin Jacob
2018-10-04 13:45     ` Iremonger, Bernard
2018-10-04 14:16       ` Jerin Jacob
2018-10-04 15:06         ` Iremonger, Bernard
2018-10-08 16:09   ` [dpdk-dev] [PATCH v4 1/4] ethdev: add Rx offload outer UDP checksum definition Jerin Jacob
2018-10-08 16:09     ` [dpdk-dev] [PATCH v4 2/4] ethdev: add Tx " Jerin Jacob
2018-10-09 10:06       ` Andrew Rybchenko
2018-10-08 16:09     ` Jerin Jacob [this message]
2018-10-08 16:09     ` [dpdk-dev] [PATCH v4 4/4] app/testpmd: collect bad outer L4 checksum for csum engine Jerin Jacob
2018-10-09 10:06     ` [dpdk-dev] [PATCH v4 1/4] ethdev: add Rx offload outer UDP checksum definition Andrew Rybchenko
2018-10-09 14:18     ` [dpdk-dev] [PATCH v5 " Jerin Jacob
2018-10-09 14:18       ` [dpdk-dev] [PATCH v5 2/4] ethdev: add Tx " Jerin Jacob
2018-10-09 14:18       ` [dpdk-dev] [PATCH v5 3/4] app/testpmd: add outer UDP HW checksum support Jerin Jacob
2018-10-09 14:18       ` [dpdk-dev] [PATCH v5 4/4] app/testpmd: collect bad outer L4 checksum for csum engine Jerin Jacob
2018-10-09 16:46       ` [dpdk-dev] [PATCH v5 1/4] ethdev: add Rx offload outer UDP checksum definition Ferruh Yigit

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=20181008160953.32510-3-jerin.jacob@caviumnetworks.com \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=arybchenko@solarflare.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=thomas@monjalon.net \
    --cc=wenzhuo.lu@intel.com \
    /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).