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

rm spurious tbls #8

Merged
merged 1 commit into from
Feb 25, 2021
Merged
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
36 changes: 7 additions & 29 deletions p4/p4_src/kary.p4
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ control MyIngress(inout headers hdr,
mark_to_drop(standard_metadata);
}

//forward all packets to the specified port
//forward packets to the specified port
action set_egr(egressSpec_t port) {
standard_metadata.egress_spec = port;
}
Expand Down Expand Up @@ -176,23 +176,6 @@ control MyIngress(inout headers hdr,
meta.flowkey2[39:32] = hdr.ipv4.protocol;
}

table get_flowkey_tcp {
actions = {
copy_key_tcp;
}
default_action = copy_key_tcp();

}


table get_flowkey_udp {
actions = {
copy_key_udp;
}
default_action = copy_key_udp();

}

table forward {
key = {
standard_metadata.ingress_port: exact;
Expand All @@ -205,30 +188,25 @@ control MyIngress(inout headers hdr,
default_action = drop();
}

//calculate hash values
table hash_index {
actions = {
cal_hash;
}
default_action = cal_hash();
}


apply {
if (hdr.ipv4.isValid()) {
//first pass
if (meta.repass == 0) {
forward.apply();
//construct flowkey information

// TODO - this can be generalized in the parser stage through the use of some metadata, I will explain you this trick soon
// so we can avoid the conditional checks and only call one action here
if (hdr.ipv4.protocol == IP_PROTOCOLS_TCP) {
get_flowkey_tcp.apply();
copy_key_tcp();
}
if (hdr.ipv4.protocol == IP_PROTOCOLS_UDP) {
get_flowkey_udp.apply();
copy_key_udp();
}

//calculate hash value
hash_index.apply();
cal_hash();

//check if new packet is inside current epoch or in the next one
epoch.read(meta.epoch,0);
Expand Down