aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/ccid3.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ccids/ccid3.h')
-rw-r--r--net/dccp/ccids/ccid3.h153
1 files changed, 68 insertions, 85 deletions
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h
index 49ca32bd7e79..af6e1bf937d9 100644
--- a/net/dccp/ccids/ccid3.h
+++ b/net/dccp/ccids/ccid3.h
@@ -47,11 +47,22 @@
47/* Two seconds as per RFC 3448 4.2 */ 47/* Two seconds as per RFC 3448 4.2 */
48#define TFRC_INITIAL_TIMEOUT (2 * USEC_PER_SEC) 48#define TFRC_INITIAL_TIMEOUT (2 * USEC_PER_SEC)
49 49
50/* In usecs - half the scheduling granularity as per RFC3448 4.6 */ 50/* Maximum backoff interval t_mbi (RFC 3448, 4.3) */
51#define TFRC_OPSYS_HALF_TIME_GRAN (USEC_PER_SEC / (2 * HZ)) 51#define TFRC_T_MBI (64 * USEC_PER_SEC)
52 52
53/* Parameter t_mbi from [RFC 3448, 4.3]: backoff interval in seconds */ 53/*
54#define TFRC_T_MBI 64 54 * The t_delta parameter (RFC 3448, 4.6): delays of less than %USEC_PER_MSEC are
55 * rounded down to 0, since sk_reset_timer() here uses millisecond granularity.
56 * Hence we can use a constant t_delta = %USEC_PER_MSEC when HZ >= 500. A coarse
57 * resolution of HZ < 500 means that the error is below one timer tick (t_gran)
58 * when using the constant t_delta = t_gran / 2 = %USEC_PER_SEC / (2 * HZ).
59 */
60#if (HZ >= 500)
61# define TFRC_T_DELTA USEC_PER_MSEC
62#else
63# define TFRC_T_DELTA (USEC_PER_SEC / (2 * HZ))
64#warning Coarse CONFIG_HZ resolution -- higher value recommended for TFRC.
65#endif
55 66
56enum ccid3_options { 67enum ccid3_options {
57 TFRC_OPT_LOSS_EVENT_RATE = 192, 68 TFRC_OPT_LOSS_EVENT_RATE = 192,
@@ -59,62 +70,43 @@ enum ccid3_options {
59 TFRC_OPT_RECEIVE_RATE = 194, 70 TFRC_OPT_RECEIVE_RATE = 194,
60}; 71};
61 72
62struct ccid3_options_received {
63 u64 ccid3or_seqno:48,
64 ccid3or_loss_intervals_idx:16;
65 u16 ccid3or_loss_intervals_len;
66 u32 ccid3or_loss_event_rate;
67 u32 ccid3or_receive_rate;
68};
69
70/* TFRC sender states */
71enum ccid3_hc_tx_states {
72 TFRC_SSTATE_NO_SENT = 1,
73 TFRC_SSTATE_NO_FBACK,
74 TFRC_SSTATE_FBACK,
75 TFRC_SSTATE_TERM,
76};
77
78/** struct ccid3_hc_tx_sock - CCID3 sender half-connection socket 73/** struct ccid3_hc_tx_sock - CCID3 sender half-connection socket
79 * 74 *
80 * @ccid3hctx_x - Current sending rate in 64 * bytes per second 75 * @x - Current sending rate in 64 * bytes per second
81 * @ccid3hctx_x_recv - Receive rate in 64 * bytes per second 76 * @x_recv - Receive rate in 64 * bytes per second
82 * @ccid3hctx_x_calc - Calculated rate in bytes per second 77 * @x_calc - Calculated rate in bytes per second
83 * @ccid3hctx_rtt - Estimate of current round trip time in usecs 78 * @rtt - Estimate of current round trip time in usecs
84 * @ccid3hctx_p - Current loss event rate (0-1) scaled by 1000000 79 * @r_sqmean - Estimate of long-term RTT (RFC 3448, 4.5)
85 * @ccid3hctx_s - Packet size in bytes 80 * @p - Current loss event rate (0-1) scaled by 1000000
86 * @ccid3hctx_t_rto - Nofeedback Timer setting in usecs 81 * @s - Packet size in bytes
87 * @ccid3hctx_t_ipi - Interpacket (send) interval (RFC 3448, 4.6) in usecs 82 * @t_rto - Nofeedback Timer setting in usecs
88 * @ccid3hctx_state - Sender state, one of %ccid3_hc_tx_states 83 * @t_ipi - Interpacket (send) interval (RFC 3448, 4.6) in usecs
89 * @ccid3hctx_last_win_count - Last window counter sent 84 * @feedback - Whether feedback has been received or not
90 * @ccid3hctx_t_last_win_count - Timestamp of earliest packet 85 * @last_win_count - Last window counter sent
91 * with last_win_count value sent 86 * @t_last_win_count - Timestamp of earliest packet with
92 * @ccid3hctx_no_feedback_timer - Handle to no feedback timer 87 * last_win_count value sent
93 * @ccid3hctx_t_ld - Time last doubled during slow start 88 * @no_feedback_timer - Handle to no feedback timer
94 * @ccid3hctx_t_nom - Nominal send time of next packet 89 * @t_ld - Time last doubled during slow start
95 * @ccid3hctx_delta - Send timer delta (RFC 3448, 4.6) in usecs 90 * @t_nom - Nominal send time of next packet
96 * @ccid3hctx_hist - Packet history 91 * @hist - Packet history
97 * @ccid3hctx_options_received - Parsed set of retrieved options
98 */ 92 */
99struct ccid3_hc_tx_sock { 93struct ccid3_hc_tx_sock {
100 struct tfrc_tx_info ccid3hctx_tfrc; 94 u64 x;
101#define ccid3hctx_x ccid3hctx_tfrc.tfrctx_x 95 u64 x_recv;
102#define ccid3hctx_x_recv ccid3hctx_tfrc.tfrctx_x_recv 96 u32 x_calc;
103#define ccid3hctx_x_calc ccid3hctx_tfrc.tfrctx_x_calc 97 u32 rtt;
104#define ccid3hctx_rtt ccid3hctx_tfrc.tfrctx_rtt 98 u16 r_sqmean;
105#define ccid3hctx_p ccid3hctx_tfrc.tfrctx_p 99 u32 p;
106#define ccid3hctx_t_rto ccid3hctx_tfrc.tfrctx_rto 100 u32 t_rto;
107#define ccid3hctx_t_ipi ccid3hctx_tfrc.tfrctx_ipi 101 u32 t_ipi;
108 u16 ccid3hctx_s; 102 u16 s;
109 enum ccid3_hc_tx_states ccid3hctx_state:8; 103 bool feedback:1;
110 u8 ccid3hctx_last_win_count; 104 u8 last_win_count;
111 ktime_t ccid3hctx_t_last_win_count; 105 ktime_t t_last_win_count;
112 struct timer_list ccid3hctx_no_feedback_timer; 106 struct timer_list no_feedback_timer;
113 ktime_t ccid3hctx_t_ld; 107 ktime_t t_ld;
114 ktime_t ccid3hctx_t_nom; 108 ktime_t t_nom;
115 u32 ccid3hctx_delta; 109 struct tfrc_tx_hist_entry *hist;
116 struct tfrc_tx_hist_entry *ccid3hctx_hist;
117 struct ccid3_options_received ccid3hctx_options_received;
118}; 110};
119 111
120static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk) 112static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk)
@@ -124,41 +116,32 @@ static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk)
124 return hctx; 116 return hctx;
125} 117}
126 118
127/* TFRC receiver states */ 119
128enum ccid3_hc_rx_states { 120enum ccid3_fback_type {
129 TFRC_RSTATE_NO_DATA = 1, 121 CCID3_FBACK_NONE = 0,
130 TFRC_RSTATE_DATA, 122 CCID3_FBACK_INITIAL,
131 TFRC_RSTATE_TERM = 127, 123 CCID3_FBACK_PERIODIC,
124 CCID3_FBACK_PARAM_CHANGE
132}; 125};
133 126
134/** struct ccid3_hc_rx_sock - CCID3 receiver half-connection socket 127/** struct ccid3_hc_rx_sock - CCID3 receiver half-connection socket
135 * 128 *
136 * @ccid3hcrx_x_recv - Receiver estimate of send rate (RFC 3448 4.3) 129 * @last_counter - Tracks window counter (RFC 4342, 8.1)
137 * @ccid3hcrx_rtt - Receiver estimate of rtt (non-standard) 130 * @feedback - The type of the feedback last sent
138 * @ccid3hcrx_p - Current loss event rate (RFC 3448 5.4) 131 * @x_recv - Receiver estimate of send rate (RFC 3448, sec. 4.3)
139 * @ccid3hcrx_last_counter - Tracks window counter (RFC 4342, 8.1) 132 * @tstamp_last_feedback - Time at which last feedback was sent
140 * @ccid3hcrx_state - Receiver state, one of %ccid3_hc_rx_states 133 * @hist - Packet history (loss detection + RTT sampling)
141 * @ccid3hcrx_bytes_recv - Total sum of DCCP payload bytes 134 * @li_hist - Loss Interval database
142 * @ccid3hcrx_x_recv - Receiver estimate of send rate (RFC 3448, sec. 4.3) 135 * @p_inverse - Inverse of Loss Event Rate (RFC 4342, sec. 8.5)
143 * @ccid3hcrx_rtt - Receiver estimate of RTT
144 * @ccid3hcrx_tstamp_last_feedback - Time at which last feedback was sent
145 * @ccid3hcrx_tstamp_last_ack - Time at which last feedback was sent
146 * @ccid3hcrx_hist - Packet history (loss detection + RTT sampling)
147 * @ccid3hcrx_li_hist - Loss Interval database
148 * @ccid3hcrx_s - Received packet size in bytes
149 * @ccid3hcrx_pinv - Inverse of Loss Event Rate (RFC 4342, sec. 8.5)
150 */ 136 */
151struct ccid3_hc_rx_sock { 137struct ccid3_hc_rx_sock {
152 u8 ccid3hcrx_last_counter:4; 138 u8 last_counter:4;
153 enum ccid3_hc_rx_states ccid3hcrx_state:8; 139 enum ccid3_fback_type feedback:4;
154 u32 ccid3hcrx_bytes_recv; 140 u32 x_recv;
155 u32 ccid3hcrx_x_recv; 141 ktime_t tstamp_last_feedback;
156 u32 ccid3hcrx_rtt; 142 struct tfrc_rx_hist hist;
157 ktime_t ccid3hcrx_tstamp_last_feedback; 143 struct tfrc_loss_hist li_hist;
158 struct tfrc_rx_hist ccid3hcrx_hist; 144#define p_inverse li_hist.i_mean
159 struct tfrc_loss_hist ccid3hcrx_li_hist;
160 u16 ccid3hcrx_s;
161#define ccid3hcrx_pinv ccid3hcrx_li_hist.i_mean
162}; 145};
163 146
164static inline struct ccid3_hc_rx_sock *ccid3_hc_rx_sk(const struct sock *sk) 147static inline struct ccid3_hc_rx_sock *ccid3_hc_rx_sk(const struct sock *sk)