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

Add parser_dc_full stf test #104

Merged
merged 1 commit into from
Oct 14, 2016
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
4 changes: 4 additions & 0 deletions backends/bmv2/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,7 @@ XFAIL_TESTS += \
bmv2/testdata/p4_14_samples/truncate.p4.test \
bmv2/testdata/p4_16_samples/clone-bmv2.p4.test \
bmv2/testdata/p4_16_samples/drop-bmv2.p4.test

# backend bug handling current(23,1) in parser
XFAIL_TESTS += bmv2/testdata/p4_14_samples/parser_dc_full.p4.test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When trying to repro I get this:
*** Packet different at position 76 : expected 0 , received F
*** Packet 0 on port 10 differs
How did you diagnose the problem as being in current?


103 changes: 60 additions & 43 deletions testdata/p4_14_samples/parser_dc_full.p4
Original file line number Diff line number Diff line change
Expand Up @@ -429,29 +429,29 @@ parser parse_ethernet {
ETHERTYPE_NSH : parse_nsh;
ETHERTYPE_ROCE: parse_roce;
ETHERTYPE_FCOE: parse_fcoe;
default: ingress;
default: parse_payload;
}
}

header snap_header_t snap_header;

parser parse_snap_header {
extract(snap_header);
return ingress;
return parse_payload;
}

header roce_header_t roce;

parser parse_roce {
extract(roce);
return ingress;
return parse_payload;
}

header fcoe_header_t fcoe;

parser parse_fcoe {
extract(fcoe);
return ingress;
return parse_payload;
}

header cpu_header_t cpu_header;
Expand All @@ -469,7 +469,7 @@ parser parse_cpu_header {
ETHERTYPE_NSH : parse_nsh;
ETHERTYPE_ROCE: parse_roce;
ETHERTYPE_FCOE: parse_fcoe;
default: ingress;
default: parse_payload;
}
}

Expand All @@ -487,7 +487,7 @@ parser parse_vlan {
ETHERTYPE_IPV6 : parse_ipv6;
ETHERTYPE_ARP : parse_arp_rarp;
ETHERTYPE_RARP : parse_arp_rarp;
default: ingress;
default: parse_payload;
}
}

Expand All @@ -504,7 +504,7 @@ parser parse_mpls {
return select(current(23, 1)) {
0 : parse_mpls_not_bos;
1 : parse_mpls_bos;
default: ingress;
default: parse_payload;
}
}

Expand Down Expand Up @@ -568,7 +568,7 @@ parser parse_ipv4 {
IP_PROTOCOLS_UDP : parse_udp;
IP_PROTOCOLS_GRE : parse_gre;
// IP_PROTOCOLS_SCTP : parse_sctp;
default: ingress;
default: parse_payload;
}
}

Expand All @@ -582,29 +582,29 @@ parser parse_ipv6 {
IP_PROTOCOLS_UDP : parse_udp;
IP_PROTOCOLS_GRE : parse_gre;
// IP_PROTOCOLS_SCTP : parse_sctp;
default: ingress;
default: parse_payload;
}
}

header icmp_t icmp;

parser parse_icmp {
extract(icmp);
return ingress;
return parse_payload;
}

header icmpv6_t icmpv6;

parser parse_icmpv6 {
extract(icmpv6);
return ingress;
return parse_payload;
}

header tcp_t tcp;

parser parse_tcp {
extract(tcp);
return ingress;
return parse_payload;
}

#define UDP_PORT_VXLAN 4789
Expand All @@ -618,7 +618,7 @@ header roce_v2_header_t roce_v2;

parser parse_roce_v2 {
extract(roce_v2);
return ingress;
return parse_payload;
}

parser parse_udp {
Expand All @@ -627,15 +627,15 @@ parser parse_udp {
UDP_PORT_VXLAN : parse_vxlan;
UDP_PORT_GENV: parse_geneve;
UDP_PORT_ROCE_V2: parse_roce_v2;
default: ingress;
default: parse_payload;
}
}

header sctp_t sctp;

parser parse_sctp {
extract(sctp);
return ingress;
return parse_payload;
}


Expand All @@ -660,32 +660,32 @@ header gre_opt_t gre_opt;

parser parse_gre_key {
extract(gre_opt);
return ingress;
return parse_payload;
}
parser parse_gre_key2 {
extract(gre_opt);
extract(gre_opt);
return ingress;
return parse_payload;
}
parser parse_gre_key22 {
extract(gre_opt);
extract(gre_opt);
return ingress;
return parse_payload;
}
parser parse_gre_opt1 {
extract(gre_opt);
return ingress;
return parse_payload;
}
parser parse_gre_opt2 {
extract(gre_opt);
extract(gre_opt);
return ingress;
return parse_payload;
}
parser parse_gre_opt3 {
extract(gre_opt);
extract(gre_opt);
extract(gre_opt);
return ingress;
return parse_payload;
}

