Skip to content

Commit

Permalink
rh: Improve RH switch logging
Browse files Browse the repository at this point in the history
The RH switch tracking logic was unclear between when the RH was
tracking a switch and the RH consider a switch as parked/down. Fix this.

NETCASSINI-6929

Signed-off-by: Ian Ziemba <ian.ziemba@hpe.com>
  • Loading branch information
iziemba committed Jan 3, 2025
1 parent ddce489 commit 4ecfc7a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions retry_handler/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -986,15 +986,17 @@ static void switch_tree_inc(struct retry_handler *rh, uint32_t nid)
if (rh->switch_tree_count > rh->stats.max_switch_tree_count)
rh->stats.max_switch_tree_count = rh->switch_tree_count;

rh_printf(rh, LOG_WARNING,
"Adding switch=%d to parked switches\n", entry->id);
rh_printf(rh, LOG_DEBUG, "Tracking switch=%d\n", entry->id);
} else {
entry = *ret;
}

entry->count++;
if (entry->count == down_switch_nid_count) {
entry->parked = true;
rh_printf(rh, LOG_WARNING,
"Adding switch=%d to parked switches\n", entry->id);

rh->parked_switches++;
if (rh->parked_switches > rh->stats.max_parked_switches)
rh->stats.max_parked_switches = rh->parked_switches;
Expand All @@ -1020,16 +1022,18 @@ static void switch_tree_dec(struct retry_handler *rh, uint32_t nid)

if (entry->count == down_switch_nid_count) {
entry->parked = false;
rh_printf(rh, LOG_WARNING,
"Removing switch=%d from parked switches\n",
entry->id);

rh->parked_switches--;
}
entry->count--;

if (entry->count == 0) {
rh->switch_tree_count--;
tdelete(entry, &rh->switch_tree, switch_compare);
rh_printf(rh, LOG_WARNING,
"Deleting switch=%d from parked switches\n",
entry->id);
rh_printf(rh, LOG_DEBUG, "Deleting switch=%d\n", entry->id);
free(entry);
}
}
Expand Down

0 comments on commit 4ecfc7a

Please sign in to comment.