diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-09-09 07:27:22 -0400 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-09-09 07:27:22 -0400 |
commit | 410e27a49bb98bc7fa3ff5fc05cc313817b9f253 (patch) | |
tree | 88bb1fcf84f9ebfa4299c9a8dcd9e6330b358446 /net/dccp/ccids/ccid3.h | |
parent | 0a68a20cc3eafa73bb54097c28b921147d7d3685 (diff) |
This reverts "Merge branch 'dccp' of git://eden-feed.erg.abdn.ac.uk/dccp_exp"
as it accentally contained the wrong set of patches. These will be
submitted separately.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/ccids/ccid3.h')
-rw-r--r-- | net/dccp/ccids/ccid3.h | 153 |
1 files changed, 85 insertions, 68 deletions
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h index af6e1bf937d9..49ca32bd7e79 100644 --- a/net/dccp/ccids/ccid3.h +++ b/net/dccp/ccids/ccid3.h | |||
@@ -47,22 +47,11 @@ | |||
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 | /* Maximum backoff interval t_mbi (RFC 3448, 4.3) */ | 50 | /* In usecs - half the scheduling granularity as per RFC3448 4.6 */ |
51 | #define TFRC_T_MBI (64 * USEC_PER_SEC) | 51 | #define TFRC_OPSYS_HALF_TIME_GRAN (USEC_PER_SEC / (2 * HZ)) |
52 | 52 | ||
53 | /* | 53 | /* Parameter t_mbi from [RFC 3448, 4.3]: backoff interval in seconds */ |
54 | * The t_delta parameter (RFC 3448, 4.6): delays of less than %USEC_PER_MSEC are | 54 | #define TFRC_T_MBI 64 |
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 | ||
66 | 55 | ||
67 | enum ccid3_options { | 56 | enum ccid3_options { |
68 | TFRC_OPT_LOSS_EVENT_RATE = 192, | 57 | TFRC_OPT_LOSS_EVENT_RATE = 192, |
@@ -70,43 +59,62 @@ enum ccid3_options { | |||
70 | TFRC_OPT_RECEIVE_RATE = 194, | 59 | TFRC_OPT_RECEIVE_RATE = 194, |
71 | }; | 60 | }; |
72 | 61 | ||
62 | struct 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 */ | ||
71 | enum 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 | |||
73 | /** struct ccid3_hc_tx_sock - CCID3 sender half-connection socket | 78 | /** struct ccid3_hc_tx_sock - CCID3 sender half-connection socket |
74 | * | 79 | * |
75 | * @x - Current sending rate in 64 * bytes per second | 80 | * @ccid3hctx_x - Current sending rate in 64 * bytes per second |
76 | * @x_recv - Receive rate in 64 * bytes per second | 81 | * @ccid3hctx_x_recv - Receive rate in 64 * bytes per second |
77 | * @x_calc - Calculated rate in bytes per second | 82 | * @ccid3hctx_x_calc - Calculated rate in bytes per second |
78 | * @rtt - Estimate of current round trip time in usecs | 83 | * @ccid3hctx_rtt - Estimate of current round trip time in usecs |
79 | * @r_sqmean - Estimate of long-term RTT (RFC 3448, 4.5) | 84 | * @ccid3hctx_p - Current loss event rate (0-1) scaled by 1000000 |
80 | * @p - Current loss event rate (0-1) scaled by 1000000 | 85 | * @ccid3hctx_s - Packet size in bytes |
81 | * @s - Packet size in bytes | 86 | * @ccid3hctx_t_rto - Nofeedback Timer setting in usecs |
82 | * @t_rto - Nofeedback Timer setting in usecs | 87 | * @ccid3hctx_t_ipi - Interpacket (send) interval (RFC 3448, 4.6) in usecs |
83 | * @t_ipi - Interpacket (send) interval (RFC 3448, 4.6) in usecs | 88 | * @ccid3hctx_state - Sender state, one of %ccid3_hc_tx_states |
84 | * @feedback - Whether feedback has been received or not | 89 | * @ccid3hctx_last_win_count - Last window counter sent |
85 | * @last_win_count - Last window counter sent | 90 | * @ccid3hctx_t_last_win_count - Timestamp of earliest packet |
86 | * @t_last_win_count - Timestamp of earliest packet with | 91 | * with last_win_count value sent |
87 | * last_win_count value sent | 92 | * @ccid3hctx_no_feedback_timer - Handle to no feedback timer |
88 | * @no_feedback_timer - Handle to no feedback timer | 93 | * @ccid3hctx_t_ld - Time last doubled during slow start |
89 | * @t_ld - Time last doubled during slow start | 94 | * @ccid3hctx_t_nom - Nominal send time of next packet |
90 | * @t_nom - Nominal send time of next packet | 95 | * @ccid3hctx_delta - Send timer delta (RFC 3448, 4.6) in usecs |
91 | * @hist - Packet history | 96 | * @ccid3hctx_hist - Packet history |
97 | * @ccid3hctx_options_received - Parsed set of retrieved options | ||
92 | */ | 98 | */ |
93 | struct ccid3_hc_tx_sock { | 99 | struct ccid3_hc_tx_sock { |
94 | u64 x; | 100 | struct tfrc_tx_info ccid3hctx_tfrc; |
95 | u64 x_recv; | 101 | #define ccid3hctx_x ccid3hctx_tfrc.tfrctx_x |
96 | u32 x_calc; | 102 | #define ccid3hctx_x_recv ccid3hctx_tfrc.tfrctx_x_recv |
97 | u32 rtt; | 103 | #define ccid3hctx_x_calc ccid3hctx_tfrc.tfrctx_x_calc |
98 | u16 r_sqmean; | 104 | #define ccid3hctx_rtt ccid3hctx_tfrc.tfrctx_rtt |
99 | u32 p; | 105 | #define ccid3hctx_p ccid3hctx_tfrc.tfrctx_p |
100 | u32 t_rto; | 106 | #define ccid3hctx_t_rto ccid3hctx_tfrc.tfrctx_rto |
101 | u32 t_ipi; | 107 | #define ccid3hctx_t_ipi ccid3hctx_tfrc.tfrctx_ipi |
102 | u16 s; | 108 | u16 ccid3hctx_s; |
103 | bool feedback:1; | 109 | enum ccid3_hc_tx_states ccid3hctx_state:8; |
104 | u8 last_win_count; | 110 | u8 ccid3hctx_last_win_count; |
105 | ktime_t t_last_win_count; | 111 | ktime_t ccid3hctx_t_last_win_count; |
106 | struct timer_list no_feedback_timer; | 112 | struct timer_list ccid3hctx_no_feedback_timer; |
107 | ktime_t t_ld; | 113 | ktime_t ccid3hctx_t_ld; |
108 | ktime_t t_nom; | 114 | ktime_t ccid3hctx_t_nom; |
109 | struct tfrc_tx_hist_entry *hist; | 115 | u32 ccid3hctx_delta; |
116 | struct tfrc_tx_hist_entry *ccid3hctx_hist; | ||
117 | struct ccid3_options_received ccid3hctx_options_received; | ||
110 | }; | 118 | }; |
111 | 119 | ||
112 | static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk) | 120 | static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk) |
@@ -116,32 +124,41 @@ static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk) | |||
116 | return hctx; | 124 | return hctx; |
117 | } | 125 | } |
118 | 126 | ||
119 | 127 | /* TFRC receiver states */ | |
120 | enum ccid3_fback_type { | 128 | enum ccid3_hc_rx_states { |
121 | CCID3_FBACK_NONE = 0, | 129 | TFRC_RSTATE_NO_DATA = 1, |
122 | CCID3_FBACK_INITIAL, | 130 | TFRC_RSTATE_DATA, |
123 | CCID3_FBACK_PERIODIC, | 131 | TFRC_RSTATE_TERM = 127, |
124 | CCID3_FBACK_PARAM_CHANGE | ||
125 | }; | 132 | }; |
126 | 133 | ||
127 | /** struct ccid3_hc_rx_sock - CCID3 receiver half-connection socket | 134 | /** struct ccid3_hc_rx_sock - CCID3 receiver half-connection socket |
128 | * | 135 | * |
129 | * @last_counter - Tracks window counter (RFC 4342, 8.1) | 136 | * @ccid3hcrx_x_recv - Receiver estimate of send rate (RFC 3448 4.3) |
130 | * @feedback - The type of the feedback last sent | 137 | * @ccid3hcrx_rtt - Receiver estimate of rtt (non-standard) |
131 | * @x_recv - Receiver estimate of send rate (RFC 3448, sec. 4.3) | 138 | * @ccid3hcrx_p - Current loss event rate (RFC 3448 5.4) |
132 | * @tstamp_last_feedback - Time at which last feedback was sent | 139 | * @ccid3hcrx_last_counter - Tracks window counter (RFC 4342, 8.1) |
133 | * @hist - Packet history (loss detection + RTT sampling) | 140 | * @ccid3hcrx_state - Receiver state, one of %ccid3_hc_rx_states |
134 | * @li_hist - Loss Interval database | 141 | * @ccid3hcrx_bytes_recv - Total sum of DCCP payload bytes |
135 | * @p_inverse - Inverse of Loss Event Rate (RFC 4342, sec. 8.5) | 142 | * @ccid3hcrx_x_recv - Receiver estimate of send rate (RFC 3448, sec. 4.3) |
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) | ||
136 | */ | 150 | */ |
137 | struct ccid3_hc_rx_sock { | 151 | struct ccid3_hc_rx_sock { |
138 | u8 last_counter:4; | 152 | u8 ccid3hcrx_last_counter:4; |
139 | enum ccid3_fback_type feedback:4; | 153 | enum ccid3_hc_rx_states ccid3hcrx_state:8; |
140 | u32 x_recv; | 154 | u32 ccid3hcrx_bytes_recv; |
141 | ktime_t tstamp_last_feedback; | 155 | u32 ccid3hcrx_x_recv; |
142 | struct tfrc_rx_hist hist; | 156 | u32 ccid3hcrx_rtt; |
143 | struct tfrc_loss_hist li_hist; | 157 | ktime_t ccid3hcrx_tstamp_last_feedback; |
144 | #define p_inverse li_hist.i_mean | 158 | struct tfrc_rx_hist ccid3hcrx_hist; |
159 | struct tfrc_loss_hist ccid3hcrx_li_hist; | ||
160 | u16 ccid3hcrx_s; | ||
161 | #define ccid3hcrx_pinv ccid3hcrx_li_hist.i_mean | ||
145 | }; | 162 | }; |
146 | 163 | ||
147 | static inline struct ccid3_hc_rx_sock *ccid3_hc_rx_sk(const struct sock *sk) | 164 | static inline struct ccid3_hc_rx_sock *ccid3_hc_rx_sk(const struct sock *sk) |