]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Optimize invoking nhg compare func 17839/head
authorRajasekar Raja <rajasekarr@nvidia.com>
Fri, 10 Jan 2025 21:39:12 +0000 (13:39 -0800)
committerRajasekar Raja <rajasekarr@nvidia.com>
Fri, 10 Jan 2025 21:39:12 +0000 (13:39 -0800)
In some cases, the old_re nhe and the newnhe is same and there is no
point in comparing them both since they are the same. Skip comparing in
such cases.

Ex:
2025/01/09 23:49:27.489020 ZEBRA: [W4Z4R-NTSMD] zebra_nhg_rib_find_nhe: => nhe 0x555f611d30c0 (44[38/39/45])
2025/01/09 23:49:27.489021 ZEBRA: [ZH3FQ-TE9NV] zebra_nhg_rib_compare_old_nhe: 0.0.0.0/0 new id: 44 old id: 44
2025/01/09 23:49:27.489021 ZEBRA: [YB8HE-Z86GN] zebra_nhg_rib_compare_old_nhe: 0.0.0.0/0 NEW 0x555f611d30c0 (44[38/39/45])
2025/01/09 23:49:27.489023 ZEBRA: [ZSB1Z-XM2V3] 0.0.0.0/0: NH 20.1.1.9[0] vrf default(0) wgt 1, with flags
2025/01/09 23:49:27.489024 ZEBRA: [ZSB1Z-XM2V3] 0.0.0.0/0: NH 30.1.2.9[0] vrf default(0) wgt 1, with flags
2025/01/09 23:49:27.489025 ZEBRA: [ZSB1Z-XM2V3] 0.0.0.0/0: NH 20.1.1.2[4] vrf default(0) wgt 1, with flags ACTIVE
2025/01/09 23:49:27.489026 ZEBRA: [ZM3BX-HPETZ] zebra_nhg_rib_compare_old_nhe: 0.0.0.0/0 OLD 0x555f611d30c0 (44[38/39/45])
2025/01/09 23:49:27.489027 ZEBRA: [ZSB1Z-XM2V3] 0.0.0.0/0: NH 20.1.1.9[0] vrf default(0) wgt 1, with flags
2025/01/09 23:49:27.489028 ZEBRA: [ZSB1Z-XM2V3] 0.0.0.0/0: NH 30.1.2.9[0] vrf default(0) wgt 1, with flags
2025/01/09 23:49:27.489028 ZEBRA: [ZSB1Z-XM2V3] 0.0.0.0/0: NH 20.1.1.2[4] vrf default(0) wgt 1, with flags ACTIVE

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
zebra/zebra_nhg.c

index 6a43fe0c84babba73da928ca027133635ef261c7..0a79ed5590cde83739a3e985e15fc257d7baa110 100644 (file)
@@ -3145,8 +3145,8 @@ backups_done:
 
                remove = new_nhe;
 
-               if (old_re && old_re->type == re->type &&
-                   old_re->instance == re->instance)
+               if (old_re && old_re->type == re->type && old_re->instance == re->instance &&
+                   new_nhe != old_re->nhe)
                        new_nhe = zebra_nhg_rib_compare_old_nhe(rn, re, new_nhe,
                                                                old_re->nhe);