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