From bd6a4c3e40fbf9a6af78ebb5b51cae946012e969 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 10 Aug 2020 21:12:28 +0200 Subject: hodec2: log requirements of best candidate, log rxlev in dBm Instead of logging a hex value for the met requirements, fully expand the "ABC" flags for both TCH/F and TCH/H. From HO_CANDIDATE_FMT/_ARGS, split off into REQUIREMENTS_FMT/_ARGS and use that when logging the chosen HO candidates. Also change the RX level to dBm, to match general logging and reduce confusion between rxlev number variants in the log. Change-Id: I1b30a6e98bdb4bd92e72864fafdd2f4f3ae3134c --- src/osmo-bsc/handover_decision_2.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/osmo-bsc/handover_decision_2.c b/src/osmo-bsc/handover_decision_2.c index 31919576e..c818dbbde 100644 --- a/src/osmo-bsc/handover_decision_2.c +++ b/src/osmo-bsc/handover_decision_2.c @@ -797,26 +797,30 @@ static int trigger_ho(struct ho_candidate *c, uint8_t requirements) return trigger_remote_bss_ho(c, requirements); } +#define REQUIREMENTS_FMT "[%s%s%s]%s" +#define REQUIREMENTS_ARGS(REQUIREMENTS, TCHX) \ + (REQUIREMENTS) & REQUIREMENT_A_TCH##TCHX ? "A" : \ + ((REQUIREMENTS) & REQUIREMENT_TCH##TCHX##_MASK) == 0? "-" : "", \ + (REQUIREMENTS) & REQUIREMENT_B_TCH##TCHX ? "B" : "", \ + (REQUIREMENTS) & REQUIREMENT_C_TCH##TCHX ? "C" : "", \ + ((REQUIREMENTS) & REQUIREMENT_TCH##TCHX##_MASK) == 0 ? " not a candidate" : \ + (((REQUIREMENTS) & REQUIREMENT_TCH##TCHX##_MASK) == REQUIREMENT_A_TCH##TCHX ? \ + " more congestion" : \ + ((REQUIREMENTS) & REQUIREMENT_B_TCH##TCHX ? \ + " good" : \ + /* now has to be (REQUIREMENTS) & REQUIREMENT_C_TCHX != 0: */ \ + " less-or-equal congestion")) + /* verbosely log about a handover candidate */ static inline void debug_candidate(struct ho_candidate *candidate, int8_t rxlev, int tchf_count, int tchh_count) { struct gsm_lchan *lchan = candidate->lchan; -#define HO_CANDIDATE_FMT(tchx, TCHX) "TCH/" #TCHX "={free %d (want %d), [%s%s%s]%s}" +#define HO_CANDIDATE_FMT(tchx, TCHX) "TCH/" #TCHX "={free %d (want %d), " REQUIREMENTS_FMT "}" #define HO_CANDIDATE_ARGS(tchx, TCHX) \ tch##tchx##_count, ho_get_hodec2_tch##tchx##_min_slots(candidate->bts->ho), \ - candidate->requirements & REQUIREMENT_A_TCH##TCHX ? "A" : \ - (candidate->requirements & REQUIREMENT_TCH##TCHX##_MASK) == 0? "-" : "", \ - candidate->requirements & REQUIREMENT_B_TCH##TCHX ? "B" : "", \ - candidate->requirements & REQUIREMENT_C_TCH##TCHX ? "C" : "", \ - (candidate->requirements & REQUIREMENT_TCH##TCHX##_MASK) == 0 ? " not a candidate" : \ - ((candidate->requirements & REQUIREMENT_TCH##TCHX##_MASK) == REQUIREMENT_A_TCH##TCHX ? \ - " more congestion" : \ - (candidate->requirements & REQUIREMENT_B_TCH##TCHX ? \ - " good" : \ - /* now has to be candidate->requirements & REQUIREMENT_C_TCHX != 0: */ \ - " less-or-equal congestion")) + REQUIREMENTS_ARGS(candidate->requirements, TCHX) if (!candidate->bts && !candidate->cil) LOGPHOLCHAN(lchan, LOGL_DEBUG, "Empty candidate\n"); @@ -1503,8 +1507,11 @@ static int bts_resolve_congestion(struct gsm_bts *bts, int tchf_congestion, int if (log_check_level(DHODEC, LOGL_DEBUG)) { LOGPHOBTS(bts, LOGL_DEBUG, "Considering %u candidates to solve congestion:\n", candidates); for (i = 0; i < candidates; i++) { - LOGPHOCAND(&clist[i], LOGL_DEBUG, "#%d: req=0x%x avg-rxlev=%d\n", - i, clist[i].requirements, clist[i].avg); + + LOGPHOCAND(&clist[i], LOGL_DEBUG, "#%d: req={TCH/F:" REQUIREMENTS_FMT ", TCH/H:" REQUIREMENTS_FMT "} avg-rxlev=%d dBm\n", + i, REQUIREMENTS_ARGS(clist[i].requirements, F), + REQUIREMENTS_ARGS(clist[i].requirements, H), + rxlev2dbm(clist[i].avg)); } } -- cgit v1.2.3