[dpdk-dev,v1] net/mlx5: fix flow type for allmulti rules

Message ID 1512466670-19229-1-git-send-email-rasland@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Raslan Darawsheh Dec. 5, 2017, 9:37 a.m. UTC
  Chnaged ibv_flow_attr type for allmulti rule to IBV_FLOW_ATTR_MC_DEFAULT
instead of IBV_FLOW_ATTR_NORMAL, in case allmulti was enabled.

Fixes: 272733b5 ("net/mlx5: use flow to enable unicast traffic")

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
  

Comments

Nélio Laranjeiro Dec. 5, 2017, 9:56 a.m. UTC | #1
On Tue, Dec 05, 2017 at 11:37:50AM +0200, Raslan Darawsheh wrote:
> Chnaged ibv_flow_attr type for allmulti rule to IBV_FLOW_ATTR_MC_DEFAULT
> instead of IBV_FLOW_ATTR_NORMAL, in case allmulti was enabled.
> 
> Fixes: 272733b5 ("net/mlx5: use flow to enable unicast traffic")
> 
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 1eda836..eaa53e2 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -429,6 +429,7 @@ static const struct mlx5_flow_items mlx5_flow_items[] = {
>  /** Structure to pass to the conversion function. */
>  struct mlx5_flow_parse {
>  	uint32_t inner; /**< Set once VXLAN is encountered. */
> +	uint8_t allmulti:1; /** Set once allmulti dst MAC is encountered. */
>  	uint32_t create:1;
>  	/**< Whether resources should remain after a validate. */
>  	uint32_t drop:1; /**< Target is a drop queue. */
> @@ -1165,6 +1166,17 @@ priv_flow_convert(struct priv *priv,
>  			}
>  		}
>  	}
> +	if (parser->allmulti &&
> +	    parser->layer == HASH_RXQ_ETH) {
> +		for (i = 0; i != hash_rxq_init_n; ++i) {
> +			if (!parser->queue[i].ibv_attr)
> +				continue;
> +			if (parser->queue[i].ibv_attr->num_of_specs != 1)
> +				break;
> +			parser->queue[i].ibv_attr->type =
> +						IBV_FLOW_ATTR_MC_DEFAULT;
> +		}
> +	}
>  	return ret;
>  exit_enomem:
>  	for (i = 0; i != hash_rxq_init_n; ++i) {
> @@ -1262,6 +1274,7 @@ mlx5_flow_create_eth(const struct rte_flow_item *item,
>  		eth.val.ether_type &= eth.mask.ether_type;
>  	}
>  	mlx5_flow_create_copy(parser, &eth, eth_size);
> +	parser->allmulti = eth.val.dst_mac[0] & 1;
>  	return 0;
>  }
>  
> -- 
> 2.7.4

It also concerns DPDK 17.11, adding stable@dpdk.org

Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
  
Shahaf Shuler Dec. 6, 2017, 6:43 a.m. UTC | #2
Tuesday, December 5, 2017 11:57 AM, Nelio Laranjeiro:
> On Tue, Dec 05, 2017 at 11:37:50AM +0200, Raslan Darawsheh wrote:
> > Chnaged ibv_flow_attr type for allmulti rule to
> > IBV_FLOW_ATTR_MC_DEFAULT instead of IBV_FLOW_ATTR_NORMAL, in
> case allmulti was enabled.
> >
> > Fixes: 272733b5 ("net/mlx5: use flow to enable unicast traffic")
> >
> > Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> > ---
> >  drivers/net/mlx5/mlx5_flow.c | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow.c
> > b/drivers/net/mlx5/mlx5_flow.c index 1eda836..eaa53e2 100644
> > --- a/drivers/net/mlx5/mlx5_flow.c
> > +++ b/drivers/net/mlx5/mlx5_flow.c
> > @@ -429,6 +429,7 @@ static const struct mlx5_flow_items
> > mlx5_flow_items[] = {
> >  /** Structure to pass to the conversion function. */  struct
> > mlx5_flow_parse {
> >  	uint32_t inner; /**< Set once VXLAN is encountered. */
> > +	uint8_t allmulti:1; /** Set once allmulti dst MAC is encountered. */

Changed comment to /**< Set once allmulti dst MAC is encountered. */ to fit doxygen style. 

> >  	uint32_t create:1;
> >  	/**< Whether resources should remain after a validate. */
> >  	uint32_t drop:1; /**< Target is a drop queue. */ @@ -1165,6
> +1166,17
> > @@ priv_flow_convert(struct priv *priv,
> >  			}
> >  		}
> >  	}
> > +	if (parser->allmulti &&
> > +	    parser->layer == HASH_RXQ_ETH) {
> > +		for (i = 0; i != hash_rxq_init_n; ++i) {
> > +			if (!parser->queue[i].ibv_attr)
> > +				continue;
> > +			if (parser->queue[i].ibv_attr->num_of_specs != 1)
> > +				break;
> > +			parser->queue[i].ibv_attr->type =
> > +
> 	IBV_FLOW_ATTR_MC_DEFAULT;
> > +		}
> > +	}
> >  	return ret;
> >  exit_enomem:
> >  	for (i = 0; i != hash_rxq_init_n; ++i) { @@ -1262,6 +1274,7 @@
> > mlx5_flow_create_eth(const struct rte_flow_item *item,
> >  		eth.val.ether_type &= eth.mask.ether_type;
> >  	}
> >  	mlx5_flow_create_copy(parser, &eth, eth_size);
> > +	parser->allmulti = eth.val.dst_mac[0] & 1;
> >  	return 0;
> >  }
> >
> > --
> > 2.7.4
> 
> It also concerns DPDK 17.11, adding stable@dpdk.org
> 
> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Applied to next-net-mlx with the Cc:stable@dpdk.org addition, thanks. 

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

Patch

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 1eda836..eaa53e2 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -429,6 +429,7 @@  static const struct mlx5_flow_items mlx5_flow_items[] = {
 /** Structure to pass to the conversion function. */
 struct mlx5_flow_parse {
 	uint32_t inner; /**< Set once VXLAN is encountered. */
+	uint8_t allmulti:1; /** Set once allmulti dst MAC is encountered. */
 	uint32_t create:1;
 	/**< Whether resources should remain after a validate. */
 	uint32_t drop:1; /**< Target is a drop queue. */
@@ -1165,6 +1166,17 @@  priv_flow_convert(struct priv *priv,
 			}
 		}
 	}
+	if (parser->allmulti &&
+	    parser->layer == HASH_RXQ_ETH) {
+		for (i = 0; i != hash_rxq_init_n; ++i) {
+			if (!parser->queue[i].ibv_attr)
+				continue;
+			if (parser->queue[i].ibv_attr->num_of_specs != 1)
+				break;
+			parser->queue[i].ibv_attr->type =
+						IBV_FLOW_ATTR_MC_DEFAULT;
+		}
+	}
 	return ret;
 exit_enomem:
 	for (i = 0; i != hash_rxq_init_n; ++i) {
@@ -1262,6 +1274,7 @@  mlx5_flow_create_eth(const struct rte_flow_item *item,
 		eth.val.ether_type &= eth.mask.ether_type;
 	}
 	mlx5_flow_create_copy(parser, &eth, eth_size);
+	parser->allmulti = eth.val.dst_mac[0] & 1;
 	return 0;
 }