aboutsummaryrefslogtreecommitdiffstats
path: root/src/encoding.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-03-11encoding: Fixes TMSI vs MI bit selection in repeated page infoJF Dionne1-1/+15
Change-Id: Iddb00b9133f523f4ba09c8f1fc5694e62dc46fbf
2019-02-26Rewrite EGPRS Packet Uplink IA Rest Octets for SBAMax1-26/+58
Use bitvec_set_*() directly without external write pointer tracking to simplify the code. This is part of IA Rest Octets (3GPP TS 44.018 §10.5.2.16) which is the last part of the message so it should not interfere with the rest of encoding functions. That's partially based on reverted commit 529ce885450946d85d1920fb3d1a994c3efe5849. Change-Id: I143b3dd02aa54b9ce206d9e780a5554f6d9fd118 Related: OS#3014
2019-02-19Rewrite EGPRS Packet Uplink IA Rest Octets for MBAMax1-15/+11
Use bitvec_set_*() directly without external write pointer tracking to simplify the code. This is part of IA Rest Octets (3GPP TS 44.018 §10.5.2.16) which is the last part of the message so it should not interfere with the rest of encoding functions. That's partially based on reverted commit 529ce885450946d85d1920fb3d1a994c3efe5849. Change-Id: I19cc4226e7e831e7d7f70212b2078f5589a87ff0 Related: OS#3014
2019-02-19Rewrite Packet Downlink AssignmentMax1-33/+112
Use bitvec_set_*() directly without external write pointer tracking to simplify the code. This is part of IA Rest Octets (3GPP TS 44.018 §10.5.2.16) which is the last part of the message so it should not interfere with the rest of encoding functions. That's updated version of commit with the same topic reverted earlier. Change-Id: Ie180733d2584ebb16fb80b84526d0dbc70e3d441 Related: OS#3014
2019-02-19Restructure IA Rest Octets encodersMax1-123/+132
In preparation for upcoming patches with 11 bit RACH and TA support, let's restructure existing encoders to simplify further modifications: * move consistency checks to top-level Imm. Ass. encoder * use consistent formatting * constify pointers where appropriate * split SBA and MBA encoders into separate functions Those changes also make it obvious which parameters are necessary for Rest Octets in each specific case (DL, UL-SBA, UL-MBA, UL-SBA-EGPRS, UL-MBA-EGPRS). There're no functional code changes so there's no need to adjust tests. Change-Id: I0ad1bc786c3a8055ea9666f64ae82c512bd01603 Related: OS#1548
2019-02-19Clarify write_immediate_assignment() signatureMax1-4/+4
* remove unused variable * use bool for boolean types * add clarification comments Change-Id: I363445063e2d873d9194b2a5924b9e59b8b7ea53
2019-02-19Move C include to proper placeMax1-2/+1
Change-Id: Id58d1820b94d54ce73ed40edb7747ef975890a7b
2018-05-02improve documentation of Encoding::write_paging_request()Stefan Sperling1-3/+3
Add pointers to relevant parts of the spec. Tweak comments to be more specific about the values being written and abbreviations used. Change-Id: Ia5bf3f7f8846198b7b4e25ff1accf6206764be74
2018-03-30Revert "Rewrite EGPRS Packet Uplink Assignment"Neels Hofmeyr1-117/+55
This reverts commit 529ce885450946d85d1920fb3d1a994c3efe5849, I2139fb347b3290621bbc3f6a031f7f213d372e65. Commit I52ec9b07413daabba8cd5f1fba5c7b3af6a33389 / 896574e92bea09ed8d39688b6fdf504e84521746 was found (empirically) to be a regression, rendering GPRS service fatally unreliable. This reverted commit seems to be related to the regression and is reverted along with it. Related: OS#3013 Change-Id: I3e8cc0e8ba3ba5bd444124fd4cb95ef92a71fdfb
2018-03-28Revert "Rewrite Packet Downlink Assignment"Neels Hofmeyr1-73/+48
This reverts commit 896574e92bea09ed8d39688b6fdf504e84521746, I52ec9b07413daabba8cd5f1fba5c7b3af6a33389. This commit was found (empirically) to be a regression, rendering GPRS service fatally unreliable. Related: OS#3013 Change-Id: Idcba0381f70eb7f7c9aefdee9dfeafd5de96a9be
2018-03-28Revert "Rewrite Packet Uplink Assignment"Neels Hofmeyr1-48/+48
This reverts commit 93d947f5e8a30acc9250c124bf9d5bb6a8863526, I44db2eeea7448ff67e688ae716487bc6dbfc96a3. Commit I52ec9b07413daabba8cd5f1fba5c7b3af6a33389 / 896574e92bea09ed8d39688b6fdf504e84521746 was found (empirically) to be a regression, rendering GPRS service fatally unreliable. This reverted commit seems to follow after the regression and is reverted along with it. Related: OS#3013 Change-Id: If7038127e9a663c93006475b3add961adc0b1922
2018-03-28Revert "Use Timing Advance Index in UL assignments"Neels Hofmeyr1-6/+2
This reverts commit 6298fbb7b2f3639fde994633e33ba54a64a6ef9b, I8b17be78a46c0bc17516b7c90f35aa4768010ae4. Commit I52ec9b07413daabba8cd5f1fba5c7b3af6a33389 / 896574e92bea09ed8d39688b6fdf504e84521746 was found (empirically) to be a regression, rendering GPRS service fatally unreliable. This reverted commit seems to follow after the regression and is reverted along with it. Related: OS#3013 Change-Id: I5e0fd8c9c3b89e519e7382e3d0bb24e0aeddeff6
2018-01-17Use Timing Advance Index in UL assignmentsMax1-2/+6
Write TAI (if available) when generating Rest Octets for UL Assignment. This should not affect actual PCU behavior because TAI is not yet supported by upper layers but we have to adjust corresponding tests anyway. Change-Id: I8b17be78a46c0bc17516b7c90f35aa4768010ae4
2018-01-17Rewrite Packet Uplink AssignmentMax1-48/+48
Use bitvec_set_*() directly without external write pointer tracking to simplify the code. This is part of IA Rest Octets (3GPP TS 44.018 §10.5.2.16) which is the last part of the message so it should not interfere with the rest of encoding functions. The tests are adjusted accordingly. Change-Id: I44db2eeea7448ff67e688ae716487bc6dbfc96a3 Related: OS#1526
2018-01-17Rewrite Packet Downlink AssignmentMax1-48/+73
Use bitvec_set_*() directly without external write pointer tracking to simplify the code. This is part of IA Rest Octets (3GPP TS 44.018 §10.5.2.16) which is the last part of the message so it should not interfere with the rest of encoding functions. The tests are adjusted accordingly. Change-Id: I52ec9b07413daabba8cd5f1fba5c7b3af6a33389 Related: OS#1526
2018-01-17Rewrite EGPRS Packet Uplink AssignmentMax1-55/+117
Use bitvec_set_*() directly without external write pointer tracking to simplify the code. This is part of IA Rest Octets (3GPP TS 44.018 §10.5.2.16) which is the last part of the message so it should not interfere with the rest of encoding functions. Reusable fragments are split into static helpers. Change-Id: I2139fb347b3290621bbc3f6a031f7f213d372e65 Related: OS#1526
2018-01-12TBF: move window parameters to UL/DL levelMax1-2/+2
The UL and DL TBF use different classes implementing window management. Hence it's better to use it explicitly instead of using the common window management superclass inside common TBF superclass. While at it, also remove the direct access to window class - use accessor functions instead. Related: OS#1759 Change-Id: I0b55aa8947db65f7206adcf53ea32b74a831d9e6
2018-01-04window: move encoding into functionsMax1-14/+20
* move window size encoding and writing into separate functions * introduce necessary TBF wrappers to avoid direct m_window access This is part of preparation work to move to separate UL/DL windows. Related: OS#1759 Change-Id: I60184d5049bc7d7b119df5a9eb82d1c4b788c840
2017-05-15remove pcu own bitvector implementationAlexander Couzens1-274/+274
The osmocore bitvec is exact the same, but use a pointer instead of a reference. Change-Id: Id8f797631d89aa12b6e48efb2dc153a3e2f059f7
2017-03-17Support sending OML Alerts via BTSMax1-10/+16
* extend BTS <-> PCU protocol with TXT messages * use it to implement OML alerts support * use it to implement version message * add function to transmit both of them them * send alerts for internal encoding problems as an example * send version when BTS socket is connected Note: requires corresponding change If57459c0610f2c7b36d599b13087c8deef8bdd9e in libosmocore. Related: OS#1614, 1615 Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7
2017-01-23Add compression support in EGPRS PUANsivasankari1-23/+108
This adds compression of bitmap in PUAN. The compressed bitmap is used only if the number of bits in the bitmap does not fit in the message and there is a gain after compression. The algorithm is part of libosmocore and so there is dependency on the libosmocore for compilation. The algorithm is tested on integration setup by forcing compression. Change-Id: Id2eec4b5eb6da0ebd24054b541b09b700b9b40ba
2017-01-06Refactoring write_packet_ack_nack_desc_egprs to prepare for CRBB supportPravin Kumarvel1-33/+36
Change-Id: Ie5c25b6ee30f2f1b613e923c234b03a6ffe12ae2
2016-11-11Handle packet access reject during EPDAN/PDAN with channel descriptionaravind sirsikar1-0/+25
When PDAN/EPDAN with channel description is received, PCU will generate the packet access reject if no resources are present. The encoding is done based on section 7.1.3.2.1 and 8.1.2.5 of 44.060 version 7.27.0 Release 7. This patch also includes the test case to validate the generated packet access reject message. This patch is integration tested on Osmo-trx setup with Ettus B210 board and LG F70 MS with some simulation code changes in Osmo-pcu. Change-Id: I096a3bb44a65533b9e9b091925dd5f70a8696d6
2016-11-09Handle Immediate assignment rejectaravind sirsikar1-0/+78
When RACH is received, PCU will generate the Immediate assignment reject message if no resources are present. The encoding is done based on section 9.1.20 of 44.018 version 11.7.0 Release 11. This patch also includes the test case to validate the generated Immediate assignment reject message. This patch is integration tested on Osmo-trx setup with Ettus B210 board and LG F70 MS with some simulation code changes in Osmo-pcu. Change-Id: I3d33e2b9746fa4f338fad0e6b63b1c5f07de6f9b
2016-11-09Handle Timing Advance IE properlyMax1-31/+43
Move writing Timing Advance IE and Timing Advance Index into separate functions to simplify adding PTCCH support. This also fixes previous incorrect (and unused) code for writing Packet TA IE which has not set TS for TA. Change-Id: I786bf7fc999d401cc3d9e7f1e7a1fba953b5d458 Related: OS#1545
2016-09-16Update the function immediate assignment for EGPRSbhargava1-9/+76
Encode the EGPRS fields of immediate assignment message in uplink when EGPRS PACKET CHANNEL REQUEST (11 bit RACH) is received. The series of patches for 11 bit RACH are dependent on libosmocore and osmo-bts patches for 11 bit RACH. Change-Id: Ie5e309156e5dbbb6add74a1b4d257c4ee2332e52
2016-08-25Fix EGPRS PUAN encoding: use correct urbb_lenAravind Sirsikar1-1/+2
Earlier there was an incorrect encoding of PUAN when VQ is not equal VR case for EGPRS UL RLC window. The PCU was encoding the same PUAN message always irrespective of radio condition. This was a bottle neck for performance testing. Which has been fixed in this patch. Related: OS#1793 unit test assertion in the previous commit is fixed in this patch. Change-Id: Iba7b1995028bd81749ffb080616b2ad5f2540d57
2016-08-02Add support for SPB handling for EGPRS UL TBFAravind Sirsikar1-2/+4
This patch will modify the EGPRS UL TBF flow to support Split block handling. This patch also contains test suite modification for SPB UL. Scenarios like MCS6->MCS3, MCS4->MCS1, MCS5->MCS2, MCS9->MCS3 MCS7->MCS2, MCS8->MCS3 have been simulated and Integration tested in NuRAN 1.0 hardware thoroughly. The scope of Unit testing is limited. Change-Id: I39ca53218b6e0982abc2ab9c703c24c8bf0a09c0
2016-07-28Properly set TA_VALID bitMax1-3/+6
Check Timing Advance validity and set corresponding bit for Immediate Assignment message. Previously !polling was errorneously used (polling bit has nothing to do with TA validity according to 3GPP TS 44.018 Table 10.5.2.16.1) which lead to TA being always valid as polling is always 0 in other parts of the code. Change-Id: I5d7ecc7f71402b945cae99332be2ebc0b17b9d44 Related: OS#1526
2016-07-14egprs: Use RLC/MAC headers from libosmocoreTom Tsou1-17/+21
EGPRS Type 1, 2, and 3 headers are used by OsmoPCU and OsmoBTS. Move the header definitions to libosmocore to be shared by both packages. Modify the struct variable naming to use *_hi/*_lo instead of *_a/*_b in order to be consistent with existing naming used in libosmocore. Change-Id: I98687ad981d27502aec42729611937ba1caf207c
2016-06-16Add header type 1 support for EGPRS uplinkAravind Sirsikar1-2/+3
Function is added to parse the EGPRS header type 1 in uplink tbf path. along with configuration parameter updation to reflect max mcs in UL Change-Id: I13c250e2e07377982ac3f29745f3cffd4088552a Reviewed-on: https://gerrit.osmocom.org/270 Reviewed-by: Harald Welte <laforge@gnumonks.org> Tested-by: Jenkins Builder
2016-06-07encoding/rlc_copy_from_aligned_buffer: export written payload bytes via an ↵Alexander Couzens1-7/+26
argument Require to count statistics for rlc_dl_payload_bytes. Change-Id: I0e622acb1f13f7489946baf049de4ba1cde6a1fc Reviewed-on: https://gerrit.osmocom.org/142 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-31encoding: add doxygen for rlc_data_to_dl_append*Alexander Couzens1-0/+31
Change-Id: I6ead0f1d14a91c657448227e17438b49a54e6c4a Reviewed-on: https://gerrit.osmocom.org/141 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-02-08rlc: Use the rlc structure to access the data unit in the RLC messageJacob Erlbeck1-4/+10
Currently most offsets are hard-coded which makes it difficult to access the data units and their headers when padding has to be taken into account. These offset are already provided by the gprs_rlc_data_info_init_ul/dl functions. Change the encoder/decoder to use these values. Note that some assumptions (bit alignment) are still present in the code and checked by assertions. Sponsored-by: On-Waves ehf
2016-02-08rlc: Support encoding of EGPRS header type 1 + 2Jacob Erlbeck1-4/+63
Currently only header type 3 (MCS-1 to MCS-4) is supported. Add header structs to rlc.h and extend Encoding::rlc_write_dl_data_header accordingly. Sponsored-by: On-Waves ehf
2016-02-08edge: Support EGPRS in IMM ASSIGNMENTJacob Erlbeck1-0/+25
Tell the MS to use EGPRS if EGPRS is enabled on the TBF. Note that only downlink TBF will be supported so far. Thus single-phase uplink assignments may not work properly. Sponsored-by: On-Waves ehf
2016-02-08encoding: Redesign Encoding::write_immediate_assignment APIJacob Erlbeck1-19/+37
The EGPRS support will need more information to encode the IMMEDIATE ASSIGMENT. Instead of adding more parameters pass a pointer to the TBF unless an SBA shall be done (indicated by tbf == NULL). All values that can be derived from the TBF and are not needed for an SBA are removed from the parameter list. Return a negative value on error. Sponsored-by: On-Waves ehf
2016-02-08encoding: Refactor write_immediate_assignmentJacob Erlbeck1-79/+98
Move the IA rest encoding into separate functions fpr uplink and downlink. Sponsored-by: On-Waves ehf
2016-02-08encoding: Use explicit LH encoding in write_immediate_assignmentJacob Erlbeck1-2/+2
Currently bitvec_write_field is used which just sets the bits as given, while the spec 44.018 assumes LH encoding. Use the bitvec_write_field_lh function instead. Sponsored-by: On-Waves ehf
2016-02-08tbf: Use TLLI as ID if TFI not yet assignedJacob Erlbeck1-5/+11
Currently the old TFI is always used as ID when a PACKET DOWNLINK ASSIGNMENT is generated. This fails if the old TBF has not been fully assigned yet. The MS will then ignore the PDA. This commit changes write_packet_downlink_assignment to accept an additional parameter old_tfi_is_valid and uses the new TBF's TLLI instead of the olf TFI if that parameter is set to false. Sponsored-by: On-Waves ehf
2016-02-08tbf: Add check_polling/set_pollingJacob Erlbeck1-6/+7
Currently the checks for and the actual polling is done in several places by copy & paste of several lines of code. This hinders changes of they polling is handled internally and also is likely source of programming mistakes. Separate this into a check_polling function, that checks whether polling is possible and returns the FN and the RRBP to be used in that case. Otherwise the cause is logged (LOGL_DEBUG) and a negative error value is returned. There are no other side effect beside the logging. If the call is successful, the set_polling method can be used to actually register the polling. Extend the encoder functions' parameters lists by an rrbp parameter. Sponsored-by: On-Waves ehf
2016-02-08edge: Make window size configurableJacob Erlbeck1-2/+7
Currently the window size is fixed to 64 even for EGPRS. Support dynamic window sizes depending on the number of PDCH. The WS can be set to b + f * N_PDCH. If the result is not valid according to TS 44.060, Table 9.1.9.2.1, the value will be corrected to use the next lower valid value (or 64). The following VTY commands are added (config-pcu node): window-size <0-1024> set base (b) value and leave f unchanged window-size <0-1024> <0-256> set base (b) and factor (f) Sponsored-by: On-Waves ehf
2016-02-05edge: Support MCS data block encodingJacob Erlbeck1-0/+146
Currently only GPRS data block encoding is supported. This commit adds rlc_data_to_dl_append_egprs which does the EGPRS specific extension and chunk handling. It extends Encoding::rlc_data_to_dl_append to use that function for MCS coding schemes. Sponsored-by: On-Waves ehf
2016-02-05edge: Select implementation by mode in rlc_data_to_dl_appendJacob Erlbeck1-7/+23
Currently the GPRS data block encoding is applied to every coding scheme, even if an MCS is selected. This commit renames the actual encoding function to rlc_data_to_dl_append_gprs (not exported) and puts selection code into Encoding::rlc_data_to_dl_append. This requires an additional cs argument. Sponsored-by: On-Waves ehf
2016-02-05edge: Add Encoding::rlc_data_to_dl_appendJacob Erlbeck1-0/+121
This function appends a single chunk to an RLC downlink data block. The implementation is basically taken from the gprs_rlcmac_dl_tbf::create_new_bsn method without the TBF related functionality and any side effects. Note that it still only supports GRPS. Sponsored-by: On-Waves ehf
2016-02-05edge: Add encoder for downlink RLC data blocksJacob Erlbeck1-0/+120
Currently the (GPRS) RLC block encoding is done by setting the header fields directly in gprs_rlcmac_dl_tbf::create_new_bsn. This is much more complex with EGPRS, since the data fields are not byte aligned, the header formats depend on the header type, and the mapping of bits to bytes is LSB first. This commit adds Encoding::rlc_write_dl_data_header which writes the header according to the given gprs_rlc_data_header structure. Encoding::rlc_copy_from_aligned_buffer is also added to copy byte sequences into the message. Note that the actual encoding of data units is not yet present. Sponsored-by: On-Waves ehf
2016-02-01edge: Support EGPRS in write_packet_downlink_assignmentJacob Erlbeck1-4/+18
Add an use_egprs parameter to write_packet_downlink_assignment and add the EGPRS related fields if it is set to true. The window size is fixed at 64 blocks, link quality measurement reports have been disabled, and the other optional fields are not present. Sponsored-by: On-Waves ehf
2016-02-01edge: Replace integer cs by GprsCodingSchemeJacob Erlbeck1-3/+3
Currently the TBF and MS object use a plain integer value (current_cs) to manage the coding scheme. This makes it difficult to support the MCS schemes. GprsCodingScheme supports a partial ordering of these values (CS and MCS) and provides safe increment and decrement methods. Use the GprsCodingScheme type instead of integer for cs fields and variables. Add a 'mode' to GprsMs which can be set to either GPRS, EGPRS, or EGPRS_GMSK which also set the initial values of current_cs_ul/dl. Select the mode based on max_mcs_ul and max_mcs_dl. Sponsored-by: On-Waves ehf
2016-02-01encoding: Remove RlcMacDownlink_t based write_packet_uplink_ackJacob Erlbeck1-117/+0
This is the CSN1-encoder based variant, which has been replaced and is no longer being used. Sponsored-by: On-Waves ehf
2016-02-01encoding: Add bitvec based write_packet_uplink_ackJacob Erlbeck1-0/+176
The current write_packet_uplink_ack implementation is based on the CSN.1 encoder which makes it difficult to do the bitmap encoding for EGPRS. Add a new implementation based on bitvec functions to create the PACKET UPLINK ACK/NACK messages. Sponsored-by: On-Waves ehf