Commit Graph

3284 Commits

Author SHA1 Message Date
Oliver Smith 05b4629166 systemd: depend on networking-online.target
Related: SYS#6400
Change-Id: I9c0cc0779f9ddb7520a565668b7cde07c6ad55d8
2023-05-26 14:10:44 +02:00
Mychaela N. Falconia 9cc85c1a6a trx: remove model-specific BFI packet formats
As detailed in OS#6033, osmo-bts-trx was emitting its own invented
packet formats to signal BFIs (bad frame indications), different
from the vty-configured ("rtp continuous-streaming" or not) BFI
signaling method implemented in l1sap and used by all other BTS models.

In the case of EFR codec, the made-up BFI format previously used by
osmo-bts-trx caused EFR operation to be broken: a spec-compliant EFR
decoder on the receiving end of the RTP stream (a network transcoder
or the MS on the other GSM call leg) would receive and decode garbage
EFR frames of 244 zero bits instead of invoking the spec-defined bad
frame handler, causing bad audio artifacts for the user.  The same
situation would also happen for FR1 codec, but the application of
ECU masked this bug: with the ECU invoked in the UL output path,
the BFI emitting code for FR1 never executed.

In the case of AMR and HR1 codecs, the model-specific BFI packet
format of osmo-bts-trx is currently harmless, but:

* The extra code adds unnecessary complexity;

* BFI packet formats are inconsistent between osmo-bts-trx and
  other OsmoBTS models;

* BFI format is even inconsistent within osmo-bts-trx itself, as
  under certain conditions the common code in l1sap will override
  the UL payload from the BTS model and emit its own form of BFI
  instead.

Fix all of the above by removing trx model-specific BFI formats
for all codecs, and let l1sap handle all BFIs.

Related: OS#6033
Change-Id: I8f9fb5b8c5b2cad4b92ac693c0040779f811981a
2023-05-19 15:07:09 +00:00
Vadim Yanitskiy 2c511d5755 copyright: fix typo: sysmocom s/s.m.f.c./s.f.m.c./ GmbH
Change-Id: Ib0bed7a4196305e2b413ca657f4fa8fb6f0d39f6
2023-05-19 08:50:18 +00:00
Philipp Maier 0eb90a0a98 paging: cosmetic: rename all IMM.ASS references to MAC block
The paging interface towards the PCU has a confusing API. In fact what
the PCU does when it wants to page or do an immediate assignment is
sending a ready formatted MAC block to the BTS. The BTS then puts this
MAC block in the paging queue and then eventually it justs sends it
without looking at the contents. For the code in paging.c it is not
imortant if the MAC block is an immediate assignment, it only cares if
the paging record contains a MAC block or paging parameters.

Related: OS#5927
Change-Id: Ifab37fdedaba98b160718113767e4ef6ee7d16ad
2023-05-16 11:38:56 +02:00
arehbein 7f03444d8b PCU interface: Log version when starting listener
Change-Id: Ieba46cc7eee7758033815014ee38bf4751a0f26f
2023-05-10 12:33:53 +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
Mychaela N. Falconia e38618f7cc lc15,oc2g: fix handling of SID in EFR
Commit 32682c63f6 fixed EFR SID handling in osmo-bts-sysmo,
but that fix was never propagated into osmo-bts-{lc15,oc2g} versions,
which are essentially copies of osmo-bts-sysmo.  Fix that oversight.

Change-Id: I509c1ea374e640d819952d58592b12fa884ad9d8
2023-05-09 23:52:35 +00:00
Mychaela N. Falconia 5755946beb RTP input, FR & EFR: preen incoming payloads for SID errors
Those network elements which receive a stream of codec frames that
may come from the uplink of GSM call A and which are responsible
for preparing the frame stream for the downlink of GSM call B
(such as OsmoBTS receiving RTP and feeding DL to its PHY) must be
prepared for the possibility that their incoming frame stream may
contain corrupted SID frames, presumably from bit errors on radio
link A.  Per the rules of section 6.1.1 of GSM 06.31 for FR and
GSM 06.81 for EFR, SID frames with just one errored bit are still
to be accepted as valid, whereas frames with more corrupted bits
which are still recognizable as SID are classified as invalid SID.

In the case of a TrFO call, the entity switching from leg A UL to
leg B DL is responsible for *not* transmitting invalid SID frames
on the destination leg (they should be treated like BFIs), and any
deemed-valid SID frames that are forwarded should be preened,
correcting that one bit error they may exhibit.  Implement this
functionality in OsmoBTS.

Change-Id: I89df2f12c49dd5378667cf149d19bde654f80134
2023-05-08 19:09:16 +00:00
Pau Espin 8b306b6f93 bbtransc/rcarrier: Fix statechg done twice upon NM_EV_RX_OPSTART
When the NM_EV_RX_OPSTART event is received, it will call bts model
specific function bts_model_opstart(), which is responisble for
answering back with NM_EV_OPSTART_ACK or NM_EV_OPSTART_NACK.
Since that answer could be done sequentially in same callback code path,
we could end up twice at the end of the st_op_disabled_offline()
function checking for statechg (due to reentring that function).
As a result, one can see the following message appear during OML
bring up:
nm_bb_transc_fsm.c:185 NM_BBTRANSC_OP(bts0-trx0){ENABLED}: transition to state ENABLED not permitted!

Fix the issue by avoiding ending up at the end of the function in code
paths which should not be triggering any change.
The case of bbtransc is a bit different than that of rcarrier for
NM_EV_RX_SETATTR, since the former really doesn't receive any such
message from the BSC yet, so if we checked for that one before
continuing, it would never go on.

Change-Id: I5184a33dd8da9244e8aacf3ab8bb8930f732a136
2023-05-05 14:33:52 +00:00
Philipp Maier 267c2606ad pcu_sock: don not continue when running out of TRX space
The info indication on pcu_sock cann only support a limited but
sufficient number of TRXs, when we detect that we overflow the maxiumum
number of TRXs, then break and do not continue.

(this is more or less a cosmetic problem)

Change-Id: If4d7eecaded22f86750283f7aa13072064724537
2023-05-05 10:31:30 +00:00
Philipp Maier 04a373cf6a l1sap: fix wording in comment
The function rtppayload_is_valid() is called from the receiving RTP code
path. Lets use the word "forwarding" instead of "sending" to avoid the
impression something is sent (like sending RTP packets to the outside
world)

Change-Id: Ie7fcc53dea462b0d575b0c9ca73ba7507289eefe
2023-05-04 17:41:56 +02:00
Pau Espin 3f5a343098 octphy: Fix clearly wrong noop assignment
This code has been there since first octphy support was added.
New gcc 13.1.1 is catching this and reporting compilation errors:
"""
/osmo-bts/src/osmo-bts-octphy/l1_oml.c: In function ‘ts_connect_as’:
/osmo-bts/src/osmo-bts-octphy/l1_oml.c:1518:60: error: ‘oc’ is used uninitialized [-Werror=uninitialized]
 1518 |         tOCTVC1_GSM_MSG_TRX_ACTIVATE_PHYSICAL_CHANNEL_CMD *oc =
      |                                                            ^~
/osmo-bts/src/osmo-bts-octphy/l1_oml.c:1518:60: note: ‘oc’ was declared here
 1518 |         tOCTVC1_GSM_MSG_TRX_ACTIVATE_PHYSICAL_CHANNEL_CMD *oc =
      |                                                            ^~
/osmo-bts/src/osmo-bts-octphy/l1_oml.c: In function ‘bts_model_ts_disconnect’:
/osmo-bts/src/osmo-bts-octphy/l1_oml.c:1803:62: error: ‘oc’ is used uninitialized [-Werror=uninitialized]
 1803 |         tOCTVC1_GSM_MSG_TRX_DEACTIVATE_PHYSICAL_CHANNEL_CMD *oc =
      |                                                              ^~
/osmo-bts/src/osmo-bts-octphy/l1_oml.c:1803:62: note: ‘oc’ was declared here
 1803 |         tOCTVC1_GSM_MSG_TRX_DEACTIVATE_PHYSICAL_CHANNEL_CMD *oc =
      |                                                              ^~
"""
Change-Id: I0da7d3a94e9eba15b8d3d3d995bba532170d9df7
2023-05-04 14:48:57 +02:00
Philipp Maier 2a60cc3087 sched_lchan_tchx: use GSM_HR_BYTES_RTP_RFC5993 constant
osmo-bts-trx uses the RFC5993 RTP payload format, so when handling the
RTP payload use GSM_HR_BYTES_RTP_RFC5993, instead of GSM_HR_BYTES + 1

Depends: libosmocore.git I125ef9cdab98c073971841c175b1a7dcd927f9c2
Related: OS#5688
Change-Id: I54dd3adab88e2262913f7b1e89340a0246c88a8a
2023-05-04 05:30:51 +00:00
Vadim Yanitskiy acaf6c563b oml: reset BCCH carrier power reduction mode (if enabled)
We should not maintain BCCH carrier power reduction mode if we loose
connection to the BSC.  When entering NM_BTS_ST_OP_DISABLED_OFFLINE,
reset the related state fields if it was enabled.

Change-Id: I34468e3fccc490f48e30b159b63308a395b65fa9
Related: SYS#6435
2023-05-02 16:36:07 +07:00
Vadim Yanitskiy dfd6224484 oml: gsm_objclass2{mo,obj}(): set cause for unknown obj_class
This patch makes BTS_Tests_OML.TC_wrong_obj_class pass.

