aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/core/drop_monitor.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index d31120248c03..0a113f26bc9f 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -52,6 +52,7 @@ struct per_cpu_dm_data {
52 52
53struct dm_hw_stat_delta { 53struct dm_hw_stat_delta {
54 struct net_device *dev; 54 struct net_device *dev;
55 unsigned long last_rx;
55 struct list_head list; 56 struct list_head list;
56 struct rcu_head rcu; 57 struct rcu_head rcu;
57 unsigned long last_drop_val; 58 unsigned long last_drop_val;
@@ -180,18 +181,25 @@ static void trace_napi_poll_hit(struct napi_struct *napi)
180 struct dm_hw_stat_delta *new_stat; 181 struct dm_hw_stat_delta *new_stat;
181 182
182 /* 183 /*
183 * Ratelimit our check time to dm_hw_check_delta jiffies 184 * Don't check napi structures with no associated device
184 */ 185 */
185 if (!napi->dev || 186 if (!napi->dev)
186 !time_after(jiffies, napi->dev->last_rx + dm_hw_check_delta))
187 return; 187 return;
188 188
189 rcu_read_lock(); 189 rcu_read_lock();
190 list_for_each_entry_rcu(new_stat, &hw_stats_list, list) { 190 list_for_each_entry_rcu(new_stat, &hw_stats_list, list) {
191 /*
192 * only add a note to our monitor buffer if:
193 * 1) this is the dev we received on
194 * 2) its after the last_rx delta
195 * 3) our rx_dropped count has gone up
196 */
191 if ((new_stat->dev == napi->dev) && 197 if ((new_stat->dev == napi->dev) &&
198 (time_after(jiffies, new_stat->last_rx + dm_hw_check_delta)) &&
192 (napi->dev->stats.rx_dropped != new_stat->last_drop_val)) { 199 (napi->dev->stats.rx_dropped != new_stat->last_drop_val)) {
193 trace_drop_common(NULL, NULL); 200 trace_drop_common(NULL, NULL);
194 new_stat->last_drop_val = napi->dev->stats.rx_dropped; 201 new_stat->last_drop_val = napi->dev->stats.rx_dropped;
202 new_stat->last_rx = jiffies;
195 break; 203 break;
196 } 204 }
197 } 205 }
@@ -287,6 +295,7 @@ static int dropmon_net_event(struct notifier_block *ev_block,
287 goto out; 295 goto out;
288 296
289 new_stat->dev = dev; 297 new_stat->dev = dev;
298 new_stat->last_rx = jiffies;
290 INIT_RCU_HEAD(&new_stat->rcu); 299 INIT_RCU_HEAD(&new_stat->rcu);
291 spin_lock(&trace_state_lock); 300 spin_lock(&trace_state_lock);
292 list_add_rcu(&new_stat->list, &hw_stats_list); 301 list_add_rcu(&new_stat->list, &hw_stats_list);