aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/rsl.c
AgeCommit message (Collapse)AuthorFilesLines
2016-07-25dyn TS: common TCH/F_TCH/H_PDCH implementationNeels Hofmeyr1-12/+213
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-25code dup: join [rsl_]lchan_lookup() from libbsc and osmo-btsNeels Hofmeyr1-52/+12
lchan_lookup in openbsc abis_rsl.c and rsl_lchan_lookup() rsl.c are the same code, except for the log context, which is only set in abis_rsl.c. The common code was factored out to gsm_data_shared.c in openbsc.git. Use the *rc return code argument to keep the logging part in the newly introduced thin wrapper lchan_lookup() in common/rsl.c. This also removes code dup for logging The rsl_lchan_lookup() implementation is removed from osmo-bts, so a recent openbsc is needed to build this. Change-Id: Ibc469b75e31560271be8633d524366442d27e6fb
2016-07-25dyn PDCH: code dup: use conf_lchans_as_pchan()Neels Hofmeyr1-2/+6
For ip.access dyn PDCH, call conf_lchans_as_pchan() instead of dup'ing the pchan-to-lchan switch. Change-Id: I979828e08953e83ae579a347334536f52939faf0
2016-07-25cosmetic: clarify TCH/F_PDCH related naming and commentsNeels Hofmeyr1-19/+31
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-25error log: rsl.c: typo x2Neels Hofmeyr1-2/+2
Change-Id: I285fdff8260f008d856b9cda811e9fbb936893eb
2016-07-25doc: move dyn_pdch.msc to osmo-gsm-manuals.gitNeels Hofmeyr1-1/+2
Also remove related cruft: .gitignore, msc-README and adjust an in-code comment that referenced dyn_pdch.msc. Change-Id: Ie41a453bb5070c1f18793f646dc053a978f43fba
2016-06-22dyn PDCH: safeguard: exit if nothing pending in dyn_pdch_ts_disconnected()Neels Hofmeyr1-1/+3
The function would currently only be called in cases where one of the if branches catches on, but for safety's and clarity's sake, don't ts_connect using as_pchan if no reconnect is pending. Change-Id: I52c34065254e902bb80662fc04540901b36cb4c3
2016-06-21Use error values instead of number for RSL errorMax1-2/+2
Change-Id: I0aa695c42a4399828fb8e9c08c905870175b7149
2016-06-17error log: two minor clarificationsNeels Hofmeyr1-1/+1
Change-Id: I95e4331f51f650d5077eb3a8f897f754d5d2b779
2016-06-17dyn PDCH: implement main dyn PDCH logic in common/Neels Hofmeyr1-0/+268
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-17dyn PDCH: rsl rx dchan: also log ip.access message namesNeels Hofmeyr1-2/+2
Before, only standard ABIS RSL message names were logged, add ip.access specific ones. The IPAC_PDCH_ACT and _DEACT msgs are received with an ABIS_RSL_MDISC_DED_CHAN discriminator, and not with _MDISC_IPACCESS like the others. Thus rsl_rx_dchan() should be able to log ip.access message types properly. Change-Id: I9db6826b515bf565fc7ae24fc0760b60928cc89f
2016-06-12Add DTXd support for sysmoBTS and LC15Max1-6/+7
* set/clear DTXd activity indicator for measurement reporting * set DTXd status based on information from RSL Related: OS#1563 Change-Id: I148a75725c4e5089b6f2da6e9adcbe94170d3257 Depends-On: I4a033b03fcd0deb4db7a38273b5407511dbf1d6c Reviewed-on: https://gerrit.osmocom.org/220 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-05-31Use libosmocore function for uplink measurementsMax1-4/+9
Related: OS#1563 Change-Id: Ide47e8e69e0d2d5859c5249b22f4bad22c18aa57 Reviewed-on: https://gerrit.osmocom.org/108 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-03-17Add explicit check for SI2quater index and countMax1-2/+21
Right now we do not support multiple SI2quater messages, so return error if either index or count is non-zero.
2016-01-04fix large amount of compiler warnings in common and sysmobts codeHarald Welte1-0/+1
2015-12-03common/rsl.c: The presence of a valied measurement result is DEBUGHarald Welte1-1/+1
we shouldn't consider the presence of a valid measurement result as something NOTICEable
2015-09-22Change to new structure of multirate at gsm_data_shared.hAndreas Eversberg1-6/+6
2015-09-22Add TCH messages to PH-/MPH-/TCH-SAP interfaceAndreas Eversberg1-2/+1
This part moves TCH handling from osmo-bts-sysmo to common part. The RTP handling is done at the common part, so they can be used by other BTS models.
2015-09-22Move chan act/rel/modify from bts_model to PH-/MPH-/TCH-SAP interfaceAndreas Eversberg1-12/+13
This part replaces channel activation/deactivation/modification routines by MPH_INFO messages.
2015-09-22Relace bts_model_get_time() by get_time() at common partAndreas Eversberg1-1/+2
2015-09-21audio/rsl: Include statistics for one callHolger Hans Peter Freyther1-3/+37
Use the new libosmo-abis API to query the session for the statistics and then send it as a TLV element to the BSC. This can be used to do post processing about the call. E.g to figure out if no audio arrived at all.
2015-09-21audio/rsl: Include the connection identifier in the DLCX indHolger Hans Peter Freyther1-0/+1
I have traces that include the connection identifier in the DLCX indication.
2015-07-14meas: Do not send incomplete measurement reportsHolger Hans Peter Freyther1-8/+11
The RSL_IE_MEAS_RES_NR is mandatory element with a minimum of 5 octets (two for TL and three for the value). When we establish a new channel we might not have had enough time in a TDMA frame to calculate the average. The issue is not easy to reproduce. At the point we receive the measurement report we have two uplink measurements queued. As it is not easy to reproduce and only occurs when a channel is new I have decided to drop the message instead of sending made up uplink measurement reports. As of now lchan_build_rsl_ul_meas will always return 3 and the condition will never be false. Avoids: SYS#1781
2015-02-05power: Make it possible to force a power levelHolger Hans Peter Freyther1-0/+23
Use the standard RSL commands to order a logical channel to use a fixed power level. The code is not fully verified and there was a last minute change to invoke bts_model_adjst_ms_pwr.
2015-02-05power/sysmobts: Add a manual ms power level controlHolger Hans Peter Freyther1-1/+9
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.
2014-12-30CBCH: Implement CBCH block segmentation and RSL_MT_SMS_BC_CMDHarald Welte1-2/+25
* CBCH load indications are not yet sent * The queue length is not yet limited!
2014-12-30Initial CBCH supportHarald Welte1-2/+4
This should handle OML channel combinations with CBCH and activate the CBCH SAPI towards the DSP correspondingly. What is still missing is sending any actual information over the CBCH in respons to the PH-RTS.ind coming up from L1.
2014-08-27Correctly fill system information messages from BSCAndreas Eversberg1-2/+7
SI 5*/6 require L2 header of 0x03,0x03. All SI might be less than 23 octets, so they need to be filled with 0x2b.
2014-07-25amr: Avoid toggling the CMR from none and a set oneHolger Hans Peter Freyther1-0/+2
For LCR and other systems without out-of-band information we need to indicate the CMR. Not every air message will include the mode and we sent a stream that had the CMR set and not-set. This lead to the AudioCodes MGW only playing every second frame. Remember the last used mode and initialize it to _NONE when we receive the multirate config. In case of a real error we will still use AMR_CMR_NONE. The initial patch is from Harald. I have added the initialization and moving of the defines to amr.h. Manually verified by enabling AMR5.9 and looking at two RTP packages in sequence. In both cases the CMR was 2. I have looked at "amr.nb.cmr != 2" in wireshark and only found the MGCP dummy packet.
2014-03-10handover: Set basic values for handover, remember the activation reasonAndreas Eversberg1-0/+10
Introduce the handover.h/handover.c and initialize handover parameters in OML and remember the activation through RSL.
2014-03-10handover: Implement generating HANDOVER DETECTION in rsl_tx_hando_detAndreas Eversberg1-0/+22
2014-02-22agch/rsl: Fix msgb handling for IMMEDIATE ASSIGNJacob Erlbeck1-1/+3
Currently, the msg->data pointer is just set to the IMMEDIATE ASSIGN message and the len is adjusted accordingly. Unfortunately, this leaves l2h (pointing to the RSL header) and l3h (pointing to the FULL_IMM_ASS_INFO IE) in an undefined state (outside of [data, tail]). The code in bts.c accesses the message via msg->data. This patch sets l3h and l2h correctly. msgb_l3() will point to the start of the IMM ASS message and should be used instead of msg->data. Sponsored-by: On-Waves ehf
2014-02-19rsl: Do not allow IPA CRCX on non traffic channelsHolger Hans Peter Freyther1-0/+5
Use 0x52 as error cause as the nanoBTS is doing the same under the situation. This has been spotted while testing handover using the VTY command for handover.
2014-02-19rsl/si: Fix resetting bits in bts->si_validJacob Erlbeck1-2/+2
Use 'var &= ~(1 << x)' to reset bits instead of 'var &= (1 << x)'. Sponsored-by: On-Waves ehf
2014-01-21common/rsl.c: Allow bts_model_rsl_chan_act() to return negative causeHarald Welte1-1/+6
If the channel couldn't be activated, the function can simply return a negated RSL_ERR_* constant which will then be propagated towards the BSC in an CHAN_ACT_NACK RSL message.
2013-11-27bts: Fix crash of receiving data during the release processHolger Hans Peter Freyther1-2/+13
Release/Free the lapdm resources _after_ the channel has been fully released. Do not forward data unless the lchan is in the active state. Reading this code again, there is probably a memory leak for everytime the PCU will re-connect to the BTS. (gdb) p lchan->state $4 = LCHAN_S_REL_REQ (gdb) bt #0 lapd_dl_flush_hist (dl=0x40454894) at lapd_core.c:164 #1 0x44873b54 in lapd_rx_u (lctx=0xbe9bd5a8, msg=0x92f90) at lapd_core.c:1040 #2 lapd_ph_data_ind (msg=0x92f90, lctx=0xbe9bd5a8) at lapd_core.c:1644 #3 0x44876d50 in l2_ph_data_ind (link_id=<optimized out>, chan_nr=<optimized out>, le=<optimized out>, msg=0x92f90) at lapdm.c:637 #4 lapdm_phsap_up (oph=<optimized out>, le=<optimized out>) at lapdm.c:707 #5 0x0000c504 in handle_ph_data_ind (l1p_msg=0x97358, data_ind=0x97420, fl1=<optimized out>) at l1_if.c:774 #6 l1if_handle_ind (fl1=<optimized out>, msg=0x97358) at l1_if.c:892
2013-11-14rsl: Rename abis_rsl_sendmsg to avoid symbol clash with libosmo-abisHolger Hans Peter Freyther1-19/+19
Nicolas ended up with linker issues due abis_rsl_sendmsg being defined twice. Rename our version of the function and update the code. Patched with: @i@ expression E; @@ - abis_rsl_sendmsg(E) + abis_bts_rsl_sendmsg(E)
2013-10-25rsl/pcu: Do not send a CHAN ACT to the BSC on PCU usageHolger Hans Peter Freyther1-0/+20
The PCU is forcing the activation of a PDCH. Currently the BSC will receive a channel act ack for a channel that was not activated at all. Use the "release_reason" flag of the lchan to see if we have requested a normal activation or a silent one. It feels a bit odd to do it in the TX function but it is the most easy solution right now. I have added logging so it will not be totally silent.
2013-10-06abis: Use OML remote (BSC) address if RSL CONNECT contains no IPHarald Welte1-5/+1
This introduces a new get_signlink_remote_ip() function whcih we also use in the RSL code to determine the RTP remote address if the CRCX/MDCX contains no remote IP address IE.
2013-10-06migrate away from our own abis.c code to libosmoabisHarald Welte1-4/+13
libosmoabis has a BTS-side implementation of the IPA protocol for years, and osmo-bts should have used that all the time. Unfortunately it had its own local hack, this patch is migrating to the libosmocore implementation.
2013-07-09rsl: Fix the audio handling after the 'alignment' handling fixHolger Hans Peter Freyther1-26/+21
The issue got introduced in fcdba6bfaca9e016f35fc9fa826948ec74f66121 when moving from the uint32_t pointer to a plain int. The code was now like this: if (connect_ip > 0) { if (connect_ip == 0) lookup_ip_based_on_rsl ... Coverity detected this as logically dead code and it was breaking audio handling for the osmo-bsc case. Remove the tristate handling, the RSL behavior is that leaving out port/ip is like specifying it as zero. Fixes: Coverity CID 1040769
2013-06-24lapd: Fix a +ptrsize memory leak for each opened lchanHolger Hans Peter Freyther1-1/+1
The lapdm/lapd_core code needs to keep a history of messages sent. This history is not freed when lapdm_channel_reset is called and the init code will just allocate a new array. This means there is a memory leak on every released channel every time it is released.
2013-06-20rsl: fix the unaligned memory access0.3.0sysmocom/0.3.0-stableNicolas J. Bouliane1-14/+18
the armv5 can do 32bit/16bit reads only from the aligned address use tlv.h macro to copy data to local variable Signed-off-by: Nicolas J. Bouliane <nicolas.bouliane@nutaq.com>
2013-04-30rsl: Add the channel name to the act nack and conn fail messageHolger Hans Peter Freyther1-2/+6
2013-03-13RSL: Fix Channel Number IE in Common Channel RSL messagesHarald Welte1-0/+1
As per Chapter 9.3 of TS 08.58, we have to use RSL_IE_CHAN_NR instead of the zero we were implicitly using so far.
2013-03-11Added radio link timeout procedure according to TS 05.08 Chapter 5.2Andreas Eversberg1-0/+20
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-09RSL: further rtp local bind related fixesHarald Welte1-11/+49
If the CRCX does not indicate the remote IP address, then we still were binding to 0.0.0.0 and used that address successively in the CRCX_ACK. As a workaround, we now use the source IP address of the RTP socket, assuming that the outbound routes to BSC and the MGW are identical. This is of course not always true, but I don't think there are any better alternatives...
2013-02-09rsl: Fix compiler warning in use of osmo_rtp_get_bound_ip_port()Harald Welte1-1/+4
for whatever reason i decided that a port number in osmo_rtp_get_bound_ip_port() needs to be a int * and not a uint16_t * at the time, so we have to deal with this here rather than breaking the ABI.
2013-02-09Fix determination of locally bound IP for RTP socketsHarald Welte1-8/+9
After we create a socket and bind it to INADDR_ANY, we cannot yet use getsockname() to resolve the locally bound IP. This only works after the socket has been connected to the remote IP. So we have to move the osmo_rtp_get_bound_ip_port() to a code section after osmo_rtp_socket_connect() has already happened. With the code prior to this commit, unless "rtp bind-ip" was used in the config file, we reported "0.0.0.0" as the "Source IP AddresS" in the IPA CRCX ACK to the BSC. This is of course wrong, as the BSC will then use this "0.0.0.0" as destination address for the incoming RTP stream :( Please note that for this fix to work, you also need a libosmoabis.git with commit d426d458ca96ba29793e35b1b2a73fbcb3b2c888 which actually causes osmo_rtp_socket_connect() to actually issue connect() on the socket at all.
2013-02-04Deprecate the "rtp bind-ip" configuration directiveHarald Welte1-1/+1
Instead of explicitly having to specify the local IP address for RTP sockets in the BTS, we just use "0.0.0.0" instead, which gets translated to INADDR_ANY. We still accept the configuration directive in old config files, but when we write, the line will no longer be re-written to the file. TODO: IMHO, the IPA RSL CRCX/MDCX actually permit the BSC to specify the IP address on the BTS side, and we probably simply ignore this at this point.