Skip to content

Commit

Permalink
rebased and updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kamleshbhalui committed Nov 11, 2022
1 parent c2a2dc8 commit cf29965
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 122 deletions.
43 changes: 1 addition & 42 deletions backends/dpdk/DpdkXfail.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,11 @@ p4c_add_xfail_reason("dpdk"
testdata/p4_16_samples/psa-meter3.p4
testdata/p4_16_samples/psa-meter7-bmv2.p4
)

p4c_add_xfail_reason("dpdk"
"Meter function execute not implemented, use dpdk_execute"
testdata/p4_16_samples/psa-meter1.p4
)
p4c_add_xfail_reason("dpdk"
"Expected packet length argument for count method of indirect counter"
testdata/p4_16_samples/psa-example-counters-bmv2.p4
)

p4c_add_xfail_reason("dpdk"
"error: Name .* is used for multiple direct counter objects in the P4Info message"
testdata/p4_16_samples/psa-counter6.p4
)

p4c_add_xfail_reason("dpdk"
"Expected psa_implementation property value for table.* to resolve to an extern instance"
testdata/p4_16_samples/psa-action-profile2.p4
)

p4c_add_xfail_reason("dpdk"
"not implemented"
Expand Down Expand Up @@ -64,31 +51,3 @@ p4c_add_xfail_reason("dpdk"
"Direct counters and direct meters are unsupported for wildcard match"
testdata/p4_16_samples/psa-example-counters-bmv2.p4
)

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
)

p4c_add_xfail_reason("dpdk"
"Expected default action .* to have .* method call for .* extern instance"
testdata/p4_16_samples/pna-dpdk-direct-counter-err-1.p4
testdata/p4_16_samples/pna-dpdk-direct-meter-err-4.p4
testdata/p4_16_samples/pna-dpdk-direct-meter-err-3.p4
)

p4c_add_xfail_reason("dpdk"
".* method for different .* instances (.*) called within same action"
testdata/p4_16_samples/pna-dpdk-direct-counter-err-4.p4
)

p4c_add_xfail_reason("dpdk"
"Learner table .* must have all exact match keys"
testdata/p4_16_samples/pna-add-on-miss-err1.p4
testdata/p4_16_samples/pna-dpdk-table-key-consolidation-learner-2.p4
)
51 changes: 0 additions & 51 deletions p4include/dpdk/psa.p4
Original file line number Diff line number Diff line change
Expand Up @@ -603,28 +603,6 @@ extern Counter<W, S> {
void count(in S index);
// Dpdk support this overload and requires packet length
void count(in S index, in bit<32> pkt_len);

/*
/// The control plane API uses 64-bit wide counter values. It is
/// not intended to represent the size of counters as they are
/// stored in the data plane. It is expected that control plane
/// software will periodically read the data plane counter values,
/// and accumulate them into larger counters that are large enough
/// to avoid reaching their maximum values for a suitably long
/// operational time. A 64-bit byte counter increased at maximum
/// line rate for a 100 gigabit port would take over 46 years to
/// wrap.
@ControlPlaneAPI
{
bit<64> read (in S index);
bit<64> sync_read (in S index);
void set (in S index, in bit<64> seed);
void reset (in S index);
void start (in S index);
void stop (in S index);
}
*/
}
// END:Counter_extern

Expand All @@ -637,17 +615,6 @@ extern DirectCounter<W> {
void count();
// Dpdk support this overload and requires packet length
void count(in bit<32> pkt_len);
/*
@ControlPlaneAPI
{
W read<W> (in TableEntry key);
W sync_read<W> (in TableEntry key);
void set (in TableEntry key, in W seed);
void reset (in TableEntry key);
void start (in TableEntry key);
void stop (in TableEntry key);
}
*/
}
// END:DirectCounter_extern

Expand Down Expand Up @@ -687,15 +654,6 @@ extern Meter<S> {
// Meter extern `dpdk_execute` which has extra param.
PSA_MeterColor_t dpdk_execute(in S index, in PSA_MeterColor_t color, in bit<32> pkt_len);
PSA_MeterColor_t dpdk_execute(in S index, in bit<32> pkt_len);

/*
@ControlPlaneAPI
{
reset(in MeterColor_t color);
setParams(in S index, in MeterConfig config);
getParams(in S index, out MeterConfig config);
}
*/
}
// END:Meter_extern

Expand All @@ -710,15 +668,6 @@ extern DirectMeter {

PSA_MeterColor_t dpdk_execute(in PSA_MeterColor_t color, in bit<32> pkt_len);
PSA_MeterColor_t dpdk_execute(in bit<32> pkt_len);

/*
@ControlPlaneAPI
{
reset(in TableEntry entry, in MeterColor_t color);
void setConfig(in TableEntry entry, in MeterConfig config);
void getConfig(in TableEntry entry, out MeterConfig config);
}
*/
}
// END:DirectMeter_extern

