Skip to content

Commit 0b67a38

Browse files
hadarhenzionSaeed Mahameed
authored andcommitted
net/mlx5e: Use flag to properly monitor a flow rule offloading state
Instead of relaying on the 'flow->rule' pointer value which can be valid or invalid (in case the FW returns an error while trying to offload the rule), monitor the rule state using a flag. In downstream patch which adds support to IP tunneling neigh update flow, a TC rule could be cached in the driver and not offloaded into the HW. In this case, the flow handle pointer stays NULL. Check the offloaded flag to properly deal with rules which are currently not offloaded when querying rule statistics. This patch doesn't add any new functionality. Signed-off-by: Hadar Hen Zion <[email protected]> Reviewed-by: Or Gerlitz <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 1a8552b commit 0b67a38

File tree

1 file changed

+7
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+7
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct mlx5_nic_flow_attr {
5959
enum {
6060
MLX5E_TC_FLOW_ESWITCH = BIT(0),
6161
MLX5E_TC_FLOW_NIC = BIT(1),
62+
MLX5E_TC_FLOW_OFFLOADED = BIT(2),
6263
};
6364

6465
struct mlx5e_tc_flow {
@@ -245,7 +246,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
245246
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
246247
struct mlx5_esw_flow_attr *attr = flow->esw_attr;
247248

248-
mlx5_eswitch_del_offloaded_rule(esw, flow->rule, flow->esw_attr);
249+
if (flow->flags & MLX5E_TC_FLOW_OFFLOADED)
250+
mlx5_eswitch_del_offloaded_rule(esw, flow->rule, flow->esw_attr);
249251

250252
mlx5_eswitch_del_vlan_action(esw, flow->esw_attr);
251253

@@ -1591,6 +1593,7 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
15911593
goto err_free;
15921594
}
15931595

1596+
flow->flags |= MLX5E_TC_FLOW_OFFLOADED;
15941597
err = rhashtable_insert_fast(&tc->ht, &flow->node,
15951598
tc->ht_params);
15961599
if (err)
@@ -1646,6 +1649,9 @@ int mlx5e_stats_flower(struct mlx5e_priv *priv,
16461649
if (!flow)
16471650
return -EINVAL;
16481651

1652+
if (!(flow->flags & MLX5E_TC_FLOW_OFFLOADED))
1653+
return 0;
1654+
16491655
counter = mlx5_flow_rule_counter(flow->rule);
16501656
if (!counter)
16511657
return 0;

0 commit comments

Comments
 (0)