Re: Identify streams unidirectional vs bidirectional based on stream ID

Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com> Fri, 13 October 2017 20:04 UTC

Return-Path: <mikkelfj@gmail.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 0F2EB132396 for <quic@ietfa.amsl.com>; Fri, 13 Oct 2017 13:04:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.698
X-Spam-Level:
X-Spam-Status: No, score=-2.698 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 vudFZ_4l9zjc for <quic@ietfa.amsl.com>; Fri, 13 Oct 2017 13:03:58 -0700 (PDT)
Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) (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 18251126BF0 for <quic@ietf.org>; Fri, 13 Oct 2017 13:03:58 -0700 (PDT)
Received: by mail-io0-x22e.google.com with SMTP id j17so10170400iod.5 for <quic@ietf.org>; Fri, 13 Oct 2017 13:03:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:in-reply-to:references:mime-version:date:message-id:subject:to; bh=QEPevy7b3Cz1MPg1QT/TecBLHaJ+e1ZlCRUsF7TYBXs=; b=qyAOx83eJdO6uQYT8f2JoZpo/5vMKaCfUVFQsjWyIbpOzf3/YMpgfRz3UdEdpBSkGA J0vK5pQ5C1iXmJ2LlWBvc0JiTFwi9Jeucm0+qikcNO1paRD51o1v6BbkAeLAozXG+fOr 1sIXW6Lwk3AGk7PygUD5miEgtsFqKZwK5aYILQL34OpVOchd5dgdV0+isK1cEt7blyj2 u6yi9/FirhGljHISL2cCm5RvPvirlc4Z8dNw9+E8gPbp3beK31zfRmcXRHTkYH3hxfrh t0mz0CbufuYY0wArr3Xj8coxnL84rJP3barIUr/QjupZTRLaY2rY5pWHZsxBzx5UozxF Bmqg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to; bh=QEPevy7b3Cz1MPg1QT/TecBLHaJ+e1ZlCRUsF7TYBXs=; b=UItctb1iZ5yFqDcKkCVGaL3BwmU0XNKm9qqpzOvism8z5SR7EmpI4ysWSlT6YXhKZg cKmMxVISCkP9N3GvEuo2kVnSoxDESG1QqlqYauGP1hQB6Iz9+J8ebyA5nJqv/VQnsxN3 njHlvwKLRq5GoEvBDEK9TkBaAWSg8furx1sAMnYBZ1UGj5n/t0I9W4K/bLtaz9BDFnYK ApfPd7AAT8pP08XZHf/x1/pvJ+LofQ6QvmqB1ivfzV0jsa0JFuL0qkiRu5R5iXC85QkR 9ZuJYylMkqHHQL8EmwzhkgeuahKtAZFs2BCnYiLsdY1GZwAwr4TpEyNPOxj2/sLUSLUB WAgw==
X-Gm-Message-State: AMCzsaXBGHe8MO735f3FCJ087esiG4erIIjb0miCpJgLJf6GtkYuB1GW mRU0D3j4cio/92K/EzbQBlehYT557gsfu/wDEFSqvA==
X-Google-Smtp-Source: AOwi7QCvZ0auGWk/w28n2ICRVTWA6N7qCag/G645MjL42b6RirdDMfZBO0fyVuQuu8NBdghjjNAVC7DRUZTQ9SjDRNA=
X-Received: by 10.107.164.76 with SMTP id n73mr3125564ioe.175.1507925037191; Fri, 13 Oct 2017 13:03:57 -0700 (PDT)
Received: from 1058052472880 named unknown by gmailapi.google.com with HTTPREST; Fri, 13 Oct 2017 13:03:56 -0700
From: Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com>
In-Reply-To: <0ffd80fd-d6a9-5df4-2128-d304b65dedf4@in.tum.de>
References: <CAJ_4DfQe=twhj3OBy1o6h+u1O4qB2YzD26EMCHKnz4HWEEa7OQ@mail.gmail.com> <0ffd80fd-d6a9-5df4-2128-d304b65dedf4@in.tum.de>
X-Mailer: Airmail (420)
MIME-Version: 1.0
Date: Fri, 13 Oct 2017 13:03:56 -0700
Message-ID: <CAN1APdcT7djsTTt8fxx8S7cY1_7Tp-mhxedk-nnzyF2+XV6+GQ@mail.gmail.com>
Subject: Re: Identify streams unidirectional vs bidirectional based on stream ID
To: quic@ietf.org, Hugues Fafard <fafard@in.tum.de>
Content-Type: multipart/alternative; boundary="001a1142249c3098b0055b73286a"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/XHbi_u88kGX9nDxGjwRjMT4awk4>
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: Fri, 13 Oct 2017 20:04:00 -0000

Especially with the new variable length encoding proposal, storing the
identifiers early makes sense, as you only have to inspect the first byte.
But it gets complicated, because you don’t want to use 8 bytes for some
stream types and you don’t want the bits at some random location in a
decoded 8 byte representation either.

Regardless of bit placement, encoding state using bits is not ideal when
considering variable length encoding because you now use two bits for
length and two bits for stream type, leaving only 16 different streams
before the stream identifier needs to use two bytes, and so forth.


Kind Regards,
Mikkel Fahnøe Jørgensen


On 13 October 2017 at 21.50.06, Hugues Fafard (fafard@in.tum.de) wrote:

I see, you used the 2 least significant bits to encode that
information. When only using one bit to indicate the direction, it
boiled down to odd/even which more or less made sense, but when using
2 bits that breaks apart.

Why not use the most significant bits instead? That way, getting the
'clean' stream ID without the flags would be as simple doing a `&
0x3F...FF` instead of bit-shifting things around. Similarly, encoding
the stream ID would just entail `| 0x?0...00` to set the appropriate
bits and also avoid bit-shifts.

Regards,
Hugues

On 2017-10-13 20:51, Ryan Hamilton wrote:
> As I understand the discussions at the interim, we've decided to
> allow streams to be unidirectional or bidirectional. I support this
> idea and was motivated to write up an idea I've been thinking about
> for a while. In the same way that we use a bit in the stream ID to
> identify the client vs server nature of the stream, we can use a
> bit to identify the directionality. This divides the stream ID
> space neatly into 4 distinct spaces (much like the 2 two we have
> today: client/server). In addition this means that a stream ID
> always uniquely identifies a single stream, and frames which
> mention stream ID (STREAM, MAX_STREAM_ID, MAX_STREAM_DATA,
> RST_STREAM, etc) do not need to explicitly convey the
> directionality as fields in those frames (or implicitly based on
> the directionality of the frames themselves).
>
> https://github.com/quicwg/base-drafts/pull/872
>
> Cheers,
>
> Ryan