Expand Down
10 changes: 5 additions & 5 deletions testdata/p4_16_pna_errors/pna-dpdk-direct-meter-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;
Expand Down Expand Up @@ -88,19 +88,19 @@ control MainControlImpl(
DirectMeter(PNA_MeterType_t.BYTES) meter0;
DirectMeter(PNA_MeterType_t.BYTES) meter1;
action next_hop(PortId_t oport) {
out1 = meter0.execute(color_in, 32w1024);
out1 = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
color_out = meter1.execute(color_in, 32w1024);
color_out = meter1.dpdk_execute(color_in, 32w1024);
user_meta.port_out1 = (color_out == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
send_to_port(oport);
}
action default_route_drop() {
out1 = meter0.execute(color_in, 32w1024);
out1 = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
drop_packet();
}
action default_route_drop1() {
out1 = meter1.execute(color_in, 32w1024);
out1 = meter1.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
drop_packet();
}
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,19 +66,19 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
DirectMeter(PNA_MeterType_t.BYTES) meter0;
DirectMeter(PNA_MeterType_t.BYTES) meter1;
action next_hop(PortId_t oport) {
out1 = meter0.execute(color_in, 32w1024);
out1 = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
color_out = meter1.execute(color_in, 32w1024);
color_out = meter1.dpdk_execute(color_in, 32w1024);
user_meta.port_out1 = (color_out == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
send_to_port(oport);
}
action default_route_drop() {
out1 = meter0.execute(color_in, 32w1024);
out1 = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
drop_packet();
}
action default_route_drop1() {
out1 = meter1.execute(color_in, 32w1024);
out1 = meter1.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
drop_packet();
}
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,14 +65,14 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
@name("MainControlImpl.meter0") DirectMeter(PNA_MeterType_t.BYTES) meter0_0;
@name("MainControlImpl.meter1") DirectMeter(PNA_MeterType_t.BYTES) meter1_0;
@name("MainControlImpl.next_hop") action next_hop(@name("oport") PortId_t oport) {
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 {
tmp = 32w0;
}
user_meta.port_out = tmp;
color_out_0 = meter1_0.execute(color_in_0, 32w1024);
color_out_0 = meter1_0.dpdk_execute(color_in_0, 32w1024);
if (color_out_0 == PNA_MeterColor_t.GREEN) {
tmp_0 = 32w1;
} else {
Expand All @@ -82,8 +82,8 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
send_to_port(oport);
}
@name("MainControlImpl.next_hop") action next_hop_1(@name("oport") PortId_t oport_1) {
out1_0 = meter0_0.execute(color_in_0, 32w1024);
color_out_0 = meter1_0.execute(color_in_0, 32w1024);
out1_0 = meter0_0.dpdk_execute(color_in_0, 32w1024);
color_out_0 = meter1_0.dpdk_execute(color_in_0, 32w1024);
if (color_out_0 == PNA_MeterColor_t.GREEN) {
tmp_0 = 32w1;
} else {
Expand All @@ -93,7 +93,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
send_to_port(oport_1);
}
@name("MainControlImpl.default_route_drop") action default_route_drop() {
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_1 = 32w1;
} else {
Expand All @@ -103,7 +103,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
drop_packet();
}
@name("MainControlImpl.default_route_drop1") action default_route_drop1() {
meter1_0.execute(color_in_0, 32w1024);
meter1_0.dpdk_execute(color_in_0, 32w1024);
drop_packet();
}
@name("MainControlImpl.ipv4_da1") table ipv4_da1_0 {
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 @@ -61,25 +61,25 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
@name("MainControlImpl.meter0") DirectMeter(PNA_MeterType_t.BYTES) meter0_0;
@name("MainControlImpl.meter1") DirectMeter(PNA_MeterType_t.BYTES) meter1_0;
@name("MainControlImpl.next_hop") action next_hop(@name("oport") bit<32> oport) {
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);
color_out_0 = meter1_0.execute(color_in_0, 32w1024);
color_out_0 = meter1_0.dpdk_execute(color_in_0, 32w1024);
user_meta.port_out1 = (color_out_0 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
send_to_port(oport);
}
@name("MainControlImpl.next_hop") action next_hop_1(@name("oport") bit<32> oport_1) {
out1_0 = meter0_0.execute(color_in_0, 32w1024);
color_out_0 = meter1_0.execute(color_in_0, 32w1024);
out1_0 = meter0_0.dpdk_execute(color_in_0, 32w1024);
color_out_0 = meter1_0.dpdk_execute(color_in_0, 32w1024);
user_meta.port_out1 = (color_out_0 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
send_to_port(oport_1);
}
@name("MainControlImpl.default_route_drop") action default_route_drop() {
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);
drop_packet();
}
@name("MainControlImpl.default_route_drop1") action default_route_drop1() {
meter1_0.execute(color_in_0, 32w1024);
meter1_0.dpdk_execute(color_in_0, 32w1024);
drop_packet();
}
@name("MainControlImpl.ipv4_da1") table ipv4_da1_0 {
Expand Down
10 changes: 5 additions & 5 deletions testdata/p4_16_samples_outputs/pna-dpdk-direct-meter-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;
header ethernet_t {
Expand Down Expand Up @@ -66,19 +66,19 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in
DirectMeter(PNA_MeterType_t.BYTES) meter0;
DirectMeter(PNA_MeterType_t.BYTES) meter1;
action next_hop(PortId_t oport) {
out1 = meter0.execute(color_in, 32w1024);
out1 = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
color_out = meter1.execute(color_in, 32w1024);
color_out = meter1.dpdk_execute(color_in, 32w1024);
user_meta.port_out1 = (color_out == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
send_to_port(oport);
}
action default_route_drop() {
out1 = meter0.execute(color_in, 32w1024);
out1 = meter0.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
drop_packet();
}
action default_route_drop1() {
out1 = meter1.execute(color_in, 32w1024);
out1 = meter1.dpdk_execute(color_in, 32w1024);
user_meta.port_out = (out1 == PNA_MeterColor_t.GREEN ? 32w1 : 32w0);
drop_packet();
}
Expand Down

0 comments on commit cf29965

Please sign in to comment.