aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/e1_config.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-06-13 16:37:24 +0200
committerlaforge <laforge@gnumonks.org>2019-07-16 04:00:19 +0000
commitafe987f848f11ceb48c7be1f7842df44363efcd0 (patch)
treee494389aaf9e417d89ed6de8c11d93e04bbdd7e8 /src/osmo-bsc/e1_config.c
parent4d4db8c7b553d784a21c585884fcfc43f5cc0cc3 (diff)
logging: introduce LOG_BTS and LOG_TRX and use it everywhere
It's quite ugly to have manual "bts=%d" printf-statements all over the BSC code. Let's change this to use shared logging helper functions all over the place, whenever we need to log something related to one BTS or one TRX. This can also help us as the first step to later add alternative logging of BTS identities, e.g. by printing the Cell Global Identifier or LAC+CI, or even a human-readable/vty-defined 'name' of the BTS, rather than its numeric bts number. With this change in place, we can introduce such changes at a single location in the code. Change-Id: I4a7814d164384eecfb6913c31802cf2faead6e6c
Diffstat (limited to 'src/osmo-bsc/e1_config.c')
-rw-r--r--src/osmo-bsc/e1_config.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/osmo-bsc/e1_config.c b/src/osmo-bsc/e1_config.c
index e7398ed9c..4389f66c9 100644
--- a/src/osmo-bsc/e1_config.c
+++ b/src/osmo-bsc/e1_config.c
@@ -72,17 +72,15 @@ int e1_reconfig_trx(struct gsm_bts_trx *trx)
int i;
if (!e1_link->e1_ts) {
- LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) RSL link without "
- "timeslot?\n", trx->bts->nr, trx->nr);
+ LOG_TRX(trx, DLINP, LOGL_ERROR, "RSL link without timeslot?\n");
return -EINVAL;
}
/* RSL Link */
line = e1inp_line_find(e1_link->e1_nr);
if (!line) {
- LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) RSL link referring "
- "to non-existing E1 line %u\n", trx->bts->nr,
- trx->nr, e1_link->e1_nr);
+ LOG_TRX(trx, DLINP, LOGL_ERROR, "TRX RSL link referring to non-existing E1 line %u\n",
+ e1_link->e1_nr);
return -ENOMEM;
}
sign_ts = &line->ts[e1_link->e1_ts-1];
@@ -93,8 +91,7 @@ int e1_reconfig_trx(struct gsm_bts_trx *trx)
oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML, trx,
trx->rsl_tei, SAPI_OML);
if (!oml_link) {
- LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) OML link creation "
- "failed\n", trx->bts->nr, trx->nr);
+ LOG_TRX(trx, DLINP, LOGL_ERROR, "TRX OML link creation failed\n");
return -ENOMEM;
}
if (trx->oml_link)
@@ -104,8 +101,7 @@ int e1_reconfig_trx(struct gsm_bts_trx *trx)
rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL,
trx, trx->rsl_tei, SAPI_RSL);
if (!rsl_link) {
- LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) RSL link creation "
- "failed\n", trx->bts->nr, trx->nr);
+ LOG_TRX(trx, DLINP, LOGL_ERROR, "TRX RSL link creation failed\n");
return -ENOMEM;
}
if (trx->rsl_link)
@@ -132,8 +128,8 @@ static int bts_isdn_sign_link(struct msgb *msg)
break;
case E1INP_SIGN_RSL:
if (link->trx->mo.nm_state.administrative == NM_STATE_LOCKED) {
- LOGP(DLMI, LOGL_ERROR, "(bts=%d/trx=%d) discarding RSL message received "
- "in locked administrative state\n", link->trx->bts->nr, link->trx->nr);
+ LOG_TRX(link->trx, DLMI, LOGL_ERROR, "discarding RSL message received "
+ "in locked administrative state\n");
msgb_free(msg);
break;
}
@@ -161,17 +157,17 @@ int e1_reconfig_bts(struct gsm_bts *bts)
struct timespec tp;
int rc;
- DEBUGP(DLMI, "e1_reconfig_bts(%u)\n", bts->nr);
+ LOG_BTS(bts, DLMI, LOGL_DEBUG, "e1_reconfig_bts\n");
line = e1inp_line_find(e1_link->e1_nr);
if (!line) {
- LOGP(DLINP, LOGL_ERROR, "BTS %u OML link referring to "
- "non-existing E1 line %u\n", bts->nr, e1_link->e1_nr);
+ LOG_BTS(bts, DLINP, LOGL_ERROR, "BTS OML link referring to "
+ "non-existing E1 line %u\n", e1_link->e1_nr);
return -ENOMEM;
}
if (!bts->model->e1line_bind_ops) {
- LOGP(DLINP, LOGL_ERROR, "no callback to bind E1 line operations\n");
+ LOG_BTS(bts, DLINP, LOGL_ERROR, "no callback to bind E1 line operations\n");
return -EINVAL;
}
if (!line->ops)
@@ -184,8 +180,7 @@ int e1_reconfig_bts(struct gsm_bts *bts)
/* OML link */
if (!e1_link->e1_ts) {
- LOGP(DLINP, LOGL_ERROR, "BTS %u OML link without timeslot?\n",
- bts->nr);
+ LOG_BTS(bts, DLINP, LOGL_ERROR, "BTS OML link without timeslot?\n");
return -EINVAL;
}
@@ -194,8 +189,7 @@ int e1_reconfig_bts(struct gsm_bts *bts)
oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML,
bts->c0, bts->oml_tei, SAPI_OML);
if (!oml_link) {
- LOGP(DLINP, LOGL_ERROR, "BTS %u OML link creation failed\n",
- bts->nr);
+ LOG_BTS(bts, DLINP, LOGL_ERROR, "BTS OML link creation failed\n");
return -ENOMEM;
}
if (bts->oml_link)