diff --git a/PNA.mdk b/PNA.mdk index 3b483a1..5edb06c 100644 --- a/PNA.mdk +++ b/PNA.mdk @@ -930,7 +930,8 @@ property is `true` for a table, the P4 developer is allowed to define a default action for the table that calls the `add_entry` extern function. `add_entry` adds a new entry to the table whose default action calls the `add_entry` function. The new entry will have the -same key that was just looked up. +same key that was just looked up. The new entry gets its value, as in +key-value pair, from the parameters to `add_entry`. The control plane API is still allowed to add, modify, and delete entries of such a table, but any entries added via the `add_entry` @@ -940,10 +941,14 @@ sustain `add_entry` calls at a large fraction of their line rate, but it need not be at the same packet rate supported for processing packets that do not call `add_entry`. The new table entry will be matchable when the next packet is processed that applies this table. +Use `add_on_miss` with caution because the data plane must have +enough information to verify that adding an entry on miss is correct. +TCP connection tracking is one application to use `add_on_miss`. ~Begin P4Example extern bool add_entry(string action_name, - in T action_params); + in T action_params, + in ExpireTimeProfileId_t expire_time_profile_id); ~End P4Example It is expected that many PNA implementations will restrict @@ -960,14 +965,33 @@ It is expected that many PNA implementations will restrict names must match the hit action parameter names, and their types must be the same as the corresponding hit action parameters. -The new entry will have the same key field values that were -searched for in the table when the miss occurred, which caused the -table's default action to be executed. The action will be the one -named by the string that is passed as the parameter `action_name`. +The new entry will have the same key that was searched for in the table +when the miss occurred, which caused the table's default action to be +executed. The action will be the one named by the string that is passed +as the parameter `action_name`. If the attempt to add a table entry succeeds, the return value is `true`, otherwise `false`. +An example program is included below using `add_entry`. + +~Begin P4Example +action hit(bit<8> a0, bit<16> a1) {} +action miss(bit<8> a0, bit<16> a1) { + meta.a0 = a0; + meta.a1 = a1; + add_entry("hit", {hdr.a0, hdr.a1}, expire_time_prof_id); +} + +table foo { + key = { hdr.ipv6.src_addr : exact; + hdr.ipv6.dst_addr : exact; + } + add_on_miss = true; + actions = { hit; miss;}; + default_action = miss; +} +~End P4Example ## Table entry timeout notification {#sec-idle-timeout}