Fix CalcRtable array parameter bug#259
Merged
aboch merged 1 commit intovishvananda:masterfrom Nov 13, 2017
Merged
Conversation
Contributor
Author
Closed
Owner
|
CI is now fixed, but it looks like you need to update the test as well. |
Contributor
Author
|
@vishvananda |
Contributor
Author
|
Linux kernel does not return "TCA_POLICE_RATE" in |
aboch
reviewed
Nov 10, 2017
| if fw.Police.Rate.Rate != filter.Police.Rate.Rate { | ||
| t.Fatal("Police Rate doesn't match") | ||
| } | ||
| for i := range fw.Rtab { |
Collaborator
There was a problem hiding this comment.
So this test was passing because the two arrays fw.Rtab and filter.Rtab were actually empty because of the bug, correct ?
Collaborator
|
@yandd Please squash the two commits in one (they are about the same thing) and sign the commit. |
fcrisciani
reviewed
Nov 10, 2017
class_linux.go
Outdated
| var ctab [256]uint32 | ||
| tcrate := nl.TcRateSpec{Rate: uint32(htb.Rate)} | ||
| if CalcRtable(&tcrate, rtab, cellLog, uint32(mtu), linklayer) < 0 { | ||
| if CalcRtable(&tcrate, &rtab, cellLog, uint32(mtu), linklayer) < 0 { |
Collaborator
There was a problem hiding this comment.
instead of passing array by reference better use slices: rtab[:]
filter_linux.go
Outdated
| } | ||
|
|
||
| func CalcRtable(rate *nl.TcRateSpec, rtab [256]uint32, cellLog int, mtu uint32, linklayer int) int { | ||
| func CalcRtable(rate *nl.TcRateSpec, rtab *[256]uint32, cellLog int, mtu uint32, linklayer int) int { |
filter_linux.go
Outdated
| for i := 0; i < 256; i++ { | ||
| sz = AdjustSize(uint((i+1)<<uint32(cellLog)), uint(mpu), linklayer) | ||
| rtab[i] = uint32(Xmittime(uint64(bps), uint32(sz))) | ||
| (*rtab)[i] = uint32(Xmittime(uint64(bps), uint32(sz))) |
class_linux.go
Outdated
| opt.Rate = tcrate | ||
| tcceil := nl.TcRateSpec{Rate: uint32(htb.Ceil)} | ||
| if CalcRtable(&tcceil, ctab, ccellLog, uint32(mtu), linklayer) < 0 { | ||
| if CalcRtable(&tcceil, &ctab, ccellLog, uint32(mtu), linklayer) < 0 { |
Collaborator
|
LGTM |
Collaborator
|
Thanks @yandd @fcrisciani LGTM as well. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.