net/mlx5: prevent querying aged flows on uninit port
PATCH 1/1 net/mlx5: prevent querying aged flows on uninit port
In HWS template API, the aging mechanism doesn't support shared host mode now. When the guest's counter is set to 0, the aging won't be initialized.
The current implementation didn't prevent the user from querying the aged flows on the uninitialized port. The access of invalid pointers would cause a crash.
With this commit, the flag of the per port aging initialization will be checked. This would help to get rid of the invalid accessing.
--- drivers/net/mlx5/mlx5_flow_hw.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/mlx5/mlx5_flow_hw.c +4 -0
@@ -10937,6 +10937,10 @@ flow_hw_get_q_aged_flows(struct rte_eth_dev *dev, uint32_t queue_id,return rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL ,"empty context" ); +if (!priv->hws_age_req) +return rte_flow_error_set (error,ENOENT , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,"No aging initialized" );if (priv->hws_strict_queue) {if (queue_id >= age_info->hw_q_age->nb_rings) return rte_flow_error_set(error, EINVAL,
Signature · 1 line
2.34.1
Hi,
Quoted 21 lines
-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Wednesday, February 21, 2024 5:23 AM
To: Suanming Mou <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]
Cc: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Dariusz Sosnowski <[email protected]>; [email protected]; Michael Baum <[email protected]>
Subject: [PATCH] net/mlx5: prevent querying aged flows on uninit portIn HWS template API, the aging mechanism doesn't support shared host mode now. When the guest's counter is set to 0, the aging won't be initialized.
The current implementation didn't prevent the user from querying the aged flows on the uninitialized port. The access of invalid pointers would cause a crash.
With this commit, the flag of the per port aging initialization will be checked. This would help to get rid of the invalid accessing.
Quoted 7 lines
Fixes 04a4de756e14 ("net/mlx5: support flow age action with HWS")Signed-off-by Bing Zhao <[email protected]>Acked-by Suanming Mou <[email protected]>---[Raslan Darawsheh]
Patch applied to next-net-mlx
Kindest regards,
Raslan Darawsheh