diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2006-03-20 20:15:42 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-20 20:15:42 -0500 |
commit | 7400d781105d18bf5bba89f8b986a413f14144a8 (patch) | |
tree | 39bba6735fa99c5b2aa755b81c0cebc0ac901931 /net/dccp/ackvec.c | |
parent | 0af5f6c1eba4a18e6b2ed518b589927d778c6c16 (diff) |
[DCCP] ackvec: Ditch dccpav_buf_len
Simplifying the code a bit as we're always using DCCP_MAX_ACKVEC_LEN.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ackvec.c')
-rw-r--r-- | net/dccp/ackvec.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c index 2c77dafbd091..348374005db0 100644 --- a/net/dccp/ackvec.c +++ b/net/dccp/ackvec.c | |||
@@ -20,6 +20,10 @@ | |||
20 | int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) | 20 | int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) |
21 | { | 21 | { |
22 | struct dccp_sock *dp = dccp_sk(sk); | 22 | struct dccp_sock *dp = dccp_sk(sk); |
23 | #ifdef CONFIG_IP_DCCP_DEBUG | ||
24 | const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ? | ||
25 | "CLIENT tx: " : "server tx: "; | ||
26 | #endif | ||
23 | struct dccp_ackvec *av = dp->dccps_hc_rx_ackvec; | 27 | struct dccp_ackvec *av = dp->dccps_hc_rx_ackvec; |
24 | int len = av->dccpav_vec_len + 2; | 28 | int len = av->dccpav_vec_len + 2; |
25 | struct timeval now; | 29 | struct timeval now; |
@@ -90,21 +94,13 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) | |||
90 | return -1; | 94 | return -1; |
91 | } | 95 | } |
92 | 96 | ||
93 | struct dccp_ackvec *dccp_ackvec_alloc(const unsigned int len, | 97 | struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority) |
94 | const gfp_t priority) | ||
95 | { | 98 | { |
96 | struct dccp_ackvec *av; | 99 | struct dccp_ackvec *av = kmalloc(sizeof(*av), priority); |
97 | |||
98 | BUG_ON(len == 0); | ||
99 | |||
100 | if (len > DCCP_MAX_ACKVEC_LEN) | ||
101 | return NULL; | ||
102 | 100 | ||
103 | av = kmalloc(sizeof(*av) + len, priority); | ||
104 | if (av != NULL) { | 101 | if (av != NULL) { |
105 | av->dccpav_buf_len = len; | ||
106 | av->dccpav_buf_head = | 102 | av->dccpav_buf_head = |
107 | av->dccpav_buf_tail = av->dccpav_buf_len - 1; | 103 | av->dccpav_buf_tail = DCCP_MAX_ACKVEC_LEN - 1; |
108 | av->dccpav_buf_ackno = | 104 | av->dccpav_buf_ackno = |
109 | av->dccpav_ack_ackno = av->dccpav_ack_seqno = ~0LLU; | 105 | av->dccpav_ack_ackno = av->dccpav_ack_seqno = ~0LLU; |
110 | av->dccpav_buf_nonce = av->dccpav_buf_nonce = 0; | 106 | av->dccpav_buf_nonce = av->dccpav_buf_nonce = 0; |
@@ -146,7 +142,7 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av, | |||
146 | unsigned int gap; | 142 | unsigned int gap; |
147 | long new_head; | 143 | long new_head; |
148 | 144 | ||
149 | if (av->dccpav_vec_len + packets > av->dccpav_buf_len) | 145 | if (av->dccpav_vec_len + packets > DCCP_MAX_ACKVEC_LEN) |
150 | return -ENOBUFS; | 146 | return -ENOBUFS; |
151 | 147 | ||
152 | gap = packets - 1; | 148 | gap = packets - 1; |
@@ -158,7 +154,7 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av, | |||
158 | gap + new_head + 1); | 154 | gap + new_head + 1); |
159 | gap = -new_head; | 155 | gap = -new_head; |
160 | } | 156 | } |
161 | new_head += av->dccpav_buf_len; | 157 | new_head += DCCP_MAX_ACKVEC_LEN; |
162 | } | 158 | } |
163 | 159 | ||
164 | av->dccpav_buf_head = new_head; | 160 | av->dccpav_buf_head = new_head; |
@@ -251,7 +247,7 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, | |||
251 | goto out_duplicate; | 247 | goto out_duplicate; |
252 | 248 | ||
253 | delta -= len + 1; | 249 | delta -= len + 1; |
254 | if (++index == av->dccpav_buf_len) | 250 | if (++index == DCCP_MAX_ACKVEC_LEN) |
255 | index = 0; | 251 | index = 0; |
256 | } | 252 | } |
257 | } | 253 | } |