diff options
Diffstat (limited to 'src/osmo-bts-lc15')
27 files changed, 244 insertions, 238 deletions
diff --git a/src/osmo-bts-lc15/Makefile.am b/src/osmo-bts-lc15/Makefile.am index bb68efaf..58284e95 100644 --- a/src/osmo-bts-lc15/Makefile.am +++ b/src/osmo-bts-lc15/Makefile.am @@ -1,38 +1,102 @@ AUTOMAKE_OPTIONS = subdir-objects AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include $(LITECELL15_INCDIR) -AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCODEC_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(LIBOSMOTRAU_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(LIBGPS_CFLAGS) $(LIBSYSTEMD_CFLAGS) -COMMON_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOCODEC_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOTRAU_LIBS) $(LIBOSMOABIS_LIBS) $(LIBOSMOCTRL_LIBS) + +AM_CFLAGS = \ + -Wall \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOCODEC_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMOCTRL_CFLAGS) \ + $(LIBOSMOABIS_CFLAGS) \ + $(LIBOSMOTRAU_CFLAGS) \ + $(LIBOSMONETIF_CFLAGS) \ + $(LIBGPS_CFLAGS) \ + $(LIBSYSTEMD_CFLAGS) \ + $(NULL) + +COMMON_LDADD = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOCODEC_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBOSMOCTRL_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + $(LIBOSMOTRAU_LIBS) \ + $(LIBOSMONETIF_LIBS) \ + $(NULL) AM_CFLAGS += -DENABLE_LC15BTS -EXTRA_DIST = misc/lc15bts_mgr.h misc/lc15bts_misc.h misc/lc15bts_par.h misc/lc15bts_led.h \ - misc/lc15bts_temp.h misc/lc15bts_power.h misc/lc15bts_clock.h \ - misc/lc15bts_bid.h misc/lc15bts_nl.h misc/lc15bts_bts.h misc/lc15bts_swd.h \ - hw_misc.h l1_if.h l1_transp.h lc15bts.h utils.h +EXTRA_DIST = \ + misc/lc15bts_mgr.h \ + misc/lc15bts_misc.h \ + misc/lc15bts_par.h \ + misc/lc15bts_led.h \ + misc/lc15bts_temp.h \ + misc/lc15bts_power.h \ + misc/lc15bts_clock.h \ + misc/lc15bts_bid.h \ + misc/lc15bts_nl.h \ + misc/lc15bts_bts.h \ + misc/lc15bts_swd.h \ + hw_misc.h \ + l1_if.h \ + l1_transp.h \ + lc15bts.h \ + utils.h \ + $(NULL) bin_PROGRAMS = osmo-bts-lc15 lc15bts-mgr lc15bts-util -COMMON_SOURCES = main.c lc15bts.c l1_if.c oml.c lc15bts_vty.c tch.c hw_misc.c calib_file.c \ - utils.c misc/lc15bts_par.c misc/lc15bts_bid.c +COMMON_SOURCES = \ + main.c \ + lc15bts.c \ + l1_if.c \ + oml.c \ + lc15bts_vty.c \ + tch.c \ + hw_misc.c \ + calib_file.c \ + utils.c \ + misc/lc15bts_par.c \ + misc/lc15bts_bid.c \ + $(NULL) osmo_bts_lc15_SOURCES = $(COMMON_SOURCES) l1_transp_hw.c -osmo_bts_lc15_LDADD = $(top_builddir)/src/common/libbts.a $(COMMON_LDADD) +osmo_bts_lc15_LDADD = \ + $(top_builddir)/src/common/libbts.a \ + $(COMMON_LDADD) \ + $(NULL) lc15bts_mgr_SOURCES = \ - misc/lc15bts_mgr.c misc/lc15bts_misc.c \ - misc/lc15bts_par.c misc/lc15bts_nl.c \ - misc/lc15bts_temp.c misc/lc15bts_power.c \ - misc/lc15bts_clock.c misc/lc15bts_bid.c \ + misc/lc15bts_mgr.c \ + misc/lc15bts_misc.c \ + misc/lc15bts_par.c \ + misc/lc15bts_nl.c \ + misc/lc15bts_temp.c \ + misc/lc15bts_power.c \ + misc/lc15bts_clock.c \ + misc/lc15bts_bid.c \ misc/lc15bts_mgr_vty.c \ misc/lc15bts_mgr_nl.c \ misc/lc15bts_mgr_temp.c \ misc/lc15bts_mgr_calib.c \ misc/lc15bts_led.c \ misc/lc15bts_bts.c \ - misc/lc15bts_swd.c + misc/lc15bts_swd.c \ + $(NULL) -lc15bts_mgr_LDADD = $(top_builddir)/src/common/libbts.a $(LIBGPS_LIBS) $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOABIS_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCTRL_LIBS) $(LIBSYSTEMD_LIBS) $(COMMON_LDADD) +lc15bts_mgr_LDADD = \ + $(top_builddir)/src/common/libbts.a \ + $(COMMON_LDADD) \ + $(LIBGPS_LIBS) \ + $(LIBSYSTEMD_LIBS) \ + $(NULL) -lc15bts_util_SOURCES = misc/lc15bts_util.c misc/lc15bts_par.c +lc15bts_util_SOURCES = \ + misc/lc15bts_util.c \ + misc/lc15bts_par.c \ + $(NULL) lc15bts_util_LDADD = $(LIBOSMOCORE_LIBS) diff --git a/src/osmo-bts-lc15/calib_file.c b/src/osmo-bts-lc15/calib_file.c index 2641552f..543be90f 100644 --- a/src/osmo-bts-lc15/calib_file.c +++ b/src/osmo-bts-lc15/calib_file.c @@ -16,7 +16,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/>. diff --git a/src/osmo-bts-lc15/hw_misc.c b/src/osmo-bts-lc15/hw_misc.c index 9f070bba..97ed3b75 100644 --- a/src/osmo-bts-lc15/hw_misc.c +++ b/src/osmo-bts-lc15/hw_misc.c @@ -15,7 +15,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/>. diff --git a/src/osmo-bts-lc15/l1_if.c b/src/osmo-bts-lc15/l1_if.c index ac165b88..4ef90949 100644 --- a/src/osmo-bts-lc15/l1_if.c +++ b/src/osmo-bts-lc15/l1_if.c @@ -17,7 +17,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/>. @@ -347,7 +347,7 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg, abort(); } - len = msgb_l2len(msg); + len = (msg->l2h) ? msgb_l2len(msg) : 0; chan_nr = l1sap->u.data.chan_nr; link_id = l1sap->u.data.link_id; @@ -395,9 +395,8 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg, else sapi = GsmL1_Sapi_Agch; } else { - LOGPFN(DL1C, LOGL_NOTICE, u32Fn, "unknown prim %d op %d " - "chan_nr %d link_id %d\n", l1sap->oph.primitive, - l1sap->oph.operation, chan_nr, link_id); + LOGPLCFN(lchan, u32Fn, DL1C, LOGL_NOTICE, "unknown prim %d op %d chan_nr %d link_id %d\n", + l1sap->oph.primitive, l1sap->oph.operation, chan_nr, link_id); msgb_free(l1msg); return -EINVAL; } @@ -458,9 +457,8 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg, memcpy(l1p->u.phDataReq.msgUnitParam.u8Buffer, msg->l2h, msgb_l2len(msg)); } - LOGPFN(DL1P, LOGL_DEBUG, u32Fn, "PH-DATA.req(%s)\n", - osmo_hexdump(l1p->u.phDataReq.msgUnitParam.u8Buffer, - l1p->u.phDataReq.msgUnitParam.u8Size)); + LOGPLCFN(lchan, u32Fn, DL1P, LOGL_DEBUG, "PH-DATA.req(%s)\n", + osmo_hexdump(l1p->u.phDataReq.msgUnitParam.u8Buffer, l1p->u.phDataReq.msgUnitParam.u8Size)); } else { /* empty frame */ GsmL1_Prim_t *l1p = msgb_l1prim(l1msg); @@ -470,7 +468,7 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg, /* send message to DSP's queue */ if (osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], l1msg) != 0) { - LOGPFN(DL1P, LOGL_ERROR, u32Fn, "MQ_L1_WRITE queue full. Dropping msg.\n"); + LOGPLCFN(lchan, u32Fn, DL1P, LOGL_ERROR, "MQ_L1_WRITE queue full. Dropping msg.\n"); msgb_free(l1msg); } else dtx_int_signal(lchan); @@ -508,7 +506,6 @@ static int ph_tch_req(struct gsm_bts_trx *trx, struct msgb *msg, /* create new message and fill data */ if (msg) { - msgb_pull(msg, sizeof(*l1sap)); /* create new message */ nmsg = l1p_msgb_alloc(); if (!nmsg) @@ -517,7 +514,7 @@ static int ph_tch_req(struct gsm_bts_trx *trx, struct msgb *msg, rc = l1if_tch_encode(lchan, l1p->u.phDataReq.msgUnitParam.u8Buffer, &l1p->u.phDataReq.msgUnitParam.u8Size, - msg->data, msg->len, u32Fn, use_cache, + msgb_l2(msg), msgb_l2len(msg), u32Fn, use_cache, l1sap->u.tch.marker); if (rc < 0) { /* no data encoded for L1: smth will be generated below */ @@ -554,7 +551,7 @@ static int ph_tch_req(struct gsm_bts_trx *trx, struct msgb *msg, } /* send message to DSP's queue */ if (osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], nmsg) < 0) { - LOGPFN(DL1P, LOGL_ERROR, u32Fn, "MQ_L1_WRITE queue full. Dropping msg.\n"); + LOGPLCFN(lchan, u32Fn, DL1P, LOGL_ERROR, "MQ_L1_WRITE queue full. Dropping msg.\n"); msgb_free(nmsg); return -ENOBUFS; } @@ -1250,7 +1247,6 @@ static int activate_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp, Litecell15_Prim_t *sysp = msgb_sysprim(resp); GsmL1_Status_t status; int on = 0; - unsigned int i; if (sysp->id == Litecell15_PrimId_ActivateRfCnf) on = 1; @@ -1281,8 +1277,8 @@ static int activate_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp, } else { if (bts_lc15->led_ctrl_mode == LC15_LED_CONTROL_BTS) bts_update_status(BTS_STATUS_RF_ACTIVE, 0); - osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_DISABLE, NULL); - osmo_fsm_inst_dispatch(trx->bb_transc.mo.fi, NM_EV_DISABLE, NULL); + osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_DISABLE, NULL); + osmo_fsm_inst_dispatch(trx->bb_transc.mo.fi, NM_EV_DISABLE, NULL); } msgb_free(resp); @@ -1430,6 +1426,30 @@ static int info_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp, LOGP(DL1C, LOGL_FATAL, "BTS band %s not supported by hw\n", gsm_band_name(trx->bts->band)); + /* Frequency bands indicated to the BSC */ + switch (fl1h->hw_info.band_support) { + case GSM_BAND_450: + trx->support.freq_bands |= NM_IPAC_F_FREQ_BAND_450; + break; + case GSM_BAND_480: + trx->support.freq_bands |= NM_IPAC_F_FREQ_BAND_480; + break; + case GSM_BAND_850: + trx->support.freq_bands |= NM_IPAC_F_FREQ_BAND_850; + break; + case GSM_BAND_900: + trx->support.freq_bands |= NM_IPAC_F_FREQ_BAND_PGSM; + /* XXX: does GSM_BAND_900 include NM_IPAC_F_FREQ_BAND_EGSM? */ + /* XXX: does GSM_BAND_900 include NM_IPAC_F_FREQ_BAND_RGSM? */ + break; + case GSM_BAND_1800: + trx->support.freq_bands |= NM_IPAC_F_FREQ_BAND_DCS; + break; + case GSM_BAND_1900: + trx->support.freq_bands |= NM_IPAC_F_FREQ_BAND_PCS; + break; + } + /* Request the activation */ l1if_activate_rf(fl1h, 1); diff --git a/src/osmo-bts-lc15/l1_transp_hw.c b/src/osmo-bts-lc15/l1_transp_hw.c index 36b77fed..63b596b2 100644 --- a/src/osmo-bts-lc15/l1_transp_hw.c +++ b/src/osmo-bts-lc15/l1_transp_hw.c @@ -15,7 +15,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/>. diff --git a/src/osmo-bts-lc15/lc15bts.c b/src/osmo-bts-lc15/lc15bts.c index 0ba89a11..40077902 100644 --- a/src/osmo-bts-lc15/lc15bts.c +++ b/src/osmo-bts-lc15/lc15bts.c @@ -15,7 +15,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/>. diff --git a/src/osmo-bts-lc15/main.c b/src/osmo-bts-lc15/main.c index 3e119f66..23601299 100644 --- a/src/osmo-bts-lc15/main.c +++ b/src/osmo-bts-lc15/main.c @@ -16,7 +16,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/>. @@ -89,6 +89,8 @@ int bts_model_init(struct gsm_bts *bts) bts->model_priv = bts_lc15; bts->variant = BTS_OSMO_LITECELL15; bts->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3); + bts->gprs.cell.support.gprs_codings = NM_IPAC_MASK_GPRS_CODING_CS + | NM_IPAC_MASK_GPRS_CODING_MCS; /* specific default values for LC15 platform */ bts_lc15->led_ctrl_mode = LC15_BTS_LED_CTRL_MODE_DEFAULT; @@ -100,24 +102,43 @@ int bts_model_init(struct gsm_bts *bts) exit(23); } - osmo_bts_set_feature(bts->features, BTS_FEAT_GPRS); + /* order alphabetically */ + osmo_bts_set_feature(bts->features, BTS_FEAT_AGCH_PCH_PROP); + osmo_bts_set_feature(bts->features, BTS_FEAT_CBCH); osmo_bts_set_feature(bts->features, BTS_FEAT_EGPRS); + osmo_bts_set_feature(bts->features, BTS_FEAT_GPRS); osmo_bts_set_feature(bts->features, BTS_FEAT_OML_ALERTS); - osmo_bts_set_feature(bts->features, BTS_FEAT_AGCH_PCH_PROP); - osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_V1); - osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_V1); - osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_EFR); osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_AMR); + osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_EFR); + osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_V1); osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_AMR); + osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_V1); bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP); bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER); + /* The default HR codec output format in the absence of saved + * vty config needs to match what was implemented previously, + * for the sake of existing deployments, i.e., to avoid + * a surprise functional change upon software update. */ + bts->emit_hr_rfc5993 = false; + return 0; } int bts_model_trx_init(struct gsm_bts_trx *trx) { + /* Frequency bands indicated to the BSC */ + trx->support.freq_bands = 0x00; /* updated in info_compl_cb() */ + + /* Channel types and modes indicated to the BSC */ + trx->support.chan_types = NM_IPAC_MASK_CHANT_COMMON + | NM_IPAC_F_CHANT_BCCH_SDCCH4_CBCH + | NM_IPAC_F_CHANT_SDCCH8_CBCH + | NM_IPAC_F_CHANT_PDCHF + | NM_IPAC_F_CHANT_TCHF_PDCHF; + trx->support.chan_modes = NM_IPAC_MASK_CHANM_SPEECH; + trx->nominal_power = 40; trx->power_params.trx_p_max_out_mdBm = to_mdB(trx->bts->c0->nominal_power); return 0; diff --git a/src/osmo-bts-lc15/misc/lc15bts_bid.c b/src/osmo-bts-lc15/misc/lc15bts_bid.c index 9284b62e..9267e06f 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_bid.c +++ b/src/osmo-bts-lc15/misc/lc15bts_bid.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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_bts.c b/src/osmo-bts-lc15/misc/lc15bts_bts.c index 0343e930..560320a0 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_bts.c +++ b/src/osmo-bts-lc15/misc/lc15bts_bts.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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_clock.c b/src/osmo-bts-lc15/misc/lc15bts_clock.c index 71701496..23f8f021 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_clock.c +++ b/src/osmo-bts-lc15/misc/lc15bts_clock.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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_led.c b/src/osmo-bts-lc15/misc/lc15bts_led.c index a93d3fb0..88b12207 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_led.c +++ b/src/osmo-bts-lc15/misc/lc15bts_led.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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_mgr.c b/src/osmo-bts-lc15/misc/lc15bts_mgr.c index b258d0cb..fb4f5c40 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_mgr.c +++ b/src/osmo-bts-lc15/misc/lc15bts_mgr.c @@ -17,7 +17,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/>. @@ -319,7 +319,7 @@ int main(int argc, char **argv) exit(1); } - rc = telnet_init(tall_mgr_ctx, NULL, OSMO_VTY_PORT_BTSMGR); + rc = telnet_init_default(tall_mgr_ctx, NULL, OSMO_VTY_PORT_BTSMGR); if (rc < 0) { fprintf(stderr, "Error initializing telnet\n"); exit(1); diff --git a/src/osmo-bts-lc15/misc/lc15bts_mgr_calib.c b/src/osmo-bts-lc15/misc/lc15bts_mgr_calib.c index badb5455..f25955f8 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_mgr_calib.c +++ b/src/osmo-bts-lc15/misc/lc15bts_mgr_calib.c @@ -17,7 +17,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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_mgr_nl.c b/src/osmo-bts-lc15/misc/lc15bts_mgr_nl.c index 3a617dd7..b34becf1 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_mgr_nl.c +++ b/src/osmo-bts-lc15/misc/lc15bts_mgr_nl.c @@ -16,7 +16,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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_mgr_temp.c b/src/osmo-bts-lc15/misc/lc15bts_mgr_temp.c index 9665e1db..abffce3b 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_mgr_temp.c +++ b/src/osmo-bts-lc15/misc/lc15bts_mgr_temp.c @@ -16,7 +16,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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_mgr_vty.c b/src/osmo-bts-lc15/misc/lc15bts_mgr_vty.c index 424ff18f..65c1fe72 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_mgr_vty.c +++ b/src/osmo-bts-lc15/misc/lc15bts_mgr_vty.c @@ -16,7 +16,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/>. @@ -89,39 +89,10 @@ static int go_to_parent(struct vty *vty) return vty->node; } -static int is_config_node(struct vty *vty, int node) -{ - switch (node) { - case MGR_NODE: - case ACT_NORM_NODE: - case ACT_WARN_NODE: - case ACT_CRIT_NODE: - case LIMIT_SUPPLY_TEMP_NODE: - case LIMIT_SOC_NODE: - case LIMIT_FPGA_NODE: - case LIMIT_RMSDET_NODE: - case LIMIT_OCXO_NODE: - case LIMIT_TX0_TEMP_NODE: - case LIMIT_TX1_TEMP_NODE: - case LIMIT_PA0_TEMP_NODE: - case LIMIT_PA1_TEMP_NODE: - case LIMIT_SUPPLY_VOLT_NODE: - case LIMIT_TX0_VSWR_NODE: - case LIMIT_TX1_VSWR_NODE: - case LIMIT_SUPPLY_PWR_NODE: - case LIMIT_PA0_PWR_NODE: - case LIMIT_PA1_PWR_NODE: - return 1; - default: - return 0; - } -} - static struct vty_app_info vty_info = { .name = "lc15bts-mgr", .version = PACKAGE_VERSION, .go_parent_cb = go_to_parent, - .is_config_node = is_config_node, .copyright = copyright, }; diff --git a/src/osmo-bts-lc15/misc/lc15bts_misc.c b/src/osmo-bts-lc15/misc/lc15bts_misc.c index 467b9d0a..bd801099 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_misc.c +++ b/src/osmo-bts-lc15/misc/lc15bts_misc.c @@ -14,7 +14,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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_nl.c b/src/osmo-bts-lc15/misc/lc15bts_nl.c index 39f64aae..d1d1bd13 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_nl.c +++ b/src/osmo-bts-lc15/misc/lc15bts_nl.c @@ -16,7 +16,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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_nl.h b/src/osmo-bts-lc15/misc/lc15bts_nl.h index 340cf117..b5a15403 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_nl.h +++ b/src/osmo-bts-lc15/misc/lc15bts_nl.h @@ -14,7 +14,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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_par.c b/src/osmo-bts-lc15/misc/lc15bts_par.c index af9d030f..e93c45b6 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_par.c +++ b/src/osmo-bts-lc15/misc/lc15bts_par.c @@ -16,7 +16,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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_power.c b/src/osmo-bts-lc15/misc/lc15bts_power.c index 1a37d8e6..c28232b7 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_power.c +++ b/src/osmo-bts-lc15/misc/lc15bts_power.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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_swd.c b/src/osmo-bts-lc15/misc/lc15bts_swd.c index eac64d66..f0af6bca 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_swd.c +++ b/src/osmo-bts-lc15/misc/lc15bts_swd.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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_temp.c b/src/osmo-bts-lc15/misc/lc15bts_temp.c index 45602dcc..f69b9bb7 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_temp.c +++ b/src/osmo-bts-lc15/misc/lc15bts_temp.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/>. diff --git a/src/osmo-bts-lc15/misc/lc15bts_util.c b/src/osmo-bts-lc15/misc/lc15bts_util.c index 430ce0f7..a5ab6027 100644 --- a/src/osmo-bts-lc15/misc/lc15bts_util.c +++ b/src/osmo-bts-lc15/misc/lc15bts_util.c @@ -16,7 +16,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/>. diff --git a/src/osmo-bts-lc15/oml.c b/src/osmo-bts-lc15/oml.c index 675e3fed..6f312e80 100644 --- a/src/osmo-bts-lc15/oml.c +++ b/src/osmo-bts-lc15/oml.c @@ -14,7 +14,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/>. @@ -49,6 +49,8 @@ #include "lc15bts.h" #include "utils.h" +static void dump_lch_par(int logl, GsmL1_LogChParam_t *lch_par, GsmL1_Sapi_t sapi); + static int mph_info_chan_confirm(struct gsm_lchan *lchan, enum osmo_mph_info_type type, uint8_t cause) { @@ -569,8 +571,7 @@ GsmL1_Sapi_t lchan_to_GsmL1_Sapi_t(const struct gsm_lchan *lchan) case GSM_LCHAN_TCH_H: return GsmL1_Sapi_TchH; default: - LOGP(DL1C, LOGL_NOTICE, "%s cannot determine L1 SAPI\n", - gsm_lchan_name(lchan)); + LOGPLCHAN(lchan, DL1C, LOGL_NOTICE, "cannot determine L1 SAPI\n"); break; } return GsmL1_Sapi_Idle; @@ -781,12 +782,8 @@ static void sapi_queue_dispatch(struct gsm_lchan *lchan, int status) talloc_free(cmd); if (end || llist_empty(&lchan->sapi_cmds)) { - LOGP(DL1C, LOGL_DEBUG, - "%s End of SAPI cmd queue encountered.%s\n", - gsm_lchan_name(lchan), - llist_empty(&lchan->sapi_cmds) - ? " Queue is now empty." - : " More pending."); + LOGPLCHAN(lchan, DL1C, LOGL_DEBUG, "End of SAPI cmd queue encountered.%s\n", + llist_empty(&lchan->sapi_cmds) ? " Queue is now empty." : " More pending."); return; } @@ -826,9 +823,8 @@ static int lchan_act_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg, goto err; } - LOGP(DL1C, LOGL_INFO, "%s MPH-ACTIVATE.conf (%s ", - gsm_lchan_name(lchan), - get_value_string(lc15bts_l1sapi_names, ic->sapi)); + LOGPLCHAN(lchan, DL1C, LOGL_INFO, "MPH-ACTIVATE.conf (%s ", + get_value_string(lc15bts_l1sapi_names, ic->sapi)); LOGPC(DL1C, LOGL_INFO, "%s)\n", get_value_string(lc15bts_dir_names, ic->dir)); @@ -849,19 +845,15 @@ static int lchan_act_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg, lchan->sapis_ul[ic->sapi] = status; if (llist_empty(&lchan->sapi_cmds)) { - LOGP(DL1C, LOGL_ERROR, - "%s Got activation confirmation with empty queue\n", - gsm_lchan_name(lchan)); + LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Got activation confirmation with empty queue\n"); goto err; } cmd = llist_entry(lchan->sapi_cmds.next, struct sapi_cmd, entry); if (cmd->sapi != ic->sapi || cmd->dir != ic->dir || cmd->type != SAPI_CMD_ACTIVATE) { - LOGP(DL1C, LOGL_ERROR, - "%s Confirmation mismatch (%d, %d) (%d, %d)\n", - gsm_lchan_name(lchan), cmd->sapi, cmd->dir, - ic->sapi, ic->dir); + LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Confirmation mismatch (%d, %d) (%d, %d)\n", + cmd->sapi, cmd->dir, ic->sapi, ic->dir); goto err; } @@ -942,8 +934,7 @@ static int lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan) (struct gsm48_multi_rate_conf *) amr_mrc->gsm48_ie; int j; - LOGP(DL1C, LOGL_INFO, "%s: %s tch_mode=0x%02x\n", - gsm_lchan_name(lchan), __FUNCTION__, lchan->tch_mode); + LOGPLCHAN(lchan, DL1C, LOGL_INFO, "%s tch_mode=0x%02x\n", __func__, lchan->tch_mode); switch (lchan->tch_mode) { case GSM48_CMODE_SIGN: @@ -971,7 +962,9 @@ static int lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan) case GSM48_CMODE_SPEECH_AMR: lch_par->tch.tchPlType = GsmL1_TchPlType_Amr; set_payload_format(lch_par); - lch_par->tch.amrCmiPhase = GsmL1_AmrCmiPhase_Odd; /* FIXME? */ + /* At call set-up, after every successful handover and after a channel mode modify, the + * default phase (odd) shall be used in downlink direction. */ + lch_par->tch.amrCmiPhase = GsmL1_AmrCmiPhase_Odd; lch_par->tch.amrInitCodecMode = amr_get_initial_mode(lchan); /* initialize to clean state */ @@ -1094,9 +1087,9 @@ static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd) break; } - LOGP(DL1C, LOGL_INFO, "%s MPH-ACTIVATE.req (hL2=0x%08x, %s ", - gsm_lchan_name(lchan), (uint32_t)act_req->hLayer2, - get_value_string(lc15bts_l1sapi_names, act_req->sapi)); + LOGPLCHAN(lchan, DL1C, LOGL_INFO, "MPH-ACTIVATE.req (hL2=0x%08x, %s ", + (uint32_t)act_req->hLayer2, get_value_string(lc15bts_l1sapi_names, act_req->sapi)); + dump_lch_par(LOGL_INFO, lch_par, act_req->sapi); LOGPC(DL1C, LOGL_INFO, "%s)\n", get_value_string(lc15bts_dir_names, act_req->dir)); @@ -1120,9 +1113,7 @@ static int sapi_activate_cb(struct gsm_lchan *lchan, int status) /* FIXME: Error handling */ if (status != GsmL1_Status_Success) { - LOGP(DL1C, LOGL_ERROR, - "%s act failed mark broken due status: %d\n", - gsm_lchan_name(lchan), status); + LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "act failed mark broken due status: %d\n", status); lchan_set_state(lchan, LCHAN_S_BROKEN); sapi_clear_queue(&lchan->sapi_cmds); mph_info_chan_confirm(lchan, PRIM_INFO_ACTIVATE, RSL_ERR_PROCESSOR_OVERLOAD); @@ -1169,13 +1160,11 @@ int lchan_activate(struct gsm_lchan *lchan) lchan_set_state(lchan, LCHAN_S_ACT_REQ); if (!llist_empty(&lchan->sapi_cmds)) - LOGP(DL1C, LOGL_ERROR, - "%s Trying to activate lchan, but commands in queue\n", - gsm_lchan_name(lchan)); + LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Trying to activate lchan, but commands in queue\n"); /* For handover, always start the main channel immediately. lchan->want_dl_sacch_active indicates whether dl * SACCH should be activated. Also, for HO, start the RACH SAPI. */ - if (lchan->ho.active == HANDOVER_ENABLED) + if (lchan->ho.active == HANDOVER_ENABLED || rsl_chan_rt_is_asci(lchan->rsl_chan_rt)) enqueue_sapi_act_cmd(lchan, GsmL1_Sapi_Rach, GsmL1_Dir_RxUplink); for (i = 0; i < s4l->num_sapis; i++) { @@ -1332,9 +1321,8 @@ static int chmod_modif_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg, goto err; } - LOGP(DL1C, LOGL_INFO, "%s MPH-CONFIG.conf (%s) ", - gsm_lchan_name(lchan), - get_value_string(lc15bts_l1cfgt_names, cc->cfgParamId)); + LOGPLCHAN(lchan, DL1C, LOGL_INFO, "MPH-CONFIG.conf (%s) ", + get_value_string(lc15bts_l1cfgt_names, cc->cfgParamId)); switch (cc->cfgParamId) { case GsmL1_ConfigParamId_SetLogChParams: @@ -1366,9 +1354,7 @@ static int chmod_modif_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg, break; } if (llist_empty(&lchan->sapi_cmds)) { - LOGP(DL1C, LOGL_ERROR, - "%s Got ciphering conf with empty queue\n", - gsm_lchan_name(lchan)); + LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Got ciphering conf with empty queue\n"); goto err; } @@ -1419,10 +1405,8 @@ static int mph_send_config_logchpar(struct gsm_lchan *lchan, struct sapi_cmd *cm /* FIXME: update encryption */ - LOGP(DL1C, LOGL_INFO, "%s MPH-CONFIG.req (%s) ", - gsm_lchan_name(lchan), - get_value_string(lc15bts_l1sapi_names, - conf_req->cfgParams.setLogChParams.sapi)); + LOGPLCHAN(lchan, DL1C, LOGL_INFO, "MPH-CONFIG.req (%s) ", + get_value_string(lc15bts_l1sapi_names, conf_req->cfgParams.setLogChParams.sapi)); LOGPC(DL1C, LOGL_INFO, "cfgParams Tn=%u, subCh=%u, dir=0x%x ", conf_req->cfgParams.setLogChParams.u8Tn, conf_req->cfgParams.setLogChParams.subCh, @@ -1532,11 +1516,9 @@ static int mph_send_config_ciphering(struct gsm_lchan *lchan, struct sapi_cmd *c return -EINVAL; cfgr->cfgParams.setCipheringParams.cipherId = rsl2l1_ciph[lchan->encr.alg_id]; - LOGP(DL1C, LOGL_NOTICE, "%s SET_CIPHERING (ALG=%u %s)\n", - gsm_lchan_name(lchan), + LOGPLCHAN(lchan, DL1C, LOGL_NOTICE, "SET_CIPHERING (ALG=%u %s)\n", cfgr->cfgParams.setCipheringParams.cipherId, - get_value_string(lc15bts_dir_names, - cfgr->cfgParams.setCipheringParams.dir)); + get_value_string(lc15bts_dir_names, cfgr->cfgParams.setCipheringParams.dir)); memcpy(cfgr->cfgParams.setCipheringParams.u8Kc, lchan->encr.key, lchan->encr.key_len); @@ -1614,9 +1596,8 @@ static int lchan_deact_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg, goto err; } - LOGP(DL1C, LOGL_INFO, "%s MPH-DEACTIVATE.conf (%s ", - gsm_lchan_name(lchan), - get_value_string(lc15bts_l1sapi_names, ic->sapi)); + LOGPLCHAN(lchan, DL1C, LOGL_INFO, "MPH-DEACTIVATE.conf (%s ", + get_value_string(lc15bts_l1sapi_names, ic->sapi)); LOGPC(DL1C, LOGL_INFO, "%s)\n", get_value_string(lc15bts_dir_names, ic->dir)); @@ -1638,19 +1619,15 @@ static int lchan_deact_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg, if (llist_empty(&lchan->sapi_cmds)) { - LOGP(DL1C, LOGL_ERROR, - "%s Got de-activation confirmation with empty queue\n", - gsm_lchan_name(lchan)); + LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Got de-activation confirmation with empty queue\n"); goto err; } cmd = llist_entry(lchan->sapi_cmds.next, struct sapi_cmd, entry); if (cmd->sapi != ic->sapi || cmd->dir != ic->dir || cmd->type != SAPI_CMD_DEACTIVATE) { - LOGP(DL1C, LOGL_ERROR, - "%s Confirmation mismatch (%d, %d) (%d, %d)\n", - gsm_lchan_name(lchan), cmd->sapi, cmd->dir, - ic->sapi, ic->dir); + LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Confirmation mismatch (%d, %d) (%d, %d)\n", + cmd->sapi, cmd->dir, ic->sapi, ic->dir); goto err; } @@ -1675,9 +1652,8 @@ static int mph_send_deactivate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd deact_req->sapi = cmd->sapi; deact_req->hLayer3 = (HANDLE)l1if_lchan_to_hLayer(lchan); - LOGP(DL1C, LOGL_INFO, "%s MPH-DEACTIVATE.req (%s ", - gsm_lchan_name(lchan), - get_value_string(lc15bts_l1sapi_names, deact_req->sapi)); + LOGPLCHAN(lchan, DL1C, LOGL_INFO, "MPH-DEACTIVATE.req (%s ", + get_value_string(lc15bts_l1sapi_names, deact_req->sapi)); LOGPC(DL1C, LOGL_INFO, "%s)\n", get_value_string(lc15bts_dir_names, deact_req->dir)); @@ -1689,8 +1665,7 @@ static int sapi_deactivate_cb(struct gsm_lchan *lchan, int status) { /* FIXME: Error handling. There is no NACK... */ if (status != GsmL1_Status_Success && lchan->state == LCHAN_S_REL_REQ) { - LOGP(DL1C, LOGL_ERROR, "%s is now broken. Stopping the release.\n", - gsm_lchan_name(lchan)); + LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "is now broken. Stopping the release.\n"); lchan_set_state(lchan, LCHAN_S_BROKEN); sapi_clear_queue(&lchan->sapi_cmds); mph_info_chan_confirm(lchan, PRIM_INFO_DEACTIVATE, 0); @@ -1775,8 +1750,7 @@ static int lchan_deactivate_sapis(struct gsm_lchan *lchan) /* nothing was queued */ if (res == 0) { - LOGP(DL1C, LOGL_ERROR, "%s all SAPIs already released?\n", - gsm_lchan_name(lchan)); + LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "all SAPIs already released?\n"); lchan_set_state(lchan, LCHAN_S_BROKEN); mph_info_chan_confirm(lchan, PRIM_INFO_DEACTIVATE, 0); } @@ -1827,36 +1801,22 @@ int bts_model_check_oml(struct gsm_bts *bts, uint8_t msg_type, } /* callback from OML */ -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); - struct gsm_abis_mo *mo = gsm_objclass2mo(bts, foh->obj_class, &foh->obj_inst); - struct nm_fsm_ev_setattr_data ev_data = { - .msg = msg, - .cause = 0, - }; - int rc; struct gsm_bts_trx *trx; struct lc15l1_hdl *fl1h; - uint8_t cell_size; - - /* TODO: NM Object without FSM: */ - switch (foh->obj_class) { - case NM_OC_GPRS_NSE: - case NM_OC_GPRS_CELL: - case NM_OC_GPRS_NSVC: - return oml_fom_ack_nack(ev_data.msg, ev_data.cause); - } switch (foh->msg_type) { case NM_MT_SET_RADIO_ATTR: trx = obj; fl1h = trx_lc15l1_hdl(trx); - /* convert max TA to max cell size in qbits */ - cell_size = bts->max_ta << 2; #if LITECELL15_API_VERSION >= LITECELL15_API(2,1,7) + { + /* convert max TA to max cell size in qbits */ + uint8_t cell_size = bts->max_ta << 2; /* We do not need to check for L1 handle * because the max cell size parameter can receive before MphInit */ if (fl1h->phy_inst->u.lc15.max_cell_size != cell_size) { @@ -1865,6 +1825,7 @@ int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg, /* update current max cell size */ fl1h->phy_inst->u.lc15.max_cell_size = cell_size; } + } #endif /* Did we go through MphInit yet? If yes fire and forget */ @@ -1889,11 +1850,7 @@ int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg, break; } - rc = osmo_fsm_inst_dispatch(mo->fi, - ev_data.cause == 0 ? NM_EV_SETATTR_ACK : NM_EV_SETATTR_NACK, - &ev_data); - /* msgb ownership is transferred to FSM if it received ev: */ - return rc == 0 ? 1 : 0; + return 0; } /* callback from OML */ @@ -1907,35 +1864,21 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo, 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); + case NM_OC_BASEB_TRANSC: + case NM_OC_GPRS_NSE: + case NM_OC_GPRS_CELL: + case NM_OC_GPRS_NSVC: + rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL); break; case NM_OC_RADIO_CARRIER: trx = (struct gsm_bts_trx *) obj; rc = trx_init(trx); 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 = ts_opstart(ts); break; - case NM_OC_GPRS_NSE: - case NM_OC_GPRS_CELL: - case NM_OC_GPRS_NSVC: - oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1, -1); - rc = oml_mo_opstart_ack(mo); - if (mo->obj_class == NM_OC_BTS) { - oml_mo_state_chg(&bts->mo, -1, NM_AVSTATE_OK, -1); - oml_mo_state_chg(&bts->gprs.nse.mo, -1, NM_AVSTATE_OK, -1); - oml_mo_state_chg(&bts->gprs.cell.mo, -1, NM_AVSTATE_OK, -1); - oml_mo_state_chg(&bts->gprs.nsvc[0].mo, -1, NM_AVSTATE_OK, -1); - } - break; default: rc = oml_mo_opstart_nack(mo, NM_NACK_OBJCLASS_NOTSUPP); } @@ -2005,14 +1948,10 @@ int l1if_rsl_chan_act(struct gsm_lchan *lchan) */ int l1if_rsl_chan_mod(struct gsm_lchan *lchan) { - const struct lchan_sapis *s4l = &sapis_for_lchan[lchan->type]; - unsigned int i; - if (lchan->ho.active == HANDOVER_NONE) return -1; - LOGP(DHO, LOGL_ERROR, "%s modifying channel for handover\n", - gsm_lchan_name(lchan)); + LOGPLCHAN(lchan, DHO, LOGL_ERROR, "modifying channel for handover\n"); /* Give up listening to RACH bursts */ release_sapi_ul_rach(lchan); @@ -2028,8 +1967,7 @@ int l1if_rsl_chan_rel(struct gsm_lchan *lchan) { /* A duplicate RF Release Request, ignore it */ if (lchan->state == LCHAN_S_REL_REQ) { - LOGP(DL1C, LOGL_ERROR, "%s already in release request state.\n", - gsm_lchan_name(lchan)); + LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "already in release request state.\n"); return 0; } @@ -2065,8 +2003,7 @@ static int ts_disconnect_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg, struct gsm_bts_trx_ts *ts = &trx->ts[cnf->u8Tn]; OSMO_ASSERT(cnf->u8Tn < TRX_NR_TS); - LOGP(DL1C, LOGL_DEBUG, "%s Rx mphDisconnectCnf\n", - gsm_lchan_name(ts->lchan)); + LOGPLCHAN(ts->lchan, DL1C, LOGL_DEBUG, "Rx mphDisconnectCnf\n"); cb_ts_disconnected(ts); @@ -2081,7 +2018,7 @@ int bts_model_ts_disconnect(struct gsm_bts_trx_ts *ts) struct lc15l1_hdl *fl1h = trx_lc15l1_hdl(ts->trx); GsmL1_MphDisconnectReq_t *cr; - DEBUGP(DRSL, "%s TS disconnect\n", gsm_lchan_name(ts->lchan)); + LOGPLCHAN(ts->lchan, DRSL, LOGL_DEBUG, "TS disconnect\n"); cr = prim_init(msgb_l1prim(msg), GsmL1_PrimId_MphDisconnectReq, fl1h, l1p_handle_for_ts(ts)); cr->u8Tn = ts->nr; @@ -2097,8 +2034,7 @@ static int ts_connect_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg, struct gsm_bts_trx_ts *ts = &trx->ts[cnf->u8Tn]; OSMO_ASSERT(cnf->u8Tn < TRX_NR_TS); - DEBUGP(DL1C, "%s %s Rx mphConnectCnf flags=%s%s%s\n", - gsm_lchan_name(ts->lchan), + LOGPLCHAN(ts->lchan, DL1C, LOGL_DEBUG, "%s Rx mphConnectCnf flags=%s%s%s\n", gsm_pchan_name(ts->pchan), ts->flags & TS_F_PDCH_ACTIVE ? "ACTIVE " : "", ts->flags & TS_F_PDCH_ACT_PENDING ? "ACT_PENDING " : "", diff --git a/src/osmo-bts-lc15/tch.c b/src/osmo-bts-lc15/tch.c index 526b2ddf..afd5b53f 100644 --- a/src/osmo-bts-lc15/tch.c +++ b/src/osmo-bts-lc15/tch.c @@ -15,7 +15,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/>. @@ -68,7 +68,7 @@ static struct msgb *l1_to_rtppayload_fr(uint8_t *l1_payload, uint8_t payload_len cur = msgb_put(msg, GSM_FR_BYTES); memcpy(cur, l1_payload, GSM_FR_BYTES); - lchan_set_marker(osmo_fr_check_sid(l1_payload, payload_len), lchan); + lchan_set_marker(osmo_fr_is_any_sid(l1_payload), lchan); return msg; } @@ -101,12 +101,8 @@ static struct msgb *l1_to_rtppayload_efr(uint8_t *l1_payload, /* new L1 can deliver bits like we need them */ cur = msgb_put(msg, GSM_EFR_BYTES); memcpy(cur, l1_payload, GSM_EFR_BYTES); - enum osmo_amr_type ft; - enum osmo_amr_quality bfi; - uint8_t cmr; - int8_t sti, cmi; - osmo_amr_rtp_dec(l1_payload, payload_len, &cmr, &cmi, &ft, &bfi, &sti); - lchan_set_marker(ft == AMR_GSM_EFR_SID, lchan); + + lchan_set_marker(osmo_efr_is_any_sid(l1_payload), lchan); return msg; } @@ -259,7 +255,10 @@ int l1if_tch_encode(struct gsm_lchan *lchan, uint8_t *data, uint8_t *len, *payload_type = GsmL1_TchPlType_Efr; rc = rtppayload_to_l1_efr(l1_payload, rtp_pl, rtp_pl_len); - /* FIXME: detect and save EFR SID */ + if (rc && lchan->ts->trx->bts->dtxd) + is_sid = osmo_efr_check_sid(rtp_pl, rtp_pl_len); + if (is_sid) + dtx_cache_payload(lchan, rtp_pl, rtp_pl_len, fn, -1); break; case GSM48_CMODE_SPEECH_AMR: if (use_cache) { @@ -360,7 +359,7 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg) { GsmL1_Prim_t *l1p = msgb_l1prim(l1p_msg); GsmL1_PhDataInd_t *data_ind = &l1p->u.phDataInd; - uint8_t *payload, payload_type, payload_len, sid_first[9] = { 0 }; + uint8_t *payload, payload_type, payload_len; struct msgb *rmsg = NULL; struct gsm_lchan *lchan = &trx->ts[L1SAP_CHAN2TS(chan_nr)].lchan[l1sap_chan2ss(chan_nr)]; @@ -368,7 +367,7 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg) return -EAGAIN; if (data_ind->msgUnitParam.u8Size < 1) { - LOGPFN(DL1P, LOGL_DEBUG, data_ind->u32Fn, "chan_nr %d Rx Payload size 0\n", chan_nr); + LOGPLCFN(lchan, data_ind->u32Fn, DL1P, LOGL_DEBUG, "chan_nr %d Rx Payload size 0\n", chan_nr); /* Push empty payload to upper layers */ rmsg = msgb_alloc_headroom(256, 128, "L1P-to-RTP"); return add_l1sap_header(trx, rmsg, lchan, chan_nr, data_ind->u32Fn, @@ -399,6 +398,8 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg) if (lchan->type != GSM_LCHAN_TCH_H && lchan->type != GSM_LCHAN_TCH_F) goto err_payload_match; + LOGPLCFN(lchan, data_ind->u32Fn, DL1P, LOGL_DEBUG, "DTX: received ONSET from L1 " "(%d bytes)\n", + payload_len); /* according to 3GPP TS 26.093 ONSET frames precede the first speech frame of a speech burst - set the marker for next RTP frame */ @@ -407,33 +408,32 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg) case GsmL1_TchPlType_Amr_SidFirstP1: if (lchan->type != GSM_LCHAN_TCH_H) goto err_payload_match; - LOGPFN(DL1P, LOGL_DEBUG, data_ind->u32Fn, "DTX: received SID_FIRST_P1 from L1 " - "(%d bytes)\n", payload_len); + LOGPLCFN(lchan, data_ind->u32Fn, DL1P, LOGL_DEBUG, "DTX: received SID_FIRST_P1 from L1 " + "(%d bytes)\n", payload_len); break; case GsmL1_TchPlType_Amr_SidFirstP2: if (lchan->type != GSM_LCHAN_TCH_H) goto err_payload_match; - LOGPFN(DL1P, LOGL_DEBUG, data_ind->u32Fn, "DTX: received SID_FIRST_P2 from L1 " - "(%d bytes)\n", payload_len); + LOGPLCFN(lchan, data_ind->u32Fn, DL1P, LOGL_DEBUG, "DTX: received SID_FIRST_P2 from L1 " + "(%d bytes)\n", payload_len); break; case GsmL1_TchPlType_Amr_SidFirstInH: if (lchan->type != GSM_LCHAN_TCH_H) goto err_payload_match; lchan->rtp_tx_marker = true; - LOGPFN(DL1P, LOGL_DEBUG, data_ind->u32Fn, "DTX: received SID_FIRST_INH from L1 " - "(%d bytes)\n", payload_len); + LOGPLCFN(lchan, data_ind->u32Fn, DL1P, LOGL_DEBUG, "DTX: received SID_FIRST_INH from L1 " + "(%d bytes)\n", payload_len); break; case GsmL1_TchPlType_Amr_SidUpdateInH: if (lchan->type != GSM_LCHAN_TCH_H) goto err_payload_match; lchan->rtp_tx_marker = true; - LOGPFN(DL1P, LOGL_DEBUG, data_ind->u32Fn, "DTX: received SID_UPDATE_INH from L1 " - "(%d bytes)\n", payload_len); + LOGPLCFN(lchan, data_ind->u32Fn, DL1P, LOGL_DEBUG, "DTX: received SID_UPDATE_INH from L1 " + "(%d bytes)\n", payload_len); break; default: - LOGPFN(DL1P, LOGL_NOTICE, data_ind->u32Fn, "%s Rx Payload Type %s is unsupported\n", - gsm_lchan_name(lchan), - get_value_string(lc15bts_tch_pl_names, payload_type)); + LOGPLCFN(lchan, data_ind->u32Fn, DL1P, LOGL_NOTICE, "%s Rx Payload Type %s is unsupported\n", + gsm_lchan_name(lchan), get_value_string(lc15bts_tch_pl_names, payload_type)); break; } @@ -449,14 +449,8 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg) rmsg = l1_to_rtppayload_efr(payload, payload_len, lchan); break; case GsmL1_TchPlType_Amr: - rmsg = l1_to_rtppayload_amr(payload, payload_len, lchan); - break; case GsmL1_TchPlType_Amr_SidFirstP1: - memcpy(sid_first, payload, payload_len); - int len = osmo_amr_rtp_enc(sid_first, 0, AMR_SID, AMR_GOOD); - if (len < 0) - return 0; - rmsg = l1_to_rtppayload_amr(sid_first, len, lchan); + rmsg = l1_to_rtppayload_amr(payload, payload_len, lchan); break; } @@ -468,8 +462,8 @@ int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg) return 0; err_payload_match: - LOGPFN(DL1P, LOGL_ERROR, data_ind->u32Fn, "%s Rx Payload Type %s incompatible with lchan\n", - gsm_lchan_name(lchan), get_value_string(lc15bts_tch_pl_names, payload_type)); + LOGPLCFN(lchan, data_ind->u32Fn, DL1P, LOGL_ERROR, "%s Rx Payload Type %s incompatible with lchan\n", + gsm_lchan_name(lchan), get_value_string(lc15bts_tch_pl_names, payload_type)); return -EINVAL; } diff --git a/src/osmo-bts-lc15/utils.c b/src/osmo-bts-lc15/utils.c index 8d980ba8..b1906d12 100644 --- a/src/osmo-bts-lc15/utils.c +++ b/src/osmo-bts-lc15/utils.c @@ -16,7 +16,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/>. |