FD.io VPP  v21.10.1-2-g0a485f517
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 {
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  */
TCP_INVALID_SACK_HOLE_INDEX
#define TCP_INVALID_SACK_HOLE_INDEX
Definition: tcp_types.h:151
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
scoreboard_hole_bytes
static u32 scoreboard_hole_bytes(sack_scoreboard_hole_t *hole)
Definition: tcp_sack.h:29
scoreboard_get_hole
static sack_scoreboard_hole_t * scoreboard_get_hole(sack_scoreboard_t *sb, u32 index)
Definition: tcp_sack.h:35
tcp_connection_t
struct _tcp_connection tcp_connection_t
tcp_rcv_sacks
void tcp_rcv_sacks(tcp_connection_t *tc, u32 ack)
Definition: tcp_sack.c:326
tcp_scoreboard_replay
u8 * tcp_scoreboard_replay(u8 *s, tcp_connection_t *tc, u8 verbose)
Definition: tcp_cli.c:687
scoreboard_init
void scoreboard_init(sack_scoreboard_t *sb)
Definition: tcp_sack.c:268
scoreboard_clear
void scoreboard_clear(sack_scoreboard_t *sb)
Definition: tcp_sack.c:277
pool_is_free_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:302
scoreboard_hole_index
static u32 scoreboard_hole_index(sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
Definition: tcp_sack.h:22
tcp_sack_list_bytes
u32 tcp_sack_list_bytes(tcp_connection_t *tc)
Definition: tcp_sack.c:617
sack_scoreboard_t
struct _sack_scoreboard sack_scoreboard_t
end
f64 end
end of the time range
Definition: mactime.api:44
scoreboard_last_hole
static sack_scoreboard_hole_t * scoreboard_last_hole(sack_scoreboard_t *sb)
Definition: tcp_sack.h:67
scoreboard_next_rxt_hole
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:194
scoreboard_next_hole
static sack_scoreboard_hole_t * scoreboard_next_hole(sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
Definition: tcp_sack.h:43
scoreboard_clear_reneging
void scoreboard_clear_reneging(sack_scoreboard_t *sb, u32 start, u32 end)
Definition: tcp_sack.c:297
format_function_t
u8 *() format_function_t(u8 *s, va_list *args)
Definition: format.h:48
index
u32 index
Definition: flow_types.api:221
always_inline
#define always_inline
Definition: rdma_mlx5dv.h:23
sack_scoreboard_hole_t
struct _sack_scoreboard_hole sack_scoreboard_hole_t
scoreboard_init_rxt
void scoreboard_init_rxt(sack_scoreboard_t *sb, u32 snd_una)
Definition: tcp_sack.c:254
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
u32
unsigned int u32
Definition: types.h:88
tcp_scoreboard_is_sane_post_recovery
u8 tcp_scoreboard_is_sane_post_recovery(tcp_connection_t *tc)
Test that scoreboard is sane after recovery.
Definition: tcp_sack.c:317
u8
unsigned char u8
Definition: types.h:56
scoreboard_first_hole
static sack_scoreboard_hole_t * scoreboard_first_hole(sack_scoreboard_t *sb)
Definition: tcp_sack.h:59
tcp_update_sack_list
void tcp_update_sack_list(tcp_connection_t *tc, u32 start, u32 end)
Build SACK list as per RFC2018.
Definition: tcp_sack.c:568
tcp_types.h
format_tcp_scoreboard
format_function_t format_tcp_scoreboard
Definition: tcp_sack.h:109
scoreboard_prev_hole
static sack_scoreboard_hole_t * scoreboard_prev_hole(sack_scoreboard_t *sb, sack_scoreboard_hole_t *hole)
Definition: tcp_sack.h:51