parser parse_gre_opts {
Expand All @@ -697,7 +697,7 @@ parser parse_gre_opts {
5 mask 0x0000 : parse_gre_key22;
6 mask 0x0000 : parse_gre_opt2;
7 mask 0x0000 : parse_gre_opt3;
default: ingress;
default: parse_payload;
}
}
#endif
Expand All @@ -711,7 +711,7 @@ parser parse_gre {
GRE_PROTOCOLS_ERSPAN_V1 : parse_erspan_v1;
GRE_PROTOCOLS_ERSPAN_V2 : parse_erspan_v2;
ETHERTYPE_NSH : parse_nsh;
default: ingress;
default: parse_payload;
}
}

Expand Down Expand Up @@ -761,14 +761,14 @@ header erspan_header_v1_t erspan_v1_header;

parser parse_erspan_v1 {
extract(erspan_v1_header);
return ingress;
return parse_payload;
}

header erspan_header_v2_t erspan_v2_header;

parser parse_erspan_v2 {
extract(erspan_v2_header);
return ingress;
return parse_payload;
}

#define ARP_PROTOTYPES_ARP_RARP_IPV4 0x0800
Expand All @@ -779,23 +779,23 @@ parser parse_arp_rarp {
extract(arp_rarp);
return select(latest.protoType) {
ARP_PROTOTYPES_ARP_RARP_IPV4 : parse_arp_rarp_ipv4;
default: ingress;
default: parse_payload;
}
}

header arp_rarp_ipv4_t arp_rarp_ipv4;

parser parse_arp_rarp_ipv4 {
extract(arp_rarp_ipv4);
return ingress;
return parse_payload;
}

header eompls_t eompls;

parser parse_eompls {
extract(eompls);
extract(inner_ethernet);
return ingress;
return parse_payload;
}

header vxlan_t vxlan;
Expand Down Expand Up @@ -867,7 +867,7 @@ parser parse_genv_inner {
ETHERTYPE_ETHERNET : parse_inner_ethernet;
ETHERTYPE_IPV4 : parse_inner_ipv4;
ETHERTYPE_IPV6 : parse_inner_ipv6;
default : ingress;
default : parse_payload;
}
}

Expand All @@ -881,7 +881,7 @@ parser parse_nsh {
ETHERTYPE_IPV4 : parse_inner_ipv4;
ETHERTYPE_IPV6 : parse_inner_ipv6;
ETHERTYPE_ETHERNET : parse_inner_ethernet;
default: ingress;
default: parse_payload;
}
}

Expand All @@ -892,36 +892,36 @@ parser parse_inner_ipv4 {
IP_PROTOCOLS_TCP : parse_inner_tcp;
IP_PROTOCOLS_UDP : parse_inner_udp;
// IP_PROTOCOLS_SCTP : parse_inner_sctp;
default: ingress;
default: parse_payload;
}
}

header icmp_t inner_icmp;

parser parse_inner_icmp {
extract(inner_icmp);
return ingress;
return parse_payload;
}

header tcp_t inner_tcp;

parser parse_inner_tcp {
extract(inner_tcp);
return ingress;
return parse_payload;
}

header udp_t inner_udp;

parser parse_inner_udp {
extract(inner_udp);
return ingress;
return parse_payload;
}

header sctp_t inner_sctp;

parser parse_inner_sctp {
extract(inner_sctp);
return ingress;
return parse_payload;
}

parser parse_inner_ipv6 {
Expand All @@ -931,35 +931,52 @@ parser parse_inner_ipv6 {
IP_PROTOCOLS_TCP : parse_inner_tcp;
IP_PROTOCOLS_UDP : parse_inner_udp;
// IP_PROTOCOLS_SCTP : parse_inner_sctp;
default: ingress;
default: parse_payload;
}
}

header icmpv6_t inner_icmpv6;

parser parse_inner_icmpv6 {
extract(inner_icmpv6);
return ingress;
return parse_payload;
}

parser parse_inner_ethernet {
extract(inner_ethernet);
return select(latest.etherType) {
ETHERTYPE_IPV4 : parse_inner_ipv4;
ETHERTYPE_IPV6 : parse_inner_ipv6;
default: ingress;
default: parse_payload;
}
}

action do_noop() { }
header_type payload_t {
fields {
data : 8;
}
}
header payload_t data;

/* extract 1 byte of payload and mark it to ensure entire parser is not dead-code elim */
parser parse_payload {
extract(data);
return ingress;
}

action mark_forward() {
data.data = 255;
standard_metadata.egress_spec = 10;
}

table do_nothing {
table mark_check {
reads {
ethernet.dstAddr : exact;
data.data : exact;
}
actions {
do_noop;
mark_forward;
}
default_action: mark_forward;
}

control ingress { apply(do_nothing); }
control ingress { apply(mark_check); }
4 changes: 4 additions & 0 deletions testdata/p4_14_samples/parser_dc_full.stf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# 2 - ethernet 16 - cpu 30 - vlan x2 38 - mpls x2 46 - inner ip 66 - udp 72 - data
expect 10 0001 0101010101010202020202029000 0000111122223333444455559100 aaaa9100 bbbb8847 00000001 00000101 4500040000000000401176eb8000000180000001 0064006503000000 ff
packet 1 0001 0101010101010202020202029000 0000111122223333444455559100 aaaa9100 bbbb8847 00000001 00000101 4500040000000000401176eb8000000180000001 0064006503000000 01
Loading