p4lang / pna

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

What do crypto offsets apply to? Packet as parsed, or packet after deparsing? #85

Open jfingerh opened 1 year ago

jfingerh commented 1 year ago

@pbhide

I am guessing the intent is that these methods take parameter values that are offsets from the beginning of the packet, in units of bytes? If so, it would be good to document them that way explicitly:

void set_auth_data_offset<T>(in T offset);
void set_icv_offset<T>(in T offset);
void set_payload_len<T>(in T len);

If that is correct, then is the intent that these offsets are for the packet:

My guess is "as it leaves the deparser" is easier for the offload engine to deal with, since then it does not need to have special logic to deal with changes in offsets during deparsing, e.g. because new headers are added, and/or some existing headers are removed.

In any case, documenting this explicitly would be good.