@@ -3475,8 +3475,8 @@ static bool is_srv6_nhg(struct nhg_hash_entry *nhe)
34753475 * but with recursive ones to keep depending relations.
34763476 */
34773477static uint32_t zebra_nhg_nhe2grp_full_internal (struct nh_grp_full * grp_full , uint32_t curr_index ,
3478- struct nhg_hash_entry * nhe , struct nhg_hash_entry * original ,
3479- uint32_t max_num )
3478+ struct nhg_hash_entry * nhe ,
3479+ struct nhg_hash_entry * original , uint32_t max_num )
34803480{
34813481 struct nhg_connected * rb_node_dep = NULL ;
34823482 struct nhg_hash_entry * curr_node = NULL ;
@@ -3487,10 +3487,9 @@ static uint32_t zebra_nhg_nhe2grp_full_internal(struct nh_grp_full *grp_full, ui
34873487 * We only write its direct depends in the array.
34883488 */
34893489 /* go through all depends from current node */
3490- frr_each (nhg_connected_tree , & nhe -> nhg_depends , rb_node_dep ) {
3490+ frr_each (nhg_connected_tree , & nhe -> nhg_depends , rb_node_dep ) {
34913491 if (i >= max_num ) {
3492- zlog_err ("%s: BREAK: i=%u >= max_num=%u" ,
3493- __func__ , i , max_num );
3492+ zlog_err ("%s: BREAK: i=%u >= max_num=%u" , __func__ , i , max_num );
34943493 goto done ;
34953494 }
34963495
@@ -3500,39 +3499,31 @@ static uint32_t zebra_nhg_nhe2grp_full_internal(struct nh_grp_full *grp_full, ui
35003499 * and we will put in installed or queued ones (same logic as zebra_nhg_nhe2grp_internal).
35013500 * If it's a invalid nhg for normal case, skip
35023501 */
3503- if (!is_srv6_nhg (curr_node )
3504- && !CHECK_FLAG (curr_node -> flags , NEXTHOP_GROUP_VALID )) {
3505- if (IS_ZEBRA_DEBUG_RIB_DETAILED
3506- || IS_ZEBRA_DEBUG_NHG )
3507- zlog_debug (
3508- "%s: NHG ID (%u) not valid as a normal case, not appending to dplane install group" ,
3509- __func__ , curr_node -> id );
3502+ if (!is_srv6_nhg (curr_node ) && !CHECK_FLAG (curr_node -> flags , NEXTHOP_GROUP_VALID )) {
3503+ if (IS_ZEBRA_DEBUG_RIB_DETAILED || IS_ZEBRA_DEBUG_NHG )
3504+ zlog_debug ("%s: NHG ID (%u) not valid as a normal case, not appending to dplane install group" ,
3505+ __func__ , curr_node -> id );
35103506 continue ;
35113507 }
35123508
35133509 /* Recursive NHGs are never installed to kernel, only require VALID.
35143510 * Non-recursive (leaf) NHGs must be INSTALLED or QUEUED to be included.
35153511 */
3516- if (!is_srv6_nhg (curr_node )
3517- && !CHECK_FLAG (curr_node -> flags , NEXTHOP_GROUP_RECURSIVE )
3518- && !(CHECK_FLAG (curr_node -> flags , NEXTHOP_GROUP_INSTALLED ) ||
3519- CHECK_FLAG (curr_node -> flags , NEXTHOP_GROUP_QUEUED )))
3520- {
3521- if (IS_ZEBRA_DEBUG_RIB_DETAILED
3522- || IS_ZEBRA_DEBUG_NHG )
3523- zlog_debug (
3524- "%s: NHG ID (%u) not installed or queued as a normal case, not appending to dplane install group" ,
3525- __func__ , curr_node -> id );
3512+ if (!is_srv6_nhg (curr_node ) &&
3513+ !CHECK_FLAG (curr_node -> flags , NEXTHOP_GROUP_RECURSIVE ) &&
3514+ !(CHECK_FLAG (curr_node -> flags , NEXTHOP_GROUP_INSTALLED ) ||
3515+ CHECK_FLAG (curr_node -> flags , NEXTHOP_GROUP_QUEUED ))) {
3516+ if (IS_ZEBRA_DEBUG_RIB_DETAILED || IS_ZEBRA_DEBUG_NHG )
3517+ zlog_debug ("%s: NHG ID (%u) not installed or queued as a normal case, not appending to dplane install group" ,
3518+ __func__ , curr_node -> id );
35263519 continue ;
35273520 }
35283521
35293522 /* If it's queued, we just log but not skip */
35303523 if (CHECK_FLAG (curr_node -> flags , NEXTHOP_GROUP_QUEUED )) {
3531- if (IS_ZEBRA_DEBUG_RIB_DETAILED
3532- || IS_ZEBRA_DEBUG_NHG )
3533- zlog_debug (
3534- "%s: NUG ID (%u) queued, dependency being installed, we add it to nh_grp_full array." ,
3535- __func__ , curr_node -> id );
3524+ if (IS_ZEBRA_DEBUG_RIB_DETAILED || IS_ZEBRA_DEBUG_NHG )
3525+ zlog_debug ("%s: NUG ID (%u) queued, dependency being installed, we add it to nh_grp_full array." ,
3526+ __func__ , curr_node -> id );
35363527 }
35373528
35383529 if (!zebra_nhg_depends_is_empty (curr_node )) {
@@ -3543,14 +3534,18 @@ static uint32_t zebra_nhg_nhe2grp_full_internal(struct nh_grp_full *grp_full, ui
35433534 struct nhg_connected * sub_rb_node = NULL ;
35443535
35453536 /* Count how many sub-depends this node has */
3546- frr_each (nhg_connected_tree , & curr_node -> nhg_depends , sub_rb_node ) {
3537+ frr_each (nhg_connected_tree , & curr_node -> nhg_depends ,
3538+ sub_rb_node ) {
35473539 /* Apply same filters as main loop */
3548- if (!is_srv6_nhg (sub_rb_node -> nhe )
3549- && !CHECK_FLAG (sub_rb_node -> nhe -> flags , NEXTHOP_GROUP_VALID ))
3540+ if (!is_srv6_nhg (sub_rb_node -> nhe ) &&
3541+ !CHECK_FLAG (sub_rb_node -> nhe -> flags ,
3542+ NEXTHOP_GROUP_VALID ))
35503543 continue ;
3551- if (!is_srv6_nhg (sub_rb_node -> nhe )
3552- && !(CHECK_FLAG (sub_rb_node -> nhe -> flags , NEXTHOP_GROUP_INSTALLED ) ||
3553- CHECK_FLAG (sub_rb_node -> nhe -> flags , NEXTHOP_GROUP_QUEUED )))
3544+ if (!is_srv6_nhg (sub_rb_node -> nhe ) &&
3545+ !(CHECK_FLAG (sub_rb_node -> nhe -> flags ,
3546+ NEXTHOP_GROUP_INSTALLED ) ||
3547+ CHECK_FLAG (sub_rb_node -> nhe -> flags ,
3548+ NEXTHOP_GROUP_QUEUED )))
35543549 continue ;
35553550
35563551 sub_depend_count ++ ;
@@ -3564,22 +3559,20 @@ static uint32_t zebra_nhg_nhe2grp_full_internal(struct nh_grp_full *grp_full, ui
35643559 }
35653560
35663561 /* Then, recursively write its sub-depends */
3567- i = zebra_nhg_nhe2grp_full_internal (grp_full , i , curr_node , original , max_num );
3568- }
3569- else {
3562+ i = zebra_nhg_nhe2grp_full_internal (grp_full , i , curr_node , original ,
3563+ max_num );
3564+ } else {
35703565 /* Go through the resolved nexthops to get weight,
35713566 * but we do not use this to determine if put in this node.
35723567 * We put in all depends nodes, and set the state flag of them.
35733568 */
35743569 bool found = false;
35753570
35763571 for (ALL_NEXTHOPS_PTR (& original -> nhg , nexthop )) {
3577- if (CHECK_FLAG (nexthop -> flags ,
3578- NEXTHOP_FLAG_RECURSIVE ))
3572+ if (CHECK_FLAG (nexthop -> flags , NEXTHOP_FLAG_RECURSIVE ))
35793573 continue ;
35803574
3581- if (nexthop_cmp_no_weight (curr_node -> nhg .nexthop ,
3582- nexthop ) != 0 )
3575+ if (nexthop_cmp_no_weight (curr_node -> nhg .nexthop , nexthop ) != 0 )
35833576 continue ;
35843577
35853578 found = true;
@@ -3590,8 +3583,7 @@ static uint32_t zebra_nhg_nhe2grp_full_internal(struct nh_grp_full *grp_full, ui
35903583 * that means it's not a valid nhg and we record it.
35913584 */
35923585 if (!found ) {
3593- if (IS_ZEBRA_DEBUG_RIB_DETAILED ||
3594- IS_ZEBRA_DEBUG_NHG )
3586+ if (IS_ZEBRA_DEBUG_RIB_DETAILED || IS_ZEBRA_DEBUG_NHG )
35953587 zlog_debug ("%s: Nexthop ID (%u) unable to find nexthop in Nexthop Group Entry, something is terribly wrong" ,
35963588 __func__ , curr_node -> id );
35973589 }
@@ -3612,22 +3604,19 @@ static uint32_t zebra_nhg_nhe2grp_full_internal(struct nh_grp_full *grp_full, ui
36123604 zlog_debug ("%s: skipping backup nhe" , __func__ );
36133605
36143606done :
3615- zlog_debug ("%s: dumping grp_full array from [%u] to [%u]:" ,
3616- __func__ , curr_index , i > 0 ? i - 1 : 0 );
3607+ zlog_debug ("%s: dumping grp_full array from [%u] to [%u]:" , __func__ , curr_index ,
3608+ i > 0 ? i - 1 : 0 );
36173609 for (uint32_t idx = curr_index ; idx < i && idx < max_num ; idx ++ ) {
3618- zlog_debug ("%s: grp_full[%u] = {id=%u, weight=%u, num_direct=%u}" ,
3619- __func__ , idx ,
3620- grp_full [idx ].id ,
3621- grp_full [idx ].weight ,
3622- grp_full [idx ].num_direct );
3610+ zlog_debug ("%s: grp_full[%u] = {id=%u, weight=%u, num_direct=%u}" , __func__ , idx ,
3611+ grp_full [idx ].id , grp_full [idx ].weight , grp_full [idx ].num_direct );
36233612 }
36243613
36253614 return i ;
36263615}
36273616
36283617/* Convert a nhe into a group array with full depends */
3629- uint32_t zebra_nhg_nhe2grp_full (struct nh_grp_full * grp_full ,
3630- struct nhg_hash_entry * nhe , uint32_t max_num )
3618+ uint32_t zebra_nhg_nhe2grp_full (struct nh_grp_full * grp_full , struct nhg_hash_entry * nhe ,
3619+ uint32_t max_num )
36313620{
36323621 /* Call into the recursive function */
36333622 return zebra_nhg_nhe2grp_full_internal (grp_full , 0 , nhe , nhe , max_num );
@@ -3654,7 +3643,7 @@ void zebra_nhg_mark_received_flag(struct nhg_hash_entry *nhe)
36543643 zlog_debug ("%s: Marking nhg %pNG as received" , __func__ , nhe );
36553644 }
36563645 /* Make sure all depends are marked as well*/
3657- frr_each (nhg_connected_tree , & nhe -> nhg_depends , rb_node_dep ) {
3646+ frr_each (nhg_connected_tree , & nhe -> nhg_depends , rb_node_dep ) {
36583647 zebra_nhg_mark_received_flag (rb_node_dep -> nhe );
36593648 }
36603649}
@@ -3671,8 +3660,7 @@ void zebra_nhg_install_kernel(struct nhg_hash_entry *nhe, uint8_t type)
36713660 * as-is (with their recursive nexthop address) for backwalk support.
36723661 */
36733662 if (!CHECK_FLAG (nhe -> flags , NEXTHOP_GROUP_RECEIVED ) &&
3674- !(zebra_nhg_fib_enabled &&
3675- CHECK_FLAG (nhe -> flags , NEXTHOP_GROUP_RECURSIVE ))) {
3663+ !(zebra_nhg_fib_enabled && CHECK_FLAG (nhe -> flags , NEXTHOP_GROUP_RECURSIVE ))) {
36763664 if (IS_ZEBRA_DEBUG_NHG_DETAIL )
36773665 zlog_debug ("%s: resolving nhg %pNG before install since it is not marked as received" ,
36783666 __func__ , nhe );
0 commit comments