aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dccp/ccids/ccid3.c10
-rw-r--r--net/dccp/dccp.h49
-rw-r--r--net/dccp/input.c7
-rw-r--r--net/dccp/output.c2
-rw-r--r--net/dccp/proto.c52
5 files changed, 63 insertions, 57 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 86201631fb6e..ff6a0d7076ef 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -46,7 +46,7 @@
46 * Reason for maths here is to avoid 32 bit overflow when a is big. 46 * Reason for maths here is to avoid 32 bit overflow when a is big.
47 * With this we get close to the limit. 47 * With this we get close to the limit.
48 */ 48 */
49static inline u32 usecs_div(const u32 a, const u32 b) 49static u32 usecs_div(const u32 a, const u32 b)
50{ 50{
51 const u32 div = a < (UINT_MAX / (USEC_PER_SEC / 10)) ? 10 : 51 const u32 div = a < (UINT_MAX / (USEC_PER_SEC / 10)) ? 10 :
52 a < (UINT_MAX / (USEC_PER_SEC / 50)) ? 50 : 52 a < (UINT_MAX / (USEC_PER_SEC / 50)) ? 50 :
@@ -98,8 +98,8 @@ static const char *ccid3_tx_state_name(enum ccid3_hc_tx_states state)
98} 98}
99#endif 99#endif
100 100
101static inline void ccid3_hc_tx_set_state(struct sock *sk, 101static void ccid3_hc_tx_set_state(struct sock *sk,
102 enum ccid3_hc_tx_states state) 102 enum ccid3_hc_tx_states state)
103{ 103{
104 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 104 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
105 enum ccid3_hc_tx_states oldstate = hctx->ccid3hctx_state; 105 enum ccid3_hc_tx_states oldstate = hctx->ccid3hctx_state;
@@ -708,8 +708,8 @@ static const char *ccid3_rx_state_name(enum ccid3_hc_rx_states state)
708} 708}
709#endif 709#endif
710 710
711static inline void ccid3_hc_rx_set_state(struct sock *sk, 711static void ccid3_hc_rx_set_state(struct sock *sk,
712 enum ccid3_hc_rx_states state) 712 enum ccid3_hc_rx_states state)
713{ 713{
714 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); 714 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
715 enum ccid3_hc_rx_states oldstate = hcrx->ccid3hcrx_state; 715 enum ccid3_hc_rx_states oldstate = hcrx->ccid3hcrx_state;
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 46aa4814d65f..6fcc9d47ae8c 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -138,53 +138,8 @@ extern unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu);
138extern const char *dccp_packet_name(const int type); 138extern const char *dccp_packet_name(const int type);
139extern const char *dccp_state_name(const int state); 139extern const char *dccp_state_name(const int state);
140 140
141static inline void dccp_set_state(struct sock *sk, const int state) 141extern void dccp_set_state(struct sock *sk, const int state);
142{ 142extern void dccp_done(struct sock *sk);
143 const int oldstate = sk->sk_state;
144
145 dccp_pr_debug("%s(%p) %-10.10s -> %s\n",
146 dccp_role(sk), sk,
147 dccp_state_name(oldstate), dccp_state_name(state));
148 WARN_ON(state == oldstate);
149
150 switch (state) {
151 case DCCP_OPEN:
152 if (oldstate != DCCP_OPEN)
153 DCCP_INC_STATS(DCCP_MIB_CURRESTAB);
154 break;
155
156 case DCCP_CLOSED:
157 if (oldstate == DCCP_CLOSING || oldstate == DCCP_OPEN)
158 DCCP_INC_STATS(DCCP_MIB_ESTABRESETS);
159
160 sk->sk_prot->unhash(sk);
161 if (inet_csk(sk)->icsk_bind_hash != NULL &&
162 !(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
163 inet_put_port(&dccp_hashinfo, sk);
164 /* fall through */
165 default:
166 if (oldstate == DCCP_OPEN)
167 DCCP_DEC_STATS(DCCP_MIB_CURRESTAB);
168 }
169
170 /* Change state AFTER socket is unhashed to avoid closed
171 * socket sitting in hash tables.
172 */
173 sk->sk_state = state;
174}
175
176static inline void dccp_done(struct sock *sk)
177{
178 dccp_set_state(sk, DCCP_CLOSED);
179 dccp_clear_xmit_timers(sk);
180
181 sk->sk_shutdown = SHUTDOWN_MASK;
182
183 if (!sock_flag(sk, SOCK_DEAD))
184 sk->sk_state_change(sk);
185 else
186 inet_csk_destroy_sock(sk);
187}
188 143
189static inline void dccp_openreq_init(struct request_sock *req, 144static inline void dccp_openreq_init(struct request_sock *req,
190 struct dccp_sock *dp, 145 struct dccp_sock *dp,
diff --git a/net/dccp/input.c b/net/dccp/input.c
index eac5178ce515..f53e3fc77262 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -56,7 +56,7 @@ static void dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb)
56 dccp_send_close(sk, 0); 56 dccp_send_close(sk, 0);
57} 57}
58 58
59static inline void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb) 59static void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb)
60{ 60{
61 struct dccp_sock *dp = dccp_sk(sk); 61 struct dccp_sock *dp = dccp_sk(sk);
62 62
@@ -151,9 +151,8 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
151 return 0; 151 return 0;
152} 152}
153 153
154static inline int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb, 154static int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
155 const struct dccp_hdr *dh, 155 const struct dccp_hdr *dh, const unsigned len)
156 const unsigned len)
157{ 156{
158 struct dccp_sock *dp = dccp_sk(sk); 157 struct dccp_sock *dp = dccp_sk(sk);
159 158
diff --git a/net/dccp/output.c b/net/dccp/output.c
index 8c83aa51572e..6f3a5f02a39a 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -27,7 +27,7 @@ static inline void dccp_event_ack_sent(struct sock *sk)
27 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); 27 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
28} 28}
29 29
30static inline void dccp_skb_entail(struct sock *sk, struct sk_buff *skb) 30static void dccp_skb_entail(struct sock *sk, struct sk_buff *skb)
31{ 31{
32 skb_set_owner_w(skb, sk); 32 skb_set_owner_w(skb, sk);
33 WARN_ON(sk->sk_send_head); 33 WARN_ON(sk->sk_send_head);
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index ef94b0c8a0c0..f644c1a23c4d 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -53,6 +53,58 @@ struct inet_hashinfo __cacheline_aligned dccp_hashinfo = {
53 53
54EXPORT_SYMBOL_GPL(dccp_hashinfo); 54EXPORT_SYMBOL_GPL(dccp_hashinfo);
55 55
56void dccp_set_state(struct sock *sk, const int state)
57{
58 const int oldstate = sk->sk_state;
59
60 dccp_pr_debug("%s(%p) %-10.10s -> %s\n",
61 dccp_role(sk), sk,
62 dccp_state_name(oldstate), dccp_state_name(state));
63 WARN_ON(state == oldstate);
64
65 switch (state) {
66 case DCCP_OPEN:
67 if (oldstate != DCCP_OPEN)
68 DCCP_INC_STATS(DCCP_MIB_CURRESTAB);
69 break;
70
71 case DCCP_CLOSED:
72 if (oldstate == DCCP_CLOSING || oldstate == DCCP_OPEN)
73 DCCP_INC_STATS(DCCP_MIB_ESTABRESETS);
74
75 sk->sk_prot->unhash(sk);
76 if (inet_csk(sk)->icsk_bind_hash != NULL &&
77 !(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
78 inet_put_port(&dccp_hashinfo, sk);
79 /* fall through */
80 default:
81 if (oldstate == DCCP_OPEN)
82 DCCP_DEC_STATS(DCCP_MIB_CURRESTAB);
83 }
84
85 /* Change state AFTER socket is unhashed to avoid closed
86 * socket sitting in hash tables.
87 */
88 sk->sk_state = state;
89}
90
91EXPORT_SYMBOL_GPL(dccp_set_state);
92
93void dccp_done(struct sock *sk)
94{
95 dccp_set_state(sk, DCCP_CLOSED);
96 dccp_clear_xmit_timers(sk);
97
98 sk->sk_shutdown = SHUTDOWN_MASK;
99
100 if (!sock_flag(sk, SOCK_DEAD))
101 sk->sk_state_change(sk);
102 else
103 inet_csk_destroy_sock(sk);
104}
105
106EXPORT_SYMBOL_GPL(dccp_done);
107
56const char *dccp_packet_name(const int type) 108const char *dccp_packet_name(const int type)
57{ 109{
58 static const char *dccp_packet_names[] = { 110 static const char *dccp_packet_names[] = {