aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-virtual/bts_model.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osmo-bts-virtual/bts_model.c')
-rw-r--r--src/osmo-bts-virtual/bts_model.c85
1 files changed, 58 insertions, 27 deletions
diff --git a/src/osmo-bts-virtual/bts_model.c b/src/osmo-bts-virtual/bts_model.c
index af8a6f2a..a70abfb3 100644
--- a/src/osmo-bts-virtual/bts_model.c
+++ b/src/osmo-bts-virtual/bts_model.c
@@ -10,7 +10,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -100,64 +100,95 @@ static uint8_t vbts_set_trx(struct gsm_bts_trx *trx)
static uint8_t vbts_set_ts(struct gsm_bts_trx_ts *ts)
{
- if (trx_sched_set_pchan(ts, ts->pchan) != 0)
+ enum gsm_phys_chan_config pchan;
+
+ /* For dynamic timeslots, pick the pchan type that should currently be
+ * active. This should only be called during init, PDCH transitions
+ * will call trx_set_ts_as_pchan() directly. */
+ switch (ts->pchan) {
+ case GSM_PCHAN_TCH_F_PDCH:
+ OSMO_ASSERT((ts->flags & TS_F_PDCH_PENDING_MASK) == 0);
+ if (ts->flags & TS_F_PDCH_ACTIVE)
+ pchan = GSM_PCHAN_PDCH;
+ else
+ pchan = GSM_PCHAN_TCH_F;
+ break;
+ case GSM_PCHAN_OSMO_DYN:
+ OSMO_ASSERT(ts->dyn.pchan_is == ts->dyn.pchan_want);
+ pchan = ts->dyn.pchan_is;
+ break;
+ default:
+ pchan = ts->pchan;
+ break;
+ }
+
+ if (trx_sched_set_pchan(ts, pchan) != 0)
return NM_NACK_RES_NOTAVAIL;
+ /* activate lchans for [CBCH/]BCCH/CCCH */
+ switch (pchan) {
+ case GSM_PCHAN_SDCCH8_SACCH8C_CBCH:
+ /* using RSL_CHAN_OSMO_CBCH4 is correct here, because the scheduler
+ * does not distinguish between SDCCH/4+CBCH abd SDCCH/8+CBCH. */
+ trx_sched_set_lchan(&ts->lchan[CBCH_LCHAN],
+ RSL_CHAN_OSMO_CBCH4, LID_DEDIC, true);
+ break;
+ case GSM_PCHAN_CCCH_SDCCH4_CBCH:
+ trx_sched_set_lchan(&ts->lchan[CBCH_LCHAN],
+ RSL_CHAN_OSMO_CBCH4, LID_DEDIC, true);
+ /* fall-through */
+ case GSM_PCHAN_CCCH_SDCCH4:
+ case GSM_PCHAN_CCCH:
+ trx_sched_set_bcch_ccch(&ts->lchan[CCCH_LCHAN], true);
+ ts->lchan[CCCH_LCHAN].rel_act_kind = LCHAN_REL_ACT_OML;
+ lchan_set_state(&ts->lchan[CCCH_LCHAN], LCHAN_S_ACTIVE);
+ break;
+ default:
+ break;
+ }
+
return 0;
}
-int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
- struct tlv_parsed *new_attr, int kind, void *obj)
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
+ struct gsm_abis_mo *mo, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
- int cause = 0;
+ int rc;
switch (foh->msg_type) {
case NM_MT_SET_BTS_ATTR:
- cause = vbts_set_bts(obj);
+ rc = vbts_set_bts(obj);
break;
case NM_MT_SET_RADIO_ATTR:
- cause = vbts_set_trx(obj);
+ rc = vbts_set_trx(obj);
break;
case NM_MT_SET_CHAN_ATTR:
- cause = vbts_set_ts(obj);
+ rc = vbts_set_ts(obj);
+ break;
+ default:
+ rc = 0;
break;
}
- return oml_fom_ack_nack(msg, cause);
+
+ return rc;
}
/* MO: TS 12.21 Managed Object */
int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj)
{
int rc;
- struct gsm_bts_bb_trx *bb_transc;
- struct gsm_bts_trx* trx;
- struct gsm_bts_trx_ts *ts;
switch (mo->obj_class) {
case NM_OC_SITE_MANAGER:
- rc = osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_OPSTART_ACK, NULL);
- break;
case NM_OC_BTS:
- rc = osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_OPSTART_ACK, NULL);
- break;
case NM_OC_RADIO_CARRIER:
- trx = (struct gsm_bts_trx*) obj;
- rc = osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_OPSTART_ACK, NULL);
- break;
case NM_OC_BASEB_TRANSC:
- bb_transc = (struct gsm_bts_bb_trx *) obj;
- rc = osmo_fsm_inst_dispatch(bb_transc->mo.fi, NM_EV_OPSTART_ACK, NULL);
- break;
case NM_OC_CHANNEL:
- ts = (struct gsm_bts_trx_ts *) obj;
- rc = osmo_fsm_inst_dispatch(ts->mo.fi, NM_EV_OPSTART_ACK, NULL);
- break;
case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
- oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
- rc = oml_mo_opstart_ack(mo);
+ rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
default:
rc = oml_mo_opstart_nack(mo, NM_NACK_OBJCLASS_NOTSUPP);