DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow expand
@ 2019-11-11 10:42 Matan Azrad
  2019-11-11 10:53 ` Jack Min
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Matan Azrad @ 2019-11-11 10:42 UTC (permalink / raw)
  To: dev; +Cc: Ori Kam, jackmin

There is a rte_flow API which expands a RSS flow pattern to multipile
patterns according to the RSS hash types in the RSS action
configuration.

Aa part of the expansion, detection of the last item of the flow uses
the "next proto" field of the last configured item in the pattern list.
Wrongly, the mask of this field was not considered in order to validate
the field.

Ignore "next proto" fields when their corresponded masks invalidate them.

Fixes: ec84aa45f17b ("ethdev: fix expand RSS flows")
Cc: jackmin@mellanox.com

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 lib/librte_ethdev/rte_flow.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 8ec9c90..d7f29e5 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -218,12 +218,21 @@ struct rte_flow_desc_data {
 {
 	enum rte_flow_item_type ret = RTE_FLOW_ITEM_TYPE_VOID;
 	uint16_t ether_type = 0;
+	uint16_t ether_type_m;
 	uint8_t ip_next_proto = 0;
+	uint8_t ip_next_proto_m;
 
 	if (item == NULL || item->spec == NULL)
 		return ret;
 	switch (item->type) {
 	case RTE_FLOW_ITEM_TYPE_ETH:
+		if (item->mask)
+			ether_type_m = ((const struct rte_flow_item_eth *)
+						(item->mask))->type;
+		else
+			ether_type_m = rte_flow_item_eth_mask.type;
+		if (ether_type_m != RTE_BE16(0xFFFF))
+			break;
 		ether_type = ((const struct rte_flow_item_eth *)
 				(item->spec))->type;
 		if (rte_be_to_cpu_16(ether_type) == RTE_ETHER_TYPE_IPV4)
@@ -234,6 +243,13 @@ struct rte_flow_desc_data {
 			ret = RTE_FLOW_ITEM_TYPE_VLAN;
 		break;
 	case RTE_FLOW_ITEM_TYPE_VLAN:
+		if (item->mask)
+			ether_type_m = ((const struct rte_flow_item_vlan *)
+						(item->mask))->inner_type;
+		else
+			ether_type_m = rte_flow_item_vlan_mask.inner_type;
+		if (ether_type_m != RTE_BE16(0xFFFF))
+			break;
 		ether_type = ((const struct rte_flow_item_vlan *)
 				(item->spec))->inner_type;
 		if (rte_be_to_cpu_16(ether_type) == RTE_ETHER_TYPE_IPV4)
@@ -244,6 +260,14 @@ struct rte_flow_desc_data {
 			ret = RTE_FLOW_ITEM_TYPE_VLAN;
 		break;
 	case RTE_FLOW_ITEM_TYPE_IPV4:
+		if (item->mask)
+			ip_next_proto_m = ((const struct rte_flow_item_ipv4 *)
+					(item->mask))->hdr.next_proto_id;
+		else
+			ip_next_proto_m =
+				rte_flow_item_ipv4_mask.hdr.next_proto_id;
+		if (ip_next_proto_m != 0xFF)
+			break;
 		ip_next_proto = ((const struct rte_flow_item_ipv4 *)
 				(item->spec))->hdr.next_proto_id;
 		if (ip_next_proto == IPPROTO_UDP)
@@ -256,6 +280,14 @@ struct rte_flow_desc_data {
 			ret = RTE_FLOW_ITEM_TYPE_IPV6;
 		break;
 	case RTE_FLOW_ITEM_TYPE_IPV6:
+		if (item->mask)
+			ip_next_proto_m = ((const struct rte_flow_item_ipv6 *)
+						(item->mask))->hdr.proto;
+		else
+			ip_next_proto_m =
+				rte_flow_item_ipv6_mask.hdr.proto;
+		if (ip_next_proto_m != 0xFF)
+			break;
 		ip_next_proto = ((const struct rte_flow_item_ipv6 *)
 				(item->spec))->hdr.proto;
 		if (ip_next_proto == IPPROTO_UDP)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow expand
  2019-11-11 10:42 [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow expand Matan Azrad
@ 2019-11-11 10:53 ` Jack Min
  2019-11-11 17:13 ` Ferruh Yigit
  2019-11-11 17:41 ` Ori Kam
  2 siblings, 0 replies; 6+ messages in thread
From: Jack Min @ 2019-11-11 10:53 UTC (permalink / raw)
  To: Matan Azrad; +Cc: dev, Ori Kam

