Commit Graph

691 Commits

Author SHA1 Message Date
Harald Welte 3af73977dd sysmobts_mgr_temp: Migrate to ctrl_cmd_send2()
ctrl_cmd_send() is now a deprecated API function.

Change-Id: I663669a1bcf7b58d6a6175cbb51c333f5cfaedd7
Depends: libosmocore.git Change-Id Ic81af56e7ea6921ba39168727ef64c308e9c6754
2024-03-02 19:05:07 +01:00
Harald Welte a7263b6474 Fix license headers.
We have licensed the code under GNU Afffero Public License,
and state that in the first paragraph as well as in the link
to the license.  However, a paragraph in the middle stated
"see the GNU General Public License", which is somewhat misleading.

Let's fix that.

Change-Id: I37e503b195fe43e1da42c080900504ca8e682e76
2024-02-17 10:21:30 +01:00
Andreas Eversberg 1013ca3b8b Handle empty (idle) PDCH blocks gracefully
An empty PDCH block contains no payload, sysmo-bts and similar BTS
models crash, because they expect the msg->l2h to be set. The function
l1sap_pdch_req() will not set msg->l2h for empty PDCH blocks, so these
models crash.

The current osmo-pcu does not send empty PDCH blocks to these BTS
models. But there shouldn't be a crash, if we receive empty PDCH blocks
over the PCU socket interface.

Change-Id: Icb52c896766425fcf453c65530c4c0b8d06b8821
2023-12-11 10:06:19 +01:00
Andreas Eversberg 8fafc1a74c ASCI: Add control of uplink access to osmo-bts-sysmo
An MPH-INFO message is used to turn detection of uplink access bursts on
or off. This is required for voice group/broadcast channels.

Related: OS#4851
Depends: libosmocore.git Ibd6a1d468a70126a8f67e944fcb916969cc3c36b
Change-Id: I61f232aa91191dae08404c1f08cad91964d74568
2023-10-27 10:35:21 +00:00
Pau Espin 586e897eea Drop use of deprectated vty callback is_config_node
While compiling:
vty.c:169:3: warning: 'is_config_node' is deprecated: Implicit parent
node tracking has replaced the use of this callback. This callback is
no longer called, ever, and can be left NULL. [-Wdeprecated-declarations]
        .is_config_node = bts_vty_is_config_node,
         ^

Change-Id: I54c5aa5911611b181f80e76556b150f25dd5b60c
2023-10-05 09:39:31 +00:00
Vadim Yanitskiy 0978d1df71 oml: implement handling of NM_ATT_IPACC_SUPP_FEATURES
Change-Id: I88c6c6af18be054bd152832e60c8afbbd16098a3
Depends: libosmocore.git Ia4208e10d61843dd6ae77398f6624c918dc81ea4
Depends: libosmocore.git I85316af9b57e8113077305798cb2d82a24e48e00
2023-09-21 06:47:27 +07:00
Keith Whyte 8ae829cabc Fix incorrect order of params passed to logging macro
Stops log lines like:
'DOML unknown 0x239616 (bts=0,trx=0,ts=1,ss=0) [....]'

Change-Id: Ie1ad41210280ae5dbe693de6bdc4378ff34621b7
2023-08-04 15:53:39 -06:00
Harald Welte 15330e2368 sysmo: Enable VGSCS + VBS feature flags
This tells the BSC that osmo-bts-sysmo supports VBS/VGCS

Change-Id: I1625d2a0f4905437fad0b5220a551f81eba9a00e
Related: OS#4851
2023-07-21 10:52:07 +00:00
Harald Welte 2ae45aba3f ASCI: VGCS/VBS RACH -> RSL TALKER/LISTENER DETECT
Random access is allowed on VGCS / VBS channels to access the uplink or
to detect listeners. Uplink Access from a listener is only reported once
after activating the channel. Uplink Access from a talker is reported
each time the uplink becomes occupied. RSL TALKER/LISTENER DETECT
messages are sent to the bsc.

The VGCS UPLINK GRANT message is sent by the BTS itself. Timer T3115 is
used to repeat the message up to NY2 times until one valid frame is
received from the MS (CM service request). The UPLINK BUSY / UPLINK FREE
message must be sent by the BSC.

