Skip to content

Commit

Permalink
fixed and update testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
kamleshbhalui committed Nov 8, 2022
1 parent c91c47f commit 70673df
Show file tree
Hide file tree
Showing 23 changed files with 44 additions and 44 deletions.
3 changes: 3 additions & 0 deletions backends/dpdk/DpdkXfail.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ p4c_add_xfail_reason("dpdk"
"can only be invoked from within action of ownertable"
testdata/p4_16_samples/psa-example-dpdk-directmeter-err.p4
testdata/p4_16_samples/pna-dpdk-direct-counter-err-3.p4
)
p4c_add_xfail_reason("dpdk"
"execute method not supported"
testdata/p4_16_samples/psa-meter6.p4
)

Expand Down
2 changes: 1 addition & 1 deletion backends/dpdk/dpdkArch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2526,7 +2526,7 @@ bool CollectDirectCounterMeter::preorder(const IR::P4Table* tbl) {
return false;
}
}
if (!ifMethodFound(defaultActionDecl, "execute", meterExternName)) {
if (!ifMethodFound(defaultActionDecl, "dpdk_execute", meterExternName)) {
if (meterInstance) {
::error(ErrorType::ERR_EXPECTED, "Expected default action %1% to have "
"'execute' method call for DirectMeter extern instance %2%",
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples/pna-dpdk-direct-counter-err-3.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
const bit<8> ETHERNET_HEADER_LEN = 14;
Expand Down
6 changes: 3 additions & 3 deletions testdata/p4_16_samples/pna-dpdk-direct-meter-err-2.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
const bit<8> ETHERNET_HEADER_LEN = 14;
Expand Down Expand Up @@ -80,7 +80,7 @@ control MainControlImpl(
PNA_MeterColor_t color_in = PNA_MeterColor_t.RED;
DirectMeter(PNA_MeterType_t.PACKETS) meter0;
action send() {
out1 = meter0.execute(color_in, 32w1024);
out1 = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
}

Expand All @@ -99,7 +99,7 @@ control MainControlImpl(
}

apply {
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (color_out == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
ipv4_host.apply();
}
Expand Down
4 changes: 2 additions & 2 deletions testdata/p4_16_samples/pna-dpdk-direct-meter-learner.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

#include <core.p4>
#include "pna.p4"
#include "dpdk/pna.p4"


typedef bit<48> EthernetAddress;
Expand Down Expand Up @@ -103,7 +103,7 @@ control MainControlImpl(

action add_on_miss_action() {
bit<32> tmp = 0;
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (color_out == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
add_entry(action_name="next_hop", action_params = tmp, expire_time_profile_id = user_meta.timeout);
}
Expand Down
4 changes: 2 additions & 2 deletions testdata/p4_16_samples/psa-example-dpdk-directmeter-err.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <bmv2/psa.p4>
#include <dpdk/psa.p4>

struct EMPTY { };

Expand Down Expand Up @@ -50,7 +50,7 @@ control MyIC(

DirectMeter(PSA_MeterType_t.BYTES) meter0;
action execute_meter () {
meter0.execute();
meter0.dpdk_execute(32w0);
}
table tbl {
key = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
const bit<8> ETHERNET_HEADER_LEN = 8w14;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
header ethernet_t {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

header ethernet_t {
bit<48> dstAddr;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
const bit<8> ETHERNET_HEADER_LEN = 14;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
const bit<8> ETHERNET_HEADER_LEN = 8w14;
Expand Down Expand Up @@ -62,7 +62,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
PNA_MeterColor_t color_in = PNA_MeterColor_t.RED;
DirectMeter(PNA_MeterType_t.PACKETS) meter0;
action send() {
out1 = meter0.execute(color_in, 32w1024);
out1 = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
}
table ipv4_host {
Expand All @@ -77,7 +77,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
pna_direct_meter = meter0;
}
apply {
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (color_out == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
ipv4_host.apply();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
header ethernet_t {
Expand Down Expand Up @@ -60,7 +60,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
@name("MainControlImpl.tmp") bit<32> tmp;
@name("MainControlImpl.meter0") DirectMeter(PNA_MeterType_t.PACKETS) meter0_0;
@name("MainControlImpl.send") action send() {
out1_0 = meter0_0.execute(color_in_0, 32w1024);
out1_0 = meter0_0.dpdk_execute(color_in_0, 32w1024);
if (out1_0 == PNA_MeterColor_t.GREEN) {
tmp = 32w1;
} else {
Expand All @@ -81,7 +81,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
}
apply {
color_in_0 = PNA_MeterColor_t.RED;
meter0_0.execute(color_in_0, 32w1024);
meter0_0.dpdk_execute(color_in_0, 32w1024);
ipv4_host_0.apply();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

header ethernet_t {
bit<48> dstAddr;
Expand Down Expand Up @@ -58,7 +58,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
@name("MainControlImpl.color_in") PNA_MeterColor_t color_in_0;
@name("MainControlImpl.meter0") DirectMeter(PNA_MeterType_t.PACKETS) meter0_0;
@name("MainControlImpl.send") action send() {
out1_0 = meter0_0.execute(color_in_0, 32w1024);
out1_0 = meter0_0.dpdk_execute(color_in_0, 32w1024);
user_meta.port_out = (out1_0 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
}
@name("MainControlImpl.ipv4_host") table ipv4_host_0 {
Expand All @@ -74,7 +74,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
}
@hidden action pnadpdkdirectmetererr2l80() {
color_in_0 = PNA_MeterColor_t.RED;
meter0_0.execute(PNA_MeterColor_t.RED, 32w1024);
meter0_0.dpdk_execute(PNA_MeterColor_t.RED, 32w1024);
}
@hidden table tbl_pnadpdkdirectmetererr2l80 {
actions = {
Expand Down
6 changes: 3 additions & 3 deletions testdata/p4_16_samples_outputs/pna-dpdk-direct-meter-err-2.p4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
const bit<8> ETHERNET_HEADER_LEN = 14;
Expand Down Expand Up @@ -62,7 +62,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
PNA_MeterColor_t color_in = PNA_MeterColor_t.RED;
DirectMeter(PNA_MeterType_t.PACKETS) meter0;
action send() {
out1 = meter0.execute(color_in, 32w1024);
out1 = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
}
table ipv4_host {
Expand All @@ -77,7 +77,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
pna_direct_meter = meter0;
}
apply {
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (color_out == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
ipv4_host.apply();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
header ethernet_t {
Expand Down Expand Up @@ -65,7 +65,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
}
action add_on_miss_action() {
bit<32> tmp = 32w0;
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (color_out == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
add_entry<bit<32>>(action_name = "next_hop", action_params = tmp, expire_time_profile_id = user_meta.timeout);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
header ethernet_t {
Expand Down Expand Up @@ -66,7 +66,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
}
@name("MainControlImpl.add_on_miss_action") action add_on_miss_action() {
tmp = 32w0;
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 == PNA_MeterColor_t.GREEN) {
tmp_0 = 32w1;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

header ethernet_t {
bit<48> dstAddr;
Expand Down Expand Up @@ -67,7 +67,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
send_to_port(vport);
}
@name("MainControlImpl.add_on_miss_action") action add_on_miss_action() {
color_out_0 = meter0_0.execute(color_in_0, 32w1024);
color_out_0 = meter0_0.dpdk_execute(color_in_0, 32w1024);
user_meta.port_out = (color_out_0 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
add_entry<bit<32>>(action_name = "next_hop", action_params = 32w0, expire_time_profile_id = user_meta.timeout);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <pna.p4>
#include <dpdk/pna.p4>

typedef bit<48> EthernetAddress;
header ethernet_t {
Expand Down Expand Up @@ -65,7 +65,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
}
action add_on_miss_action() {
bit<32> tmp = 0;
color_out = meter0.execute(color_in, 32w1024);
color_out = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (color_out == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
add_entry(action_name = "next_hop", action_params = tmp, expire_time_profile_id = user_meta.timeout);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ struct main_metadata_t {
bit<8> local_metadata_timeout
bit<32> local_metadata_port_out
bit<32> pna_main_output_metadata_output_port
bit<32> table_entry_index
bit<32> MainControlT_tmp
bit<32> MainControlT_tmp_0
bit<32> MainControlT_color_out
Expand All @@ -56,8 +55,6 @@ action next_hop args instanceof next_hop_arg_t {
}

action add_on_miss_action args none {
entryid m.table_entry_index
meter meter0_0 m.table_entry_index 0x400 m.MainControlT_color_in m.MainControlT_color_out
jmpneq LABEL_FALSE_0 m.MainControlT_color_out 0x1
mov m.MainControlT_tmp_1 0x1
jmp LABEL_END_0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <bmv2/psa.p4>
#include <dpdk/psa.p4>

struct EMPTY {
}
Expand Down Expand Up @@ -31,7 +31,7 @@ parser MyEP(packet_in buffer, out EMPTY a, inout EMPTY b, in psa_egress_parser_i
control MyIC(inout headers_t hdr, inout EMPTY b, in psa_ingress_input_metadata_t c, inout psa_ingress_output_metadata_t d) {
DirectMeter(PSA_MeterType_t.BYTES) meter0;
action execute_meter() {
meter0.execute();
meter0.dpdk_execute(32w0);
}
table tbl {
key = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <bmv2/psa.p4>
#include <dpdk/psa.p4>

struct EMPTY {
}
Expand Down Expand Up @@ -35,7 +35,7 @@ control MyIC(inout headers_t hdr, inout EMPTY b, in psa_ingress_input_metadata_t
}
@name("MyIC.meter0") DirectMeter(PSA_MeterType_t.BYTES) meter0_0;
@name("MyIC.execute_meter") action execute_meter() {
meter0_0.execute();
meter0_0.dpdk_execute(32w0);
}
@name("MyIC.tbl") table tbl_0 {
key = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <bmv2/psa.p4>
#include <dpdk/psa.p4>

struct EMPTY {
}
Expand Down Expand Up @@ -34,7 +34,7 @@ control MyIC(inout headers_t hdr, inout EMPTY b, in psa_ingress_input_metadata_t
}
@name("MyIC.meter0") DirectMeter(PSA_MeterType_t.BYTES) meter0_0;
@name("MyIC.execute_meter") action execute_meter() {
meter0_0.execute();
meter0_0.dpdk_execute(32w0);
}
@name("MyIC.tbl") table tbl_0 {
key = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <core.p4>
#include <bmv2/psa.p4>
#include <dpdk/psa.p4>

struct EMPTY {
}
Expand Down Expand Up @@ -31,7 +31,7 @@ parser MyEP(packet_in buffer, out EMPTY a, inout EMPTY b, in psa_egress_parser_i
control MyIC(inout headers_t hdr, inout EMPTY b, in psa_ingress_input_metadata_t c, inout psa_ingress_output_metadata_t d) {
DirectMeter(PSA_MeterType_t.BYTES) meter0;
action execute_meter() {
meter0.execute();
meter0.dpdk_execute(32w0);
}
table tbl {
key = {
Expand Down

0 comments on commit 70673df

Please sign in to comment.