-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
lib: Add hash function for nexthop groups #4066
Conversation
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7111/ This is a comment from an automated CI system. Warnings Generated during build:Ubuntu 16.04 amd64 build: Successful with additional warningsDebian Package lintian failed for Ubuntu 16.04 amd64 build:
Ubuntu 18.04 amd64 build: Successful with additional warningsDebian Package lintian failed for Ubuntu 18.04 amd64 build:
Ubuntu 16.04 i386 build: Successful with additional warningsDebian Package lintian failed for Ubuntu 16.04 i386 build:
Debian 9 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 9 amd64 build:
Ubuntu 14.04 amd64 build: Successful with additional warningsDebian Package lintian failed for Ubuntu 14.04 amd64 build:
clang_check |
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
9358c78
to
cf0294a
Compare
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7112/ This is a comment from an automated CI system. Warnings Generated during build:Ubuntu 16.04 i386 build: Successful with additional warningsDebian Package lintian failed for Ubuntu 16.04 i386 build:
Ubuntu 16.04 amd64 build: Successful with additional warningsDebian Package lintian failed for Ubuntu 16.04 amd64 build:
Ubuntu 18.04 amd64 build: Successful with additional warningsDebian Package lintian failed for Ubuntu 18.04 amd64 build:
Debian 9 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 9 amd64 build:
Ubuntu 14.04 amd64 build: Successful with additional warningsDebian Package lintian failed for Ubuntu 14.04 amd64 build:
clang_check |
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 are suggested changes - if you really don't want to make them, I won't object.
lib/nexthop_group.c
Outdated
*/ | ||
for (nh = nhg->nexthop; nh; nh = nh->next) { | ||
key = jhash_1word(nh->type, key); | ||
key = jhash_2words(nh->vrf_id, nh->nh_label_type, key); |
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 not jhash_3words instead of 1 followed by 2words?
lib/nexthop_group.c
Outdated
key = jhash(&nh->rmap_src, sizeof(nh->rmap_src), key); | ||
if (nh->nh_label) { | ||
for (i = 0; i < nh->nh_label->num_labels; i++) | ||
key = jhash_1word(nh->nh_label->label[i], key); |
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.
I think it's worth special casing the 2 and 3word case, i.e., something like
i = nh->nh_label->num_labels;
while (i >= 3) {
key = jhash_3words(nh->nh_label->label[i], nh->nh_label->label[i+1],nh->nh_label->label[i+2],key);
i -=3;
}
if (i >= 2) {
key = jhash_2words(nh->nh_label->label[i], nh->nh_label->label[i+1],key);
i -=2;
}
if (i >= 2) {
key = jhash_1word(nh->nh_label->label[i], key);
i -=2;
}
cf0294a
to
955ba95
Compare
@louberger I implemented your suggested changes and also moved the hash function directly into lib/nexthop.c per @mjstapp 's suggestion offline. |
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.
Thanks for moving the logic into the individual nexthop - but I had a concern about the label array indexing.
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7158/ This is a comment from an automated CI system. Warnings Generated during build:Checkout code: Successful with additional warnings
clang_check |
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
955ba95
to
facf5e9
Compare
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Yes, sorry bad pseudo code on my part...
…----------
On April 5, 2019 9:40:02 AM Mark Stapp ***@***.***> wrote:
mjstapp requested changes on this pull request.
Thanks for moving the logic into the individual nexthop - but I had a
concern about the label array indexing.
>
+ if (nexthop->nh_label) {
+ int i = nexthop->nh_label->num_labels;
+
+ while (i >= 3) {
+ key = jhash_3words(nexthop->nh_label->label[i],
+ nexthop->nh_label->label[i + 1],
we can't really use `i` this way, can we - aren't we looking beyond the end
of the array? I think we need two variables - one counting forward from
zero, and a second one counting down the remaining number of labels to process.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#4066 (review)
|
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7162/ This is a comment from an automated CI system. Warnings Generated during build:Checkout code: Successful with additional warnings
clang_check |
facf5e9
to
bd495cc
Compare
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.
thanks for the 'const' - looks good
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7167/ This is a comment from an automated CI system. Warnings Generated during build:Checkout code: Successful with additional warnings
clang_check |
Add a hash function to turn a nexthop group into a 32 bit unsigned hash key with jhash. We do not care to hash any recursively resolved nexthops, just the group. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
bd495cc
to
1b1fe1c
Compare
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7168/ This is a comment from an automated CI system. clang_check |
Add a hash function to turn a nexthop group into a
32 bit unsigned hash key with jhash. We do not care to
hash any recursively resolved nexthops, just the group.
Signed-off-by: Stephen Worley sworley@cumulusnetworks.com