p4lang / pna

Portable NIC Architecture
Apache License 2.0
55 stars 21 forks source link

drop_packet() extern function not defined in the spec even though it is in pna.p4 #55

Open apinski-cavium opened 1 year ago

apinski-cavium commented 1 year ago

While reading pna.p4 I noticed that drop_packet() extern function is not defined in the spec itself. This has to be an oversight. It is referenced in the spec once: The effects of mirror_packet() calls are independent of calls to drop_packet() and send_to_port(). But never defined what it does and what it can do. The header file has:

// The following extern functions are "forwarding" functions -- they
// all set the destination of the packet.  Calling one of them
// overwrites and replaces the effect of any earlier call to any of
// the functions in this set.  Only the last one executed will
// actually take effect for the packet.

// + drop_packet
// + send_to_port

// drop_packet() - Cause the packet to be dropped when it finishes
// completing the main control.
//
// Invoking drop_packet() is supported only within the main control.

extern void drop_packet();
hesingh commented 1 year ago

The PSA specification includes text for drop starting at https://p4.org/p4-spec/docs/PSA.html#sec-drop-operation We can leverage text into PNA.

jfingerh commented 1 year ago

Definitely good if someone is willing to write a PR for the PNA spec that defines drop_packet() in the text.