mirror of https://gitee.com/openkylin/linux.git
net/mlx5e: Always query offloaded tc peer rule counter
Under multipath when encap rules are duplicated to HW in the driver, it's possible for one flow to be currently un-offloaded (e.g. lack of next-hop route or neigh entry) while the other flow is offloaded. As such, we move to query the counters of both flows at all times. Signed-off-by: Roi Dayan <roid@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
b4a23329e2
commit
316d5f72b4
|
@ -3078,23 +3078,25 @@ int mlx5e_stats_flower(struct net_device *dev, struct mlx5e_priv *priv,
|
||||||
struct mlx5_eswitch *peer_esw;
|
struct mlx5_eswitch *peer_esw;
|
||||||
struct mlx5e_tc_flow *flow;
|
struct mlx5e_tc_flow *flow;
|
||||||
struct mlx5_fc *counter;
|
struct mlx5_fc *counter;
|
||||||
u64 bytes;
|
u64 lastuse = 0;
|
||||||
u64 packets;
|
u64 packets = 0;
|
||||||
u64 lastuse;
|
u64 bytes = 0;
|
||||||
|
|
||||||
flow = rhashtable_lookup_fast(tc_ht, &f->cookie, tc_ht_params);
|
flow = rhashtable_lookup_fast(tc_ht, &f->cookie, tc_ht_params);
|
||||||
if (!flow || !same_flow_direction(flow, flags))
|
if (!flow || !same_flow_direction(flow, flags))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!(flow->flags & MLX5E_TC_FLOW_OFFLOADED))
|
if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) {
|
||||||
return 0;
|
counter = mlx5e_tc_get_counter(flow);
|
||||||
|
if (!counter)
|
||||||
|
return 0;
|
||||||
|
|
||||||
counter = mlx5e_tc_get_counter(flow);
|
mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse);
|
||||||
if (!counter)
|
}
|
||||||
return 0;
|
|
||||||
|
|
||||||
mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse);
|
|
||||||
|
|
||||||
|
/* Under multipath it's possible for one rule to be currently
|
||||||
|
* un-offloaded while the other rule is offloaded.
|
||||||
|
*/
|
||||||
peer_esw = mlx5_devcom_get_peer_data(devcom, MLX5_DEVCOM_ESW_OFFLOADS);
|
peer_esw = mlx5_devcom_get_peer_data(devcom, MLX5_DEVCOM_ESW_OFFLOADS);
|
||||||
if (!peer_esw)
|
if (!peer_esw)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -3106,6 +3108,8 @@ int mlx5e_stats_flower(struct net_device *dev, struct mlx5e_priv *priv,
|
||||||
u64 lastuse2;
|
u64 lastuse2;
|
||||||
|
|
||||||
counter = mlx5e_tc_get_counter(flow->peer_flow);
|
counter = mlx5e_tc_get_counter(flow->peer_flow);
|
||||||
|
if (!counter)
|
||||||
|
goto no_peer_counter;
|
||||||
mlx5_fc_query_cached(counter, &bytes2, &packets2, &lastuse2);
|
mlx5_fc_query_cached(counter, &bytes2, &packets2, &lastuse2);
|
||||||
|
|
||||||
bytes += bytes2;
|
bytes += bytes2;
|
||||||
|
@ -3113,8 +3117,8 @@ int mlx5e_stats_flower(struct net_device *dev, struct mlx5e_priv *priv,
|
||||||
lastuse = max_t(u64, lastuse, lastuse2);
|
lastuse = max_t(u64, lastuse, lastuse2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
no_peer_counter:
|
||||||
mlx5_devcom_release_peer_data(devcom, MLX5_DEVCOM_ESW_OFFLOADS);
|
mlx5_devcom_release_peer_data(devcom, MLX5_DEVCOM_ESW_OFFLOADS);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
flow_stats_update(&f->stats, bytes, packets, lastuse);
|
flow_stats_update(&f->stats, bytes, packets, lastuse);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue