]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net: merge cases where sock_efree and sock_edemux are the same function
authorAlexander Duyck <alexander.h.duyck@intel.com>
Thu, 4 Sep 2014 17:32:11 +0000 (13:32 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sat, 6 Sep 2014 00:43:45 +0000 (17:43 -0700)
Since sock_efree and sock_demux are essentially the same code for non-TCP
sockets and the case where CONFIG_INET is not defined we can combine the
code or replace the call to sock_edemux in several spots.  As a result we
can avoid a bit of unnecessary code or code duplication.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sock.h
net/core/sock.c
net/ipv4/udp.c

index e02be37a3d912f0f2335de90ad1b9a7ccff1e411..ad23e80cb8d339a2b17e6a5ba84813264b402c35 100644 (file)
@@ -1575,7 +1575,11 @@ void sock_wfree(struct sk_buff *skb);
 void skb_orphan_partial(struct sk_buff *skb);
 void sock_rfree(struct sk_buff *skb);
 void sock_efree(struct sk_buff *skb);
 void skb_orphan_partial(struct sk_buff *skb);
 void sock_rfree(struct sk_buff *skb);
 void sock_efree(struct sk_buff *skb);
+#ifdef CONFIG_INET
 void sock_edemux(struct sk_buff *skb);
 void sock_edemux(struct sk_buff *skb);
+#else
+#define sock_edemux(skb) sock_efree(skb)
+#endif
 
 int sock_setsockopt(struct socket *sock, int level, int op,
                    char __user *optval, unsigned int optlen);
 
 int sock_setsockopt(struct socket *sock, int level, int op,
                    char __user *optval, unsigned int optlen);
index d04005c51724646f2b9b5b4783acbf5b2b72b792..69592cb66e3b6132a666ee21cf17d1da78b10f8a 100644 (file)
@@ -1643,18 +1643,18 @@ void sock_efree(struct sk_buff *skb)
 }
 EXPORT_SYMBOL(sock_efree);
 
 }
 EXPORT_SYMBOL(sock_efree);
 
+#ifdef CONFIG_INET
 void sock_edemux(struct sk_buff *skb)
 {
        struct sock *sk = skb->sk;
 
 void sock_edemux(struct sk_buff *skb)
 {
        struct sock *sk = skb->sk;
 
-#ifdef CONFIG_INET
        if (sk->sk_state == TCP_TIME_WAIT)
                inet_twsk_put(inet_twsk(sk));
        else
        if (sk->sk_state == TCP_TIME_WAIT)
                inet_twsk_put(inet_twsk(sk));
        else
-#endif
                sock_put(sk);
 }
 EXPORT_SYMBOL(sock_edemux);
                sock_put(sk);
 }
 EXPORT_SYMBOL(sock_edemux);
+#endif
 
 kuid_t sock_i_uid(struct sock *sk)
 {
 
 kuid_t sock_i_uid(struct sock *sk)
 {
index 0da3849fd35bb652631e03a08e76abbe29738ddd..cd0db5471bb5eb6048208404aab71253867e1eec 100644 (file)
@@ -1972,7 +1972,7 @@ void udp_v4_early_demux(struct sk_buff *skb)
                return;
 
        skb->sk = sk;
                return;
 
        skb->sk = sk;
-       skb->destructor = sock_edemux;
+       skb->destructor = sock_efree;
        dst = sk->sk_rx_dst;
 
        if (dst)
        dst = sk->sk_rx_dst;
 
        if (dst)