1 #ifndef __pacer_timer_h__
2 #define __pacer_timer_h__
3 /*-
4  * Copyright (c) 2017 Netflix, Inc.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  * __FBSDID("$FreeBSD$");
28  */
29 /* Common defines and such used by both RACK and BBR */
30 /* Special values for mss accounting array */
31 #define TCP_MSS_ACCT_JUSTRET 0
32 #define TCP_MSS_ACCT_SNDACK  1
33 #define TCP_MSS_ACCT_PERSIST 2
34 #define TCP_MSS_ACCT_ATIMER  60
35 #define TCP_MSS_ACCT_INPACE  61
36 #define TCP_MSS_ACCT_LATE    62
37 #define TCP_MSS_SMALL_SIZE_OFF 63	/* Point where small sizes enter */
38 #define TCP_MSS_ACCT_SIZE    70
39 #define TCP_MSS_SMALL_MAX_SIZE_DIV (TCP_MSS_ACCT_SIZE - TCP_MSS_SMALL_SIZE_OFF)
40 
41 
42 /* Magic flags to tell whats cooking on the pacing wheel */
43 #define PACE_PKT_OUTPUT 0x01	/* Output Packets being paced */
44 #define PACE_TMR_RACK   0x02	/* RACK timer running */
45 #define PACE_TMR_TLP    0x04	/* TLP timer running */
46 #define PACE_TMR_RXT    0x08	/* Retransmit timer running */
47 #define PACE_TMR_PERSIT 0x10	/* Persists timer running */
48 #define PACE_TMR_KEEP   0x20	/* Keep alive timer running */
49 #define PACE_TMR_DELACK 0x40	/* Delayed ack timer running */
50 #define PACE_TMR_MASK   (PACE_TMR_KEEP|PACE_TMR_PERSIT|PACE_TMR_RXT|PACE_TMR_TLP|PACE_TMR_RACK|PACE_TMR_DELACK)
51 
52 /* Magic flags for tracing progress events */
53 #define PROGRESS_DROP   1
54 #define PROGRESS_UPDATE 2
55 #define PROGRESS_CLEAR  3
56 #define PROGRESS_START  4
57 
58 
59 /* RTT sample methods */
60 #define USE_RTT_HIGH 0
61 #define USE_RTT_LOW  1
62 #define USE_RTT_AVG  2
63 
64 #ifdef _KERNEL
65 /* We have only 7 bits in rack so assert its true */
66 CTASSERT((PACE_TMR_MASK & 0x80) == 0);
67 #endif
68 #endif
69