| #ifndef __NET_MAC80211_CODEL_I_H |
| #define __NET_MAC80211_CODEL_I_H |
| |
| /* |
| * Codel - The Controlled-Delay Active Queue Management algorithm |
| * |
| * Copyright (C) 2011-2012 Kathleen Nichols <nichols@pollere.com> |
| * Copyright (C) 2011-2012 Van Jacobson <van@pollere.net> |
| * Copyright (C) 2016 Michael D. Taht <dave.taht@bufferbloat.net> |
| * Copyright (C) 2012 Eric Dumazet <edumazet@google.com> |
| * Copyright (C) 2015 Jonathan Morton <chromatix99@gmail.com> |
| * Copyright (C) 2016 Michal Kazior <michal.kazior@tieto.com> |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| * are met: |
| * 1. Redistributions of source code must retain the above copyright |
| * notice, this list of conditions, and the following disclaimer, |
| * without modification. |
| * 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. |
| * 3. The names of the authors may not be used to endorse or promote products |
| * derived from this software without specific prior written permission. |
| * |
| * Alternatively, provided that this notice is retained in full, this |
| * software may be distributed under the terms of the GNU General |
| * Public License ("GPL") version 2, in which case the provisions of the |
| * GPL apply INSTEAD OF those given above. |
| * |
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
| * DAMAGE. |
| * |
| */ |
| |
| #include <linux/version.h> |
| #include <linux/types.h> |
| #include <linux/ktime.h> |
| #include <linux/skbuff.h> |
| #include <net/pkt_sched.h> |
| #include <net/inet_ecn.h> |
| #include <linux/reciprocal_div.h> |
| |
| /* Controlling Queue Delay (CoDel) algorithm |
| * ========================================= |
| * Source : Kathleen Nichols and Van Jacobson |
| * http://queue.acm.org/detail.cfm?id=2209336 |
| * |
| * Implemented on linux by Dave Taht and Eric Dumazet |
| */ |
| |
| /* CoDel5 uses a real clock, unlike codel */ |
| |
| #define MS2TIME(a) (a * (u64) NSEC_PER_MSEC) |
| #define US2TIME(a) (a * (u64) NSEC_PER_USEC) |
| |
| /** |
| * struct codel_vars - contains codel variables |
| * @count: how many drops we've done since the last time we |
| * entered dropping state |
| * @dropping: set to > 0 if in dropping state |
| * @rec_inv_sqrt: reciprocal value of sqrt(count) >> 1 |
| * @first_above_time: when we went (or will go) continuously above target |
| * for interval |
| * @drop_next: time to drop next packet, or when we dropped last |
| * @drop_count: temp count of dropped packets in dequeue() |
| * @ecn_mark: number of packets we ECN marked instead of dropping |
| */ |
| |
| struct codel_vars { |
| u32 count; |
| u16 dropping; |
| u16 rec_inv_sqrt; |
| codel_time_t first_above_time; |
| codel_time_t drop_next; |
| u16 drop_count; |
| u16 ecn_mark; |
| }; |
| #endif |