aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_output.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-11-06 00:04:31 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-11-07 07:08:26 -0500
commitbf138862b162b6eaf3d7336f759f6e6485e481df (patch)
tree1f775c773e6b59663a30c58cfbc36b40013b24c6 /net/ipv6/ip6_output.c
parent429f08e950a88cd826b203ea898c2f2d0f7db9de (diff)
[IPV6]: Consolidate the ip cork destruction in ip6_output.c
The ip6_push_pending_frames and ip6_flush_pending_frames do the same things to flush the sock's cork. Move this into a separate function and save ~100 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/ipv6/ip6_output.c')
-rw-r--r--net/ipv6/ip6_output.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 653fc0a8235b..86e1835ce4e4 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1339,6 +1339,19 @@ error:
1339 return err; 1339 return err;
1340} 1340}
1341 1341
1342static void ip6_cork_release(struct inet_sock *inet, struct ipv6_pinfo *np)
1343{
1344 inet->cork.flags &= ~IPCORK_OPT;
1345 kfree(np->cork.opt);
1346 np->cork.opt = NULL;
1347 if (np->cork.rt) {
1348 dst_release(&np->cork.rt->u.dst);
1349 np->cork.rt = NULL;
1350 inet->cork.flags &= ~IPCORK_ALLFRAG;
1351 }
1352 memset(&inet->cork.fl, 0, sizeof(inet->cork.fl));
1353}
1354
1342int ip6_push_pending_frames(struct sock *sk) 1355int ip6_push_pending_frames(struct sock *sk)
1343{ 1356{
1344 struct sk_buff *skb, *tmp_skb; 1357 struct sk_buff *skb, *tmp_skb;
@@ -1415,15 +1428,7 @@ int ip6_push_pending_frames(struct sock *sk)
1415 } 1428 }
1416 1429
1417out: 1430out:
1418 inet->cork.flags &= ~IPCORK_OPT; 1431 ip6_cork_release(inet, np);
1419 kfree(np->cork.opt);
1420 np->cork.opt = NULL;
1421 if (np->cork.rt) {
1422 dst_release(&np->cork.rt->u.dst);
1423 np->cork.rt = NULL;
1424 inet->cork.flags &= ~IPCORK_ALLFRAG;
1425 }
1426 memset(&inet->cork.fl, 0, sizeof(inet->cork.fl));
1427 return err; 1432 return err;
1428error: 1433error:
1429 goto out; 1434 goto out;
@@ -1431,8 +1436,6 @@ error:
1431 1436
1432void ip6_flush_pending_frames(struct sock *sk) 1437void ip6_flush_pending_frames(struct sock *sk)
1433{ 1438{
1434 struct inet_sock *inet = inet_sk(sk);
1435 struct ipv6_pinfo *np = inet6_sk(sk);
1436 struct sk_buff *skb; 1439 struct sk_buff *skb;
1437 1440
1438 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { 1441 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
@@ -1442,14 +1445,5 @@ void ip6_flush_pending_frames(struct sock *sk)
1442 kfree_skb(skb); 1445 kfree_skb(skb);
1443 } 1446 }
1444 1447
1445 inet->cork.flags &= ~IPCORK_OPT; 1448 ip6_cork_release(inet_sk(sk), inet6_sk(sk));
1446
1447 kfree(np->cork.opt);
1448 np->cork.opt = NULL;
1449 if (np->cork.rt) {
1450 dst_release(&np->cork.rt->u.dst);
1451 np->cork.rt = NULL;
1452 inet->cork.flags &= ~IPCORK_ALLFRAG;
1453 }
1454 memset(&inet->cork.fl, 0, sizeof(inet->cork.fl));
1455} 1449}