Re: [hybi] frame length encoding

Scott Ferguson <ferg@caucho.com> Sun, 22 August 2010 21:27 UTC

Return-Path: <ferg@caucho.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 1F9743A6954 for <hybi@core3.amsl.com>; Sun, 22 Aug 2010 14:27:07 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.502
X-Spam-Level:
X-Spam-Status: No, score=-2.502 tagged_above=-999 required=5 tests=[AWL=0.097, BAYES_00=-2.599]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZHNV15UYxoye for <hybi@core3.amsl.com>; Sun, 22 Aug 2010 14:27:05 -0700 (PDT)
Received: from smtp112.biz.mail.mud.yahoo.com (smtp112.biz.mail.mud.yahoo.com [209.191.68.77]) by core3.amsl.com (Postfix) with SMTP id D13763A6960 for <hybi@ietf.org>; Sun, 22 Aug 2010 14:27:03 -0700 (PDT)
Received: (qmail 28308 invoked from network); 22 Aug 2010 21:27:34 -0000
Received: from [192.168.1.11] (ferg@66.92.8.203 with plain) by smtp112.biz.mail.mud.yahoo.com with SMTP; 22 Aug 2010 14:27:34 -0700 PDT
X-Yahoo-SMTP: L1_TBRiswBB5.MuzAo8Yf89wczFo0A2C
X-YMail-OSG: VfnWV4wVM1mzW3GOOYyo3beXsVzV8d76KXsVMLO7WzdrIdB 4UmU6u7V2IWnHLp0J3BTQJMXWpwX9XmDww5OwsU.pa_KmCuEFPdZ_St1JDQr 9orgy45Rjali.M5MwEDWZ5HxV1rJRuVbcxB5R4gNGtxXqbsfFL2z9_GB6bdD 1iEQ7yjhUKW05fi5h4gicunZWZ3SRHky._txFyIgrLkEDTP9Tb8Uc.A1uDWL 8wKD4zH.ACe2GVu9X7847JxLOXOwJqd1I9oiqxZM.acOZC5Z_BTkNLuuhV_N dFTcSxPF94cvhzfqNED5g2E3qCvHQLQxuFCQBzvRYYIXcQZt_.Bj56W5w
X-Yahoo-Newman-Property: ymail-3
Message-ID: <4C719640.6070808@caucho.com>
Date: Sun, 22 Aug 2010 14:27:28 -0700
From: Scott Ferguson <ferg@caucho.com>
User-Agent: Thunderbird 2.0.0.24 (X11/20100411)
MIME-Version: 1.0
To: John Tamplin <jat@google.com>
References: <AANLkTimKbmcpgx8k0uXUWvCO=8w9pPrtV=3y4qh6363k@mail.gmail.com> <20100820192927.GA32620@1wt.eu> <4C6EEA55.2050205@hs-weingarten.de> <AANLkTinHqxUOZaVANFpC52t8FfgNw2L5_A-s9Az3Fm7p@mail.gmail.com> <AANLkTinvkxMP8FYz9xjDu_Kt9FfzYotgsqXUDB4MZMEo@mail.gmail.com> <AANLkTim3KRq1arso7wN_b+1TH3sWabYW6uFu7AbYw6-P@mail.gmail.com> <AANLkTikhhajho895WyEoJMwMk9GJ98kA0Mjy5qr4apC8@mail.gmail.com> <AANLkTi=kdk6BRvza_7bpoLNTFzUkjcRRijGLMe_NGXZV@mail.gmail.com> <AANLkTi=VE298Tg+qyfufhzMswE5pBxtPZhA0t2k=sf2A@mail.gmail.com> <4C717048.5020309@ericsson.com> <4C717B28.4070009@caucho.com> <4C717E1A.5000404@ericsson.com> <AANLkTimtNN1oW2TB30cS1Ew9pSxWNNsY9FH7Eu4EpQMb@mail.gmail.com>
In-Reply-To: <AANLkTimtNN1oW2TB30cS1Ew9pSxWNNsY9FH7Eu4EpQMb@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] frame length encoding
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Aug 2010 21:27:07 -0000

John Tamplin wrote:
> On Sun, Aug 22, 2010 at 3:44 PM, Salvatore Loreto 
> <salvatore.loreto@ericsson.com <mailto:salvatore.loreto@ericsson.com>> 
> wrote:
>
>     (again as individual)
>
>     Hi Scott
>
>     almost, what I had in mind was
>
>
>      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
>     +-+-+---+-+-------+--------------+
>     |F|T|LEN|R|OPCODE | reserved(7)  |
>     |I|M|   |E|       |              |
>     |N|L|   |S|       |              |
>     +-+-+---+-+-------+--------------+
>
>     in this way we have the possibility to add 1 extra bit to OPCODE
>     in the case we will run out of it
>
>
> Why not just move the opcode all the way to the right, and then we can 
> allocate reserved bits from the left as separate flags or from the 
> right to extend the opcode field?

Those are good points. Moving it to the right would also keep the opcode 
aligned, which is nice for debugging.

 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+---+-+-+---------------+-------+
|LEN|T|F| reserved(8)   |OPCODE |
|   |M|I|               |       |
|   |L|N|               |       |
+---+-+-+---------------+-------+

>  
>
>
>         It might also be possible to define 00 to use the reserved
>         byte for an
>         ultra-compact header, or 00 could be ultra-compact, and 01
>         could be the
>         normal 1 byte after the reserved and 10 be 2 byte.
>
>         LEN: 00 = 0 byte length (uses reserved byte)
>              01 = 1 byte length
>              10 = 2 byte length
>              11 = 8 byte length
>          
>
>     +1
>
>
> I still think it is a mistake to increase the size of the overwhelming 
> majority of frames to make things easier for the less-frequent (and 
> larger, so that the extra overhead is negligible) frames, but I am 
> tired of arguing about it.  If this is what people want then let's go 
> with it.

I think the compact frame (LEN 00 = 0 byte length) would give you that 
efficiency because the compact frame only uses 2 bytes total for the 
header and length:

 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+---+-+-+-------------+-+-------+
|00 |T|F| length(7)   |R|OPCODE |
|   |M|I|             |E|       |
|   |L|N|             |S|       |
+---+-+-+-------------+-+-------+

Where length(7) is the payload length and the payload immediately 
follows the header.

If we were willing to trade some extra complexity for extension bits, we 
could even reuse the TML and FIN bits for the compact header, because 
those bits aren't needed for small frames. So the compact (2 byte) 
header might be:


 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+---+---------------+---+-------+
|00 | length(8)     |RES|OPCODE |
|   |               |   |       |
|   |               |   |       |
+---+---------------+---+-------+

I'm not sure if it's a good idea because it does make the compact frame 
a special case, but it frees up some extra reserved bits.

I think that would give you the compact frame with the minimal overhead 
that you want, while still reserving 8 bits for the standard frames.

-- Scott

>
> -- 
> John A. Tamplin
> Software Engineer (GWT), Google