* [dpdk-dev] [PATCH] net/mlx5: fix default RSS level
@ 2018-05-15 13:23 Shahaf Shuler
2018-05-17 13:32 ` Nélio Laranjeiro
0 siblings, 1 reply; 3+ messages in thread
From: Shahaf Shuler @ 2018-05-15 13:23 UTC (permalink / raw)
To: nelio.laranjeiro, adrien.mazarguil, yskoh; +Cc: dev, xuemingl, matan
Using inner RSS by default for GRE leads to memory corruption as the
extra flow items added for the inner RSS are not counted in the flow
attributes buffer size.
Fixing by enforcing the default RSS level to be outer. This much
simplify the flow engine and more robust.
Future optimization for out of the box RSS can be done on subsequent
commits.
Fixes: d4a405186b73 ("net/mlx5: support tunnel RSS level")
Cc: xuemingl@mellanox.com
Cc: matan@mellanox.com
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
drivers/net/mlx5/mlx5_flow.c | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 0c0d6f99ad..994be05be6 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -805,7 +805,7 @@ mlx5_flow_convert_actions(struct rte_eth_dev *dev,
}
parser->rss_conf = (struct rte_flow_action_rss){
.func = RTE_ETH_HASH_FUNCTION_DEFAULT,
- .level = rss->level,
+ .level = rss->level ? rss->level : 1,
.types = rss->types,
.key_len = rss_key_len,
.queue_num = rss->queue_num,
@@ -1166,9 +1166,6 @@ mlx5_flow_convert_rss(struct mlx5_flow_parse *parser)
int outer = parser->tunnel && parser->rss_conf.level < 2;
uint64_t rss = parser->rss_conf.types;
- /* Default to outer RSS. */
- if (!parser->rss_conf.level)
- parser->rss_conf.level = 1;
layer = outer ? parser->out_layer : parser->layer;
if (layer == HASH_RXQ_TUNNEL)
layer = HASH_RXQ_ETH;
@@ -1801,9 +1798,6 @@ mlx5_flow_create_vxlan(const struct rte_flow_item *item,
parser->tunnel = ptype_ext[PTYPE_IDX(RTE_PTYPE_TUNNEL_VXLAN)];
parser->out_layer = parser->layer;
parser->layer = HASH_RXQ_TUNNEL;
- /* Default VXLAN to outer RSS. */
- if (!parser->rss_conf.level)
- parser->rss_conf.level = 1;
if (spec) {
if (!mask)
mask = default_mask;
@@ -1876,9 +1870,6 @@ mlx5_flow_create_vxlan_gpe(const struct rte_flow_item *item,
parser->tunnel = ptype_ext[PTYPE_IDX(RTE_PTYPE_TUNNEL_VXLAN_GPE)];
parser->out_layer = parser->layer;
parser->layer = HASH_RXQ_TUNNEL;
- /* Default VXLAN-GPE to outer RSS. */
- if (!parser->rss_conf.level)
- parser->rss_conf.level = 1;
if (spec) {
if (!mask)
mask = default_mask;
@@ -1956,9 +1947,6 @@ mlx5_flow_create_gre(const struct rte_flow_item *item,
parser->tunnel = ptype_ext[PTYPE_IDX(RTE_PTYPE_TUNNEL_GRE)];
parser->out_layer = parser->layer;
parser->layer = HASH_RXQ_TUNNEL;
- /* Default GRE to inner RSS. */
- if (!parser->rss_conf.level)
- parser->rss_conf.level = 2;
#ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT
if (spec) {
if (!mask)
@@ -2052,12 +2040,6 @@ mlx5_flow_create_mpls(const struct rte_flow_item *item,
/* parser->out_layer stays as in GRE out_layer. */
}
parser->layer = HASH_RXQ_TUNNEL;
- /*
- * For MPLS-in-GRE, RSS level should have been set.
- * For MPLS-in-UDP, use outer RSS.
- */
- if (!parser->rss_conf.level)
- parser->rss_conf.level = 1;
if (spec) {
if (!mask)
mask = default_mask;
@@ -2501,7 +2483,7 @@ mlx5_flow_list_create(struct rte_eth_dev *dev,
flow->tunnel = parser.tunnel;
flow->rss_conf = (struct rte_flow_action_rss){
.func = RTE_ETH_HASH_FUNCTION_DEFAULT,
- .level = 0,
+ .level = parser.rss_conf.level,
.types = parser.rss_conf.types,
.key_len = parser.rss_conf.key_len,
.queue_num = parser.rss_conf.queue_num,
--
2.12.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix default RSS level
2018-05-15 13:23 [dpdk-dev] [PATCH] net/mlx5: fix default RSS level Shahaf Shuler
@ 2018-05-17 13:32 ` Nélio Laranjeiro
2018-05-17 15:45 ` Shahaf Shuler
0 siblings, 1 reply; 3+ messages in thread
From: Nélio Laranjeiro @ 2018-05-17 13:32 UTC (permalink / raw)
To: Shahaf Shuler; +Cc: adrien.mazarguil, yskoh, dev, xuemingl, matan
On Tue, May 15, 2018 at 04:23:24PM +0300, Shahaf Shuler wrote:
> Using inner RSS by default for GRE leads to memory corruption as the
> extra flow items added for the inner RSS are not counted in the flow
> attributes buffer size.
>
> Fixing by enforcing the default RSS level to be outer. This much
> simplify the flow engine and more robust.
> Future optimization for out of the box RSS can be done on subsequent
> commits.
>
> Fixes: d4a405186b73 ("net/mlx5: support tunnel RSS level")
> Cc: xuemingl@mellanox.com
> Cc: matan@mellanox.com
>
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> ---
> drivers/net/mlx5/mlx5_flow.c | 22 ++--------------------
> 1 file changed, 2 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 0c0d6f99ad..994be05be6 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -805,7 +805,7 @@ mlx5_flow_convert_actions(struct rte_eth_dev *dev,
> }
> parser->rss_conf = (struct rte_flow_action_rss){
> .func = RTE_ETH_HASH_FUNCTION_DEFAULT,
> - .level = rss->level,
> + .level = rss->level ? rss->level : 1,
> .types = rss->types,
> .key_len = rss_key_len,
> .queue_num = rss->queue_num,
> @@ -1166,9 +1166,6 @@ mlx5_flow_convert_rss(struct mlx5_flow_parse *parser)
> int outer = parser->tunnel && parser->rss_conf.level < 2;
> uint64_t rss = parser->rss_conf.types;
>
> - /* Default to outer RSS. */
> - if (!parser->rss_conf.level)
> - parser->rss_conf.level = 1;
> layer = outer ? parser->out_layer : parser->layer;
> if (layer == HASH_RXQ_TUNNEL)
> layer = HASH_RXQ_ETH;
> @@ -1801,9 +1798,6 @@ mlx5_flow_create_vxlan(const struct rte_flow_item *item,
> parser->tunnel = ptype_ext[PTYPE_IDX(RTE_PTYPE_TUNNEL_VXLAN)];
> parser->out_layer = parser->layer;
> parser->layer = HASH_RXQ_TUNNEL;
> - /* Default VXLAN to outer RSS. */
> - if (!parser->rss_conf.level)
> - parser->rss_conf.level = 1;
> if (spec) {
> if (!mask)
> mask = default_mask;
> @@ -1876,9 +1870,6 @@ mlx5_flow_create_vxlan_gpe(const struct rte_flow_item *item,
> parser->tunnel = ptype_ext[PTYPE_IDX(RTE_PTYPE_TUNNEL_VXLAN_GPE)];
> parser->out_layer = parser->layer;
> parser->layer = HASH_RXQ_TUNNEL;
> - /* Default VXLAN-GPE to outer RSS. */
> - if (!parser->rss_conf.level)
> - parser->rss_conf.level = 1;
> if (spec) {
> if (!mask)
> mask = default_mask;
> @@ -1956,9 +1947,6 @@ mlx5_flow_create_gre(const struct rte_flow_item *item,
> parser->tunnel = ptype_ext[PTYPE_IDX(RTE_PTYPE_TUNNEL_GRE)];
> parser->out_layer = parser->layer;
> parser->layer = HASH_RXQ_TUNNEL;
> - /* Default GRE to inner RSS. */
> - if (!parser->rss_conf.level)
> - parser->rss_conf.level = 2;
> #ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT
> if (spec) {
> if (!mask)
> @@ -2052,12 +2040,6 @@ mlx5_flow_create_mpls(const struct rte_flow_item *item,
> /* parser->out_layer stays as in GRE out_layer. */
> }
> parser->layer = HASH_RXQ_TUNNEL;
> - /*
> - * For MPLS-in-GRE, RSS level should have been set.
> - * For MPLS-in-UDP, use outer RSS.
> - */
> - if (!parser->rss_conf.level)
> - parser->rss_conf.level = 1;
> if (spec) {
> if (!mask)
> mask = default_mask;
> @@ -2501,7 +2483,7 @@ mlx5_flow_list_create(struct rte_eth_dev *dev,
> flow->tunnel = parser.tunnel;
> flow->rss_conf = (struct rte_flow_action_rss){
> .func = RTE_ETH_HASH_FUNCTION_DEFAULT,
> - .level = 0,
> + .level = parser.rss_conf.level,
> .types = parser.rss_conf.types,
> .key_len = parser.rss_conf.key_len,
> .queue_num = parser.rss_conf.queue_num,
> --
> 2.12.0
>
--
Nélio Laranjeiro
6WIND
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix default RSS level
2018-05-17 13:32 ` Nélio Laranjeiro
@ 2018-05-17 15:45 ` Shahaf Shuler
0 siblings, 0 replies; 3+ messages in thread
From: Shahaf Shuler @ 2018-05-17 15:45 UTC (permalink / raw)
To: Nélio Laranjeiro
Cc: Adrien Mazarguil, Yongseok Koh, dev, Xueming(Steven) Li, Matan Azrad
Thursday, May 17, 2018 4:32 PM, Nélio Laranjeiro:
> Subject: Re: [PATCH] net/mlx5: fix default RSS level
>
> On Tue, May 15, 2018 at 04:23:24PM +0300, Shahaf Shuler wrote:
> > Using inner RSS by default for GRE leads to memory corruption as the
> > extra flow items added for the inner RSS are not counted in the flow
> > attributes buffer size.
> >
> > Fixing by enforcing the default RSS level to be outer. This much
> > simplify the flow engine and more robust.
> > Future optimization for out of the box RSS can be done on subsequent
> > commits.
> >
> > Fixes: d4a405186b73 ("net/mlx5: support tunnel RSS level")
> > Cc: xuemingl@mellanox.com
> > Cc: matan@mellanox.com
> >
> > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
>
> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
>
Applied to next-net-mlx, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-17 15:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-15 13:23 [dpdk-dev] [PATCH] net/mlx5: fix default RSS level Shahaf Shuler
2018-05-17 13:32 ` Nélio Laranjeiro
2018-05-17 15:45 ` 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).