From 43ccaf51f2206f63f963a87d8eb5f3261d9556a5 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 5 Sep 2020 21:35:13 +0700 Subject: [PATCH] library/PCUIF_Types: version 10: add Mobile Allocation length field My initial assumption was that we can skip redundant '0'B bits or even '00'O octets in the Mobile Allocation IE, and thus reduce the overall size of this element. Unfortunately, this is wrong. 3GPP TS 44.018, section 10.5.2.21 clearly states that the Mobile Allocation IE contains a bit-string of size NF, where NF is the number of frequencies in the cell allocation. If NF % 8 != 0, then '0'B padding bits must be appended to make it octet-aligned. In other words, if the cell allocation contains let's say 13 frequencies, but a hopping timeslot makes use of only a small fraction of it (e.g. 4 first channels), we would still need to transmit at least 13 bits (+padding), including all redundant bits and octets. In RLC/MAC frames though it's not required to make the bit-string octet aligned, so we need to send exactly NF bits without padding. In order to achieve that: a) add MA length field to INFO.ind (record PCUIF_InfoTrxTs); b) ajust the existing test cases to use this field. It's safe to merge this change as the related patches have not been merged to osmo-pcu and osmo-bts yet. Change-Id: I2709673c90a0cd7d76de9db8b8ad82ac59ca84a0 Related: SYS#4868, OS#4547 --- library/PCUIF_Types.ttcn | 8 +++++++- pcu/PCU_Tests.ttcn | 30 ++++++++---------------------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn index 8144d972f..f0200af9f 100644 --- a/library/PCUIF_Types.ttcn +++ b/library/PCUIF_Types.ttcn @@ -145,6 +145,7 @@ type record PCUIF_InfoTrxTs { uint8_t hopping, uint8_t hsn, uint8_t maio, + uint8_t ma_bit_len, bitstring ma length(64) } with { variant (ma) "BYTEORDER(first), BITORDER(msb)" }; private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList; @@ -709,12 +710,14 @@ template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t t tsc := tsc, hopping := 0, hsn := 0, maio := 0, + ma_bit_len := 0, ma := f_pad_bit(''B, 64, '0'B) }; template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := { tsc := tsc, hopping := 0, hsn := ?, maio := ?, + ma_bit_len := ?, ma := ? }; @@ -726,16 +729,19 @@ template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t t hopping := 1, hsn := hsn, maio := maio, + ma_bit_len := lengthof(valueof(ma)), ma := f_pad_bit(valueof(ma), 64, '0'B) }; template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?, template uint6_t hsn := ?, template uint6_t maio := ?, - template bitstring ma := ?) := { + template bitstring ma := ?, + template uint8_t ma_bit_len := ?) := { tsc := tsc, hopping := 1, hsn := hsn, maio := maio, + ma_bit_len := ma_bit_len, ma := ma }; diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn index 2d209752b..a4596bff8 100644 --- a/pcu/PCU_Tests.ttcn +++ b/pcu/PCU_Tests.ttcn @@ -2193,18 +2193,12 @@ private function f_TC_pcuif_fh_check_imm_ass(in PCUIF_info_ind info_ind, ia.pkt_chan_desc, " vs ", tr_pkt_chan_desc); } - var MobileAllocationLV tr_ma := { len := 0, ma := ''B }; - var octetstring ma_oct := bit2oct(ts.ma); - - /* Calculate length of the useful part of Mobile Allocation */ - for (var integer i := 0; i < lengthof(ma_oct); i := i + 1) { - if (ma_oct[i] != '00'O) { - tr_ma.len := i + 1; - } - } - - /* Strip zero bytes from the right side of MA */ - tr_ma.ma := substr(ts.ma, 0, tr_ma.len * 8); + /* Mobile Allocation is expected to be octet-aligned */ + var uint8_t ma_oct_len := (ts.ma_bit_len + 8 - 1) / 8; + var template MobileAllocationLV tr_ma := { + len := ma_oct_len, /* in bytes */ + ma := substr(ts.ma, 0, ma_oct_len * 8) + }; if (not match(ia.mobile_allocation, tr_ma)) { setverdict(fail, "Mobile Allocation does not match: ", @@ -2284,14 +2278,6 @@ private function f_TC_pcuif_fh_check_pkt_ass(in PCUIF_info_ind info_ind, { /* FIXME: TRX0/TS7 is a hard-coded expectation, make it configurable */ var PCUIF_InfoTrxTs ts := info_ind.trx.v10[0].ts[7]; - var integer ma_bit_len := 0; - - /* Calculate length of the useful part of Mobile Allocation */ - for (var integer i := 0; i < lengthof(ts.ma); i := i + 1) { - if (ts.ma[i] == '1'B) { - ma_bit_len := i + 1; - } - } /* Table 12.8.1: Frequency Parameters information elements */ var template FrequencyParameters tr_fp := { @@ -2307,8 +2293,8 @@ private function f_TC_pcuif_fh_check_pkt_ass(in PCUIF_info_ind info_ind, rfl_number_list_present := '0'B, rfl_number_list := omit, ma_present := '0'B, /* inverted logic */ - ma_length := ma_bit_len, - ma_bitmap := substr(ts.ma, 0, ma_bit_len) + ma_length := ts.ma_bit_len, + ma_bitmap := substr(ts.ma, 0, ts.ma_bit_len) } }, direct2 := omit