diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-09-04 01:30:19 -0400 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-09-04 01:45:37 -0400 |
commit | 283fb4a5f39d1521d53e1044bff0ba2654acf145 (patch) | |
tree | e813566d7b3530702410d470f85cf2162e443bb3 /net/dccp/input.c | |
parent | e28fe59f9c82ef55fc9b55e745531c9fed86f00a (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/input.c')
-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 77a5d57ab702..9a108ce17fc7 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
@@ -159,13 +159,15 @@ static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb) | |||
159 | dccp_time_wait(sk, DCCP_TIME_WAIT, 0); | 159 | dccp_time_wait(sk, DCCP_TIME_WAIT, 0); |
160 | } | 160 | } |
161 | 161 | ||
162 | static void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb) | 162 | static void dccp_handle_ackvec_processing(struct sock *sk, struct sk_buff *skb) |
163 | { | 163 | { |
164 | struct dccp_sock *dp = dccp_sk(sk); | 164 | struct dccp_ackvec *av = dccp_sk(sk)->dccps_hc_rx_ackvec; |
165 | 165 | ||
166 | if (dp->dccps_hc_rx_ackvec != NULL) | 166 | if (av == NULL) |
167 | dccp_ackvec_clear_state(dp->dccps_hc_rx_ackvec, | 167 | return; |
168 | DCCP_SKB_CB(skb)->dccpd_ack_seq); | 168 | if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) |
169 | dccp_ackvec_clear_state(av, DCCP_SKB_CB(skb)->dccpd_ack_seq); | ||
170 | dccp_ackvec_input(av, skb); | ||
169 | } | 171 | } |
170 | 172 | ||
171 | static void dccp_deliver_input_to_ccids(struct sock *sk, struct sk_buff *skb) | 173 | static void dccp_deliver_input_to_ccids(struct sock *sk, struct sk_buff *skb) |
@@ -364,21 +366,13 @@ discard: | |||
364 | int dccp_rcv_established(struct sock *sk, struct sk_buff *skb, | 366 | int dccp_rcv_established(struct sock *sk, struct sk_buff *skb, |
365 | const struct dccp_hdr *dh, const unsigned len) | 367 | const struct dccp_hdr *dh, const unsigned len) |
366 | { | 368 | { |
367 | struct dccp_sock *dp = dccp_sk(sk); | ||
368 | |||
369 | if (dccp_check_seqno(sk, skb)) | 369 | if (dccp_check_seqno(sk, skb)) |
370 | goto discard; | 370 | goto discard; |
371 | 371 | ||
372 | if (dccp_parse_options(sk, NULL, skb)) | 372 | if (dccp_parse_options(sk, NULL, skb)) |
373 | return 1; | 373 | return 1; |
374 | 374 | ||
375 | if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) | 375 | dccp_handle_ackvec_processing(sk, skb); |
376 | dccp_event_ack_recv(sk, skb); | ||
377 | |||
378 | if (dp->dccps_hc_rx_ackvec != NULL && | ||
379 | dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk, | ||
380 | DCCP_SKB_CB(skb)->dccpd_seq, DCCPAV_RECEIVED)) | ||
381 | goto discard; | ||
382 | dccp_deliver_input_to_ccids(sk, skb); | 376 | dccp_deliver_input_to_ccids(sk, skb); |
383 | 377 | ||
384 | return __dccp_rcv_established(sk, skb, dh, len); | 378 | return __dccp_rcv_established(sk, skb, dh, len); |
@@ -621,14 +615,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
621 | if (dccp_parse_options(sk, NULL, skb)) | 615 | if (dccp_parse_options(sk, NULL, skb)) |
622 | return 1; | 616 | return 1; |
623 | 617 | ||
624 | if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) | 618 | dccp_handle_ackvec_processing(sk, skb); |
625 | dccp_event_ack_recv(sk, skb); | ||
626 | |||
627 | if (dp->dccps_hc_rx_ackvec != NULL && | ||
628 | dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk, | ||
629 | DCCP_SKB_CB(skb)->dccpd_seq, DCCPAV_RECEIVED)) | ||
630 | goto discard; | ||
631 | |||
632 | dccp_deliver_input_to_ccids(sk, skb); | 619 | dccp_deliver_input_to_ccids(sk, skb); |
633 | } | 620 | } |
634 | 621 | ||