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
[SDFAB-1054] Use p4 auto generated constants #501
[SDFAB-1054] Use p4 auto generated constants #501
Conversation
f9db7d1
to
a9c9a5e
Compare
* build maps and lists of IDs
…nt var() sections
Co-authored-by: Maximilian Pudelko <pudelkoM@users.noreply.github.com>
…c into modify-translator
…c into modify-translator
…c into modify-translator
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.
LGTM, but I left minor comments that we should address before merging.
pfcpiface/up4.go
Outdated
|
||
switch counterID { | ||
case p4constants.CounterPreQosPipePreQosCounter: | ||
//FIXME to fully exploit p4constants, counters should be a map instead of a slice |
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.
what do you mean by fully exploit p4constants
? We get counterName from p4constants and counter size is retrieved from UP4's P4Info. What can we do more?
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.
switch counterID {
case p4constants.CounterPreQosPipePreQosCounter:
//FIXME to fully exploit p4constants, counters should be a map instead of a slice
up4.initCounter(preQosCounterID, counterName, uint64(counterSize))
case p4constants.CounterPostQosPipePostQosCounter:
up4.initCounter(postQosCounterID, counterName, uint64(counterSize))
}
all of the above code could be replaced by up4.initCounter(counterID, counterName, counterSize)
.
This means that we could also get rid of
preQosCounterID = iota
postQosCounterID
That FIXME
is pointing to this improvement, basically. It is not implemented because counters
is a slice and it's allocating counters sequentially, in setUpfInfo()
.
The above simplification can be achieved, however, with a refactor on how we handle counters IMO.
Anyway, I removed that FIXME
so that we can merge this and address the improvements on a later PR.
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.
ok, I see. Getting rid of preQosCounterID
and postQosCounterID
requires refactoring of the entire counter allocation mechanism. We can address it later.
Make use of P4 constants and remove methods that iterate over p4info to retrieve ID.
depends on:
Generate Go P4 constants for UP4 pipeline from p4info #499Add convenience functions to generated p4info code #508[SDFAB-1090] Don't set UP4 forwarding pipeline config #548