summaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-28 12:08:28 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-01-02 11:43:06 +0100
commit454140e7fcd9c904ffbdf5b16af84e52efe9b4d4 (patch)
treece7409a449e1e42280967b8fb5ad2db5303ed588 /openbsc
parent52fa7bd2da381cf933052806eb1fd78f3fc0967c (diff)
lchan: Remember why a channel is broken using static strings
Remember why a channel is being marked as broken. So we can maybe understand what happend.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/abis_rsl.h1
-rw-r--r--openbsc/include/openbsc/gsm_data_shared.h1
-rw-r--r--openbsc/src/libbsc/abis_rsl.c22
-rw-r--r--openbsc/src/libbsc/bsc_vty.c7
-rw-r--r--openbsc/src/libbsc/chan_alloc.c2
5 files changed, 24 insertions, 9 deletions
diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h
index 1609c4833..b27595e4a 100644
--- a/openbsc/include/openbsc/abis_rsl.h
+++ b/openbsc/include/openbsc/abis_rsl.h
@@ -71,6 +71,7 @@ int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id,
enum rsl_rel_mode release_mode);
int rsl_lchan_set_state(struct gsm_lchan *lchan, int);
+int rsl_lchan_mark_broken(struct gsm_lchan *lchan, const char *broken);
/* to be provided by external code */
int rsl_deact_sacch(struct gsm_lchan *lchan);
diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h
index 54dda1ff8..ac54fb20a 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -195,6 +195,7 @@ struct gsm_lchan {
enum lchan_csd_mode csd_mode;
/* State */
enum gsm_lchan_state state;
+ const char *broken_reason;
/* Power levels for MS and BTS */
uint8_t bs_power;
uint8_t ms_power;
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index ae405c98c..479323d3d 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -210,7 +210,7 @@ static void lchan_act_tmr_cb(void *data)
"%s Timeout during activation. Marked as broken.\n",
gsm_lchan_name(lchan));
- rsl_lchan_set_state(lchan, LCHAN_S_BROKEN);
+ rsl_lchan_mark_broken(lchan, "activation timeout");
lchan_free(lchan);
}
@@ -222,7 +222,7 @@ static void lchan_deact_tmr_cb(void *data)
"%s Timeout during deactivation! Marked as broken.\n",
gsm_lchan_name(lchan));
- rsl_lchan_set_state(lchan, LCHAN_S_BROKEN);
+ rsl_lchan_mark_broken(lchan, "de-activation timeout");
lchan_free(lchan);
}
@@ -943,6 +943,13 @@ int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id,
return 0;
}
+int rsl_lchan_mark_broken(struct gsm_lchan *lchan, const char *reason)
+{
+ lchan->state = LCHAN_S_BROKEN;
+ lchan->broken_reason = reason;
+ return 0;
+}
+
int rsl_lchan_set_state(struct gsm_lchan *lchan, int state)
{
lchan->state = state;
@@ -1013,13 +1020,14 @@ static int rsl_rx_chan_act_nack(struct msgb *msg)
print_rsl_cause(LOGL_ERROR, cause,
TLVP_LEN(&tp, RSL_IE_CAUSE));
msg->lchan->error_cause = *cause;
- if (*cause != RSL_ERR_RCH_ALR_ACTV_ALLOC)
- rsl_lchan_set_state(msg->lchan, LCHAN_S_BROKEN);
- else
+ if (*cause != RSL_ERR_RCH_ALR_ACTV_ALLOC) {
+ rsl_lchan_mark_broken(msg->lchan, "NACK on activation");
+ } else
rsl_rf_chan_release(msg->lchan, 1, SACCH_DEACTIVATE);
- } else
- rsl_lchan_set_state(msg->lchan, LCHAN_S_BROKEN);
+ } else {
+ rsl_lchan_mark_broken(msg->lchan, "NACK on activation no IE");
+ }
LOGPC(DRSL, LOGL_ERROR, "\n");
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 0e38a7c86..3e7ac585e 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -959,9 +959,12 @@ static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s",
lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE);
- vty_out(vty, " Connection: %u, State: %s%s",
+ vty_out(vty, " Connection: %u, State: %s%s%s%s",
lchan->conn ? 1: 0,
- gsm_lchans_name(lchan->state), VTY_NEWLINE);
+ gsm_lchans_name(lchan->state),
+ lchan->state == LCHAN_S_BROKEN ? " Error reason: " : "",
+ lchan->state == LCHAN_S_BROKEN ? lchan->broken_reason : "",
+ VTY_NEWLINE);
vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
- lchan->bs_power*2,
diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index c86556b48..d8f908770 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -198,6 +198,8 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type,
/* clear multi rate config */
memset(&lchan->mr_conf, 0, sizeof(lchan->mr_conf));
+
+ lchan->broken_reason = "";
} else {
struct challoc_signal_data sig;
sig.bts = bts;