You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/08/23 02:29:16 UTC

[trafficserver] branch quic-latest updated (49f8be8 -> 33772c8)

This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


    from 49f8be8  Check frame size when AckFrameCreator/AltConnectionManager/PathValidator generate frame
     new 7dadd68  Make QUICFlowController derived class from QUICFrameGenerator
     new f422468  Fix typo
     new 33772c8  Cleanup: Remove tricky QUICNetVConnection::_store_frame()

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 iocore/net/P_QUICNetVConnection.h               |  2 -
 iocore/net/QUICNetVConnection.cc                | 80 +++----------------------
 iocore/net/quic/QUICFlowController.cc           | 20 ++++++-
 iocore/net/quic/QUICFlowController.h            |  7 ++-
 iocore/net/quic/QUICStream.cc                   |  4 +-
 iocore/net/quic/test/test_QUICFlowController.cc |  6 +-
 6 files changed, 36 insertions(+), 83 deletions(-)


[trafficserver] 02/03: Fix typo

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit f422468a9b4288c8264803f0327c096e06ca6994
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Thu Aug 23 11:02:17 2018 +0900

    Fix typo
---
 iocore/net/QUICNetVConnection.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 8562d5c..3b9884c 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -63,7 +63,7 @@ static constexpr uint32_t MAX_STREAM_FRAME_OVERHEAD = 24;
 // static constexpr uint32_t MAX_CRYPTO_FRAME_OVERHEAD   = 16;
 static constexpr uint32_t MINIMUM_INITIAL_PACKET_SIZE = 1200;
 static constexpr ink_hrtime WRITE_READY_INTERVAL      = HRTIME_MSECONDS(20);
-static constexpr uint32_t PACKET_PRE_EVENT            = 32;
+static constexpr uint32_t PACKET_PER_EVENT            = 32;
 
 static constexpr uint32_t MAX_PACKETS_WITHOUT_SRC_ADDR_VARIDATION = 3;
 