The uplink is released by UPLINK RELEASE message from the MS or from the
BSC. Afterwards the UPLINK FREE message causes the MS to leave the
uplink without any acknowlege. An RSL REL-REQ must be used to terminate
the link locally. (Without layer 2 DISC procedure.)

Change-Id: I1bd07ab6802341b09a06e89df356665ffaf6d2bf
Related: OS#4851
2023-07-21 10:52:07 +00:00
Oliver Smith 805340cb9c osmo-bts-sysmo: mute PHY until OML is ready
Connecting to OML and PHY is done in parallel. The PHY connection will
always be done first, mute PHY until OML is also ready.

As Pau suggested, move dispatch of NM_EV_SW_ACT to a callback of
trx_rf_lock to have the events serialized and therefore deterministic.

Fixes: SYS#6496
Change-Id: Ia1769f952fa787202a442a33db5ed4a1f7cbe9c3
2023-06-27 15:08:17 +02:00
Oliver Smith 81ebfb34b4 osmo-bts-sysmo/l1_if: move mute_rf_compl_cb up
Prepare to use it in a new function above activate_rf_compl_cb.

Change-Id: I19dbfbd595d3b42c0634a4c38e39cdb314a54266
2023-06-26 17:23:17 +02:00
Oliver Smith 07c3d86356 osmo-bts-sysmo: activate_rf: no dispatch on fail
Do not dispatch NM_EV_SW_ACT to trx->mo.fi and trx->bb_transc.mo.fi when
RF-ACT.conf was not successful. Running this code path anyway looks like
a leftover from when bts_shutdown used to exit osmo-bts.

Change-Id: I342187604f4c72303e393ce6925b94d610bfa8fa
2023-06-26 15:06:02 +00:00
Oliver Smith 235d2bfbc4 osmo-bts-sysmo: trx_mute_on_init_cb: call bts_update_status
Run bts_update_status in trx_mute_on_init_cb like in the default
callback mute_rf_compl_cb.

Related: SYS#6496
Change-Id: Ib73a33a82fbb86ead3569a6bb22fb001c55354d4
2023-06-23 13:18:38 +02:00
Mychaela N. Falconia c18f9f256c all models, HR1 codec: select RTP output format via vty option
The new vty option "rtp hr-format (rfc5993|ts101318)" selects the
RTP output format to be used for HR1 codec, consistently across
all models.  The default is set to match legacy behavior: ts101318
on osmo-bts-{lc15,oc2g,sysmo} and rfc5993 on osmo-bts-trx.
On models where no legacy behavior is applicable, the default is
set to rfc5993 as a forward-looking measure - see OS#6036.

Closes: OS#5688
Change-Id: I168191874a062429a57904511a1e89e3f588732e
2023-05-27 10:24:09 +00:00
Mychaela N. Falconia 81cfbb10cb all models, FR/EFR UL: change SID check to _is_any_sid()
In all OsmoBTS models in FR and EFR speech modes, as the UL traffic
frame stream is passed from the PHY to l1sap and ultimately to RTP
output, all passed frames are checked for SID.  The Boolean result
of this SID check is used in two ways:

* RFC 3551 instructs that the Marker bit in the RTP header SHOULD be
  set in the first packet of a talkspurt after a period of silence
  suppression.  OsmoBTS implements this recommendation by setting
  the Marker bit in the first RTP-transmitted non-SID UL packet
  that was preceded by SID.

* In osmo-bts-trx only, this same SID check serves a second purpose:
  handling of BFI conditions depends on whether or not the last received
  good traffic frame was a SID.  If a BFI condition is received after
  a non-SID traffic frame, the ECU is invoked, and if this ECU fails
  or when libosmocodec does not provide an ECU for the codec in use,
  a special FR (EFR) BFI frame of 260 (244) zero bits is emitted.
  Both the ECU call and the peculiar form of BFI are skipped when the
  last received good traffic frame was a SID.

For both of the above purposes, in all BTS models, change the SID check
from osmo_{fr,efr}_check_sid() to osmo_{fr,efr}_is_any_sid().  The
effect of this change is that "what counts as a SID" for the just-listed
purposes changes from recognizing only perfectly uncorrupted SID frames
without any bit errors to recognizing all frames which the rules of
GSM 06.31 (FR) or 06.81 (EFR) classify as either valid or invalid SID.

