aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-05-29 23:08:22 +0000
committerNeels Hofmeyr <neels@hofmeyr.de>2021-06-10 16:15:35 +0200
commit426941e87f5476d1220ddf657a84bcfc9204a185 (patch)
tree8e7f6dcb0a59469724f09abf7c4bfff12eafc127 /src
parentd163aa380588bb8628c45d7ce34838595dc6e1f2 (diff)
update the lchan name to always reflect VAMOS shadowness
Change gsm_lchan_name_compute() to a function that in-place updates the lchan->name. That allows calling it numerous times with the talloc handled internally. Rename it to lchan_update_name(). Add 'shadow' to lchan_update_name() and lchan_fsm_update_id() for VAMOS shadow lchans, and also print the lchan index that it is a shadow for, instead of the index in the lchan array. When set_pchan_is() updates the VAMOSness of the lchans, call lchan_fsm_update_id(). From lchan_fsm_update_id() also call lchan_update_name(). This is a bit convoluted for legacy reasons. There are utility programs and C tests using bts_trx.c but not lchan_fsm.c. lchan_update_name() lives in gsm_data.c for that reason. This patch calls lchan_update_name() from lchan_fsm_update_id() and not vice versa to avoid having to add stubbed lchan_fsm_update_id() functions to all utility programs and C tests. We can't easily unify the lchan->name and lchan->fi->id without lots of refactoring rippling through all those little utility programs and C tests. Change-Id: I7c2bae3b895a91f1b99b4147ecc0e3009cb7439a
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bsc/assignment_fsm.c5
-rw-r--r--src/osmo-bsc/bts_trx.c2
-rw-r--r--src/osmo-bsc/gsm_data.c11
-rw-r--r--src/osmo-bsc/lchan_fsm.c11
-rw-r--r--src/osmo-bsc/timeslot_fsm.c5
5 files changed, 23 insertions, 11 deletions
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index b6de29310..a54bee5c8 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -302,14 +302,15 @@ static void assignment_fsm_update_id(struct gsm_subscriber_connection *conn)
return;
}
- osmo_fsm_inst_update_id_f(conn->assignment.fi, "%s_%u-%u-%u-%s%s%s-%u",
+ osmo_fsm_inst_update_id_f(conn->assignment.fi, "%s_%u-%u-%u-%s%s%s-%s%u",
conn->fi->id,
new_lchan->ts->trx->bts->nr, new_lchan->ts->trx->nr, new_lchan->ts->nr,
gsm_pchan_id(new_lchan->ts->pchan_on_init),
(new_lchan->ts->pchan_on_init == new_lchan->ts->pchan_is)? "" : "as",
(new_lchan->ts->pchan_on_init == new_lchan->ts->pchan_is)? ""
: gsm_pchan_id(new_lchan->ts->pchan_is),
- new_lchan->nr);
+ new_lchan->vamos.is_secondary ? "shadow" : "",
+ new_lchan->nr - (new_lchan->vamos.is_secondary ? new_lchan->ts->max_primary_lchans : 0));
}
static bool lchan_type_compat_with_mode(enum gsm_chan_t type, const struct channel_mode_and_rate *ch_mode_rate)
diff --git a/src/osmo-bsc/bts_trx.c b/src/osmo-bsc/bts_trx.c
index 64c7985e5..1f3cb0ac5 100644
--- a/src/osmo-bsc/bts_trx.c
+++ b/src/osmo-bsc/bts_trx.c
@@ -111,7 +111,7 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
lchan->nr = l;
lchan->type = GSM_LCHAN_NONE;
- lchan->name = gsm_lchan_name_compute(trx, lchan);
+ lchan_update_name(lchan);
}
}
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index 4d2d81181..5f647e228 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -334,12 +334,15 @@ char *gsm_ts_and_pchan_name(const struct gsm_bts_trx_ts *ts)
return ts2str;
}
-char *gsm_lchan_name_compute(void *ctx, const struct gsm_lchan *lchan)
+void lchan_update_name(struct gsm_lchan *lchan)
{
struct gsm_bts_trx_ts *ts = lchan->ts;
- return talloc_asprintf(ctx, "(bts=%d,trx=%d,ts=%d,ss=%d%s)",
- ts->trx->bts->nr, ts->trx->nr, ts->nr, lchan->nr,
- lchan->vamos.is_secondary ? "-VAMOS" : "");
+ if (lchan->name)
+ talloc_free(lchan->name);
+ lchan->name = talloc_asprintf(ts->trx, "(bts=%d,trx=%d,ts=%d,ss=%s%d)",
+ ts->trx->bts->nr, ts->trx->nr, ts->nr,
+ lchan->vamos.is_secondary ? "shadow" : "",
+ lchan->nr - (lchan->vamos.is_secondary ? ts->max_primary_lchans : 0));
}
/* obtain the MO structure for a given object instance */
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index c42924300..c56be8d78 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -411,11 +411,16 @@ void lchan_mode_modify(struct gsm_lchan *lchan, struct lchan_modify_info *info)
}
}
-static void lchan_fsm_update_id(struct gsm_lchan *lchan)
+void lchan_fsm_update_id(struct gsm_lchan *lchan)
{
- osmo_fsm_inst_update_id_f(lchan->fi, "%u-%u-%u-%s-%u",
+ lchan_update_name(lchan);
+ if (!lchan->fi)
+ return;
+ osmo_fsm_inst_update_id_f(lchan->fi, "%u-%u-%u-%s-%s%u",
lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
- gsm_pchan_id(lchan->ts->pchan_on_init), lchan->nr);
+ gsm_pchan_id(lchan->ts->pchan_on_init),
+ lchan->vamos.is_secondary ? "shadow" : "",
+ lchan->nr - (lchan->vamos.is_secondary ? lchan->ts->max_primary_lchans : 0));
if (lchan->fi_rtp)
osmo_fsm_inst_update_id_f(lchan->fi_rtp, lchan->fi->id);
}
diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c
index 64b98a67d..b9c86df96 100644
--- a/src/osmo-bsc/timeslot_fsm.c
+++ b/src/osmo-bsc/timeslot_fsm.c
@@ -204,11 +204,14 @@ void ts_set_pchan_is(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config pchan_
lchan->vamos.is_secondary = false;
else
lchan->vamos.is_secondary = true;
+ lchan_fsm_update_id(lchan);
}
break;
default:
- ts_for_n_lchans(lchan, ts, ts->max_lchans_possible)
+ ts_for_n_lchans(lchan, ts, ts->max_lchans_possible) {
lchan->vamos.is_secondary = false;
+ lchan_fsm_update_id(lchan);
+ }
break;
}
}