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

PSA/eBPF: retrieve interface numbers from OS in PTF tests #3659

Merged
merged 9 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/action-const-default.p4
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; NoAction; }
const default_action = do_forward((PortId_t) 5);
const default_action = do_forward((PortId_t) PORT1);
size = 100;
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/action-default-ternary.p4
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ control ingress(inout headers hdr,
hdr.ipv4.dstAddr : ternary;
}
actions = { do_forward; NoAction; }
const default_action = do_forward((PortId_t) 5);
const default_action = do_forward((PortId_t) PORT1);
}

apply {
Expand Down
4 changes: 2 additions & 2 deletions backends/ebpf/tests/p4testdata/action-profile-action-run.p4
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ control MyIC(inout headers a, inout empty_t bc,

apply {
switch(tbl.apply().action_run) {
a1: { send_to_port(ostd, (PortId_t) 5); }
a2: { send_to_port(ostd, (PortId_t) 6); }
a1: { send_to_port(ostd, (PortId_t) PORT1); }
a2: { send_to_port(ostd, (PortId_t) PORT2); }
default: {}
}
}
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/action-profile-hit.p4
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ control MyIC(inout headers a, inout empty_t bc,

apply {
if (tbl.apply().hit)
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/action-profile-lpm.p4
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ control MyIC(inout headers a, inout empty_t bc,

apply {
tbl.apply();
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/action-profile1.p4
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ control MyIC(inout headers a, inout empty_t bc,

apply {
tbl.apply();
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/action-profile2.p4
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ control MyIC(inout headers a, inout empty_t bc,
apply {
tbl.apply();
tbl2.apply();
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ control MyIC(inout headers a, inout empty_t bc,

apply {
switch(tbl.apply().action_run) {
fwd: { send_to_port(ostd, (PortId_t) 5); }
fwd: { send_to_port(ostd, (PortId_t) PORT1); }
default: {}
}
}
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/action-selector-hit.p4
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ control MyIC(inout headers a, inout empty_t bc,

apply {
if (tbl.apply().hit)
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/action-selector3.p4
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ control MyIC(inout headers a, inout empty_t bc,
}
actions = { NoAction; fwd; }
psa_implementation = as;
psa_empty_group_action = fwd((PortId_t) 5);
psa_empty_group_action = fwd((PortId_t) PORT1);
}

apply {
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/bridged-metadata.p4
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ control ingress(inout headers hdr,
inout psa_ingress_output_metadata_t ostd)
{
apply {
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
hdr.bridged_metadata.setValid();
hdr.bridged_metadata.drop = 0;
if (hdr.ethernet.dstAddr == 0xffffffffffff) {
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/checksum-updates-crc16.p4
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ control ingress(inout headers hdr,
{

apply {
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/checksum-updates-crc32.p4
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ control ingress(inout headers hdr,
{

apply {
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
}
}

Expand Down
8 changes: 4 additions & 4 deletions backends/ebpf/tests/p4testdata/const-entry-and-action.p4
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; NoAction; }
const default_action = do_forward((PortId_t) 5);
const default_action = do_forward((PortId_t) PORT1);
const entries = {
(PortId_t)6 : do_forward((PortId_t) 4);
(PortId_t)PORT2 : do_forward((PortId_t) PORT0);
}
size = 100;
}
Expand All @@ -99,8 +99,8 @@ control ingress(inout headers hdr,
}
actions = { do_forward; NoAction; }
const entries = {
0x11223300 &&& 0xFFFFFF00 : do_forward((PortId_t) 6);
0x11223355 &&& 0xFFFFFFFF : do_forward((PortId_t) 4);
0x11223300 &&& 0xFFFFFF00 : do_forward((PortId_t) PORT2);
0x11223355 &&& 0xFFFFFFFF : do_forward((PortId_t) PORT0);
}
}

Expand Down
4 changes: 2 additions & 2 deletions backends/ebpf/tests/p4testdata/const-entry-ternary.p4
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ control ingress(inout headers hdr,
}
actions = { do_forward; NoAction; }
const entries = {
(0x5555555555 &&& 0x000000000000, 0x11223300 &&& 0xFFFF00FF, 0x33333333 &&& 0xFFFFFFFF, 0x00) : do_forward((PortId_t) 6);
(0x7777777777 &&& 0x000000000000, 0x11223355 &&& 0xFF00FFFF, 0x33333333 &&& 0xFFFFFFFF, 0x00) : do_forward((PortId_t) 5);
(0x5555555555 &&& 0x000000000000, 0x11223300 &&& 0xFFFF00FF, 0x33333333 &&& 0xFFFFFFFF, 0x00) : do_forward((PortId_t) PORT2);
(0x7777777777 &&& 0x000000000000, 0x11223355 &&& 0xFF00FFFF, 0x33333333 &&& 0xFFFFFFFF, 0x00) : do_forward((PortId_t) PORT1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/const-entry.p4
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ control ingress(inout headers hdr,
}
actions = { do_forward; NoAction; }
const entries = {
(PortId_t)4 : do_forward((PortId_t) 5);
(PortId_t)PORT0 : do_forward((PortId_t) PORT1);
}
size = 100;
}
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/cos-psa.p4
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ control ingress(inout headers hdr,
{

apply {
send_to_port(ostdx, (PortId_t) 5);
send_to_port(ostdx, (PortId_t) PORT1);

if (hdr.ethernet.etherType == 0x0800) {
ostdx.class_of_service = (ClassOfService_t) 100;
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/counters.p4
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; do_forward_2; NoAction; }
default_action = do_forward((PortId_t) 5);
default_action = do_forward((PortId_t) PORT1);
size = 100;
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/direct-counters.p4
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ control ingress(inout headers hdr,

apply {
ostd.drop = false;
ostd.egress_port = (PortId_t) 5;
ostd.egress_port = (PortId_t) PORT1;

tbl1.apply();
tbl2.apply();
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/etm-clone-e2e.p4
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ control ingress(inout headers hdr,

apply {
ostd.drop = false;
ostd.egress_port = (PortId_t) 5;
ostd.egress_port = (PortId_t) PORT1;
}
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/etm-drop.p4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ control ingress(inout headers hdr,

apply {
ostd.drop = false;
ostd.egress_port = (PortId_t) 5;
ostd.egress_port = (PortId_t) PORT1;
}
}

Expand Down
4 changes: 2 additions & 2 deletions backends/ebpf/tests/p4testdata/etm-recirc.p4
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ control ingress(inout headers hdr,

apply {
ostd.drop = false;
ostd.egress_port = (PortId_t) 5;
ostd.egress_port = (PortId_t) PORT1;

if (istd.packet_path == PSA_PacketPath_t.NORMAL) {
if (hdr.ethernet.dstAddr[15:0] == 0xfef0) {
ostd.egress_port = (PortId_t) 2;
ostd.egress_port = (PortId_t) PSA_RECIRC;
}
} else if (istd.packet_path == PSA_PacketPath_t.RECIRCULATE) {
} else {
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/hash-action.p4
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ control ingress(inout headers hdr,

apply {
t1.apply();
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/hash-crc16.p4
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ control ingress(inout headers hdr,
Hash<bit<16>>(PSA_HashAlgorithm_t.CRC16) h;

apply {
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);

hdr.crc.crc = h.get_hash({hdr.crc.f1, hdr.crc.f2, hdr.crc.f3, hdr.crc.f4});
}
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/hash-crc32.p4
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ control ingress(inout headers hdr,
Hash<bit<32>>(PSA_HashAlgorithm_t.CRC32) h;

apply {
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);

hdr.crc.crc = h.get_hash({hdr.crc.f1, hdr.crc.f2, hdr.crc.f3, hdr.crc.f4});
}
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/hash-range.p4
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ control ingress(inout headers hdr,
Hash<bit<16>>(PSA_HashAlgorithm_t.CRC16) h;

apply {
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);

hdr.crc.crc = (bit<8>) h.get_hash(16w50, {hdr.crc.f1, hdr.crc.f3, hdr.crc.f4}, 16w200);
}
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/internet-checksum.p4
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ control ingress(inout headers hdr,
return;
}

send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
}
}

Expand Down
4 changes: 2 additions & 2 deletions backends/ebpf/tests/p4testdata/meters-action.p4
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ control ingress(inout headers hdr,
Meter<bit<7>>(1, PSA_MeterType_t.BYTES) meter1;
bit<7> idx;
PSA_MeterColor_t color1 = PSA_MeterColor_t.RED;
PortId_t port = (PortId_t)5;
PortId_t port = (PortId_t)PORT1;

action do_forward(PortId_t egress_port) {
color1 = meter1.execute((bit<7>) 0);
Expand All @@ -94,7 +94,7 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; NoAction; }
default_action = do_forward((PortId_t) 6);
default_action = do_forward((PortId_t) PORT2);
size = 100;
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/meters-color-aware.p4
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ control ingress(inout headers hdr,
color1 = meter1.execute((bit<7>) 0, PSA_MeterColor_t.YELLOW);

if (color1 != PSA_MeterColor_t.RED) {
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
} else {
ingress_drop(ostd);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; NoAction; }
default_action = do_forward((PortId_t) 6);
default_action = do_forward((PortId_t) PORT2);
size = 100;
psa_direct_meter = meter1;
psa_direct_counter = counter1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; NoAction; }
default_action = do_forward((PortId_t) 6);
default_action = do_forward((PortId_t) PORT2);
size = 100;
psa_direct_meter = direct_meter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; NoAction; }
default_action = do_forward((PortId_t) 6);
default_action = do_forward((PortId_t) PORT2);
size = 100;
psa_direct_meter = direct_meter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; NoAction; }
default_action = do_forward((PortId_t) 6);
default_action = do_forward((PortId_t) PORT2);
size = 100;
psa_direct_meter = meter1;
}
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/meters-direct.p4
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; NoAction; }
default_action = do_forward((PortId_t) 6);
default_action = do_forward((PortId_t) PORT2);
size = 100;
psa_direct_meter = meter1;
}
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/meters-packets.p4
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ control ingress(inout headers hdr,
color1 = meter1.execute((bit<7>) 0);

if (color1 != PSA_MeterColor_t.RED) {
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
} else {
ingress_drop(ostd);
}
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/meters-two-direct.p4
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; NoAction; }
default_action = do_forward((PortId_t) 6);
default_action = do_forward((PortId_t) PORT2);
size = 100;
psa_direct_meter = { meter1, meter2 };
}
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/meters.p4
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ control ingress(inout headers hdr,
color1 = meter1.execute((bit<7>) 0);

if (color1 != PSA_MeterColor_t.RED) {
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
} else {
ingress_drop(ostd);
}
Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/packet_in-advance.p4
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; NoAction; }
default_action = do_forward((PortId_t) 5);
default_action = do_forward((PortId_t) PORT1);
size = 100;
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/packet_in-length.p4
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ control ingress(inout headers hdr,
istd.ingress_port : exact;
}
actions = { do_forward; NoAction; }
default_action = do_forward((PortId_t) 5);
default_action = do_forward((PortId_t) PORT1);
size = 100;
}

Expand Down
2 changes: 1 addition & 1 deletion backends/ebpf/tests/p4testdata/psa-ternary.p4
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ control ingress(inout headers hdr,
}

apply {
send_to_port(ostd, (PortId_t) 5);
send_to_port(ostd, (PortId_t) PORT1);
tbl_ternary_0.apply();
tbl_ternary_2.apply();
tbl_ternary_1.apply();
Expand Down
Loading