aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-04-28 15:14:43 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-30 19:29:42 -0400
commit767dd03369ac18af58efdef0383d6eb986eab426 (patch)
tree5af8a861110676a084078a168c27fd3935d41f13 /include/net/sock.h
parent21851264120b0bd1f953328cb131abcfa9305bc3 (diff)
net: speedup sock_recv_ts_and_drops()
sock_recv_ts_and_drops() is fat and slow (~ 4% of cpu time on some profiles) We can test all socket flags at once to make fast path fast again. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index d361c7769fe0..e1777db5b9ab 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1635,7 +1635,24 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1635 sk->sk_stamp = kt; 1635 sk->sk_stamp = kt;
1636} 1636}
1637 1637
1638extern void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb); 1638extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
1639 struct sk_buff *skb);
1640
1641static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
1642 struct sk_buff *skb)
1643{
1644#define FLAGS_TS_OR_DROPS ((1UL << SOCK_RXQ_OVFL) | \
1645 (1UL << SOCK_RCVTSTAMP) | \
1646 (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE) | \
1647 (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \
1648 (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \
1649 (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE))
1650
1651 if (sk->sk_flags & FLAGS_TS_OR_DROPS)
1652 __sock_recv_ts_and_drops(msg, sk, skb);
1653 else
1654 sk->sk_stamp = skb->tstamp;
1655}
1639 1656
1640/** 1657/**
1641 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped 1658 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped