aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcu_l1_if.cpp
AgeCommit message (Collapse)AuthorFilesLines
2023-12-05bts: rename struct member gen_idle_blocks to gen_idle_blocks_C0Philipp Maier1-2/+2
The struct member gen_idle_blocks controls whether the the PCU has to generate dummy blocks to fill idle periods or if this task is left to the BTS hardware. Since idle dummy blocks only have to be transmitted on the C0 carrier, we should rename the gen_idle_blocks struct member to gen_idle_blocks_C0. Related: OS#6198 Change-Id: If9511ed911f9c5d6d463881a387a9e7d11a15465
2023-11-24gprs_rlcmac_sched: fix condition for generating dummy blocks on idlePhilipp Maier1-4/+25
When a PDCH is idle, then the gaps are filled with dummy blocks. OsmoPCU supports generating the dummy blocks locally, so that a continous stream of PDCH blocks is sent to L1. However, some BTS models (the OsmoTRX based models in particular) are able to generate the idle blocks locally. In this case the PCU should leave the genration of the dummy blocks to the BTS in order to save processing time and load on the PCUIF interface. In gprs_rlcmac_sched we already have a flag to skip idle frames in case we do not use the so called "direct phy access". A similar mechanism also exists in pcu_l1_if.cpp in function pcu_rx_rts_req_ptcch(). Unfortunately this check is not implemented correctly. The flag gets set when the ENABLE_DIRECT_PHY define constant is set. However, this does not say anything about whether the BTS model supports the generation of idle blocks or not. The define constant is intended to be used to disable direct phy related code in on platforms where no direct phy code is used or cannot be used. We must instead check the BTS model (bts->bts_model) in order to decide whether this particular BTS type requires the generation of dummy blocks or not. Related: OS#6191 Change-Id: I7a08d8cc670fa14f7206ffffdbc22351f3668a17
2023-11-21pcu_l1_if: signal BTS model via PCUIFPhilipp Maier1-0/+14
At the moment the PCU has no way of knowing with which BTS model it is used with. However, some BTS models may require slightly different behaviour by the PCU, depending on which BTS model is used. So, lets add an additional bts_model field to struct gsm_pcu_if_info_ind in order to convey the exact BTS model to the PCU and store this information in struct gprs_rlcmac_bts Related: OS#6191 Change-Id: I48eb75f65ab54fdec41ef913e24c1f18cd4a4047
2023-10-23pcuif_proto: drop support for PCUIF v10Philipp Maier1-85/+1
We now use PCUIF v11 in the TTCN3 tests exclusively and also osmo-bts and osmo-bsc only support PCUIF v11. There is no longer a need to maintain a backward compatibility to PCUIF v10 in osmo-pcu. Related: OS#5927 Change-Id: I68a3f59d5c960ae3a4fbd74f9d4a894295cb9ed8
2023-09-29pcuif_proto: rename PCU_IF_FLAG_SYSMO to PCU_IF_FLAG_DIRECT_PHYPhilipp Maier1-3/+3
The PCUIF flag PCU_IF_FLAG_SYSMO was originally used by osmo-bts-sysmo to signal to the PCU that the direct PHY access for the sysmo-bts DSP should be enabled. With time, support for other BTS models was added and the flag became a synonym for "direct PHY access", so it makes sense to rename it to "PCU_IF_FLAG_DIRECT_PHY" Related: OS#6191 Change-Id: I29b7b78a3a91d062b9ea3cd72623d30618cd3f0b
2023-08-31pcu_l1_if: add support for PCU_IF_SAPI_AGCH_2 for PCUIF v.11Philipp Maier1-0/+24
When a downlink IMMEDIATE ASSIGNMENT message is sent through the PCH, an IMSI is always required in order to be able to calculate the paging group. However, when the downlink IMMEDIATE ASSIGNMENT has to be sent before the MS has completed the GMM ATTACH REQUEST, the IMSI is still unknown. In this case we may assume that the MS is still in non-DRX mode, which means it listens on all CCCH blocks (PCH and AGCH). This means we may send the IMMEDIATE ASSIGNMENT through the AGCH in this situation. This will also have the advantage that the scheduling through the AGCH will have less latency than the paging queue. Unfortunately the SAPI PCU_IF_SAPI_AGCH only supports sending whole MAC blocks, so it won't be possible to attach a TLLI that can be used for confirmation. To fix this, let's add a new SAPI_PCUI_IF_AGCH_2, that works similar as SAPI PCU_IF_SAPI_PCH_2 and use it to send the IMMEDIATE ASSIGNMENT through the AGCH. CAUTION: This patch breaks compatibility with current master osmo-bts and osmo-bsc (see "Depends") Related: OS#5927 Depends: osmo-bts.git I29858fa20ad8bd0aefe81a5c40ad77a2559a8c10 Change-Id: I9effdcec1da91a6e2e7a7c41f95d3300ad1bb292
2023-08-25pcuif_proto: add confirm flag to struct gsm_pcu_if_pchPhilipp Maier1-1/+3
At the moment we let OsmoBTS (or OsmoBSC) look into the MAC block we send and in case it is an IMMEDIATE ASSIGNMENT message, a confirmation would be sent back. Unfortunately, this method is not very practical, lets add a flag to struct gsm_pcu_if_pch to tell the receiving end that the MAC block (data) needs to be confirmed when it is sent. Related: OS#5927 Change-Id: Ia202862aafc1f0cb6601574ef61eb9155de11f04
2023-08-10pcuif_proto: get rid of _DT, _dt (Direct TLLI)Philipp Maier1-19/+19
Since we now no longer refer to TLLI when we mean "message ID" (msg_id), we should also remove the "_DT" / "_dt" suffix from structs and define constants and replace it with "_2" if required. Change-Id: If641b507dcb6b176109c99dce7cff2a7561364b0 Related: OS#5927
2023-08-10bts: get rid of fn parameter in bts_rcv_imm_ass_cnfPhilipp Maier1-8/+4
The function bts_rcv_imm_ass_cnf, which processes the confirmation message from osmo-bts or osmo-bsc has an fn (frame number) parameter. This parameter not used for anything other than logging. The source of this frame number parameter is the conformation message that comes from osmo-pcu or osmo-bsc. In the case of osmo-bsc the frame number is always 0, since osmo-bsc uses RSL and can not know the exact frame numbers. since we do not really need the frame number for the confirmation, lets remove the fn parameter entirely. Related: OS#5927 Change-Id: I35bc99eaec5d0287ae3916bc668f0babaddfd6ce
2023-08-10pcuif_proto: rename tlli to msg_idPhilipp Maier1-4/+4
To confirm downlink IMMEDIATE ASSIGNMENT messages, we use the TLLI as an identifier and the related struct member is also called "tlli". Unfortunately this is misleading since the message identifier does not necessarly have to be a TLLI. It is just an implementation detail that osmo-pcu uses the TLLI as a message identifier. To make that clear, lets rename the tlli member (and variable and parameter names where it is passed on) to "msg_id". (Since this change only renames variables and struct members it will not break compatibility with other programs that use the PCUIF) Related: OS#5927 Change-Id: I4a25039dfe329e68879bc68936e49c4b190625e6
2023-07-31pcu_l1_if.cpp: Fix gsmtap not sent in PCU_IF_SAPI_PCH_DTPau Espin Pedrol1-0/+4
Change-Id: I2cfa0486a3483140ce219b4645e0544e7923870a
2023-07-14pcu_l1_if: Document tx_pch empty IMSI scenarioPau Espin Pedrol1-0/+14
Related: OS#6097 Change-Id: I327ca0e0f53be2d9b2a0705fe4de600229bdc5f9
2023-06-20Store T3192 value received from SI13, do some sanity checksPau Espin Pedrol1-1/+6
Timer T3192 may be used in the future to know wheter a DL TBF assignment can be sent on PACCH after the last DL TBF has finished (final ACK). Change-Id: Ie5f6251ee773f56771f9a9507711a20e6282aac6
2023-06-16pcu_l1_if: use correct SAPI in PCUIF message PCU_IF_MSG_DATA_CNF_DTPhilipp Maier1-1/+1
When we receive PCU_IF_MSG_DATA_CNF_DT, we check on PCU_IF_SAPI_PCH. This is formally not correct, we should check on PCU_IF_SAPI_PCH_DT instead. (This patch will only affect osmo-bsc but not osmo-bts. The reason for this is that osmo-bts still uses the older PCUIF v.10) Depends: osmo-bsc.git Id5c799e625c56e57f7b51cd4fb57f5bea9c973d2 Change-Id: I0883b51fc232ec0267f1511c3a37c0bcd0967a08
2023-06-12Abort UL TBF PACCH Ass based on T3168Pau Espin Pedrol1-0/+2
It makes no sense to continue trying to assign the UL TBF over PACCH after T3168 * 4 retrans time out. This helps in releasing the TBF after we got rid of incorrect use of N3015 in UL TBFs. While at it, update tbf_ul_fsm to use T3168 instead of X2001, since it really needs to match T3168. Ideally it would not even have a timer itself and receive an event from tbf_ul_ass_fsm, but that's left as a TODO (it was already before) and simply the timer is updated. Change-Id: I87dff68dedd06b60501e7586d20faf02bb1f0c93
2023-06-02Move call to bts_set_current_frame_number() earlier in the code pathPau Espin Pedrol1-0/+3
The FN time counter is not really PDCH specific, but to the whole BTS, and all other calls t the bts_set_current_frame_number() are already laced in pcu_l1_if.cpp; move it there. Change-Id: If36f22a1067c904fa7fda87bed5062b6738f0dd1
2023-06-02Use fn_valid() helper in pcu_rx_time_ind()Pau Espin Pedrol1-3/+1
Change-Id: I5b1f1d4cd621d81fb99b87761a878af242227a10
2023-06-02Derive FN from RFN once and cache it in struct rach_ind_paramsPau Espin Pedrol1-0/+2
Change-Id: Iaefb9650dfc5083360a4a24b9c17fdbf3115e51f
2023-05-31Use always RFN when handling RACH indicationsPau Espin Pedrol1-6/+17
The previous code was really confusing, passing full FNs as RFNs under certain external conditions, and then assuming the RFN input of rfn_to_fn() function could actually be a FN. As a result, we had a lot of code behaving slightly different depending on whether the incomding FN from pcuif was filled in by a BSC or a BTS. Avoid this b ehavior differentiation and always assume the most restricted one, aka RFN. Change-Id: Ib3b5702168195b595711cd0ff32c211b9aba429d
2023-05-22gprs_rlcmac: also use PCU_IF_SAPI_PCH_DT for paging MAC blocksPhilipp Maier1-6/+5
In the current code we still send PAGING COMMAND MAC blocks via SAPI PCU_IF_SAPI_PCH, which technically belongs to the older PCUIF version (v.10), which we are going to deprecate soon. Let's change this so that PAGING COMMAND MAC blocks will also be sent through PCU_IF_SAPI_PCH_DT. Since PAGING COMMAND messages require no confirmation by the receiving end we may set the TLLI field to GSM_RESERVED_TMSI. Depends: osmo-bsc.git I82443f2b402aa2416469c8c50b1c050323ef3b8f Related: OS#5927 Change-Id: I99cfe373fa157cfb32b74c113ad9935347653a71
2023-05-10pcu_l1_if: replace magic numbers with IMSI_DIGITS_FOR_PAGINGPhilipp Maier1-2/+3
we have defined IMSI_DIGITS_FOR_PAGING but some parts of the code still use magic numbers (3), let's replace those as well. Change-Id: I9a1b6ba4578e2a8875d8d1a9e56c36dc2b33fe0d
2023-05-03pcu_l1_if_phy: fix API function namesPhilipp Maier1-1/+1
The functions l1if_open_pdch and l1if_close_pdch have a misleading naming since what they actually do is opening and closing the TRX since they return and accept a context (obj) that is valid for a whole TRX. This also explains why the other functions accept a timeslot as parameter in addition to the context. Let's rename those functions so that it is clear what they do. Related: OS#6022 Change-Id: I395a60b2fba39bac4facec78989bac20f0cef0d3
2023-04-26pcu_l1_if: cosmetic: reformat commentPhilipp Maier1-3/+1
Change-Id: Ib4ae65e1bc118572135fbec02e64dbec35f208b4
2023-04-20ms: Merge ms_storage into bts.cppPau Espin Pedrol1-6/+6
That class is mostly a C++ class holding a llist plus some callbacks. Having that in a separate class makes code more complex for no good reason. This patch moves the llist into bts and allocates stuff directly from within bts. This will allow further cleanup of MS lieficyle in future patches. Change-Id: I627f5db5073189c23ddf2b7f09c90abb24846f62
2023-04-20bts: Rename bts_ms_by_{tlli,imsi} -> bts_get_ms_by_{tlli,imsi}Pau Espin Pedrol1-1/+1
While at it, put them together and mark bts param as const. This is a preparation for next patch. Change-Id: Iad8aec4424f1f23cd4d02a14c4f9ec1b9fdb1f75
2023-03-31fix pcu_rx(): actually discard malformed container messageVadim Yanitskiy1-0/+2
Currently we do log an error, but then still call pcu_rx_container(), passing it a malformed message. The function does have an additional length check inside, but let's better discard it early. Change-Id: I8410ecf35442ab75741a5c9cd29d640ce5508e57 Related: OS#5963
2023-03-20pcu_l1_if: do not copy IMSI when it is NULLPhilipp Maier1-2/+3
The parameter imsi of pcu_l1if_tx_pch_dt() could be NULL. In those cases we should ensure that struct gsm_pcu_if_pch_dt is populated with a zero length string. Related: OS#5198 Change-Id: I9192d50dd78be0a72ffdb9bfb9ed66aef085bcf1
2023-03-20pcu_l1_if: get rid of strange paging group calculationPhilipp Maier1-34/+10
The PCU uses a 16 bit integer value as paging group which does in fact not really resamble the paging group. Instead it encodes the last three digits of the IMSI from which the paging group can be calculated. The value is then eventually converted back to Ascii-digits and then sent over the PCU-IF interface. Lets get rid of this weird conversion and use the IMSI directly. Change-Id: I40d7fc14c9591b3de091e425faaf325421c70a0e
2023-03-20support for Ericsson RBS E1 CCUPhilipp Maier1-0/+88
Ericsson RBS series BTSs do not have a built in PCU. Rather than having the PCU on board the PCU is co-located to the BSC in those cases. Just like the MGW the PCU would connect to the CCU (Channel Coding Unit) via E1 line. The PCU is connected via an unix domain socket (pcu_sock) to the BSC to receive RACH requests and to control Paging and TBF assignment. This patch adds all the required functionality to run an Ercisson RBS in GPRS/EGPRS mode. It supports 16k I.460 E1 subslots and full 64k E1 timeslots (recommended) Change-Id: I5c0a76667339ca984a12cbd2052f5d9e5b0f9c4d Related: OS#5198
2023-03-06bts: add IMMEDIATE ASSIGNMENT via PCH transmissionPhilipp Maier1-4/+30
In situations where the PCU is co-located to the BSC, the IMMEDIATE ASSIGNMENT for downlink TBFs must be sent via RSL and the BSC also must instruct the BTS to transmit the IMMEDIATE ASSIGNMENT via PCH instead of AGCH. Eventually the BSC must sent a confirmation message (follow-up patch) where the TLLI is used as an identifer. This new method will eventually replace the previous method that uses the MAC block as an identifier. To remain compatible with older versions of osmo-bsc, we will keep the old method until osmo-bts is migrated as well. This patch also requires new features to be added to the PCU socket interface the version number of the protocol is incremented from 0x0a to 0x0b. Version 0x0a will remain compatible and use the old method, while version 0x0b will use the new method introduced with this patch. Change-Id: I2a78651593323e8b9627c39918d949a33497b70f Related: OS#5198
2023-03-03pcu_l1_if_phy: support multiple BTS (in theory)Philipp Maier1-1/+4
The PCU already has a list that can hold multiple BTS objects but the API for the direct PHY access has no way to associate a PHY with a certain BTS object. Lets update the API so that we can associate a BTS object when opening a PDCH. Unfortunately OsmoPCU has never been tested with more than one BTS so it is very likely that there are still shortcomings that prevent OsmoPCU to work properly when more then one BTS is attached. To make users aware of this, also print a warning as soon as more than one BTS object exists. Related: OS#5198 Related: OS#5930 Change-Id: I33518cbbe83f7f8c071afa5e995d30930099ba92
2023-03-03pcu_l1_if: cosmetic: remove whitespace after *Philipp Maier1-2/+2
Change-Id: Idd1abdfb8df4df58271025c7a808a692d9d86af7
2023-02-27pcu_l1_if_phy: add new PHY API function to disconnect PDCHPhilipp Maier1-0/+4
There is a function l1if_connect_pdch, but no complementary function like we have it with l1if_open_pdch and l1if_close_pdch. The reason for this is that the PHY implementations that rely on a femtocell DSP do not need to disconnect the pdch explcitly. However, the planned support for the E1 based Ercisson RBS CCU will require an explicit disconnect. So lets add a function call for this. Change-Id: Ied88f3289bda87c48f5f9255c4591470633cc805 Related: OS#5198
2023-02-27pcu_l1_if: use only the term "direct PHY access"Philipp Maier1-3/+3
The log messages and code comments sometimes refer to the direct PHY access feature as "direct DSP access". Lets use only the term "direct PHY access" Change-Id: I121ad85cd8581c40f390dbaad0d6a028d68b095e
2023-02-13pcu_l1_if: move direct phy l1if functions to dedicated header filePhilipp Maier1-9/+1
The function headers for the direct phy related functions (l1if_...) are currently directly listed in pcu_l1_if.cpp and osmobts_sock.c. Those functions are basically the API interface definition between the platform independed PCU code and the platform dependant direct phy code. Lets put them into a dedicated header file. Change-Id: Id54b96a4cd498a9860f3f209498132455e2aa6f8 Related: OS#5198
2023-02-13pcu_l1_if.cpp: handle TLLI based IMMEDIATE ASSIGNMENT confirmationPhilipp Maier1-1/+25
The IMMEDIATE ASSIGNMENT for downlink TBFs must be confirmed by the receiving end (BSC/BTS) in order to set the timers in the PCU correctly. When the PCU is used in a BSC co-located scheme (Ericsson RBS). The TLLI is used as an identifier to confirm a specific IMMEDIATE ASSIGNMENT. Change-Id: Icf7ca34500984239ee877ee71fd9c126b5eb3480 Related: OS#5198
2023-02-06pcu_l1_if: ignore frame numbers that exceed the valid rangePhilipp Maier1-0/+7
osmo-bsc may send invalid frame numbers through the pcu-sock interface. Lets make sure that incoming frame numbers do not exceed the valid range. Change-Id: Ib0cf1738be07733c95fc6c459a8a7c4cb2eeef26 Related: OS#5198
2023-02-03pcu_l1_if: cosmetic: use sizeof instead of constantsPhilipp Maier1-2/+2
Change-Id: Ib99e0a5470758bc4235b140103f2abd448ac07d3
2022-10-27pcuif_proto: cosmetic: rename gsm_pcu_if_info_ts to gsm_pcu_if_info_trx_tsPhilipp Maier1-1/+1
The struct gsm_pcu_if_info_ts is named "gsm_pcu_if_info_trx_ts" in osmo-bts. Lets rename it since the definition in osmo-bts is newer. Change-Id: If8b50181d3b609612aa8433b635052aadddd3484
2022-10-27pcuif_proto: cosmetic: rename struct member "h" to "hopping"Philipp Maier1-1/+1
struct gsm_pcu_if_info_ts has a struct member "h", which controls frequency hopping. This struct member is named "hopping" in osmo-bts, so lets rename it here as well to be consistent. Change-Id: I3156b39cc91da07ee3f97e8c8be60fc989cf112b
2022-10-16Use GSM48_MT_RR_IMM_ASS instead of hardcoded 0x3f valuePau Espin Pedrol1-1/+1
Change-Id: Id966cbab403763d006bd5e59757c5bf57402bf9d
2022-09-30fix pcu_l1if_tx_ptcch(): do not send empty blocks to GSMTAPVadim Yanitskiy1-1/+1
This makes no sense and confuses Wireshark, so it shows malformed packets. We are not sending empty PDTCH blocks to GSMTAP either. Change-Id: Ic7b6aca4f3af43a6fd47d033c950c711164685a4 Related: SYS#6045
2022-04-05pdch is_enabled: Use API getter instead of accessing field directlyPau Espin Pedrol1-1/+1
Change-Id: I389f42ef2e95d28643ec51771e46d083d4e20057
2022-03-30Fix assert hit if connecting to SGSN failsPau Espin Pedrol1-1/+2
""" DLBSSGP ERROR gprs_bssgp_pcu.c:1278 Failed to connect! DL1IF ERROR pcu_l1_if.cpp:827 No NSVC available to connect to the SGSN! DRLCMAC INFO pdch.cpp:185 PDCH(bts=0,trx=0,ts=0) PDCH state: disabled => disabled Assert failed m_is_enabled == 1 pdch.cpp:186 """ Change-Id: I36dc64fa807091bf2b565417c1185c4cb399932b
2021-12-14treewide: remove FSF address2021q4Oliver Smith1-4/+0
Remove the paragraph about writing to the Free Software Foundation's mailing address. The FSF has changed addresses in the past, and may do so again. In 2021 this is not useful, let's rather have a bit less boilerplate at the start of source files. Change-Id: I4a49dbeeec89b22624c968152118aecf8886dac6
2021-10-20pcuif: Submit data_req with len=0 as idle framesPau Espin Pedrol1-2/+21
This way PCU always answers DATA.ind and the BTS can still clearly identify idle frames. It also simplifies testing and verification of correct behavior. Related: SYS#4919 Change-Id: Ife718eeed2af011479c03099ea109518f04567bc
2021-09-20PTCCH: skip Tx DL idle blocks when possiblePau Espin Pedrol1-0/+16
Same was already done for PDTCH in previous commits. Let's now apply same bits to PTCCH. Related: SYS#4919 Change-Id: If6617964e67fc35eeee1791b06e13bf63ac88f73
2021-09-13Support Neighbor Address Resolution over PCUIF IPA multiplexPau Espin Pedrol1-0/+94
While NACC was initially developed, it became clear there was need for a way to interact PCU<->BSC in order resolve ARFCN+BSIC into CGI-PS for later RIM usage. Hence, this resolution was first (until today) implemented using an out of bands RPC system using the CTRL interface, which required specific config to be written and matches in osmo-pcu and osmo-bsc VTY (ip+port of the CTRL interface to use). However, this has several shortcomings: * As explained above, specific configuration is required * Since recently, we do support BSC redundancy in osmo-bts. Hence the BTS may switch to a BSC other than first one. If that happened, that'd mean the CTRL interface would still point to the initially configured one, which may not be the same currently serving the PCU. During recent development of ANR related features, a similar need for PCU<->BSC was required, but this time it was decided to extend the IPA multiplex of the Abis OML connection to pass PCUIF messages, transparently forwarded to each side by the BTS. This has the advantage that connection PCU<->BTS is handled by BTS and both sides send messages transparently. Let's switch by default to using this new interface, while still maintaing the old way for a while (announcing them as deprecated) to avoid breaking existing deployments until they are upgraded to new versions of osmo-pcu and osmo-bsc. Related: SYS#4971 Change-Id: I6ad33c7ab10202840cf804dea9ba595978d0e920
2021-08-31Fix crash with dyn TS when using direct pcuPau Espin Pedrol1-0/+5
It seems there may be a race conditon where lower layers (direct PCU) send UL blocks to us while the PDCH was already disabled (due to a call entering on a dynamic TS). As the PDCH is disabled, the ULC is NULL and shouldn't be used before being enabled again. Related: OS#5222 Change-Id: I4b8931f0cc7cfc787a1cc35196295402524b15c3
2021-07-01pdch: Fix heap-use-after-free in pdch->ulcPau Espin Pedrol1-2/+1
In existing previous code, pdch->ulc would be freed in gprs_rlcmac_pdch::free_resources() when it became disabled as per PCUIF info_ind (for instance, when a DYN TS is switched PDCH->SDCCH8). However, pdch->ulc was so far only allocated during pdch_init, which is only called during bts_alloc() time. Hence, after first info_ind disabling it, if it became again enabled (again by info_ind re-enabling it after SDCCH8 was not longer in use), the pdch->ulc would be used again but it would point to freed memory. Let's rearrange how/when resources are freed to make it more logical. With this patch, pdch internal resources are freed upon ->disable(), and re-allocated upon ->enable(). Change-Id: Id51f5f6a54ac9f24b784c17bc360ac38f5726fc7