aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2010-09-19 14:14:23 -0400
committerGerrit Renker <gerrit@erg.abdn.ac.uk>2010-09-21 06:14:26 -0400
commit536bb20b45dee3f9b77b0d250f8ed0733a5cb025 (patch)
treecb28f25c7c4c70f6d3c110fd7ddcf0666a5b04af /net/dccp/ccids
parent792e6d3389061ad449429b9ba228eb758c247ea0 (diff)
dccp ccid-3: Remove redundant 'options_received' struct
The `options_received' struct is redundant, since it re-duplicates the existing `p' and `x_recv' fields. This patch removes the sub-struct and migrates the format conversion operations to ccid3_hc_tx_parse_options(). Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/ccids')
-rw-r--r--net/dccp/ccids/ccid3.c24
-rw-r--r--net/dccp/ccids/ccid3.h7
2 files changed, 8 insertions, 23 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 9715eebf1551..c3f3a25bbd7a 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -365,11 +365,10 @@ static void ccid3_hc_tx_packet_sent(struct sock *sk, int more,
365static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) 365static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
366{ 366{
367 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk); 367 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk);
368 struct ccid3_options_received *opt_recv = &hc->tx_options_received;
369 struct tfrc_tx_hist_entry *acked; 368 struct tfrc_tx_hist_entry *acked;
370 ktime_t now; 369 ktime_t now;
371 unsigned long t_nfb; 370 unsigned long t_nfb;
372 u32 pinv, r_sample; 371 u32 r_sample;
373 372
374 /* we are only interested in ACKs */ 373 /* we are only interested in ACKs */
375 if (!(DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK || 374 if (!(DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK ||
@@ -394,17 +393,6 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
394 r_sample = dccp_sample_rtt(sk, ktime_us_delta(now, acked->stamp)); 393 r_sample = dccp_sample_rtt(sk, ktime_us_delta(now, acked->stamp));
395 hc->tx_rtt = tfrc_ewma(hc->tx_rtt, r_sample, 9); 394 hc->tx_rtt = tfrc_ewma(hc->tx_rtt, r_sample, 9);
396 395
397 /* Update receive rate in units of 64 * bytes/second */
398 hc->tx_x_recv = opt_recv->ccid3or_receive_rate;
399 hc->tx_x_recv <<= 6;
400
401 /* Update loss event rate (which is scaled by 1e6) */
402 pinv = opt_recv->ccid3or_loss_event_rate;
403 if (pinv == 0)
404 hc->tx_p = 0;
405 else
406 hc->tx_p = tfrc_invert_loss_event_rate(pinv);
407
408 /* 396 /*
409 * Update allowed sending rate X as per draft rfc3448bis-00, 4.2/3 397 * Update allowed sending rate X as per draft rfc3448bis-00, 4.2/3
410 */ 398 */
@@ -476,7 +464,6 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, u8 packet_type,
476 u8 option, u8 *optval, u8 optlen) 464 u8 option, u8 *optval, u8 optlen)
477{ 465{
478 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk); 466 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk);
479 struct ccid3_options_received *opt_recv = &hc->tx_options_received;
480 __be32 opt_val; 467 __be32 opt_val;
481 468
482 switch (option) { 469 switch (option) {
@@ -493,11 +480,16 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, u8 packet_type,
493 opt_val = ntohl(get_unaligned((__be32 *)optval)); 480 opt_val = ntohl(get_unaligned((__be32 *)optval));
494 481
495 if (option == TFRC_OPT_RECEIVE_RATE) { 482 if (option == TFRC_OPT_RECEIVE_RATE) {
496 opt_recv->ccid3or_receive_rate = opt_val; 483 /* Receive Rate is kept in units of 64 bytes/second */
484 hc->tx_x_recv = opt_val;
485 hc->tx_x_recv <<= 6;
486
497 ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n", 487 ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n",
498 dccp_role(sk), sk, opt_val); 488 dccp_role(sk), sk, opt_val);
499 } else { 489 } else {
500 opt_recv->ccid3or_loss_event_rate = opt_val; 490 /* Update the fixpoint Loss Event Rate fraction */
491 hc->tx_p = tfrc_invert_loss_event_rate(opt_val);
492
501 ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n", 493 ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n",
502 dccp_role(sk), sk, opt_val); 494 dccp_role(sk), sk, opt_val);
503 } 495 }
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h
index 89b047b0c79b..1a9933c29672 100644
--- a/net/dccp/ccids/ccid3.h
+++ b/net/dccp/ccids/ccid3.h
@@ -67,11 +67,6 @@ enum ccid3_options {
67 TFRC_OPT_RECEIVE_RATE = 194, 67 TFRC_OPT_RECEIVE_RATE = 194,
68}; 68};
69 69
70struct ccid3_options_received {
71 u32 ccid3or_loss_event_rate;
72 u32 ccid3or_receive_rate;
73};
74
75/* TFRC sender states */ 70/* TFRC sender states */
76enum ccid3_hc_tx_states { 71enum ccid3_hc_tx_states {
77 TFRC_SSTATE_NO_SENT = 1, 72 TFRC_SSTATE_NO_SENT = 1,
@@ -97,7 +92,6 @@ enum ccid3_hc_tx_states {
97 * @tx_t_ld: Time last doubled during slow start 92 * @tx_t_ld: Time last doubled during slow start
98 * @tx_t_nom: Nominal send time of next packet 93 * @tx_t_nom: Nominal send time of next packet
99 * @tx_hist: Packet history 94 * @tx_hist: Packet history
100 * @tx_options_received: Parsed set of retrieved options
101 */ 95 */
102struct ccid3_hc_tx_sock { 96struct ccid3_hc_tx_sock {
103 u64 tx_x; 97 u64 tx_x;
@@ -115,7 +109,6 @@ struct ccid3_hc_tx_sock {
115 ktime_t tx_t_ld; 109 ktime_t tx_t_ld;
116 ktime_t tx_t_nom; 110 ktime_t tx_t_nom;
117 struct tfrc_tx_hist_entry *tx_hist; 111 struct tfrc_tx_hist_entry *tx_hist;
118 struct ccid3_options_received tx_options_received;
119}; 112};
120 113
121static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk) 114static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk)