-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fixes] updates based on tesing on Oxide p4 programs
- Loading branch information
1 parent
12f4d2b
commit 12bbff1
Showing
9 changed files
with
14,944 additions
and
12,384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
# tree-sitter-p4 | ||
# tree-sitter-p4: P4 grammar for tree-sitter | ||
|
||
P4 grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter). | ||
|
||
## Setup | ||
|
||
To build the parser, you need to have `tree-sitter` installed. You can install | ||
it using most OS package managers, from source, or through `npm`: | ||
|
||
```sh | ||
npm install tree-sitter-cli | ||
``` | ||
|
||
or with `cargo`: | ||
|
||
```sh | ||
cargo install tree-sitter-cli | ||
``` | ||
|
||
## Contributing | ||
|
||
This project is still in its early stages, so there are many things that can be | ||
improved, as we aim toward capturing more of the [`P4_16` specification][p4-16-spec]. | ||
|
||
To contribute, just open a pull request! | ||
|
||
[p4-16-spec]: https://p4.org/p4-spec/docs/P4-16-v1.0.0-spec.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
action multicast_inbound() { | ||
hdr.sidecar.sc_code = 4; | ||
hdr.sidecar.sc_ingress = (bit<16>) meta.in_port; | ||
hdr.sidecar.sc_egress = (bit<16>) ig_tm_md.ucast_egress_port; | ||
hdr.sidecar.sc_ether_type = hdr.ethernet.ether_type; | ||
hdr.sidecar.sc_payload = 0; | ||
hdr.sidecar.setValid(); | ||
hdr.ethernet.ether_type = ETHERTYPE_SIDECAR; | ||
meta.routed = false; | ||
meta.service_routed = true; | ||
ig_tm_md.ucast_egress_port = USER_SPACE_SERVICE_PORT; | ||
meta.multicast = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
control Services( | ||
inout sidecar_headers_t hdr, | ||
inout sidecar_ingress_meta_t meta, | ||
inout ingress_intrinsic_metadata_for_deparser_t ig_dprsr_md, | ||
inout ingress_intrinsic_metadata_for_tm_t ig_tm_md) | ||
{ | ||
Counter<bit<32>, bit<8>>(SVC_COUNTER_MAX, CounterType_t.PACKETS) service_ctr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,5 +43,4 @@ control ingress(inout headers_t hdr) { | |
hdr.udp, | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
parser IngressParser( | ||
packet_in pkt, | ||
out sidecar_headers_t hdr, | ||
out sidecar_ingress_meta_t meta, | ||
out ingress_intrinsic_metadata_t ig_intr_md) | ||
{ | ||
Checksum() ipv4_checksum; | ||
Checksum() icmp_checksum; | ||
Checksum() nat_checksum; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.