Replace switch in action with multiple if's
p4c --target bmv2 --arch v1model --std p4-16 "../p4src/static-mapping.p4" -o "/home/p4/master-thesis/p4src" ../p4src/static-mapping.p4(60): error: SwitchStatement: switch statements not allowed in actions switch(hdr.icmp6.type) { ^^^^^^
This commit is contained in:
parent
aa1b316767
commit
7d9e9e1cfd
2 changed files with 15 additions and 3 deletions
10
doc/plan.org
10
doc/plan.org
|
@ -141,6 +141,9 @@
|
||||||
| 2019-03-26 | | |
|
| 2019-03-26 | | |
|
||||||
| | Find out where packet is stuck | |
|
| | Find out where packet is stuck | |
|
||||||
| | | |
|
| | | |
|
||||||
|
| 2019-03-27 | | |
|
||||||
|
| | switch cannot be used in actions! | |
|
||||||
|
| | | |
|
||||||
| 2019-03-28 | Meet Laurent #4 | |
|
| 2019-03-28 | Meet Laurent #4 | |
|
||||||
| | - Router solicitation for finding router on startup! | |
|
| | - Router solicitation for finding router on startup! | |
|
||||||
| | - test.py for TDD | |
|
| | - test.py for TDD | |
|
||||||
|
@ -1388,6 +1391,13 @@ me available?
|
||||||
I could work around this by using if(! .. .hit) { my_action(table_id)
|
I could work around this by using if(! .. .hit) { my_action(table_id)
|
||||||
}, but it would not work with using default_action = ...
|
}, but it would not work with using default_action = ...
|
||||||
|
|
||||||
|
**** No switch in actions
|
||||||
|
#+BEGIN_SRC
|
||||||
|
../p4src/static-mapping.p4(60): error: SwitchStatement: switch statements not allowed in actions
|
||||||
|
switch(hdr.icmp6.type) {
|
||||||
|
^^^^^^
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
*** Implementation limitations
|
*** Implementation limitations
|
||||||
**** No fragmentation support (yet)
|
**** No fragmentation support (yet)
|
||||||
**** No session handling (yet)
|
**** No session handling (yet)
|
||||||
|
|
|
@ -57,9 +57,11 @@ control MyIngress(inout headers hdr,
|
||||||
hdr.icmp.setValid();
|
hdr.icmp.setValid();
|
||||||
hdr.ipv4.protocol = PROTO_ICMP; // overwrite generic same protocol assumption
|
hdr.ipv4.protocol = PROTO_ICMP; // overwrite generic same protocol assumption
|
||||||
|
|
||||||
switch(hdr.icmp6.type) {
|
if(hdr.icmp6.type == ICMP6_ECHO_REQUEST) {
|
||||||
ICMP6_ECHO_REQUEST: { hdr.icmp.type = ICMP_ECHO_REQUEST; }
|
hdr.icmp.type = ICMP_ECHO_REQUEST;
|
||||||
ICMP6_ECHO_REPLY: { hdr.icmp.type = ICMP_ECHO_REPLY; }
|
}
|
||||||
|
if(hdr.icmp6.type == ICMP6_ECHO_REPLY) {
|
||||||
|
hdr.icmp.type = ICMP_ECHO_REPLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* trigger checksumming */
|
/* trigger checksumming */
|
||||||
|
|
Loading…
Reference in a new issue