diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2010-11-14 11:25:36 -0500 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2010-11-15 01:11:59 -0500 |
commit | 18219463c884bfdb7954d298b9edb5194b14d621 (patch) | |
tree | d153af455b44eaf2fbf474515a2a7bb33b1b4b07 /net/dccp | |
parent | 3802408644515e29fb723d51a5317301b212cf3a (diff) |
dccp ccid-2: Consolidate Ack-Vector processing within main DCCP module
This aggregates Ack Vector processing (handling input and clearing old state)
into one function, for the following reasons and benefits:
* all Ack Vector-specific processing is now in one place;
* duplicated code is removed;
* ensuring sanity: from an Ack Vector point of view, it is better to clear the
old state first before entering new state;
* Ack Event handling happens mostly within the CCIDs, not the main DCCP module.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/input.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/net/dccp/input.c b/net/dccp/input.c index f91cf5ada306..7d230d14ce22 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
@@ -160,13 +160,15 @@ static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb) | |||
160 | dccp_time_wait(sk, DCCP_TIME_WAIT, 0); | 160 | dccp_time_wait(sk, DCCP_TIME_WAIT, 0); |
161 | } | 161 | } |
162 | 162 | ||
163 | static void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb) | 163 | static void dccp_handle_ackvec_processing(struct sock *sk, struct sk_buff *skb) |
164 | { | 164 | { |
165 | struct dccp_sock *dp = dccp_sk(sk); | 165 | struct dccp_ackvec *av = dccp_sk(sk)->dccps_hc_rx_ackvec; |
166 | 166 | ||
167 | if (dp->dccps_hc_rx_ackvec != NULL) | 167 | if (av == NULL) |
168 | dccp_ackvec_clear_state(dp->dccps_hc_rx_ackvec, | 168 | return; |
169 | DCCP_SKB_CB(skb)->dccpd_ack_seq); | 169 | if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) |
170 | dccp_ackvec_clear_state(av, DCCP_SKB_CB(skb)->dccpd_ack_seq); | ||
171 | dccp_ackvec_input(av, skb); | ||
170 | } | 172 | } |
171 | 173 | ||
172 | static void dccp_deliver_input_to_ccids(struct sock *sk, struct sk_buff *skb) | 174 | static void dccp_deliver_input_to_ccids(struct sock *sk, struct sk_buff *skb) |
@@ -365,21 +367,13 @@ discard: | |||
365 | int dccp_rcv_established(struct sock *sk, struct sk_buff *skb, | 367 | int dccp_rcv_established(struct sock *sk, struct sk_buff *skb, |
366 | const struct dccp_hdr *dh, const unsigned len) | 368 | const struct dccp_hdr *dh, const unsigned len) |
367 | { | 369 | { |
368 | struct dccp_sock *dp = dccp_sk(sk); | ||
369 | |||
370 | if (dccp_check_seqno(sk, skb)) | 370 | if (dccp_check_seqno(sk, skb)) |
371 | goto discard; | 371 | goto discard; |
372 | 372 | ||
373 | if (dccp_parse_options(sk, NULL, skb)) | 373 | if (dccp_parse_options(sk, NULL, skb)) |
374 | return 1; | 374 | return 1; |
375 | 375 | ||
376 | if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) | 376 | dccp_handle_ackvec_processing(sk, skb); |
377 | dccp_event_ack_recv(sk, skb); | ||
378 | |||
379 | if (dp->dccps_hc_rx_ackvec != NULL && | ||
380 | dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk, | ||
381 | DCCP_SKB_CB(skb)->dccpd_seq, DCCPAV_RECEIVED)) | ||
382 | goto discard; | ||
383 | dccp_deliver_input_to_ccids(sk, skb); | 377 | dccp_deliver_input_to_ccids(sk, skb); |
384 | 378 | ||
385 | return __dccp_rcv_established(sk, skb, dh, len); | 379 | return __dccp_rcv_established(sk, skb, dh, len); |
@@ -631,14 +625,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
631 | if (dccp_parse_options(sk, NULL, skb)) | 625 | if (dccp_parse_options(sk, NULL, skb)) |
632 | return 1; | 626 | return 1; |
633 | 627 | ||
634 | if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) | 628 | dccp_handle_ackvec_processing(sk, skb); |
635 | dccp_event_ack_recv(sk, skb); | ||
636 | |||
637 | if (dp->dccps_hc_rx_ackvec != NULL && | ||
638 | dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk, | ||
639 | DCCP_SKB_CB(skb)->dccpd_seq, DCCPAV_RECEIVED)) | ||
640 | goto discard; | ||
641 | |||
642 | dccp_deliver_input_to_ccids(sk, skb); | 629 | dccp_deliver_input_to_ccids(sk, skb); |
643 | } | 630 | } |
644 | 631 | ||