diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-21 22:34:08 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-21 22:34:08 -0400 |
commit | a3536c839f04682ed06c84a7f75968c27c6108c8 (patch) | |
tree | 92c26ea74c0ffb9b83a2285ad2539cc271b09856 /net/dccp/ccids | |
parent | a33a1982012e9070736e3717231714dc9892303b (diff) | |
parent | efb0372bbaf5b829ff8c39db372779928af542a7 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'net/dccp/ccids')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 56 | ||||
-rw-r--r-- | net/dccp/ccids/ccid3.h | 23 |
2 files changed, 69 insertions, 10 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 38aa84986118..aa68e0ab274d 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -1120,6 +1120,60 @@ static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info) | |||
1120 | info->tcpi_rtt = hctx->ccid3hctx_rtt; | 1120 | info->tcpi_rtt = hctx->ccid3hctx_rtt; |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len, | ||
1124 | u32 __user *optval, int __user *optlen) | ||
1125 | { | ||
1126 | const struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); | ||
1127 | const void *val; | ||
1128 | |||
1129 | /* Listen socks doesn't have a private CCID block */ | ||
1130 | if (sk->sk_state == DCCP_LISTEN) | ||
1131 | return -EINVAL; | ||
1132 | |||
1133 | switch (optname) { | ||
1134 | case DCCP_SOCKOPT_CCID_RX_INFO: | ||
1135 | if (len < sizeof(hcrx->ccid3hcrx_tfrc)) | ||
1136 | return -EINVAL; | ||
1137 | len = sizeof(hcrx->ccid3hcrx_tfrc); | ||
1138 | val = &hcrx->ccid3hcrx_tfrc; | ||
1139 | break; | ||
1140 | default: | ||
1141 | return -ENOPROTOOPT; | ||
1142 | } | ||
1143 | |||
1144 | if (put_user(len, optlen) || copy_to_user(optval, val, len)) | ||
1145 | return -EFAULT; | ||
1146 | |||
1147 | return 0; | ||
1148 | } | ||
1149 | |||
1150 | static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len, | ||
1151 | u32 __user *optval, int __user *optlen) | ||
1152 | { | ||
1153 | const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); | ||
1154 | const void *val; | ||
1155 | |||
1156 | /* Listen socks doesn't have a private CCID block */ | ||
1157 | if (sk->sk_state == DCCP_LISTEN) | ||
1158 | return -EINVAL; | ||
1159 | |||
1160 | switch (optname) { | ||
1161 | case DCCP_SOCKOPT_CCID_TX_INFO: | ||
1162 | if (len < sizeof(hctx->ccid3hctx_tfrc)) | ||
1163 | return -EINVAL; | ||
1164 | len = sizeof(hctx->ccid3hctx_tfrc); | ||
1165 | val = &hctx->ccid3hctx_tfrc; | ||
1166 | break; | ||
1167 | default: | ||
1168 | return -ENOPROTOOPT; | ||
1169 | } | ||
1170 | |||
1171 | if (put_user(len, optlen) || copy_to_user(optval, val, len)) | ||
1172 | return -EFAULT; | ||
1173 | |||
1174 | return 0; | ||
1175 | } | ||
1176 | |||
1123 | static struct ccid ccid3 = { | 1177 | static struct ccid ccid3 = { |
1124 | .ccid_id = 3, | 1178 | .ccid_id = 3, |
1125 | .ccid_name = "ccid3", | 1179 | .ccid_name = "ccid3", |
@@ -1139,6 +1193,8 @@ static struct ccid ccid3 = { | |||
1139 | .ccid_hc_rx_packet_recv = ccid3_hc_rx_packet_recv, | 1193 | .ccid_hc_rx_packet_recv = ccid3_hc_rx_packet_recv, |
1140 | .ccid_hc_rx_get_info = ccid3_hc_rx_get_info, | 1194 | .ccid_hc_rx_get_info = ccid3_hc_rx_get_info, |
1141 | .ccid_hc_tx_get_info = ccid3_hc_tx_get_info, | 1195 | .ccid_hc_tx_get_info = ccid3_hc_tx_get_info, |
1196 | .ccid_hc_rx_getsockopt = ccid3_hc_rx_getsockopt, | ||
1197 | .ccid_hc_tx_getsockopt = ccid3_hc_tx_getsockopt, | ||
1142 | }; | 1198 | }; |
1143 | 1199 | ||
1144 | module_param(ccid3_debug, int, 0444); | 1200 | module_param(ccid3_debug, int, 0444); |
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h index eb248778eea3..0bde4583d091 100644 --- a/net/dccp/ccids/ccid3.h +++ b/net/dccp/ccids/ccid3.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/list.h> | 40 | #include <linux/list.h> |
41 | #include <linux/time.h> | 41 | #include <linux/time.h> |
42 | #include <linux/types.h> | 42 | #include <linux/types.h> |
43 | #include <linux/tfrc.h> | ||
43 | 44 | ||
44 | #define TFRC_MIN_PACKET_SIZE 16 | 45 | #define TFRC_MIN_PACKET_SIZE 16 |
45 | #define TFRC_STD_PACKET_SIZE 256 | 46 | #define TFRC_STD_PACKET_SIZE 256 |
@@ -93,12 +94,15 @@ struct ccid3_options_received { | |||
93 | * @ccid3hctx_hist - Packet history | 94 | * @ccid3hctx_hist - Packet history |
94 | */ | 95 | */ |
95 | struct ccid3_hc_tx_sock { | 96 | struct ccid3_hc_tx_sock { |
96 | u32 ccid3hctx_x; | 97 | struct tfrc_tx_info ccid3hctx_tfrc; |
97 | u32 ccid3hctx_x_recv; | 98 | #define ccid3hctx_x ccid3hctx_tfrc.tfrctx_x |
98 | u32 ccid3hctx_x_calc; | 99 | #define ccid3hctx_x_recv ccid3hctx_tfrc.tfrctx_x_recv |
100 | #define ccid3hctx_x_calc ccid3hctx_tfrc.tfrctx_x_calc | ||
101 | #define ccid3hctx_rtt ccid3hctx_tfrc.tfrctx_rtt | ||
102 | #define ccid3hctx_p ccid3hctx_tfrc.tfrctx_p | ||
103 | #define ccid3hctx_t_rto ccid3hctx_tfrc.tfrctx_rto | ||
104 | #define ccid3hctx_t_ipi ccid3hctx_tfrc.tfrctx_ipi | ||
99 | u16 ccid3hctx_s; | 105 | u16 ccid3hctx_s; |
100 | u32 ccid3hctx_rtt; | ||
101 | u32 ccid3hctx_p; | ||
102 | u8 ccid3hctx_state; | 106 | u8 ccid3hctx_state; |
103 | u8 ccid3hctx_last_win_count; | 107 | u8 ccid3hctx_last_win_count; |
104 | u8 ccid3hctx_idle; | 108 | u8 ccid3hctx_idle; |
@@ -106,19 +110,19 @@ struct ccid3_hc_tx_sock { | |||
106 | struct timer_list ccid3hctx_no_feedback_timer; | 110 | struct timer_list ccid3hctx_no_feedback_timer; |
107 | struct timeval ccid3hctx_t_ld; | 111 | struct timeval ccid3hctx_t_ld; |
108 | struct timeval ccid3hctx_t_nom; | 112 | struct timeval ccid3hctx_t_nom; |
109 | u32 ccid3hctx_t_rto; | ||
110 | u32 ccid3hctx_t_ipi; | ||
111 | u32 ccid3hctx_delta; | 113 | u32 ccid3hctx_delta; |
112 | struct list_head ccid3hctx_hist; | 114 | struct list_head ccid3hctx_hist; |
113 | struct ccid3_options_received ccid3hctx_options_received; | 115 | struct ccid3_options_received ccid3hctx_options_received; |
114 | }; | 116 | }; |
115 | 117 | ||
116 | struct ccid3_hc_rx_sock { | 118 | struct ccid3_hc_rx_sock { |
119 | struct tfrc_rx_info ccid3hcrx_tfrc; | ||
120 | #define ccid3hcrx_x_recv ccid3hcrx_tfrc.tfrcrx_x_recv | ||
121 | #define ccid3hcrx_rtt ccid3hcrx_tfrc.tfrcrx_rtt | ||
122 | #define ccid3hcrx_p ccid3hcrx_tfrc.tfrcrx_p | ||
117 | u64 ccid3hcrx_seqno_last_counter:48, | 123 | u64 ccid3hcrx_seqno_last_counter:48, |
118 | ccid3hcrx_state:8, | 124 | ccid3hcrx_state:8, |
119 | ccid3hcrx_last_counter:4; | 125 | ccid3hcrx_last_counter:4; |
120 | u32 ccid3hcrx_rtt; | ||
121 | u32 ccid3hcrx_p; | ||
122 | u32 ccid3hcrx_bytes_recv; | 126 | u32 ccid3hcrx_bytes_recv; |
123 | struct timeval ccid3hcrx_tstamp_last_feedback; | 127 | struct timeval ccid3hcrx_tstamp_last_feedback; |
124 | struct timeval ccid3hcrx_tstamp_last_ack; | 128 | struct timeval ccid3hcrx_tstamp_last_ack; |
@@ -127,7 +131,6 @@ struct ccid3_hc_rx_sock { | |||
127 | u16 ccid3hcrx_s; | 131 | u16 ccid3hcrx_s; |
128 | u32 ccid3hcrx_pinv; | 132 | u32 ccid3hcrx_pinv; |
129 | u32 ccid3hcrx_elapsed_time; | 133 | u32 ccid3hcrx_elapsed_time; |
130 | u32 ccid3hcrx_x_recv; | ||
131 | }; | 134 | }; |
132 | 135 | ||
133 | static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk) | 136 | static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk) |