[P4-dev] Implementation on marking a particular flow

HAOJU XIAO hamkuu at gmail.com
Thu Dec 22 10:15:12 EST 2016


Dear all,

I am trying to implement a P4 program that can mark the characteristics (i.e. some header information) of a packet, so that subsequent packets of the same flow can be processed faster under some shortcut processing pipeline.

After reading the P4 specification, I’m considering using Register to implement this feature. But I was confused by some description, as I quoted from the latest specification:

------------------------
7.3 Registers

Registers are stateful memories whose values can be read and written in actions. They are like counters, but can be used in a more general way to keep state.

A simple example use might be to verify that a "first packet" was seen for a particular type of flow. A register cell would be allocated to the flow, initialized to "clear". When the protocol signalled a "first packet", the table would match on this value and update the flow’s cell to "marked". Subsequent packets in the flow could would be mapped to the same cell; the current cell value would be stored in metadata for the packet and a subsequent table could check that the flow was marked as active. 

------------------------
  
What I confused about is [When the protocol signalled a "first packet”]. Can anyone explain the mechanism on signaling a first packet? What does THE protocol mean in this case? 

If anyone had implement such feature before, any source code or pseudo-code would help.


Another question (which might be silly question, but I really need to clear my confusion): 

Are stateful memories like Counter, Meter, and Register part of the metadata in the P4 language?


Thanks in advance.

Regards, 

Xiao


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161223/16b76d6b/attachment-0002.html>


More information about the P4-dev mailing list