aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2007-12-17 07:07:44 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:58:21 -0500
commit8e138e7949490eebdccbd65b1f660a0488149a6b (patch)
tree8013f8f699f3bac8daa9747183a704854150c496 /net/dccp
parent17159b0b494ad27f397f914d6eab1b91faf57630 (diff)
[CCID3]: Use a function to update p_inv, and p is never used
This patch 1) concentrates previously scattered computation of p_inv into one function; 2) removes the `p' element of the CCID3 RX sock (it is redundant); 3) makes the tfrc_rx_info structure standalone, only used on demand. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ccids/ccid3.c11
-rw-r--r--net/dccp/ccids/ccid3.h8
2 files changed, 12 insertions, 7 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index cd9b9ffe2ec4..e31560daa0b9 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -917,6 +917,7 @@ static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len,
917 u32 __user *optval, int __user *optlen) 917 u32 __user *optval, int __user *optlen)
918{ 918{
919 const struct ccid3_hc_rx_sock *hcrx; 919 const struct ccid3_hc_rx_sock *hcrx;
920 struct tfrc_rx_info rx_info;
920 const void *val; 921 const void *val;
921 922
922 /* Listen socks doesn't have a private CCID block */ 923 /* Listen socks doesn't have a private CCID block */
@@ -926,10 +927,14 @@ static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len,
926 hcrx = ccid3_hc_rx_sk(sk); 927 hcrx = ccid3_hc_rx_sk(sk);
927 switch (optname) { 928 switch (optname) {
928 case DCCP_SOCKOPT_CCID_RX_INFO: 929 case DCCP_SOCKOPT_CCID_RX_INFO:
929 if (len < sizeof(hcrx->ccid3hcrx_tfrc)) 930 if (len < sizeof(rx_info))
930 return -EINVAL; 931 return -EINVAL;
931 len = sizeof(hcrx->ccid3hcrx_tfrc); 932 rx_info.tfrcrx_x_recv = hcrx->ccid3hcrx_x_recv;
932 val = &hcrx->ccid3hcrx_tfrc; 933 rx_info.tfrcrx_rtt = hcrx->ccid3hcrx_rtt;
934 rx_info.tfrcrx_p = hcrx->ccid3hcrx_pinv == 0 ? ~0U :
935 scaled_div(1, hcrx->ccid3hcrx_pinv);
936 len = sizeof(rx_info);
937 val = &rx_info;
933 break; 938 break;
934 default: 939 default:
935 return -ENOPROTOOPT; 940 return -ENOPROTOOPT;
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h
index e9f6ff4f0552..49ca32bd7e79 100644
--- a/net/dccp/ccids/ccid3.h
+++ b/net/dccp/ccids/ccid3.h
@@ -139,6 +139,8 @@ enum ccid3_hc_rx_states {
139 * @ccid3hcrx_last_counter - Tracks window counter (RFC 4342, 8.1) 139 * @ccid3hcrx_last_counter - Tracks window counter (RFC 4342, 8.1)
140 * @ccid3hcrx_state - Receiver state, one of %ccid3_hc_rx_states 140 * @ccid3hcrx_state - Receiver state, one of %ccid3_hc_rx_states
141 * @ccid3hcrx_bytes_recv - Total sum of DCCP payload bytes 141 * @ccid3hcrx_bytes_recv - Total sum of DCCP payload bytes
142 * @ccid3hcrx_x_recv - Receiver estimate of send rate (RFC 3448, sec. 4.3)
143 * @ccid3hcrx_rtt - Receiver estimate of RTT
142 * @ccid3hcrx_tstamp_last_feedback - Time at which last feedback was sent 144 * @ccid3hcrx_tstamp_last_feedback - Time at which last feedback was sent
143 * @ccid3hcrx_tstamp_last_ack - Time at which last feedback was sent 145 * @ccid3hcrx_tstamp_last_ack - Time at which last feedback was sent
144 * @ccid3hcrx_hist - Packet history (loss detection + RTT sampling) 146 * @ccid3hcrx_hist - Packet history (loss detection + RTT sampling)
@@ -147,13 +149,11 @@ enum ccid3_hc_rx_states {
147 * @ccid3hcrx_pinv - Inverse of Loss Event Rate (RFC 4342, sec. 8.5) 149 * @ccid3hcrx_pinv - Inverse of Loss Event Rate (RFC 4342, sec. 8.5)
148 */ 150 */
149struct ccid3_hc_rx_sock { 151struct ccid3_hc_rx_sock {
150 struct tfrc_rx_info ccid3hcrx_tfrc;
151#define ccid3hcrx_x_recv ccid3hcrx_tfrc.tfrcrx_x_recv
152#define ccid3hcrx_rtt ccid3hcrx_tfrc.tfrcrx_rtt
153#define ccid3hcrx_p ccid3hcrx_tfrc.tfrcrx_p
154 u8 ccid3hcrx_last_counter:4; 152 u8 ccid3hcrx_last_counter:4;
155 enum ccid3_hc_rx_states ccid3hcrx_state:8; 153 enum ccid3_hc_rx_states ccid3hcrx_state:8;
156 u32 ccid3hcrx_bytes_recv; 154 u32 ccid3hcrx_bytes_recv;
155 u32 ccid3hcrx_x_recv;
156 u32 ccid3hcrx_rtt;
157 ktime_t ccid3hcrx_tstamp_last_feedback; 157 ktime_t ccid3hcrx_tstamp_last_feedback;
158 struct tfrc_rx_hist ccid3hcrx_hist; 158 struct tfrc_rx_hist ccid3hcrx_hist;
159 struct tfrc_loss_hist ccid3hcrx_li_hist; 159 struct tfrc_loss_hist ccid3hcrx_li_hist;