aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf.cpp
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-08-22 02:05:28 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-09-08 02:47:02 +0700
commitdb56a3563e3d76f75613581b666390c4ceddbc3d (patch)
treed5dff5206ccd9c95cb1af9db15519ec154418a36 /src/tbf.cpp
parent962d717f41cf70c08f881268c367fe0a5b8c9d7e (diff)
encoding: use CSN.1 codec to generate Packet Uplink Assignment
It's quite odd to see that in write_packet_downlink_assignment() we initialize an 'RlcMacDownlink_t', so then the caller can use the power of CSN.1 codec to generate the final sequence of bytes to be transmitted, while in write_packet_uplink_assignment() we already compose the final RLC/MAC message straight away using the low-level bitvec API (like bitvec_write_field()). I guess the reason is that at the time of writing this code, the CSN.1 codec was not stable enough, so it was safer to generate the message 'by hand'. This would also explain why we *decode* the final RLC/MAC message in create_ul_ass() right after encoding. Rewrite write_packet_uplink_assignment(), so now it initializes a caller-provided 'RlcMacDownlink_t' structure. Given that it's allocated on heap using talloc_zero(), do not initialize presence indicators of fields that are not present in the message. This would facilitate handling of frequency hopping parameters in the upcoming changes, in particular we can now introduce a function that would compose Frequency Parameters IE for both write_packet_{downlink,uplink}_assignment(). Tested manually by running a GPRS-enabled network, as well as by running test cases from ttcn3-pcu-test => no regressions observed. Change-Id: I2850b91e0043cdca8ae7498a5fc727eeedd029b6 Related: SYS#4868, OS#4547
Diffstat (limited to 'src/tbf.cpp')
-rw-r--r--src/tbf.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index c1ec7291..0447edc2 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1368,16 +1368,16 @@ struct msgb *gprs_rlcmac_tbf::create_ul_ass(uint32_t fn, uint8_t ts)
bitvec_unhex(&bv, DUMMY_VEC);
LOGPTBF(new_tbf, LOGL_INFO, "start Packet Uplink Assignment (PACCH)\n");
- Encoding::write_packet_uplink_assignment(&bv, m_tfi,
+ mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t);
+ Encoding::write_packet_uplink_assignment(mac_control_block, m_tfi,
(direction == GPRS_RLCMAC_DL_TBF), tlli(),
is_tlli_valid(), new_tbf, 1, rrbp, bts_data()->alpha,
bts_data()->gamma, -1, is_egprs_enabled());
- mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t);
LOGP(DTBF, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Uplink Assignment +++++++++++++++++++++++++\n");
- rc = decode_gsm_rlcmac_downlink(&bv, mac_control_block);
+ rc = encode_gsm_rlcmac_downlink(&bv, mac_control_block);
if (rc < 0) {
- LOGP(DTBF, LOGL_ERROR, "Decoding of Packet Uplink Ass failed (%d)\n", rc);
+ LOGP(DTBF, LOGL_ERROR, "Encoding of Packet Uplink Ass failed (%d)\n", rc);
goto free_ret;
}
LOGP(DTBF, LOGL_DEBUG, "------------------------- TX : Packet Uplink Assignment -------------------------\n");