DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jijiang Liu <jijiang.liu@intel.com>
To: dev@dpdk.org, walter.e.gilmore@intel.com, thomas.long@intel.com
Subject: [dpdk-dev] [PATCH RFC 10/10] examples/tep_termination:add the configuration for encapsulation and the decapsulation
Date: Thu, 16 Apr 2015 11:55:58 +0800	[thread overview]
Message-ID: <1429156558-28548-11-git-send-email-jijiang.liu@intel.com> (raw)
In-Reply-To: <1429156558-28548-1-git-send-email-jijiang.liu@intel.com>

The two flags by default are enabled, but sometimes we want to know the performance influence due to encapsulation and decapsulation operations, and
I think we should add the two options. 

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 examples/tep_termination/main.c        |   36 ++++++++++++++++++++++++++++++-
 examples/tep_termination/vxlan_setup.c |    8 +++++-
 2 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c
index 8ce78ee..7d021f9 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -125,6 +125,12 @@ uint8_t tx_checksum;
 /* TSO segment size */
 uint16_t tso_segsz = 0;
 
+/* enable/disable decapsulation */
+uint8_t rx_decap = 1;
+
+/* enable/disable encapsulation */
+uint8_t tx_encap = 1;
+
 /* RX filter type for tunneling packet */
 uint8_t filter_idx;
 
@@ -250,6 +256,8 @@ vep_termination_usage(const char *prgname)
 	"		--nb-devices: number of virtIO device\n"
 	"		--tx-checksum [0|1]: inner Tx checksum offload\n"
 	"		--tso-segsz [0-N]: TSO segment size\n"
+	"		--decap [0|1]: Decapsulation for tunneling packet\n"
+	"		--encap [0|1]: Encapsulation for tunneling packet\n"
 	"		--filter-type[1-3]: filter type for tunneling packet\n"
 	"		    1: Inner MAC&VLAN and tenent ID\n"
 	"		    2: Inner MAC and tenent ID\n"
@@ -276,6 +284,8 @@ tep_parse_args(int argc, char **argv)
 		{"nb-devices", required_argument, NULL, 0},
 		{"tx-checksum", required_argument, NULL, 0},
 		{"tso-segsz", required_argument, NULL, 0},
+		{"decap", required_argument, NULL, 0},
+		{"encap", required_argument, NULL, 0},
 		{"filter-type", required_argument, NULL, 0},
 		{"stats", required_argument, NULL, 0},
 		{"dev-basename", required_argument, NULL, 0},
@@ -325,8 +335,30 @@ tep_parse_args(int argc, char **argv)
 					return -1;
 				}
 			}
-			
-			if (!strncmp(long_option[option_index].name, "tx-checksum", MAX_LONG_OPT_SZ)) {
+
+			/* Enable/disable encapsulation on RX. */
+			if (!strncmp(long_option[option_index].name, "decap", MAX_LONG_OPT_SZ)) {
+				ret = parse_num_opt(optarg, 1);
+				if (ret == -1) {
+					RTE_LOG(INFO, VHOST_CONFIG, "Invalid argument for decapsulation [0|1]\n");
+					vep_termination_usage(prgname);
+					return -1;
+				} else
+					rx_decap = ret;
+			}
+
+			/* Enable/disable encapsulation on TX. */
+			if (!strncmp(long_option[option_index].name, "encap", MAX_LONG_OPT_SZ)) {
+				ret = parse_num_opt(optarg, 1);
+				if (ret == -1) {
+					RTE_LOG(INFO, VHOST_CONFIG, "Invalid argument for encapsulation [0|1]\n");
+					vep_termination_usage(prgname);
+					return -1;
+				} else
+					tx_encap = ret;
+			}
+
+			 if (!strncmp(long_option[option_index].name, "tx-checksum", MAX_LONG_OPT_SZ)) {
 				ret = parse_num_opt(optarg, 1);
 				if (ret == -1) {
 					RTE_LOG(INFO, VHOST_CONFIG, "Invalid argument for tx-checksum [0|1]\n");
diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index 312a878..b4e8fbc 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -83,6 +83,8 @@ extern uint16_t num_devices;
 extern uint16_t udp_port;
 extern uint8_t ports[RTE_MAX_ETHPORTS];
 extern uint8_t filter_idx;
+extern uint8_t rx_decap;
+extern uint8_t tx_encap;
 
 /* ethernet addresses of ports */
 extern struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
@@ -237,7 +239,8 @@ vxlan_rx_process(struct rte_mbuf *pkt)
 		| PKT_RX_TUNNEL_IPV6_HDR)) == 0)
 		return -1;
 
-	ret = decapsulation(pkt);
+	if(rx_decap)
+		ret = decapsulation(pkt);
 
 	return ret;
 }
@@ -252,7 +255,8 @@ vxlan_tx_process(uint8_t vport_id, struct rte_mbuf *pkt)
 		return -1;
 	}
 
-	ret = encapsulation(pkt, vport_id);
+	if (tx_encap)
+		ret = encapsulation(pkt, vport_id);
 
 	return ret;
 }
-- 
1.7.7.6

  parent reply	other threads:[~2015-04-16  3:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16  3:55 [dpdk-dev] [PATCH RFC 00/10] Add a VXLAN sample Jijiang Liu
2015-04-16  3:55 ` [dpdk-dev] [PATCH RFC 01/10] examples/tep_termination:initialize the VXLAN example Jijiang Liu
2015-04-16  3:55 ` [dpdk-dev] [PATCH RFC 02/10] examples/tep_termination:define VXLAN device information and APIs Jijiang Liu
2015-04-16  3:55 ` [dpdk-dev] [PATCH RFC 03/10] examples/tep_termination:add the pluggable structures for VXLAN packet processing Jijiang Liu
2015-04-16  3:55 ` [dpdk-dev] [PATCH RFC 04/10] examples/tep_termination:implement " Jijiang Liu
2015-04-16  3:55 ` [dpdk-dev] [PATCH RFC 05/10] examples/tep_termination:implement the APIs of encapsulation and decapsulation for VXLAN Jijiang Liu
2015-04-16  3:55 ` [dpdk-dev] [PATCH RFC 06/10] examples/tep_termination:add UDP port configuration for UDP tunneling packet Jijiang Liu
2015-04-16  3:55 ` [dpdk-dev] [PATCH RFC 07/10] examples/tep_termination:add tunnel filter type configuration Jijiang Liu
2015-04-16  3:55 ` [dpdk-dev] [PATCH RFC 08/10] examples/tep_termination:add Tx checksum offload configuration for inner header Jijiang Liu
2015-04-16  3:55 ` [dpdk-dev] [PATCH RFC 09/10] examples/tep_termination:add TSO offload configuration Jijiang Liu
2015-04-16  3:55 ` Jijiang Liu [this message]
2015-04-20  7:22 ` [dpdk-dev] [PATCH RFC 00/10] Add a VXLAN sample Liu, Jijiang
2015-04-28  3:31 ` Liu, Jijiang

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=1429156558-28548-11-git-send-email-jijiang.liu@intel.com \
    --to=jijiang.liu@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas.long@intel.com \
    --cc=walter.e.gilmore@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).