* [dpdk-dev] [PATCH] net/mlx5: fix rte flow items size calculation
@ 2020-07-16 12:14 Raslan Darawsheh
2020-07-19 8:26 ` Slava Ovsiienko
2020-07-22 9:11 ` Raslan Darawsheh
0 siblings, 2 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2020-07-16 12:14 UTC (permalink / raw)
To: dev; +Cc: dekelp, stable
flow_dv_get_item_len returns the actual header size of
an rte_flow item.
Changing any of the structs for rte_flow items by adding
or removing some extra fields will break this function.
This fixes the behavior by retrning the actual header size
of each item.
Fixes: 34d41b7aa3bf ("net/mlx5: add VXLAN encap action to Direct Verbs")
Cc: dekelp@mellanox.com
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
drivers/net/mlx5/mlx5_flow_dv.c | 31 ++++++++++++++-----------------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 8b5b683..6f61cf1 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -29,6 +29,7 @@
#include <rte_gre.h>
#include <rte_vxlan.h>
#include <rte_gtp.h>
+#include <rte_mpls.h>
#include <mlx5_devx_cmds.h>
#include <mlx5_prm.h>
@@ -2869,7 +2870,7 @@ flow_dv_push_vlan_action_resource_register
return 0;
}
/**
- * Get the size of specific rte_flow_item_type
+ * Get the size of specific rte_flow_item_type hdr size
*
* @param[in] item_type
* Tested rte_flow_item_type.
@@ -2878,43 +2879,39 @@ flow_dv_push_vlan_action_resource_register
* sizeof struct item_type, 0 if void or irrelevant.
*/
static size_t
-flow_dv_get_item_len(const enum rte_flow_item_type item_type)
+flow_dv_get_item_hdr_len(const enum rte_flow_item_type item_type)
{
size_t retval;
switch (item_type) {
case RTE_FLOW_ITEM_TYPE_ETH:
- retval = sizeof(struct rte_flow_item_eth);
+ retval = sizeof(struct rte_ether_hdr);
break;
case RTE_FLOW_ITEM_TYPE_VLAN:
- retval = sizeof(struct rte_flow_item_vlan);
+ retval = sizeof(struct rte_vlan_hdr);
break;
case RTE_FLOW_ITEM_TYPE_IPV4:
- retval = sizeof(struct rte_flow_item_ipv4);
+ retval = sizeof(struct rte_ipv4_hdr);
break;
case RTE_FLOW_ITEM_TYPE_IPV6:
- retval = sizeof(struct rte_flow_item_ipv6);
+ retval = sizeof(struct rte_ipv6_hdr);
break;
case RTE_FLOW_ITEM_TYPE_UDP:
- retval = sizeof(struct rte_flow_item_udp);
+ retval = sizeof(struct rte_udp_hdr);
break;
case RTE_FLOW_ITEM_TYPE_TCP:
- retval = sizeof(struct rte_flow_item_tcp);
+ retval = sizeof(struct rte_tcp_hdr);
break;
case RTE_FLOW_ITEM_TYPE_VXLAN:
- retval = sizeof(struct rte_flow_item_vxlan);
+ case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
+ retval = sizeof(struct rte_vxlan_hdr);
break;
case RTE_FLOW_ITEM_TYPE_GRE:
- retval = sizeof(struct rte_flow_item_gre);
- break;
case RTE_FLOW_ITEM_TYPE_NVGRE:
- retval = sizeof(struct rte_flow_item_nvgre);
- break;
- case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
- retval = sizeof(struct rte_flow_item_vxlan_gpe);
+ retval = sizeof(struct rte_gre_hdr);
break;
case RTE_FLOW_ITEM_TYPE_MPLS:
- retval = sizeof(struct rte_flow_item_mpls);
+ retval = sizeof(struct rte_mpls_hdr);
break;
case RTE_FLOW_ITEM_TYPE_VOID: /* Fall through. */
default:
@@ -2967,7 +2964,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf,
RTE_FLOW_ERROR_TYPE_ACTION,
NULL, "invalid empty data");
for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
- len = flow_dv_get_item_len(items->type);
+ len = flow_dv_get_item_hdr_len(items->type);
if (len + temp_size > MLX5_ENCAP_MAX_LEN)
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION,
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix rte flow items size calculation
2020-07-16 12:14 [dpdk-dev] [PATCH] net/mlx5: fix rte flow items size calculation Raslan Darawsheh
@ 2020-07-19 8:26 ` Slava Ovsiienko
2020-07-22 9:11 ` Raslan Darawsheh
1 sibling, 0 replies; 3+ messages in thread
From: Slava Ovsiienko @ 2020-07-19 8:26 UTC (permalink / raw)
To: Raslan Darawsheh, dev; +Cc: Dekel Peled, stable
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Raslan Darawsheh
> Sent: Thursday, July 16, 2020 15:15
> To: dev@dpdk.org
> Cc: Dekel Peled <dekelp@mellanox.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix rte flow items size calculation
>
> flow_dv_get_item_len returns the actual header size of an rte_flow item.
>
> Changing any of the structs for rte_flow items by adding or removing some
> extra fields will break this function.
>
> This fixes the behavior by retrning the actual header size of each item.
>
> Fixes: 34d41b7aa3bf ("net/mlx5: add VXLAN encap action to Direct Verbs")
> Cc: dekelp@mellanox.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix rte flow items size calculation
2020-07-16 12:14 [dpdk-dev] [PATCH] net/mlx5: fix rte flow items size calculation Raslan Darawsheh
2020-07-19 8:26 ` Slava Ovsiienko
@ 2020-07-22 9:11 ` Raslan Darawsheh
1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2020-07-22 9:11 UTC (permalink / raw)
To: Raslan Darawsheh, dev; +Cc: Dekel Peled, stable
Hi,
> -----Original Message-----
> From: Raslan Darawsheh <rasland@mellanox.com>
> Sent: Thursday, July 16, 2020 3:15 PM
> To: dev@dpdk.org
> Cc: Dekel Peled <dekelp@mellanox.com>; stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix rte flow items size calculation
>
> flow_dv_get_item_len returns the actual header size of
> an rte_flow item.
>
> Changing any of the structs for rte_flow items by adding
> or removing some extra fields will break this function.
>
> This fixes the behavior by retrning the actual header size
> of each item.
>
> Fixes: 34d41b7aa3bf ("net/mlx5: add VXLAN encap action to Direct Verbs")
> Cc: dekelp@mellanox.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_flow_dv.c | 31 ++++++++++++++-----------------
> 1 file changed, 14 insertions(+), 17 deletions(-)
>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-22 9:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 12:14 [dpdk-dev] [PATCH] net/mlx5: fix rte flow items size calculation Raslan Darawsheh
2020-07-19 8:26 ` Slava Ovsiienko
2020-07-22 9:11 ` Raslan Darawsheh
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).