Skip to content

Remove in6addr cmp#17312

Merged
ton31337 merged 3 commits intoFRRouting:masterfrom
donaldsharp:remove_in6addr_cmp
Nov 1, 2024
Merged

Remove in6addr cmp#17312
ton31337 merged 3 commits intoFRRouting:masterfrom
donaldsharp:remove_in6addr_cmp

Conversation

@donaldsharp
Copy link
Member

As a note, switching from from in6addr_cmp to memcmp significantly reduced cpu convergence time from ~3 minutes 30 seconds to 2 minutes 30 seconds with 100k x 256 ecmp in bgp

@frrbot frrbot bot added libfrr tests Topotests, make check, etc labels Oct 30, 2024
}
}

int in6addr_cmp(const struct in6_addr *addr1, const struct in6_addr *addr2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't we just change the implementation of this so that it's not so ... awkward?
it seems nice to have the v6 address-specific signature, for instance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except of course we have IPV6_ADDR_CMP and a couple other places where we just use memcmp for v6 addresses in sockunion.c. I've just converted them over to use that version. All in all looks like a bunch of places could be fixed up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure- it's not the use of memcmp() at the bottom level that I was asking about, it's about having a v6-specific signature that seems ... useful and helpful. Just a fan of apis that help folks use our data types in a natural sort of way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why IPV6_ADDR_CMP is not sufficient. the custom function was incredibly slow, when I removed it in a 256 peer X 100k routes I dropped from ~3:30 convergence to 2:30 convergence.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that the byte-by-byte implementation was not good - fine, let's do it better.
the macro is just a macro, so no type-checking of its arguments - I like the idea of a strongly-typed utility (that has a good implementation). but it's ok - if you and Donatas are ok with the macro, I'm not lying on the tracks

memcmp will return and act exactly the same as in6addr_cmp
but it does it significantly faster than how in6addr_cmp
does it.  Let this be a lesson for implementing something
that is a duplicate of what is provided by the c library.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This function should just be memcmp.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
@ton31337 ton31337 requested a review from mjstapp November 1, 2024 08:12
@ton31337 ton31337 merged commit a69f661 into FRRouting:master Nov 1, 2024
lguohan pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Dec 19, 2024
Why I did it
Added patches from FRR to support scale of BGP neighbors to 256/514. Below are the patches

Patch	FRR Pull request
0069-lib-nexthop-code-should-use-uint16_t-for-nexthop-cou.patch	FRRouting/frr#16967
0070-Allow-16-bit-size-for-nexthops.patch	FRRouting/frr#17023
0071-zebra-Only-notify-dplane-work-pthread-when-needed.patch	FRRouting/frr#17062
0072-Fix-up-improper-handling-of-nexthops-for-nexthop-tra.patch	FRRouting/frr#17076
0073-remove-in6addr-cmp.patch	FRRouting/frr#17312
0074-bgp-best-port-reordering.patch	FRRouting/frr#15572
0075-bgp-mp-info-changes.patch	FRRouting/frr#16961
0076-Optimizations-and-problem-fixing-for-large-scale-ecmp-from-bgp.patch	FRRouting/frr#17229
dgsudharsan added a commit to dgsudharsan/sonic-buildimage that referenced this pull request Dec 23, 2024
…net#21199)

Why I did it
Added patches from FRR to support scale of BGP neighbors to 256/514. Below are the patches

Patch	FRR Pull request
0069-lib-nexthop-code-should-use-uint16_t-for-nexthop-cou.patch	FRRouting/frr#16967
0070-Allow-16-bit-size-for-nexthops.patch	FRRouting/frr#17023
0071-zebra-Only-notify-dplane-work-pthread-when-needed.patch	FRRouting/frr#17062
0072-Fix-up-improper-handling-of-nexthops-for-nexthop-tra.patch	FRRouting/frr#17076
0073-remove-in6addr-cmp.patch	FRRouting/frr#17312
0074-bgp-best-port-reordering.patch	FRRouting/frr#15572
0075-bgp-mp-info-changes.patch	FRRouting/frr#16961
0076-Optimizations-and-problem-fixing-for-large-scale-ecmp-from-bgp.patch	FRRouting/frr#17229
mssonicbld added a commit to mssonicbld/sonic-buildimage-msft that referenced this pull request Jan 8, 2025
<!--
     Please make sure you've read and understood our contributing guidelines:
     https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

     ** Make sure all your commits include a signature generated with `git commit -s` **

     If this is a bug fix, make sure your description includes "fixes #xxxx", or
     "closes #xxxx" or "resolves #xxxx"

     Please provide the following information:
-->

#### Why I did it

Added patches from FRR to support scale of BGP neighbors to 256/514. Below are the patches

| Patch | FRR Pull request|
| ------  |--------- |
| 0069-lib-nexthop-code-should-use-uint16_t-for-nexthop-cou.patch | FRRouting/frr#16967 |
| 0070-Allow-16-bit-size-for-nexthops.patch | FRRouting/frr#17023  |
| 0071-zebra-Only-notify-dplane-work-pthread-when-needed.patch | FRRouting/frr#17062 |
| 0072-Fix-up-improper-handling-of-nexthops-for-nexthop-tra.patch | FRRouting/frr#17076 |
| 0073-remove-in6addr-cmp.patch | FRRouting/frr#17312 |
| 0074-bgp-best-port-reordering.patch | FRRouting/frr#15572 |
| 0075-bgp-mp-info-changes.patch | FRRouting/frr#16961 |
| 0076-Optimizations-and-problem-fixing-for-large-scale-ecmp-from-bgp.patch | FRRouting/frr#17229 |
##### Work item tracking
- Microsoft ADO **(number only)**:

#### How I did it

#### How to verify it

<!--
If PR needs to be backported, then the PR must be tested against the base branch and the earliest backport release branch and provide tested image version on these two branches. For example, if the PR is requested for master, 202211 and 202012, then the requester needs to provide test results on master and 202012.
-->

#### Which release branch to backport (provide reason below if selected)

<!--
- Note we only backport fixes to a release branch, *not* features!
- Please also provide a reason for the backporting below.
- e.g.
- [x] 202006
-->

- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012
- [ ] 202106
- [ ] 202111
- [ ] 202205
- [ ] 202211
- [ ] 202305

#### Tested branch (Please provide the tested image version)

<!--
- Please provide tested image version
- e.g.
- [x] 20201231.100
-->

- [ ] <!-- image version 1 -->
- [ ] <!-- image version 2 -->

#### Description for the changelog
<!--
Write a short (one line) summary that describes the changes in this
pull request for inclusion in the changelog:
-->

<!--
 Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.
-->

#### Link to config_db schema for YANG module changes
<!--
Provide a link to config_db schema for the table for which YANG model
is defined
Link should point to correct section on https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md
-->

#### A picture of a cute animal (not mandatory but encouraged)
VladimirKuk pushed a commit to Marvell-switching/sonic-buildimage that referenced this pull request Jan 21, 2025
…net#21199)

Why I did it
Added patches from FRR to support scale of BGP neighbors to 256/514. Below are the patches

Patch	FRR Pull request
0069-lib-nexthop-code-should-use-uint16_t-for-nexthop-cou.patch	FRRouting/frr#16967
0070-Allow-16-bit-size-for-nexthops.patch	FRRouting/frr#17023
0071-zebra-Only-notify-dplane-work-pthread-when-needed.patch	FRRouting/frr#17062
0072-Fix-up-improper-handling-of-nexthops-for-nexthop-tra.patch	FRRouting/frr#17076
0073-remove-in6addr-cmp.patch	FRRouting/frr#17312
0074-bgp-best-port-reordering.patch	FRRouting/frr#15572
0075-bgp-mp-info-changes.patch	FRRouting/frr#16961
0076-Optimizations-and-problem-fixing-for-large-scale-ecmp-from-bgp.patch	FRRouting/frr#17229
lguohan pushed a commit to sonic-net/sonic-buildimage that referenced this pull request May 8, 2025
New patches that were added:
Patch	FRR Pull request
0086-isisd-lib-add-some-codepoints-usually-shared-with-other-vendors.patch	FRRouting/frr#17957
0087-staticd-Add-support-for-SRv6-uA-behavior.patch	FRRouting/frr#18198

Removed patches:
Patch	FRR commit / Pull request
0025-bgp-community-memory-leak-fix.patch	FRRouting/frr@e613e12
0028-zebra-fix-parse-attr-problems-for-encap.patch	FRRouting/frr@ba5a353 FRRouting/frr@569f9e4 FRRouting/frr@bd4fca1
0030-zebra-backpressure-Zebra-push-back-on-Buffer-Stream-.patch	FRRouting/frr@a8efa99
0031-bgpd-backpressure-Add-a-typesafe-list-for-Zebra-Anno.patch	FRRouting/frr@705fed7
0033-bgpd-backpressure-cleanup-bgp_zebra_XX-func-args.patch	FRRouting/frr@5f379be
0034-gpd-backpressure-Handle-BGP-Zebra-Install-evt-Creat.patch	FRRouting/frr@ccfe452
0035-bgpd-backpressure-Handle-BGP-Zebra-EPVN-Install-evt-.patch	FRRouting/frr@a07df6f
0036-zebra-backpressure-Fix-Null-ptr-access-Coverity-Issu.patch	FRRouting/frr@ed7005d
0037-bgpd-Increase-install-uninstall-speed-of-evpn-vpn-vn.patch	FRRouting/frr@9edf45b
0038-zebra-Actually-display-I-O-buffer-sizes.patch	FRRouting/frr@8d8f12b
0039-zebra-Actually-display-I-O-buffer-sizes-part-2.patch	FRRouting/frr@33dccbe
0040-bgpd-backpressure-Fix-to-withdraw-evpn-type-5-routes.patch	FRRouting/frr@f4ba472
0041-bgpd-backpressure-Fix-to-avoid-CPU-hog.patch	FRRouting/frr@920bf45
0042-zebra-Use-built-in-data-structure-counter.patch	FRRouting/frr@a23a938
0043-zebra-Use-the-ctx-queue-counters.patch	FRRouting/frr@34670c4
0044-zebra-Modify-dplane-loop-to-allow-backpressure-to-fi.patch	FRRouting/frr@3af381b
0045-zebra-Limit-queue-depth-in-dplane_fpm_nl.patch	FRRouting/frr@8926ac1
0046-zebra-Modify-show-zebra-dplane-providers-to-give-mor.patch	FRRouting/frr@98b11de
0047-bgpd-backpressure-fix-evpn-route-sync-to-zebra.patch	FRRouting/frr@b47a92e
0048-bgpd-backpressure-fix-to-properly-remove-dest-for-bg.patch	FRRouting/frr@4395fcd
0049-bgpd-backpressure-Improve-debuggability.patch	FRRouting/frr@186db96
0050-bgpd-backpressure-Avoid-use-after-free.patch	FRRouting/frr@40965e5
0051-bgpd-backpressure-fix-ret-value-evpn_route_select_in.patch	FRRouting/frr@c4bbb5b
0052-bgpd-backpressure-log-error-for-evpn-when-route-inst.patch	FRRouting/frr@6cf5b79
0055-bgpd-lib-Include-SID-structure-in-seg6local-nexthop.patch	FRRouting/frr@0402551
0059-Fix-BGP-reset-on-suppress-fib-pending-configuration.patch	FRRouting/frr#17487
0060-bgpd-Validate-both-nexthop-information-NEXTHOP-and-N.patch	FRRouting/frr@a0d2734
0061-dont-print-warning-if-not-a-daemon.patch	FRRouting/frr@cecf571
0062-zebra-lib-use-internal-rbtree-per-ns.patch	FRRouting/frr#17297
0064-SRv6-BGP-SID-reachability.patch	FRRouting/frr#14810
0065-zebra-display-srv6-encapsulation-source-address-when-configured.patch	FRRouting/frr@890b67d
0066-lib-fix-srv6-locator-flags-propagated-to-isis.patch	FRRouting/frr@03d2ad0
0067-Add-support-for-SRv6-SID-Manager.patch	FRRouting/frr#15604
0068-bgpd-Extend-BGP-to-communicate-with-the-SRv6-SID-Manager-to-allocate-release-SRv6-SIDs.patch	FRRouting/frr#15676
0069-lib-nexthop-code-should-use-uint16_t-for-nexthop-cou.patch	FRRouting/frr@0bc79f5
0070-Allow-16-bit-size-for-nexthops.patch	FRRouting/frr@9f8968f
0071-zebra-Only-notify-dplane-work-pthread-when-needed.patch	FRRouting/frr#17062
0072-Fix-up-improper-handling-of-nexthops-for-nexthop-tra.patch	FRRouting/frr#17076
0073-remove-in6addr-cmp.patch	FRRouting/frr#17312
0074-bgp-best-port-reordering.patch	FRRouting/frr#15572
0075-bgp-mp-info-changes.patch	FRRouting/frr#16961
0076-Optimizations-and-problem-fixing-for-large-scale-ecmp-from-bgp.patch	FRRouting/frr#17229
0077-frr-vtysh-dependencies-for-srv6-static-patches.patch	FRRouting/frr@fd8edc3
0078-vtysh-de-conditionalize-and-reorder-install-node.patch	FRRouting/frr@e26c580
0079-staticd-add-support-for-srv6.patch	FRRouting/frr#16894
0081-bgpd-Optimize-evaluate-paths-for-a-peer-going-down.patch	FRRouting/frr@9f55368

Realigned patches:
Patch
0001-Reduce-severity-of-Vty-connected-from-message.patch
0002-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch
0003-nexthops-compare-vrf-only-if-ip-type.patch
0004-frr-remove-frr-log-outchannel-to-var-log-frr.log.patch
0005-Add-support-of-bgp-l3vni-evpn.patch
0006-Link-local-scope-was-not-set-while-binding-socket-for-bgp-ipv6-link-local-neighbors.patch
0007-ignore-route-from-default-table.patch
0008-Use-vrf_id-for-vrf-not-tabled_id.patch
0010-bgpd-Change-log-level-for-graceful-restart-events.patch
0021-Disable-ipv6-src-address-test-in-pceplib.patch
0022-cross-compile-changes.patch
0054-build-dplane-fpm-sonic-module.patch
0056-zebra-do-not-send-local-routes-to-fpm.patch
0057-Adding-changes-to-write-ip-nht-resolve-via-default-c.patch
0058-When-the-file-is-config-replayed-we-cannot-handle-th.patch
0061-Set-multipath-to-514-and-disable-bgp-vnc-for-optimiz.patch
0063-Patch-to-send-tag-value-associated-with-route-via-ne.patch
0080-SRv6-vpn-route-and-sidlist-install.patch
0082-Revert-bgpd-upon-if-event-evaluate-bnc-with-matching.patch
0083-staticd-add-cli-to-support-steering-of-ipv4-traffic-over-srv6-sid-list.patch
0084-lib-Return-duplicate-prefix-list-entry-test.patch
0085-This-error-happens-when-we-try-to-write-to-a-socket.patch

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
@donaldsharp donaldsharp deleted the remove_in6addr_cmp branch July 30, 2025 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libfrr master size/S tests Topotests, make check, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants