Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: merge cases where sock_efree and sock_edemux are the same function

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>

authored by

Alexander Duyck and committed by
David S. Miller
82eabd9e 62bccb8c

+7 -3
+4
include/net/sock.h
··· 1575 1575 void skb_orphan_partial(struct sk_buff *skb); 1576 1576 void sock_rfree(struct sk_buff *skb); 1577 1577 void sock_efree(struct sk_buff *skb); 1578 + #ifdef CONFIG_INET 1578 1579 void sock_edemux(struct sk_buff *skb); 1580 + #else 1581 + #define sock_edemux(skb) sock_efree(skb) 1582 + #endif 1579 1583 1580 1584 int sock_setsockopt(struct socket *sock, int level, int op, 1581 1585 char __user *optval, unsigned int optlen);
+2 -2
net/core/sock.c
··· 1643 1643 } 1644 1644 EXPORT_SYMBOL(sock_efree); 1645 1645 1646 + #ifdef CONFIG_INET 1646 1647 void sock_edemux(struct sk_buff *skb) 1647 1648 { 1648 1649 struct sock *sk = skb->sk; 1649 1650 1650 - #ifdef CONFIG_INET 1651 1651 if (sk->sk_state == TCP_TIME_WAIT) 1652 1652 inet_twsk_put(inet_twsk(sk)); 1653 1653 else 1654 - #endif 1655 1654 sock_put(sk); 1656 1655 } 1657 1656 EXPORT_SYMBOL(sock_edemux); 1657 + #endif 1658 1658 1659 1659 kuid_t sock_i_uid(struct sock *sk) 1660 1660 {
+1 -1
net/ipv4/udp.c
··· 1972 1972 return; 1973 1973 1974 1974 skb->sk = sk; 1975 - skb->destructor = sock_edemux; 1975 + skb->destructor = sock_efree; 1976 1976 dst = sk->sk_rx_dst; 1977 1977 1978 1978 if (dst)