DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix flow director drop rule deletion crash
@ 2018-05-09  7:37 Shahaf Shuler
  2018-05-15  6:26 ` [dpdk-dev] [PATCH v2] " Shahaf Shuler
  0 siblings, 1 reply; 4+ messages in thread
From: Shahaf Shuler @ 2018-05-09  7:37 UTC (permalink / raw)
  To: nelio.laranjeiro, adrien.mazarguil, yskoh; +Cc: dev, stable

Drop flow rules are created on the ETH queue even though the parser layer
matches the flow rule layer (L3/L4)

Fixes: 6f2f4948b236 ("net/mlx5: fix flow director rule deletion crash")
Cc: stable@dpdk.org
Cc: adrien.mazarguil@6wind.com

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 38811bbcec..ebc6754eeb 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3382,6 +3382,8 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev,
 	if (parser.drop) {
 		struct ibv_flow_spec_action_drop *drop;
 
+		/* Drop rules are created on the ETH queue. */
+		parser.layer = HASH_RXQ_ETH;
 		drop = (void *)((uintptr_t)parser.queue[parser.layer].ibv_attr +
 				parser.queue[parser.layer].offset);
 		*drop = (struct ibv_flow_spec_action_drop){
@@ -3401,6 +3403,9 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev,
 
 		attr = parser.queue[parser.layer].ibv_attr;
 		flow_attr = flow->frxq[parser.layer].ibv_attr;
+		/* Matching flows must have ibv context on the same queue. */
+		if (!flow_attr)
+			continue;
 		/* Compare first the attributes. */
 		if (memcmp(attr, flow_attr, sizeof(struct ibv_flow_attr)))
 			continue;
-- 
2.12.0

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

* [dpdk-dev] [PATCH v2] net/mlx5: fix flow director drop rule deletion crash
  2018-05-09  7:37 [dpdk-dev] [PATCH] net/mlx5: fix flow director drop rule deletion crash Shahaf Shuler
@ 2018-05-15  6:26 ` Shahaf Shuler
  2018-05-15  7:26   ` Adrien Mazarguil
  0 siblings, 1 reply; 4+ messages in thread
From: Shahaf Shuler @ 2018-05-15  6:26 UTC (permalink / raw)
  To: yskoh, adrien.mazarguil, nelio.laranjeiro; +Cc: dev, stable

Drop flow rules are created on the ETH queue even though the parser layer
matches the flow rule layer (L3/L4)

Fixes: 6f2f4948b236 ("net/mlx5: fix flow director rule deletion crash")
Cc: stable@dpdk.org
Cc: adrien.mazarguil@6wind.com

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---

On v2:
 - Instead of override parser.layer use HASH_RXQ_ETH directly.
 - Remove obvious comments.

---
 drivers/net/mlx5/mlx5_flow.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index ec6d00f21b..7af1dfa0b7 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3381,13 +3381,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[parser.layer].ibv_attr +
-				parser.queue[parser.layer].offset);
+		drop = (void *)((uintptr_t)parser.queue[HASH_RXQ_ETH].ibv_attr +
+				parser.queue[HASH_RXQ_ETH].offset);
 		*drop = (struct ibv_flow_spec_action_drop){
 			.type = IBV_FLOW_SPEC_ACTION_DROP,
 			.size = sizeof(struct ibv_flow_spec_action_drop),
 		};
-		parser.queue[parser.layer].ibv_attr->num_of_specs++;
+		parser.queue[HASH_RXQ_ETH].ibv_attr->num_of_specs++;
 	}
 	TAILQ_FOREACH(flow, &priv->flows, next) {
 		struct ibv_flow_attr *attr;
@@ -3397,11 +3397,14 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev,
 		struct ibv_spec_header *flow_h;
 		void *flow_spec;
 		unsigned int specs_n;
+		unsigned int queue_id = parser.drop ? HASH_RXQ_ETH :
+						      parser.layer;
 
-		attr = parser.queue[parser.layer].ibv_attr;
-		flow_attr = flow->frxq[parser.layer].ibv_attr;
+		attr = parser.queue[queue_id].ibv_attr;
+		flow_attr = flow->frxq[queue_id].ibv_attr;
 		/* Compare first the attributes. */
-		if (memcmp(attr, flow_attr, sizeof(struct ibv_flow_attr)))
+		if (!flow_attr ||
+		    memcmp(attr, flow_attr, sizeof(struct ibv_flow_attr)))
 			continue;
 		if (attr->num_of_specs == 0)
 			continue;
-- 
2.12.0

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

* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix flow director drop rule deletion crash
  2018-05-15  6:26 ` [dpdk-dev] [PATCH v2] " Shahaf Shuler
@ 2018-05-15  7:26   ` Adrien Mazarguil
  2018-05-15  7:42     ` Shahaf Shuler
  0 siblings, 1 reply; 4+ messages in thread
From: Adrien Mazarguil @ 2018-05-15  7:26 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: yskoh, nelio.laranjeiro, dev, stable

On Tue, May 15, 2018 at 09:26:35AM +0300, Shahaf Shuler wrote:
> Drop flow rules are created on the ETH queue even though the parser layer
> matches the flow rule layer (L3/L4)
> 
> Fixes: 6f2f4948b236 ("net/mlx5: fix flow director rule deletion crash")
> Cc: stable@dpdk.org
> Cc: adrien.mazarguil@6wind.com
> 
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> 
> ---
> 
> On v2:
>  - Instead of override parser.layer use HASH_RXQ_ETH directly.
>  - Remove obvious comments.

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

-- 
Adrien Mazarguil
6WIND

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

* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix flow director drop rule deletion crash
  2018-05-15  7:26   ` Adrien Mazarguil
@ 2018-05-15  7:42     ` Shahaf Shuler
  0 siblings, 0 replies; 4+ messages in thread
From: Shahaf Shuler @ 2018-05-15  7:42 UTC (permalink / raw)
  To: Adrien Mazarguil; +Cc: Yongseok Koh, Nélio Laranjeiro, dev, stable

Tuesday, May 15, 2018 10:27 AM, Adrien Mazarguil:
> <nelio.laranjeiro@6wind.com>; dev@dpdk.org; stable@dpdk.org
> Subject: Re: [PATCH v2] net/mlx5: fix flow director drop rule deletion crash
> 
> On Tue, May 15, 2018 at 09:26:35AM +0300, Shahaf Shuler wrote:
> > Drop flow rules are created on the ETH queue even though the parser
> > layer matches the flow rule layer (L3/L4)
> >
> > Fixes: 6f2f4948b236 ("net/mlx5: fix flow director rule deletion
> > crash")
> > Cc: stable@dpdk.org
> > Cc: adrien.mazarguil@6wind.com
> >
> > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> >

Applied to next-net-mlx, thanks. 

> > ---
> >
> > On v2:
> >  - Instead of override parser.layer use HASH_RXQ_ETH directly.
> >  - Remove obvious comments.
> 
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> 
> --
> Adrien Mazarguil
> 6WIND

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

end of thread, other threads:[~2018-05-15  7:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-09  7:37 [dpdk-dev] [PATCH] net/mlx5: fix flow director drop rule deletion crash Shahaf Shuler
2018-05-15  6:26 ` [dpdk-dev] [PATCH v2] " Shahaf Shuler
2018-05-15  7:26   ` Adrien Mazarguil
2018-05-15  7:42     ` 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).