aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Vadai <amir@vadai.me>2016-08-18 14:09:06 -0400
committerDavid S. Miller <davem@davemloft.net>2016-08-19 19:09:55 -0400
commit6c3b4f90861c7ed59d0287b0ff7f2623f9d93d73 (patch)
treea1bdb22fd938edbd0f726b2a284d3087138d17cf
parent2c0f8ce1b584a4d7b8ff53140d21dfed99834940 (diff)
net/mlx5: Update last-use statistics for flow rules
Set lastuse statistic, when number of packets is changed compared to last query. This was wrongly dropped when bulk counter reading was added. Fixes: a351a1b03bf1 ('net/mlx5: Introduce bulk reading of flow counters') Signed-off-by: Amir Vadai <amirva@mellanox.com> Reported-by: Paul Blakey <paulb@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
index c2877e9de8a1..3a9195b4169d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
@@ -126,12 +126,21 @@ static struct rb_node *mlx5_fc_stats_query(struct mlx5_core_dev *dev,
126 for (node = &first->node; node; node = rb_next(node)) { 126 for (node = &first->node; node; node = rb_next(node)) {
127 struct mlx5_fc *counter = rb_entry(node, struct mlx5_fc, node); 127 struct mlx5_fc *counter = rb_entry(node, struct mlx5_fc, node);
128 struct mlx5_fc_cache *c = &counter->cache; 128 struct mlx5_fc_cache *c = &counter->cache;
129 u64 packets;
130 u64 bytes;
129 131
130 if (counter->id > last_id) 132 if (counter->id > last_id)
131 break; 133 break;
132 134
133 mlx5_cmd_fc_bulk_get(dev, b, 135 mlx5_cmd_fc_bulk_get(dev, b,
134 counter->id, &c->packets, &c->bytes); 136 counter->id, &packets, &bytes);
137
138 if (c->packets == packets)
139 continue;
140
141 c->packets = packets;
142 c->bytes = bytes;
143 c->lastuse = jiffies;
135 } 144 }
136 145
137out: 146out: