1 /*!\file netinet/tcp_scor.h
2 * TCP scoreboard definitions (SACK).
6 * Copyright (c) 1997, Pittsburgh Supercomputing Center,
7 * Jamshid Mahdavi, Matt Mathis, Jeffrey Semke
10 * Permission to use, copy, modify, and distribute this software and
11 * its documentation for any purpose and without fee is hereby granted,
12 * provided that the above copyright notice appear in all copies and
13 * that both that copyright notice and this permission notice appear
14 * in supporting documentation.
16 * This is experimental software under active development and may
17 * potentially contain bugs. Use at your own risk.
21 #ifndef __NETINET_TCP_SCOREBOARD_H
22 #define __NETINET_TCP_SCOREBOARD_H
24 /**********************************************************************
26 * Scoreboard module headers:
28 **********************************************************************/
30 /* Initialize the scoreboard
32 #define scrb_init(tp) { LIST_INIT(&((tp)->scrb.head)); \
33 (tp)->scrb.last_ack=(tp)->snd_una; \
34 (tp)->snd_retran_data = 0; }
37 * Check to see if the scoreboard is empty
38 * scrb_isempty(struct tcpcp *tp)
40 #define scrb_isempty(tp) (! ((tp)->scrb.scrb_head))
42 /* This macro quickly takes care of the common case of an empty
43 * scoreboard. Otherwise it called scrb_getnextretran_func to hunt
44 * through the scoreboard and return the next block of data to be
45 * retransmitted. The start and end of the block are filled in to
46 * start_ptr and end_ptr, and the length of the block is returned. A
47 * zero return value indicates that there is no data to be
48 * retransmitted at this time. Note that end_ptr actually points to
49 * the first byte of data which is NOT to be retransmitted (or the
50 * first byte following the data to be retransmitted) similar in
51 * fashion to the rest of this code.
53 * scrb_getnextretran(struct tcpcp *tp, tcp_seq *start, tcp_seq *end)
56 #define scrb_getnextretran(tp,start,end) \
58 (int)((tcp_seq*)*start = (tcp_seq*)*end = \
60 : scrb_getnextretran_func(tp,start,end))
63 /* sender side -- tracks packets sent that WERE selectively acknowledged
65 * Each sb_entry represents a hole (missing data) followed by
66 * consecutive received data.
69 LIST_ENTRY(scrb_entry) ptrs; /* Next/Prev structure pointers */
70 tcp_seq start; /* Start of received data block */
71 tcp_seq end; /* End of received data block */
72 tcp_seq retran; /* End of subsequent data
74 tcp_seq snd_max; /* Value of snd_max at the time of
76 int sack_cnt; /* FACK ONLY: Number of reports for
80 #define scrb_next ptrs.le_next /* next element */
81 #define scrb_prev ptrs.le_prev /* previous element */
84 /* sender side -- tracks packets sent that were selectively
85 * acknowledged by the other end
88 tcp_seq last_ack; /* This value replicates snd_una,
89 but is needed for internal
91 LIST_HEAD(scrb_head_internal, scrb_entry) head; /* Scoreboard list */
94 #define scrb_head head.lh_first /* first element of scoreboard */
96 /* return codes from routines that might have to clear the scoreboard
98 #define E_SCRB_CLEAR -1
99 #define E_SCRB_NOERR 0
101 /* reason parameters for scrb_clear
104 #define SCRB_RENEGE 1
106 #define SCRB_TIMEOUT 3
108 #endif /* __NETINET_TCP_SCOREBOARD_H */