Change-Id: I5c24b379deda8ae551f9924d10770da50e6acbbd
2023-05-10 00:26:31 +00:00
Pau Espin be18d2b275 bts-sysmo: Delay marking phy_link as connected until L1 reset + got info
Better wait until the DSP is reset and all the information is retrieved
before telling upper layers that the phy is ready. Keep it in CONNECTING
state meanwhile.

Change-Id: Ifdc791336fb8efd42f4428893f687093085af129
2023-04-11 17:19:48 +02:00
Pau Espin cb0c0dfa15 bts-sysmo: Fix pinst->version filled too early
The fields used to fill in pinst->version are set when info_compl_cb()
is called, which happens asynchronously and hence later than when in
bts_model_phy_link_open().
Hence, copying the values when in bts_model_phy_link_open()
(l1if_open()) makes no sense at all.
Fill in pinst->version in info_compl_cb(), just when the layer receives
the required information.

Related: OS#5978
Change-Id: Ica53a5d852214b24de7f75b08ad7e595ce5236ee
2023-04-11 17:05:33 +02:00
Pau Espin 66543fe422 Introduce NM FSM for GPRS NSVC object
Change-Id: I684482064136a461d01cace3cd37afc8b68458cc
Related: OS#5994
2023-04-11 08:11:43 +00:00
Harald Welte c3d839be9e cosmetic: Change LOGPLCFN argument order
As it has come up during code review of Change-ID
I214af0448652a9f321ccbab77977b67663ba28f9 introducing LOGPLCNF, my
approach to the strict preserval of argument order (lchan first from
LOGPLCHAN and fn *after* loglevel from LOGPFN) was considered
sub-optimal.

I used the following spatch rule to clean this up:

@@
expression lc, ss, logl, fn;
expression list trailer;
@@

-LOGPLCFN(lc, ss, logl, fn, trailer);
+LOGPLCFN(lc, fn, ss, logl, trailer);

Change-Id: Iba4a8416545673d03cb057e4855f8b1ecae3e1ec
2023-04-09 14:10:09 +00:00
Pau Espin d50d239914 Introduce NM FSM for GPRS Cell object
Change-Id: I5fd1d17da09a5f0eee3d69fcb4788c106a240e21
Related: OS#5994
2023-04-06 10:28:22 +00:00
Pau Espin 633bbf174a Introduce NM FSM for GPRS NSE object
Related: OS#5994
Change-Id: I01eadc63214a2eb5e1bce455c7e5b62bd41905ea
2023-04-06 10:28:22 +00:00
Pau Espin 92d1d1582b Simplify implementation of bts_model_opstart() in all bts types
Use mo->fi directly to avoid repeating code paths for each obj_class.

Change-Id: I54632201afe87eb3e02bc75cbade163917239ab6
2023-04-06 10:28:22 +00:00
Pau Espin f4505f6caf lc15,oc2g,sysmo: Update GPRS NM object state at the right time
Change-Id: I2f331954835496504f1fafa572bd46ee83b03a63
2023-04-06 10:28:22 +00:00
Pau Espin 91a1295a5a bts_model_apply_oml(): Improve definition of parameter
The param is usually called obj_class, but here it is called kind.
In any case, change the param to pass the related struct gsm_abis_mo
(which still contains mo->obj_class), similar to what's done in other
bts_model functions such as bts_model_opstart().

Change-Id: Ife2e98a791455d5f7e7052356d559af2f1d4d185
2023-04-06 10:28:22 +00:00
Pau Espin 8894fe6f4c oml: Get rid of unused tlv_parsed param in bts_model_apply_oml()
This way we simplify the common lower level interface. It can be added
in the future again if it is really required at any point to pass/use
specific TLV values in the device-specific code.

Change-Id: I64c6c6834e277b1d75a97d6f408e7e1b7ca85832
2023-04-06 10:28:22 +00:00
Pau Espin aebd2a21b5 nm: Drop NM_EV_SETATTR_{ACK/NACK}
Simply return error codes from lower layer implementations, and do
the OML handling in the common NM TS 12.21 FSMs.

