diff options
| -rw-r--r-- | include/net/codel.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/include/net/codel.h b/include/net/codel.h index 389cf621161d..3b04ff5f6f8d 100644 --- a/include/net/codel.h +++ b/include/net/codel.h | |||
| @@ -72,10 +72,21 @@ static inline codel_time_t codel_get_time(void) | |||
| 72 | return ns >> CODEL_SHIFT; | 72 | return ns >> CODEL_SHIFT; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | #define codel_time_after(a, b) ((s32)(a) - (s32)(b) > 0) | 75 | /* Dealing with timer wrapping, according to RFC 1982, as desc in wikipedia: |
| 76 | #define codel_time_after_eq(a, b) ((s32)(a) - (s32)(b) >= 0) | 76 | * https://en.wikipedia.org/wiki/Serial_number_arithmetic#General_Solution |
| 77 | #define codel_time_before(a, b) ((s32)(a) - (s32)(b) < 0) | 77 | * codel_time_after(a,b) returns true if the time a is after time b. |
| 78 | #define codel_time_before_eq(a, b) ((s32)(a) - (s32)(b) <= 0) | 78 | */ |
| 79 | #define codel_time_after(a, b) \ | ||
| 80 | (typecheck(codel_time_t, a) && \ | ||
| 81 | typecheck(codel_time_t, b) && \ | ||
| 82 | ((s32)((a) - (b)) > 0)) | ||
| 83 | #define codel_time_before(a, b) codel_time_after(b, a) | ||
| 84 | |||
| 85 | #define codel_time_after_eq(a, b) \ | ||
| 86 | (typecheck(codel_time_t, a) && \ | ||
| 87 | typecheck(codel_time_t, b) && \ | ||
| 88 | ((s32)((a) - (b)) >= 0)) | ||
| 89 | #define codel_time_before_eq(a, b) codel_time_after_eq(b, a) | ||
| 79 | 90 | ||
| 80 | /* Qdiscs using codel plugin must use codel_skb_cb in their own cb[] */ | 91 | /* Qdiscs using codel plugin must use codel_skb_cb in their own cb[] */ |
| 81 | struct codel_skb_cb { | 92 | struct codel_skb_cb { |
