Skip to content

Commit

Permalink
[FRR]BGP Fixes and optimizations for handling scale scenarios
Browse files Browse the repository at this point in the history
<!--
     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)
  • Loading branch information
mssonicbld committed Jan 8, 2025
1 parent 72a23cd commit 8120cd1
Show file tree
Hide file tree
Showing 9 changed files with 5,190 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
From 1102e4f6ee58d0d41596880fe3a7c82840ee679e Mon Sep 17 00:00:00 2001
From: Donald Sharp <sharpd@nvidia.com>
Date: Tue, 1 Oct 2024 14:31:08 -0400
Subject: [PATCH] lib: nexthop code should use uint16_t for nexthop counting

It's possible to specify via the cli and configure how many
nexthops that are allowed on the system. If you happen to
have > 255 then things are about to get interesting otherwise.

Let's allow up to 65k nexthops (ha!)

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

diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c
index 3f408e0a71..cb1ebb5d09 100644
--- a/lib/nexthop_group.c
+++ b/lib/nexthop_group.c
@@ -70,10 +70,10 @@ static struct nexthop *nexthop_group_tail(const struct nexthop_group *nhg)
return nexthop;
}

-uint8_t nexthop_group_nexthop_num(const struct nexthop_group *nhg)
+uint16_t nexthop_group_nexthop_num(const struct nexthop_group *nhg)
{
struct nexthop *nhop;
- uint8_t num = 0;
+ uint16_t num = 0;

for (ALL_NEXTHOPS_PTR(nhg, nhop))
num++;
@@ -81,11 +81,10 @@ uint8_t nexthop_group_nexthop_num(const struct nexthop_group *nhg)
return num;
}

-static uint8_t
-nexthop_group_nexthop_num_no_recurse(const struct nexthop_group *nhg)
+static uint16_t nexthop_group_nexthop_num_no_recurse(const struct nexthop_group *nhg)
{
struct nexthop *nhop;
- uint8_t num = 0;
+ uint16_t num = 0;

for (nhop = nhg->nexthop; nhop; nhop = nhop->next)
num++;
@@ -93,10 +92,10 @@ nexthop_group_nexthop_num_no_recurse(const struct nexthop_group *nhg)
return num;
}

-uint8_t nexthop_group_active_nexthop_num(const struct nexthop_group *nhg)
+uint16_t nexthop_group_active_nexthop_num(const struct nexthop_group *nhg)
{
struct nexthop *nhop;
- uint8_t num = 0;
+ uint16_t num = 0;

for (ALL_NEXTHOPS_PTR(nhg, nhop)) {
if (CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_ACTIVE))
@@ -184,11 +183,9 @@ static struct nexthop *nhg_nh_find(const struct nexthop_group *nhg,
return NULL;
}

-static bool
-nexthop_group_equal_common(const struct nexthop_group *nhg1,
- const struct nexthop_group *nhg2,
- uint8_t (*nexthop_group_nexthop_num_func)(
- const struct nexthop_group *nhg))
+static bool nexthop_group_equal_common(
+ const struct nexthop_group *nhg1, const struct nexthop_group *nhg2,
+ uint16_t (*nexthop_group_nexthop_num_func)(const struct nexthop_group *nhg))
{
if (nhg1 && !nhg2)
return false;
diff --git a/lib/nexthop_group.h b/lib/nexthop_group.h
index 822a35439c..9103299418 100644
--- a/lib/nexthop_group.h
+++ b/lib/nexthop_group.h
@@ -149,9 +149,8 @@ extern void nexthop_group_json_nexthop(json_object *j,
const struct nexthop *nh);

/* Return the number of nexthops in this nhg */
-extern uint8_t nexthop_group_nexthop_num(const struct nexthop_group *nhg);
-extern uint8_t
-nexthop_group_active_nexthop_num(const struct nexthop_group *nhg);
+extern uint16_t nexthop_group_nexthop_num(const struct nexthop_group *nhg);
+extern uint16_t nexthop_group_active_nexthop_num(const struct nexthop_group *nhg);

extern bool nexthop_group_has_label(const struct nexthop_group *nhg);

--
2.43.2

Loading

0 comments on commit 8120cd1

Please sign in to comment.