blob: b9d0e571a5dd0120246483a9bf8ee74061c8cc1a [file] [log] [blame]
Florin Coras999840c2020-03-18 20:31:34 +00001/*
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/*
17 * Rate estimation
18 */
19
20#ifndef SRC_VNET_TCP_TCP_BT_H_
21#define SRC_VNET_TCP_TCP_BT_H_
22
23#include <vnet/tcp/tcp_types.h>
24
25/**
26 * Byte tracker initialize
27 *
28 * @param tc connection for which the byte tracker should be allocated and
29 * initialized
30 */
31void tcp_bt_init (tcp_connection_t * tc);
32/**
33 * Byte tracker cleanup
34 *
35 * @param tc connection for which the byte tracker should be cleaned up
36 */
37void tcp_bt_cleanup (tcp_connection_t * tc);
38/**
39 * Flush byte tracker samples
40 *
41 * @param tc tcp connection for which samples should be flushed
42 */
43void tcp_bt_flush_samples (tcp_connection_t * tc);
44/**
45 * Track a tcp tx burst
46 *
47 * @param tc tcp connection
48 */
49void tcp_bt_track_tx (tcp_connection_t * tc, u32 len);
50/**
51 * Track a tcp retransmission
52 *
53 * @param tc tcp connection
54 * @param start start sequence number
55 * @param end end sequence number
56 */
57void tcp_bt_track_rxt (tcp_connection_t * tc, u32 start, u32 end);
58/**
59 * Generate a delivery rate sample from recently acked bytes
60 *
61 * @param tc tcp connection
62 * @param rs resulting rate sample
63 */
64void tcp_bt_sample_delivery_rate (tcp_connection_t * tc,
65 tcp_rate_sample_t * rs);
66/**
67 * Check if sample to be generated is app limited
68 *
69 * @param tc tcp connection
70 */
71void tcp_bt_check_app_limited (tcp_connection_t * tc);
72/**
73 * Check if the byte tracker is in sane state
74 *
75 * Should be used only for testing
76 *
77 * @param bt byte tracker
78 */
79int tcp_bt_is_sane (tcp_byte_tracker_t * bt);
80
81format_function_t format_tcp_bt;
82
83#endif /* SRC_VNET_TCP_TCP_BT_H_ */
84
85/*
86 * fd.io coding-style-patch-verification: ON
87 *
88 * Local Variables:
89 * eval: (c-set-style "gnu")
90 * End:
91 */