From bbebbfed7449e6152fe014d91a3f71fe30941fb8 Mon Sep 17 00:00:00 2001 From: Chinh Tran Date: Wed, 26 Oct 2011 16:14:15 -0700 Subject: [PATCH] cne: Add reference count for Smart Wireless Interface Manager Add the reference count for Smart Wireless Interface Manager to know whether there are any process who still has the socket in question in use or not. Enable INET DIAG. Redefine the TCP_FLAG as it gives compiling error when an enum is defined by a function return. Change-Id: I1aa9c810fec2e332048c9ef4199ec3f996bc3a75 Signed-off-by: Chinh Tran --- arch/arm/configs/msm7630-perf_defconfig | 2 +- arch/arm/configs/msm7630_defconfig | 2 +- arch/arm/configs/msm8660-perf_defconfig | 2 +- arch/arm/configs/msm8660_defconfig | 2 +- arch/arm/configs/msm8960_defconfig | 2 +- include/linux/tcp.h | 25 +++++++++++++------------ net/ipv4/tcp.c | 9 +++++++++ 7 files changed, 27 insertions(+), 17 deletions(-) diff --git a/arch/arm/configs/msm7630-perf_defconfig b/arch/arm/configs/msm7630-perf_defconfig index 5b5240453c1..fb0f1069752 100644 --- a/arch/arm/configs/msm7630-perf_defconfig +++ b/arch/arm/configs/msm7630-perf_defconfig @@ -71,7 +71,7 @@ CONFIG_IP_PNP_DHCP=y # CONFIG_INET_XFRM_MODE_TUNNEL is not set # CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_LRO is not set -# CONFIG_INET_DIAG is not set +CONFIG_INET_DIAG=y CONFIG_IPV6=y CONFIG_IPV6_PRIVACY=y CONFIG_IPV6_ROUTER_PREF=y diff --git a/arch/arm/configs/msm7630_defconfig b/arch/arm/configs/msm7630_defconfig index 9ad0b5a96f8..cde40483140 100644 --- a/arch/arm/configs/msm7630_defconfig +++ b/arch/arm/configs/msm7630_defconfig @@ -70,7 +70,7 @@ CONFIG_IP_PNP_DHCP=y # CONFIG_INET_XFRM_MODE_TUNNEL is not set # CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_LRO is not set -# CONFIG_INET_DIAG is not set +CONFIG_INET_DIAG=y CONFIG_IPV6=y CONFIG_IPV6_PRIVACY=y CONFIG_IPV6_ROUTER_PREF=y diff --git a/arch/arm/configs/msm8660-perf_defconfig b/arch/arm/configs/msm8660-perf_defconfig index 0f41c0a983f..c9082f040dd 100644 --- a/arch/arm/configs/msm8660-perf_defconfig +++ b/arch/arm/configs/msm8660-perf_defconfig @@ -104,7 +104,7 @@ CONFIG_IP_PNP_DHCP=y # CONFIG_INET_XFRM_MODE_TUNNEL is not set # CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_LRO is not set -# CONFIG_INET_DIAG is not set +CONFIG_INET_DIAG=y CONFIG_IPV6=y CONFIG_IPV6_PRIVACY=y CONFIG_IPV6_ROUTER_PREF=y diff --git a/arch/arm/configs/msm8660_defconfig b/arch/arm/configs/msm8660_defconfig index e90006284c5..2569f827f2d 100644 --- a/arch/arm/configs/msm8660_defconfig +++ b/arch/arm/configs/msm8660_defconfig @@ -95,7 +95,7 @@ CONFIG_IP_PNP_DHCP=y # CONFIG_INET_XFRM_MODE_TUNNEL is not set # CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_LRO is not set -# CONFIG_INET_DIAG is not set +CONFIG_INET_DIAG=y CONFIG_IPV6=y CONFIG_IPV6_PRIVACY=y CONFIG_IPV6_ROUTER_PREF=y diff --git a/arch/arm/configs/msm8960_defconfig b/arch/arm/configs/msm8960_defconfig index 73d07562da1..12f946cc79c 100755 --- a/arch/arm/configs/msm8960_defconfig +++ b/arch/arm/configs/msm8960_defconfig @@ -97,7 +97,7 @@ CONFIG_IP_PNP_DHCP=y # CONFIG_INET_XFRM_MODE_TUNNEL is not set # CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_LRO is not set -# CONFIG_INET_DIAG is not set +CONFIG_INET_DIAG=y CONFIG_IPV6=y CONFIG_IPV6_PRIVACY=y CONFIG_IPV6_ROUTER_PREF=y diff --git a/include/linux/tcp.h b/include/linux/tcp.h index e64f4c67d0e..3cd86ea1f25 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -68,18 +68,18 @@ union tcp_word_hdr { #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) -enum { - TCP_FLAG_CWR = __cpu_to_be32(0x00800000), - TCP_FLAG_ECE = __cpu_to_be32(0x00400000), - TCP_FLAG_URG = __cpu_to_be32(0x00200000), - TCP_FLAG_ACK = __cpu_to_be32(0x00100000), - TCP_FLAG_PSH = __cpu_to_be32(0x00080000), - TCP_FLAG_RST = __cpu_to_be32(0x00040000), - TCP_FLAG_SYN = __cpu_to_be32(0x00020000), - TCP_FLAG_FIN = __cpu_to_be32(0x00010000), - TCP_RESERVED_BITS = __cpu_to_be32(0x0F000000), - TCP_DATA_OFFSET = __cpu_to_be32(0xF0000000) -}; +enum { + TCP_FLAG_CWR = __constant_htonl(0x00800000), + TCP_FLAG_ECE = __constant_htonl(0x00400000), + TCP_FLAG_URG = __constant_htonl(0x00200000), + TCP_FLAG_ACK = __constant_htonl(0x00100000), + TCP_FLAG_PSH = __constant_htonl(0x00080000), + TCP_FLAG_RST = __constant_htonl(0x00040000), + TCP_FLAG_SYN = __constant_htonl(0x00020000), + TCP_FLAG_FIN = __constant_htonl(0x00010000), + TCP_RESERVED_BITS = __constant_htonl(0x0F000000), + TCP_DATA_OFFSET = __constant_htonl(0xF0000000) +}; /* * TCP general constants @@ -134,6 +134,7 @@ struct tcp_info { __u8 tcpi_backoff; __u8 tcpi_options; __u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; + __u8 tcpi_count; __u32 tcpi_rto; __u32 tcpi_ato; diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index f2d98137778..e5f1113af8b 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2504,6 +2504,15 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) info->tcpi_rcv_space = tp->rcvq_space.space; info->tcpi_total_retrans = tp->total_retrans; + + /* + * Expose reference count for socket. + */ + if (NULL != sk->sk_socket) { + struct file *filep = sk->sk_socket->file; + if (NULL != filep) + info->tcpi_count = atomic_read(&filep->f_count); + } } EXPORT_SYMBOL_GPL(tcp_get_info);