[DCCP]: Uninline some functions
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5e0817f84c
commit
c25a18ba34
5 changed files with 63 additions and 57 deletions
|
@ -46,7 +46,7 @@
|
||||||
* Reason for maths here is to avoid 32 bit overflow when a is big.
|
* Reason for maths here is to avoid 32 bit overflow when a is big.
|
||||||
* With this we get close to the limit.
|
* With this we get close to the limit.
|
||||||
*/
|
*/
|
||||||
static inline u32 usecs_div(const u32 a, const u32 b)
|
static u32 usecs_div(const u32 a, const u32 b)
|
||||||
{
|
{
|
||||||
const u32 div = a < (UINT_MAX / (USEC_PER_SEC / 10)) ? 10 :
|
const u32 div = a < (UINT_MAX / (USEC_PER_SEC / 10)) ? 10 :
|
||||||
a < (UINT_MAX / (USEC_PER_SEC / 50)) ? 50 :
|
a < (UINT_MAX / (USEC_PER_SEC / 50)) ? 50 :
|
||||||
|
@ -98,7 +98,7 @@ static const char *ccid3_tx_state_name(enum ccid3_hc_tx_states state)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void ccid3_hc_tx_set_state(struct sock *sk,
|
static void ccid3_hc_tx_set_state(struct sock *sk,
|
||||||
enum ccid3_hc_tx_states state)
|
enum ccid3_hc_tx_states state)
|
||||||
{
|
{
|
||||||
struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
|
struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
|
||||||
|
@ -708,7 +708,7 @@ static const char *ccid3_rx_state_name(enum ccid3_hc_rx_states state)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void ccid3_hc_rx_set_state(struct sock *sk,
|
static void ccid3_hc_rx_set_state(struct sock *sk,
|
||||||
enum ccid3_hc_rx_states state)
|
enum ccid3_hc_rx_states state)
|
||||||
{
|
{
|
||||||
struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
|
struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
|
||||||
|
|
|
@ -138,53 +138,8 @@ extern unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu);
|
||||||
extern const char *dccp_packet_name(const int type);
|
extern const char *dccp_packet_name(const int type);
|
||||||
extern const char *dccp_state_name(const int state);
|
extern const char *dccp_state_name(const int state);
|
||||||
|
|
||||||
static inline void dccp_set_state(struct sock *sk, const int state)
|
extern void dccp_set_state(struct sock *sk, const int state);
|
||||||
{
|
extern void dccp_done(struct sock *sk);
|
||||||
const int oldstate = sk->sk_state;
|
|
||||||
|
|
||||||
dccp_pr_debug("%s(%p) %-10.10s -> %s\n",
|
|
||||||
dccp_role(sk), sk,
|
|
||||||
dccp_state_name(oldstate), dccp_state_name(state));
|
|
||||||
WARN_ON(state == oldstate);
|
|
||||||
|
|
||||||
switch (state) {
|
|
||||||
case DCCP_OPEN:
|
|
||||||
if (oldstate != DCCP_OPEN)
|
|
||||||
DCCP_INC_STATS(DCCP_MIB_CURRESTAB);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DCCP_CLOSED:
|
|
||||||
if (oldstate == DCCP_CLOSING || oldstate == DCCP_OPEN)
|
|
||||||
DCCP_INC_STATS(DCCP_MIB_ESTABRESETS);
|
|
||||||
|
|
||||||
sk->sk_prot->unhash(sk);
|
|
||||||
if (inet_csk(sk)->icsk_bind_hash != NULL &&
|
|
||||||
!(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
|
|
||||||
inet_put_port(&dccp_hashinfo, sk);
|
|
||||||
/* fall through */
|
|
||||||
default:
|
|
||||||
if (oldstate == DCCP_OPEN)
|
|
||||||
DCCP_DEC_STATS(DCCP_MIB_CURRESTAB);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Change state AFTER socket is unhashed to avoid closed
|
|
||||||
* socket sitting in hash tables.
|
|
||||||
*/
|
|
||||||
sk->sk_state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void dccp_done(struct sock *sk)
|
|
||||||
{
|
|
||||||
dccp_set_state(sk, DCCP_CLOSED);
|
|
||||||
dccp_clear_xmit_timers(sk);
|
|
||||||
|
|
||||||
sk->sk_shutdown = SHUTDOWN_MASK;
|
|
||||||
|
|
||||||
if (!sock_flag(sk, SOCK_DEAD))
|
|
||||||
sk->sk_state_change(sk);
|
|
||||||
else
|
|
||||||
inet_csk_destroy_sock(sk);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void dccp_openreq_init(struct request_sock *req,
|
static inline void dccp_openreq_init(struct request_sock *req,
|
||||||
struct dccp_sock *dp,
|
struct dccp_sock *dp,
|
||||||
|
|
|
@ -56,7 +56,7 @@ static void dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb)
|
||||||
dccp_send_close(sk, 0);
|
dccp_send_close(sk, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb)
|
static void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct dccp_sock *dp = dccp_sk(sk);
|
struct dccp_sock *dp = dccp_sk(sk);
|
||||||
|
|
||||||
|
@ -151,9 +151,8 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
|
static int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
|
||||||
const struct dccp_hdr *dh,
|
const struct dccp_hdr *dh, const unsigned len)
|
||||||
const unsigned len)
|
|
||||||
{
|
{
|
||||||
struct dccp_sock *dp = dccp_sk(sk);
|
struct dccp_sock *dp = dccp_sk(sk);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ static inline void dccp_event_ack_sent(struct sock *sk)
|
||||||
inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
|
inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void dccp_skb_entail(struct sock *sk, struct sk_buff *skb)
|
static void dccp_skb_entail(struct sock *sk, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
skb_set_owner_w(skb, sk);
|
skb_set_owner_w(skb, sk);
|
||||||
WARN_ON(sk->sk_send_head);
|
WARN_ON(sk->sk_send_head);
|
||||||
|
|
|
@ -53,6 +53,58 @@ struct inet_hashinfo __cacheline_aligned dccp_hashinfo = {
|
||||||
|
|
||||||
EXPORT_SYMBOL_GPL(dccp_hashinfo);
|
EXPORT_SYMBOL_GPL(dccp_hashinfo);
|
||||||
|
|
||||||
|
void dccp_set_state(struct sock *sk, const int state)
|
||||||
|
{
|
||||||
|
const int oldstate = sk->sk_state;
|
||||||
|
|
||||||
|
dccp_pr_debug("%s(%p) %-10.10s -> %s\n",
|
||||||
|
dccp_role(sk), sk,
|
||||||
|
dccp_state_name(oldstate), dccp_state_name(state));
|
||||||
|
WARN_ON(state == oldstate);
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case DCCP_OPEN:
|
||||||
|
if (oldstate != DCCP_OPEN)
|
||||||
|
DCCP_INC_STATS(DCCP_MIB_CURRESTAB);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DCCP_CLOSED:
|
||||||
|
if (oldstate == DCCP_CLOSING || oldstate == DCCP_OPEN)
|
||||||
|
DCCP_INC_STATS(DCCP_MIB_ESTABRESETS);
|
||||||
|
|
||||||
|
sk->sk_prot->unhash(sk);
|
||||||
|
if (inet_csk(sk)->icsk_bind_hash != NULL &&
|
||||||
|
!(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
|
||||||
|
inet_put_port(&dccp_hashinfo, sk);
|
||||||
|
/* fall through */
|
||||||
|
default:
|
||||||
|
if (oldstate == DCCP_OPEN)
|
||||||
|
DCCP_DEC_STATS(DCCP_MIB_CURRESTAB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Change state AFTER socket is unhashed to avoid closed
|
||||||
|
* socket sitting in hash tables.
|
||||||
|
*/
|
||||||
|
sk->sk_state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT_SYMBOL_GPL(dccp_set_state);
|
||||||
|
|
||||||
|
void dccp_done(struct sock *sk)
|
||||||
|
{
|
||||||
|
dccp_set_state(sk, DCCP_CLOSED);
|
||||||
|
dccp_clear_xmit_timers(sk);
|
||||||
|
|
||||||
|
sk->sk_shutdown = SHUTDOWN_MASK;
|
||||||
|
|
||||||
|
if (!sock_flag(sk, SOCK_DEAD))
|
||||||
|
sk->sk_state_change(sk);
|
||||||
|
else
|
||||||
|
inet_csk_destroy_sock(sk);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT_SYMBOL_GPL(dccp_done);
|
||||||
|
|
||||||
const char *dccp_packet_name(const int type)
|
const char *dccp_packet_name(const int type)
|
||||||
{
|
{
|
||||||
static const char *dccp_packet_names[] = {
|
static const char *dccp_packet_names[] = {
|
||||||
|
|
Loading…
Reference in a new issue