FD.io VPP  v20.05-21-gb1500e9ff
Vector Packet Processing
tcp_sack.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SRC_VNET_TCP_TCP_SACK_H_
17 #define SRC_VNET_TCP_TCP_SACK_H_
18 
19 #include <vnet/tcp/tcp_types.h>
20 
23 {
24  ASSERT (!pool_is_free_index (sb->holes, hole - sb->holes));
25  return hole - sb->holes;
26 }
27 
30 {
31  return hole->end - hole->start;
32 }
33 
36 {
37  if (index != TCP_INVALID_SACK_HOLE_INDEX)
38  return pool_elt_at_index (sb->holes, index);
39  return 0;
40 }
41 
44 {
45  if (hole->next != TCP_INVALID_SACK_HOLE_INDEX)
46  return pool_elt_at_index (sb->holes, hole->next);
47  return 0;
48 }
49 
52 {
53  if (hole->prev != TCP_INVALID_SACK_HOLE_INDEX)
54  return pool_elt_at_index (sb->holes, hole->prev);
55  return 0;
56 }
57 
60 {
61  if (sb->head != TCP_INVALID_SACK_HOLE_INDEX)
62  return pool_elt_at_index (sb->holes, sb->head);
63  return 0;
64 }
65 
68 {
69  if (sb->tail != TCP_INVALID_SACK_HOLE_INDEX)
70  return pool_elt_at_index (sb->holes, sb->tail);
71  return 0;
72 }
73 
74 #if TCP_SCOREBOARD_TRACE
75 #define tcp_scoreboard_trace_add(_tc, _ack) \
76 { \
77  static u64 _group = 0; \
78  sack_scoreboard_t *_sb = &_tc->sack_sb; \
79  sack_block_t *_sack, *_sacks; \
80  scoreboard_trace_elt_t *_elt; \
81  int i; \
82  _group++; \
83  _sacks = _tc->rcv_opts.sacks; \
84  for (i = 0; i < vec_len (_sacks); i++) \
85  { \
86  _sack = &_sacks[i]; \
87  vec_add2 (_sb->trace, _elt, 1); \
88  _elt->start = _sack->start; \
89  _elt->end = _sack->end; \
90  _elt->ack = _elt->end == _ack ? _ack : 0; \
91  _elt->snd_una_max = _elt->end == _ack ? _tc->snd_una_max : 0; \
92  _elt->group = _group; \
93  } \
94 }
95 #else
96 #define tcp_scoreboard_trace_add(_tc, _ack)
97 #endif
98 
101  start, u8 have_sent_1_smss,
102  u8 * can_rescue,
103  u8 * snd_limited);
107 void scoreboard_init_rxt (sack_scoreboard_t * sb, u32 snd_una);
108 
110 
111 /* Made public for unit testing only */
112 void tcp_update_sack_list (tcp_connection_t * tc, u32 start, u32 end);
114 void tcp_rcv_sacks (tcp_connection_t * tc, u32 ack);
115 u8 *tcp_scoreboard_replay (u8 * s, tcp_connection_t * tc, u8 verbose);
117 
118 #endif /* SRC_VNET_TCP_TCP_SACK_H_ */
119 
120 /*
121  * fd.io coding-style-patch-verification: ON
122  *
123  * Local Variables:
124  * eval: (c-set-style "gnu")
125  * End:
126  */
void tcp_update_sack_list(tcp_connection_t *tc, u32 start, u32 end)
Build SACK list as per RFC2018.
Definition: tcp_sack.c:544
static u32 scoreboard_hole_bytes(sack_scoreboard_hole_t *hole)
Definition: tcp_sack.h:29
#define TCP_INVALID_SACK_HOLE_INDEX
Definition: tcp_types.h:151
static sack_scoreboard_hole_t * scoreboard_get_hole(sack_scoreboard_t *sb, u32 index)
Definition: tcp_sack.h:35
struct _tcp_connection tcp_connection_t
u8 tcp_scoreboard_is_sane_post_recovery(tcp_connection_t *tc)
Test that scoreboard is sane after recovery.
Definition: tcp_sack.c:296
struct _sack_scoreboard sack_scoreboard_t
unsigned char u8
Definition: types.h:56
format_function_t format_tcp_scoreboard
Definition: tcp_sack.h:109
u8 *() format_function_t(u8 *s, va_list *args)
Definition: format.h:48
unsigned int u32
Definition: types.h:88
static sack_scoreboard_hole_t * scoreboard_first_hole(sack_scoreboard_t *sb)
Definition: tcp_sack.h:59
static sack_scoreboard_hole_t * scoreboard_prev_hole(sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
Definition: tcp_sack.h:51
static sack_scoreboard_hole_t * scoreboard_next_hole(sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
Definition: tcp_sack.h:43
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:534
#define always_inline
Definition: ipsec.h:28
sack_scoreboard_hole_t * scoreboard_next_rxt_hole(sack_scoreboard_t *sb, sack_scoreboard_hole_t *start, u8 have_sent_1_smss, u8 *can_rescue, u8 *snd_limited)
Figure out the next hole to retransmit.
Definition: tcp_sack.c:175
static u32 scoreboard_hole_index(sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
Definition: tcp_sack.h:22
void scoreboard_clear(sack_scoreboard_t *sb)
Definition: tcp_sack.c:257
static sack_scoreboard_hole_t * scoreboard_last_hole(sack_scoreboard_t *sb)
Definition: tcp_sack.h:67
void tcp_rcv_sacks(tcp_connection_t *tc, u32 ack)
Definition: tcp_sack.c:305
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:299
void scoreboard_init_rxt(sack_scoreboard_t *sb, u32 snd_una)
Definition: tcp_sack.c:235
#define ASSERT(truth)
u8 * tcp_scoreboard_replay(u8 *s, tcp_connection_t *tc, u8 verbose)
Definition: tcp_cli.c:685
struct _sack_scoreboard_hole sack_scoreboard_hole_t
void scoreboard_clear_reneging(sack_scoreboard_t *sb, u32 start, u32 end)
Definition: tcp_sack.c:276
void scoreboard_init(sack_scoreboard_t *sb)
Definition: tcp_sack.c:249
u32 tcp_sack_list_bytes(tcp_connection_t *tc)
Definition: tcp_sack.c:593
f64 end
end of the time range
Definition: mactime.api:44