[P4-dev] Cut-through switching specification at P4 level

Vladimir Gurevich vladimir.gurevich at barefootnetworks.com
Sat May 20 14:39:26 EDT 2017


Hello Saulo,

You are correct -- many targets can be configured to work in either
cut-through or store-and-forward mode. However, this configuration should
not really affect the data plane algorithm that the P4 program is
describing. The only thing I can think of is that:

   1. Almost certainly, any functionality that requires the knowledge of
   packet length (byte counters, byte meters) will be either unavailable (in
   Ingress()) or severely limited.
   2. There is a high chance that your program might be processing some
   packets that will be ultimately dropped without your program's knowledge of
   that fact (because Ethernet CRC can be checked only after the last byte
   arrives).

All these things are external to the P4 program and usually have to be
controlled outside. Some architectures might choose to expose some
intrinsic metadata to either indicate to the data plane program that the
device is configured in cut-through mode or to allow the data plane program
to choose cut-through mode on a per-packet basis, but even then there is
usually additional piece of external configuration that is outside of P4
program purview.

As for the last part (external configuration), that's OK. There are many
parameters that have to be configured outside of the P4 program (most
obvious examples are port speeds and modes) and this is intentionally done
this way.

As for whether MyIngress() control (or any other P4 parser/control) would
start forwarding bytes immediately or not -- this is totally outside the
scope of the specification and can be done in a way that a given platform
chooses.

Thanks,
Vladimir

On Thu, May 18, 2017 at 9:33 AM, Saulo Queiroz <ssaulojorge at gmail.com>
wrote:

> If i'm not wrong, some targets offer the feature as an administrative
> configuration parameter, i.e.
> store-and-forward, cut-through or "dynamic" (following some heuristic to
> determine the forwarding mode
> in a per frame basis). Unless cut-through is definetly left-behind, would
> not be the case to offer such option at
> P4 level to be even more platform-generic?
>
> Also, some researchers may test specific algorithms based on the options.
>
>
>
> 2017-05-17 19:59 GMT-03:00 Andy Fingerhut <andy.fingerhut at gmail.com>:
>
>> I am not aware of any way to specify this in the P4 language (and I've
>> read through the spec several times in the last couple of weeks).  The most
>> the spec has to say about it is to note that if you want to access a packet
>> length field, that would be impossible on a cut-through target
>> implementation, so a program accessing such information would not be
>> portable to such a target (Section 11.8 "Data Extraction" of the P4-16
>> spec).
>>
>> Just about everything I can think of that you would want to write a P4
>> program would be independent of whether the target was cut-through or
>> store-and-forward.  Do you have some application or feature in mind where
>> that would make a difference to you when writing P4 code?
>>
>> Andy
>>
>>
>> On Wed, May 17, 2017 at 5:36 AM, Saulo Queiroz <ssaulojorge at gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> Is it possible to specify at P4 level whether a given target operate
>>> as cut-though or store-and-forward?
>>>
>>> BTW, does switch.p4 support cut-through?
>>>
>>>
>>> thanks in advance
>>>
>>> --
>>> Saulo Jorge bq
>>> - "Beware of bugs in the above code; I have only proved it correct, not
>>> tried it."
>>> Donald Knuth.
>>>
>>> _______________________________________________
>>> P4-dev mailing list
>>> P4-dev at lists.p4.org
>>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>>
>>
>>
>
>
> --
> Saulo Jorge bq
> - "Beware of bugs in the above code; I have only proved it correct, not
> tried it."
> Donald Knuth.
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>



-- 
*Vladimir Gurevich*

*Barefoot Networks*
*Technical Lead, Customer Engineering*
Email: vag at barefootnetworks.com
Phone: (408) 833-4505
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170520/39f1eee2/attachment-0002.html>


More information about the P4-dev mailing list