Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+8 -23
+8 -16
net/dccp/ccids/ccid3.c
··· 365 365 static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) 366 366 { 367 367 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk); 368 - struct ccid3_options_received *opt_recv = &hc->tx_options_received; 369 368 struct tfrc_tx_hist_entry *acked; 370 369 ktime_t now; 371 370 unsigned long t_nfb; 372 - u32 pinv, r_sample; 371 + u32 r_sample; 373 372 374 373 /* we are only interested in ACKs */ 375 374 if (!(DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK || ··· 392 393 now = ktime_get_real(); 393 394 r_sample = dccp_sample_rtt(sk, ktime_us_delta(now, acked->stamp)); 394 395 hc->tx_rtt = tfrc_ewma(hc->tx_rtt, r_sample, 9); 395 - 396 - /* Update receive rate in units of 64 * bytes/second */ 397 - hc->tx_x_recv = opt_recv->ccid3or_receive_rate; 398 - hc->tx_x_recv <<= 6; 399 - 400 - /* Update loss event rate (which is scaled by 1e6) */ 401 - pinv = opt_recv->ccid3or_loss_event_rate; 402 - if (pinv == 0) 403 - hc->tx_p = 0; 404 - else 405 - hc->tx_p = tfrc_invert_loss_event_rate(pinv); 406 396 407 397 /* 408 398 * Update allowed sending rate X as per draft rfc3448bis-00, 4.2/3 ··· 464 476 u8 option, u8 *optval, u8 optlen) 465 477 { 466 478 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk); 467 - struct ccid3_options_received *opt_recv = &hc->tx_options_received; 468 479 __be32 opt_val; 469 480 470 481 switch (option) { ··· 480 493 opt_val = ntohl(get_unaligned((__be32 *)optval)); 481 494 482 495 if (option == TFRC_OPT_RECEIVE_RATE) { 483 - opt_recv->ccid3or_receive_rate = opt_val; 496 + /* Receive Rate is kept in units of 64 bytes/second */ 497 + hc->tx_x_recv = opt_val; 498 + hc->tx_x_recv <<= 6; 499 + 484 500 ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n", 485 501 dccp_role(sk), sk, opt_val); 486 502 } else { 487 - opt_recv->ccid3or_loss_event_rate = opt_val; 503 + /* Update the fixpoint Loss Event Rate fraction */ 504 + hc->tx_p = tfrc_invert_loss_event_rate(opt_val); 505 + 488 506 ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n", 489 507 dccp_role(sk), sk, opt_val); 490 508 }
-7
net/dccp/ccids/ccid3.h
··· 67 67 TFRC_OPT_RECEIVE_RATE = 194, 68 68 }; 69 69 70 - struct ccid3_options_received { 71 - u32 ccid3or_loss_event_rate; 72 - u32 ccid3or_receive_rate; 73 - }; 74 - 75 70 /* TFRC sender states */ 76 71 enum ccid3_hc_tx_states { 77 72 TFRC_SSTATE_NO_SENT = 1, ··· 92 97 * @tx_t_ld: Time last doubled during slow start 93 98 * @tx_t_nom: Nominal send time of next packet 94 99 * @tx_hist: Packet history 95 - * @tx_options_received: Parsed set of retrieved options 96 100 */ 97 101 struct ccid3_hc_tx_sock { 98 102 u64 tx_x; ··· 109 115 ktime_t tx_t_ld; 110 116 ktime_t tx_t_nom; 111 117 struct tfrc_tx_hist_entry *tx_hist; 112 - struct ccid3_options_received tx_options_received; 113 118 }; 114 119 115 120 static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk)