@@ -465,7 +465,8 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
list_for_each_entry(flow, &e->flows, encap) {
if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) {
counter = mlx5_flow_rule_counter(flow->rule);
- mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse);
+ mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse,
+ MLX5_FLOW_QUERY_CACHED_DIFF);
if (time_after((unsigned long)lastuse, nhe->reported_lastuse)) {
neigh_used = true;
break;
@@ -2133,7 +2134,8 @@ int mlx5e_stats_flower(struct mlx5e_priv *priv,
if (!counter)
return 0;
- mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse);
+ mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse,
+ MLX5_FLOW_QUERY_CACHED_DIFF);
tcf_exts_stats_update(f->exts, bytes, packets, lastuse);
@@ -315,16 +315,22 @@ void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev)
}
void mlx5_fc_query_cached(struct mlx5_fc *counter,
- u64 *bytes, u64 *packets, u64 *lastuse)
+ u64 *bytes, u64 *packets, u64 *lastuse,
+ enum mlx5_flow_query_cached_flags query_flags)
{
struct mlx5_fc_cache c;
c = counter->cache;
- *bytes = c.bytes - counter->lastbytes;
- *packets = c.packets - counter->lastpackets;
- *lastuse = c.lastuse;
+ if (query_flags == MLX5_FLOW_QUERY_CACHED_ABS) {
+ *bytes = c.bytes;
+ *packets = c.packets;
+ } else {
+ *bytes = c.bytes - counter->lastbytes;
+ *packets = c.packets - counter->lastpackets;
+ }
+ *lastuse = c.lastuse;
counter->lastbytes = c.bytes;
counter->lastpackets = c.packets;
}
@@ -164,8 +164,14 @@ int mlx5_modify_rule_destination(struct mlx5_flow_handle *handler,
struct mlx5_fc *mlx5_flow_rule_counter(struct mlx5_flow_handle *handler);
struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
+
+enum mlx5_flow_query_cached_flags {
+ MLX5_FLOW_QUERY_CACHED_DIFF = 0,
+ MLX5_FLOW_QUERY_CACHED_ABS = 1,
+};
void mlx5_fc_query_cached(struct mlx5_fc *counter,
- u64 *bytes, u64 *packets, u64 *lastuse);
+ u64 *bytes, u64 *packets, u64 *lastuse,
+ enum mlx5_flow_query_cached_flags query_flags);
int mlx5_cmd_fc_query(struct mlx5_core_dev *dev, u32 id,
u64 *packets, u64 *bytes);