From: Willem de Bruijn <willemb@google.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, eric.dumazet@gmail.com,
richardcochran@gomail.com, stephen@networkplumber.org,
Willem de Bruijn <willemb@google.com>
Subject: [PATCH net-next v2 6/8] net-timestamp: ENQ timestamp on enqueue to traffic shaping layer
Date: Thu, 3 Jul 2014 15:39:38 -0400 [thread overview]
Message-ID: <1404416380-3545-7-git-send-email-willemb@google.com> (raw)
In-Reply-To: <1404416380-3545-1-git-send-email-willemb@google.com>
Kernel transmit latency is often incurred in the traffic shaping
layer. This patch adds a new timestamp on transmission just before
entering traffic shaping. When data travels through multiple devices
(bonding, tunneling, ...) each device will export an individual
timestamp.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
include/linux/skbuff.h | 8 +++++++-
include/linux/socket.h | 3 ++-
net/core/dev.c | 4 ++++
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 0205184..ec76556 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -260,9 +260,13 @@ enum {
SKBTX_SHARED_FRAG = 1 << 5,
SKBTX_ACK_TSTAMP = 1 << 6,
+
+ SKBTX_ENQ_TSTAMP = 1 << 7,
};
-#define SKBTX_ANY_SW_TSTAMP (SKBTX_SW_TSTAMP | SKBTX_ACK_TSTAMP)
+#define SKBTX_ANY_SW_TSTAMP (SKBTX_SW_TSTAMP | \
+ SKBTX_ACK_TSTAMP | \
+ SKBTX_ENQ_TSTAMP)
#define SKBTX_ANY_TSTAMP (SKBTX_HW_TSTAMP | SKBTX_ANY_SW_TSTAMP)
/*
@@ -2754,6 +2758,8 @@ static inline u8 skbflags_tx_tstamp(int flags)
tx_flags |= SKBTX_SW_TSTAMP;
if (flags & MSG_TSTAMP_ACK)
tx_flags |= SKBTX_ACK_TSTAMP;
+ if (flags & MSG_TSTAMP_ENQ)
+ tx_flags |= SKBTX_ENQ_TSTAMP;
}
return tx_flags;
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 68d5f48..6d21582 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -255,7 +255,8 @@ struct ucred {
#define MSG_SENDPAGE_NOTLAST 0x20000 /* sendpage() internal : not the last page */
#define MSG_TSTAMP 0x100000
#define MSG_TSTAMP_ACK 0x200000
-#define MSG_TSTAMP_MASK (MSG_TSTAMP | MSG_TSTAMP_ACK)
+#define MSG_TSTAMP_ENQ 0x400000
+#define MSG_TSTAMP_MASK (MSG_TSTAMP | MSG_TSTAMP_ACK | MSG_TSTAMP_ENQ)
#define MSG_EOF MSG_FIN
#define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */
diff --git a/net/core/dev.c b/net/core/dev.c
index 6e2a2cd..b710213f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -132,6 +132,7 @@
#include <linux/hashtable.h>
#include <linux/vmalloc.h>
#include <linux/if_macvlan.h>
+#include <linux/errqueue.h>
#include "net-sysfs.h"
@@ -2859,6 +2860,9 @@ static int __dev_queue_xmit(struct sk_buff *skb, void *accel_priv)
skb_reset_mac_header(skb);
+ if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_ENQ_TSTAMP))
+ __skb_tstamp_tx(skb, NULL, skb->sk, SCM_TSTAMP_ENQ);
+
/* Disable soft irqs for various locks below. Also
* stops preemption for RCU.
*/
--
2.0.0.526.g5318336
next prev parent reply other threads:[~2014-07-03 19:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-03 19:39 net-timestamp: MSG_TSTAMP flags and bytestream support Willem de Bruijn
2014-07-03 19:39 ` [PATCH net-next v2 1/8] net-timestamp: explicit SO_TIMESTAMPING ancillary data struct Willem de Bruijn
2014-07-05 20:10 ` Richard Cochran
2014-07-18 15:54 ` Willem de Bruijn
2014-07-05 20:18 ` Richard Cochran
2014-07-07 15:34 ` Willem de Bruijn
2014-07-07 18:47 ` Richard Cochran
2014-07-07 19:14 ` Willem de Bruijn
2014-07-07 19:44 ` Chad Reese
2014-07-07 20:11 ` Richard Cochran
2014-07-07 21:03 ` Chad Reese
2014-07-08 6:04 ` Richard Cochran
2014-07-08 7:42 ` Chad Reese
2014-07-08 9:41 ` Richard Cochran
2014-07-10 15:36 ` Willem de Bruijn
2014-07-07 20:18 ` Richard Cochran
2014-07-07 21:08 ` Chad Reese
2014-07-08 5:49 ` Richard Cochran
2014-07-08 6:08 ` Richard Cochran
2014-07-03 19:39 ` [PATCH net-next v2 2/8] net-timestamp: MSG_TSTAMP one-shot tx timestamps Willem de Bruijn
2014-07-03 19:39 ` [PATCH net-next v2 3/8] net-timestamp: tx timestamp without payload Willem de Bruijn
2014-07-03 19:39 ` [PATCH net-next v2 4/8] net-timestamp: TCP timestamping Willem de Bruijn
2014-07-03 19:39 ` [PATCH net-next v2 5/8] net-timestamp: ACK timestamp for bytestreams Willem de Bruijn
2014-07-03 19:39 ` Willem de Bruijn [this message]
2014-07-03 19:39 ` [PATCH net-next v2 7/8] net-timestamp: expand documentation Willem de Bruijn
2014-07-05 20:14 ` Richard Cochran
2014-07-07 15:40 ` Willem de Bruijn
2014-07-03 19:39 ` [PATCH net-next v2 8/8] net-timestamp: SOCK_RAW and PING timestamping Willem de Bruijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1404416380-3545-7-git-send-email-willemb@google.com \
--to=willemb@google.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gomail.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).