net/mlx5: fix GENEVE TLV option management
PATCH 1/1 net/mlx5: fix GENEVE TLV option management
In SW steering, the GENEVE TLV option matching flows must be created using a translation function.
This function checks whether this option has already created a DevX object for the matching and either creates the objects or updates the reference counter.
After translation, a flag in flow structure is turned on indicating the destroy function to release this DevX object.
When the flow rule has meter, the rule may be split, and call translate function more than once per flow causing object reference counter to increase each time without updating the flow flag accordingly.
This patch uses this flag as a reference counter which is increased every translation and indicates the destroy function how many destroy DevX to do.
--- drivers/net/mlx5/mlx5_flow_dv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +3 -3
@@ -14318,7 +14318,7 @@ flow_dv_translate_items_sws(struct rte_eth_dev *dev,* Avoid be overwritten by other sub mlx5_flows. */ if (wks.geneve_tlv_option) - dev_flow->flow->geneve_tlv_option = wks.geneve_tlv_option; + dev_flow->flow->geneve_tlv_option += wks.geneve_tlv_option;return 0 ; }
@@ -15922,9 +15922,9 @@ flow_dv_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)flow_dv_aso_ct_release (dev, flow->ct,NULL ); else if (flow->age) flow_dv_aso_age_release(dev, flow->age); -if (flow->geneve_tlv_option) { +while (flow->geneve_tlv_option) {flow_dev_geneve_tlv_option_resource_release (priv->sh); - flow->geneve_tlv_option =0 ; + flow->geneve_tlv_option--; }while (flow->dev_handles) {uint32_t tmp_idx = flow->dev_handles;
Signature · 1 line
2.25.1
Hi,
Quoted 25 lines
-----Original Message-----
From: Michael Baum <[email protected]>
Sent: Monday, January 15, 2024 2:13 PM
To: [email protected]
Cc: Matan Azrad <[email protected]>; Dariusz Sosnowski <[email protected]>; Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Shiri Kuzin <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: fix GENEVE TLV option managementIn SW steering, the GENEVE TLV option matching flows must be created using a translation function.
This function checks whether this option has already created a DevX object for the matching and either creates the objects or updates the reference counter. After translation, a flag in flow structure is turned on indicating the destroy function to release this DevX object.When the flow rule has meter, the rule may be split, and call translate function more than once per flow causing object reference counter to increase each time without updating the flow flag accordingly.
This patch uses this flag as a reference counter which is increased every translation and indicates the destroy function how many destroy DevX to do.
Quoted 7 lines
Fixes f15f0c3806d0 ("net/mlx5: create GENEVE TLV option management")Fixes e440d6cf589e ("net/mlx5: add GENEVE TLV option flow translation")Signed-off-by Michael Baum <[email protected]>Acked-by Matan Azrad <[email protected]>
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh