-
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
Add support for ternary const entries #3347
Conversation
backends/ebpf/psa/ebpfPsaTable.cpp
Outdated
} | ||
|
||
void EBPFTablePSA::emitKeysAndValues(CodeBuilder *builder, | ||
std::vector<const IR::Entry *> &samePrefixEntries, |
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.
inconsistent indentation
backends/ebpf/psa/ebpfPsaTable.cpp
Outdated
BUG("Cannot assess field bit width"); | ||
} | ||
builder->append("0x"); | ||
for (int j = 0; j < width / 8; j++) |
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.
does this work with non-aligned widths too?
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.
you should factor this into a utility function getHexMask, or something of the kind.
} | ||
} | ||
|
||
std::vector<std::vector<const IR::Entry*>> EBPFTablePSA::getConstEntriesGroupedByPrefix() { |
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.
A small comment would help make this function easier to interpret.
backends/ebpf/psa/ebpfPsaTable.cpp
Outdated
std::vector<std::vector<const IR::Entry*>> EBPFTablePSA::getConstEntriesGroupedByPrefix() { | ||
std::vector<std::vector<const IR::Entry*>> entriesGroupedByPrefix; | ||
const IR::EntriesList* entries = table->container->getEntries(); | ||
if (entries != nullptr) { |
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.
especially for long ifs I find it simpler to if (!entries) return ...;
One less level of indentation afterwards.
@mbudiu-vmw I've addressed comments. |
* Add support for ternary const entries in ebpf-PSA backend
This PR adds possibility to use const entries with ternary tables.