-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow masked table keys in frontend and bmv2 backend
- Loading branch information
Chris Dodd
committed
Mar 29, 2017
1 parent
aee4f47
commit 1f2c23f
Showing
13 changed files
with
261 additions
and
23 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
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
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
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
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
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
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
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
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
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,71 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header data_t { | ||
bit<32> f1; | ||
bit<32> f2; | ||
bit<16> h1; | ||
bit<8> b1; | ||
bit<8> b2; | ||
} | ||
|
||
struct metadata { | ||
} | ||
|
||
struct headers { | ||
@name("data") | ||
data_t data; | ||
} | ||
|
||
parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { | ||
@name("start") state start { | ||
packet.extract<data_t>(hdr.data); | ||
transition accept; | ||
} | ||
} | ||
|
||
control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { | ||
@name("setb1") action setb1(bit<8> val, bit<9> port) { | ||
hdr.data.b1 = val; | ||
standard_metadata.egress_spec = port; | ||
} | ||
@name("noop") action noop() { | ||
} | ||
@name("test1") table test1 { | ||
actions = { | ||
setb1(); | ||
noop(); | ||
@default_only NoAction(); | ||
} | ||
key = { | ||
hdr.data.f1 & 32w0xff00ff: exact @name("hdr.data.f1") ; | ||
} | ||
default_action = NoAction(); | ||
} | ||
apply { | ||
test1.apply(); | ||
} | ||
} | ||
|
||
control egress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
control DeparserImpl(packet_out packet, in headers hdr) { | ||
apply { | ||
packet.emit<data_t>(hdr.data); | ||
} | ||
} | ||
|
||
control verifyChecksum(in headers hdr, inout metadata meta) { | ||
apply { | ||
} | ||
} | ||
|
||
control computeChecksum(inout headers hdr, inout metadata meta) { | ||
apply { | ||
} | ||
} | ||
|
||
V1Switch<headers, metadata>(ParserImpl(), verifyChecksum(), ingress(), egress(), computeChecksum(), DeparserImpl()) main; |
71 changes: 71 additions & 0 deletions
71
testdata/p4_14_samples_outputs/exact_match_mask1-frontend.p4
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,71 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header data_t { | ||
bit<32> f1; | ||
bit<32> f2; | ||
bit<16> h1; | ||
bit<8> b1; | ||
bit<8> b2; | ||
} | ||
|
||
struct metadata { | ||
} | ||
|
||
struct headers { | ||
@name("data") | ||
data_t data; | ||
} | ||
|
||
parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { | ||
@name("start") state start { | ||
packet.extract<data_t>(hdr.data); | ||
transition accept; | ||
} | ||
} | ||
|
||
control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { | ||
@name("setb1") action setb1_0(bit<8> val, bit<9> port) { | ||
hdr.data.b1 = val; | ||
standard_metadata.egress_spec = port; | ||
} | ||
@name("noop") action noop_0() { | ||
} | ||
@name("test1") table test1_0 { | ||
actions = { | ||
setb1_0(); | ||
noop_0(); | ||
@default_only NoAction(); | ||
} | ||
key = { | ||
hdr.data.f1 & 32w0xff00ff: exact @name("hdr.data.f1") ; | ||
} | ||
default_action = NoAction(); | ||
} | ||
apply { | ||
test1_0.apply(); | ||
} | ||
} | ||
|
||
control egress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
control DeparserImpl(packet_out packet, in headers hdr) { | ||
apply { | ||
packet.emit<data_t>(hdr.data); | ||
} | ||
} | ||
|
||
control verifyChecksum(in headers hdr, inout metadata meta) { | ||
apply { | ||
} | ||
} | ||
|
||
control computeChecksum(inout headers hdr, inout metadata meta) { | ||
apply { | ||
} | ||
} | ||
|
||
V1Switch<headers, metadata>(ParserImpl(), verifyChecksum(), ingress(), egress(), computeChecksum(), DeparserImpl()) main; |
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,71 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header data_t { | ||
bit<32> f1; | ||
bit<32> f2; | ||
bit<16> h1; | ||
bit<8> b1; | ||
bit<8> b2; | ||
} | ||
|
||
struct metadata { | ||
} | ||
|
||
struct headers { | ||
@name("data") | ||
data_t data; | ||
} | ||
|
||
parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { | ||
@name("start") state start { | ||
packet.extract(hdr.data); | ||
transition accept; | ||
} | ||
} | ||
|
||
control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { | ||
@name("setb1") action setb1(bit<8> val, bit<9> port) { | ||
hdr.data.b1 = val; | ||
standard_metadata.egress_spec = port; | ||
} | ||
@name("noop") action noop() { | ||
} | ||
@name("test1") table test1 { | ||
actions = { | ||
setb1; | ||
noop; | ||
@default_only NoAction; | ||
} | ||
key = { | ||
hdr.data.f1 & 32w0xff00ff: exact; | ||
} | ||
default_action = NoAction(); | ||
} | ||
apply { | ||
test1.apply(); | ||
} | ||
} | ||
|
||
control egress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { | ||
apply { | ||
} | ||
} | ||
|
||
control DeparserImpl(packet_out packet, in headers hdr) { | ||
apply { | ||
packet.emit(hdr.data); | ||
} | ||
} | ||
|
||
control verifyChecksum(in headers hdr, inout metadata meta) { | ||
apply { | ||
} | ||
} | ||
|
||
control computeChecksum(inout headers hdr, inout metadata meta) { | ||
apply { | ||
} | ||
} | ||
|
||
V1Switch(ParserImpl(), verifyChecksum(), ingress(), egress(), computeChecksum(), DeparserImpl()) main; |
Empty file.