aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/net/pkt_sched.h8
-rw-r--r--include/net/red.h4
2 files changed, 7 insertions, 5 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index e6b1da050d32..b2cc9a8ed4e7 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -48,11 +48,13 @@ typedef long psched_tdiff_t;
48#define PSCHED_NS2US(x) ((x) >> 10) 48#define PSCHED_NS2US(x) ((x) >> 10)
49 49
50#define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC) 50#define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC)
51#define PSCHED_GET_TIME(stamp) \
52 ((stamp) = PSCHED_NS2US(ktime_to_ns(ktime_get())))
53
54#define PSCHED_PASTPERFECT 0 51#define PSCHED_PASTPERFECT 0
55 52
53static inline psched_time_t psched_get_time(void)
54{
55 return PSCHED_NS2US(ktime_to_ns(ktime_get()));
56}
57
56static inline psched_tdiff_t 58static inline psched_tdiff_t
57psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound) 59psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound)
58{ 60{
diff --git a/include/net/red.h b/include/net/red.h
index 0bc16913fdd7..3cf31d466a81 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -156,7 +156,7 @@ static inline int red_is_idling(struct red_parms *p)
156 156
157static inline void red_start_of_idle_period(struct red_parms *p) 157static inline void red_start_of_idle_period(struct red_parms *p)
158{ 158{
159 PSCHED_GET_TIME(p->qidlestart); 159 p->qidlestart = psched_get_time();
160} 160}
161 161
162static inline void red_end_of_idle_period(struct red_parms *p) 162static inline void red_end_of_idle_period(struct red_parms *p)
@@ -177,7 +177,7 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p)
177 long us_idle; 177 long us_idle;
178 int shift; 178 int shift;
179 179
180 PSCHED_GET_TIME(now); 180 now = psched_get_time();
181 us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max); 181 us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max);
182 182
183 /* 183 /*