From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 8C750593A for ; Wed, 23 Dec 2015 09:50:00 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 23 Dec 2015 00:49:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,468,1444719600"; d="scan'208";a="868062671" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 23 Dec 2015 00:49:56 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id tBN8ntoN022276 for ; Wed, 23 Dec 2015 16:49:55 +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 tBN8nrnw012708 for ; Wed, 23 Dec 2015 16:49:55 +0800 Received: (from jijiangl@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id tBN8nrwc012704 for dev@dpdk.org; Wed, 23 Dec 2015 16:49:53 +0800 From: Jijiang Liu To: dev@dpdk.org Date: Wed, 23 Dec 2015 16:49:46 +0800 Message-Id: <1450860592-12673-1-git-send-email-jijiang.liu@intel.com> X-Mailer: git-send-email 1.7.12.2 Subject: [dpdk-dev] [RFC PATCH 0/6] General tunneling APIs 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: , X-List-Received-Date: Wed, 23 Dec 2015 08:50:01 -0000 I want to define a set of General tunneling APIs, which are used to accelarate tunneling packet processing in DPDK, In this RFC patch set, I wll explain my idea using some codes. 1. Using flow director offload to define a tunnel flow in a pair of queues. flow rule: src IP + dst IP + src port + dst port + tunnel ID (for VXLAN) For example: struct rte_eth_tunnel_conf{ .tunnel_type = VXLAN, .rx_queue = 1, .tx_queue = 1, .filter_type = 'src ip + dst ip + src port + dst port + tunnel id' .flow_tnl { .tunnel_type = VXLAN, .tunnel_id = 100, .remote_mac = 11.22.33.44.55.66, .ip_type = ipv4, .outer_ipv4.src_ip = 192.168.10.1 .outer_ipv4.dst_ip = 10.239.129.11 .src_port = 1000, .dst_port =2000 }; 2. Configure tunnel flow for a device and for a pair of queues. rte_eth_dev_tunnel_configure(0, &rte_eth_tunnel_conf); In this API, it will call RX decapsulation and TX encapsulation callback function if HW doesn't support encap/decap, and a space will be allocated for tunnel configuration and store a pointer to this new allocated space as dev->post_rx/tx_burst_cbs[].param. rte_eth_add_rx_callback(port_id, tunnel_conf.rx_queue, rte_eth_tunnel_decap, (void *)tunnel_conf); rte_eth_add_tx_callback(port_id, tunnel_conf.tx_queue, rte_eth_tunnel_encap, (void *)tunnel_conf) 3. Using rte_vxlan_decap_burst() to do decapsulation of tunneling packet. 4. Using rte_vxlan_encap_burst() to do encapsulation of tunneling packet. The 'src ip, dst ip, src port, dst port and tunnel ID" can be got from tunnel configuration. And SIMD is used to accelarate the operation. How to use these APIs, there is a example below: 1)at config phase dev_config(port, ...); tunnel_config(port,...); ... dev_start(port); ... rx_burst(port, rxq,... ); tx_burst(port, txq,...); 2)at transmitting packet phase The only outer src/dst MAC address need to be set for TX tunnel configuration in dev->post_tx_burst_cbs[].param. In this patch set, I have not finished all of codes, the purpose of sending patch set is that I would like to collect more comments and sugestions on this idea. Jijiang Liu (6): extend rte_eth_tunnel_flow define tunnel flow structure and APIs implement tunnel flow APIs define rte_vxlan_decap/encap implement rte_vxlan_decap/encap i40e tunnel configure drivers/net/i40e/i40e_ethdev.c | 41 +++++ lib/librte_ether/libtunnel/rte_vxlan_opt.c | 251 ++++++++++++++++++++++++++++ lib/librte_ether/libtunnel/rte_vxlan_opt.h | 49 ++++++ lib/librte_ether/rte_eth_ctrl.h | 14 ++- lib/librte_ether/rte_ethdev.h | 28 +++ lib/librte_ether/rte_ethdev.c | 60 ++ 5 files changed, 440 insertions(+), 3 deletions(-) create mode 100644 lib/librte_ether/libtunnel/rte_vxlan_opt.c create mode 100644 lib/librte_ether/libtunnel/rte_vxlan_opt.h -- 1.7.7.6