-
Notifications
You must be signed in to change notification settings - Fork 444
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
Replace pna direction with register read #3224
Conversation
Consider statements in actions
Remove uniqued vars
@@ -96,6 +92,11 @@ p4c_add_xfail_reason("dpdk" | |||
testdata/p4_16_samples/pna-example-mirror-packet-error3.p4 | |||
) | |||
|
|||
p4c_add_xfail_reason("dpdk" | |||
"declaration not found" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this supposed to fail with p4c-dpdk only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is failing may be due to some bug in compiler frontend. I am just recording this test for fixing it later.
backends/dpdk/dpdkMetadata.cpp
Outdated
} | ||
|
||
const IR::Node* DirectionToRegRead::preorder(IR::DpdkAsmProgram *p) { | ||
uniqueNames(p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many spaces
backends/dpdk/dpdkMetadata.cpp
Outdated
} | ||
// "network_port_mask" name is used in dpdk for initialzing direction port mask | ||
// make sure no such decls exist with that name | ||
if (mng1.newName(registerInstanceName) != registerInstanceName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's best if you add a new api to the name generator to check whether a name is in use.
This works too, but it is a bit ugly.
usedNames.insert(decl->name); | ||
} | ||
|
||
if (usedNames.count(registerInstanceName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works if usedNames contains everything you need to check for. I was hoping that you'd add a new method MinimalNameGenerator::nameIsUsed(cstring name)
Extract packet direction for PNA from an input port, By creating a Register extern network_port_mask, which will be initialized by P4SDE.
The direction metadata should be replaced by a register read from network_port_mask register and ANDing it with mask for input port
istd.direction => network_port_mask.read(0) & (32w0x1 << istd.input_port)