aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/l1sap.c
AgeCommit message (Collapse)AuthorFilesLines
2017-06-26Add missing include for abis.h header fileMax1-0/+1
This fixes compilation warning: implicit declaration of function ‘abis_bts_rsl_sendmsg’ Change-Id: I956561b2f953c7d380a26442fad84bc8262ea129
2017-06-24l1sap: if lchan is in loopback, don't accept incoming RTPHarald Welte1-0/+5
When the lchan is in loopback mode, we loop back all uplink blocks into downlink blocks. We do not processs any RTP frames for that lchan anymore. Rather, we discard those RTP frames to avoid mixing looped-back samples with those received from remote. Change-Id: I29ef4963e9c491c94c413cbc10436a2388c04d9b
2017-06-24l1sap.c: Factor out function to limit message queueHarald Welte1-21/+18
Change-Id: I0fe0fc6b17cefdbf6b2d9f30ed08306998d30687
2017-06-18OML Add osmocom-specific way to deactivate radio link timeoutHarald Welte1-0/+4
In some situations (e.g. when trying to do measurements/testing on the BTS receiver / uplink) it is useful to have a way to disable the radio link timeout and keep any channel open until deactivated, irrespective of whether (valid) data is received or not. This adds a related feature that can be activated by using an osmocom-specific value of 0xff for the TS 12.21 Connection Failure Criterion (9.4.14). Change-Id: I736f21f6528db5c16fa80cdb905af20673797be5
2017-05-29l1sap.c: Add spec reference to link timeout implementationHarald Welte1-1/+3
Change-Id: Ia95635a4350624b30f2b352e30ee39f856945670
2017-05-17measurement: Compute measurement results on measurement idicationPhilipp Maier1-5/+4
Computing the measurement results on in l1sap_info_time_ind() all at once may peak the host CPU. On smaller systems (arm based sysmobts) this might cause a noticable delay of other important tasks (e.g. passing l2 messages back and forth) It makes more sense to compute the measurement results continously when l1sap_info_meas_ind() is executed. Change-Id: Iecb9a30c0d716bfc88221cd752b1ffdc74269e30
2017-04-27Fix RTP duration adjustment not done when speech resumes in DTX mode.Jean-Francois Dionne1-6/+2
RTP jitter increases continuously because duration is not updated when speech resumes in DTX mode. Change-Id: Ib51ed95a449369222c957b3acebd9ce1f66c5435
2017-04-26Add MS TO to RSL measurementsMax1-0/+27
Add optional MS timing offset (3GPP TS 45.010 § 1.2) to RSL MEASUREMENT RESULT (3GPP TS 48.058 § 8.4.8). The value is calculated either directly from corresponding BTS measurement or from 3GPP TS 48.058 § 9.3.17 Access Delay (for known TA) and is invalidated after RSL report is sent until new measurement indication or RACH is received. Change-Id: I4dfe5c48834a083e757d5de3236a02e15a238b28 Related: OS#1574
2017-04-13l1sap: improve log outputPhilipp Maier1-1/+3
Print toa and ra value with the "RACH for packet access" log message. Change-Id: I3a2dde95947438aa8348a0a9fc8566cbc177aa2d
2017-02-01rsl: Fix dropping of LAPDm UA message.Minh-Quang Nguyen1-0/+11
In some cases, when successive mobile originated calls are made, the LAPDm UA message gets lost because the channel is relased to early. Too overcome the problem we do not send relase indications immediately. Instead a flag will be set and the message stored and sent on the next TCH-RTS-IND. This commit adds the functionality to store the release indication msg, to rsl.c. It also addes the mechanism to forward the release indication to l1sap.c See also coresponding change in openbsc.git: Change-Id I15fc1ef8e9e83f009bde96de9a8e95702cffbce6 This patch is is a slightly improved/reformatted version of: https://gitlab.com/nrw_noa/osmo-bts/commit/95d1f15ad108c1c1869c1965144acd64c1395d8c Change-Id: Ie4f70c75f0137b4bd72d579b3a32575bac2fca38
2017-01-25OML: internalize failure reportingMax1-4/+2
* make oml_tx_failure_event_rep() static and use osmo_signal_dispatch() wrapped into oml_fail_rep() to trigger event reports outside of oml.c instead of directly calling into OML layer * remove unnecessary formatting from text messages Related: OS#1615 Change-Id: I738555c547926e97b325ab53763c0076c42309bc
2017-01-16l1sap: fix missing 'else's causing wrong rach frame expiry countsPhilipp1-2/+2
This bug was introduced in the recently merged commit 1e399f888e4e1c93e0e5b7fd69fce09a2587fb87 aka change-id I87f40f5f160a4f6750c4f3d06997fc4f24049303 Fixes: coverity-scan CID#160156 and CID#160155 Change-Id: I88ed1b3e59213acdf97f88eda097b8172b952a5e
2017-01-12l1sap: Fix expired rach slot countingPhilipp1-16/+56
The counting of the expired rach slots in l1sap.c is not correctly implemented. This commit fixes the implementation. The expired rach slots are now conted correctly according to the configured channel combination. If a CCCH and SDCCH are combined, only the frames related to rach slots are counted. Change-Id: I87f40f5f160a4f6750c4f3d06997fc4f24049303
2017-01-08Alarm on various errorsMax1-0/+5
Send OML Failure Report for unsupported BTS attributes and other errors. Change-Id: Ic163bcfb6361a8ebd39e0bc0f238ef51e2cb214e Related: OS#1615
2017-01-04DTX AMR HR: fix inhibitionMax1-2/+1
* Unlike in AMR FR, in AMR HR incoming ONSET have to be treated differently depending on whether we've recently sent SID UPDATE or EMPTY frame. Split ST_SID_U FSM state into 2 states to accommodate for that and make sure that additional states specific to AMR HR are not used for AMR FR. * Avoid sending E_VOICE and E_SID_U in corresponding states as those do not initiate FSM state transitions anyway. This decrease extra load from FSM signalling which otherwise would be triggered on per-frame basis. * Introduce separate signal for SID First P1 -> P2 transition to avoid confusion with E_COMPL and E_SID_U initiated transitions from P1 state. * Don't init DTX FSM for SDCCH channels. Change-Id: I229ba39a38a223fada4881fc9aca35d3639371f8 Related: OS#1801
2016-12-15DTX: fix TS adjustment for ONSETMax1-5/+15
Previously timestamp was always adjusted according to FN difference. In case of ONSET event this causes unnecessary TS gap with subsequent speech packet. Fix this by checking Marker bit before performing adjustment. Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c Related: OS#1801
2016-12-09Save RTP metadata in Control BufferMax1-2/+11
Having RTP metadata is useful for debugging - save Sequence Number and Timestamp next to Marker bit from RTP header. Change-Id: I359b3bcb74fbfc071547fe2f9d837829374fe997
2016-12-01Fix AGCH/PCH proportional allocationMax1-7/+6
Do not assume that 1 == BS_AG_BLKS_RES but take that information from SI3. Note: due to current implementation quirks we activate channels before SI3 obtained, than we deactivate channels upon receiving SI3 and activate them again. This might not be necessary once we migrate to proper OML state machines. This affects lc15 and sysmo hw. Change-Id: I11377b12680ac3b2f77f80e742b6f0af63fc9c1e Related: OS#1575
2016-11-14l1sap: Fix use-after-free in loopback mode.Alexander Chemeris1-0/+3
By default l1sap_tch_ind() returns 0 which signals to its caller that message has been processed and can be freed. In case of loopback we're forwarding the message to dl_tch_queue who will free it later. Returning 1 from l1sap_tch_ind() prevents caller from freeing message. Change-Id: I1e065075baa51c88fa717f132e1f0a83df68be02
2016-11-11Remove duplicated codeMax1-13/+11
Having duplicated code to fill in fn & tn values makes it harder to read and modify static gsmtap_p* functions. Fix this by removing the duplication and moving the common code one level up. Change-Id: I0e67bf7423424cc11435bc0a5a1110297eeee383
2016-11-08DTX: wrap FSM signal dispatchingMax1-4/+2
Make wrapper function which checks that DTX is enabled for lchan before dispatching any events. Change-Id: Id8b519c4af6d505ec9a4b9aadd5107bf7af53d66
2016-11-08DTX DL: tighten check for enabled operationMax1-1/+1
Introduce dtx_dl_amr_enabled() function which checks that DTX is enabled and FSM is allocated and use it for all corresponding checks. Change-Id: Ifa68b641265ed14f242765c85e40da2d1021a541
2016-11-03DTX fix ONSET handlingMax1-4/+6
* re-introduce ST_ONSET_F to guard from repetitive ONSET messages in case multiple FACCH occur duriing DTX silence period. * produce ONSET event after both SID FIRST and UPDATE in case of AMR FR. * always dispatch E_SID_F (SID FIRST) signal if in talkspurt. * allow E_SID_* right after ONSET (zero-length talkspurt). * add missing E_ONSET signal description. * fix FSM transitions for AMR HR *Inhibited and First P*. * fix incorrect return from l1if_tch_encode() in ONSET FACCH with incoming SID UPDATE Change-Id: I0e9033c5f169da46aed9a0d1295faff489778dcf Related: OS#1801
2016-10-21Extend RTP RX callback parametersMax1-1/+2
Adopt to change in libosmo-abis to accept additional parameters in RTP RX callback function. Change-Id: Icf41e568f041e87b38e6192af0be90c42362bfee
2016-10-18Replace magic number with defineMax1-1/+1
SDCCH occupy lchan 0..3 in combined configuration so for CCCH we've always used lchan[4] - replace it with CCCH_LCHAN define and add comment. Change-Id: Ic5d742c292d638f119c6b4672120c1950adeb7f0
2016-10-13DTX DL: use FSM for AMRMax1-1/+23
Use dedicated FSM to handle all DTX DL related events: - add explicit checks if DTX DL is enabled (fixes regression for non-DTX setup introduced in 654175f33bd412671e3ef8cdd65c0689d10f278c) - fix handling of AMR CMI for SPEECH frames - add FSM for DTX DL - sync with corresponding changes in OpenBSC's - handle FACCH-related DTX ONSET events This affects both lc15 and sysmobts and requires corresponding change in OpenBSC (Change-Id: Idac8609faf9b5ced818fde899ccfc6ed0c42e8fd). Change-Id: I74a0b42cb34d525b8a70d264135e82994ca70d31
2016-10-12Move copy-pasted array into shared headerMax1-6/+0
Change-Id: I377ece2845830e3defab2d515f44b629ce5aed8e
2016-10-11DTX: fix conversion from fn to msMax1-2/+4
Previously FN was converted to millisecondss incorrectly due to wrong conversion between FN and a number of voice samples. The conversion should be based on following: * there are 12/13 useful frames for audio in TCH * there is 1 RTP packet per 4 frame * there are 160 samples per RTP packet Fixes: OS#1801 Change-Id: I9cc70cacabde98621aa892cee74f4ac461645093
2016-10-11DTX: fix 1st RTP packet dropYves Godin1-1/+1
Use "impossible" dummy value to initialize last_fn to prevent dropping of 1st RTP frame due to timestamp jump. Fixes: OS#1803 Change-Id: I485af21f6761048d12dc7f5552fcdd46daf786ed
2016-09-24DTX: check Marker bit to send ONSET to L1Max1-3/+10
If Marker bit is set than it's a talkspurt which we have to explicitly indicate to L1 by first sending ONSET message and than actual voice data in a separate message. This change affect sysmobts and LC15 hw. Change-Id: I88c41568bcb0d82699f617adc4ad192603dd1bb6 Related: OS#1750
2016-09-02common/rsl: move decision whether to chan act ack/nack to common functionNeels Hofmeyr1-4/+1
Prepare for a dyn TS patch that needs to call rsl_tx_chan_act_ack() directly without the rel_act_kind decision. Add function rsl_tx_chan_act_acknack() to wrap rsl_tx_chan_act_ack() and rsl_tx_chan_act_nack(). Move the decision whether to drop the ack/nack, based on lchan->rel_act_kind, to the new function, losing some code dup. Change all callers to use the new function; drop the two older ones from rsl.h and make them static. Note: for nack, the exception for dyn TS in PDCH mode was missing (rsl_tx_chan_act_nack() had only the rel_act_kind != LCHAN_REL_ACT_RSL condition, but should also have had the dyn TS exception as in rsl_tx_chan_act_ack()). I already know that this exception will again be removed in an upcoming commit, but for patch readability it logically makes sense to add it here. To easily include the nack case, drop the check for which pchan the dyn TS is operating as, because a rel_act_kind == LCHAN_REL_ACT_PCU implies that it is either already in or trying to become PDCH mode. Change-Id: I57ba60c670730c6d7877a6a9b96ece0a7679a0bb
2016-08-30cosmetic: common ts_is_pdch()Neels Hofmeyr1-11/+0
Have one common ts_is_pdch(), placed in lchan.c, since this file is pretty empty and pretty close to ts. Publish in gsm_data.h. Remove the if-style implementation from l1sap.c, and instead implement in a switch statement. This prepares for upcoming ts_is_pdch() usage in ph_data_req() for sysmo and lc15. Change-Id: Ib78d663fdbac5a1d7053f1b9d543649b66da00e2
2016-08-27log: l1sap: add 0x to hex output of chan_nr, 5 timesNeels Hofmeyr1-5/+5
Change-Id: I187a74fd255dbdfb9bfb1e32786031a66f013efb
2016-08-27Change interface in osmo-bts for 11 bit RACHbhargava1-3/+6
Interface structure between osmo-bts and osmo-pcu is updated with the parameters to differentiate the type of RACH and further support 11 bit RACH. The function prototype and definitions are changed accordingly. Interface version number is increased. Change-Id: I4f4c501b2d86d77c78de32a84b1804172ffb6f4d
2016-08-10dyn TS: complete for TRXNeels Hofmeyr1-1/+4
Apply similar fixes as for TCH/F_PDCH also for TCH/F_TCH/H_PDCH: Detect dyn TS in PDCH mode in ts_is_pdch(). In trx_set_ts(), enhance the "if (TCH_F_PDCH)" to a switch statement including both dynamic channel types. Adjust the comment to include both kinds. Change-Id: I6669739cd08780cd9ffb9451cdae9f6b9704c4fe
2016-08-08Fill measurements data for L1SAPMax1-2/+5
Fill in values for BER, BTO, Link quality in L1SAP and send them to PCU. Note: this increases the version of BTS <-> PCU protocol. It also requires corresponding changes in libosmocore. All BTS models provide measurements data unless direct DSP access for PCU is enabled. For BTS-specific notes see below. Octphy: conversion from sSNRDb to Link Quality uses formulae which works in practice instead of what's documented for sSNRDb value. Subject to change in future revisions. TRX: C / I link quality estimator is not computed. Change-Id: Ic9693a044756fb1c7bd2ff3cfa0db042c3c4e01c Related: OS#1616
2016-07-28dyn TS, dyn PDCH: common/l1sap.c: properly notice PDCHNeels Hofmeyr1-3/+11
In l1sap_ph_rts_ind(), l1sap_ph_data_ind() and to_gsmtap(), the decision to handle a TS as PDCH was still missing for dynamic TS. It is not yet clear why this did not impact functionality for dynamic timeslots on other BTS models. AFAICT they should not work without this patch, but in fact they do. It would be nice to clarify this some day. Change-Id: I7b873a089a3de70d980885a7539cb91997464743
2016-07-28fix comment in common/l1sap.c, function name changedNeels Hofmeyr1-1/+1
Change was in 334df9441a44de00c0dd3f66e73ac6fae28098fb "cosmetic: clarify TCH/F_PDCH related naming and comments" Change-Id: If3e353ea5796ee129bdd95e5f954e6c141cffec8
2016-07-27comment typo: common/l1sap.cNeels Hofmeyr1-1/+1
Change-Id: I053766452ee01bed6136a9742551c664666a7989
2016-07-25dyn TS: common TCH/F_TCH/H_PDCH implementationNeels Hofmeyr1-0/+5
common/l1sap: For dyn TS, the BSC will issue RSL Chan Activ requests with a non-standard chan_nr. While the rest of the code now understands that, the L1 phy will not. Translate to standard PDCH (== TCH/F). common/oml: use dyn TS' current pchan mode for lchans config. common/pcu_sock: detect desired PDCH mode of dyn TS. common/rsl: implement reconnection chain of a TS for changing its pchan: * rsl_rx_chan_activ(): ** Add dyn_pchan_from_chan_nr() to derive the requested pchan from the RSL chan_nr IE. ** Notice the need for a pchan change and invoke dyn_ts_l1_reconnect() (s.b.) ** Make Chan Mode IE presence optional, because the non-standard PDCH activation message is simpler and does not require it. ** Do PDCH activation via PCU. * Add dyn_ts_l1_reconnect(): store state and disconnect the L1 channel; then wait for cb_ts_disconnected(). * Add osmo_dyn_ts_disconnected() to cb_ts_disconnected(): verify state and connect with the new pchan type; then wait for cb_ts_connected(). * Add osmo_dyn_ts_connected() to cb_ts_connected(), which re-issues the cached chan activation message from before disconnecting the L1 channel. * Also send an rf chan rel/act ack for dyn TS upon PDCH de/act via PCU. * Add dyn_ts_pdch_release(): on channel release of a dyn TS in PDCH mode, release via the PCU. Call from rsl_rx_rd_chan_rel(). Change-Id: I463bb6b4e57674f091c3badba9257374961c52c7
2016-07-25cosmetic: clarify TCH/F_PDCH related naming and commentsNeels Hofmeyr1-3/+6
We're about to introduce a new kind of dynamic channel, which will also use parts of the ip.access mode dyn PDCH code paths. Make sure the general parts have general names and mark ip.access specific parts as such. Rename dyn_pdch_ts_[dis]connected() to cb_ts_[dis]connected(). Rename dyn_pdch_complete to ipacc_dyn_pdch_complete(). From cb_ts_[dis]connected(), factor out the current code into static functions ipacc_dyn_pdch_[dis]connected() -- this will make sense once the new dynamic kind is added to cb_ts_[dis]connected(). Change-Id: I7da5b7cb7b48572671f50e0dec97d9eec3083df1
2016-07-25info log: l1sap.c: add '0x' to hex outputNeels Hofmeyr1-2/+2
Change-Id: If29895de238e586b8298d84b6f0b41e08bea8c91
2016-06-23Make get_lchan_by_chan_nr globally availableMax1-2/+2
* Remove static qualifier * Remove duplicated code - use generic function instead Change-Id: I37a312648771f58d3087471083cfcebbd97ccf1d
2016-06-18Move copy-pasted code into common partMax1-0/+20
Related: OS#1750 Change-Id: Ic4342eaf7e32a0e9a5f2b16dd196a1f5f03152a9
2016-06-17dyn PDCH: implement main dyn PDCH logic in common/Neels Hofmeyr1-0/+12
React on IPAC PDCH ACT and DEACT messages and invoke the PCU and bts_model_ts_* APIs to effect switchover. The dyn PDCH interaction is described in the comment to rsl_rx_dyn_pdch(), the main entry point for PDCH switchover. In case the bts_model_ts_* are not implemented (or return other errors), reply with an IPAC PDCH ACT/DEACT NACK. Add callbacks that mark steps in the PDCH switchover process, dyn_pdch_ts_disconnected(), dyn_pdch_ts_connected() and dyn_pdch_complete(). Add hooks in l1sap.c on channel activation and release confirmation, to call dyn PDCH callbacks. BTS dyn PDCH implementations should invoke dyn_pdch_ts_disconnected() and dyn_pdch_ts_connected() when bts_model_ts_disconnect() or bts_model_ts_connect() are called, respectively. (upcoming for sysmoBTS) Change-Id: Id2f5f77121a65d6c14eac127b3d4fb50e97a77ab
2016-06-14DTXu: mark beginning of speech burst in RTPMax1-2/+4
Set Marker bit in RTP header to mark the beginning of talkspurt. Change-Id: I3dd70ad8ff94356e3c3cc5458255f6c23534783e Related: OS#1562
2016-06-07Fix RTP timestamps in case of DTXMax1-2/+16
Compute RTP user_ts adjustment based on the difference between current and previous FN instead of hard-coded value. Change-Id: If1677ddcf754b29990ff7cd846e11c32e3d30b33 Related: OS#1562 Reviewed-on: https://gerrit.osmocom.org/196 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-02-22Fix ocmo-bts-octphy interaction with OsmoPCUMax1-2/+3
Previously osmo-bts-octphy have not provided in-band presence information which cause off-by-one errors and misinterpretation of ph_data_ind by PCU. This fixed now by adding support for explicitly passing PH-DATA presence info. Corresponding check and in-band passing of presence information are removed. Note: this requires libosmocore version with osmo_ph_pres_info_type support integrated. [hfreyther/max: Remove + 1 from the decoded length]
2016-02-09fix migration of check_for_ciph_cmd() from sysmobts to l1sapHarald Welte1-0/+12
During the L1SAP related changes, somehow an old version of check_for_ciph_cmd() was re-introduced, which didn't store the N(s) as part of the lchan. To make things worse, the old code was still present in the sysmobts specific part, but never executed.
2016-02-03L1SAP: Ensure we don't process MPH-TIME.indication on TRX != C0Harald Welte1-1/+8