Watt-32 tcp/ip  2.2 dev-rel.10
tcp_scor.h
Go to the documentation of this file.
1 
5 /*
6  * Copyright (c) 1997, Pittsburgh Supercomputing Center,
7  * Jamshid Mahdavi, Matt Mathis, Jeffrey Semke
8  * All rights reserved.
9  *
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.
15  *
16  * This is experimental software under active development and may
17  * potentially contain bugs. Use at your own risk.
18  *
19  */
20 
21 #ifndef __NETINET_TCP_SCOREBOARD_H
22 #define __NETINET_TCP_SCOREBOARD_H
23 
24 /**********************************************************************
25  *
26  * Scoreboard module headers:
27  *
28  **********************************************************************/
29 
30 /* Initialize the scoreboard
31  */
32 #define scrb_init(tp) { LIST_INIT(&((tp)->scrb.head)); \
33  (tp)->scrb.last_ack=(tp)->snd_una; \
34  (tp)->snd_retran_data = 0; }
35 
36 /*
37  * Check to see if the scoreboard is empty
38  * scrb_isempty(struct tcpcp *tp)
39  */
40 #define scrb_isempty(tp) (! ((tp)->scrb.scrb_head))
41 
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.
52  *
53  * scrb_getnextretran(struct tcpcp *tp, tcp_seq *start, tcp_seq *end)
54  */
55 
56 #define scrb_getnextretran(tp,start,end) \
57  (scrb_isempty(tp) ? \
58  (int)((tcp_seq*)*start = (tcp_seq*)*end = \
59  (tcp_seq*)0) \
60  : scrb_getnextretran_func(tp,start,end))
61 
62 
63 /* sender side -- tracks packets sent that WERE selectively acknowledged
64  * by the other end.
65  * Each sb_entry represents a hole (missing data) followed by
66  * consecutive received data.
67  */
68 struct scrb_entry {
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
73  retransmitted */
74  tcp_seq snd_max; /* Value of snd_max at the time of
75  retransmission */
76  int sack_cnt; /* FACK ONLY: Number of reports for
77  this hole */
78 };
79 
80 #define scrb_next ptrs.le_next /* next element */
81 #define scrb_prev ptrs.le_prev /* previous element */
82 
83 
84 /* sender side -- tracks packets sent that were selectively
85  * acknowledged by the other end
86  */
87 struct scoreboard {
88  tcp_seq last_ack; /* This value replicates snd_una,
89  but is needed for internal
90  scoreboard state. */
91  LIST_HEAD(scrb_head_internal, scrb_entry) head; /* Scoreboard list */
92 };
93 
94 #define scrb_head head.lh_first /* first element of scoreboard */
95 
96 /* return codes from routines that might have to clear the scoreboard
97  */
98 #define E_SCRB_CLEAR -1
99 #define E_SCRB_NOERR 0
100 
101 /* reason parameters for scrb_clear
102  */
103 #define SCRB_INIT 0
104 #define SCRB_RENEGE 1
105 #define SCRB_NOMEM 2
106 #define SCRB_TIMEOUT 3
107 
108 #endif /* __NETINET_TCP_SCOREBOARD_H */
Definition: tcp_scor.h:68