Skip to content
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

Merged
merged 1 commit into from
Apr 5, 2019

Conversation

sworleys
Copy link
Member

@sworleys sworleys commented Apr 2, 2019

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

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, 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.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Ubuntu 16.04 amd64 build: Successful with additional warnings

Debian Package lintian failed for Ubuntu 16.04 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7111/artifact/CI014BUILD/ErrorLog/log_lintian.txt)

W: frr-rpki-rtrlib: package-has-long-file-name 72 (81) > 80
Ubuntu 18.04 amd64 build: Successful with additional warnings

Debian Package lintian failed for Ubuntu 18.04 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7111/artifact/U1804AMD64/ErrorLog/log_lintian.txt)

W: frr-rpki-rtrlib: package-has-long-file-name 72 (81) > 80
Ubuntu 16.04 i386 build: Successful with additional warnings

Debian Package lintian failed for Ubuntu 16.04 i386 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7111/artifact/U1604I386/ErrorLog/log_lintian.txt)

W: frr-rpki-rtrlib: package-has-long-file-name 71 (81) > 80
Debian 9 amd64 build: Successful with additional warnings

Debian Package lintian failed for Debian 9 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7111/artifact/CI021BUILD/ErrorLog/log_lintian.txt)

W: frr-rpki-rtrlib-dbgsym: package-has-long-file-name 72 (81) > 80
Ubuntu 14.04 amd64 build: Successful with additional warnings

Debian Package lintian failed for Ubuntu 14.04 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7111/artifact/CI001BUILD/ErrorLog/log_lintian.txt)

W: frr-rpki-rtrlib: package-has-long-file-name 72 (81) > 80
<TITLE>clang_check</TITLE>

clang_check

@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 2, 2019

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/4066 9358c78
Date 04/02/2019
Start 14:59:02
Finish 15:22:50
Run-Time 23:48
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2019-04-02-14:59:02.txt
Log autoscript-2019-04-02-14:59:45.log.bz2
Memory 499 491 429

For details, please contact louberger

@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 2, 2019

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/4066 cf0294a
Date 04/02/2019
Start 17:35:13
Finish 17:59:43
Run-Time 24:30
Total 1816
Pass 1816
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2019-04-02-17:35:13.txt
Log autoscript-2019-04-02-17:36:06.log.bz2
Memory 468 491 429

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, 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.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Ubuntu 16.04 i386 build: Successful with additional warnings

Debian Package lintian failed for Ubuntu 16.04 i386 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7112/artifact/U1604I386/ErrorLog/log_lintian.txt)

W: frr-rpki-rtrlib: package-has-long-file-name 71 (81) > 80
Ubuntu 16.04 amd64 build: Successful with additional warnings

Debian Package lintian failed for Ubuntu 16.04 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7112/artifact/CI014BUILD/ErrorLog/log_lintian.txt)

W: frr-rpki-rtrlib: package-has-long-file-name 72 (81) > 80
Ubuntu 18.04 amd64 build: Successful with additional warnings

Debian Package lintian failed for Ubuntu 18.04 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7112/artifact/U1804AMD64/ErrorLog/log_lintian.txt)

W: frr-rpki-rtrlib: package-has-long-file-name 72 (81) > 80
Debian 9 amd64 build: Successful with additional warnings

Debian Package lintian failed for Debian 9 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7112/artifact/CI021BUILD/ErrorLog/log_lintian.txt)

W: frr-rpki-rtrlib-dbgsym: package-has-long-file-name 72 (81) > 80
Ubuntu 14.04 amd64 build: Successful with additional warnings

Debian Package lintian failed for Ubuntu 14.04 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7112/artifact/CI001BUILD/ErrorLog/log_lintian.txt)

W: frr-rpki-rtrlib: package-has-long-file-name 72 (81) > 80
<TITLE>clang_check</TITLE>

clang_check

Copy link
Member

@louberger louberger left a 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.

*/
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);
Copy link
Member

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?

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);
Copy link
Member

@louberger louberger Apr 4, 2019

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;
}

@qlyoung qlyoung added the zebra label Apr 4, 2019
@sworleys
Copy link
Member Author

sworleys commented Apr 5, 2019

This are suggested changes - if you really don't want to make them, I won't object.

@louberger I implemented your suggested changes and also moved the hash function directly into lib/nexthop.c per @mjstapp 's suggestion offline.

Copy link
Contributor

@mjstapp mjstapp left a 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.

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, 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.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Checkout code: Successful with additional warnings
Report for nexthop_group.c | 2 issues
===============================================
< WARNING: braces {} are not necessary for single statement blocks
< #160: FILE: /tmp/f1-22250/nexthop_group.c:160:
<TITLE>clang_check</TITLE>

clang_check

@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 5, 2019

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/4066 955ba95
Date 04/05/2019
Start 10:08:41
Finish 10:32:28
Run-Time 23:47
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2019-04-05-10:08:41.txt
Log autoscript-2019-04-05-10:09:25.log.bz2
Memory 498 497 429

For details, please contact louberger

@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 5, 2019

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/4066 facf5e9
Date 04/05/2019
Start 11:24:02
Finish 11:47:50
Run-Time 23:48
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2019-04-05-11:24:02.txt
Log autoscript-2019-04-05-11:24:45.log.bz2
Memory 494 501 429

For details, please contact louberger

@louberger
Copy link
Member

louberger commented Apr 5, 2019 via email

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, 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.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Checkout code: Successful with additional warnings
Report for nexthop_group.c | 2 issues
===============================================
< WARNING: braces {} are not necessary for single statement blocks
< #160: FILE: /tmp/f1-31495/nexthop_group.c:160:
<TITLE>clang_check</TITLE>

clang_check

Copy link
Contributor

@mjstapp mjstapp left a 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

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, 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.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Checkout code: Successful with additional warnings
Report for nexthop_group.c | 2 issues
===============================================
< WARNING: braces {} are not necessary for single statement blocks
< #160: FILE: /tmp/f1-25261/nexthop_group.c:160:
<TITLE>clang_check</TITLE>

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>
@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 5, 2019

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/4066 1b1fe1c
Date 04/05/2019
Start 14:29:08
Finish 14:52:57
Run-Time 23:49
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2019-04-05-14:29:08.txt
Log autoscript-2019-04-05-14:29:51.log.bz2
Memory 502 497 429

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, 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.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

<TITLE>clang_check</TITLE>

clang_check

@mjstapp mjstapp merged commit a1a972f into FRRouting:master Apr 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants