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

create dpdk specific pna.p4 and extend it #3658

Merged
merged 11 commits into from
Nov 11, 2022
Prev Previous commit
Next Next commit
rebased with main
  • Loading branch information
kamleshbhalui committed Nov 11, 2022
commit 5f8b6481316147e86d68f86bd4b0013818a70868
2 changes: 1 addition & 1 deletion backends/dpdk/dpdkArch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2557,7 +2557,7 @@ void ValidateDirectCounterMeter::validateMethodInvocation(P4::ExternMethod *a) {
}

if ((externName == "DirectCounter" && methodName != "count") ||
(externName == "DirectMeter" && methodName != "execute")) {
(externName == "DirectMeter" && methodName != "dpdk_execute")) {
::error(ErrorType::ERR_UNEXPECTED, "%1% method not supported for %2% extern",
methodName, externName);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ control MyIC(

DirectMeter(PSA_MeterType_t.BYTES) meter0;
action execute_meter () {
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
b.port_out = (color_out == PSA_MeterColor_t.GREEN ? 32w1 : 32w0);
}
table tbl {
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/psa-example-dpdk-directmeter.p4
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ control MyIC(

DirectMeter(PSA_MeterType_t.PACKETS) meter0;
action execute_meter () {
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
b.port_out = (color_out == PSA_MeterColor_t.GREEN ? 32w1 : 32w0);
}
table tbl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ control MyIC(inout headers_t hdr, inout metadata_t b, in psa_ingress_input_metad
PSA_MeterColor_t color_in = PSA_MeterColor_t.RED;
DirectMeter(PSA_MeterType_t.BYTES) meter0;
action execute_meter() {
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
b.port_out = (color_out == PSA_MeterColor_t.GREEN ? 32w1 : 32w0);
}
table tbl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ control MyIC(inout headers_t hdr, inout metadata_t b, in psa_ingress_input_metad
@name("MyIC.as") ActionSelector(PSA_HashAlgorithm_t.CRC32, 32w1024, 32w16) as_0;
@name("MyIC.meter0") DirectMeter(PSA_MeterType_t.BYTES) meter0_0;
@name("MyIC.execute_meter") action execute_meter() {
color_out_0 = meter0_0.execute(color_in_0, 32w1024);
color_out_0 = meter0_0.dpdk_execute(color_in_0, 32w1024);
if (color_out_0 == PSA_MeterColor_t.GREEN) {
tmp = 32w1;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ control MyIC(inout headers_t hdr, inout metadata_t b, in psa_ingress_input_metad
@name("MyIC.as") ActionSelector(PSA_HashAlgorithm_t.CRC32, 32w1024, 32w16) as_0;
@name("MyIC.meter0") DirectMeter(PSA_MeterType_t.BYTES) meter0_0;
@name("MyIC.execute_meter") action execute_meter() {
color_out_0 = meter0_0.execute(color_in_0, 32w1024);
color_out_0 = meter0_0.dpdk_execute(color_in_0, 32w1024);
b.port_out = (color_out_0 == PSA_MeterColor_t.GREEN ? 32w1 : 32w0);
}
@name("MyIC.tbl") table tbl_0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ control MyIC(inout headers_t hdr, inout metadata_t b, in psa_ingress_input_metad
PSA_MeterColor_t color_in = PSA_MeterColor_t.RED;
DirectMeter(PSA_MeterType_t.BYTES) meter0;
action execute_meter() {
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
b.port_out = (color_out == PSA_MeterColor_t.GREEN ? 32w1 : 32w0);
}
table tbl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ control MyIC(inout headers_t hdr, inout metadata_t b, in psa_ingress_input_metad
PSA_MeterColor_t color_in = PSA_MeterColor_t.RED;
DirectMeter(PSA_MeterType_t.PACKETS) meter0;
action execute_meter() {
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
b.port_out = (color_out == PSA_MeterColor_t.GREEN ? 32w1 : 32w0);
}
table tbl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ control MyIC(inout headers_t hdr, inout metadata_t b, in psa_ingress_input_metad
}
@name("MyIC.meter0") DirectMeter(PSA_MeterType_t.PACKETS) meter0_0;
@name("MyIC.execute_meter") action execute_meter() {
color_out_0 = meter0_0.execute(color_in_0, 32w1024);
color_out_0 = meter0_0.dpdk_execute(color_in_0, 32w1024);
if (color_out_0 == PSA_MeterColor_t.GREEN) {
tmp = 32w1;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ control MyIC(inout headers_t hdr, inout metadata_t b, in psa_ingress_input_metad
}
@name("MyIC.meter0") DirectMeter(PSA_MeterType_t.PACKETS) meter0_0;
@name("MyIC.execute_meter") action execute_meter() {
color_out_0 = meter0_0.execute(color_in_0, 32w1024);
color_out_0 = meter0_0.dpdk_execute(color_in_0, 32w1024);
b.port_out = (color_out_0 == PSA_MeterColor_t.GREEN ? 32w1 : 32w0);
}
@name("MyIC.tbl") table tbl_0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ control MyIC(inout headers_t hdr, inout metadata_t b, in psa_ingress_input_metad
PSA_MeterColor_t color_in = PSA_MeterColor_t.RED;
DirectMeter(PSA_MeterType_t.PACKETS) meter0;
action execute_meter() {
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
b.port_out = (color_out == PSA_MeterColor_t.GREEN ? 32w1 : 32w0);
}
table tbl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ struct metadata_t {
bit<8> psa_ingress_output_metadata_drop
bit<32> psa_ingress_output_metadata_egress_port
bit<32> local_metadata_port_out
bit<32> table_entry_index
bit<32> Ingress_color_out
bit<32> Ingress_color_in
bit<32> Ingress_tmp
Expand All @@ -47,8 +46,6 @@ action NoAction args none {
}

action execute_meter args none {
entryid m.table_entry_index
meter meter0_0 m.table_entry_index 0x400 m.Ingress_color_in m.Ingress_color_out
jmpneq LABEL_FALSE m.Ingress_color_out 0x0
mov m.Ingress_tmp 0x1
jmp LABEL_END
Expand Down