diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-11-06 00:03:24 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-11-07 07:08:25 -0500 |
commit | 429f08e950a88cd826b203ea898c2f2d0f7db9de (patch) | |
tree | 7ee583efb040adb192c63734516b56849d7c6c10 /net/ipv4/ip_output.c | |
parent | e011ff48abc1b0ee97cde26b7700d2cca689e7c3 (diff) |
[IPV4]: Consolidate the ip cork destruction in ip_output.c
The ip_push_pending_frames and ip_flush_pending_frames do the
same things to flush the sock's cork. Move this into a separate
function and save ~80 bytes from the .text
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r-- | net/ipv4/ip_output.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index e5f7dc2de303..fd99fbd685ea 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -1183,6 +1183,17 @@ error: | |||
1183 | return err; | 1183 | return err; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | static void ip_cork_release(struct inet_sock *inet) | ||
1187 | { | ||
1188 | inet->cork.flags &= ~IPCORK_OPT; | ||
1189 | kfree(inet->cork.opt); | ||
1190 | inet->cork.opt = NULL; | ||
1191 | if (inet->cork.rt) { | ||
1192 | ip_rt_put(inet->cork.rt); | ||
1193 | inet->cork.rt = NULL; | ||
1194 | } | ||
1195 | } | ||
1196 | |||
1186 | /* | 1197 | /* |
1187 | * Combined all pending IP fragments on the socket as one IP datagram | 1198 | * Combined all pending IP fragments on the socket as one IP datagram |
1188 | * and push them out. | 1199 | * and push them out. |
@@ -1276,13 +1287,7 @@ int ip_push_pending_frames(struct sock *sk) | |||
1276 | } | 1287 | } |
1277 | 1288 | ||
1278 | out: | 1289 | out: |
1279 | inet->cork.flags &= ~IPCORK_OPT; | 1290 | ip_cork_release(inet); |
1280 | kfree(inet->cork.opt); | ||
1281 | inet->cork.opt = NULL; | ||
1282 | if (inet->cork.rt) { | ||
1283 | ip_rt_put(inet->cork.rt); | ||
1284 | inet->cork.rt = NULL; | ||
1285 | } | ||
1286 | return err; | 1291 | return err; |
1287 | 1292 | ||
1288 | error: | 1293 | error: |
@@ -1295,19 +1300,12 @@ error: | |||
1295 | */ | 1300 | */ |
1296 | void ip_flush_pending_frames(struct sock *sk) | 1301 | void ip_flush_pending_frames(struct sock *sk) |
1297 | { | 1302 | { |
1298 | struct inet_sock *inet = inet_sk(sk); | ||
1299 | struct sk_buff *skb; | 1303 | struct sk_buff *skb; |
1300 | 1304 | ||
1301 | while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) | 1305 | while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) |
1302 | kfree_skb(skb); | 1306 | kfree_skb(skb); |
1303 | 1307 | ||
1304 | inet->cork.flags &= ~IPCORK_OPT; | 1308 | ip_cork_release(inet_sk(sk)); |
1305 | kfree(inet->cork.opt); | ||
1306 | inet->cork.opt = NULL; | ||
1307 | if (inet->cork.rt) { | ||
1308 | ip_rt_put(inet->cork.rt); | ||
1309 | inet->cork.rt = NULL; | ||
1310 | } | ||
1311 | } | 1309 | } |
1312 | 1310 | ||
1313 | 1311 | ||