As a result, we simplify the logic in the lower layers.

Change-Id: I281c07bb5ad88ee03542f092141cebe036d10aee
2023-04-06 10:28:22 +00:00
Pau Espin c4a17d35ec nm: Apply BTS/TRX/TS OML Attributes through NM FSMs
This way we have further control on how to handle the SetAttr meessages
received. For instance, NACK them if the NM object FSMs are not at the expected
correct state.

The originating msgs are now kept owned and freed by the OML layer
(oml.c), and the NM FSMs only uses them and create new OML msgb when
answering with ACK/NACK.

Related: OS#5992
Change-Id: Id68868e25bbf96227ab6459fcd3c9181852ed28e
2023-04-05 13:21:14 +02:00
Pau Espin 7a646f963b bts_model_apply_oml(): Drop unneded code
Calls to bts_model_apply_oml() are done only for BTS, RCARRIER and
RCHANNEL NM Objects in their respective Rx code paths (and they will
be moved to respective FSMs in follow up patches). This function is
never called with any of the GPRS NM objects.

These NM Objectes have the NM_MT_IPACC_SET_ATTR msg ACKED/NACKED in its
own path:
oml_ipa_set_attr()
	rc = oml_ipa_mo_set_attr()
	return oml_fom_ack_nack(msg, rc);

Change-Id: I1a0d38a122f50ffe749ebc4f1cc11235ca516586
2023-04-04 20:26:23 +02:00
Harald Welte 1266c068d7 Replace explicit gsm_lchan_name() calls with LOGPLCHAN
There was a surprising number of explicit gsm_lchan_name() calls
from within log message code.  Let's avoid that whenever possible and
use a LOGPLCHAN() or related macro.

Change-Id: If4f4f555f5ca61dfa624b298805f5375efc0b137
2023-03-31 11:56:35 +00:00
Mychaela N. Falconia 61e7fdbb3f sysmo: emit empty RTP ticks during FACCH stealing on TCH/F
When FACCH stealing occurs and sysmoBTS L1 delivers GsmL1_Sapi_FacchF
instead of GsmL1_Sapi_TchF, that 20 ms unit still needs to be
accounted for in the RTP timestamp cadence, and if we run with
rtp continuous-streaming enabled, then an actual BFI packet needs
to be emitted.  The original code failed to do either; the present
change implements correct behavior for TCH/F.

The present patch only covers the case of TCH/F; handling of TCH/H
is left as a FIXME for other/later developers.

Related: OS#5974
Change-Id: I39d15faade28fb7d670493a99a0e0bdb654e2a4a
2023-03-30 17:30:53 +00:00
Harald Welte 2551882c1c cosmetic: Remove "FIXME?" from Odd AMR CMI phase
This default phase of the Codec Mode Indication in downlink direction is
called "odd", which is defined by starting with CMC in every 26
multiframe.

At call set-up, after every successful handover and after a channel mode
modify, the default phase (odd) shall be used in downlink direction.
During a call, the phase of Codec Mode Indication may be changed in
downlink by using a RATSCCH message.

As we don't implement RATSCCH, odd is always correct.

Change-Id: Ia64767fbfdc3fb067d72dbf5eabb1d84e3868ce5
2023-03-29 12:02:10 +00:00
Harald Welte 80c605dd0b cosmetic: use __func__ instead of __FUNCTION__
Our linter would complain about this these days:

	__func__ should be used instead of gcc specific __FUNCTION__

Change-Id: I80bf6d0a89ce6454ae063759d6088a28b04670c0
2023-03-29 12:02:10 +00:00
Mychaela N. Falconia 32682c63f6 sysmo: fix handling of SID in EFR
Handling of SID in EFR mode was broken in osmo-bts-sysmo.
l1_to_rtppayload_efr(), the function for UL Rx, was using completely
bogus logic (passing bits in ETSI TS 101 318 EFR format to an AMR
decoding function), whereas l1if_tch_encode(), the function for
DL Tx, had missing SID logic for EFR while supporting SID detection
for all other codecs.  The fix is to use the new osmo_efr_check_sid()
function in libosmocodec.

