FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
tcp_cc.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_CC_H_
17 #define SRC_VNET_TCP_TCP_CC_H_
18 
19 #include <vnet/tcp/tcp_types.h>
20 
21 always_inline void
23 {
24  tc->cc_algo->rcv_ack (tc, rs);
25  tc->tsecr_last_ack = tc->rcv_opts.tsecr;
26 }
27 
28 static inline void
30  tcp_rate_sample_t * rs)
31 {
32  tc->cc_algo->rcv_cong_ack (tc, ack_type, rs);
33 }
34 
35 static inline void
37 {
38  tc->cc_algo->congestion (tc);
39 }
40 
41 static inline void
43 {
44  tc->cc_algo->loss (tc);
45 }
46 
47 static inline void
49 {
50  tc->cc_algo->recovered (tc);
51 }
52 
53 static inline void
55 {
56  if (tc->cc_algo->undo_recovery)
57  tc->cc_algo->undo_recovery (tc);
58 }
59 
60 static inline void
62 {
63  if (tc->cc_algo->event)
64  tc->cc_algo->event (tc, evt);
65 }
66 
67 static inline u64
69 {
70  if (tc->cc_algo->get_pacing_rate)
71  return tc->cc_algo->get_pacing_rate (tc);
72 
73  f64 srtt = clib_min ((f64) tc->srtt * TCP_TICK, tc->mrtt_us);
74 
75  /* TODO should constrain to interface's max throughput but
76  * we don't have link speeds for sw ifs ..*/
77  return ((f64) tc->cwnd / srtt);
78 }
79 
80 static inline void *
82 {
83  return (void *) tc->cc_data;
84 }
85 
86 /**
87  * Register exiting cc algo type
88  */
90  const tcp_cc_algorithm_t * vft);
91 
92 /**
93  * Register new cc algo type
94  */
97 
98 
100  tcp_rate_sample_t * rs);
101 
102 
103 #endif /* SRC_VNET_TCP_TCP_CC_H_ */
104 
105 /*
106  * fd.io coding-style-patch-verification: ON
107  *
108  * Local Variables:
109  * eval: (c-set-style "gnu")
110  * End:
111  */
tcp_connection_t
struct _tcp_connection tcp_connection_t
tcp_cc_congestion
static void tcp_cc_congestion(tcp_connection_t *tc)
Definition: tcp_cc.h:36
newreno_rcv_cong_ack
void newreno_rcv_cong_ack(tcp_connection_t *tc, tcp_cc_ack_t ack_type, tcp_rate_sample_t *rs)
Definition: tcp_newreno.c:62
tcp_cc_algo_register
void tcp_cc_algo_register(tcp_cc_algorithm_type_e type, const tcp_cc_algorithm_t *vft)
Register exiting cc algo type.
Definition: tcp.c:85
tcp_cc_event
static void tcp_cc_event(tcp_connection_t *tc, tcp_cc_event_t evt)
Definition: tcp_cc.h:61
tcp_cc_recovered
static void tcp_cc_recovered(tcp_connection_t *tc)
Definition: tcp_cc.h:48
tcp_cc_algorithm_type_e
enum _tcp_cc_algorithm_type tcp_cc_algorithm_type_e
tcp_cc_get_pacing_rate
static u64 tcp_cc_get_pacing_rate(tcp_connection_t *tc)
Definition: tcp_cc.h:68
tcp_cc_rcv_ack
static void tcp_cc_rcv_ack(tcp_connection_t *tc, tcp_rate_sample_t *rs)
Definition: tcp_cc.h:22
f64
double f64
Definition: types.h:142
clib_min
#define clib_min(x, y)
Definition: clib.h:342
tcp_cc_algo_get
tcp_cc_algorithm_t * tcp_cc_algo_get(tcp_cc_algorithm_type_e type)
Definition: tcp.c:96
tcp_cc_loss
static void tcp_cc_loss(tcp_connection_t *tc)
Definition: tcp_cc.h:42
tcp_cc_data
static void * tcp_cc_data(tcp_connection_t *tc)
Definition: tcp_cc.h:81
always_inline
#define always_inline
Definition: rdma_mlx5dv.h:23
tcp_rate_sample_
Definition: tcp_types.h:221
u64
unsigned long u64
Definition: types.h:89
tcp_cc_undo_recovery
static void tcp_cc_undo_recovery(tcp_connection_t *tc)
Definition: tcp_cc.h:54
tcp_cc_algo_new_type
tcp_cc_algorithm_type_e tcp_cc_algo_new_type(const tcp_cc_algorithm_t *vft)
Register new cc algo type.
Definition: tcp.c:103
tcp_cc_rcv_cong_ack
static void tcp_cc_rcv_cong_ack(tcp_connection_t *tc, tcp_cc_ack_t ack_type, tcp_rate_sample_t *rs)
Definition: tcp_cc.h:29
tcp_cc_algorithm_t
struct _tcp_cc_algorithm tcp_cc_algorithm_t
Definition: tcp_types.h:253
tcp_cc_ack_t
enum _tcp_cc_ack_t tcp_cc_ack_t
tcp_types.h
TCP_TICK
#define TCP_TICK
TCP tick period (s)
Definition: tcp_types.h:24
tcp_cc_event_t
enum tcp_cc_event_ tcp_cc_event_t
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123