Skip to content

Commit

Permalink
Add write offset to DSR structures.
Browse files Browse the repository at this point in the history
Summary: No functional change, this is just the plumbing to ensure that we can specify a time offset for writing DSR packets. The delay will be added by the DSR backend.

Reviewed By: afrind

Differential Revision: D48574262

fbshipit-source-id: 8395d50697d7f2c272b5f82fb71e6688f4c25f8c
  • Loading branch information
Matt Joras authored and facebook-github-bot committed Sep 6, 2023
1 parent 89b32ad commit c16ea6c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions quic/dsr/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct SendInstruction {
clientAddress(other.clientAddress),
packetNum(other.packetNum),
largestAckedPacketNum(other.largestAckedPacketNum),
writeOffset(other.writeOffset),
largestAckedStreamOffset(other.largestAckedStreamOffset),
streamId(other.streamId),
streamOffset(other.streamOffset),
Expand All @@ -72,6 +73,7 @@ struct SendInstruction {
clientAddress(other.clientAddress),
packetNum(other.packetNum),
largestAckedPacketNum(other.largestAckedPacketNum),
writeOffset(other.writeOffset),
largestAckedStreamOffset(other.largestAckedStreamOffset),
streamId(other.streamId),
streamOffset(other.streamOffset),
Expand All @@ -85,6 +87,7 @@ struct SendInstruction {
const folly::SocketAddress& clientAddress;
PacketNum packetNum{0};
PacketNum largestAckedPacketNum{0};
std::chrono::microseconds writeOffset{0us};

// QUIC Stream info
folly::Optional<uint64_t> largestAckedStreamOffset;
Expand All @@ -108,6 +111,7 @@ struct SendInstruction {
clientAddr,
packetNum,
largestAckedPacketNum,
writeOffset,
largestAckedStreamOffset,
streamId,
*streamOffset,
Expand All @@ -126,6 +130,11 @@ struct SendInstruction {
return *this;
}

Builder& setWriteOffset(std::chrono::microseconds val) {
writeOffset = val;
return *this;
}

Builder& setLargestAckedStreamOffset(uint64_t val) {
largestAckedStreamOffset = val;
return *this;
Expand Down Expand Up @@ -158,6 +167,7 @@ struct SendInstruction {
PacketNum packetNum{0};
PacketNum largestAckedPacketNum{0};
folly::Optional<uint64_t> largestAckedStreamOffset;
std::chrono::microseconds writeOffset{0us};
StreamId streamId;
folly::Optional<uint64_t> streamOffset;
folly::Optional<uint64_t> len;
Expand All @@ -172,6 +182,7 @@ struct SendInstruction {
const folly::SocketAddress& clientAddrIn,
PacketNum packetNumIn,
PacketNum largestAckedPacketNumIn,
std::chrono::microseconds writeOffsetIn,
folly::Optional<uint64_t> largestAckedStreamOffsetIn,
StreamId idIn,
uint64_t streamOffsetIn,
Expand All @@ -183,6 +194,7 @@ struct SendInstruction {
clientAddress(clientAddrIn),
packetNum(packetNumIn),
largestAckedPacketNum(largestAckedPacketNumIn),
writeOffset(writeOffsetIn),
largestAckedStreamOffset(largestAckedStreamOffsetIn),
streamId(idIn),
streamOffset(streamOffsetIn),
Expand Down
1 change: 1 addition & 0 deletions quic/dsr/backend/DSRPacketizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ struct RequestGroup {
folly::SocketAddress clientAddress;
const CipherPair* cipherPair{nullptr};
SmallVec<PacketizationRequest, 64> requests;
std::chrono::microseconds writeOffset{0us};
};

BufQuicBatchResult writePacketsGroup(
Expand Down
2 changes: 2 additions & 0 deletions quic/dsr/frontend/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ void DSRStreamFrameScheduler::enrichInstruction(
if (largestDeliverableOffset) {
builder.setLargestAckedStreamOffset(*largestDeliverableOffset);
}
// TODO set to actual write delay.
builder.setWriteOffset(0us);
}

} // namespace quic

0 comments on commit c16ea6c

Please sign in to comment.