This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/19030 ) Change subject: osmo-bts-trx/scheduler: implement baseband frequency hopping ...................................................................... osmo-bts-trx/scheduler: implement baseband frequency hopping Change-Id: I68f4ae09fd0789ad0d8f1c1e17e17dfc4de8e462 Related: OS#4546 --- M include/osmo-bts/scheduler.h M src/osmo-bts-trx/scheduler_trx.c M src/osmo-bts-trx/trx_if.c 3 files changed, 78 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/30/19030/1 diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h index e65665f..6f93812 100644 --- a/include/osmo-bts/scheduler.h +++ b/include/osmo-bts/scheduler.h @@ -270,6 +270,7 @@ }; /*! Handle an UL burst received by PHY */ +int trx_sched_route_burst_ind(struct l1sched_trx *l1t, struct trx_ul_burst_ind *bi); int trx_sched_ul_burst(struct l1sched_trx *l1t, struct trx_ul_burst_ind *bi); #endif /* TRX_SCHEDULER_H */ diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index 8e1ccfa..eecc65e 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -34,6 +34,7 @@ #include <osmocom/core/timer_compat.h> #include <osmocom/core/bits.h> #include <osmocom/gsm/a5.h> +#include <osmocom/gsm/gsm0502.h> #include <osmo-bts/gsm_data.h> @@ -55,6 +56,30 @@ return 0; } +/* Find a route (PHY instance) for a given Downlink burst request */ +static struct phy_instance *dlfh_route_br(const struct gsm_bts_trx_ts *ts, + const struct trx_dl_burst_req *br) +{ + const struct gsm_bts_trx *trx; + struct gsm_time time; + uint16_t arfcn; + + gsm_fn2gsmtime(&time, br->fn); + + /* TODO: implement a "cache", so we could avoid frequent lookups */ + arfcn = gsm0502_hop_seq_gen(&time, ts->hopping.hsn, ts->hopping.maio, + ts->hopping.ma_len, ts->hopping.ma); + llist_for_each_entry(trx, &ts->trx->bts->trx_list, list) { + if (trx->arfcn == arfcn) + return trx->role_bts.l1h; + } + + LOGP(DL1C, LOGL_FATAL, "Failed to resolve TDMA fn=%u " + "(hsn=%u, maio=%u, ma_len=%u)\n", + br->fn, ts->hopping.hsn, ts->hopping.maio, ts->hopping.ma_len); + return ts->trx->role_bts.l1h; /* fall-back to the current trx */ +} + /* schedule all frames of all TRX for given FN */ static void trx_sched_fn(struct gsm_bts *bts, const uint32_t fn) { @@ -100,8 +125,14 @@ continue; } + /* resolve PHY instance if freq. hopping is enabled */ + if (trx->ts[tn].hopping.enabled) { + pinst = dlfh_route_br(&trx->ts[tn], &br); + l1h = pinst->u.osmotrx.hdl; + } + /* update dummy burst mask for C0 */ - if (trx == bts->c0) + if (pinst->trx == bts->c0) c0_mask |= (1 << tn); trx_if_send_burst(l1h, &br); @@ -127,6 +158,50 @@ } } +/* Find a route (TRX instance) for a given Uplink burst indication */ +static struct gsm_bts_trx *ulfh_route_bi(const struct gsm_bts_trx *src_trx, + const struct trx_ul_burst_ind *bi) +{ + struct gsm_bts_trx *trx; + struct gsm_time time; + uint16_t arfcn; + + gsm_fn2gsmtime(&time, bi->fn); + + /* TODO: implement a "cache", so we could avoid frequent lookups */ + llist_for_each_entry(trx, &src_trx->bts->trx_list, list) { + const struct gsm_bts_trx_ts *ts = &trx->ts[bi->tn]; + if (!ts->hopping.enabled) + continue; + + arfcn = gsm0502_hop_seq_gen(&time, ts->hopping.hsn, ts->hopping.maio, + ts->hopping.ma_len, ts->hopping.ma); + if (src_trx->arfcn == arfcn) + return trx; + } + + LOGP(DL1C, LOGL_FATAL, "Failed to find transceiver for an Uplink burst fn=%u\n", bi->fn); + return (struct gsm_bts_trx *) src_trx; /* fall-back to the originating trx */ +} + +/* Route a given Uplink burst indication to the scheduler depending on freq. hopping state */ +int trx_sched_route_burst_ind(struct l1sched_trx *l1t, struct trx_ul_burst_ind *bi) +{ + const struct phy_instance *pinst; + const struct gsm_bts_trx *trx; + struct trx_l1h *l1h; + + /* no frequency hopping => nothing to do */ + if (!l1t->trx->ts[bi->tn].hopping.enabled) + return trx_sched_ul_burst(l1t, bi); + + trx = ulfh_route_bi(l1t->trx, bi); + pinst = trx_phy_instance(trx); + l1h = pinst->u.osmotrx.hdl; + + return trx_sched_ul_burst(&l1h->l1s, bi); +} + /*! maximum number of 'missed' frame periods we can tolerate of OS doesn't schedule us*/ #define MAX_FN_SKEW 50 /*! maximum number of frame periods we can tolerate without TRX Clock Indication*/ diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index 58f7455..2b74cd8 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -1097,7 +1097,7 @@ hdr_ver, trx_data_desc_msg(&bi)); /* feed received burst into scheduler code */ - trx_sched_ul_burst(&l1h->l1s, &bi); + trx_sched_route_burst_ind(&l1h->l1s, &bi); return 0; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/19030 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I68f4ae09fd0789ad0d8f1c1e17e17dfc4de8e462 Gerrit-Change-Number: 19030 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200628/10988af0/attachment.htm>