diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/dccp/ackvec.c | 24 | ||||
-rw-r--r-- | net/dccp/ackvec.h | 10 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 3 | ||||
-rw-r--r-- | net/dccp/minisocks.c | 3 |
4 files changed, 15 insertions, 25 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 | } |
diff --git a/net/dccp/ackvec.h b/net/dccp/ackvec.h index f7dfb5f67b87..f083daf4200c 100644 --- a/net/dccp/ackvec.h +++ b/net/dccp/ackvec.h | |||
@@ -49,7 +49,6 @@ | |||
49 | * (HC-Sender seqno) | 49 | * (HC-Sender seqno) |
50 | * @dccpav_ack_nonce - the one-bit sum of the ECN Nonces for all State 0. | 50 | * @dccpav_ack_nonce - the one-bit sum of the ECN Nonces for all State 0. |
51 | * | 51 | * |
52 | * @dccpav_buf_len - circular buffer length | ||
53 | * @dccpav_time - the time in usecs | 52 | * @dccpav_time - the time in usecs |
54 | * @dccpav_buf - circular buffer of acknowledgeable packets | 53 | * @dccpav_buf - circular buffer of acknowledgeable packets |
55 | */ | 54 | */ |
@@ -63,18 +62,16 @@ struct dccp_ackvec { | |||
63 | u8 dccpav_ack_ptr; | 62 | u8 dccpav_ack_ptr; |
64 | u8 dccpav_sent_len; | 63 | u8 dccpav_sent_len; |
65 | u8 dccpav_vec_len; | 64 | u8 dccpav_vec_len; |
66 | u8 dccpav_buf_len; | ||
67 | u8 dccpav_buf_nonce; | 65 | u8 dccpav_buf_nonce; |
68 | u8 dccpav_ack_nonce; | 66 | u8 dccpav_ack_nonce; |
69 | u8 dccpav_buf[0]; | 67 | u8 dccpav_buf[DCCP_MAX_ACKVEC_LEN]; |
70 | }; | 68 | }; |
71 | 69 | ||
72 | struct sock; | 70 | struct sock; |
73 | struct sk_buff; | 71 | struct sk_buff; |
74 | 72 | ||
75 | #ifdef CONFIG_IP_DCCP_ACKVEC | 73 | #ifdef CONFIG_IP_DCCP_ACKVEC |
76 | extern struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len, | 74 | extern struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority); |
77 | const gfp_t priority); | ||
78 | extern void dccp_ackvec_free(struct dccp_ackvec *av); | 75 | extern void dccp_ackvec_free(struct dccp_ackvec *av); |
79 | 76 | ||
80 | extern int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, | 77 | extern int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, |
@@ -92,8 +89,7 @@ static inline int dccp_ackvec_pending(const struct dccp_ackvec *av) | |||
92 | return av->dccpav_sent_len != av->dccpav_vec_len; | 89 | return av->dccpav_sent_len != av->dccpav_vec_len; |
93 | } | 90 | } |
94 | #else /* CONFIG_IP_DCCP_ACKVEC */ | 91 | #else /* CONFIG_IP_DCCP_ACKVEC */ |
95 | static inline struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len, | 92 | static inline struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority) |
96 | const gfp_t priority) | ||
97 | { | 93 | { |
98 | return NULL; | 94 | return NULL; |
99 | } | 95 | } |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index dc0487b5bace..f8df565e89c8 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -1042,8 +1042,7 @@ int dccp_v4_init_sock(struct sock *sk) | |||
1042 | do_gettimeofday(&dp->dccps_epoch); | 1042 | do_gettimeofday(&dp->dccps_epoch); |
1043 | 1043 | ||
1044 | if (dp->dccps_options.dccpo_send_ack_vector) { | 1044 | if (dp->dccps_options.dccpo_send_ack_vector) { |
1045 | dp->dccps_hc_rx_ackvec = dccp_ackvec_alloc(DCCP_MAX_ACKVEC_LEN, | 1045 | dp->dccps_hc_rx_ackvec = dccp_ackvec_alloc(GFP_KERNEL); |
1046 | GFP_KERNEL); | ||
1047 | if (dp->dccps_hc_rx_ackvec == NULL) | 1046 | if (dp->dccps_hc_rx_ackvec == NULL) |
1048 | return -ENOMEM; | 1047 | return -ENOMEM; |
1049 | } | 1048 | } |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index 29261fc198e7..a60a3e948c36 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
@@ -116,8 +116,7 @@ struct sock *dccp_create_openreq_child(struct sock *sk, | |||
116 | 116 | ||
117 | if (newdp->dccps_options.dccpo_send_ack_vector) { | 117 | if (newdp->dccps_options.dccpo_send_ack_vector) { |
118 | newdp->dccps_hc_rx_ackvec = | 118 | newdp->dccps_hc_rx_ackvec = |
119 | dccp_ackvec_alloc(DCCP_MAX_ACKVEC_LEN, | 119 | dccp_ackvec_alloc(GFP_ATOMIC); |
120 | GFP_ATOMIC); | ||
121 | /* | 120 | /* |
122 | * XXX: We're using the same CCIDs set on the parent, | 121 | * XXX: We're using the same CCIDs set on the parent, |
123 | * i.e. sk_clone copied the master sock and left the | 122 | * i.e. sk_clone copied the master sock and left the |