Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P4TC - Support for DirectCounter extern #4711

Merged
merged 12 commits into from
Jun 11, 2024
Prev Previous commit
Next Next commit
Change table permissions
  • Loading branch information
komaljai committed Jun 7, 2024
commit 05bfcc56d9dba799b28cdb7a622574e0f4e2f9ef
4 changes: 2 additions & 2 deletions backends/tc/tc.def
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ class TCTable {
tcTable += " num_timer_profiles " + Util::toString(timerProfiles);
}
if (isDirectCounter) {
tcTable += " \\\n\tpna_direct_counter Counter/" + directCounterInstance;
tcTable += " \\\n\tpna_direct_counter DirectCounter/" + directCounterInstance;
}

if (!actionList.empty()) {
Expand Down Expand Up @@ -451,7 +451,7 @@ class TCKey {
tckeyInstance += " id " + Util::toString(keyID);
}
if (emitValue) {
tckeyInstance += Util::toString(value);
tckeyInstance += " " + Util::toString(value);
}
return tckeyInstance;
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples/direct_counter_example.p4
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ control ingress(
drop_packet();
}

@tc_acl("RUS:RXP") table nh_table {
@tc_acl("CRUDPS:RX") table nh_table {
key = {
hdr.ipv4.srcAddr : exact @tc_type ("ipv4");
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/direct_counter_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"name" : "ingress/nh_table",
"id" : 1,
"tentries" : 2048,
"permissions" : "0x18a6",
"permissions" : "0x3da4",
"nummask" : 8,
"keysize" : 32,
"keyfields" : [
Expand Down
6 changes: 3 additions & 3 deletions testdata/p4tc_samples_outputs/direct_counter_example.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ $TC p4template update action/direct_counter_example/ingress/drop state active
$TC p4template create extern/root/DirectCounter extid 101 numinstances 1 tc_acl 0x1136 has_exec_method
komaljai marked this conversation as resolved.
Show resolved Hide resolved

$TC p4template create extern_inst/direct_counter_example/DirectCounter/ingress.global_counter instid 1 \
tc_numel 2048 tbl_bindable constructor param type ptype bit320 \
tc_numel 2048 tbl_bindable constructor param type ptype bit32 0 \
komaljai marked this conversation as resolved.
Show resolved Hide resolved
control_path tc_key index ptype bit32 id 1 param pkts ptype bit64 id 2

$TC p4template create table/direct_counter_example/ingress/nh_table \
tblid 1 \
type exact \
keysz 32 nummasks 8 permissions 0x18a6 tentries 2048 \
pna_direct_counter Counter/ingress.global_counter \
keysz 32 nummasks 8 permissions 0x3da4 tentries 2048 \
pna_direct_counter DirectCounter/ingress.global_counter \
table_acts act name direct_counter_example/ingress/send_nh \
act name direct_counter_example/ingress/drop
$TC p4template update table/direct_counter_example/ingress/nh_table default_miss_action permissions 0x1024 action direct_counter_example/ingress/drop
Expand Down