Commit 58fdea0f authored by Gerrit Renker's avatar Gerrit Renker

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: default avatarGerrit Renker <gerrit@erg.abdn.ac.uk>
parent b4d5f4b2
...@@ -627,18 +627,14 @@ static void ccid2_hc_tx_exit(struct sock *sk) ...@@ -627,18 +627,14 @@ static void ccid2_hc_tx_exit(struct sock *sk)
static void ccid2_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) static void ccid2_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
{ {
const struct dccp_sock *dp = dccp_sk(sk);
struct ccid2_hc_rx_sock *hc = ccid2_hc_rx_sk(sk); struct ccid2_hc_rx_sock *hc = ccid2_hc_rx_sk(sk);
switch (DCCP_SKB_CB(skb)->dccpd_type) { if (!dccp_data_packet(skb))
case DCCP_PKT_DATA: return;
case DCCP_PKT_DATAACK:
hc->rx_data++; if (++hc->rx_num_data_pkts >= dccp_sk(sk)->dccps_r_ack_ratio) {
if (hc->rx_data >= dp->dccps_r_ack_ratio) {
dccp_send_ack(sk); dccp_send_ack(sk);
hc->rx_data = 0; hc->rx_num_data_pkts = 0;
}
break;
} }
} }
......
...@@ -97,8 +97,12 @@ static inline u32 rfc3390_bytes_to_packets(const u32 smss) ...@@ -97,8 +97,12 @@ static inline u32 rfc3390_bytes_to_packets(const u32 smss)
return smss <= 1095 ? 4 : (smss > 2190 ? 2 : 3); return smss <= 1095 ? 4 : (smss > 2190 ? 2 : 3);
} }
/**
* struct ccid2_hc_rx_sock - Receiving end of CCID-2 half-connection
* @rx_num_data_pkts: number of data packets received since last feedback
*/
struct ccid2_hc_rx_sock { struct ccid2_hc_rx_sock {
int rx_data; u32 rx_num_data_pkts;
}; };
static inline struct ccid2_hc_tx_sock *ccid2_hc_tx_sk(const struct sock *sk) static inline struct ccid2_hc_tx_sock *ccid2_hc_tx_sk(const struct sock *sk)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment