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 2017/12/22 08:03:20 UTC

[trafficserver] branch quic-latest updated: Ack delay field can be 64bit value

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

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


The following commit(s) were added to refs/heads/quic-latest by this push:
     new 24d344d  Ack delay field can be 64bit value
24d344d is described below

commit 24d344d4dd3847224458c8f51885d485c84c15b2
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Fri Dec 22 17:02:43 2017 +0900

    Ack delay field can be 64bit value
---
 iocore/net/quic/QUICAckFrameCreator.cc | 14 ++++++++++++--
 iocore/net/quic/QUICAckFrameCreator.h  |  1 +
 iocore/net/quic/QUICFrame.cc           |  2 +-
 iocore/net/quic/QUICFrame.h            |  4 ++--
 iocore/net/quic/QUICLossDetector.cc    |  7 +++++--
 5 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/iocore/net/quic/QUICAckFrameCreator.cc b/iocore/net/quic/QUICAckFrameCreator.cc
index 4cdc27a..9c81166 100644
--- a/iocore/net/quic/QUICAckFrameCreator.cc
+++ b/iocore/net/quic/QUICAckFrameCreator.cc
@@ -97,7 +97,7 @@ QUICAckFrameCreator::_create_ack_frame()
     if (ack_frame) {
       ack_frame->ack_block_section()->add_ack_block({static_cast<uint8_t>(gap - 1), length - 1});
     } else {
-      uint16_t delay = (Thread::get_hrtime() - this->_packet_numbers.largest_ack_received_time()) / 1000; // TODO Milliseconds?
+      uint64_t delay = this->_calculate_delay();
       ack_frame      = QUICFrameFactory::create_ack_frame(largest_ack_number, delay, length - 1);
     }
 
@@ -109,12 +109,22 @@ QUICAckFrameCreator::_create_ack_frame()
   if (ack_frame) {
     ack_frame->ack_block_section()->add_ack_block({static_cast<uint8_t>(gap - 1), length - 1});
   } else {
-    uint16_t delay = (Thread::get_hrtime() - this->_packet_numbers.largest_ack_received_time()) / 1000; // TODO Milliseconds?
+    uint64_t delay = this->_calculate_delay();
     ack_frame      = QUICFrameFactory::create_ack_frame(largest_ack_number, delay, length - 1);
   }
   return ack_frame;
 }
 
+uint64_t
+QUICAckFrameCreator::_calculate_delay()
+{
+  // Ack delay is in microseconds and scaled
+  uint64_t delay = (Thread::get_hrtime() - this->_packet_numbers.largest_ack_received_time()) / 1000;
+  // FXIME ack delay exponent has to be read from transport parameters
+  uint8_t ack_delay_exponent = 3;
+  return delay >> ack_delay_exponent;
+}
+
 void
 QUICAckPacketNumbers::push_back(QUICPacketNumber packet_number)
 {
diff --git a/iocore/net/quic/QUICAckFrameCreator.h b/iocore/net/quic/QUICAckFrameCreator.h
index 9dffb93..5a8e799 100644
--- a/iocore/net/quic/QUICAckFrameCreator.h
+++ b/iocore/net/quic/QUICAckFrameCreator.h
@@ -83,4 +83,5 @@ private:
 
   void _sort_packet_numbers();
   std::unique_ptr<QUICAckFrame, QUICFrameDeleterFunc> _create_ack_frame();
+  uint64_t _calculate_delay();
 };
diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc
index 93d894c..6bd3563 100644
--- a/iocore/net/quic/QUICFrame.cc
+++ b/iocore/net/quic/QUICFrame.cc
@@ -313,7 +313,7 @@ QUICAckFrame::QUICAckFrame(const uint8_t *buf, size_t len) : QUICFrame(buf, len)
   this->reset(buf, len);
 }
 
-QUICAckFrame::QUICAckFrame(QUICPacketNumber largest_acknowledged, uint16_t ack_delay, uint64_t first_ack_block_length)
+QUICAckFrame::QUICAckFrame(QUICPacketNumber largest_acknowledged, uint64_t ack_delay, uint64_t first_ack_block_length)
 {
   this->_largest_acknowledged = largest_acknowledged;
   this->_ack_delay            = ack_delay;
diff --git a/iocore/net/quic/QUICFrame.h b/iocore/net/quic/QUICFrame.h
index df5bf75..c0cfad7 100644
--- a/iocore/net/quic/QUICFrame.h
+++ b/iocore/net/quic/QUICFrame.h
@@ -36,7 +36,7 @@ class QUICFrame
 public:
   QUICFrame(const uint8_t *buf, size_t len) : _buf(buf), _len(len){};
   virtual QUICFrameType type() const;
-  virtual size_t size() const                         = 0;
+  virtual size_t size() const = 0;
   virtual void store(uint8_t *buf, size_t *len) const = 0;
   virtual void reset(const uint8_t *buf, size_t len);
   static QUICFrameType type(const uint8_t *buf);
@@ -724,7 +724,7 @@ public:
    * need to ack.
    */
   static std::unique_ptr<QUICAckFrame, QUICFrameDeleterFunc> create_ack_frame(QUICPacketNumber largest_acknowledged,
-                                                                              uint16_t ack_delay, uint64_t first_ack_block_length);
+                                                                              uint64_t ack_delay, uint64_t first_ack_block_length);
   /*
    * Creates a CONNECTION_CLOSE frame.
    */
diff --git a/iocore/net/quic/QUICLossDetector.cc b/iocore/net/quic/QUICLossDetector.cc
index 616108c..c1bd993 100644
--- a/iocore/net/quic/QUICLossDetector.cc
+++ b/iocore/net/quic/QUICLossDetector.cc
@@ -164,8 +164,11 @@ QUICLossDetector::_on_ack_received(const std::shared_ptr<const QUICAckFrame> &ac
   auto pi = this->_sent_packets.find(ack_frame->largest_acknowledged());
   if (pi != this->_sent_packets.end()) {
     this->_latest_rtt = Thread::get_hrtime() - pi->second->time;
-    // _latest_rtt is nanosecond but ack_frame->ack_delay is millisecond
-    this->_update_rtt(this->_latest_rtt, HRTIME_MSECONDS(ack_frame->ack_delay()), ack_frame->largest_acknowledged());
+    // _latest_rtt is nanosecond but ack_frame->ack_delay is microsecond and scaled
+    // FIXME ack delay exponent has to be read from transport parameters
+    uint8_t ack_delay_exponent = 3;
+    ink_hrtime delay           = HRTIME_USECONDS(ack_frame->ack_delay() << ack_delay_exponent);
+    this->_update_rtt(this->_latest_rtt, delay, ack_frame->largest_acknowledged());
   }
 
   QUICLDDebug("Unacked packets %lu (retransmittable %u, includes %u handshake packets)", this->_sent_packets.size(),

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].