Change-Id: Ia56c1bb7432968685110456961d24a907b0a201f
2023-03-29 11:59:28 +00:00
Harald Welte ac23ce2e03 bts-{sysmo,oc2g,lc15}: Dump logical channel params during MPH-ACTIVATE.req
So far we only printed it during later modification.  Let's print
it also during initial activation of a logical channel.

Change-Id: I6982a52905e4719e2e9c40630252ffef2ff9fbed
2023-03-28 15:13:34 +02:00
Harald Welte bb3ed23e71 bts-{sysmo,oc2g,lc15}: Fix RTP of AMR SID_FIRST_P1
When we receive a SID_FIRST_P1 frame from the PHY (during AMR/HR DTXu),
we must generate a SID frame on the RTP side.

The existing code
* ignored that the Amr_SidFirstP1 PHYIF message actually contains the
  RTP payload
* manually generated the same content using osmo_amr_rtp_enc()
* forgot to prefix that with the AMR CMR+TOC
* in the end, sent a completely broken (too short) AMR SID frame over RTP

Let's fix this by simply using the 7-byte RTP payload with CMR+TOC that
the PHY is providing to us.

Change-Id: I90479efcc002d497648a71e73847af54e6208358
Related: OS#5944
2023-03-28 15:12:10 +02:00
Harald Welte a563640f86 Introduce LOGPLCFN() for logging lchan-name + frame number
So far, we've had LOGPLCHAN() and LOGPFN().  This resulted in a number
of log lines containing frame numbers *not* containing the lchan
context, which makes it difficult to deterine which of potentially many
concurrently active lchans is logging.

Let's introduce LOGPLCFN() for a FN-extended version of LOGPLCHAN(),
and convert all callers that have the related context.

Change-Id: I214af0448652a9f321ccbab77977b67663ba28f9
2023-03-28 15:12:10 +02:00
Harald Welte d47d288630 DTX: bts-{sysmo,oc2g,lc15}: Print DEBUG messages about ONSET
We're printing DEBUG messages for all other DTX frames, but not for
ONSET.  This made me think that we never received any ONSET frames
when looking at log output.

Let's add ONSET for completeness.

Related: OS#5944
Change-Id: I9a1511d9929444cef96388492d907e8f3a082311
2023-03-27 20:00:00 +02:00
Vadim Yanitskiy e464ef6524 osmo-bts-{sysmo,lc15,oc2g}: fix segfault in ph_tch_req()
ph_tch_req() is a recursive function and conditionally calls itself at
the very bottom.  The recursive call happens iff all of the following
conditions are met:

* DTXd is enabled,
* AMR codec is in use,
* DTX DL AMR FSM state is recursive.

The problem is that ph_tch_req() may pull sizeof(*lsap) from the given
msgb twice: during the initial and the recursive calls.  The second
attempt to pull sizeof(*lsap) causes the process to abort, because
the remaining room is less than it's attempting to pull.

AFAICT, doing msgb_pull() is not really necessary, given that
l1sap_tch_rts_ind() thankfully does set msg->l2h before pushing
the lsap header in front of the actual frame.

Update osmo-bts-sysmo and its copy-pasted siblings, which are likely
affected too, except osmo-bts-octphy which does not do the recursion.

Change-Id: Ib349b74a9e4bd48c902286f872d3b0e9a068256c
Related: OS#5925
2023-03-24 18:24:01 +00:00
arehbein a743ae1c1e osmo-bts: Transition to use of 'telnet_init_default'
Related: OS#5809
Change-Id: I2da7d7bf2b07b6736ab09a11ec37afc12f5ec075
2023-01-02 23:08:32 +00:00
Pau Espin a2dc808acc Depend on libosmo-netif
This library will be used soon when adding Osmux support to osmo-bts.
Furthermore, it nice to have it available to make use of other general
interfaces to create connections, primitives, RTP and AMR related
functionalities, etc.

Related: SYS#5987
Change-Id: I49db4de715065c083e1249cbeae6298d6868e229
2022-09-06 09:14:40 +02:00
Pau Espin d9f2cf2df6 Clean up osmo-bts-*/Makefile.am
Make them more easy to read and edit by splitting to one element per
line when several elements are present.