@@ -1083,7 +1083,7 @@ QUICNetVConnection::_state_common_send_packet()
 {
   uint32_t packet_count = 0;
   uint32_t error        = 0;
-  while (error == 0 && packet_count < PACKET_PRE_EVENT) {
+  while (error == 0 && packet_count < PACKET_PER_EVENT) {
     uint32_t window = this->_congestion_controller->open_window();
 
     if (window == 0) {


[trafficserver] 01/03: Make QUICFlowController derived class from QUICFrameGenerator

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 7dadd68544e117f80ea09ab98c15179011880528
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Thu Aug 23 11:01:56 2018 +0900

    Make QUICFlowController derived class from QUICFrameGenerator
---
 iocore/net/quic/QUICFlowController.cc           | 20 ++++++++++++++++++--
 iocore/net/quic/QUICFlowController.h            |  7 +++++--
 iocore/net/quic/QUICStream.cc                   |  4 ++--
 iocore/net/quic/test/test_QUICFlowController.cc |  6 +++---
 4 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/iocore/net/quic/QUICFlowController.cc b/iocore/net/quic/QUICFlowController.cc
index c833aa6..57357f1 100644
--- a/iocore/net/quic/QUICFlowController.cc
+++ b/iocore/net/quic/QUICFlowController.cc
@@ -100,14 +100,30 @@ QUICFlowController::set_limit(QUICOffset limit)
   this->_limit = limit;
 }
 
+bool
+QUICFlowController::will_generate_frame(QUICEncryptionLevel level)
+{
+  if (!this->_is_level_matched(level)) {
+    return false;
+  }
+
+  return this->_frame != nullptr;
+}
+
 QUICFrameUPtr
-QUICFlowController::generate_frame()
+QUICFlowController::generate_frame(QUICEncryptionLevel level, uint64_t connection_credit, uint16_t maximum_frame_size)
 {
   QUICFrameUPtr frame = QUICFrameFactory::create_null_frame();
-  if (this->_frame) {
+
+  if (!this->_is_level_matched(level)) {
+    return frame;
+  }
+
+  if (this->_frame && this->_frame->size() <= maximum_frame_size) {
     frame        = std::move(this->_frame);
     this->_frame = nullptr;
   }
+
   return frame;
 }
 
diff --git a/iocore/net/quic/QUICFlowController.h b/iocore/net/quic/QUICFlowController.h
index bc4a91a..8f9e387 100644
--- a/iocore/net/quic/QUICFlowController.h
+++ b/iocore/net/quic/QUICFlowController.h
@@ -26,6 +26,7 @@
 #include "../../eventsystem/I_EventSystem.h"
 #include "QUICTypes.h"
 #include "QUICFrame.h"
+#include "QUICFrameGenerator.h"
 #include "QUICLossDetector.h"
 
 class QUICRateAnalyzer
@@ -39,7 +40,7 @@ private:
   ink_hrtime _start_time = Thread::get_hrtime();
 };
 
-class QUICFlowController
+class QUICFlowController : public QUICFrameGenerator
 {
 public:
   uint64_t credit();
@@ -60,7 +61,9 @@ public:
    */
   void set_limit(QUICOffset limit);
 
-  QUICFrameUPtr generate_frame();
+  // QUICFrameGenerator
+  bool will_generate_frame(QUICEncryptionLevel level) override;
+  QUICFrameUPtr generate_frame(QUICEncryptionLevel level, uint64_t connection_credit, uint16_t maximum_frame_size) override;
 
 protected:
   QUICFlowController(uint64_t initial_limit) : _limit(initial_limit) {}
diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index 1965760..ff38147 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -398,7 +398,7 @@ QUICStream::generate_frame(QUICEncryptionLevel level, uint64_t connection_credit
   }
 
   QUICFrameUPtr frame = QUICFrameFactory::create_null_frame();
-  frame               = this->_local_flow_controller.generate_frame();
+  frame               = this->_local_flow_controller.generate_frame(level, connection_credit, maximum_frame_size);
   if (frame) {
     return frame;
   }
@@ -449,7 +449,7 @@ QUICStream::generate_frame(QUICEncryptionLevel level, uint64_t connection_credit
     this->_state.update_with_sending_frame(*frame);
   } else if (ret != 0) {
     QUICStreamDebug("Flow Controller blocked sending a STREAM frame");
-    frame = this->_remote_flow_controller.generate_frame();
+    frame = this->_remote_flow_controller.generate_frame(level, connection_credit, maximum_frame_size);
   }
   return frame;
 }
diff --git a/iocore/net/quic/test/test_QUICFlowController.cc b/iocore/net/quic/test/test_QUICFlowController.cc
index c52b8b2..0d8749c 100644
--- a/iocore/net/quic/test/test_QUICFlowController.cc
+++ b/iocore/net/quic/test/test_QUICFlowController.cc
@@ -97,7 +97,7 @@ TEST_CASE("QUICFlowController_Local_Connection", "[quic]")
   fc.forward_limit(2048);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 2048);
-  QUICFrameUPtr frame = fc.generate_frame();
+  QUICFrameUPtr frame = fc.generate_frame(QUICEncryptionLevel::ONE_RTT, 0, 1024);
   CHECK(frame);
   CHECK(frame->type() == QUICFrameType::MAX_DATA);
 
@@ -148,7 +148,7 @@ TEST_CASE("QUICFlowController_Remote_Connection", "[quic]")
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 1024);
   CHECK(ret != 0);
-  QUICFrameUPtr frame = fc.generate_frame();
+  QUICFrameUPtr frame = fc.generate_frame(QUICEncryptionLevel::ONE_RTT, 0, 1024);
   CHECK(frame);
   CHECK(frame->type() == QUICFrameType::BLOCKED);
 
@@ -211,7 +211,7 @@ TEST_CASE("QUICFlowController_Local_Stream", "[quic]")
   fc.forward_limit(2048);
   CHECK(fc.current_offset() == 1024);
   CHECK(fc.current_limit() == 2048);
-  QUICFrameUPtr frame = fc.generate_frame();
+  QUICFrameUPtr frame = fc.generate_frame(QUICEncryptionLevel::ONE_RTT, 0, 1024);
   CHECK(frame);
   CHECK(frame->type() == QUICFrameType::MAX_STREAM_DATA);
 


[trafficserver] 03/03: Cleanup: Remove tricky QUICNetVConnection::_store_frame()

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 33772c879267bab570eb89d183d24f23028b80ee
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Thu Aug 23 11:28:02 2018 +0900

    Cleanup: Remove tricky QUICNetVConnection::_store_frame()
    
    Which is used before draft-13.
---
 iocore/net/P_QUICNetVConnection.h |  2 --
 iocore/net/QUICNetVConnection.cc  | 76 ++++-----------------------------------
 2 files changed, 6 insertions(+), 72 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h
index 18bff60..27a3410 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -297,8 +297,6 @@ private:
 
   uint64_t _maximum_stream_frame_data_size();
   uint32_t _transmit_packet(QUICPacketUPtr packet);
-  void _store_frame(ats_unique_buf &buf, size_t &len, bool &retransmittable, QUICPacketType &current_packet_type,
-                    QUICFrameUPtr frame);
   void _store_frame(ats_unique_buf &buf, size_t &offset, uint64_t &max_frame_size, QUICFrameUPtr frame);
   QUICPacketUPtr _packetize_frames(QUICEncryptionLevel level, uint64_t max_packet_size);
   void _packetize_closing_frame();
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 3b9884c..750fa09 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -1194,71 +1194,6 @@ QUICNetVConnection::_state_closing_send_packet()
   return QUICErrorUPtr(new QUICNoError());
 }
 
