You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2015/09/16 00:28:12 UTC

trafficserver git commit: TS-2520: Add TCP fastopen support for incoming TCP connections

Repository: trafficserver
Updated Branches:
  refs/heads/master 6bc07de95 -> bf90e9b7c


TS-2520: Add TCP fastopen support for incoming TCP connections


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/bf90e9b7
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/bf90e9b7
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/bf90e9b7

Branch: refs/heads/master
Commit: bf90e9b7c9647e4f94704d87f9670f52ff1b2006
Parents: 6bc07de
Author: Bryan Call <bc...@apache.org>
Authored: Tue Sep 15 15:26:48 2015 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Tue Sep 15 15:26:48 2015 -0700

----------------------------------------------------------------------
 iocore/net/Connection.cc      | 12 +++++++++++-
 iocore/net/I_NetVConnection.h |  2 ++
 mgmt/RecordsConfig.cc         |  2 ++
 3 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bf90e9b7/iocore/net/Connection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/Connection.cc b/iocore/net/Connection.cc
index 4f11e45..2c9dce8 100644
--- a/iocore/net/Connection.cc
+++ b/iocore/net/Connection.cc
@@ -154,8 +154,11 @@ int
 Server::setup_fd_for_listen(bool non_blocking, int recv_bufsize, int send_bufsize, bool transparent)
 {
   int res = 0;
-  int sockopt_flag_in;
+  int sockopt_flag_in = 0;
+  int tfo_queue_length = 0;
+
   REC_ReadConfigInteger(sockopt_flag_in, "proxy.config.net.sock_option_flag_in");
+  REC_ReadConfigInteger(tfo_queue_length, "proxy.config.net.sock_option_tcp_fastopen_queue_length");
 
   ink_assert(fd != NO_FD);
 
@@ -244,6 +247,13 @@ Server::setup_fd_for_listen(bool non_blocking, int recv_bufsize, int send_bufsiz
     goto Lerror;
   }
 
+#ifdef TCP_FASTOPEN
+  if ((sockopt_flag_in & NetVCOptions::SOCK_OPT_TCP_FAST_OPEN) &&
+      (res = safe_setsockopt(fd, SOL_TCP, TCP_FASTOPEN, (char*)&tfo_queue_length, sizeof(int)))) {
+    goto Lerror;
+  }
+#endif
+
   if (transparent) {
 #if TS_USE_TPROXY
     Debug("http_tproxy", "Listen port inbound transparency enabled.\n");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bf90e9b7/iocore/net/I_NetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_NetVConnection.h b/iocore/net/I_NetVConnection.h
index 39e8d4d..79e2dac 100644
--- a/iocore/net/I_NetVConnection.h
+++ b/iocore/net/I_NetVConnection.h
@@ -156,6 +156,8 @@ struct NetVCOptions {
   static uint32_t const SOCK_OPT_KEEP_ALIVE = 2;
   /// Value for linger on for @c sockopt_flags
   static uint32_t const SOCK_OPT_LINGER_ON = 4;
+  /// Value for TCP Fast open @c sockopt_flags
+  static uint32_t const SOCK_OPT_TCP_FAST_OPEN = 8;
 
   uint32_t packet_mark;
   uint32_t packet_tos;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bf90e9b7/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index dd85b6c..2a592ee 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -838,6 +838,8 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.net.throttle_delay", RECD_INT, "50", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.net.sock_option_tcp_fastopen_queue_length", RECD_INT, "10000", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
 
   //##############################################################################
   //#