Change-Id: I24ecfa1167b806dcb3a5a0c00343299df842a78b
2022-08-11 21:02:00 +02:00
Pau Espin b8ae49d0ca bts-sysmo: Replace use of deprecated ipa_client_conn_create API
"""
osmo-bts/src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c:544:9: warning:
‘ipa_client_conn_create’ is deprecated: Use ipa_client_conn_create2()
instead [-Wdeprecated-declarations]
"""

Change-Id: Ief4d629f366e4f69ccd489198302568a919b2f0c
2022-06-21 09:38:42 +00:00
Oliver Smith 162ca199e0 src/common/bts.c: set BTS_FEAT_PAGING_COORDINATION
I did not realize with my previous patch that there's a common place
where features available for all backends should be enabled. So move it
there.

Related: SYS#5922, OS#5538
Change-Id: Id688ddae5cd714355fcc5324f33c9397fecae261
2022-04-25 11:27:54 +02:00
Oliver Smith 0f075a1e2d model_init: set BTS_FEAT_PAGINATION_COORDINATION
According to osmo-bsc I0e80ca5afc06737273b6699bde6e325e454b57f6, the
PAGING_COORDINATION feature should be well supported in osmo-bts. Adjust
the bts_model_init functions to report this to the BSC, so it properly
sets this in SI13 and so we can avoid this notice in the log:
  Get Attributes Response: reported feature 'PAGING_COORDINATION' is not supported, while we thought it is.

Related: SYS#5922, OS#5538
Change-Id: Ib06829501f4221a7f7b0344ec7991ceba74e7641
2022-04-21 17:36:53 +02:00
Oliver Smith 7d2193b467 model_init: order features alphabetically
Make it easier to compare the lists of features.

Related: SYS#5922, OS#5538
Change-Id: I67887d89912d963fbbe90590c8467cbbd2566e09
2022-04-21 17:36:46 +02:00
Vadim Yanitskiy fe21e88630 struct amr_multirate_conf: remove ms_mode[], raname bts_mode[]
Looks like this structure was copied from openbsc/osmo-bsc as-is.
The ms_mode[] makes no sense in the context of BTS, so remove it
and rename bts_mode[] to mode[] for the sake of brevity.

Change-Id: I7442360ed857554440a0b9854f2d2bbab9dc5a71
Related: SYS#5917, OS#4984
2022-04-17 13:14:59 +00:00
Pau Espin d3e730c61d Move lchan_init_lapdm inside lchan_set_state(LCHAN_S_ACTIVE)
osmo-bts-trx/l1_if.c lchan_init_lapdm() for CCCH is already done when
trx_set_ts_as_pchan() calls:
"lchan_set_state(&ts->lchan[CCCH_LCHAN], LCHAN_S_ACTIVE);"

Change-Id: I7a9c3660b9aab57ff8765e2f1526349599630cd9
2021-10-14 17:48:31 +02:00
Eric Wild 87f48a1d38 lc15, oc2g, sysmo: fix show dsp-trace-flags
This was colliding with the global "show trx" command introduced a few
years ago, and prevented both command from working.

Change-Id: I57f9515292f7bd906599e2cc277542bfaf3b657b
Related: OS#5080
2021-09-30 19:30:00 +00:00
Pau Espin 68a39a8617 nm_*fsm: Make FSMs aware of object being properly configured or not
This will allow in the future advertising children objects that the
parent object has been configured. It is useful for instance to let TRX
know that the BTS is configured.

Change-Id: Ie319465fd0e991bab8451ea34ec72ff3702533d2
2021-09-22 12:56:58 +02:00
Pau Espin ea53ad454e Allow setting administrative state through oml_mo_state_chg()
This way it can be changed together with operative/availability state,
and changes announced to the BSC if present.

This commit presents no real change in osmo-bts behavior, since the only
place where adm_state is passed different than -1 is in
st_op_disabled_notinstalled_on_enter(), which is actually never called
(yet) since it's the initial state and no other states transition later
to it.

However, this will change in the future once we support re-connecting to
a (possibly different) BSC, which means objects will need to be moved to
that state to restart the whole OML install procedure on the new BSC.

Change-Id: Ifdc6a1dfb673c0ab915ddf2a9d372928f4f86b4c
2021-09-20 12:22:53 +02:00