aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/ccid3.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ccids/ccid3.c')
-rw-r--r--net/dccp/ccids/ccid3.c57
1 files changed, 14 insertions, 43 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index f74e58d9793f..12b601f11bfd 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -487,60 +487,31 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option,
487 unsigned char len, u16 idx, 487 unsigned char len, u16 idx,
488 unsigned char *value) 488 unsigned char *value)
489{ 489{
490 int rc = 0;
491 const struct dccp_sock *dp = dccp_sk(sk);
492 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 490 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
493 struct ccid3_options_received *opt_recv = &hctx->options_received; 491 struct ccid3_options_received *opt_recv = &hctx->options_received;
494 __be32 opt_val; 492 __be32 opt_val;
495 493
496 if (opt_recv->ccid3or_seqno != dp->dccps_gsr) {
497 opt_recv->ccid3or_seqno = dp->dccps_gsr;
498 opt_recv->ccid3or_loss_event_rate = ~0;
499 opt_recv->ccid3or_loss_intervals_idx = 0;
500 opt_recv->ccid3or_loss_intervals_len = 0;
501 opt_recv->ccid3or_receive_rate = 0;
502 }
503
504 switch (option) { 494 switch (option) {
495 case TFRC_OPT_RECEIVE_RATE:
505 case TFRC_OPT_LOSS_EVENT_RATE: 496 case TFRC_OPT_LOSS_EVENT_RATE:
506 if (unlikely(len != 4)) { 497 if (unlikely(len != 4)) {
507 DCCP_WARN("%s(%p), invalid len %d " 498 DCCP_WARN("%s(%p), invalid len %d for %u\n",
508 "for TFRC_OPT_LOSS_EVENT_RATE\n", 499 dccp_role(sk), sk, len, option);
509 dccp_role(sk), sk, len); 500 return -EINVAL;
510 rc = -EINVAL;
511 } else {
512 opt_val = get_unaligned((__be32 *)value);
513 opt_recv->ccid3or_loss_event_rate = ntohl(opt_val);
514 ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n",
515 dccp_role(sk), sk,
516 opt_recv->ccid3or_loss_event_rate);
517 } 501 }
518 break; 502 opt_val = ntohl(get_unaligned((__be32 *)value));
519 case TFRC_OPT_LOSS_INTERVALS: 503
520 opt_recv->ccid3or_loss_intervals_idx = idx; 504 if (option == TFRC_OPT_RECEIVE_RATE) {
521 opt_recv->ccid3or_loss_intervals_len = len; 505 opt_recv->ccid3or_receive_rate = opt_val;
522 ccid3_pr_debug("%s(%p), LOSS_INTERVALS=(%u, %u)\n",
523 dccp_role(sk), sk,
524 opt_recv->ccid3or_loss_intervals_idx,
525 opt_recv->ccid3or_loss_intervals_len);
526 break;
527 case TFRC_OPT_RECEIVE_RATE:
528 if (unlikely(len != 4)) {
529 DCCP_WARN("%s(%p), invalid len %d "
530 "for TFRC_OPT_RECEIVE_RATE\n",
531 dccp_role(sk), sk, len);
532 rc = -EINVAL;
533 } else {
534 opt_val = get_unaligned((__be32 *)value);
535 opt_recv->ccid3or_receive_rate = ntohl(opt_val);
536 ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n", 506 ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n",
537 dccp_role(sk), sk, 507 dccp_role(sk), sk, opt_val);
538 opt_recv->ccid3or_receive_rate); 508 } else {
509 opt_recv->ccid3or_loss_event_rate = opt_val;
510 ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n",
511 dccp_role(sk), sk, opt_val);
539 } 512 }
540 break;
541 } 513 }
542 514 return 0;
543 return rc;
544} 515}
545 516
546static int ccid3_hc_tx_init(struct ccid *ccid, struct sock *sk) 517static int ccid3_hc_tx_init(struct ccid *ccid, struct sock *sk)