Thread (39 messages) 39 messages, 3 authors, 2017-03-30

Re: [PATCH v2 3/4] net/i40e: support tunnel filter to VF

From: Xing, Beilei <hidden>
Date: 2017-03-27 10:37:38

-----Original Message-----
From: Wu, Jingjing
Sent: Monday, March 27, 2017 5:55 PM
To: Xing, Beilei <redacted>
Cc: Zhang, Helin <redacted>; dev@dpdk.org
Subject: RE: [PATCH v2 3/4] net/i40e: support tunnel filter to VF


quoted
-----Original Message-----
From: Xing, Beilei
Sent: Thursday, March 23, 2017 6:46 PM
To: Wu, Jingjing <redacted>
Cc: Zhang, Helin <redacted>; dev@dpdk.org
Subject: [PATCH v2 3/4] net/i40e: support tunnel filter to VF

Previously, only tunnel filter to PF is supported.
This patch adds i40e_dev_consistent_tunnel_filter_set
function for consistent filter API to support tunnel filter to VF.

Signed-off-by: Beilei Xing <redacted>
---
 drivers/net/i40e/i40e_ethdev.c | 145
+++++++++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.h |  32 +++++++++
 drivers/net/i40e/i40e_flow.c   |  50 +++++++++-----
 3 files changed, 212 insertions(+), 15 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c
b/drivers/net/i40e/i40e_ethdev.c index 5e6cc59..2b3d41b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -6935,6 +6935,151 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
 	return ret;
 }

+int
+i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
+		      struct i40e_tunnel_filter_conf *tunnel_filter,
+		      uint8_t add)
+{
+	uint16_t ip_type;
+	uint32_t ipv4_addr;
+	uint8_t i, tun_type = 0;
+	/* internal variable to convert ipv6 byte order */
+	uint32_t convert_ipv6[4];
+	int val, ret = 0;
+	struct i40e_pf_vf *vf = NULL;
+	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+	struct i40e_vsi *vsi;
+	struct i40e_aqc_add_rm_cloud_filt_elem_ext *cld_filter;
+	struct i40e_aqc_add_rm_cloud_filt_elem_ext *pfilter;
+	struct i40e_tunnel_rule *tunnel_rule = &pf->tunnel;
+	struct i40e_tunnel_filter *tunnel, *node;
+	struct i40e_tunnel_filter check_filter; /* Check if filter exists */
+	bool big_buffer = 0;
+
+	cld_filter = rte_zmalloc("tunnel_filter",
+			 sizeof(struct
i40e_aqc_add_rm_cloud_filt_elem_ext),
quoted
+			 0);
+
+	if (cld_filter == NULL) {
+		PMD_DRV_LOG(ERR, "Failed to alloc memory.");
+		return -EINVAL;
-EINVAL? I think -ENOMEM is better.
Agree.
quoted
+	if (add) {
+		if (big_buffer)
+			ret = i40e_aq_add_cloud_filters_big_buffer(hw,
+						   vsi->seid, cld_filter, 1);
+		else
+			ret = i40e_aq_add_cloud_filters(hw,
+					vsi->seid, &cld_filter->element, 1);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to add a tunnel filter.");
+			return ret;
Ret is type of "enum i40e_status_code". It will not be consistent.

quoted
+
 #define I40E_MIRROR_MAX_ENTRIES_PER_RULE   64
 #define I40E_MAX_MIRROR_RULES           64
 /*
@@ -718,6 +746,7 @@ union i40e_filter_t {
 	struct rte_eth_ethertype_filter ethertype_filter;
 	struct rte_eth_fdir_filter fdir_filter;
 	struct rte_eth_tunnel_filter_conf tunnel_filter;
+	struct i40e_tunnel_filter_conf consistent_tunnel_filter;
 };
I like to use driver specified structures instead of the old rte_eth_XX.
Glad to see this change, it will be better to change other structs. :)
Thanks, what do you think we change other structures after this release?
Acked-by Jingjing Wu [off-list ref]

Thanks
Jingjing
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help