From patchwork Thu Apr 16 03:55:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jijiang Liu X-Patchwork-Id: 4329 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id B4647C3D8; Thu, 16 Apr 2015 05:56:30 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 37996C3D8 for ; Thu, 16 Apr 2015 05:56:29 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 15 Apr 2015 20:56:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,585,1422950400"; d="scan'208";a="481577965" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 15 Apr 2015 20:56:27 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t3G3uP8X006180; Thu, 16 Apr 2015 11:56:25 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t3G3uLr0029283; Thu, 16 Apr 2015 11:56:23 +0800 Received: (from jijiangl@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t3G3uLTW029276; Thu, 16 Apr 2015 11:56:21 +0800 From: Jijiang Liu To: dev@dpdk.org, walter.e.gilmore@intel.com, thomas.long@intel.com Date: Thu, 16 Apr 2015 11:55:58 +0800 Message-Id: <1429156558-28548-11-git-send-email-jijiang.liu@intel.com> X-Mailer: git-send-email 1.7.12.2 In-Reply-To: <1429156558-28548-1-git-send-email-jijiang.liu@intel.com> References: <1429156558-28548-1-git-send-email-jijiang.liu@intel.com> Subject: [dpdk-dev] [PATCH RFC 10/10] examples/tep_termination:add the configuration for encapsulation and the decapsulation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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; }