[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>
This commit is contained in:
Pavel Emelyanov 2007-11-05 21:04:31 -08:00 committed by David S. Miller
parent 429f08e950
commit bf138862b1

View File

@ -1339,6 +1339,19 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
return err; return err;
} }
static void ip6_cork_release(struct inet_sock *inet, struct ipv6_pinfo *np)
{
inet->cork.flags &= ~IPCORK_OPT;
kfree(np->cork.opt);
np->cork.opt = NULL;
if (np->cork.rt) {
dst_release(&np->cork.rt->u.dst);
np->cork.rt = NULL;
inet->cork.flags &= ~IPCORK_ALLFRAG;
}
memset(&inet->cork.fl, 0, sizeof(inet->cork.fl));
}
int ip6_push_pending_frames(struct sock *sk) int ip6_push_pending_frames(struct sock *sk)
{ {
struct sk_buff *skb, *tmp_skb; struct sk_buff *skb, *tmp_skb;
@ -1415,15 +1428,7 @@ int ip6_push_pending_frames(struct sock *sk)
} }
out: out:
inet->cork.flags &= ~IPCORK_OPT; ip6_cork_release(inet, np);
kfree(np->cork.opt);
np->cork.opt = NULL;
if (np->cork.rt) {
dst_release(&np->cork.rt->u.dst);
np->cork.rt = NULL;
inet->cork.flags &= ~IPCORK_ALLFRAG;
}
memset(&inet->cork.fl, 0, sizeof(inet->cork.fl));
return err; return err;
error: error:
goto out; goto out;
@ -1431,8 +1436,6 @@ int ip6_push_pending_frames(struct sock *sk)
void ip6_flush_pending_frames(struct sock *sk) void ip6_flush_pending_frames(struct sock *sk)
{ {
struct inet_sock *inet = inet_sk(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
struct sk_buff *skb; struct sk_buff *skb;
while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
@ -1442,14 +1445,5 @@ void ip6_flush_pending_frames(struct sock *sk)
kfree_skb(skb); kfree_skb(skb);
} }
inet->cork.flags &= ~IPCORK_OPT; ip6_cork_release(inet_sk(sk), inet6_sk(sk));
kfree(np->cork.opt);
np->cork.opt = NULL;
if (np->cork.rt) {
dst_release(&np->cork.rt->u.dst);
np->cork.rt = NULL;
inet->cork.flags &= ~IPCORK_ALLFRAG;
}
memset(&inet->cork.fl, 0, sizeof(inet->cork.fl));
} }