* [PATCH net-next v2] net-timestamp: optimize sock_tx_timestamp default path
@ 2014-09-08 23:58 Willem de Bruijn
2014-09-10 0:35 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Willem de Bruijn @ 2014-09-08 23:58 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet, richardcochran, Willem de Bruijn
Few packets have timestamping enabled. Exit sock_tx_timestamp quickly
in this common case.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
include/net/sock.h | 10 +++++++++-
net/socket.c | 7 ++-----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 049ab1b..515a4d0 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2199,6 +2199,8 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
sk->sk_stamp = skb->tstamp;
}
+void __sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags);
+
/**
* sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
* @sk: socket sending this packet
@@ -2206,7 +2208,13 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
*
* Note : callers should take care of initial *tx_flags value (usually 0)
*/
-void sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags);
+static inline void sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags)
+{
+ if (unlikely(sk->sk_tsflags))
+ __sock_tx_timestamp(sk, tx_flags);
+ if (unlikely(sock_flag(sk, SOCK_WIFI_STATUS)))
+ *tx_flags |= SKBTX_WIFI_STATUS;
+}
/**
* sk_eat_skb - Release a skb if it is no longer needed
diff --git a/net/socket.c b/net/socket.c
index 2e2586e..d40f522 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -610,7 +610,7 @@ void sock_release(struct socket *sock)
}
EXPORT_SYMBOL(sock_release);
-void sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags)
+void __sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags)
{
u8 flags = *tx_flags;
@@ -626,12 +626,9 @@ void sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags)
if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_ACK)
flags |= SKBTX_ACK_TSTAMP;
- if (sock_flag(sk, SOCK_WIFI_STATUS))
- flags |= SKBTX_WIFI_STATUS;
-
*tx_flags = flags;
}
-EXPORT_SYMBOL(sock_tx_timestamp);
+EXPORT_SYMBOL(__sock_tx_timestamp);
static inline int __sock_sendmsg_nosec(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t size)
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next v2] net-timestamp: optimize sock_tx_timestamp default path
2014-09-08 23:58 [PATCH net-next v2] net-timestamp: optimize sock_tx_timestamp default path Willem de Bruijn
@ 2014-09-10 0:35 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-09-10 0:35 UTC (permalink / raw)
To: willemb; +Cc: netdev, eric.dumazet, richardcochran
From: Willem de Bruijn <willemb@google.com>
Date: Mon, 8 Sep 2014 19:58:58 -0400
> Few packets have timestamping enabled. Exit sock_tx_timestamp quickly
> in this common case.
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-10 0:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-08 23:58 [PATCH net-next v2] net-timestamp: optimize sock_tx_timestamp default path Willem de Bruijn
2014-09-10 0:35 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).