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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968 ) Change subject: pcu: Add infra to handle multitrx and multits envs ...................................................................... pcu: Add infra to handle multitrx and multits envs ARFCNs are allocated sequentially, so that conversion between arfcn<->trx_nr is easily done. Some helper functions are introduced to be able to submit and expect messages on a given TRX+TS, which is required for setups with several TRX and PDCH-enabled TS different than the default. These new APIs will be used in PCU_Tests.ttcn in subsequent patches. Change-Id: I28430e6d8c77d2b7dc630d186d425a5d82587b82 --- M library/PCUIF_Types.ttcn M pcu/GPRS_Components.ttcn M pcu/PCU_Tests.ttcn 3 files changed, 82 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/68/20968/1 diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn index b50e4c5..935f82b 100644 --- a/library/PCUIF_Types.ttcn +++ b/library/PCUIF_Types.ttcn @@ -815,21 +815,21 @@ template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09TrxNULL := ts_PCUIF_InfoV09Trx(0, '00000000'B, '00'O); -template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def := { +template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def(uint16_t base_arfcn) := { v09 := { - ts_PCUIF_InfoV09Trx, ts_PCUIF_InfoV09TrxNULL, + ts_PCUIF_InfoV09Trx(arfcn := base_arfcn + 0), ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL } }; -template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def := { +template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def(uint16_t base_arfcn) := { v10 := { - ts_PCUIF_InfoV10Trx(arfcn := 871), ts_PCUIF_InfoV10Trx(arfcn := 872), - ts_PCUIF_InfoV10Trx(arfcn := 873), ts_PCUIF_InfoV10Trx(arfcn := 874), - ts_PCUIF_InfoV10Trx(arfcn := 875), ts_PCUIF_InfoV10Trx(arfcn := 876), - ts_PCUIF_InfoV10Trx(arfcn := 877), ts_PCUIF_InfoV10Trx(arfcn := 878) + ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 0), ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 1), + ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 2), ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 3), + ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 4), ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 5), + ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 6), ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 7) } }; @@ -972,12 +972,12 @@ /* TODO: remove this as soon as we drop version 9 support */ -function f_PCUIF_ver_INFO_Trxs() +function f_PCUIF_ver_INFO_Trxs(uint16_t base_arfcn) return PCUIF_InfoTrxs { if (PCUIF_Types.mp_pcuif_version >= 10) { - return valueof(ts_PCUIF_InfoV10Trxs_def); + return valueof(ts_PCUIF_InfoV10Trxs_def(base_arfcn)); } else { - return valueof(ts_PCUIF_InfoV09Trxs_def); + return valueof(ts_PCUIF_InfoV09Trxs_def(base_arfcn)); } } diff --git a/pcu/GPRS_Components.ttcn b/pcu/GPRS_Components.ttcn index c460e25..5ca32dd 100644 --- a/pcu/GPRS_Components.ttcn +++ b/pcu/GPRS_Components.ttcn @@ -44,6 +44,11 @@ import from Native_Functions all; import from SGSN_Components all; +modulepar { + /* ARFCN of 1st TRX. Subsequent TRX are allocated incrementing ARFCNs. Nth TRX => base_arfcn + N-1 */ + GsmArfcn mp_base_arfcn := 871; +}; + type record TsTrxBtsNum { uint3_t ts_nr, uint3_t trx_nr, @@ -201,6 +206,18 @@ mtc.stop; } +function f_arfcn2trxnr(uint10_t arfcn) runs on MS_BTS_IFACE_CT return uint3_t { + if (arfcn < mp_base_arfcn) { + setverdict(fail, "Unable to find TRX NR for arfcn ", arfcn); + f_shutdown(__BFILE__, __LINE__); + } + return arfcn - mp_base_arfcn; +} + +function f_trxnr2arfcn(uint3_t trx_nr) return uint10_t { + return mp_base_arfcn + trx_nr; +} + function f_ultbf_new_from_rr_imm_ass(in GsmRrMessage rr_imm_ass) runs on MS_BTS_IFACE_CT return UlTbf { var UlTbf ul_tbf := valueof(t_UlTbf_def); @@ -394,12 +411,62 @@ return dl_tbf; } +function f_ms_tx_TsTrxBtsNum(inout GprsMS ms) +runs on MS_BTS_IFACE_CT return TsTrxBtsNum { + var uint3_t ts_nr := f_ultbf_next_ts(ms.ul_tbf); + + var uint3_t trx_nr; + if (ms.ul_tbf.arfcn != 0) { + trx_nr := f_arfcn2trxnr(ms.ul_tbf.arfcn); + } else { + /* FIXME: implement search by hsn+maio+ma when freq hopping is enabled */ + trx_nr := 7; + } + return valueof(ts_TsTrxBtsNum(ts_nr, trx_nr)); +} + +function f_dltbf_num_slots(inout DlTbf dl_tbf) +runs on MS_BTS_IFACE_CT return uint3_t { + var uint3_t n := 0; + for (var integer i := 0; i < lengthof(dl_tbf.ts_mask); i := i + 1) { + if (dl_tbf.ts_mask[i] == '1'B) { + n := n + 1; + } + } + return n; +} + function f_ultbf_inc_bsn(inout UlTbf ul_tbf) runs on MS_BTS_IFACE_CT { ul_tbf.bsn := ul_tbf.bsn + 1; ul_tbf.bsn := ul_tbf.bsn mod 128; /* FIXME: EGPRS SNS: 2048 */ } +function f_ultbf_next_ts(inout UlTbf ul_tbf) +runs on MS_BTS_IFACE_CT return uint3_t { + /* FIXME: in the future we probably want to store last used internally + /* and continue from there */ + for (var integer i := 0; i < lengthof(ul_tbf.ts_mask); i := i + 1) { + if (ul_tbf.ts_mask[i] == '1'B) { + return i; + } + } + setverdict(fail, "No TS available for tx!"); + f_shutdown(__BFILE__, __LINE__); + return 0; +} + +function f_ultbf_num_slots(inout UlTbf ul_tbf) +runs on MS_BTS_IFACE_CT return uint3_t { + var uint3_t n := 0; + for (var integer i := 0; i < lengthof(ul_tbf.ts_mask); i := i + 1) { + if (ul_tbf.ts_mask[i] == '1'B) { + n := n + 1; + } + } + return n; +} + function f_ms_use_ra(inout GprsMS ms, uint16_t ra, uint8_t ra_is_11bit := 0) runs on MS_BTS_IFACE_CT { ms.ra_is_11bit := ra_is_11bit; @@ -706,7 +773,7 @@ BTS.send(ts_PCUIF_RACH_IND(nr.bts_nr, nr.trx_nr, ts_nr := 0, ra := ra, is_11bit := is_11bit, burst_type := burst_type, - fn := fn, arfcn := 871, + fn := fn, arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), qta := ta * 4)); /* 3GPP TS 44.018, table 9.1.8.1, note 2b: Request Reference shall be set to 127 @@ -725,7 +792,8 @@ var template RAW_PCU_EventParam ev_param := {tdma_fn := ? }; BTS.send(ts_PCUIF_DATA_IND(nr.bts_nr, nr.trx_nr, nr.ts_nr, nr.blk_nr, sapi := PCU_IF_SAPI_PDTCH, data := data, - fn := fn, arfcn := 871, lqual_cb := lqual_cb)); + fn := fn, arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), + lqual_cb := lqual_cb)); if (fn != 0) { ev_param := {tdma_fn := fn }; } @@ -738,7 +806,7 @@ runs on MS_BTS_IFACE_CT { BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH, fn := 0, - arfcn := 871, block_nr := nr.blk_nr)); + arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), block_nr := nr.blk_nr)); BTS.receive(tr_PCUIF_DATA_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH)) -> value pcu_msg; } diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn index ff8a355..4e2feb6 100644 --- a/pcu/PCU_Tests.ttcn +++ b/pcu/PCU_Tests.ttcn @@ -70,7 +70,7 @@ friend template (value) PCUIF_info_ind ts_PCUIF_INFO_default := { version := PCUIF_Types.mp_pcuif_version, flags := c_PCUIF_Flags_default, - trx := f_PCUIF_ver_INFO_Trxs(), + trx := f_PCUIF_ver_INFO_Trxs(GPRS_Components.mp_base_arfcn), bsic := 7, mcc := 262, mnc := 42, -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I28430e6d8c77d2b7dc630d186d425a5d82587b82 Gerrit-Change-Number: 20968 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201029/f41ccfe6/attachment.htm>