DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/mlx5: fix flow director rule deletion crash
@ 2018-04-26 16:17 Adrien Mazarguil
  2018-04-27  6:55 ` Nélio Laranjeiro
  0 siblings, 1 reply; 3+ messages in thread
From: Adrien Mazarguil @ 2018-04-26 16:17 UTC (permalink / raw)
  To: Nelio Laranjeiro; +Cc: Shahaf Shuler, dev, stable

Flow director rules matching traffic properties above layer 2 do not
target a fixed hash Rx queue (HASH_RXQ_ETH), it actually depends on the
highest protocol layer specified by each flow rule.

mlx5_fdir_filter_delete() makes this wrong assumption and causes a crash
when attempting to destroy flow rules with L3/L4 specifications.

Fixes: 4c3e9bcdd52e ("net/mlx5: support flow director")
Cc: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Cc: stable@dpdk.org

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 drivers/net/mlx5/mlx5_flow.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 8f5fcf4d6..05def2b14 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3409,13 +3409,13 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev,
 	if (parser.drop) {
 		struct ibv_flow_spec_action_drop *drop;
 
-		drop = (void *)((uintptr_t)parser.queue[HASH_RXQ_ETH].ibv_attr +
-				parser.queue[HASH_RXQ_ETH].offset);
+		drop = (void *)((uintptr_t)parser.queue[parser.layer].ibv_attr +
+				parser.queue[parser.layer].offset);
 		*drop = (struct ibv_flow_spec_action_drop){
 			.type = IBV_FLOW_SPEC_ACTION_DROP,
 			.size = sizeof(struct ibv_flow_spec_action_drop),
 		};
-		parser.queue[HASH_RXQ_ETH].ibv_attr->num_of_specs++;
+		parser.queue[parser.layer].ibv_attr->num_of_specs++;
 	}
 	TAILQ_FOREACH(flow, &priv->flows, next) {
 		struct ibv_flow_attr *attr;
@@ -3426,8 +3426,8 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev,
 		void *flow_spec;
 		unsigned int specs_n;
 
-		attr = parser.queue[HASH_RXQ_ETH].ibv_attr;
-		flow_attr = flow->frxq[HASH_RXQ_ETH].ibv_attr;
+		attr = parser.queue[parser.layer].ibv_attr;
+		flow_attr = flow->frxq[parser.layer].ibv_attr;
 		/* Compare first the attributes. */
 		if (memcmp(attr, flow_attr, sizeof(struct ibv_flow_attr)))
 			continue;
-- 
2.11.0

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

* Re: [dpdk-dev] [PATCH v1] net/mlx5: fix flow director rule deletion crash
  2018-04-26 16:17 [dpdk-dev] [PATCH v1] net/mlx5: fix flow director rule deletion crash Adrien Mazarguil
@ 2018-04-27  6:55 ` Nélio Laranjeiro
  2018-04-29  5:51   ` Shahaf Shuler
  0 siblings, 1 reply; 3+ messages in thread
From: Nélio Laranjeiro @ 2018-04-27  6:55 UTC (permalink / raw)
  To: Adrien Mazarguil; +Cc: Shahaf Shuler, dev, stable

On Thu, Apr 26, 2018 at 06:17:46PM +0200, Adrien Mazarguil wrote:
> Flow director rules matching traffic properties above layer 2 do not
> target a fixed hash Rx queue (HASH_RXQ_ETH), it actually depends on the
> highest protocol layer specified by each flow rule.
> 
> mlx5_fdir_filter_delete() makes this wrong assumption and causes a crash
> when attempting to destroy flow rules with L3/L4 specifications.
> 
> Fixes: 4c3e9bcdd52e ("net/mlx5: support flow director")
> Cc: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Cc: stable@dpdk.org
> 
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

> ---
>  drivers/net/mlx5/mlx5_flow.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 8f5fcf4d6..05def2b14 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -3409,13 +3409,13 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev,
>  	if (parser.drop) {
>  		struct ibv_flow_spec_action_drop *drop;
>  
> -		drop = (void *)((uintptr_t)parser.queue[HASH_RXQ_ETH].ibv_attr +
> -				parser.queue[HASH_RXQ_ETH].offset);
> +		drop = (void *)((uintptr_t)parser.queue[parser.layer].ibv_attr +
> +				parser.queue[parser.layer].offset);
>  		*drop = (struct ibv_flow_spec_action_drop){
>  			.type = IBV_FLOW_SPEC_ACTION_DROP,
>  			.size = sizeof(struct ibv_flow_spec_action_drop),
>  		};
> -		parser.queue[HASH_RXQ_ETH].ibv_attr->num_of_specs++;
> +		parser.queue[parser.layer].ibv_attr->num_of_specs++;
>  	}
>  	TAILQ_FOREACH(flow, &priv->flows, next) {
>  		struct ibv_flow_attr *attr;
> @@ -3426,8 +3426,8 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev,
>  		void *flow_spec;
>  		unsigned int specs_n;
>  
> -		attr = parser.queue[HASH_RXQ_ETH].ibv_attr;
> -		flow_attr = flow->frxq[HASH_RXQ_ETH].ibv_attr;
> +		attr = parser.queue[parser.layer].ibv_attr;
> +		flow_attr = flow->frxq[parser.layer].ibv_attr;
>  		/* Compare first the attributes. */
>  		if (memcmp(attr, flow_attr, sizeof(struct ibv_flow_attr)))
>  			continue;
> -- 
> 2.11.0

-- 
Nélio Laranjeiro
6WIND

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

* Re: [dpdk-dev] [PATCH v1] net/mlx5: fix flow director rule deletion crash
  2018-04-27  6:55 ` Nélio Laranjeiro
