diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2011-07-03 11:53:12 -0400 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2011-07-04 14:37:40 -0400 |
commit | 58fdea0f3170c13a3b875ef904d5b67cf73814be (patch) | |
tree | 9cdaa4c22734531b21479dc594dadf6ffbcd36d4 | |
parent | b4d5f4b2884625d13c7ef5b9fd085ec93bbf545c (diff) |
dccp ccid-2: Use existing function to test for data packets
This replaces a switch statement with a test, using the equivalent
function dccp_data_packet(skb). It also doubles the range of the field
`rx_num_data_pkts' by changing the type from `int' to `u32', avoiding
signed/unsigned comparison with the u16 field `dccps_r_ack_ratio'.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
-rw-r--r-- | net/dccp/ccids/ccid2.c | 16 | ||||
-rw-r--r-- | net/dccp/ccids/ccid2.h | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index e96d5e810039..7d917981a4d1 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
@@ -627,18 +627,14 @@ static void ccid2_hc_tx_exit(struct sock *sk) | |||
627 | 627 | ||
628 | static void ccid2_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | 628 | static void ccid2_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) |
629 | { | 629 | { |
630 | const struct dccp_sock *dp = dccp_sk(sk); | ||
631 | struct ccid2_hc_rx_sock *hc = ccid2_hc_rx_sk(sk); | 630 | struct ccid2_hc_rx_sock *hc = ccid2_hc_rx_sk(sk); |
632 | 631 | ||
633 | switch (DCCP_SKB_CB(skb)->dccpd_type) { | 632 | if (!dccp_data_packet(skb)) |
634 | case DCCP_PKT_DATA: | 633 | return; |
635 | case DCCP_PKT_DATAACK: | 634 | |
636 | hc->rx_data++; | 635 | if (++hc->rx_num_data_pkts >= dccp_sk(sk)->dccps_r_ack_ratio) { |
637 | if (hc->rx_data >= dp->dccps_r_ack_ratio) { | 636 | dccp_send_ack(sk); |
638 | dccp_send_ack(sk); | 637 | hc->rx_num_data_pkts = 0; |
639 | hc->rx_data = 0; | ||
640 | } | ||
641 | break; | ||
642 | } | 638 | } |
643 | } | 639 | } |
644 | 640 | ||
diff --git a/net/dccp/ccids/ccid2.h b/net/dccp/ccids/ccid2.h index f17460a8fe7f..da021ebce9af 100644 --- a/net/dccp/ccids/ccid2.h +++ b/net/dccp/ccids/ccid2.h | |||
@@ -97,8 +97,12 @@ static inline u32 rfc3390_bytes_to_packets(const u32 smss) | |||
97 | return smss <= 1095 ? 4 : (smss > 2190 ? 2 : 3); | 97 | return smss <= 1095 ? 4 : (smss > 2190 ? 2 : 3); |
98 | } | 98 | } |
99 | 99 | ||
100 | /** | ||
101 | * struct ccid2_hc_rx_sock - Receiving end of CCID-2 half-connection | ||
102 | * @rx_num_data_pkts: number of data packets received since last feedback | ||
103 | */ | ||
100 | struct ccid2_hc_rx_sock { | 104 | struct ccid2_hc_rx_sock { |
101 | int rx_data; | 105 | u32 rx_num_data_pkts; |
102 | }; | 106 | }; |
103 | 107 | ||
104 | static inline struct ccid2_hc_tx_sock *ccid2_hc_tx_sk(const struct sock *sk) | 108 | static inline struct ccid2_hc_tx_sock *ccid2_hc_tx_sk(const struct sock *sk) |