[NET_SCHED]: Use ktime as clocksource
[deliverable/linux.git] / net / sched / sch_hfsc.c
index 135087d4213a45f58eeecd2b935392bb70a933a5..f85cfba647f85ec2b12b2519dae8d87011543001 100644 (file)
@@ -71,8 +71,6 @@
 #include <asm/system.h>
 #include <asm/div64.h>
 
-#define HFSC_DEBUG 1
-
 /*
  * kernel internal service curve representation:
  *   coordinates are given by 64 bit unsigned integers.
@@ -197,31 +195,6 @@ struct hfsc_sched
        struct timer_list wd_timer;             /* watchdog timer */
 };
 
-/*
- * macros
- */
-#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
-#include <linux/time.h>
-#undef PSCHED_GET_TIME
-#define PSCHED_GET_TIME(stamp)                                         \
-do {                                                                   \
-       struct timeval tv;                                              \
-       do_gettimeofday(&tv);                                           \
-       (stamp) = 1ULL * USEC_PER_SEC * tv.tv_sec + tv.tv_usec;         \
-} while (0)
-#endif
-
-#if HFSC_DEBUG
-#define ASSERT(cond)                                                   \
-do {                                                                   \
-       if (unlikely(!(cond)))                                          \
-               printk("assertion %s failed at %s:%i (%s)\n",           \
-                      #cond, __FILE__, __LINE__, __FUNCTION__);        \
-} while (0)
-#else
-#define ASSERT(cond)
-#endif /* HFSC_DEBUG */
-
 #define        HT_INFINITY     0xffffffffffffffffULL   /* infinite time value */
 
 
@@ -407,28 +380,17 @@ cftree_update(struct hfsc_class *cl)
  *     ism: (psched_us/byte) << ISM_SHIFT
  *     dx: psched_us
  *
- * Clock source resolution (CONFIG_NET_SCH_CLK_*)
- *  JIFFIES: for 48<=HZ<=1534 resolution is between 0.63us and 1.27us.
- *  CPU: resolution is between 0.5us and 1us.
- *  GETTIMEOFDAY: resolution is exactly 1us.
+ * The clock source resolution with ktime is 1.024us.
  *
  * sm and ism are scaled in order to keep effective digits.
  * SM_SHIFT and ISM_SHIFT are selected to keep at least 4 effective
  * digits in decimal using the following table.
  *
- * Note: We can afford the additional accuracy (altq hfsc keeps at most
- * 3 effective digits) thanks to the fact that linux clock is bounded
- * much more tightly.
- *
  *  bits/sec      100Kbps     1Mbps     10Mbps     100Mbps    1Gbps
  *  ------------+-------------------------------------------------------
- *  bytes/0.5us   6.25e-3    62.5e-3    625e-3     6250e-e    62500e-3
- *  bytes/us      12.5e-3    125e-3     1250e-3    12500e-3   125000e-3
- *  bytes/1.27us  15.875e-3  158.75e-3  1587.5e-3  15875e-3   158750e-3
+ *  bytes/1.024us 12.8e-3    128e-3     1280e-3    12800e-3   128000e-3
  *
- *  0.5us/byte    160        16         1.6        0.16       0.016
- *  us/byte       80         8          0.8        0.08       0.008
- *  1.27us/byte   63         6.3        0.63       0.063      0.0063
+ *  1.024us/byte  78.125     7.8125     0.78125    0.078125   0.0078125
  */
 #define        SM_SHIFT        20
 #define        ISM_SHIFT       18
@@ -1197,10 +1159,12 @@ hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
 
        sch_tree_lock(sch);
 
-       list_del(&cl->hlist);
        list_del(&cl->siblings);
        hfsc_adjust_levels(cl->cl_parent);
+
        hfsc_purge_queue(sch, cl);
+       list_del(&cl->hlist);
+
        if (--cl->refcnt == 0)
                hfsc_destroy_class(sch, cl);
 
@@ -1492,7 +1456,7 @@ hfsc_schedule_watchdog(struct Qdisc *sch, u64 cur_time)
                if (next_time == 0 || next_time > q->root.cl_cfmin)
                        next_time = q->root.cl_cfmin;
        }
-       ASSERT(next_time != 0);
+       WARN_ON(next_time == 0);
        delay = next_time - cur_time;
        delay = PSCHED_US2JIFFIE(delay);
 
This page took 0.025598 seconds and 5 git commands to generate.