aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/pkt_sched.h5
-rw-r--r--net/sched/sch_hfsc.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index e37fe3129c17..cd0e026d4f6a 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -42,8 +42,9 @@ typedef u64 psched_time_t;
42typedef long psched_tdiff_t; 42typedef long psched_tdiff_t;
43 43
44/* Avoid doing 64 bit divide by 1000 */ 44/* Avoid doing 64 bit divide by 1000 */
45#define PSCHED_US2NS(x) ((s64)(x) << 10) 45#define PSCHED_SHIFT 10
46#define PSCHED_NS2US(x) ((x) >> 10) 46#define PSCHED_US2NS(x) ((s64)(x) << PSCHED_SHIFT)
47#define PSCHED_NS2US(x) ((x) >> PSCHED_SHIFT)
47 48
48#define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC) 49#define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC)
49#define PSCHED_PASTPERFECT 0 50#define PSCHED_PASTPERFECT 0
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 5022f9c1f34b..362c2811b2df 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -372,7 +372,7 @@ cftree_update(struct hfsc_class *cl)
372 * ism: (psched_us/byte) << ISM_SHIFT 372 * ism: (psched_us/byte) << ISM_SHIFT
373 * dx: psched_us 373 * dx: psched_us
374 * 374 *
375 * The clock source resolution with ktime is 1.024us. 375 * The clock source resolution with ktime and PSCHED_SHIFT 10 is 1.024us.
376 * 376 *
377 * sm and ism are scaled in order to keep effective digits. 377 * sm and ism are scaled in order to keep effective digits.
378 * SM_SHIFT and ISM_SHIFT are selected to keep at least 4 effective 378 * SM_SHIFT and ISM_SHIFT are selected to keep at least 4 effective
@@ -383,9 +383,11 @@ cftree_update(struct hfsc_class *cl)
383 * bytes/1.024us 12.8e-3 128e-3 1280e-3 12800e-3 128000e-3 383 * bytes/1.024us 12.8e-3 128e-3 1280e-3 12800e-3 128000e-3
384 * 384 *
385 * 1.024us/byte 78.125 7.8125 0.78125 0.078125 0.0078125 385 * 1.024us/byte 78.125 7.8125 0.78125 0.078125 0.0078125
386 *
387 * So, for PSCHED_SHIFT 10 we need: SM_SHIFT 20, ISM_SHIFT 18.
386 */ 388 */
387#define SM_SHIFT 20 389#define SM_SHIFT (30 - PSCHED_SHIFT)
388#define ISM_SHIFT 18 390#define ISM_SHIFT (8 + PSCHED_SHIFT)
389 391
390#define SM_MASK ((1ULL << SM_SHIFT) - 1) 392#define SM_MASK ((1ULL << SM_SHIFT) - 1)
391#define ISM_MASK ((1ULL << ISM_SHIFT) - 1) 393#define ISM_MASK ((1ULL << ISM_SHIFT) - 1)