Explicitly setting primary port status to avoid overflow error in `Protect.p4` for robustness
GreenieQwQ opened this issue · comments
GreeenieQWQ commented
The time-based mechanism introduced in the paper is like:
and the current implementation in Protect.p4
is
apply {
period.apply();
port_config.apply();
bit<1> accepted = 0;
bit<48> time = standard_metadata.ingress_global_timestamp;
if(standard_metadata.ingress_port == meta.primary) {
last_primary.write(0, time);
accepted = 1;
}
else if(standard_metadata.ingress_port == meta.secondary) {
bit<48> last;
last_primary.read(last, 0);
if((time - last) > meta.period) {
accepted = 1;
}
}
meta.accepted = accepted;
}
}
Ideally, if primary is down, packets from secondary port will be unconditionally accepted even if (time - last) <= meta.period
occurs (e.g., register last
approaches standard_metadata.ingress_global_timestamp
overflows). Explicitly setting the primary status register, as depicted in the diagram, would prevent the overflow error.