-// Store frame data to buffer for packet. When remaining buffer is too small to store frame data or packet type is different from
-// previous one, build packet and transmit it. After that, allocate new buffer.
-void
-QUICNetVConnection::_store_frame(ats_unique_buf &buf, size_t &len, bool &retransmittable, QUICPacketType &current_packet_type,
-                                 QUICFrameUPtr frame)
-{
-  uint32_t max_size = this->maximum_quic_packet_size();
-
-  QUICPacketType previous_packet_type = current_packet_type;
-  QUICRetransmissionFrame *rf         = dynamic_cast<QUICRetransmissionFrame *>(frame.get());
-  if (rf) {
-    current_packet_type = rf->packet_type();
-  } else if (frame->is_protected()) {
-    current_packet_type = QUICPacketType::PROTECTED;
-  } else {
-    current_packet_type = QUICPacketType::UNINITIALIZED;
-  }
-
-  if (len + frame->size() + MAX_PACKET_OVERHEAD > max_size || (previous_packet_type != current_packet_type && len > 0)) {
-    this->_transmit_packet(this->_build_packet(std::move(buf), len, retransmittable, previous_packet_type));
-    retransmittable = false;
-    len             = 0;
-    buf             = nullptr;
-  }
-
-  retransmittable = retransmittable || (frame->type() != QUICFrameType::ACK && frame->type() != QUICFrameType::PADDING);
-
-  if (buf == nullptr) {
-    buf = ats_unique_malloc(max_size);
-  }
-
-  ink_assert(max_size > len);
-
-  size_t l = 0;
-  size_t n = frame->store(buf.get() + len, &l, max_size - len);
-  if (n > 0) {
-    if (is_debug_tag_set(QUIC_DEBUG_TAG.data())) {
-      char msg[1024];
-      frame->debug_msg(msg, sizeof(msg));
-      QUICConDebug("[TX] %s", msg);
-    }
-
-    len += l;
-    return;
-  }
-
-  // split frame
-  auto new_frame = QUICFrameFactory::split_frame(frame.get(), max_size - len);
-
-  if (is_debug_tag_set(QUIC_DEBUG_TAG.data())) {
-    char msg[1024];
-    frame->debug_msg(msg, sizeof(msg));
-    QUICConDebug("[TX] %s", msg);
-  }
-
-  ink_assert(frame->store(buf.get() + len, &l, max_size - len) > 0);
-  ink_assert(new_frame != nullptr);
-
-  this->_transmit_packet(this->_build_packet(std::move(buf), len, retransmittable, current_packet_type));
-  len = 0;
-  buf = ats_unique_malloc(max_size);
-  this->_store_frame(buf, len, retransmittable, current_packet_type, std::move(new_frame));
-  return;
-}
-
 void
 QUICNetVConnection::_store_frame(ats_unique_buf &buf, size_t &offset, uint64_t &max_frame_size, QUICFrameUPtr frame)
 {
@@ -1406,11 +1341,12 @@ QUICNetVConnection::_packetize_closing_frame()
     frame = QUICFrameFactory::create_connection_close_frame(std::move(this->_connection_error));
   }
 
-  ats_unique_buf buf(nullptr, [](void *p) { ats_free(p); });
-  size_t len                         = 0;
-  bool retransmittable               = false;
-  QUICPacketType current_packet_type = QUICPacketType::UNINITIALIZED;
-  this->_store_frame(buf, len, retransmittable, current_packet_type, std::move(frame));
+  uint32_t max_size  = this->maximum_quic_packet_size();
+  ats_unique_buf buf = ats_unique_malloc(max_size);
+
+  size_t len              = 0;
+  uint64_t max_frame_size = static_cast<uint64_t>(max_size);
+  this->_store_frame(buf, len, max_frame_size, std::move(frame));
 
   QUICEncryptionLevel level = this->_hs_protocol->current_encryption_level();
   ink_assert(level != QUICEncryptionLevel::ZERO_RTT);