On Fri, May 18, 2018 at 09:47:53AM +0800, Marek
Lindner wrote:
+fallback_throughput:
+ last_tp_run_jiffies = jiffies - neigh->bat_v.last_tp_meter_run;
+ last_tp_run_msecs = jiffies_to_msecs(last_tp_run_jiffies);
+
+ /* check the tp_meter_running flag before checking the timestamp
to
+ * avoid a race condition where a new tp meter session is
scheduled
+ * right after the previous tp meter session has completed
+ */
+ if (!neigh->bat_v.tp_meter_running &&
+ last_tp_run_msecs > BATADV_ELP_TP_RUN_INTERVAL)
+ batadv_v_elp_tp_start(neigh);
+
+ /* discard too old tp test results */
+ if (last_tp_run_msecs > 2 * BATADV_ELP_TP_RUN_INTERVAL)
+ neigh->bat_v.tp_meter_throughput = 0;
+
So far we were either using time_before(), time_after_eq() or our
own wrapper batadv_has_timed_out(). Would it make sense to use
some of these here, too?
Good point. That changes has been staged for v3.
Cheers,
Marek