Change-Id: I30e109a7c86e651fb7055a80ef0656d8563475c8
Fixes: OS#5966
2023-05-01 23:59:06 +07:00
Vadim Yanitskiy 8b535ee77a oml: gsm_objclass2{mo,obj}(): cosmetic: return immediately
Change-Id: Ie2fb927ac7f71103a1e0e693718771dd36139223
Related: OS#5966
2023-05-01 23:59:06 +07:00
arehbein cf8736e916 gsm_objclass2obj(): Change signature/set NACK cause
- Add out-parameter to enable returning a NACK cause (ignored if NULL)
 - Return appropriate NACK cause if TRX number is unknown (fixes OS#5967
   together with change I37e6b23ed95260a8188910cf9754faffcba519c5)

Change-Id: If734ea2c8cae4c1f99b02520dffa4e3862a67745
Related: OS#5961, OS#5967
2023-04-29 02:51:12 +07:00
arehbein 204cd4d7e3 gsm_objclass2mo(): Change signature/set NACK cause
- Add out-parameter to enable returning a NACK cause (ignored if NULL)
 - Return appropriate NACK cause if TRX number is unknown (part of fix
   for OS#5967)

Change-Id: I37e6b23ed95260a8188910cf9754faffcba519c5
Related: OS#5961, OS#5967
2023-04-29 02:51:12 +07:00
Vadim Yanitskiy 1d7133e936 fixup: common: Remove unused function gsm_objclass2nmstate()
Change-Id: I31b948f2aeb18ac8069fc019285be7991cffe064
2023-04-29 02:49:34 +07:00
arehbein a4a9c28f15 common: Remove unused function gsm_objclass2nmstate()
Change-Id: Ia538e3f3d416408f69f9d8e6c8c746eddd9f005a
2023-04-28 12:21:15 +00:00
Oliver Smith f729ff970a debian: set compat level to 10
Related: OS#5958
Change-Id: Id0f168a7d3c2ae6869121397e65ca1d0cfea30d3
2023-04-25 16:48:21 +02:00
Max bbdb10ee48 license: fix typos
Change-Id: I450919973bbd31bce44c0b6606f457581e2f71df
2023-04-23 15:08:00 +03:00
Vadim Yanitskiy ac1eb71d78 flags: ensure completeness of bts_impl_flag_desc[]
Change-Id: I049df344c8c0b0d6cd122e2f2d705e0f7ee5990c
2023-04-21 17:07:33 +07:00
Vadim Yanitskiy 11ec99d419 flags: group BTS_INTERNAL_FLAG_* into an enum
Change-Id: I4c7d9f6dce61f7690b86c3973b13ddb63cdace04
2023-04-21 17:07:33 +07:00
Vadim Yanitskiy fad8986f06 flags: add missing entries to bts_impl_flag_desc[]
The following output can be seen when doing 'show bts' in the VTY:

  BTS model specific (internal) flags:
    001 Measurement and Payload data combined
    003 unknown 0x8

Fix this by adding the missing values to the value-string array.

Change-Id: I83e5065f9f80b4f81e9767f184c8dc027883025a
Fixes: 0277cddab "sysmo,oc2g,lc15: Make RadioChannel MO depend on RadioCarrier MO"
Fixes: ee5eb6169 "l1sap: check if BTS model supports interference reporting"
2023-04-21 17:07:25 +07:00
arehbein b96d975f7d common: Remove redundant checks
Remove checks that are performed in gsm_bts_trx_num() already.

Related: OS#5961
Related: OS#5967
Change-Id: I9f21f1a0a9dab897d4fd89ab6b7341ca4aec8b22
2023-04-20 23:17:45 +00:00
Pau Espin 30601ccaf4 vty.c: Use already available tpp pointer
Change-Id: I54b4b995c3296d8a38ee72604dedbde77c5d0722
2023-04-18 13:24:39 +02:00
Vadim Yanitskiy a1927f32f7 osmo-bts-virtual: properly activate [CBCH/]BCCH/CCCH
In change 8e04613e I overlooked that osmo-bts-virtual is re-using the
scheduler of osmo-bts-trx and forgot to update its OML logic.  As a
result, osmo-bts-virtual is broken and does not transmit anything on
the broadcast channels.

Change-Id: I2276f7e5e4042e56ddf1fd1642c917dba0005ac4
Fixes: 8e04613e "osmo-bts-trx: properly activate [CBCH/]BCCH/CCCH"
Related: OS#6001, OS#1572
2023-04-13 02:52:07 +07: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 8a21e7c27a oml: Fix potential null ptr access on trx object
If the TRX_NR had no matching TRX it would access a NULL pointer trx
after failing to resolve it.
This commit refactors the code path to only require the trx pointer at
the very end, and NACKs the message if TRX fails to be resolved.

Change-Id: If27639ae1727fc5232e1a964a1b29f50c8805d80
2023-04-11 15:47:47 +02:00
Pau Espin 4c56bed4d7 pcu_sock: Drop bts_sm pointer
It is not really needed since the object is global.

Change-Id: I17f7c42dc9f38485dbcc8595a3a3dbf5a80a7961
2023-04-11 11:46:27 +02:00
Pau Espin 31c759165a pcu_sock: Allocate pcu_sock_state using g_bts_sm talloc context
Change-Id: I29eae7bcc66dc5e646b8a4703871682202259bed
2023-04-11 11:36:19 +02:00
Pau Espin 38491d813b Move pcu_sock_state to gprs section of bts_sm
Change-Id: I7d739287fd11f81ce657bac362e55fa822fb0ef5
2023-04-11 11:35:34 +02:00
Pau Espin 1dc9e3f2f8 Update g_bts_sm->num_bts when bts is added/removed from bts list
Change-Id: Ifa162d01d908eba8cadd8f01dd4d698491176fe8
2023-04-11 11:29:06 +02:00
Pau Espin b07e19d185 Properly report all states through NM FSM upon OML link up
Change-Id: Ic3358629d17baab46f467a1ab82eea1837ad7390
2023-04-11 11:16:21 +02:00
Pau Espin c3e059ce04 nm: Document current state of SW_ACT in TRX related objects
Change-Id: Ie24503b25b9c8042edae696d5b002933c73d00fb
2023-04-11 11:16:21 +02:00
Pau Espin 36ef885a6c Drop NM_EV_BBTRANSC_INSTALLED in favour of generic NM_EV_SW_ACT
All the other objects already use that one; there's no need to have a
specific one for the NM Channel FSM.

Change-Id: Ic5fd37367b500c75a0a53b1d868ba2aed3edef1b
2023-04-11 11:16:21 +02:00
Pau Espin 7cd45a7cfe Move GPRS NSE under BTS SiteMgr
As per ipaccess expectancies and following TS 12.21.

Change-Id: If44d8f256cab7b2660900cedfb0ed9fe67eb3420
2023-04-11 11:15:07 +02:00
Pau Espin 6be13437b7 Merge gsm_network into gsm_bts_sm and place gsm_bts under it
This way the data model in TS 12.21 (Figure 1) is followed, where
there's a BTS Site Manager containing one or more BTS. In our case we
only support 1 BTS (cell) so far.

Change-Id: Ideb0d458ec631008223f861cf8b46d09524a1a21
Related: OS#5994
2023-04-11 11:11:45 +02:00
Pau Espin 3481dd40b3 nm: Dispatch NM_EV_SW_ACT in cascade to BTS SiteMgr children
Change-Id: I97445812bb1b6de450411aceaeece2427027ae67
Related: OS#5994
2023-04-11 08:11:43 +00: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 5b75e5dc8d bts: Simplify lifecycle of BTS inside bts_list
Add the BTS object to the BTS list as the first thing after it is created,
this way it's always attached and hence simply always detach it during
object free.

Change-Id: Ica4fe2a4be0c85b10702011e978be03bf970b0c8
2023-04-06 10:28:22 +00:00
Pau Espin 9c4b472179 Move NSVC structs to be part of NSE
The NSVCs exist inside an NSE. Rearrange data model to have proper
relations.

Change-Id: I1cfe9366594836c622673d461ab8b2edd1a2b58a
2023-04-06 10:28:22 +00:00
Pau Espin 10d5499d03 Rearrange declaration of struct gsm_bts_gprs_nsvc
Move it together with the other similar objects like gprs_nse and
gprs_cell.
Move the "mo" field to the start of the struct, similar to the other
types.

Change-Id: I5dc020a6bab8c94ab831b6ca506bc5cb681d07a3
2023-04-06 10:28:22 +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 989d99ca00 Fix octet 2 of NM GPRS Cell
Octet 2 should contain the address of the GPRS cell in the GPRS NSE
object. Since there's 1 GPRS Cell per BTS and we have only 1 BTS in
osmo-bts, then this address should be 0.
Otherwise, osmo-bts answers sometimes using (0x00, 0xff,0xff) instead of
requested (0x00, 0x00, 0xff), for instance when ACKing an Admin Unlock.
This is kinda still fine since value 0xff has the meaning of "all"
addresses, and that means the only one available.
Still, it's not the proper way to identify the object, so this patch
fixes it.

Change-Id: I2ea05778f5b5ac335c75f3958324664553da7f0d
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 4190537d7d NM: NACK received OML OPSTART if no attributes were set beforehand
Related: OS#5992
Change-Id: I771ecc2f60873a3549e8a07a2e57c7948dfc993e
2023-04-06 10:28:22 +00:00