net/mlx5: fix incorrect pointer operation

Message ID 1578387392-114282-1-git-send-email-suanmingm@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix incorrect pointer operation |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Suanming Mou Jan. 7, 2020, 8:56 a.m. UTC
  The meter suffix flow item pointer restore is not correct to minus a
fixed value. It should minus the real offset it increases.

Set the value to the real offset the pointer increases to fix the issue.

Fixes: 9ea9b049a960 ("net/mlx5: split meter flow")
Cc: stable@dpdk.org

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Tested-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 drivers/net/mlx5/mlx5_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon Jan. 7, 2020, 2:29 p.m. UTC | #1
Hi,

How this issue was seen? Is it related to the bug reported by Tonghao Zhang?
If yes, you may use "Reported-by:".

One comment about the title, please describe which area is fixed,
instead of "incorrect pointer operation" which is very generic.
The title should probably include the word "meter".
Then in the explanations below, please explain what is the impact of the bug.

Thanks

07/01/2020 09:56, Suanming Mou:
> The meter suffix flow item pointer restore is not correct to minus a
> fixed value. It should minus the real offset it increases.
> 
> Set the value to the real offset the pointer increases to fix the issue.
> 
> Fixes: 9ea9b049a960 ("net/mlx5: split meter flow")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
> Tested-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index cb9d265..52ffcb2 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -4037,7 +4037,7 @@  uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 			sfx_items++;
 		}
 		sfx_items->type = RTE_FLOW_ITEM_TYPE_END;
-		sfx_items -= METER_SUFFIX_ITEM;
+		sfx_items -= sfx_port_id_item ? 2 : 1;
 		/* Setting the sfx group atrr. */
 		sfx_attr.group = sfx_attr.transfer ?
 				(MLX5_FLOW_TABLE_LEVEL_SUFFIX - 1) :