From 143de750131f9df43cd900a65ee73e9dbbce333e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 5 Oct 2013 17:16:20 +0200 Subject: Do not attempt to initialize L1 with a band unsupported by hardware If the EEPROM tells us that a given unit doesn't support a given band, we shouldn't try to use it, even if the BSC tells us to use an ARFCN in such an unsupported band. The reason is simple: The given BTS unit might have band specific filter / duplexer / PA. --- src/osmo-bts-sysmo/oml.c | 2 +- src/osmo-bts-sysmo/utils.c | 26 ++++++++++++++++++-------- src/osmo-bts-sysmo/utils.h | 4 ++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index faef0258..bd73f647 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -277,7 +277,7 @@ static int trx_init(struct gsm_bts_trx *trx) //return oml_mo_opstart_nack(&trx->mo, NM_NACK_CANT_PERFORM); } - femto_band = sysmobts_select_femto_band(trx->bts, trx->arfcn); + femto_band = sysmobts_select_femto_band(trx, trx->arfcn); if (femto_band < 0) { LOGP(DL1C, LOGL_ERROR, "Unsupported GSM band %s\n", gsm_band_name(trx->bts->band)); diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c index d3ee872c..eaa45290 100644 --- a/src/osmo-bts-sysmo/utils.c +++ b/src/osmo-bts-sysmo/utils.c @@ -1,7 +1,7 @@ /* * Helper utilities that are used in OML * - * (C) 2011 by Harald Welte + * (C) 2011-2013 by Harald Welte * (C) 2013 by Holger Hans Peter Freyther * * All Rights Reserved @@ -24,11 +24,20 @@ #include "utils.h" #include +#include #include "femtobts.h" +#include "l1_if.h" -static int band_osmo2femto(enum gsm_band osmo_band) +static int band_osmo2femto(struct gsm_bts_trx *trx, enum gsm_band osmo_band) { + struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx); + + /* check if the TRX hardware actually supports the given band */ + if (!(fl1h->hw_info.band_support & osmo_band)) + return -1; + + /* if yes, convert from osmcoom style band definition to L1 band */ switch (osmo_band) { case GSM_BAND_850: return GsmL1_FreqBand_850; @@ -50,13 +59,14 @@ static int band_osmo2femto(enum gsm_band osmo_band) * modifying the BTS configuration is a bit annoying. The auto-band * configuration allows to ease with this transition. */ -int sysmobts_select_femto_band(struct gsm_bts *bts, uint16_t arfcn) +int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn) { enum gsm_band band; + struct gsm_bts *bts = trx->bts; struct gsm_bts_role_bts *btsb = bts_role_bts(bts); if (!btsb->auto_band) - return band_osmo2femto(bts->band); + return band_osmo2femto(trx, bts->band); /* * We need to check what will happen now. @@ -65,11 +75,11 @@ int sysmobts_select_femto_band(struct gsm_bts *bts, uint16_t arfcn) /* if we are already on the right band return */ if (band == bts->band) - return band_osmo2femto(bts->band); + return band_osmo2femto(trx, bts->band); /* Check if it is GSM1800/GSM1900 */ if (band == GSM_BAND_1800 && bts->band == GSM_BAND_1900) - return band_osmo2femto(bts->band); + return band_osmo2femto(trx, bts->band); /* * Now to the actual autobauding. We just want DCS/DCS and @@ -78,9 +88,9 @@ int sysmobts_select_femto_band(struct gsm_bts *bts, uint16_t arfcn) if ((band == GSM_BAND_900 && bts->band == GSM_BAND_1800) || (band == GSM_BAND_1800 && bts->band == GSM_BAND_900) || (band == GSM_BAND_850 && bts->band == GSM_BAND_1900)) - return band_osmo2femto(band); + return band_osmo2femto(trx, band); if (band == GSM_BAND_1800 && bts->band == GSM_BAND_850) - return band_osmo2femto(GSM_BAND_1900); + return band_osmo2femto(trx, GSM_BAND_1900); /* give up */ return -1; diff --git a/src/osmo-bts-sysmo/utils.h b/src/osmo-bts-sysmo/utils.h index 4574e221..65706359 100644 --- a/src/osmo-bts-sysmo/utils.h +++ b/src/osmo-bts-sysmo/utils.h @@ -3,8 +3,8 @@ #include -struct gsm_bts; +struct gsm_bts_trx; -int sysmobts_select_femto_band(struct gsm_bts *bts, uint16_t arfcn); +int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn); #endif -- cgit v1.2.3