DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jingjing Wu <jingjing.wu@intel.com>
To: thomas.monjalon@6wind.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v8 3/4] driver/i40e: implement tunnel filter for IP in GRE
Date: Thu, 10 Mar 2016 11:06:01 +0800	[thread overview]
Message-ID: <1457579162-18170-4-git-send-email-jingjing.wu@intel.com> (raw)
In-Reply-To: <1457579162-18170-1-git-send-email-jingjing.wu@intel.com>

From: Xutao Sun <xutao.sun@intel.com>

Signed-off-by: Xutao Sun <xutao.sun@intel.com>
Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 127ed72..3b9bf77 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5808,6 +5808,12 @@ i40e_dev_get_filter_type(uint16_t filter_type, uint16_t *flag)
 	case ETH_TUNNEL_FILTER_IMAC:
 		*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC;
 		break;
+	case ETH_TUNNEL_FILTER_OIP:
+		*flag = I40E_AQC_ADD_CLOUD_FILTER_OIP;
+		break;
+	case ETH_TUNNEL_FILTER_IIP:
+		*flag = I40E_AQC_ADD_CLOUD_FILTER_IIP;
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "invalid tunnel filter type");
 		return -EINVAL;
@@ -5822,7 +5828,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
 			uint8_t add)
 {
 	uint16_t ip_type;
-	uint8_t tun_type = 0;
+	uint8_t i, tun_type = 0;
+	/* internal varialbe to convert ipv6 byte order */
+	uint32_t convert_ipv6[4];
 	int val, ret = 0;
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
 	struct i40e_vsi *vsi = pf->main_vsi;
@@ -5844,16 +5852,19 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
 	(void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac,
 			ETHER_ADDR_LEN);
 
-	pfilter->inner_vlan = tunnel_filter->inner_vlan;
+	pfilter->inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan);
 	if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) {
 		ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4;
 		(void)rte_memcpy(&pfilter->ipaddr.v4.data,
-				&tunnel_filter->ip_addr,
+			&rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv4_addr),
 				sizeof(pfilter->ipaddr.v4.data));
 	} else {
 		ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV6;
-		(void)rte_memcpy(&pfilter->ipaddr.v6.data,
-				&tunnel_filter->ip_addr,
+		for (i = 0; i < 4; i++) {
+			convert_ipv6[i] =
+			rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv6_addr[i]);
+		}
+		(void)rte_memcpy(&pfilter->ipaddr.v6.data, &convert_ipv6,
 				sizeof(pfilter->ipaddr.v6.data));
 	}
 
@@ -5865,6 +5876,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
 	case RTE_TUNNEL_TYPE_NVGRE:
 		tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC;
 		break;
+	case RTE_TUNNEL_TYPE_IP_IN_GRE:
+		tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_IP;
+		break;
 	default:
 		/* Other tunnel types is not supported. */
 		PMD_DRV_LOG(ERR, "tunnel type is not supported.");
@@ -5879,10 +5893,11 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
 		return -EINVAL;
 	}
 
-	pfilter->flags |= I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE | ip_type |
-		(tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT);
-	pfilter->tenant_id = tunnel_filter->tenant_id;
-	pfilter->queue_number = tunnel_filter->queue_id;
+	pfilter->flags |= rte_cpu_to_le_16(
+		I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE |
+		ip_type | (tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT));
+	pfilter->tenant_id = rte_cpu_to_le_32(tunnel_filter->tenant_id);
+	pfilter->queue_number = rte_cpu_to_le_16(tunnel_filter->queue_id);
 
 	if (add)
 		ret = i40e_aq_add_cloud_filters(hw, vsi->seid, cld_filter, 1);
