Re: Idea for packet numbers

Dmitri Tikhonov <dtikhonov@litespeedtech.com> Tue, 25 July 2017 12:41 UTC

Return-Path: <dtikhonov@litespeedtech.com>
X-Original-To: quic@ietfa.amsl.com
Delivered-To: quic@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 4E30C129B35 for <quic@ietfa.amsl.com>; Tue, 25 Jul 2017 05:41:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=litespeedtech-com.20150623.gappssmtp.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yB_GlHiSEmBJ for <quic@ietfa.amsl.com>; Tue, 25 Jul 2017 05:41:19 -0700 (PDT)
Received: from mail-qt0-x229.google.com (mail-qt0-x229.google.com [IPv6:2607:f8b0:400d:c0d::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id BC13F129AAD for <quic@ietf.org>; Tue, 25 Jul 2017 05:41:19 -0700 (PDT)
Received: by mail-qt0-x229.google.com with SMTP id p3so25482560qtg.2 for <quic@ietf.org>; Tue, 25 Jul 2017 05:41:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=litespeedtech-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=aTCPb/ON6quwCBCckIKO9mGJbb7wH1norPWEEZOiI2Y=; b=m8Ix5Io6NvqCbK2/owWiRG8yKXaasZt91otvZPO7CrtZdgkzogkHvg1XSTLDimNhJ5 cXmmfk+897XTbWMI1yywD06QWEY84xFlCNB4xxV9d5nypK/DrVj1HMnrXUA0BQgsgEts mLHITs5xj2wr/ziiARuWfaiXtnWJ6r1D0IgXdziuomYSUPVaRj8eAa5TXcKzeZCe+xvF J6nwlCJTAQm2BOF0buqolYg+ASNo4bGEqJnsT1OLFH3Pel2nxsmln54FllFvFNV5eAqD 14fkklHI7MvInFO99elAHW1YwHWULlv99VdqY7HrdQ1WPzYBhB82RigjV0X53qkNoq94 AxxQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=aTCPb/ON6quwCBCckIKO9mGJbb7wH1norPWEEZOiI2Y=; b=aXaCmLURyOqbifk0289ZQVicoJe06vnqd23C1unqab/hXAhk1uJNCgXKMUZ6whyrsM 7xYjSRDmbHMdMeZwiQKikKOkHkfoiEj3t/SjlSFp5MpZ/AEFWH9YaK+IsxPJEE86+mEp V5v6QUU+72V7JCaSht9pOXbqcJPRbnHmfjYzM4RXeBIC4KR9GMcj1ict25tp1db7hggE +3WTGYPNRbm03GTE87QcHYp55A99YXwtSdpx0KbpQrlyfhm5C2hvouN9p6bylTUb+MQX ObhKqmzaKEDrNWeJg56KTA67efwN6Vh/Z8cOx0cmVNrZDRzDqAZceipqzveZ1wzJj3Yn MsyQ==
X-Gm-Message-State: AIVw112LHHRb7luFGKHLZjA4C3Q3BH5XyUclfziudQZqWuNPvHx95mwq mFcoCncu4sVyuPQW
X-Received: by 10.200.48.105 with SMTP id g38mr15800862qte.125.1500986478776; Tue, 25 Jul 2017 05:41:18 -0700 (PDT)
Received: from ubuntu-dmitri (ool-2f1636b6.static.optonline.net. [47.22.54.182]) by smtp.gmail.com with ESMTPSA id o20sm10489662qtc.23.2017.07.25.05.41.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jul 2017 05:41:18 -0700 (PDT)
Date: Tue, 25 Jul 2017 08:41:09 -0400
From: Dmitri Tikhonov <dtikhonov@litespeedtech.com>
To: "Swindells, Thomas (Nokia - GB/Cambridge, UK)" <thomas.swindells@nokia.com>
Cc: Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com>, Magnus Westerlund <magnus.westerlund@ericsson.com>, IETF QUIC WG <quic@ietf.org>
Subject: Re: Idea for packet numbers
Message-ID: <20170725124109.GA1764@ubuntu-dmitri>
References: <c7941a67-6eaa-cd58-d0e2-a764478aa5b0@ericsson.com> <CAN1APdfwCoEieon8H98TOXBmsiwoHQfpsknfMB4hteU5gi9sMg@mail.gmail.com> <20170721093732.GA31705@ubuntu-dmitri> <DB5PR07MB1237B7C130AE23585EFF4CB084B80@DB5PR07MB1237.eurprd07.prod.outlook.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <DB5PR07MB1237B7C130AE23585EFF4CB084B80@DB5PR07MB1237.eurprd07.prod.outlook.com>
User-Agent: Mutt/1.5.24 (2015-08-30)
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/2TB2u4-7whskkj0U9Seqy6OnZjY>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Main mailing list of the IETF QUIC working group <quic.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/quic>, <mailto:quic-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/quic/>
List-Post: <mailto:quic@ietf.org>
List-Help: <mailto:quic-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/quic>, <mailto:quic-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 25 Jul 2017 12:41:21 -0000

On Tue, Jul 25, 2017 at 10:04:52AM +0000, Swindells, Thomas (Nokia - GB/Cambridge, UK) wrote:
> From the senders perspective the process it goes through is:
> 1. Get data to send
> 2. Get packet number
> 3. encrypt packet
> 4. queue packet on NIC
> 5. NIC sends packet.

I think this model needs to account for the OS.

A normal application does not write to NIC directly: it goes through
the kernel.  A socket's send buffer may get full and queueing a packet
may fail.  Let's assume that happens and the application waits to queue
a packet.  (If instead you just throw this packet out and pretend that
you queued it, then it is conceptually the same as the "write to NIC
directly" model above, but I don't think many people are ready to take
that route.)  While the application waits for the socket to become
writeable, an ACK alarm may go off or new packets may arrive for this
connection: generating and sending an ACK is in order.  Since we want
to send the ACK first, the buffered, not-yet-sent packet may need to be
renumbered, have its contents changed, or both:

    - Either the packet does not contain an ACK, in which case the
      new ACK frame is put into a new packet and the buffered packet
      gets a new packet number; or
    - The packet contains an ACK which can be replaced with the new
      ACK (if there is room), in which case the packet gets to keep
      the number, but the packet contents change.

Another scenario where butchering unsent packets is required is when
RST_STREAM comes in: application must then drop outgoing STREAM frames
for that stream.

The process is, then:

    1. Get data to send
    2. Get packet number
    3. Encrypt packet
    4. Try enqueuing packet
        a) If successful, "commit" packet number and go to (1)
        b) If unsuccessful, wait and do something smart later,
           depending on circumstances

Just my $.02,

  - Dmitri.