net/mlx5: fix meter suffix flow
authorSuanming Mou <suanmingm@mellanox.com>
Wed, 8 Jan 2020 10:41:09 +0000 (12:41 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 20 Jan 2020 17:02:17 +0000 (18:02 +0100)
The meter suffix flow item pointer restore is not correct to decrease
a fixed value. The incorrect operation will cause incorrect match to
the meter suffix flow, the flow create will fail once the magic number
in the wrong offset memory start with RTE_FLOW_ITEM_TYPE_END.
The pointer should decrease the real offset it increases.

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

Fixes: 9ea9b049a960 ("net/mlx5: split meter flow")
Cc: stable@dpdk.org
Reported-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
drivers/net/mlx5/mlx5_flow.c

index bb1f1f1..970123b 100644 (file)
@@ -4042,7 +4042,7 @@ flow_create_split_meter(struct rte_eth_dev *dev,
                        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) :