-- 
2.4.0

  parent reply	other threads:[~2016-03-10  3:06 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25  7:25 [dpdk-dev] [PATCH 0/4] Add tunnel filter support for IP in GRE on i40e Xutao Sun
2016-01-25  7:25 ` [dpdk-dev] [PATCH 1/4] lib/ether: optimize the 'rte_eth_tunnel_filter_conf' structure Xutao Sun
2016-01-25  7:25 ` [dpdk-dev] [PATCH 2/4] lib/ether: add IP in GRE type Xutao Sun
2016-01-25  7:25 ` [dpdk-dev] [PATCH 3/4] driver/i40e: implement tunnel filter for IP in GRE Xutao Sun
2016-01-25  7:25 ` [dpdk-dev] [PATCH 4/4] app/test-pmd: test " Xutao Sun
2016-01-28  7:30 ` [dpdk-dev] [PATCH v2 0/4] Add tunnel filter support for IP in GRE on i40e Xutao Sun
2016-01-28  7:30   ` [dpdk-dev] [PATCH v2 1/4] lib/ether: optimize the 'rte_eth_tunnel_filter_conf' structure Xutao Sun
2016-01-28  8:21     ` Thomas Monjalon
2016-01-28  9:05       ` Sun, Xutao
2016-01-28  7:30   ` [dpdk-dev] [PATCH v2 2/4] lib/ether: add IP in GRE type Xutao Sun
2016-01-28  7:30   ` [dpdk-dev] [PATCH v2 3/4] driver/i40e: implement tunnel filter for IP in GRE Xutao Sun
2016-01-28  7:30   ` [dpdk-dev] [PATCH v2 4/4] app/test-pmd: test " Xutao Sun
     [not found]   ` <1453976778-27807-1-git-send-email-xutao.sun@intel.com>
2016-01-28 10:26     ` [dpdk-dev] [PATCH v3 1/4] lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure Xutao Sun
2016-01-28 10:26     ` [dpdk-dev] [PATCH v3 2/4] lib/ether: add IP in GRE type Xutao Sun
2016-01-28 10:26     ` [dpdk-dev] [PATCH v3 3/4] driver/i40e: implement tunnel filter for IP in GRE Xutao Sun
2016-01-28 10:26     ` [dpdk-dev] [PATCH v3 4/4] app/test-pmd: test " Xutao Sun
2016-02-12 13:46       ` De Lara Guarch, Pablo
2016-02-18  7:19         ` Sun, Xutao
2016-02-18  9:58     ` [dpdk-dev] [PATCH v4 0/4] Add tunnel filter support for IP in GRE on i40e Xutao Sun
2016-02-18  9:58       ` [dpdk-dev] [PATCH v4 1/4] lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure Xutao Sun
2016-02-18  9:58       ` [dpdk-dev] [PATCH v4 2/4] lib/ether: add IP in GRE type Xutao Sun
2016-02-18  9:58       ` [dpdk-dev] [PATCH v4 3/4] driver/i40e: implement tunnel filter for IP in GRE Xutao Sun
2016-02-18  9:58       ` [dpdk-dev] [PATCH v4 4/4] app/test-pmd: test " Xutao Sun
2016-02-18 12:16         ` De Lara Guarch, Pablo
2016-02-19  2:40           ` Sun, Xutao
2016-02-19  7:31       ` [dpdk-dev] [PATCH v5 0/4] Add tunnel filter support for IP in GRE on i40e Xutao Sun
2016-02-19  7:31         ` [dpdk-dev] [PATCH v5 1/4] lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure Xutao Sun
2016-02-25  1:22           ` Wu, Jingjing
2016-02-19  7:31         ` [dpdk-dev] [PATCH v5 2/4] lib/ether: add IP in GRE type Xutao Sun
2016-02-19  7:31         ` [dpdk-dev] [PATCH v5 3/4] driver/i40e: implement tunnel filter for IP in GRE Xutao Sun
2016-02-25  1:50           ` Wu, Jingjing
2016-02-19  7:31         ` [dpdk-dev] [PATCH v5 4/4] app/test-pmd: test " Xutao Sun
2016-03-01  3:47         ` [dpdk-dev] [PATCH v6 0/4] Add tunnel filter support for IP in GRE on i40e Xutao Sun
2016-03-01  3:47           ` [dpdk-dev] [PATCH v6 1/4] lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure Xutao Sun
2016-03-01  8:53             ` Panu Matilainen
2016-03-02  3:10               ` Sun, Xutao
2016-03-02  7:12                 ` Panu Matilainen
2016-03-01  3:47           ` [dpdk-dev] [PATCH v6 2/4] lib/ether: add IP in GRE type Xutao Sun
2016-03-01  3:47           ` [dpdk-dev] [PATCH v6 3/4] driver/i40e: implement tunnel filter for IP in GRE Xutao Sun
2016-03-01  3:47           ` [dpdk-dev] [PATCH v6 4/4] app/test-pmd: test " Xutao Sun
2016-03-01  8:41           ` [dpdk-dev] [PATCH v7 0/4] Add tunnel filter support for IP in GRE on i40e Xutao Sun
2016-03-01  8:41             ` [dpdk-dev] [PATCH v7 1/4] lib/ether: optimize the'rte_eth_tunnel_filter_conf' structure Xutao Sun
2016-03-08 23:08               ` Thomas Monjalon
2016-03-08 23:20                 ` Thomas Monjalon
2016-03-01  8:41             ` [dpdk-dev] [PATCH v7 2/4] lib/ether: add IP in GRE type Xutao Sun
2016-03-01  8:41             ` [dpdk-dev] [PATCH v7 3/4] driver/i40e: implement tunnel filter for IP in GRE Xutao Sun
2016-03-01  8:41             ` [dpdk-dev] [PATCH v7 4/4] app/test-pmd: test " Xutao Sun
2016-03-02  7:04             ` [dpdk-dev] [PATCH v7 0/4] Add tunnel filter support for IP in GRE on i40e Liu, Yong
2016-03-02  7:31             ` Wu, Jingjing
2016-03-10  3:05             ` [dpdk-dev] [PATCH v8 0/4] This patch set adds " Jingjing Wu
2016-03-10  3:05               ` [dpdk-dev] [PATCH v8 1/4] lib/ether: optimize struct rte_eth_tunnel_filter_conf Jingjing Wu
2016-03-13 12:01                 ` Thomas Monjalon
2016-03-10  3:06               ` [dpdk-dev] [PATCH v8 2/4] lib/ether: add IP in GRE type Jingjing Wu
2016-03-10  3:06               ` Jingjing Wu [this message]
2016-03-10  3:06               ` [dpdk-dev] [PATCH v8 4/4] app/test-pmd: test tunnel filter for IP in GRE Jingjing Wu
2016-03-13 14:18               ` [dpdk-dev] [PATCH v8 0/4] This patch set adds tunnel filter support for IP in GRE on i40e 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=1457579162-18170-4-git-send-email-jingjing.wu@intel.com \
    --to=jingjing.wu@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.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).