On Mon, 19-11-11, 10:42, Matan Azrad wrote:
> There is a rte_flow API which expands a RSS flow pattern to multipile
> patterns according to the RSS hash types in the RSS action
> configuration.
> 
> Aa part of the expansion, detection of the last item of the flow uses
> the "next proto" field of the last configured item in the pattern list.
> Wrongly, the mask of this field was not considered in order to validate
> the field.
> 
> Ignore "next proto" fields when their corresponded masks invalidate them.
> 
> Fixes: ec84aa45f17b ("ethdev: fix expand RSS flows")
> Cc: jackmin@mellanox.com
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Xiaoyu Min <jackmin@mellanox.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow expand
  2019-11-11 10:42 [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow expand Matan Azrad
  2019-11-11 10:53 ` Jack Min
@ 2019-11-11 17:13 ` Ferruh Yigit
  2019-11-11 21:36   ` Ori Kam
  2019-11-11 17:41 ` Ori Kam
  2 siblings, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2019-11-11 17:13 UTC (permalink / raw)
  To: Matan Azrad, dev; +Cc: Ori Kam, jackmin

On 11/11/2019 10:42 AM, Matan Azrad wrote:
> There is a rte_flow API which expands a RSS flow pattern to multipile
> patterns according to the RSS hash types in the RSS action
> configuration.
> 
> Aa part of the expansion, detection of the last item of the flow uses
> the "next proto" field of the last configured item in the pattern list.
> Wrongly, the mask of this field was not considered in order to validate
> the field.
> 
> Ignore "next proto" fields when their corresponded masks invalidate them.
> 
> Fixes: ec84aa45f17b ("ethdev: fix expand RSS flows")
> Cc: jackmin@mellanox.com
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>

Hi Ori,

Can you check this one please?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow expand
  2019-11-11 10:42 [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow expand Matan Azrad
  2019-11-11 10:53 ` Jack Min
  2019-11-11 17:13 ` Ferruh Yigit
@ 2019-11-11 17:41 ` Ori Kam
  2019-11-12  1:02   ` Ferruh Yigit
  2 siblings, 1 reply; 6+ messages in thread
From: Ori Kam @ 2019-11-11 17:41 UTC (permalink / raw)
  To: Matan Azrad, dev; +Cc: Jack Min



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Matan Azrad
> Sent: Monday, November 11, 2019 12:42 PM
> To: dev@dpdk.org
> Cc: Ori Kam <orika@mellanox.com>; Jack Min <jackmin@mellanox.com>
> Subject: [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow
> expand
> 
> There is a rte_flow API which expands a RSS flow pattern to multipile
> patterns according to the RSS hash types in the RSS action
> configuration.
> 
> Aa part of the expansion, detection of the last item of the flow uses
> the "next proto" field of the last configured item in the pattern list.
> Wrongly, the mask of this field was not considered in order to validate
> the field.
> 
> Ignore "next proto" fields when their corresponded masks invalidate them.
> 
> Fixes: ec84aa45f17b ("ethdev: fix expand RSS flows")
> Cc: jackmin@mellanox.com
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> ---

Acked-by: Ori Kam <orika@mellanox.com>
Thanks,
Ori

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow expand
  2019-11-11 17:13 ` Ferruh Yigit
@ 2019-11-11 21:36   ` Ori Kam
  0 siblings, 0 replies; 6+ messages in thread
From: Ori Kam @ 2019-11-11 21:36 UTC (permalink / raw)
  To: Ferruh Yigit, Matan Azrad, dev; +Cc: Jack Min

Checked and acked.
Best,
Ori

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Monday, November 11, 2019 7:14 PM
> To: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> Cc: Ori Kam <orika@mellanox.com>; Jack Min <jackmin@mellanox.com>
> Subject: Re: [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow
> expand
> 
> On 11/11/2019 10:42 AM, Matan Azrad wrote:
> > There is a rte_flow API which expands a RSS flow pattern to multipile
> > patterns according to the RSS hash types in the RSS action
> > configuration.
> >
> > Aa part of the expansion, detection of the last item of the flow uses
> > the "next proto" field of the last configured item in the pattern list.
> > Wrongly, the mask of this field was not considered in order to validate
> > the field.
> >
> > Ignore "next proto" fields when their corresponded masks invalidate them.
> >
> > Fixes: ec84aa45f17b ("ethdev: fix expand RSS flows")
> > Cc: jackmin@mellanox.com
> >
> > Signed-off-by: Matan Azrad <matan@mellanox.com>
> 
> Hi Ori,
> 
> Can you check this one please?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow expand
  2019-11-11 17:41 ` Ori Kam
@ 2019-11-12  1:02   ` Ferruh Yigit
  0 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2019-11-12  1:02 UTC (permalink / raw)
  To: Ori Kam, Matan Azrad, dev; +Cc: Jack Min

On 11/11/2019 5:41 PM, Ori Kam wrote:
> 
> 
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of Matan Azrad
>> Sent: Monday, November 11, 2019 12:42 PM
>> To: dev@dpdk.org
>> Cc: Ori Kam <orika@mellanox.com>; Jack Min <jackmin@mellanox.com>
>> Subject: [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow
>> expand
>>
>> There is a rte_flow API which expands a RSS flow pattern to multipile
>> patterns according to the RSS hash types in the RSS action
>> configuration.
>>
>> Aa part of the expansion, detection of the last item of the flow uses
>> the "next proto" field of the last configured item in the pattern list.
>> Wrongly, the mask of this field was not considered in order to validate
>> the field.
>>
>> Ignore "next proto" fields when their corresponded masks invalidate them.
>>
>> Fixes: ec84aa45f17b ("ethdev: fix expand RSS flows")
>> Cc: jackmin@mellanox.com
>>
>> Signed-off-by: Matan Azrad <matan@mellanox.com>
>> ---
> 
> Acked-by: Ori Kam <orika@mellanox.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-12  1:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 10:42 [dpdk-dev] [PATCH] ethdev: fix last item detection on RSS flow expand Matan Azrad
2019-11-11 10:53 ` Jack Min
2019-11-11 17:13 ` Ferruh Yigit
2019-11-11 21:36   ` Ori Kam
2019-11-11 17:41 ` Ori Kam
2019-11-12  1:02   ` 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).