@ 2018-04-29  5:51   ` Shahaf Shuler
  0 siblings, 0 replies; 3+ messages in thread
From: Shahaf Shuler @ 2018-04-29  5:51 UTC (permalink / raw)
  To: Nélio Laranjeiro, Adrien Mazarguil; +Cc: dev, stable

Friday, April 27, 2018 9:55 AM, Nélio Laranjeiro:
> Subject: Re: [PATCH v1] net/mlx5: fix flow director rule deletion crash
> 
> On Thu, Apr 26, 2018 at 06:17:46PM +0200, Adrien Mazarguil wrote:
> > Flow director rules matching traffic properties above layer 2 do not
> > target a fixed hash Rx queue (HASH_RXQ_ETH), it actually depends on
> > the highest protocol layer specified by each flow rule.
> >
> > mlx5_fdir_filter_delete() makes this wrong assumption and causes a
> > crash when attempting to destroy flow rules with L3/L4 specifications.
> >
> > Fixes: 4c3e9bcdd52e ("net/mlx5: support flow director")
> > Cc: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> 
> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> 
> > ---
> >  drivers/net/mlx5/mlx5_flow.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow.c
> > b/drivers/net/mlx5/mlx5_flow.c index 8f5fcf4d6..05def2b14 100644
> > --- a/drivers/net/mlx5/mlx5_flow.c
> > +++ b/drivers/net/mlx5/mlx5_flow.c
> > @@ -3409,13 +3409,13 @@ mlx5_fdir_filter_delete(struct rte_eth_dev
> *dev,
> >  	if (parser.drop) {
> >  		struct ibv_flow_spec_action_drop *drop;
> >
> > -		drop = (void
> *)((uintptr_t)parser.queue[HASH_RXQ_ETH].ibv_attr +
> > -				parser.queue[HASH_RXQ_ETH].offset);
> > +		drop = (void
> *)((uintptr_t)parser.queue[parser.layer].ibv_attr +
> > +				parser.queue[parser.layer].offset);
> >  		*drop = (struct ibv_flow_spec_action_drop){
> >  			.type = IBV_FLOW_SPEC_ACTION_DROP,
> >  			.size = sizeof(struct ibv_flow_spec_action_drop),
> >  		};
> > -		parser.queue[HASH_RXQ_ETH].ibv_attr->num_of_specs++;
> > +		parser.queue[parser.layer].ibv_attr->num_of_specs++;
> >  	}
> >  	TAILQ_FOREACH(flow, &priv->flows, next) {
> >  		struct ibv_flow_attr *attr;
> > @@ -3426,8 +3426,8 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev,
> >  		void *flow_spec;
> >  		unsigned int specs_n;
> >
> > -		attr = parser.queue[HASH_RXQ_ETH].ibv_attr;
> > -		flow_attr = flow->frxq[HASH_RXQ_ETH].ibv_attr;
> > +		attr = parser.queue[parser.layer].ibv_attr;
> > +		flow_attr = flow->frxq[parser.layer].ibv_attr;
> >  		/* Compare first the attributes. */
> >  		if (memcmp(attr, flow_attr, sizeof(struct ibv_flow_attr)))
> >  			continue;
> > --
> > 2.11.0

Applied to next-net-mlx, thanks. 

> 
> --
> Nélio Laranjeiro
> 6WIND

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

end of thread, other threads:[~2018-04-29  5:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26 16:17 [dpdk-dev] [PATCH v1] net/mlx5: fix flow director rule deletion crash Adrien Mazarguil
2018-04-27  6:55 ` Nélio Laranjeiro
2018-04-29  5:51   ` Shahaf Shuler

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).