From c0773ed9d3cc9f187ce84e0d89bf5e06428d80ca Mon Sep 17 00:00:00 2001 From: hesingh Date: Wed, 26 Oct 2022 00:47:20 +0000 Subject: [PATCH 1/3] clarify add-on-miss --- PNA.mdk | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/PNA.mdk b/PNA.mdk index 3b483a1..cf033c2 100644 --- a/PNA.mdk +++ b/PNA.mdk @@ -930,7 +930,9 @@ 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 value, as in a (key,value) +pair, is obtained from network headers of the packet that caused the +table lookup to miss. 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 +942,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 +966,29 @@ 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`. +~Begin P4Example +action hit(bit<8> a0, bit<16> a1) {} +action miss(bit<8> a0, bit<16> 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} From da27d487d39bebd61d47102c71f10acc098c7eb0 Mon Sep 17 00:00:00 2001 From: hesingh Date: Wed, 26 Oct 2022 12:42:56 +0000 Subject: [PATCH 2/3] address review comments --- PNA.mdk | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PNA.mdk b/PNA.mdk index cf033c2..cba156d 100644 --- a/PNA.mdk +++ b/PNA.mdk @@ -931,8 +931,9 @@ 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. The new entry value, as in a (key,value) -pair, is obtained from network headers of the packet that caused the -table lookup to miss. +pair, is obtained from sources such as packet headers that caused the +table lookup to miss. Other sources are metadata and results from +prior processing of the P4 program before `add_entry` is called. 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` @@ -974,9 +975,13 @@ 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); } From 0428fda623319c567710c31fc044c52d50070bc3 Mon Sep 17 00:00:00 2001 From: hesingh Date: Fri, 28 Oct 2022 15:09:21 +0000 Subject: [PATCH 3/3] address review comment --- PNA.mdk | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/PNA.mdk b/PNA.mdk index cba156d..5edb06c 100644 --- a/PNA.mdk +++ b/PNA.mdk @@ -930,10 +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. The new entry value, as in a (key,value) -pair, is obtained from sources such as packet headers that caused the -table lookup to miss. Other sources are metadata and results from -prior processing of the P4 program before `add_entry` is called. +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`