aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/oml.c
AgeCommit message (Collapse)AuthorFilesLines
2015-02-05power/sysmobts: Add a manual ms power level controlHolger Hans Peter Freyther1-10/+29
Currently the DSP is instructed to achieve a given uplink power target but there are circumstances (e.g. EMV testing) where we need more control over it. The "manual/software/osmo" power control can only be implemented per TRX and not per lchan. Add a very very basic control that checks the MS Power used by the phone, the actual receive level and then adjust the power. The code doesn't take the history into account, if the phone can not reach the requested power level the code will be stuck (e.g. no timeout based on multiframes). It has a mode for a fixed power control but no way to set it yet. The change of the mode requires a restart of the software. Conflicts: include/osmo-bts/bts_model.h src/common/vty.c src/osmo-bts-sysmo/l1_if.c src/osmo-bts-sysmo/l1_if.h src/osmo-bts-sysmo/oml.c tests/sysmobts/sysmobts_test.c
2014-04-29osmo-bts-sysmo/utils.c: Added a function for calculate the power transmitterÁlvaro Neira Ayuso1-2/+2
Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-04-07sysmobts: Add log message in case the channel activation failsHolger Hans Peter Freyther1-0/+3
2014-04-07rsl: Use unique values for the call to rsl_tx_chan_act_nackHolger Hans Peter Freyther1-1/+1
This way we can easily find the place in the code that is responsible for the NACK.
2014-03-26sysmobts: Apply the potentially new max_power_red on the TRXHolger Hans Peter Freyther1-0/+9
In case the max power reduction has been changed through OML, let us call the l1if_set_txpower routine to update the nominal power. This has been manually verified with both BTS #1 and #57. ./bsc_control.py -d localhost -p 4249 -s bts.0.trx.0.max-power-reduction 0 The above command and GNUradio have been used to determine if the power level has changed at all. Fixes: SYS#268
2014-03-26oml: Indicate the kind of object passed as the void*Holger Hans Peter Freyther1-1/+1
These routines do not pass the gsm_abis_mo and parsing the FOM header of the msg does not seem to be a good idea either. Pass in the OML object so that the model code can determine what the void pointer is.
2014-03-16sysmobts: Add a magic number to the hLayer2 to differentiate itHolger Hans Peter Freyther1-1/+8
The DSP/FPGA appears to report bogus PhDataInd with hlayer2 == 0. Currently this would match the TRX==0,TS==0 and SS=0 and then we report bad measurement reports. Add a magic number to the lower eight bit of the hLayer2 to differentiate valid numbers. Addresses: <0004> measurement.c:97 (bts=0,trx=0,ts=0,ss=0) measurement during state: NONE <0004> measurement.c:102 (bts=0,trx=0,ts=0,ss=0) no space for uplink measurement
2014-03-10sysmobts: Do a RF mute at initialization when the RC is lockedHolger Hans Peter Freyther1-4/+33
Currently a locked cell is actively broadcasting when it is being bootstrapped after the lock. This patch adds an initial update of the RF mute state when the TRX is initialized. Ticket: OW#1131 Sponsored-by: On-Waves ehf
2014-03-10handover,sysmobts: Handle handover in the sysmobts codeHolger Hans Peter Freyther1-2/+51
When the lchan was activated for handover configure it to wait for a RACH burst. On release make sure to always release the RACH SAPI (in case it has been allocated). On the first frame inform handover.c about it and forward the received access burst to the handover layer. Using an E71 it was possible to make a handover for SDCCH and TCH/F from a nanoBTS but also from itself to itself. The vty commands of OpenBSC and the silent-call have been used for that. I didn't verify audio handling so far.
2014-03-10handover: Add generic handling for handoverAndreas Eversberg1-0/+9
The BTS layer needs to inform the handover code when an access burst has been received. In turn the handover layer will ask the bts to modify the channel, it will schedule the physical information inform the BSC with the HANDOVER DETECTION and waits for the BTS layer to inform it about the first received frame to stop a timer.
2014-01-23bts_model_rsl_chan_act(): Handle tp==NULL case gracefullyHarald Welte1-1/+3
The PCU may call this function without a valid 'tp' (tlv parsed) pointer, we need to make sure we take this into consideration...
2014-01-21sysmoBTS OML: Don't permit TSC != BSICHarald Welte1-1/+32
The sysmoBTS L1 has the TSC as a global value, we cannot have individual per-timestamp or even per-lchan TSC, as the GSM specification would suggest (and other BTSs support). Rather than fail silently, write an error message to the log and return NM_NACK_PARAM_RANGE or RSL_ERR_SERV_OPT_UNIMPL back to the BSC.
2013-12-29sysmobts: Specify the constant as a float and not a doubleHolger Hans Peter Freyther1-1/+1
2013-12-12sysmobts: Change the ARRAY_SIZE to a constant numberHolger Hans Peter Freyther1-1/+1
The parameter "uint8_t mute_state[8]" is actually a "uint8_t *mute_state" so the ARRAY_SIZE is not what we think it is. Fixes: Coverity CID 1125885
2013-11-27sysmobts: Activate the BCCH silently have have state set to activeHolger Hans Peter Freyther1-5/+6
Use the lchan->rel_act_kind field for the BCCH activatiob by OML. The lchan's should be marked as active but no event should be sent to the BSC. This is mostly like the PCU. We can now remove the secnd argument from lchan_activate.
2013-11-05sysmobts: Only set RC state to LOCK if all channels are mutedJacob Erlbeck1-2/+8
Currently only mute_state[0] (refers to ts[0]) is inspected to determine, whether the Radio Carrier's state is set to LOCK. This patch changes this by looking at all channels and using LOCK if (and only if) all channels have been muted successfully. Sponsored-by: On-Waves ehf
2013-11-05sysmobts: Do a RF mute when Radio Carrier is lockedJacob Erlbeck1-4/+66
Currently a Change Administrative State Request is just applied unconditionally to the object's state object and then acknowledged. This patch implements the special handling of setting the Radio Carriers state to LOCK or UNLOCK. This is done by passing the appropriate mute command to the L1 layer. Always all radio channels are affected, it is not possible to lock single radio channels. On success, an ACK is sent back to the bsc with the new state (based on the state passed in the callback by the L1 layer). If something went wrong or the firmware doesn't support RF mute, a NACK (REQ_NOT_GRANTED) is sent instead. Note that a NACK for such a request hasn't been sent by the BTS to the BSC yet, so (albeit it's spec conformant to do so) the BSC must be prepared to handle this correctly. Ticket: OW#976 Sponsored-by: On-Waves ehf
2013-11-05sysmobts: Add L1 support for the new RF mute requestJacob Erlbeck1-0/+6
This adds a new function l1if_mute_rf(femtol1_hdl, ch_mute[8]) to set the mute state for each radio channel. On completion and iff l1if_mute_rf() returned 0 the callback oml_mo_rf_lock_chg(mo, ch_mute_state[8], success) is invoked when the response from the superfemto DSP is received. Ticket: OW#976 Sponsored-by: On-Waves ehf
2013-10-25lchan: Print the name of the channel already in release requestHolger Hans Peter Freyther1-1/+5
2013-10-09Do not attempt to initialize L1 with a band unsupported by hardwareHarald Welte1-1/+1
If the EEPROM tells us that a given unit doesn't support a given band, we shouldn't try to use it, even if the BSC tells us to use an ARFCN in such an unsupported band. The reason is simple: The given BTS unit might have band specific filter / duplexer / PA.
2013-07-04sysmobts: Fix a typo that broke the ciphering with A5/0 > 0Holger Hans Peter Freyther1-2/+2
Commit 564313066464197af58b02152c379e1c02336bcf by Daniel changed the ciphering to go through the command queue. In this commit the direction for the ciphering got turned around and was not spotted by review. It worked in testing due the usage of A5/0 and in that case the direction did not matter.
2013-06-24sysmobts: Introduce an auto-band config to ease DCS/DCS, PCS/PCS changesHolger Hans Peter Freyther1-17/+2
During development one switches from GSM900 to GSM1800 and GSM850 to GSM1900. This commit attempts to make this switch more easy. GSM1800 and GSM1900 have overlapping ARFCNs. This means that the mapping from bands to arfcn is not injective. Because of that I removed the code to deduce the band from the ARFCN. This was done in commit 8c3d807b3fc785ffb18aeb97355150c92221e8a0. The auto-band option allows to move between GSM900/GSM1800 and GSM850/GSM1900. Add a simple testcase with these auto-band configurations.
2013-06-24sysmobts: Make sure we receive every SACCH frame to count S properlyHolger Hans Peter Freyther1-7/+6
In case there is no transmitter the S counter might never be decreased. This means that no radio link timeout will not be sent and the lchan will remain open forever. There are several ways to resolve this. The first would be to use the MphTimeInd and after each multiframe check if there has been a SACCH message for the open lchan's. This could be similar to the trx_meas_check_compute. I decided to change fBFILevel to always receive SACCH frames and move the code down to the PDTCH/PACCH handling and update the comment.
2013-06-24sysmobts: Fix potential memory leaks in the prim callback handlingHolger Hans Peter Freyther1-3/+4
Make sure the l1msg is always freed in the callback. There were several error conditions were the msgb would not have been freed, in the case of the calib data and the system information the message was not freed even in normal condition. I will modify this code to __use a msgb. This allows to re-use the allocated msgb across read operations.
2013-06-20sysmobts: Fix a crash when the DSP2ARM queue runs fullHolger Hans Peter Freyther1-1/+1
When not reading quick enough from the queue we will get a bogus response which will lead to marking the lchan as broken and to clear the sapi queue. The sapi_queue_dispatch was checking if the queue was empty before calling the callback but not taking into account that it might have been flushed. Stop processing if the queue was empty before calling the callback or if it is empty after the callback. Backtrace: #0 0x4eb1f1cc in raise () from /lib/libc.so.6 #1 0x4eb22f48 in abort () from /lib/libc.so.6 #2 0x4ecc2cb8 in talloc_abort (reason=<optimized out>) at talloc.c:167 #3 0x4ecbc854 in talloc_abort_unknown_value () at talloc.c:180 #4 0x4ecc6bc8 in talloc_chunk_from_ptr (ptr=0x4ec2d494) at talloc.c:192 #5 _talloc_free (ptr=0x4ec2d494) at talloc.c:517 #6 talloc_free (ptr=0x4ec2d494) at talloc.c:990 #7 0x0000f294 in sapi_queue_exeute (lchan=0x402414a0) at oml.c:528 #8 0x0000f2d4 in sapi_queue_send (lchan=0x402414a0) at oml.c:542 #9 0x0000f3e0 in sapi_queue_dispatch (lchan=0x402414a0, status=-4) at oml.c:565 #10 0x000114d0 in lchan_deact_compl_cb (trx=0x4021e038, l1_msg=0x7e690) at oml.c:1269 #11 0x0000d70c in l1if_handle_l1prim (wq=1, fl1h=0x607c8, msg=0x7e690) at l1_if.c:938
2013-03-24sysmobts: Do not re-configure the channel on non-active channelsHolger Hans Peter Freyther1-0/+7
In case the channel is not active we can omit the external requests to modify it. For the channel modification the higher level is already acking it and for the ciphering it is probably too late to do anything.
2013-03-24oml: Use the queue for the release handling of a channelHolger Hans Peter Freyther1-67/+212
There are three new commands. There are two markers and a deactivate command. The markers are used to wait until all previous commands are executed and then to decide if the SAPI needs to be released at all. When asked to release the SACCH the marker will be queued, then on execution of the marker the SACCH in Up-/Downlink will be released. For the RF Channel Release we use another marker, when the marker is executed we check all the SAPIs we want to release. It is possible that the queue looks like this: (SACCH_REL_MARKER is done) REL_MARKER, SACCH DEACT, SACCH DEACT This could happen if a BSC sends SACCH Deactivate and RF Channel Release at the same time. We deal with issue by changing the SAPI state to the REL_REQ state and check_sapi_release will not ask for another release. So after the execution the queue will look like this: SACCH DEACT, FACCH DEACT, TCHF DEACT.. This code does not check that all allocated SAPIs are released. The lchan_deactivate_sapis could be changed to go through all sapis_dl and sapis_ul to fix that. The normal flow should now be: 1.) lchan_deactivate 2.) Check if the queue is empty then go to 4 3.) REL_MARKER is executed and lchan_deactivate_sapis is called 4.) For all SAPIs to be released, check if they are allocated and then schedule a CMD_DEACTIVATE. If there is an error remember something went wrong but continue. 5.) Once all commands are executed send the channel release ack. For the release markers we need to be careful as they might not schedule any work. E.g. if the BSC sends two SACCH DEACTIVATE the second marker will not generate any release requests and we should proceed with the next command. Make sapi_queue_command return 1 in case the command has been directly executed. So a queue like SACCH_REL_MARKER, LOGCH will result in LOGCH, SACCH DEACT Rx, SACCH DEACT Tx but a 0 will be returned and the sapi_queue_next will then call sapi_queue_exeute again. NITB has been modified to trigger these corner cases more easily. * Do not send IMM.ASSIGNMENT for some timeslots to go through the error path * Issue multile SACCH deactivates in the normal release mode * Send rsl_chan_mode_modify_req before the SACCH DEACT and also when the RLL is being released.
2013-03-24oml: Print out power setting in txpower completion callbackDaniel Willmann1-5/+18
2013-03-24oml: Use sapi command queue for setting the logical channel paramsDaniel Willmann1-3/+25
2013-03-24oml: Enqueue ciphering message through sapi cmd queue as wellDaniel Willmann1-10/+44
2013-03-24oml: Introduce a SAPI queue for activation and deactivation of SAPIsDaniel Willmann1-30/+162
Put all SAPI requests into a queue and handle them one after another. Begin with the channel activation. Once the queue is empty the channel activate will be sent. For the BCCH activation we do not want to send a channel activation message and this is why we set the lchan->state to NONE. One change is that we do not attempt to call the ciphering routines on the BCCH anymore. This change is necessary to fix issues with LCHANs staying open and being marked as broken by the BSC and will help in implementing handover support as this requires a re-configuration of the lchan on the fly.
2013-03-11Added radio link timeout procedure according to TS 05.08 Chapter 5.2Andreas Eversberg1-0/+3
Chapter 5.2 applies to MS procedure, but 5.3 (BSS procedure) defines no exact criterion, so I decided to use the procedure equivalent to MS. The criterion is based on a counter S, which is initialized to a preset RADIO_LINK_TIMEOUT, which can be configured via VTY. Whenever a received SACCH block is bad, S is counted down by one. If SACCH block is successfully decoded, S is counted up by two, but never above initial RADIO_LINK_TIMEOUT value. If S reaches 0, an RSL Connection Failure Indication with cause RF Radio Link Failure is sent to BSC, which then aborts channel. Use link timeout value from BSC via OML attribute. How to test: - Set "debug" for "meas" logging. - Start silent call to an attached mobile. - Remove battery from mobile or shield mobile. - Watch S count down.
2013-02-27sysmobts: Improve the shutdown of the DSP on exitHolger Hans Peter Freyther1-2/+1
Issue the RfDeactivate.REQ before sending the MphClose.REQ. Ideally we would issue MphClose.REQ after the RfDeactivate.CNF but this is not possible right now. The current approach makes the following warning of the DSP go away on shutdown. This was tested with my E71 and an active silent-call using a SDCCH. DSP Warning: [ERROR] : DeviceMng_ValidateL1Handle() => Invalid layer 1 handle
2013-02-27sysmobts: We can now pass the trx to the callback change the signaturesHolger Hans Peter Freyther1-11/+6
2013-02-27sysmobts: Remove the data parameter from the l1if_gsm_req_complHolger Hans Peter Freyther1-9/+9
Pass in the trx argument at the lower level as everyone is using the fl1h->priv now.
2013-02-27sysmobts: Use the fl1h->priv and get the ts back from the responseHolger Hans Peter Freyther1-4/+14
2013-02-27sysmobts: Use the fl1h->priv to get the trx instead of using the lchanHolger Hans Peter Freyther1-9/+9
I am working toward killing the last argument of the l1if_gsm_req_compl and just have the trx inside the callback signature.
2013-01-24oml: Create mph_send_activate_req for sending the activation requestDaniel Willmann1-59/+63
Move the channel activation out of the loop into a dedicated function. This is done in preparation of separating the decision to activate something and sending the request.
2013-01-23sysmobts: Send GSM requests using the l1if_gsm_req_compl methodHolger Hans Peter Freyther1-9/+10
Prepare to change the queue and callback handling. For the TX power VTY command it is still possible that it will conflict with other callbacks and the easiest way is to beging with sending these requests through another method that allows us a more strict test.
2013-01-23sysmobts: Help in calling the right callback for l1if_req_complHolger Hans Peter Freyther1-8/+39
The wait list code has a limitation that for two requests of the same kind it does not know where the confirmation belongs to. This limitation is triggered when two lchan's get activated/deactivated at the same time and is noticed once we start to count the SAPIs. Set the hLayer3 to the lchan identifier, use the trx as closure for the callback and resolve the lchan in the callback using these two bits of information.
2013-01-23sysmobts: Rename the hLayer2<->lchan to hLayer<->lchanHolger Hans Peter Freyther1-4/+4
We are using this conversion for both hLayer2 and hLayer3. Make the function name more generic to indicate that this function can be used with the hLayer3. The functions that call the methods were updated using spatch and @rule1@ expression E; expression F; @@ - l1if_hLayer2_to_lchan(E, F) + l1if_hLayer_to_lchan(E, F) @rule2@ expression E; expression F; @@ - l1if_lchan_to_hLayer2(E) + l1if_lchan_to_hLayer(E)
2013-01-23oml: Fix memory leak in the callbackHolger Hans Peter Freyther1-0/+1
2012-11-10VTY: make target uplink Rx level VTY-configurableHarald Welte1-1/+1
We used to have -75 dBm as the target value for the uplink receive level. Now this is configurable. The parameter is used as input into the power control loop that adjusts the MS transmit power in order to achieve the target rx value on the BTS Rx input.
2012-08-09sysmobts: Do not ignore the band configuration of the BTS.Holger Hans Peter Freyther1-4/+2
The band was derived from the ARFCN but this does not work for PCS1900/DCS1800 due overlapping ARFCNs. Use the already existing band configuration to select the band for the MphInitReq. The dsp firmware will complain if the band/arfcn do not match.
2012-07-21Enable direct access to PDTCH queue of DSP by PCUAndreas Eversberg1-0/+7
Use "-P -M" to enable PCU and direct access.
2012-07-08lchan: Activate PTCCH/PRACH/PDTCH/PACCH when activating PDCHAndreas Eversberg1-2/+15
2012-07-08Fixes for handling of GPRS NSE/NSVC/CELL MOAndreas Eversberg1-0/+3
2012-07-05sysmobts: avoid sending duplicate RSL CHAN ACT ACKHarald Welte1-3/+6
This is just an intermediary hack, until we get proper lchan manager threads...
2012-04-28sysmo-bts: Move the payload setting into a new methodHolger Hans Peter Freyther1-21/+14
Make this code a bit easier to read by moving the payload setting into a new method.
2012-04-20lchan: I forgot to handle TchH in my recent lchan fixes, add it to another placeHolger Hans Peter Freyther1-0/+1
Harald fixed the issue for the activation by adding TchH, but this needs to be added for de-activation as well.