* [dpdk-dev] [PATCH] net/i40e: fix tunnel filter issue
@ 2017-02-06 8:52 Beilei Xing
2017-02-07 14:11 ` Ferruh Yigit
2017-02-07 14:12 ` Ferruh Yigit
0 siblings, 2 replies; 3+ messages in thread
From: Beilei Xing @ 2017-02-06 8:52 UTC (permalink / raw)
To: jingjing.wu; +Cc: dev
Creating IPv4 flow and IPv6 flow will cause confilct error.
Root cause is there's no IP info included in tunnel filter
input.
Fixes: 425c3325f0b0 ("net/i40e: store tunnel filter")
Fixes: d416530e6358 ("net/i40e: parse tunnel filter")
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 6 ++++++
drivers/net/i40e/i40e_ethdev.h | 6 ++++++
drivers/net/i40e/i40e_flow.c | 28 ++++++++++++++++++++++++++--
3 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4492bcc..b2dd6d6 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -6705,6 +6705,12 @@ i40e_tunnel_filter_convert(struct i40e_aqc_add_remove_cloud_filters_element_data
ether_addr_copy((struct ether_addr *)&cld_filter->inner_mac,
(struct ether_addr *)&tunnel_filter->input.inner_mac);
tunnel_filter->input.inner_vlan = cld_filter->inner_vlan;
+ if ((rte_le_to_cpu_16(cld_filter->flags) &
+ I40E_AQC_ADD_CLOUD_FLAGS_IPV6) ==
+ I40E_AQC_ADD_CLOUD_FLAGS_IPV6)
+ tunnel_filter->input.ip_type = I40E_TUNNEL_IPTYPE_IPV6;
+ else
+ tunnel_filter->input.ip_type = I40E_TUNNEL_IPTYPE_IPV4;
tunnel_filter->input.flags = cld_filter->flags;
tunnel_filter->input.tenant_id = cld_filter->tenant_id;
tunnel_filter->queue = cld_filter->queue_number;
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 9e2f7a2..7c344a0 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -499,11 +499,17 @@ struct i40e_ethertype_rule {
/* Tunnel filter number HW supports */
#define I40E_MAX_TUNNEL_FILTER_NUM 400
+enum i40e_tunnel_iptype {
+ I40E_TUNNEL_IPTYPE_IPV4 = 0, /* IPv4. */
+ I40E_TUNNEL_IPTYPE_IPV6, /* IPv6. */
+};
+
/* Tunnel filter struct */
struct i40e_tunnel_filter_input {
uint8_t outer_mac[6]; /* Outer mac address to match */
uint8_t inner_mac[6]; /* Inner mac address to match */
uint16_t inner_vlan; /* Inner vlan address to match */
+ enum i40e_tunnel_iptype ip_type;
uint16_t flags; /* Filter type flag */
uint32_t tenant_id; /* Tenant id to match */
};
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index c14eb22..c6e4d87 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -1307,16 +1307,40 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern,
}
break;
case RTE_FLOW_ITEM_TYPE_IPV4:
+ filter->ip_type = RTE_TUNNEL_IPTYPE_IPV4;
+ /* IPv4 is used to describe protocol,
+ * spec amd mask should be NULL.
+ */
+ if (item->spec || item->mask) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "Invalid IPv4 item");
+ return -rte_errno;
+ }
+ break;
case RTE_FLOW_ITEM_TYPE_IPV6:
+ filter->ip_type = RTE_TUNNEL_IPTYPE_IPV6;
+ /* IPv6 is used to describe protocol,
+ * spec amd mask should be NULL.
+ */
+ if (item->spec || item->mask) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "Invalid IPv6 item");
+ return -rte_errno;
+ }
+ break;
case RTE_FLOW_ITEM_TYPE_UDP:
- /* IPv4/IPv6/UDP are used to describe protocol,
+ /* UDP is used to describe protocol,
* spec amd mask should be NULL.
*/
if (item->spec || item->mask) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
item,
- "Invalid IPv4 item");
+ "Invalid UDP item");
return -rte_errno;
}
break;
--
2.5.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/i40e: fix tunnel filter issue
2017-02-06 8:52 [dpdk-dev] [PATCH] net/i40e: fix tunnel filter issue Beilei Xing
@ 2017-02-07 14:11 ` Ferruh Yigit
2017-02-07 14:12 ` Ferruh Yigit
1 sibling, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2017-02-07 14:11 UTC (permalink / raw)
To: Beilei Xing, jingjing.wu; +Cc: dev
On 2/6/2017 8:52 AM, Beilei Xing wrote:
> Creating IPv4 flow and IPv6 flow will cause confilct error.
> Root cause is there's no IP info included in tunnel filter
> input.
>
> Fixes: 425c3325f0b0 ("net/i40e: store tunnel filter")
> Fixes: d416530e6358 ("net/i40e: parse tunnel filter")
>
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
<...>
> +enum i40e_tunnel_iptype {
> + I40E_TUNNEL_IPTYPE_IPV4 = 0, /* IPv4. */
No need to assign the value, it will be already zero. And comments are
not adding something new.
Since these are minor issues, I can update while applying.
> + I40E_TUNNEL_IPTYPE_IPV6, /* IPv6. */
> +};
> +
<...>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/i40e: fix tunnel filter issue
2017-02-06 8:52 [dpdk-dev] [PATCH] net/i40e: fix tunnel filter issue Beilei Xing
2017-02-07 14:11 ` Ferruh Yigit
@ 2017-02-07 14:12 ` Ferruh Yigit
1 sibling, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2017-02-07 14:12 UTC (permalink / raw)
To: Beilei Xing, jingjing.wu; +Cc: dev
On 2/6/2017 8:52 AM, Beilei Xing wrote:
> Creating IPv4 flow and IPv6 flow will cause confilct error.
> Root cause is there's no IP info included in tunnel filter
> input.
>
> Fixes: 425c3325f0b0 ("net/i40e: store tunnel filter")
> Fixes: d416530e6358 ("net/i40e: parse tunnel filter")
>
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-07 14:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-06 8:52 [dpdk-dev] [PATCH] net/i40e: fix tunnel filter issue Beilei Xing
2017-02-07 14:11 ` Ferruh Yigit
2017-02-07 14:12 ` Ferruh Yigit
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).