Compare commits

...

790 Commits

Author SHA1 Message Date
Keith Whyte 65337b739a vty info: MS power levels in dBm are not negative
Change-Id: Ib928a1378bc00b8ccb0365e5536f010e1f8a3d43
2024-03-31 12:38:05 -06:00
Harald Welte 3c09964b11 README.md: Add Forum + Issue Tracker sections
Change-Id: I2a25ae51cd5c9fdd48575715f3fa11c8631af32d
2024-03-23 12:10:23 +01:00
Harald Welte 798b28728b Add funding link to github mirror
see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository

Change-Id: Ib500e79ae7cc93ff0fc24db47f76d27109eb01f9
2024-03-23 12:07:42 +01:00
Harald Welte aec0422c8f common: Add RTP related rate counters
Let's add some rate counters to add visibility to the BTS on what is
happening in terms of received and/or transmitted RTP packets.

This should help during debugging any RTP related issues.

Change-Id: Ide674bde10b0e4b501d6a48947b983090342dfec
2024-03-18 10:09:47 +01:00
Harald Welte 3c133dc386 osmo-bts-virtual: Port over to osmo_io
osmo_io permits us to use the io_uring backend, which should
significantly speed up the many small read/writes we're doing
on virt-um.

Change-Id: Icfe42da00fd446c38090055e2baa5d5e0ae5b70c
2024-03-16 21:08:22 +01:00
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
Vadim Yanitskiy 82a2a8d9b4 doc/examples: fix missing config files in release tarballs
All config file examples must be listed in EXTRA_DIST unconditionally.
Adding them conditionally results in incomplete release tarballs,
containing only 'osmo-bts-virtual.cfg' and failing to build.

Change-Id: I167027afde3cee40a3b52adfaec7bde91ba896da
Related: OS#6349
2024-01-28 23:16:42 +07:00
Vadim Yanitskiy e94553a547 osmo-bts-trx: add test VTY command to send arbitrary TRXC messages
Change-Id: Iabc9b702e5f1513187e24f45d9ffe06ea940c3ec
2024-01-23 04:01:27 +07:00
Neels Hofmeyr 088f4ffd57 early-IA: use the correct TRX
In early-Immediate-Assignment, the BSC sends the IMM ASS message
directly after it sent the Channel Activation message, and osmo-bts
should cache it until the Channel Activation is complete.

So far the code had a bug: it assumed that the lchan was on the same TRX
where the IMM ASS is transmitted -- but actually, 'trx' refers to the
BCCH channel's TRX, i.e. always c0.

Instead, look up the correct TRX by the ARFCN in the IMM ASS message.

Now, when frequency hopping is enabled, there will be no ARFCN in the
IMM ASS message, hence this fix does not work with frequency hopping.
Related osmo-bsc patch disallows this combination.

(To also support frequency hopping, osmo-bsc would need to modify the
RSL protocol: send the IMM ASS message as a custom IE directly as part
of the Channel Activation. Then it is always possible to correllate the
IMM ASS with a specific trx and lchan, no matter what information it
contains. However, early-IA is a "bad" feature in itself as it
"promotes" having high latency on Abis. It seems unnecessary to do extra
work to also support this odd use case for frequency hopping.)

Related: osmo-bsc I8d375e5155be7b53034d5c0be5566d2f33af5db0
Related: SYS#6655
Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
2024-01-10 07:56:23 +00:00
Vadim Yanitskiy 950ed8bc4d l1sap: fix logic error in gsmtap_csd_rlp_process()
Current code evaluates as follows:

   (trx->arfcn | is_uplink) ? GSMTAP_ARFCN_F_UPLINK : 0

while we want it to be evaluated as follows:

   trx->arfcn | (is_uplink ? GSMTAP_ARFCN_F_UPLINK : 0)

Change-Id: Ida3d684968a3e4a45531d4b6d7b6af170e3e39f4
Fixes: CID#338165
2024-01-06 16:40:13 +00:00
Matan Perelman 59c641d20e ctrl: Add max ber10k rach
Change-Id: I466ee7ab0f8b24f14a91875ae2c720da3e506bd1
2024-01-04 19:09:06 +02:00
Harald Welte 1f755bcfee gsmtap-rlp: Add support for skipping generating NULL frames
If there's nothing to transmit over a CSD NT channel, both ends generate
NULL frames.  Let's add an option to suppress GSMTAP output for those,
creating pcap files with less noise.

Change-Id: I85a2159cfaa01bfb4205c1462e3a9dbda68e4bad
Depends: libosmocore.git I2d9bd8eb4f0cd0f72c436996767b199429596917
2023-12-21 11:37:41 +00:00
Harald Welte 7786d9b673 Add GSMTAP encapsulation of RLP frames in CSD NT mode
In CSD (Circuit Switched Data) NT (Non-Transparent) mode, there
are RLP (Radio Link Protocol) frames inside the modified V.110.

wireshark alrady has a dissector for this, and we've introduced
a GSMTAP type for RLP some time ago.  So with this patch, we now
generate such GSMTAP RLP frames.

Change-Id: I6a258458822bcb3fe7290a9b9b3d104beecda219
2023-12-21 11:37:41 +00:00
Andreas Eversberg f60f45e7ab OML: Add Get Attributes for supported MOs for Channel Object Class
Get Attributes of Channel Object class that osmo-bts supports are added:

* ARFCN List
* Channel Combinations
* TSC
* HSN
* MAIO

Related: OS#6172
Change-Id: I56e067be9e5c17625c7da4e982b90927802f57b4
2023-12-19 14:19:06 +01:00
Andreas Eversberg 722767a49d OML: Add Get Attributes for supported MOs for Radio Carrier Object Class
Two Get Attributes of Radio Carrier Object class that osmo-bts supports
are added:

* RF Max Power Reduction
* ARFCN List

Note: Only one ARFCN is reported, because synthesizer hopping is not
      supported. The NM_ATT_ARFCN_LIST in the Set Radio Carrier
      Attributes message currently allowes one ARFCN only.

Related: OS#6172
Change-Id: I49ab516c38a986520f1d3f6e26ddd20ee16688ac
2023-12-19 14:19:05 +01:00
Andreas Eversberg 90f6ebcd3b OML: Add Get Attributes for supported MOs for BTS Object Class
Most Get Attributes of BTS Object class that osmo-bts supports are
added. Not supported attributes are:

* T200
* Starting Time
* HW Configuration

Related: OS#6172
Change-Id: I067c6bdea3c44d5a731bcfdcfe304c14629eb3db
2023-12-16 11:53:25 +01:00
Andreas Eversberg 17fe7d6841 Use polling based LAPDm with frame numbers
Osmo-bts uses the new polling based LAPDm implementation.

The OML message NM_ATT_T200 is ignored, because T200 timeouts are set to
the minimal response time. Longer timeouts would cause lower throughput
in case of lost frames. Shorter timeouts would cause LAPDm to fail.

Related: OS#4074
Depends: libosmocore.git I6ebe83f829d7751ea9de1d90eb478c7a628db64c
Change-Id: Ic6d7902b13cf491daaa8752db78f9875387aeffd
2023-12-11 10:06:21 +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 647b8d0978 LAPDm: Reject (release) establishment on DCCH, SAPI 0 without L3 payload
If the channel is activated for immediate assignment, the initial data
link establishment on main signaling link with SAPI 0 must have L3
infomation included in the SABM message. If this is not the case,
release the data link without notifying BSC.

Related: OS#5971
Change-Id: I6819b51a876b8743c2d4a04165b7900723a1631c
2023-12-11 10:06:16 +01:00
Andreas Eversberg bc6cc67115 Transmit invalid AMR speech blocks instead of dummy FACCH
Every BTS needs to have some graceful handling for the scenario
where it is time to send out a speech frame on TCH DL, but there is
no frame to be sent. One possible solution is to transmit dummy
FACCH, but this option is unattractive for TCH/AHS where FACCH
displaces two speech frames rather than one. A more elegant solution
is to emit a speech frame that is bad, causing the MS receiver to
declare a BFI condition to trigger substitution and muting procedure.
A bad frame is generated by gsm0503_tch_{afs,ahs}_encode() by setting
the payload length to 0.

Depends: libosmocore.git I82ce2adf995a4b42d1f378c5819f88d773b9104a
Related: OS#6049
Change-Id: I056f379715c91ad968f198e112d363a9009dc1c3
2023-12-06 16:33:00 +00:00
Andreas Eversberg bc4ca18a31 Use uniform log format for default config files
Related: OS#6272
Change-Id: I08b297ea78e7cd60f28f0df79f2096f70c0692c6
2023-12-01 11:50:12 +01:00
Philipp Maier 4a6a2fdf7e pcuif_proto: signal BTS model via PCUIF
At the moment the PCU has no way of knowing with which BTS model it is
used with. However, some BTS models may require slightly different
behaviour by the PCU, depending on which BTS model is used. So, lets add
an additional bts_model field to struct gsm_pcu_if_info_ind in order to
convey the exact BTS model to the PCU.

Related: OS#6191
Depends: osmo-pcu.git I48eb75f65ab54fdec41ef913e24c1f18cd4a4047
Change-Id: Ib51238a0e09d4484a539a7f822864189872698b6
2023-11-21 09:17:00 +00:00
Vadim Yanitskiy 28b8759465 osmo-bts-trx: eliminate ul_bursts_prev, use the primary buffer
When adding support for Circuit Switched Data calls, we had to enlarge
the burst buffer size to accommodate bits for a maximum of 24 bursts.

Let's take advantage of this by utilizing the currently unused part of
the Uplink burst buffer for storing bits of previously decoded blocks.
This eliminates the need to allocate additional memory for SACCH.

Change-Id: I15047cd1df4476054b36f05616e41f5297d9bfe5
Related: SYS#5114, OS#4794, OS#4795, OS#4796
2023-11-14 12:22:32 +00:00
Vadim Yanitskiy 25aae40e17 osmo-bts-trx: use BPLEN macro instead of magic numbers
Change-Id: I7d89b2e50c7eeb54b734c4959eeeb1c63a51a315
2023-11-14 12:22:21 +00:00
Vadim Yanitskiy dc3b78da01 osmo-bts-trx: add_sbits(): simplify, improve coding style
Change-Id: I518a8ea268a9a6d48b04c291a03e5efbed5f571d
2023-11-14 12:22:21 +00:00
Vadim Yanitskiy 7c76630024 osmo-bts-trx: tx_tch[fh]_fn(): fix sending idle CSD frames
In accordance with 3GPP TS 44.021, sections 8.1.6 and 10.2.3, the
transmission of idle frames to the DTE is mandated when no data is
received from the radio interface.  An idle frame has all data,
status, and E-bits to binary '1' (excluding the alignment pattern).
This requirement is currently implemented for the Uplink, see
function csd_v110_rtp_encode().

However, 3GPP TS 44.021 does not explicitly specify whether the same
rule is applicable to the Downlink, perhaps assuming a continuous
stream of bits on the CSD-over-TDM link.  Currently, we transmit
a sequence of binary '0' on the Downlink instead of idle frames.

* In non-transparent (RLP) mode, whether all bits in a block are
  set to binary '0' or '1' has no impact, as both scenarios lead
  to an incorrect FCS.
* In transparent sync mode, any filling be it binary '0' or '1'
  is perceived as incorrect or unexpected.
* In transparent async mode, it is more logical to transmit a
  sequence of binary '1,' which will be interpreted as
  a sequence of stop bits.

Let's align the Downlink with the Uplink for consistency and transmit
idle frames when no data is available for transmission.  The modified
60-bit V.110 frames exclude the alignment pattern, so sending a
sequence of binary '1' is enough to achieve the intended goal.

Change-Id: I0b25cfac41b6d8dcf3bfd9d46d51a9665f1b047a
Related: OS#1572
2023-11-10 02:19:37 +07:00
Vadim Yanitskiy bcb9875176 osmo-bts-trx: tx_tch[fh]_fn(): rework generation of dummy FACCH
Even though it might have a somewhat higher performance impact,
opting for the common code path for FACCH by allocating a msgb
on heap is more favorable for both readability and maintainability.

This choice is preferred over directly calling
gsm0503_tch_fr_encode() and then using a 'goto' statement.
A similar strategy will be adopted in an follow up patch for CSD.

Change-Id: I67cb5c6f4d15149996e17c78a59d66db396da8ff
Related: OS#1572
2023-11-10 02:07:37 +07:00
Vadim Yanitskiy 863d4d933e osmo-bts-trx: tx_tch[fh]_fn(): use BUFPOS macro everywhere
For the sake of consistency.

Change-Id: I16ce4c979c5b44fd67324eb2ed3da28a4b78221b
Related: OS#1572
2023-11-09 19:28:48 +07:00
Andreas Eversberg 791d121bd9 ASCI: Add library requirements for uplink access to TODO-RELEASE
Related: OS#4851
Depends: libosmocore.git Ibd6a1d468a70126a8f67e944fcb916969cc3c36b
Change-Id: Ic7807b69bbecd84b7a30d45b599b688acfd2ddc0
2023-10-27 10:35:21 +00:00
Andreas Eversberg 771e9f2838 ASCI: Control uplink access bursts detection of physical interface
An MPH-INFO message is used to turn detection of uplink access bursts on
or off. Whenever the uplink on a voice group channel is free, the uplink
access burst detection is turned on. When the uplink access is granted
to a talker or when the calling subscriber has been assigned to the
channel, the uplink access burst detection is turned off until the
uplink becomes free again.

Related: OS#4851
Depends: libosmocore.git Ibd6a1d468a70126a8f67e944fcb916969cc3c36b
Change-Id: I92d6773a3a463eb747143c85aa149e54c1fda122
2023-10-27 10:35:21 +00:00
Andreas Eversberg e5d8a469d2 ASCI: Enable voice group/broadcast call feature at osmo-bts-trx
Related: OS#4851
Change-Id: I3a2e3f94812cec0bbf7e3674172437fa359d014c
2023-10-27 10:35:21 +00: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
Andreas Eversberg d88cc624ed ASCI: Add control of uplink access to osmo-bts-trx
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: I9045437d52984b7abe00fbc815d7f83c62c0fb5a
2023-10-27 10:35:21 +00:00
Pau Espin bd777b0276 trx_if: Allow calling trx_if_flush/close from within TRXC callback (v2)
- If the llist is flushed during rx rsp callback, when the flow is
  returned to trx_ctrl_read_cb() it would access tcm which was in the
llist and end up in use-after-free.
- We need to store state on whether code path is inside the read_cb in
  order to:
-- Delay transmission of new message if callback calls trx_if_flush()
   followed by trx_ctrl_send(), since the trx_ctrl_send() at the end of
   trx_ctrl_read_cb would retransmit it again immediatelly.
-- Avoid accessing tcm pointer if the callback called trx_if_flush(),
   since it has been freed.

Related: OS#6020
Change-Id: Ibdffa4644aa3a7d219452644d3e74b411734f1df
2023-10-25 16:00:59 +00:00
Pau Espin 3bd97d839e Revert "trx_if: Allow calling trx_if_flush/close from within TRXC callback"
This reverts commit 4444262a6a.
This commit introduced several side effects:
- tcm is left out of the l1h->trx_ctrl_list and hence won't be ever
  retransmitted.
- Since tcm is removed before rsp callback, the llist may become empty
  and if somehwere in the rsp callback a new message is enqueud it will
  be sent immediatelly, and will be retransmitted again when
trx_ctrl_read_cb() calls trx_ctrl_send() at the end.

Change-Id: Ideb2d08ac8a2902bceeabfb055c59c9a13dbe3c0
Related: OS#6020
2023-10-25 16:00:59 +00:00
Philipp Maier 6ed4a9a1eb pcuif_proto: clean up last remains of old PCUIF v10
There are still some remains that are related to the old PCUIF v10
protocol version. Let's clean those up.

Related: OS#5927
Depends: osmo-pcu.git I68a3f59d5c960ae3a4fbd74f9d4a894295cb9ed8
Change-Id: I04f7108c94c99c9920192177087748e8b89b3106
2023-10-16 11:54:14 +02:00
Andreas Eversberg d265ce68b2 Increase RR scheduler priority to 20, to avoid dropped bursts
If frames are not deliverd fast enough to the DSP, bursts will get
dropped. The osmo-bts-sysmo process must have priority over other
processes, so it can deliver frames fast enough.

Related: OS#6199
Change-Id: I2394e6bbc00a1d47987dbe7b70f4b5cbedf69b10
2023-10-09 08:04:56 +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
Philipp Maier 955b7dc637 pcuif_proto: rename PCU_IF_FLAG_SYSMO to PCU_IF_FLAG_DIRECT_PHY
The PCUIF flag PCU_IF_FLAG_SYSMO was originally used by osmo-bts-sysmo
to signal to the PCU that the direct PHY access for the sysmo-bts DSP
should be enabled. With time, support for other BTS models was added and
the flag became a synonym for "direct PHY access", so it makes sense to
rename it to "PCU_IF_FLAG_DIRECT_PHY"

Related: OS#6191
Depends: osmo-pcu.git I29b7b78a3a91d062b9ea3cd72623d30618cd3f0b
Change-Id: Ib556a93f7d7d7dbe1e96c4a0802bc802241b2b2d
2023-10-04 14:46:53 +00:00
Vadim Yanitskiy 695080745c meas: lchan_meas_sub_num_expected(): handle CSD modes
Change-Id: Iba5314dc89d65ab4a3706b6ef11994b6fa95162c
Related: OS#6168
2023-10-04 09:18:11 +00:00
Vadim Yanitskiy fe005cb76e meas: ts45008_83_is_sub(): properly handle CSD modes
Change-Id: Ic3b1e27be2dece3605657fd91d7addebb1e554e8
Related: OS#6168
2023-10-04 09:18:11 +00:00
Vadim Yanitskiy b960c7558a meas: fix ts45008_83_is_sub(): DTX is permitted on TCH/F sign
DTX is not allowed for TCH/H in signalling mode, but *is* allowed
for TCH/F in signalling mode.

Change-Id: I91cfd8f561eb47a5fc48c0682d56331a1d69aded
Related: OS#6168
2023-10-04 09:18:11 +00:00
Vadim Yanitskiy b8a185cc12 meas: handle VAMOS specific chan modes
Treat the VAMOS channel modes same as their non-VAMOS counterparts.

Change-Id: I8ecaf87c7cda4c10dd411e7539382274715bce57
Related: OS#6168
2023-10-04 09:18:11 +00:00
Vadim Yanitskiy 08f058789f meas: lchan_meas_check_compute(): fix -SUB frame substitution
The current implementation does substitute all missing meas samples
with dummy -SUB measurements and then complain about exceeding
amount of -SUB samples.

Change-Id: Iab84f4b64b645486e2f115b0f82ee2f27eb992bc
Related: OS#6168
2023-10-04 09:18:11 +00:00
Vadim Yanitskiy 8bff3b6898 meas: lchan_meas_sub_num_expected(): proper cmode enforcement
3GPP TS 45.008, section 8.3 defines TDMA Fn subsets, which shall
always be transmitted when DTX is employed, only for:

* TCH/F in signalling mode (but not for TCH/H),
* TCH/H and TCH/F in data mode (CSD) [*],
* TCH/FS, TCH/EFS, and TCH/HS.

For channel modes employing AMR codec, in particular:

* TCH/AFS, TCH/WFS, O-TCH/WFS,
* TCH/AHS, O-TCH/AHS, O-TCH/WHS,

there exist no fixed TDMA Fn subsets, but DTX is still permitted.
For those we expect at least one SACCH frame, plus a variable
number of speech frames (0 or more).

[*] Handling of data modes is fixed in a follow-up patch.

Change-Id: Ied477528d77871dd7e3b5b7b433a4e33bca40011
Related: OS#6168
2023-10-04 09:18:11 +00:00
Vadim Yanitskiy aaa1f26e52 meas: also match stderr logging for meas_test
Change-Id: Id1ce154a65b194ce5fd9257c9c1b26d62aad1e0d
Related: OS#6168
2023-10-04 09:18:11 +00:00
Vadim Yanitskiy 40ba43a2e8 osmo-bts-trx: rx_tchh_fn(): fix copy-pasted comment
Change-Id: Idba18c217187f7aacc2fcb0c330814f3802a9306
2023-10-03 13:36:40 +00:00
Pau Espin c6211a8bec cosmetic: oc2g_mgr: fix trailing whitespace
Change-Id: I918cbe32d1be692a1747c9721f680ed8a336bf6f
2023-10-03 14:19:53 +02:00
Vadim Yanitskiy aa06f97326 l1sap: l1sap_tch_ind(): fix segfault on stale TCH.ind
It was reported that osmo-bts-sysmo is crashing due to a TCH.ind
primitive being received by l1sap_tch_ind() for an lchan, which
is operating neither in speech nor data, but in signalling mode.

It's not clear which scenario is causing this situation.  My best
guess is that one or more TCH.ind primitive(s) remain waiting in
the lower layers and bob up right after the channel mode change.

This can happen, for instance, when a dynamic timeslot gets
switched from TCH/F or TCH/H to PDCH or SDCCH/8.

Change-Id: I2d270ab654fdd9d19d1708ff6c4b4e902bd5d0a3
Fixes: d1f8f3429 "l1sap: proper rate adaptation for CSD"
Closes: OS#6180
2023-09-28 14:43:22 +00:00
Oliver Smith 188f76275a systemd: remove RestartPreventExitStatus=1
Fix OsmoBTS not restarting if e.g. an external gsmtap IP is configured
that is currently not available. Also make the service files more
consistent with other Osmocom projects.

Partial revert of ae2473c2 ("systemd: Do not restart with a broken
config file or such").

Related: SYS#6581
Change-Id: Ieeed858c159839ebaa27b2be35a597fb86874c4b
2023-09-27 10:06:54 +02:00
Andreas Eversberg ddc15996dd Do not prefix UI header to System Information Type 10
System Information Type 10 uses short L2 header that is transmitted as
Bter UI frame. The complete frame is sent by BSC, including short L2
header. Only the SACCH layer 1 header is added by the BTS.

A switch() statement is used, so other System Information with short L2
header can be added in the future.

Change-Id: Ifede42bfd84ea5914b559a20ae68f594d2ee1a5c
2023-09-25 08:25:58 +02:00
Andreas Eversberg f5c1cd3889 ASCI: Ignore LAPD frames from MS, while the uplink is not active
Do not forward any message that is received on the uplink to LAPD while
the uplink is not active. If the MS did not recognize (fast enough) that
the uplink is free, it may continue to transmit LAPD messages. A
response by LAPD to these messages is not desired and not required. If
LAPD would respond, it would cause stopping transmission of UPLINK FREE
messages. No MS could access the uplink anymore.

Note: UPLINK FREE messages are repeated automatically until a different
      message is transmitted.

Related: OS#5781
Change-Id: I5075115123055b2997481f56ddf473430a1dc9e3
2023-09-25 06:22:35 +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
Pau Espin 852b2cbadc nm: delay RSL connect until BBTRANSC object is OPSTARTed
Have same behavior as nanoBTS.

Related: OS#5253
Change-Id: Idefc65a8812abd49fb5f0cd7b0bef423536b86e0
2023-09-19 09:15:08 +00:00
Pau Espin c4e836838d Move trx->rsl_link to trx->bb_transc.rsl.link
The RSL link is configured/set up by the BBTRANSC NM object, hence move
it to the appropiate substruct.

Related: OS#5253
Change-Id: I62937cbd81c27274b9f5f70d454d5319a6898c7b
2023-09-19 09:15:08 +00:00
Pau Espin 9aaaacc7aa oml: Store RSL connect related fields in bb_transc
This is a preparation commit towards delaying connection of RSL tcp
socket until the BBTRANSC object is OPSTARTed, as it is the case already
in nanoBTS.

Related: OS#5253
Change-Id: Ia571ec19e9e8f8a6d7c2554642aab0afe1b4b917
2023-09-19 09:15:08 +00:00
Vadim Yanitskiy 9d9d9e2f27 oml: oml_tx_attr_resp(): handle common nm_state attributes
These attributes are listed in 3GPP TS 52.021, Table 2/GSM 12.21.
Many attributes are still unhandled, but at least something.

Change-Id: I94702c503fea5b42d84673ccd7065c9323b733b8
Related: OS#4505
2023-09-15 05:13:11 +07:00
Vadim Yanitskiy fbd8aa8a77 oml: refactor generation of Get Attribute Response
Change-Id: I531e88e789d09f8828a53813e3b2863faf0cc572
Related: OS#4505
2023-09-15 04:49:54 +07:00
Vadim Yanitskiy e8518ae375 oml: oml_tx_attr_resp(): pass *mo to handle_attrs_{bts,trx}()
Change-Id: I78555d7226afd0c25efc100d95642634323a7b95
2023-09-15 01:39:06 +07:00
Vadim Yanitskiy fd4654e1b8 osmo-bts-{oc2g,lc15}: signal CBCH support to BSC
The model specific code seems to have everything needed for CBCH.

Change-Id: I6b4d82223dc0bdcd94cd1269bfb02047cbebe480
2023-09-15 01:39:06 +07:00
Pau Espin e97834f2db Bump version: 1.6.0.210-8a1f-dirty → 1.7.0
Change-Id: I3137362f3933aad20e3000a2fab4af82fe4fb649
2023-09-12 16:05:31 +02:00
Pau Espin 8a1f740dfc rsl: Improve logic reactivating CCCH upon SI3 BS_AG_BLKS_RES change
The previous logic was wrong, since it was only reactivating the channel
if the provided BS_AG_BLKS_RES was != 1.
Example previously broken scenario:

1- osmo-bsc user sets "channel-descrption bs-ag-blks-res 2" during
   osmo-bsc startup in osmo-bsc.cfg
2- osmo-bsc user uses VTY to change it to "channel-descrption
   bs-ag-blks-res 1"
3- osmo-bsc user uses VTY to deploy the new config: "bts <0-255>
   resend-system-information"

Step 3 would fail beforehand, ending up in a NO-OP.

Change-Id: Ibc118e11c64f04de55cb7b94d8bf2c84b431774d
2023-09-07 18:34:25 +02:00
Pau Espin 1d53d231da bts-trx: Fix CCCH not enabled if BS_AG_BLKS_RES!=1 is provided by BSC
Other bts models like sysmo,lc15,oc2g properly handled
rel_act_kind=LCHAN_REL_ACT_REACT under the bts_model_lchan_deactivate()
implementation, but bts-trx didn't.

As a result, when BCCH_INFO(SYSINFO_TYPE_3) coming from BSC (RSL)
containing a different BS_AG_BLKS_RES triggers CCCH re-activation,
it would only deactivate it but not re-activate it.
That means no SIs were being scheduled if bts was configured with
"channel-descrption bs-ag-blks-res 2" in osmo-bsc.cfg, and phones would
not see the cell.

Related: OS#1575
Change-Id: I61e1681fbaa2c993b529d58b581c99166b62bda3
2023-09-07 18:15:03 +02:00
Philipp Maier d2d938c261 pcu_sock: print SAPI and msg_id when sending confirmation
At the moment we do not print the SAPI, nor the msg_id when we send a
confirmation back to the PCU

Change-Id: Ibd5b4225e597b69eaabaeee437fb637943a55602
elated: OS#5927
2023-08-31 11:02:03 +02:00
Philipp Maier f20e13d160 pcu_sock: use PCU_IF_SAPI_AGCH_2 instead PCU_IF_SAPI_AGCH
In PCUIF v.11 we use PCU_IF_SAPI_AGCH_2 exclusively. We use this SAPI
to transfer IMMEDIATE ASSIGNMENT messages for uplink and downlink. In
both cases we send a confirmation back to the PCU. For details see
coresponding patch in osmo-pcu.git (see Depends)

CAUTION: This patch breaks compatibility to current master osmo-pcu (See
also "Depends")

Related: OS#5927
Depends: osmo-pcu.git I9effdcec1da91a6e2e7a7c41f95d3300ad1bb292
Depends: osmo-ttcn3-hacks.git Iec00d8144dfb2cd8bcee9093c96a3cc98aea6458
Change-Id: I29858fa20ad8bd0aefe81a5c40ad77a2559a8c10
2023-08-31 11:01:25 +02:00
Philipp Maier 55a21dc1c3 pcuif_proto: use confirm flag in struct gsm_pcu_if_pch
The PCU now sets a confirm flag in struct gsm_pcu_if_pch in case the MAC
block (data) requires a confirmation when sent. Use this confirm flag
instead of making the decision locally based on the MAC block contents.

Related: OS#5927
Depends: osmo-pcu.git Ia202862aafc1f0cb6601574ef61eb9155de11f04
Change-Id: I3364d2268bdef9c4d2feeb8e3d51a64e34bca68c
2023-08-29 11:13:13 +02:00
Vadim Yanitskiy b33502a39b csd_v110: handle empty/incomplete Uplink frames gracefully
Change-Id: I7cbf868df3ba5d390cea3d529eef26d18dbe55ab
Related: OS#1572
2023-08-26 04:11:33 +07:00
Vadim Yanitskiy 183c088864 csd_v110: properly set E1/E2/E3 for non-transparent data
Change-Id: Ie38c12e462654cd9fe83a0420bc8ea8b476214b8
Related: OS#1572
2023-08-26 03:12:03 +07:00
Vadim Yanitskiy 37e639cb8f csd_v110: fix comments in csd_v110_rtp_{en,de}code()
Change-Id: I6fee665e587bfa76058187e13f0cdafaea991940
Related: OS#1572
2023-08-26 03:10:20 +07:00
Philipp Maier 7e5a62e9f3 bts: make bts_agch_dequeue static
The function bts_agch_dequeue() is not used outside of bts.c, so it can
be a static function.

Change-Id: If86293ebbd99d6550022aeb8721d40bca5fc04fc
Related: OS#5927
2023-08-22 14:53:11 +02:00
Philipp Maier 9171e37aff pcuif_proto: get rid of _DT, _dt (Direct TLLI)
Since we now no longer refer to TLLI when we mean "message ID" (msg_id),
we should also remove the "_DT" / "_dt" suffix from structs and define
constants and replace it with "_2" if required.

Depends: osmo-pcu.git If641b507dcb6b176109c99dce7cff2a7561364b0
Change-Id: Icf85f60ae86fbe1f3b98e1457c0598bb09cb08c5
Related: OS#5927
2023-08-10 15:08:11 +02:00
Philipp Maier 086b46a77f pcuif_proto: remove unnecessary members from gsm_pcu_if_data_cnf_dt
The struct gsm_pcu_if_data_cnf_dt was added when the first experiments
mit Ericsson RBS base stations were made. It is essentially a copy of
gsm_pcu_if_data, where the mamber "data" was replaced with a member
"msg_id" (which was originally called "tlli"). Since we didn't know
back then which parameters we would still need at some later point we
kept all the other parameters. However, to this day we never used the
parameters below fn. Even fn was only used for logging purposes, but is
now also unused.

Let's remove all those unused members.

(Since all removed members are at the tail of the struct,
compatibility with other programs that use the PCUIF should not break.)

Related: OS#5927
Change-Id: I779605858648e2a1c202c37e197a6e32e6ea3786
2023-08-08 17:34:20 +02:00
Philipp Maier ff085f63c9 pcu_sock: get rid of fn parameter in pcu_tx_pch_data_cnf
The function pcu_tx_pch_data_cnf() gets a parameter fn (frame number).
This parameter is then used to populate the member fn in
gsm_pcu_if_data_cnf_dt of the PCUIF protocol. However, the PCU only uses
this parameter for logging and nothing else. Hence it it is not needed
and we can remove it.

Related: OS#5927
Depends: osmo-pcu.git I35bc99eaec5d0287ae3916bc668f0babaddfd6ce
Change-Id: Id1c8fa77725129ec2ea7e92e1df493f35a277659
2023-08-08 17:04:12 +02:00
Philipp Maier bbb3a1ed17 pcuif_proto: rename tlli to msg_id
To confirm downlink IMMEDIATE ASSIGNMENT messages, we use the TLLI as an
identifier and the related struct member is also called "tlli".
Unfortunately this is misleading since the message identifier does not
necessarly have to be a TLLI. It is just an implementation detail that
osmo-pcu uses the TLLI as a message identifier.

To make that clear, lets rename the tlli member (and variable and
parameter names where it is passed on) to "msg_id".

(Since this change only renames variables and struct members it will not
break compatibility with other programs that use the PCUIF)

Related: OS#5927
Depends: osmo-pcu.git I4a25039dfe329e68879bc68936e49c4b190625e6
Change-Id: Ie6b34d5df64f4bed6b14581c7957dcba6af44136
2023-08-08 16:11:50 +02:00
Vadim Yanitskiy 88de4d6789 rsl: rsl_handle_chan_mod_ie(): do not use legacy defines
Change-Id: I4e8f9ff5189af80bce13cfd1b27585aabda03f7a
Related: OS#1572
2023-08-07 14:50:10 +00:00
Vadim Yanitskiy 66eae187b9 rsl: rsl_handle_chan_mod_ie(): set lchan->csd_mode
Change-Id: I6b1b44cffae1484098709efe496efafacbd354a8
Related: ca418643 "csd_v110_rtp_encode(): properly set E1/E2/E3 bits"
Related: OS#1572
2023-08-07 14:50:10 +00: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
Vadim Yanitskiy 007e72d5bc osmo-bts-trx: bts_supports_cm_data(): allow non-transparent modes
The rate adaptation algorithm is the same for both transparent and
non-transparent channel modes.  The only difference is that the
E-bits in the modified CSD frames carry data, like the D-bits.

Change-Id: Ib0d9346d7a8e30b8a8e4b08ee04846ba7d12b3fb
Related: OS#1572
2023-07-30 20:32:20 +07:00
Vadim Yanitskiy ca418643b3 csd_v110_rtp_encode(): properly set E1/E2/E3 bits
The E1/E2/E3 bits are set based on out-of-band knowledge of the
current user data rate.  The actual bit values are defined in
3GPP TS 44.021, Figure 4 "Coding of data rates".

TODO: this is only valid for transparent services,
      for non-transparent services see 3GPP TS 48.020.
TODO: lchan->csd_mode is never set to the actual CSD mode...

Change-Id: I1a14597dff746cf975140b294400a2cc05badccd
Related: OS#1572
2023-07-30 20:29:12 +07:00
Vadim Yanitskiy d1f8f3429c l1sap: proper rate adaptation for CSD (RFC4040 'clearmode')
Since 95407f3f osmo-bts-trx supports scheduling all CSD specific
channel rates, however the rate adaptation was missing.

On the radio interface we deal with CSD-modified V.110 frames, which
need to be converted to normal 80-bit V.110 frames (RA1'/RA1), which
in turn need to be batched and sent in RFC4040 "clearmode" 160 octet
RTP payloads (RA1/RA2 as per I.460).

Note that this patch comments out TCH/F14.4 in bts_supports_cm_data(),
so that all channel allocations for this mode would be NACKed.  The
reason for this is that the rate adaptation functions for TCH/F14.4
are different than the RA1'/RA1 and the RA1/RA2.

For more information, see:

* 3GPP TS 44.021, section 8 (functions RA1'/RA1)
* ITU-T I.460, section 1.1 "Rate adaption of 8, 16 and 32 kbit/s streams"

Change-Id: I5e3701ad52d5d428fd02caff037881045f2d0a02
Related: OS#1572
2023-07-30 16:08:01 +07:00
Andreas Eversberg 97d3bd3e62 ASCI: Enable UPLINK ACCESS on various BTS models
UPLINK ACCESS (RACH on TCH) was enabled for osmo-bts-sysmo only. Now it
is also enabled for:
* osmo-bts-lc15
* osmo-bts-oc2g
* osmo-bts-trx
* osmo-bts-virtual

Change-Id: Iae0db6bfcf6629c114436a79648e832c82835abe
2023-07-21 13:20:13 +02:00
Andreas Eversberg 467d63e387 Add test cases for rest octets of Paging Requests
The abstract representation of the rest octets are moved to the header
file, so that the test case can include it. append_p*_rest_octets()
function become externally available for test.

Change-Id: Ifa5be8998b671160e38af1be707e040b00d407b8
Related: OS#5781
2023-07-21 13:20:12 +02:00
Andreas Eversberg be93b87a64 ASCI: Repeat UPLINK FREE message until uplink becomes busy
According to TS 44.018 the UPLINK FREE message must be repeated when the
uplink is marked as free. The BSC sends the UPLINK FREE message once and
the BTS repeats it until UPLINK BUSY (uplink blocked by BSC) or
VGCS UPLINK GRANT (talker accesses the uplink) is sent.

It is important to stop sending UPLINK FREE message when a talker
accesses the uplink and before the VGCS UPLINK GRANT message is sent, so
that stopping must be controlled by the BTS.

Related: OS#5781
Change-Id: Ia23c59f5e9a73bbc384fbc317a2cfcf707e3c28f
2023-07-21 13:20:11 +02:00
Andreas Eversberg ba5d2e4a5f ASCI: Add Notification/FACCH support
When a VGCS/VBS call is established in a cell, NCH is used to notify
about ongoing calls to idle subscribers. Additionally Notification/FACCH
is used to notify subscribers in dedicated mode. This is performed by
broadcasting this messages to all active dedicated channels. The mobile
station can then indicate the call, so the user can join the call.

More importaint is the notification of the calling subscriber's MS,
which initiated the call. This is done on the early assigned channel.
The MS must know on which channel the call is placed. After leaving the
uplink, it must know where to access the uplink the next time.

Change-Id: I3ed14fa54a907891e492a7ada8e745a2c56cd46d
Related: OS#4851, OS#5781
2023-07-21 13:20:10 +02:00
Andreas Eversberg 0a2b0a20b3 ASCI: Send only NLN on Paging request type 1 rest octets
Do not send notifications here. The notifications are sent on the NCH.
The NLN is used to indicate a change on the NCH, so that the MS will
read the NCH then.

If NLN is not sent towards MS, it will not read NCH to get an updated
list of ongoing calls. Also, it will not allow making VGCS/VBS calls and
might indicate that ASCI is not supported in this call. (Tested with
GPH-610R.)

Change-Id: I22e584b70fd14d8bdabb28cf5de3d4647f37425a
Related: OS#5781
2023-07-21 13:20:07 +02:00
Andreas Eversberg 290085787a ASCI: Add support for rest octets in Paging request type 2 and 3
Currently the rest octets contain Notification List Number (NLN) and
NLN status and the "Channel Needed" (CN3 / CN4) fields for mobile
identities.

The existing encoding of CN3 / CN4 in Paging request type 3 has been
replaced.

The missing encoding of CN3 in Paging request type 2 has been added.

Change-Id: I6e33a6d38d4c7b124de35b53d219b64bb881ba66
Related: OS#5781
2023-07-21 13:20:07 +02:00
Andreas Eversberg 6fa1dfce61 ASCI: Add Notification CHannel (NCH) support
The location of the NCH is defined by the rest octet of System
Information 1. If NCH is defined, the given CCCH blocks are used for NCH
instead of AGCH/PCH.

The current list of VGCS/VBS call notifications is transmitted on the
NCH. If there is no notification, an empty notification is transmitted
on the NCH.

The Notification List Number (NLN) is used to indicated new
notificaitons. Only the last notification (or empty notification)
indicates NLN. This way the MS can determine after two equal NLN that
the complete list has been recevied.

Change-Id: I82fdaba3faaced76267a99ae14a5458a1b41fdaa
Related: OS#5781
2023-07-21 13:20:06 +02:00
Andreas Eversberg 65c8f0de94 ASCI: Retrieve NCH position from System Information 1
When BCCH INFO is received via RSL message, the rest octet of the System
Information 1 message is parsed to get the position of the NCH. The
position is stored in the gsm_bts structure. If the position is not
present int the rest octet, the stored value is set to negative.

Change-Id: I799a27179d478d4ff577d8bc47ae524834851e85
Related: OS#5781
2023-07-21 13:20:05 +02:00
Vadim Yanitskiy 98e5d6f7c6 osmo-bts-trx: document/clarify the meaning of BUFMAX=24
Change-Id: I95d4e4ee3938cfabc1695959cc82a1efbbf0d7ed
Related: OS#1572
2023-07-21 11:12:50 +00:00
Vadim Yanitskiy 29fcae8632 osmo-bts-trx: tx_tch[fh]_fn(): fix NULL pointer dereference
It may happen that only FACCH is available for transmission, so msg_tch
would be NULL in this case.  Check it before dereferencing.

Change-Id: I0e7d5634b5223bc246badbb8e94b620c967ab121
Related: OS#1572
2023-07-21 11:06:00 +00:00
Harald Welte fa90ff3e67 omldummy: Claim to support VBS + VGCS towards BSC
This tells our TTCN3 BSC tests to perform VBS/VGCS related procedures on
RSL.

Change-Id: I9ed1b20985d2ce3be31942d3e9df5cad513a0bfd
Related: OS#5778, OS#5779
2023-07-21 10:52:07 +00: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
Andreas Eversberg cdbd83affd ASCI: Add function to reactivate channel
Reactivation will modify parameters on an already activated channel. On
a VGCS/VBS channel it can be used to prepare channel for assignment of
the mobile station to it.

During assignment the channel is reactivated. The timing advance of the
mobile station is given. The uplink is activated and is waiting for the
mobile station to establish, to complete the assignment.

For reference see patent EP 1 858 275 A1.

Change-Id: I77f413cf70c2f5f8e8f525686eee40548521c71b
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
Philipp Maier 6c83527e62 paging: also accept zero length IMSI strings 3
When an IMMEDIATE ASSIGNMENT MAC block (from PCUIF) is added to the
paging queue, then also an IMSI is required. The paging queue uses the
last three digits of the IMSI to calculate the paging group. In case no
IMSI is given, the MAC block is rejected. This was handeled differently
before. Even an IMSI of length 0 would still be interpreted as "000" and
not rejected. See also:

I9f3799916e8102bf1ce0f21891f2d24f43091f01

Let's restore the behaviour we had before and accept short IMSI
strings again.

Change-Id: Iab1c3f1c39dd59bb53aa74b2c9e9e135e3985e0b
Related: OS#6099
2023-07-17 14:15:20 +02:00
Vadim Yanitskiy d04e3e708b osmo-bts-trx: change 'Received bad data' back to LOGL_DEBUG
In f2c902c2 I accidentally bumped the logging level for PDCH decoding
errors to LOGL_NOTICE, making osmo-bts-trx spam the logging with
hundreds of 'Received bad data' messsages.  Revert this.

Change-Id: Idb963f1a779dfa172825f6d481740cb0c4165485
Fixes: f2c902c2 "osmo-bts-trx: unify and enrich 'Received bad data' logging"
2023-07-15 01:20:15 +07:00
Vadim Yanitskiy 4344f323f2 osmo-bts-trx: rx_tch[fh]_fn(): combine rc-checking ifs
Change-Id: I7bb341867e362bf2061608ff54c3596ad209af90
2023-07-13 13:18:02 +00:00
Vadim Yanitskiy 17087a08c7 osmo-bts-trx: rx_tchf_fn(): move compute_ber10k() above
... for the sake of consistency with rx_tchh_fn().

Change-Id: Ie331da78eb3831e35d255583466e0d09b093b132
2023-07-13 13:18:02 +00:00
Vadim Yanitskiy f2c902c2af osmo-bts-trx: unify and enrich 'Received bad data' logging
Change-Id: I7902f382e1d83ef9ad2cf6f92e31eeb16f6b797c
2023-07-13 13:18:02 +00:00
Vadim Yanitskiy bb596dddc7 osmo-bts-trx: visualize rx_tch[fh]_fn() functions
Change-Id: I373dbbc3d427858f76d07ff85633e07fe2600770
Related: OS#1572
2023-07-13 03:42:29 +07:00
Vadim Yanitskiy 4bbfb904b8 osmo-bts-trx: implement TCH/F2.4 support for CSD
Change-Id: I31c59a78a362986b0cd1bc6650c325ee9f206519
Depends: libosmocore.git I4685376c8deb04db670684c9ebf685ad6fc989fa
Related: OS#1572
2023-07-13 03:42:29 +07:00
Vadim Yanitskiy deef79ffae osmo-bts-trx: implement FACCH/[FH] support for CSD
The FACCH/[FH] coding rules are specified in 3GPP TS 45.003, sections
4.2 and 4.3.  The key difference is that unlike with speech channels,
FACCH does not replace data frames completely, but disturb a fixed
amount of bits fom them.  This is why we need to use separate
gsm0503_tch_[fh]r_facch_{en,de}code() API for data channels.

Change-Id: I4c6736e84c271240d457998de688c0baf59fe578
Depends: libosmocore.git I0c7a9c180dcafe64e6aebe53518d3d11e1f29886
Related: OS#1572
2023-07-13 03:42:29 +07:00
Vadim Yanitskiy 95407f3f63 osmo-bts-trx: implement CSD scheduling support
* enlarge the maximum burst buffer size to 24 * (2 * 58) bytes;
* enlarge per-l1cs Uplink burst mask to hold up to 32 bits;
* enlarge per-l1cs Uplink meas ring buffer to 24 entries;
* add new meas modes: SCHED_MEAS_AVG_M_{S22N22,S24N22};

Change-Id: I08ffbf8e79ce76a586d61f5463890c6e72a6d9b9
Depends: libosmocore.git Ib482817b5f6a4e3c7299f6e0b3841143b60fc93d
Related: OS#1572
2023-07-13 03:42:29 +07:00
Vadim Yanitskiy f3a63758d1 osmo-bts-trx: pull the AMR header in tch_dl_dequeue()
The goal is to unify encoding functions in tx_tch[fh]_fn(), so that
in a follow-up change adding CSD we could use a switch statement.

Change-Id: I15318e497b236128f779769e4fa99f307ea431ea
Related: OS#1572
2023-07-13 03:42:29 +07:00
arehbein 34077236f2 common: Make socket queue max. length configurable
Title refers to the maximum length of the osmo_wqueue used for
the PCU socket connection.

Related: OS#5774
Change-Id: Id6ba6e4eadce9ce82ef2407f4e28346e7fe4abfa
2023-07-12 07:46:05 +00:00
Vadim Yanitskiy d53a084fd6 measurement: suppress unsupported tch_mode warnings for CSD
Change-Id: If6896b420d0fa50fa6622d24ef679ca65ef2dc50
Related: OS#1572
2023-07-11 04:12:45 +07:00
Vadim Yanitskiy 2bdb2201f6 fix bts_supports_cm(): properly check feature flags for VGCS/VBS
cm->spd_ind can take only three values defined in enum rsl_cmod_spd:

  0000 0001   RSL_CMOD_SPD_SPEECH
  0000 0010   RSL_CMOD_SPD_DATA
  0000 0011   RSL_CMOD_SPD_SIGN

According to 3GPP TS 48.058, section 9.3.6, all other values are
reserved, so expecting RSL_CMOD_CRT_TCH_{GROUP,BCAST}_{Lm,Bm} there
is wrong.  These values are part of enum rsl_cmod_crt, so the right
field would be not cm->spd_ind, but cm->chan_rt.

Let's check these channel types in a separate stage, before checking
the requested codec.  Group them with VAMOS specific types for the
sake of consistency.

Change-Id: I914c84be04da819df9e60e2f5ecc5bac9b61b2e5
Fixes: 44c94fdea "validate RSL "channel rate and type" against VGCS/VBS flags"
Related: OS#4851
2023-07-11 04:09:31 +07:00
Harald Welte 84d220abc1 Store "Channel rate and type" from RSL Channel Mode IE in BTS
The RSL "Channel rate and type" field from the RSL Channel Mode IE
in RSL_CHAN_ACTIV and RSL_MODE_MODIFY_REQ messages is the only place
where the BSC differentiates between a normal TCH and the special
TCH modes used in VGCS or VBS.  Let's copy this field from the RSL
message into the lchan state, so that BTS models can actually (in
subsequent patches) reflect it when activating the L1.

Change-Id: I6d531bf528bcb81f44d91336471a46ef790d7646
Related: OS#4851
2023-07-10 18:06:19 +00:00
Andreas Eversberg 34838ee4e9 Change return value of bts_supports_cm() from int to bool
Change-Id: I72e30fe852ab69a162b117a534071ebddd4b16ba
2023-07-10 18:06:19 +00:00
Harald Welte 44c94fdeae validate RSL "channel rate and type" against VGCS/VBS flags
We already have specfied (but not yet implemented BTS_FEAT_{VBS,VGCS}).

Let's add code to validate "channel rate and type" compatibility
in bts_supports_cm() once a BTS model would actually exhibit those
feature flags.

Change-Id: I5e7f65b44cef6e2f7ad4f152f80a1686a4f511e3
Related: OS#4851
2023-07-10 18:06:19 +00:00
Harald Welte f0510b6207 ASCI: NCH / NOTIFICATION support
This adds very minimalistic support for notification of VBS/VGCS calls.

Minimalistic in that we
* only notify via PCH (not via NCH or FACCH)
* only include notification in otherwise empty PAGING TYPE 1

This means that notification will cease to work once the PCH becomes too
loaded and we never would send otherwise empty PAGING TYPE 1 anymore.

Change-Id: I6f6f72d9a0123cb519b341d72a124aaa2117370e
Requires: libosmocore.git I9586b5cb8514010d9358fcfc97c3d34741294522
Related: OS#5781
2023-07-10 18:06:19 +00:00
Harald Welte 3480a2ab4c Add ASCI (advanced speech call items) log sub-system
As we subsequently add ASCI related features to the code, it makes
sense to have a specific log sub-system for it.

Change-Id: I8ea3e61df35175bd74110b2f41994c99da3e2858
Related: OS#4851
2023-07-10 18:06:19 +00:00
Harald Welte ad15414fd9 paging: Add support for generating NLN/NLN-Status in P1 Rest Octets
The NLN + NLN-Status are optional parts of P1 rest octets; they can
be used to support the "Reduced NCH monitoring mechanism" as described
in Section 3.3.3.3 of TS 48.018.

The patch just adds encoder capability but doesn't yet make use of it.

Change-Id: I961842c3fec151e149f72a4f36279ce4b979795e
Related: OS#5781
2023-07-10 18:06:19 +00:00
Philipp Maier f98a55b713 pcu_sock: use PCUIF version 11 (direct TLLI)
OsmoBTS still uses the deprecated version 10 of the PCUIF protocol.
OsmoPCU is still compatible to version 10, but to maintain a clean
interface it is planned to drop the support for version 10 in the near
future.

Moving to PCUIF v.11 essentially means using the "Direct TLLI" method to
convey IMMEDIATE ASSIGNMENT and also PAGING COMMAND messages through the
PCU socket. This means in particular that we use a TLLI as an identifier
to confirm IMMEDIATE ASSIGNMENT messages towards the PCU (PAGING COMMAND
is not confirmed at all). Also we now use struct gsm_pcu_if_pch_dt to
parse the incoming PCU_IF_SAPI_PCH_DT, which is much cleaner than using
offsets in a buffer.

Change-Id: I25816ac12e63cc6b641eb414e6bc7eaa9c85fc25
Depends: osmo-ttcn3-hacks.git I08de02e951e10bc8b4381cc2ad32e63f2747e3c4
Depends: docker-playground.git Ia28bc0d6d3cbfe63be19443db86631fb67bb80fb
Related: OS#5927
2023-07-10 12:06:18 +00:00
Vadim Yanitskiy 1f5fdf8c8d scheduler: use size_t for data_len in _sched_compose_*_ind()
The payload size for some CSD channel types is bigger than what an
uint8_t can represent, for instance 290 bytes for TCH/F14.4.

Change-Id: Id75c55509a017d14dfab2a7b4c67e0742125a113
Related: OS#1572
2023-07-06 00:51:10 +07:00
Vadim Yanitskiy d78968422f scheduler: constify *data pointer in _sched_compose_*_ind()
Change-Id: I617e7ed50d27e047cc2851f5d44d31ad3111ce0a
Related: OS#1572
2023-07-06 00:50:11 +07:00
Vadim Yanitskiy c860309aea scheduler: unify argument names/order for _sched_compose_*_ind()
This commit aims to make the argument naming/ordering more consistent:

* rename l2/l2_len and tch/tch_len to data/data_len;
* common arguments first (consistent ordering), specific last.

Change-Id: I3d8c90b82f2a55b0c5c2d6b4efb8fd962508534d
Related: OS#1572
2023-07-06 00:43:36 +07:00
Vadim Yanitskiy 5c1401d6f3 scheduler: use msgb_hexdump_l2() in _sched_compose_tch_ind()
Change-Id: Iec8b6edaeb516eb5dc65eab52e3450e7330a6504
Related: OS#1572
2023-07-06 00:01:35 +07:00
Vadim Yanitskiy 477fb3d9a4 scheduler: fix wrong union field in _sched_compose_tch_ind()
Change-Id: I2f6794d229ad8219e3835a6eb74513672e497d5d
Related: OS#1572
2023-07-05 23:59:50 +07:00
Pau Espin e5c2bc346b Increase PCUIF wqueue size
The default of 10 messages introduced recently is too small, specially
when using osmo-bts-trx, where clock drifting and CPU scheduling can
cause skewing and hence generation of 2-3 FNs (* up to 8 TS) at once,
hence filling the PCUIF queue with more than 10 messages in a given
moment.

Fixes: c938a95e25
Change-Id: I7ababfc6cdf20196889fb542a8040128b3c118b5
2023-07-04 12:16:10 +02:00
arehbein c938a95e25 common: Have PCU socket connection use osmo_wqueue
Fixes memleak in case of connected PCU process being suspended without proper close on socket

Related: OS#5774
Change-Id: Ia6e61dda4b3cd4bba76e6acb7771d70335062fe1
2023-07-02 17:46:51 +00:00
Mychaela N. Falconia 4c3b4e2868 ECU in UL path: move it from trx model to l1sap
With this change the application of ECU in the uplink path becomes
consistent across all OsmoBTS models, enabled or disabled per vty
config setting "rtp internal-uplink-ecu".  An additional behavioral
change from the previous trx-model-only implementation is that ECU
insertion is now done after the link quality check in l1sap, thereby
fixing the bug where this quality check would sometimes suppress
ECU output and replace it with BFI markers in RTP.

In the new implementation when the internal ECU is enabled and
available for the selected codec (currently FRv1 only), the RTP output
will gap (standard representation of BFI in RTP) only during DTXu
pauses as indicated by a received SID frame (either valid or invalid),
and the SID frame that triggers the switch from ECU mode into pause
mode is reliably emitted in RTP.

Related: OS#6040
Depends: I3857be84bba12aaca0c2cca91458b7e13c5a642a (libosmocore)
Change-Id: Iac577975c9ab50cb8ebbc035c661c1880e7cecec
2023-06-28 16:29:00 +00:00
Mychaela N. Falconia 676e9e5804 ECU in UL path: move state alloc/free to l1sap
In preparation for moving the now-optional application of ECU in UL
path from osmo-bts-trx model-specific code to the common layer,
move ECU state allocation and freeing from trx model to l1sap.

Related: OS#6040
Change-Id: Ic98a2eb26b5a99bc4a89ad07ae87c9a86b921418
2023-06-28 16:29:00 +00:00
Mychaela N. Falconia f0f91fc66c ECU in UL path: make it optional per vty config
Current osmo-bts-trx includes a provision for invoking ECUs from
libosmocodec in the UL path from the channel decoder to the RTP
output.  This pre-existing implementation is counter to the spirit
of 3GPP specs (a BTS should merely mark BFI conditions in its UL
output, as opposed to actively modifying the frame stream with an ECU),
inconsistent between different osmo-bts models (only in -trx and no
others), and inconsistent even within osmo-bts-trx itself, where
the link quality check in l1sap will sometimes suppress the output
of the ECU - a quirk which the designers of the current mechanism
most certainly did not intend.

The solution decided upon in OsmoDevCall on 2023-06-21 is to make
this ECU optional per vty config, and move it from the trx model
to the common layer to resolve the inconsistencies.  Implement the
first part: make the ECU application optional per vty config.

For backward compatibility with existing deployments, the new
"rtp internal-uplink-ecu" setting is enabled by default on osmo-bts-trx
but not on any other models.

Related: OS#6040
Change-Id: I0acca9c6d7da966a623287563e0789db9e0fae8e
2023-06-28 16:29:00 +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
Vadim Yanitskiy 34ab6f1470 l1sap: use gsm0502_fn2ccch_block() from libosmogsm
Keep the l1sap specific wrapper because we still want to assert().

Change-Id: I7097ba87f42689d2336014da9173cadbdaa9fdab
Depends: libosmocore.git I8cbd31226754e95887358ed83a928e2f567f4cf3
2023-06-26 14:59:49 +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
Oliver Smith fd544caae1 gitignore: add arm-poky-linux-gnueabi-libtool
This file gets copied into the tree when building with the SDK.

Change-Id: I0fe4f96175ee94eb0a131c425bbeb110f1d55402
2023-06-23 13:18:38 +02:00
Philipp Maier 3f9e507d77 l1sap: cosmetic: rename payload_len to rtp_pl_len
The function signature of rtppayload_is_octet_aligned has a parameter
rtp_pl for the payload and a parameter payload_len for the length of the
payload, while other functions use rtp_pl and rtp_pl_len.

Change-Id: I8a0e0357aab2a78e25811f66b1b870e8c6ebffe9
2023-06-14 10:21:22 +02:00
Philipp Maier b2c6b68a10 pcu_sock: move variable declaration of imsi[4] into related scope
The variable imsi[4] may be moved into the scope of case PCU_IF_SAPI_PCH

Related: OS#5927
Change-Id: I62aed4f1c600ce2a80d2df928a60b6a2e0ae1889
2023-06-07 12:25:31 +02:00
Philipp Maier c9a8eca543 paging: do not confirm PAGING COMMAND messages
when osmo-bts receives a MAC block from osmo-pcu through the PCUIF it
puts it in the review queue without further interpreting it. This also
means that it will send confirmations to the PCU for IMMEDIATE
ASSIGNMENT and PAGING COMMAND. This is not entirely correct because only
IMMEDIATE ASSIGNMENT messages should be confirmed. osmo-pcu has no
problem with this since it silently drops the confirmations for PAGING
COMMAND messages. This peculiarity of the PCUIF implementation makes the
confirmation logic hard to understand, so let's add some logic to
osmo-bts that makes sure that only IMMEDIATE ASSIGNMENT messages are
confirmed.

Related: OS#5927
Change-Id: I8b8264d28b1b1deb08774cdba58dd4c6dafe115d
2023-06-07 12:25:27 +02:00
Philipp Maier 9b5721b3fb paging: parse PCUIF data indication outside of paging.c
The function paging_add_macblock takes a data and length parameter. The
first three byte of that string are the last three digits of the IMSI
from which the paging group is calculated.

As the layout of this data buffer is a property of the PCUIF interface
API, we should do this separation outside of paging.c. Also we should
supply the IMSI as a valid null terminated string since PCUIF v.11 also
uses this format.

Change-Id: I9f3799916e8102bf1ce0f21891f2d24f43091f01
Related: OS#5927
2023-06-07 11:26:48 +02:00
Vadim Yanitskiy 194d1e8bc2 osmo-bts-trx: remove redundant memset() on receipt of NOPE.ind
In all Uplink lchan handlers we do memset() the Rx burst buffer on
bid=0 and there is no need to do that again for NOPE.ind.

Change-Id: Ia6803b8606d86bd2d011fe21f7a540d2115aa654
2023-06-06 10:20:36 +00:00
Vadim Yanitskiy 282c87ab2d osmo-bts-trx: fix recent regression in Tx lchan handlers
In my recent patch a0770250, among with the new burst buffer
allocation/release strategy, I introduced a regression:

        /* send burst, if we already got a frame */
-       if (br->bid > 0) {
-               if (!*bursts_p)
-                       return -ENODEV;
+       if (br->bid > 0)
                goto send_burst;
-       }

We used to allocate the burst buffers in Rx/Tx lchan handlers, and
release them in case of an error, e.g. when no block is available
for transmission.  In the case of Tx burst buffers, the state of
Tx burst buffer was additionally used to check if we have a valid
Tx block for transmission, as can be seen in the code snippet above.

As a side effect of my patch, osmo-bts-trx now keeps transmitting
3 out of 4 bursts (br->bid > 0) of the last valid block, until the
next valid Tx block is available for transmission.

This problem was not affecting the CS domain, where it's expected to
have a more or less constant pressure of Tx blocks.  However it did
show up in the PS domain, where in the absence of active TBFs the
PCU may omit DL blocks.

Add a new field 'dl_mask' to struct l1sched_chan_state, similar to
the existing 'ul_mask', and use it to reconstruct the removed logic.

Change-Id: I4538a8fe6b29f8d6eca33ad27d4a9852e3a3e86c
Fixes: a0770250 "osmo-bts-trx: alloc/free burst buffers in trx_sched_set_lchan()"
2023-06-03 14:56:42 +07:00
Vadim Yanitskiy 785e731def osmo-bts-trx: tx_pdtch_fn(): use msgb_l2len()
Change-Id: If3c2d9d93399411d4466779ce8e8987843b521b1
2023-06-02 18:50:40 +07:00
Mychaela N. Falconia 592030eee7 trx TCH DL: transmit invalid speech blocks instead of dummy FACCH
In speech TCH operation, there will always be times when a speech frame
needs to be transmitted on the downlink, but there is no frame available
to transmit (gap in the incoming RTP stream), or the logic of DTXd says
that no frame shall be transmitted at this FN, but we are not doing
physical DTXd.  Previous osmo-bts-trx code sent dummy FACCH during such
conditions, but this approach is bad for TCH/HS where we would like to
transmit good speech frames or speech frame gaps one 20 ms frame at a
time, rather than take out pairs of frames for dummy FACCH/H.  Other
BTS models (sysmoBTS PHY) send out invalid speech blocks with inverted
CRC3 under the conditions in question - do the same in osmo-bts-trx.

The present change modifies osmo-bts-trx TCH DL frame gap behavior
only for TCH/FS, TCH/HS and TCH/EFS; for all other channel modes,
including AMR speech, the previous behavior of sending dummy FACCH
is left unchanged.

Depends: Iade3310e16b906efb6892d28f474a0d15204e861 (libosmocore)
Change-Id: I78106802a0aa4af39859c75d29fe0e77037899fe
2023-05-31 17:40:43 +00:00
Vadim Yanitskiy 3302d4adfe osmo-bts-trx: tch_dl_dequeue(): do not drop CSD frames
Change-Id: I382b9994db01d58515c89c8de6250cd3239b8861
Related: OS#1572
2023-05-30 11:08:25 +00:00
Mychaela N. Falconia 405368b697 HR1 codec: act on SID indication in RFC5993 RTP input
Suppose we receive RTP from the uplink of another BTS, and the
UL-handling BTS has channel-decoded an HR1 frame which it deems
(per GSM 06.41 section 6.1.1) to be a valid SID, even though it is
not a perfect, error-free SID.  How will this SID frame be
represented in RFC 5993 transport?  My reading of the RFC tells me
that the UL-handling BTS will need to apply an operation like our
osmo_hr_sid_reset() to the payload before sending it out in RTP -
but because the text of the RFC does not explicitly address this
scenario, others may have interpreted it differently.

If we receive an RFC 5993 RTP payload in which FT is set to 2,
indicating good SID, but the actual HR payload is not a perfect SID
(the SID field is not all 1s), the only reasonable interpretation
of such occurrence is that the sender of this payload was another
BTS whose implementors interpreted the RFC as not requiring them
to rejuvenate the SID codeword prior to RTP output.  Therefore, let's
treat such payloads as valid SID for our DTXd logic, and rejuvenate
the SID codeword ourselves.

Change-Id: Ife00de6220a8ca7cc180a61734497f1acb7f5b83
2023-05-29 21:04:07 +00:00
Mychaela N. Falconia 1dd710944f HR1 codec: validate ToC header in RFC5993 RTP input
osmo-bts-trx always accepted (and previously required) HR1 codec RTP
input in RFC 5993 format; currently we accept this RTP format as
input for all BTS models, but no longer require it.  However, we
have never applied any checks to this format's ToC header, even
when we previously required it in osmo-bts-trx.  Check this header
and reject invalid payloads that just happen to have the same octet
length as valid ones.

Change-Id: If16d38641913bb46bcd7cc11685407ed17136bfe
2023-05-29 20:28:57 +00:00
Mychaela N. Falconia a84b9a0261 FR/HR/EFR TCH DL: implement DTX rules
GSM 06.31, 06.41 and 06.81 are the respective DTX specs for FR, HR
and EFR.  In each of these specs, section 5.1.2 specifies the
expected shape of radio downlink in the presence of SIDs: one SID
frame after each talkspurt (after speech frames), and one SID frame
in every SACCH-aligned position every 480 ms (every 240 ms for HR),
or if the actual SACCH-aligned position is taken up by FACCH,
then just one SID frame as soon as possible after that FACCH -
and no transmitted SID frames in other positions.

This just-referenced spec section was written with the assumption
that it will only be applied when DTXd is enabled - however, if
the RTP stream for call leg B DL comes from call leg A UL (TrFO),
then we are going to receive SID frames in the stream intended for
our DL even when DTXd is disabled or not supported altogether.
The easiest solution is to apply FR/HR/EFR DTXd logic whenever
the incoming RTP stream contains SID frames, irrespective of physical
DTXd enable/disable state.  If we apply such "logical DTXd" when
physical DTXd is disabled, the BTS model PHY will end up transmitting
induced BFIs (dummy FACCH or inverted CRC3) in those frame positions
where the "logical DTXd" function says "please transmit nothing".

The point remains, however, that the prescribed SID shape on the
radio downlink (expected positions of SID frames) won't happen on its
own: in the case of TrFO, whichever SID frames are present will be
in wrong positions for leg B DL, and even in the case of transcoded
calls the responsibility for DL SID shaping cannot be placed on the
RTP stream source because that source won't know where SACCH alignment
will lie.  Therefore, the necessary DL SID reshaping has to be done
in the RTP stream receiver in OsmoBTS.

Related: OS#5996
Change-Id: I924ab21952dcf8bb03ba7ccef790474bf66fc9e5
2023-05-29 16:21:36 +00:00
Vadim Yanitskiy d9de1a5b28 osmo-bts-trx: use direct pointer to chan_state->{ul,dl}_bursts
There is no more need to access the UL/DL buffers via pointer to pointer
thanks to the previous patch [1] moving the memory management routines
out of the logical channel specific Rx/Tx handlers.

Change-Id: Ib1e8e86ac60a7ac9b0415ef66b609eaa33443c19
Related: [1] c45e03726af8a2b46b7166b3c47bc666ba933a69
2023-05-27 22:40:58 +07:00
Vadim Yanitskiy a0770250bc osmo-bts-trx: alloc/free burst buffers in trx_sched_set_lchan()
It's a lot cleaner if the Rx/Tx burst buffers are allocated and free()d
in one place rather than in each lchan handler individually.  Allocate
the buffer(s) during the lchan activation, free() on deactivation.

Regardless of lchan type, allocate the maximim size of 4 * (3 * 2 * 58)
bytes, which is sufficient to store 4 8PSK modulated bursts.  This way
we reduce the load on the memory allocator at the cost of memory
consumption, what should not be a big problem.

Change-Id: I6a5f76023fc492786076a63016f81285b3576c33
Depends: libosmocore.git I1c38ccc2b64ba9046bb3b1221d99cc55ec493802
Related: OS#1572
2023-05-27 22:39:50 +07: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 44d47b2cdd trx, HR1 codec: change UL PHY output format to TS 101 318
As a preliminary step before making the RTP output format from
OsmoBTS configurable with a vty option, we need to make the internal
format consistent across all models.  The "natural" output from a
"pure" GSM 05.03 channel decoder is TS 101 318, which is also the
output format of all currently supported proprietary PHYs - adopt
it as our internal format.

Related: OS#5688
Depends: I6e75ca95409b5c368e8e04d0e0aba41e0331d9e6 (libosmocore)
Change-Id: I41bce6226964975cb85aea89e4c0f9e11e4929b8
2023-05-27 10:24:09 +00:00
Mychaela N. Falconia 4b945ec327 trx: fix HR1 codec breakage from format change
As of commit 1160cabefb, the common layer of osmo-bts accepts both
TS 101 318 and RFC 5993 formats for HR1 codec, and always passes
the more basic TS 101 318 format to the BTS model.  Unfortunately,
osmo-bts-trx has model-specific code checking the payload length
that was overlooked in that patch, causing breakage.  Fix that bug.
(The actual channel encoding function in libosmocoding already
accepts 14-byte payloads.)

Related: OS#5688
Fixes: I702e26c3ad5b9d8347e73c6cd23efa38a3a3407e
Change-Id: I0e251faeffb76d2604a4100c848141d239d1d86f
2023-05-26 22:05:15 +00:00
Mychaela N. Falconia 1160cabefb all models, HR1 codec: accept both TS101318 and RFC5993 formats
There exist two different RTP encoding formats for HR1 codec: one
"simple" format defined in ETSI TS 101 318, and an extended format
(adding a ToC octet) defined in IETF RFC 5993.  Following the
liberal-accept clause of Postel's law, we would like to accept
both formats.  Implement this feature by first converting all HR1
RTP inputs to the more basic TS 101 318 format at the point of
input preening, and then consistently using this basic format
internally.

Related: OS#5688
Depends: I13eaad366f9f68615b9e9e4a5f87396a0e9dea0f (libosmocore)
Change-Id: I702e26c3ad5b9d8347e73c6cd23efa38a3a3407e
2023-05-26 16:05:23 +00:00
Mychaela N. Falconia 208127986e refactor: replace rtppayload_is_valid() with preening before enqueue
Up until now, our approach to validating incoming RTP payloads and
dropping invalid ones has been to apply the preening function inside
l1sap_tch_rts_ind(), at the point of dequeueing from the DL input queue.
However, there are some RTP formats where we need to strip one byte
of header from the payload before passing the rest to our innards:
there is RFC 5993 for HR codec, and there also exists a non-standard
extension (rtp_traulike) that does a similar deal for FR and EFR.
Because of alignment issues, it will be more efficient (avoids memmove)
if we can do this header octet stripping before we copy the payload
into msgb - but doing so requires that we move this preening logic
to the point of RTP input before enqueueing.  Make this change.

Related: OS#5688
Change-Id: I7fc99aeecba8303b56d397b8952de5eea82b301e
2023-05-26 16:05:23 +00:00
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
Pau Espin cea6c230ad nm: Apply OPSTART through NM FSMs
This way we have further control on how to handle the OPSTART messages
received. For instance, NACK them if the NM object FSMs are not at the
expected correct state.

Related: OS#5992
Change-Id: I5df0bfb4cc812c11c7a00a8ffa882ae1915d562f
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
Harald Welte 8c397da917 logging: Introduce LOGPLCGT()
We have LOGPLCHAN and LOGPGT, but not a combined version for logging
both the lchan and the gsm_time.  Let's resolve this.

Log messages without indicating the lchan name are pretty useless if you
have multiple concurrently active lchans...

Change-Id: I4bf3363f92acdf67d8e7333e30ac2209e31cb287
2023-04-05 17:56:00 +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 c12bc93db8 oml.c: Remove dot character at the end of log lines
Change-Id: Iaf061bb752f9808a6ab31049b9e87920a6b07f3d
2023-04-05 13:10:05 +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
Pau Espin 914e55caf3 Clarify configuration of TSC on each timeslot
Related: OS#5856
Change-Id: Ief21daf63ba76725de9117cbe14ada8b75f147df
2023-04-04 12:50:20 +02:00
Pau Espin 0350824203 bts-trx: Drop unused param to internal function
Change-Id: Id7ad7629ec13bcec618055c41083cdac0a3102be
2023-04-04 12:50:19 +02:00
Mychaela N. Falconia 4ff6888a81 bts-{lc15,oc2g,sysmo}: support EFR in repeat_last_sid()
The function repeat_last_sid() is implemented in the common part,
but is only used by osmo-bts-{lc15,oc2g,sysmo} models.  These BTS
models call this function when they are looking to see if a
previously cached SID frame needs to retransmitted on the DL
because it is that time according to the SACCH multiframe.
Out of non-AMR codecs, this function previously supported only
FR1 and HR1, but failed to support EFR.  Fix that omission.

Change-Id: Iebcd28e65af889254740757eed9c579392eb1c33
2023-04-03 15:15:48 +00:00
Vadim Yanitskiy 5f556af232 tests: $(BUILT_SOURCES) is not defined, depend on osmo-bts-virtual
Change-Id: I4ace06e115a2689bde9afd9f99ecee99d796360b
2023-04-03 13:33:25 +00:00
Pau Espin 909d943fe8 contrib/ber: Avoid regenerating codec_bit_class.h every build
Automatic generation of a header file using a C program built during
build of osmo-bts creates several problems when cross-compiling.

The generated header file is only 59 lines long, so let's have it
generated in order to avoid having to call the helper program every
time.

A Makefile target is added to easily regenerate the file manually in
case it's needed:
make -C contrib/ber/ update_codec_bit_class_h

Fixes: acf0f0f0bb
Change-Id: I97efdb4ee00537fcae191b4267d0211d582ef372
2023-04-01 21:18:25 +00: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
Mychaela N. Falconia 50710f4e8e rtp continuous-streaming: fix BFI in the quality-suppressed case
The check for (tch_ind->lqual_cb >= bts->min_qual_norm) in
l1sap_tch_ind() has the intent of suppressing valid-seeming
speech frame output from lower layers when the link quality is
too low; this check is particularly important for FR1 codec
where the intrinsic validity check is only a 3-bit CRC which has
1/8 probability of indicating "correct" when decoding radio noise
during DTXu silence.

However, this check is effectively defeated in the current
implementation of rtp continuous-streaming: the RTP packet being
output is the presumed-bogus speech frame from lower layers,
rather than the intended zero-length payload.  Fix this bug.

Related: OS#5975
Change-Id: Icee0f57be289a0592a0197469432a012d15f224c
2023-03-30 17:30:53 +00:00
Sylvain Munaut acf0f0f0bb contrib: Add BER testing tool
This implements RTP based GSM BER testing for osmo-bts, implementing
ideas described in https://osmocom.org/projects/osmobts/wiki/BER_Testing

In short: The command transmits a PRBS sequence encapsulated in RTP
frames, which are sent to the BTS, which transmits that data in the
(unimpaired) downlink.  The mobile station receives the data and is
instructed to loop it back in the (possibly impaired) uplink.  The BTS
receives that uplink, puts in in RTP frames which end up being received
back by this very tool.  By correlating the received RTP with the PRBS
sequence, this tool can compute the BER (Bit Error Rate) of the
(possibly impaired) uplink.  Doing this with different RF channel model
simulators in the uplink allows to establish BER at different levels and
channel conditions.

Original code by Sylvain Munaut extended with some comments and Automake
integration by Harald Welte.

Change-Id: I1cffa0ae959e29ec61775b13185fd1057ed7485a
2023-03-30 12:56:14 +02:00
Harald Welte f06b959c7d lc15: fix compiler warning about unused variable cell_size
oml.c: In function ‘bts_model_apply_oml’:
oml.c:1814:17: error: variable ‘cell_size’ set but not used [-Werror=unused-but-set-variable]
 1814 |         uint8_t cell_size;
      |                 ^~~~~~~~~

Change-Id: I0bf1542f613f613d03609d50836137ff440401af
2023-03-29 14:02:50 +02: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 96263aa908 oc2g: Fix 'unused variable' compiler warning
oml.c: In function ‘bts_model_opstart’:
oml.c:1883:32: warning: variable ‘ts’ set but not used [-Wunused-but-set-variable]
 1883 |         struct gsm_bts_trx_ts *ts;
      |                                ^~

Change-Id: Ifd5552f2dd56f4f9bf4c17d25b741f694f4f2168
2023-03-29 12:02:10 +00:00
Harald Welte 362f2e50c2 lc15/oc2g: remove unused variables
oml.c: In function ‘l1if_rsl_chan_mod’:
oml.c:1980:22: error: unused variable ‘i’ [-Werror=unused-variable]
 1980 |         unsigned int i;
      |                      ^
oml.c:1979:35: error: unused variable ‘s4l’ [-Werror=unused-variable]
 1979 |         const struct lchan_sapis *s4l = &sapis_for_lchan[lchan->type];
      |                                   ^~~

oml.c: In function ‘l1if_rsl_chan_mod’:
oml.c:1985:22: warning: unused variable ‘i’ [-Wunused-variable]
 1985 |         unsigned int i;
      |                      ^
oml.c:1984:35: warning: unused variable ‘s4l’ [-Wunused-variable]
 1984 |         const struct lchan_sapis *s4l = &sapis_for_lchan[lchan->type];
      |                                   ^~~

Change-Id: Ieb8882bbade7f6d6628c9c00150bcf54e3a9dc75
2023-03-29 12:02:10 +00:00
Harald Welte 3d2c107922 lc15: Remove unused warning
l1_if.c: In function ‘activate_rf_compl_cb’:
l1_if.c:1251:22: error: unused variable ‘i’ [-Werror=unused-variable]
 1251 |         unsigned int i;
      |                      ^

Change-Id: I23270dfe6779321e514c71184b3c71f52a9b4c4a
2023-03-29 12:02:10 +00:00
Harald Welte 9584980ea2 lc15: fix compiler warning about wrong indent
l1_if.c: In function ‘activate_rf_compl_cb’:
l1_if.c:1280:17: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
 1280 |                 if (bts_lc15->led_ctrl_mode == LC15_LED_CONTROL_BTS)
      |                 ^~
In file included from ../../include/osmo-bts/dtx_dl_amr_fsm.h:3,
                 from ../../include/osmo-bts/msg_utils.h:8,
                 from l1_if.c:55:
l1_if.c:1282:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
 1282 |                         osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_DISABLE, NULL);
      |                         ^~~~~~~~~~~~~~~~~~~~~~

Change-Id: I00ae3faf0f85fecf6e15e71dff071165725e547c
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 c29ca5eb7d common: implement rtp continuous-streaming mode
In some environments it is highly desirable for the RTP stream
coming from each GSM call UL on a BTS to be fully continuous,
without any gaps, with _some_ RTP packet emitted every 20 ms,
even if there is no speech or SID frame to be sent in that frame
time window.  The present change adds an rtp continuous-streaming
vty option which, when enabled, causes the BTS to emit RTP packets
with a zero-length payload, instead of producing gaps in the RTP
stream, when it has nothing else to send.

Related: OS#5975
Change-Id: Ic0e2edf2ed90ba0ac6bee5e7d9629bf0255e256d
2023-03-29 12:01:26 +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
Mychaela N. Falconia e1e204fae3 trx: detect UL SID in EFR just like in FR
The TCH/F Rx code in osmo-bts-trx uses osmo_fr_check_sid() to detect
when the MS sends SID, and passes the flag to lchan_set_marker().
However, equivalent logic was missing for EFR, as until recently
there was no EFR SID check function in libosmocodec.  Now that
we have osmo_efr_check_sid(), use it.

Change-Id: Ib043e00dbf92145c2a6c32f6365517244472a922
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 c17697d337 common/vty: Print AMR MultiRate Configuration in "show lchan"
It can be useful to introspect the current active AMR mode set.

Related: OS#5944
Change-Id: I630af8c3835c2fcbea325c07db269d25e4e18f62
2023-03-28 15:12:10 +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 61b005193c cosmetic: Replace %i with %d
Our linter will fail on %i, so let's replace any legacy occurrences with %d

Change-Id: Ic302915bd5576d3e1f77668918f005d651daf21a
2023-03-28 12:44:22 +00: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
Vadim Yanitskiy dbd70bca75 rsl: rsl_handle_chan_mod_ie(): add missing GSM48_CMODE_* values
Change-Id: Iec397f1ef4cb5ac1c48abf869f54e272ed0fbb55
Depends: libosmocore.git I6adda28698c0e479ef20f5d090c1f7f76a2ec97e
Depends: libosmocore.git Ia6b428e5b6aaecf151cbfa980b89eff6d0fe6006
Related: OS#1572
2023-03-23 20:09:49 +00:00
Pau Espin 8fe6479358 bts-trx: Avoid pushing interf_meas for disabled TRX
It makes no sense to push interference meas results for those TRX since
they are disabled, unused and hence won't be reported in RSL RF Res Ind.

Related: SYS#6370
Change-Id: Ie3fd80970585cb30808b0644568dbc8936a57721
2023-03-23 12:38:26 +01:00
Vadim Yanitskiy 8e04613e4f osmo-bts-trx: properly activate [CBCH/]BCCH/CCCH
The timeslot carrying BCCH/CCCH on C0 is a bit special in a way that
it's being activated implicitly - there is no explicit RSL CHANnel
ACTIVation for that.  This is why we have TRX_CHAN_FLAG_AUTO_ACTIVE,
which marks sub-channels of BCCH/CCCH in the trx_chan_desc[].

The upcoming patch changes the burst buffer allocation strategy, so
that the memory is allocated on channel activation and then free()d
on channel release.  This patch facilitates that by making the
activation/deactivation logic consistent for all sub-channels.

Change-Id: Id0c70d6a2b777a5117c85149bfa1b3a997299d1d
Related: OS#1572
2023-03-22 12:14:25 +00:00
Vadim Yanitskiy e7085d1699 contrib/osmo-bts.spec.in: do not depend on libosmogb
The header file <osmocom/gprs/protocol/gsm_04_60.h> was recently
deprecated and moved to <osmocom/gsm/protocol/gsm_44_060.h>, so
it's now part of libosmogsn and depending libosmogb is not needed.

Change-Id: I823de7ebac2fe5dfddb88d533f1a9419f4a605db
Related: libosmocore.git I70cc21bf25a7081070738abacb409ed19094c3b2
Related: OS#5312
2023-03-21 12:26:21 +00:00
Vadim Yanitskiy ef9b27526c osmo-bts-virtual: properly handle dynamic TS in vbts_set_ts()
This change fixes a problem that prevents osmo-bts-virtual from
starting when dynamic (ipa/osmo) timeslots are in use.

Change-Id: I5db5b7dd6a8e84cf9a0d84f04a650c2ed8a4e368
2023-03-20 23:08:33 +07:00
Vadim Yanitskiy 4bdc5a74cc scheduler: log pchan value in trx_sched_set_pchan()
Change-Id: Ia31e53552208a9d57e2fc5473440840d38945d00
2023-03-20 03:59:11 +07:00
Pau Espin 767f690f05 Avoid tx RF Resource Ind for disabled TRX
Related: SYS#6370
Change-Id: I887e0cb03b2a5654accccf7a55fac51319981bfb
2023-03-17 17:02:47 +01:00
Pau Espin 48b00783f8 cosmetic: bts_trx.h: Fix whitespace
Change-Id: Ibcc3578cce23767445e53149796d0bd79f81ead8
2023-03-17 15:47:49 +01:00
Pau Espin c88ed31d9e cosmetic: gsm_pchan2chan_nr(): Update spec documentation
Change-Id: If1de230f022c69f3dfce8a7c66d494a984e7f3f9
2023-03-17 15:29:17 +01:00
Pau Espin 149de0c113 lchan: Improve error path logging in gsm_pchan2chan_nr()
Change-Id: I8d9da8e8433feb1f022dc2f5199f9c15c01e9312
2023-03-17 15:14:19 +01:00
Pau Espin ca72961bbd Rewrite pcu_sock_write()
The code in that function is pretty rotten:
* osmo_fd_write_disable() is called for each message in the queue,
  there's no need for that. Let's simply call it at the end if the queue
  is empty.
* Asserting for obvious stuff like dequeue returning the first entry in
  the list.
* Having error code path for empty message: That shouldn't happen, abort
  immediately.

With all thse changes, the function is way simpler, easy to read and
more efficient.

Change-Id: I7ffff98cd8cdf2041bff486c3fde6f16365028d5
2023-03-15 17:45:35 +01:00
Vadim Yanitskiy 50de553a1f tests: use -no-install libtool flag to avoid ./lt-* scripts
This option should be used for any executables which are used only
for testing, or for generating other files and are consequently never
installed.  By specifying this option, we are telling Libtool that
the executable it links will only ever be executed from where it is
built in the build tree.  Libtool is usually able to considerably
speed up the link process for such executables.

Change-Id: I06d3d5ab1dd21400a72f76eecc508886617ef4c6
2023-03-14 20:09:44 +00:00
Vadim Yanitskiy c1909e7258 rsl: reduce logging verbosity on some messages
These two messages indicate that no ACK/NACK message is going to be
sent to the BSC because activation/deactivation was requested by the
PCU.  This is absolutely normal and requires no attention from the
user/operator, so better use LOGL_INFO.

Change-Id: I6eaf3a6c07fb30b31c045729c935c8ad6735e5c8
2023-03-14 21:14:54 +07:00
Vadim Yanitskiy 729037de0a rsl: remove redundant gsm_lchan_name() in rsl_tx_rf_rel_ack()
Change-Id: I69dc11c66a774ddb7364d6ecd9bdb2e94e6cad66
2023-03-14 21:10:27 +07:00
Pau Espin 33956215a7 pcu_sock.c: Call osmo_fd_unregister() before closing and changing bfd->fd
Change-Id: I692bbb5b7c06b5528a36c09a99a7580cbafa3cc0
2023-03-14 11:29:42 +01:00
Oliver Smith f162fa9009 rsl_rx_ipac_XXcx: parse csd_fmt_d/ir
Parse the RTP CSD Format and reply with NACK if the mode is not
RSL_IPAC_RTP_CSD_TRAU_BTS, which is the only one we plan to implement
for now.

Related: OS#4393
Change-Id: Ibfc7811387df5224682d7e6a313d38648d3d8c48
2023-03-14 09:59:15 +00:00
Oliver Smith 9b88fd8481 doc: rsl: add RSL_IE_IPAC_RTP_CSD_FORMAT
Add documentation for rsl_ipac_rtp_csd_format_d/_ir from
libosmocore.git, include/osmocom/gsm/protocol/gsm_08_58.h and
wireshark.git, epan/dissectors/packet-rsl.c.

Related: OS#4393
Change-Id: Ic8f40076698f2b341cc0096fd96ba2051a41f077
2023-03-14 09:59:15 +00:00
Vadim Yanitskiy 61933e6a7a osmo-bts-virtual: indicate BTS_FEAT_[E]GPRS to the BSC
Forwarding of PDCH related data over multicast works for me.
Without these features osmo-bsc would reject the OML connection
if it's configured with [E]GPRS enabled.

Change-Id: I5e13c153805c56904e51d222007228e1c2872c88
Related: OS#5500
2023-03-11 06:57:13 +07:00
Oliver Smith a023df5c7f gitignore: add vty pdf
Change-Id: I8653d5521680bb6ac2b32371b5428263082bc7f3
2023-03-10 10:18:41 +00:00
Pau Espin a21545e374 pcu_sock: Submit all DATA.ind regardless of link quality
osmo-pcu requires to get DATA.ind for all FN/TS it manages in order to
tick its internal FN clock and trigger timeouts. Without this, some
events are ticked in a delay fashion when osmo-pcu detects FN jumps.

Change-Id: I8f1856dd9061c1bfca8b15be30df7a51760231b0
2023-03-09 17:52:53 +00:00
Pau Espin 72f991f541 bts-trx: Fix no NM Radio{Carrier,Channel} switching to Enabled if one TRX is rf_locked
Differentiate in each TRX between being provisioned (configuration available) and being provisioned *plus enabled*.
TRX0 waits for all other TRX to be ready before sending POWERON, since
all TRX need to have been minimally configured over TRXC before POWERON
is called. This "ready" state though, doesn't necessarily mean the
TRX!=0 are enabled (aka NM Enabled and rf_locked=0). With them being
configured it es enough to start the whole PHY.

With the old logic, given any TRX was rf_locked=1 at startup, the PHY
would not become UP because it the TRX_PROV FSM was waiting for OPSTART
to arrive on all TRX, which wouldn't happen on TRX that had rf_locked=1.

So in summary, the desired requirements to start the PHY are (in any
order):
1- Wait all TRX are configured
2- Wait for TRX0 OPSTART

Related: SYS#6370
Change-Id: Ie4836f5721ce8227a63c267730aeb17228994214
2023-03-09 11:27:51 +01:00
Philipp Maier a981e28128 pcu_sock: do not mess with the osmo fd flags directly
When we disable the old socket connection, let's use
osmo_fd_read_disable().

Change-Id: I6b6854e9881c79b5c4794bde4ba4f6841dd06386
2023-03-07 14:09:53 +00:00
Vadim Yanitskiy c48b4651a1 GSMTAP: print 'gsmtap-local-host' if not NULL
Change-Id: If4f5a419b5af3f185219a879dcb2abb4eea45f1c
Fixes: f19f5331 "GSMTAP: allow configuring local address"
2023-03-07 20:32:36 +07:00
Vadim Yanitskiy fa109255ac osmo-bts-{trx,virtual}: set rc on error in bts_model_l1sap_down()
Change-Id: If3016bae9d03a9972c04b748fc9efab56a412e0e
Related: OS#1572
2023-03-07 09:43:21 +00:00
Vadim Yanitskiy 69bca44a84 osmo-bts-{trx,virtual}: check lchan against NULL in bts_model_l1sap_down()
Even though it's unlikely, get_lchan_by_chan_nr() *may* return NULL.

Change-Id: I1a815c9675eebc16640b62308499dd784fc206bd
Related: OS#1572
2023-03-07 09:43:21 +00:00
Vadim Yanitskiy 54840a203b osmo-bts-{trx,virtual}: clean up bts_model_l1sap_down()
Having a common body for PRIM_INFO_{ACTIVATE,DEACTIVATE,MODIFY},
but then branching using if-statements is a bit confusing.

Change-Id: I915c8a541249249e3c0b1f2eda4535e7c52db79f
Related: OS#1572
2023-03-07 09:43:21 +00:00
Philipp Maier 66bcdd839c pcu_sock: cosmetic: remove unnecessary line breaks
Change-Id: I8cb2979c62ebb05d06af49b40b145b7dee826cb1
2023-03-06 12:43:50 +01:00
Philipp Maier cc13ea8b66 pcu_sock: cosmetic: remove whitespace after type cast
Change-Id: I373b510efab4874f59f75385bd0e1229692299ec
2023-03-06 12:26:46 +01:00
Philipp Maier bdc438299b pcu_sock: rename rc to fd
The variable rc holds the return code of accept(), which returns a file
descriptor on success. So lets call the variable "fd" to make this
clear.

Change-Id: Ibc359d941786b1d1d52b356e239a76a090b52c1f
2023-03-06 12:23:08 +01:00
Max f19f533139 GSMTAP: allow configuring local address
Change-Id: If047cbaf95b343ee115690bf7a724a8edc5df735
2023-03-04 11:24:37 +00:00
Max af9466159e osmo-bts-trx: use bool for true/false flags
Change-Id: Iaa97dc36e92797db5f348e0bb79d2191ca0a58b5
2023-03-04 11:18:42 +00:00
Max 633c09ee50 osmo-bts-trx: log TRXC/TRXD connection address
Change-Id: Id53c1dd58b95c45f261fa9bfae16cc53b20edd18
2023-03-04 11:18:42 +00:00
Vadim Yanitskiy dfe96b786f paging_add_imm_ass(): remove meaningless from_pcu argument
A request to send an Immediate Assignment over the PCH (not AGCH)
is always coming from the PCU.  It's used for DL TBF assignment.

Change-Id: If4b0aa01532ab65b96201ff8829e724c67df6993
2023-03-01 03:01:46 +07:00
arehbein d28ce3287f doc: Adapt to use of 'telnet_init_default'
Related: OS#5809
Change-Id: I1ae5a7169d864e5dbd052437addd167ffa2c510d
2023-02-25 02:04:18 +01:00
Max 495cf39cb9 bts-virtual: fix segfault
Premature activation of virtual scheduler in bts_model_phy_link_open()
leads to segfault in vbts_sched_start(). Fix this by moving scheduler
activation to bts_model_oml_estab()

Change-Id: I116c2548dd4d05df90c16e81fa2e85ed6027a2e1
2023-02-19 18:56:56 +03:00
arehbein 2f6e105956 common: Fix memleak in get_smscb_block()
Fix condition `block_nr == 4`, which was never reached, by effectively
replacing
 - `4` by `msg->num_segs`, so we truly check if the current
   block is the last of this message
 - the index `block_nr` (which starts at zero) by `block_nr + 1`,
   so it is comparable to `msg->num_segs`

Related: OS#5354

Change-Id: I3dc116d6c16c80b31712b2a969f0b2a6998b03f0
2023-02-10 19:56:53 +00:00
Pau Espin c66b812c16 Bump version: 1.5.0.64-7571-dirty → 1.6.0
Change-Id: Iaa207d4996a00befd99194c65fc6e6cd9dbaa340
2023-02-07 17:15:53 +01:00
Max 757180beba Add SI10 support
Related: OS#5783
Change-Id: I268ba716ded330a024a8f3c0d1bd2f28622cecab
2023-02-01 11:12:32 +00:00
Philipp Maier f1b7ee6a63 pcu_sock: use ARRAY_SIZE rather then magic number
Lets use ARRAY_SIZE instead of magic number (8) to determine the
number of timeslots to iterate.

Change-Id: I0e016e6fff420851dfabebef5d8d43c735b968b2
2023-01-31 18:12:27 +01:00
Pau Espin 809879daae vty: Fix typo in symbol name
Change-Id: Ib33ffba348d6e9414eb904bfb7a2bd7ba2f55344
2023-01-30 14:19:52 +01:00
Oliver Smith 0701788724 contrib/jenkins: build libosmo-abis without dahdi
Looks like this is not needed, so make the jenkins build work without
installing dahdi-source.

Related: OS#5863
Change-Id: I61c483983a4793e0429bb37804dee0a128125daf
2023-01-18 14:29:54 +01:00
Pau Espin 0336b6e8e5 vty: Fix typo in write-config: osmux / local-port
The VTY command is "local-port", but write-config would write "port"
instead, which would fail when re-reading the config file.

Realted: SYS#6237
Change-Id: Id08530b626b0e69c3b3bb9d8bb9e16080a73e74d
2023-01-03 16:30:09 +01: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
Max 6a6a47f554 ctrl: take both address and port from vty config
Change-Id: Ieca05004255c40287e6427560c2636b39529cf07
2022-12-22 09:40:08 +00:00
Daniel Willmann 63baf960c6 shutdown_fsm: Add power_ramp_force() to jump straight to the tgt power
Both power_ramp_start() and power_ramp_force() are now small macros
around _power_ramp_start()

The new behavior is:
* ramp down power when stopping bts through Ctrl-C
* the other shutdown causes skip power ramping

This will cause the bts to reconnect faster when the oml link is
dropped and power ramping is enabled.

Change-Id: Ida1d7bbf094958b9142af306dbf84206729a609e
Related: SYS#6237
2022-12-21 23:51:51 +00:00
Oliver Smith 7377344771 oc2gbts_mgr_calib: fix build against gpsd >= 3.20
Fixes: OS#5832
Related: https://gitlab.com/gpsd/gpsd/-/blob/release-3.20/gps.h#L63
Change-Id: I6dc8ce303e5cb0fb412857a7f2c925e8cfe9b1e0
2022-12-21 10:43:48 +00:00
Alexander Couzens c8e2b021a9 OML: NSVC[1] MO should have the same initial state as NVSC[0]
There is no reason why they should have different initial
states. Keep it consistent with the other MOs.

Change-Id: I9fd744ec79da9fc26d3ebe9857b2b0bbd5fcd1ff
2022-12-19 22:01:45 +01:00
Daniel Willmann 300b72b44c Revert "shutdown_fsm: Only ramp down power when stopping bts through Ctrl-C"
This reverts commit c96d34f828.

Reason for revert: This breaks ramping up power since the power ramp logic still assumes the output is full power.

Change-Id: I47a16a4b3ba02d74473569c0f4350a41fc12a464
2022-12-17 13:21:17 +00:00
Daniel Willmann c96d34f828 shutdown_fsm: Only ramp down power when stopping bts through Ctrl-C
For the other shutdown causes power ramping doesn't make sense. Instead
shutdown quickly so we can reconnect faster

Change-Id: I71c46478b8f3b236dba3e959fc75e58c0409517f
Related: SYS#6237
2022-12-15 11:26:22 +01:00
Philipp Maier c2261bb62e pcuif_proto: use define constant to specify nax number of trx
The array of trx in gsm_pcu_if_info_ind can hold trx 8 items. Lets use a
define constant to specify the size of that array.

Change-Id: I5fdd5b9e59865fabd0340650ecb347d52208ebe9
2022-12-14 12:43:50 +01:00
Philipp Maier 82d92f703a l1sap: remove unused pointer variable
The pointer variable l1sap is only used to determine the size of the
related struct but for nothing else.  We can use the struct name in
sizeof also directly and get rid of it.

Change-Id: I93abdce1dec60d53ddceb1fce6e9e7451ba6283a
2022-12-08 17:02:13 +01:00
Philipp Maier ffe2b28c9b sched_lchan_tchf: replace numeric constant with define constant
An RFC 5993 HR GSM payload is 15 bytes long. That is GSM_HR_BYTES + 1

Change-Id: I7008ba7e50562e9366fd9ecc97e2e22fad4aa641
2022-12-08 17:02:05 +01:00
Pau Espin 5b9a5f569a osmux: Use new osmux_xfrm_input API to set name on each link
Change-Id: Iaea980a2e11282add12f9af585500d90f0462279
Depends: libosmo-netif.git Change-Id 8bb688e4827f345416c2a4526ced956a07fcc60b
2022-11-21 10:51:33 +01:00
Pau Espin 035080e4f4 osmux: Rotate over available Osmux CID when allocating a new one
Before this patch, the free CID with the smallest number was always
selected to be used. This caused more or less the same subset of CIDs to
be used all the time, while the CIDs with bigger numbers were mostly
unused.
Let's distribute the use so that all CIDs are used roughly the same.
This has the advantage, among others, that the same CID will not be
re-used immediatelly after being freed if a new call is established.
It is useful to leave the CIDs unused for some time since the other end
peer may know of the call being tear down with some delay.
Hence if a new call is established immediately after the CID was
released, the same CID would be allocated and passed at the peer, which
would then detect that the old call (in its view still active) would
already make use of that remote CID.

Related: SYS#6161
Change-Id: I72803fb172accbabfc81923572890f8ecb06cefd
2022-11-15 18:10:14 +01:00
Harald Welte a590b1a15a update outdated vty copyright statement
Change-Id: Ia12a012c229f883286e96a90132adcc5e8c0c5da
2022-11-11 18:22:45 +01:00
Max eba8816d51 Update realtime scheduling priority in service file
Related: OS#5687
Change-Id: I64a8c1e9c5b4ca7b51956d195964124d3a8ef768
2022-11-06 12:49:28 +00:00
Vadim Yanitskiy 8ec66a7f58 osmo-bts-trx: drop ul_amr_fn_is_cmi() / dl_amr_fn_is_cmi()
The scheduler is now using the lookup tables instead of these
functions.  The only part using them is the AMR unit test.

Change-Id: I1a9c80dd12252e7befe9c9bc8e8f7ee8648b5465
2022-11-01 01:09:20 +07:00
Vadim Yanitskiy c33ff98d39 osmo-bts-trx: use lookup tables for checking AMR CMI/CMR on Downlink
Change-Id: I75ecf5369f31c8b8e9519d2b580355fa80c24196
2022-11-01 01:04:25 +07:00
Philipp Maier aa8779b824 pcuif_proto: cosmetic: add constant PCU_IF_NUM_NSVC and replace magic numbers
The number of NSVCs is fixed but lets not use magic numbers to define
the sizes of the arrays that hold the config values. In osmo-pcu there
is already a define constant, so lets use a define here as well.

Change-Id: If7fa44abb86c18900110d7ee81fe6140c8c4635b
2022-10-31 10:22:17 +00:00
Pau Espin 764820e742 osmux: Fix null ptr dereference sending UL data before the remote is configured
Related: SYS#6161
Change-Id: I5d7971c0ed9b22d35d8965af54031a43c6388762
2022-10-29 01:06:27 +02:00
Keith Whyte 77fd0a589c osmo-bts-trx: respond to tx-attenuation config in real time.
Some osmo-bts varieties have a method to make an immediate change to
TX power from the vty. In osmo-bts-trx there does not seem to be any
way, so lets start the power ramp loop when the parameter
osmotrx tx-attenution is changed on a running TRX.

Change-Id: I1fa5e8130202fb509593db4132863b762b0f40b7
2022-10-13 14:34:15 +00:00
Philipp Maier ea35b26b35 rsl: use unsigned int
The parameter l3_len in rsl_tx_meas_res() is defined as int, even though
it can't be negative. Lets use unsigned int for l3_len.

Change-Id: I99068a36e74a557000f406154dce32300615086c
2022-10-12 18:20:14 +07:00
Philipp Maier 59e147e7ad l1sap: do not call msgb_l2hlen without checking
We request the length using msgb_l2len() in two locations where whe
cannot be sure that l2h is populated. Lets check this first.

Change-Id: Ie13d0724f183ff240714dcdbd24e5a21b4276bfe
Related: OS#5645
2022-10-12 18:19:25 +07:00
Philipp Maier 0087a1137e measurement: do not call msgb_l3len without checking
The function lchan_meas_handle_sacch() calls msgb_l3len without checking
if l3h is even populated. Lets add a check to be sure.

Change-Id: Ie5a9fe1ba880e68edb74f5f4ca559ac191330d4f
2022-10-11 11:45:14 +02:00
Vadim Yanitskiy 2950c0363d osmo-bts-trx: handle MTS 0b0110 indicating an Access Burst
The PCU may poll the MS requesting an ACKnowledgment message to be
sent in form of four Access Bursts instead of Normal Bursts.  The
BTS has no prior knowledge of the Uplink burst type, so a new MTS
value was specified in order to prevent the BTS from trying to
decode Access Bursts as a PDTCH block.

This patch implements parsing of the new MTS value 0b0110.
Signalling RACH.ind to the PCU is to be implemented.

Change-Id: I0fbb63006797e6be386d1f76ed97fff098c036fc
Related: OS#4006, SYS#4794
2022-10-04 16:33:10 +00:00
Vadim Yanitskiy 493ff0000b osmo-bts-trx: rx_rach_fn(): properly detect handover RACH
Checking if (bi->chan != TRXC_RACH) is not enough to detect HANDOVER
ACCESS.  Receiving this message is only possible on CS channels.

Change-Id: Ice1674fd4fed8c54d605ff19d568f6e46b4c5783
2022-10-04 14:57:57 +00:00
Pau Espin 8396471638 osmux: Close osmux socket when bts is freed
Related: SYS#5987
Change-Id: Ibd3faa33b28d45048c340b177f13d5685f41a784
2022-10-04 16:12:38 +02:00
Pau Espin 0db38d6521 osmux: Skip lchans in lookup which still have no remote associated
Lchans which are marked as non-connected have not yet received
information about its remote peer, hence they may not have some fields
available yet. Let's skip them to avoid accessing such fields
(lchan->abis_ip.osmux.in).

Related: SYS#5987
Change-Id: Id53822c4a0486b0090df2db3d185e047d14fc90a
2022-10-03 18:54:11 +02:00
Pau Espin 943ef9665e osmux: nullify osmux.rtpst after freeing it
Change-Id: I806cbe42cfc8fe59134ae842f3d7398acb1a1848
2022-10-03 18:43:52 +02:00
Pau Espin 65f63a55c7 osmux: Lower log level when osmux batch received for unknown CID
This is actually quite common, since our peer may be sending some osmux
packets to us a while after we have closed the conn on our side,
specially if latency is high in the network (eg satellite links).

Related: SYS#598

Change-Id: I102047685b9b9f4cba43970945f955c4fe9c4c95
2022-10-03 18:29:34 +02:00
Pau Espin b73c46ae97 osmux: Log remote address upon rx of osmux pkt
Related: SYS#5987
Change-Id: I391bc02a16eae1602680cb96128252f262852e14
2022-10-03 18:26:00 +02:00
Pau Espin 3fd60a5784 osmux: Match remote address in osmux_lchan_find()
Related: SYS#5987
Depends: libosmo-netif.git I95433b18802f73fa70e758f4aa02128eee940d88
Change-Id: I6813686b55fc3a74f1676a7965186e1e5fa00481
2022-10-03 18:24:36 +02:00
Pau Espin 53e566247d osmux: Drop logging of osmux internal counters
This way we have no more access to internal osmux structures.
If those counters are needed in the future they can be counted by
osmo-bts by means of adding rate counters to the caller of
osmux_xfrm_input() and deliver_cb.

Change-Id: Ib952437ea3aa2770c96bddb667491e7675a6a06e
2022-09-29 14:38:57 +02:00
Pau Espin fd356bdcd2 Allocate struct osmux_in_handle through new libosmo-netif APIs
Depends: libosmo-netif.git I752ab031f935f04731bb1a354333f1682a1aa5bd
Change-Id: I132a7c03213cb20dfe118616c8cfd7032b075507
2022-09-29 14:25:04 +02:00
Philipp Maier ae6ae89a19 pcu_sock: fix sourcecode formatting
Change-Id: Ib88173363fc11ad44a5bdbcd85ea8ca075db7997
2022-09-26 13:02:34 +02:00
Pau Espin 8cfb8bcc6c vty: Print Osmux CID on lchans using Osmux
Related: SYS#5987
Change-Id: Ide6edefda828e9ce04fbb60cf547857f322d5f40
2022-09-22 13:26:44 +02:00
Pau Espin ff5c8787dd vty: Fix SPEECH_MODE printed with hex prefix but dec value
Change-Id: I597ff582f47b00d895611eae8a810fe3ebfe8339
2022-09-22 13:25:49 +02:00
Pau Espin bbec5df6c7 lchan: Reset Abis RTP/Osmux config during lchan release
Otherwise some shared variables used by both Osmux and RTP was left set,
like connect_ip and connect_port, and next time the lchan was selected,
those were already configured even if they didn't come in IPAC CRCX.
This is specially bad if the channel was reused to set up an Osmux call,
since the osmux code path relied on those fields being properly reset
until set by IPAC CRCX.

Change-Id: I414bd0bc801451357bb45b89197a95e51b7c97f1
2022-09-20 17:33:07 +02:00
Pau Espin 9108eed3e4 osmux: Log sendto() error
Change-Id: I195ebe0fdb05195a7f3b1390630e83084b5dea3a
2022-09-20 16:55:42 +02:00
Pau Espin cd3d71b318 abis: Avoid TCP/IPA RSL sockets continue conn establishment while shutting down
when something fails in osmo-bts during startup and it goes into SHUTDOWN state,
it is desirable to close new RSL links (sockets) which are in progress to connect,
while it waits for a while to complete shutdown (power ramping down, etc.).
This way we don't end up with new interactions and new state against a BSC if we
are shutting down.

The new libosmo-abis API is used since the higher layer struct e1inp_sign_link assigned
to each struct gsm_bts_trx is not provided to the osmo-bts code layer by libosmo-abis API
until the TCP+IPA handshake in the socket becomes fully established (sign_link_up()
callback).

Depends: libosmo-abis.git Ia6418321f3b6f1f7274efd414625a4b10a09a362
Change-Id: I599d074f51f490b43c9a89b105d1823391926947
2022-09-16 20:56:00 +02:00
Max e826d78399 Document realtime options in .service units
It's not immediately obvious what numeric values mean for CPU scheduling policy.
Let's document this and add doc reference.

Related: OS#4107
Change-Id: Ib047762a336851e6205d77c83068a99d8a868e8b
2022-09-16 01:16:29 +00:00
Max 9b7a48421c Don't manually create pid file
Previously osmo-bts created /var/run/osmo-bts.pid which
isn't used by anything and makes it hard to run as non-root
user. Let's get rid of this pre-systemd relic.

Related: OS#4107
Change-Id: I86bcaedbc8cb1297476ad741eaa45585fea3c380
2022-09-14 08:30:11 +00:00
Pau Espin 2201900f94 Introduce Osmux support
Related: SYS#5987
Requires: libosmo-netif.git Change-Id I632654221826340423e1e97b0f8ed9a2baf6c6c3
Change-Id: Ib80be434c06d07b3611bd18ae25dff8b14a7aad9
2022-09-13 17:32:22 +02:00
Pau Espin 0908c7da22 oc2g: Makefile.am Fix typo in LIBOSMONETIF_LIBS
Change-Id: I6d316ffaff0ad7881b694f4d6427434bb9a0684c
2022-09-12 17:35:01 +02:00
Pau Espin d48d4beb56 tests/*/Makefile.am: Add missing libosmo-netif cflags
Change-Id: I7a2a846c2d68a4d6d77c4be62969238069d6cf95
2022-09-12 13:29:52 +02:00
Pau Espin 1176d1a626 tests/*/Makefile.am: Fix typo in LIBOSMONETIF_CFLAGS
Change-Id: I29d52bdacdebc0495d11425399e796fa7aef3ac4
2022-09-12 12:51:30 +02:00
Max 0ccd8781b1 Set working directory in systemd service file
By default systemd will execute service with root directory
(or home directory for user instance) which might result in
attempts to create files in unexpected place. Let's set it
to 'osmocom' subdir of state directory
(/var/lib for system instance) instead.

Related: OS#4821
Change-Id: I4b7bcd441e5da81c4c5267715675041171a1ce1e
2022-09-09 20:46:33 +07:00
Pau Espin e9bdd73fdc Clarify RTP AMR header offset in TCH enc/dec
This helps understand the origin/purpose of those 2 bytes and
what's contained in them.

Related: SYS#5987
Change-Id: I607fdf6d627242e010fba35be1b9b0ffde820d08
2022-09-07 10:22:01 +02: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 ebecff4a5a cosmetic: Fix formatting of if-else block brackets
Change-Id: Ifec6674ba04109f6b8a039679caff08f060d83d9
2022-09-01 17:05:20 +02:00
Vadim Yanitskiy 52da5b6f64 osmo-bts-trx: fix handling of ciphering params in PRIM_INFO_MODIFY
The PRIM_INFO_MODIFY is sent on receipt of the RSL MODE MODIFY message,
which may optionally contain new ciphering parameters.  Before this
patch, osmo-bts-trx would ignore the new parameters and continue using
the old ciphering key/algorithm.

* Modify l1if_set_ciphering() to allow updating ciphering params.
* Call l1if_set_ciphering() when handling PRIM_INFO_MODIFY.

This problem was uncovered by BTS_Tests.TC_rsl_modify_encr, which has
been failing ever since it was introduced [1].  This patch makes it pass.

Change-Id: I2278703b487374c0de4cfc42b22e70aaf6548589
Related: [1] I4cbea499bb6a331d314e6573548a4540945208b5 osmo-ttcn3-hacks.git
Related: OS#3750
2022-08-27 18:56:33 +07:00
Pau Espin 755546028e Move lchan_dl_tch_queue_enqueue to lchan.c and make it public
It will be used too by osmux code present in another file. This is a
preparation commit to simplify the one adding osmux support.

Change-Id: Ie7fa57bb04db9ad9b03971467e12ee7b8e4c190a
2022-08-11 23:04:46 +02:00
Pau Espin fff806bc92 rsl: Reduce scope of variable
The function is long/complex enough, so having one extra struct in_addr
declared the function top only used in one specific small path to print
the variable is unnecesary.
Let's move it to the conditional path where it is used to print the
ip address.

Change-Id: I4c16bbca6a6779537517b6b196828b47eddaa516
2022-08-11 23:04:46 +02:00
Pau Espin 7593cc743d Use libosmocore API msgb_queue_free() to free lists
There's no need to maintain a duplicate msgb_queue_flush(), which
returns the amount of freed messages (feature not used at all by the
callers).

Change-Id: I9841e18ca0b7b852130bbb02a510e43a3b3fd93f
2022-08-11 23:04:46 +02:00
Pau Espin 9ea93c7e20 Avoid counting lchan->dl_tch_queue length every time a msg is enqueued
The queue_limit_to method iterates the entire list of messages every
time a new message is added. Let's use msgb_{enqueue,dequeue}_count()
APIs to do that in constant time. It is true that since the queue is
limited to 1, there's usually at most 1 item in the queue so it's not a
real problem. However, when we add Osmux in the future, we may need to
tweak the amount of messages which can be in the list, due to Osmux
batching mechansim which may be more bursty sometimes.
In any case, this change doesn't make things worse for sure.

The patch also takes the chance to group the queue_limit_to + enqueue
into one function to avoid having the code spread several times.

Change-Id: I61818a3bb521c27bd21a8b6fa70581d27638ec9b
2022-08-11 23:04:35 +02:00
Pau Espin 5a1b14fa4f Split out lchan rtp socket creation from rsl handling code
This makes the code more clear, as well as allows adding Osmux in the
future.

Change-Id: Iade43fde7f6113f9d68539f7d6cc9843783c2b3f
2022-08-11 21:02:06 +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 311f9ffcf8 logging: Move category descriptions to be in order with enum
Change-Id: I3a1922fcd695e08ca42ece8cf0a1804d1a00f450
2022-08-10 18:12:44 +02:00
Pau Espin db8a676844 rsl: rx ipac crcx/mdcx: Log payload_type2
Change-Id: Id3afee50aa112051aacb9016183a78374e5ba7fc
2022-08-10 16:25:48 +02:00
Vadim Yanitskiy 541b7525ae osmo-bts-trx: amr_loop: trigger the loop unconditionally
The logic responsible for enabling and disabling the loop appears
to be broken: during my experiments trx_loop_amr_set() was never
called with loop=1.  It's not clear what's the motivation behind
this breaker, so I propose to rip it out for now.  This patch
finally makes the loop work (confirmed with a TEMS phone).

Change-Id: I09b649973d4269c4082a4fafa493c37825f95a9c
Related: SYS#5917, OS#4984
2022-08-08 05:43:20 +00:00
Vadim Yanitskiy a5a150c7ee osmo-bts-trx: call osmo_timer_del() unconditionally
osmo_timer_del() does check if a timer is active internally.

Change-Id: I16dca28120061ffc1f118d1e4a1ea986c1639bf7
2022-07-22 03:42:28 +07:00
Pau Espin 7243cada6a Bump version: 1.4.0.103-b8ae-dirty → 1.5.0
Change-Id: I920a834912cd6da66daae6a896f0789059698ba0
2022-06-29 09:41:38 +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
Harald Welte b90e1ef2d0 update git URLs (git -> https; gitea)
Change-Id: Ibd00975142ee6a2ca96453d7baf5b7164ccdd289
2022-06-18 11:39:25 +02:00
Vadim Yanitskiy 2baf54dd46 Revert "osmo-bts-trx: rx_tchf_fn(): do not treat AFS_SID_UPDATE as SUB frame"
This reverts commit 1f9fbd8816, which
was a workaround rather than a proper fix.  The root problem has
been fixed in libosmocoding [1], so ~50% BER is not the case for
AFS_SID_UPDATE frames anymore.

Related: I813081a4c0865958eee2496fe251ae17235ac842 (libosmocore.git)
Change-Id: Iebe139632daf1d1f72e39fe9d1497059f68625b9
2022-05-17 03:32:21 +03:00
Vadim Yanitskiy 1f9fbd8816 osmo-bts-trx: rx_tchf_fn(): do not treat AFS_SID_UPDATE as SUB frame
We have two similar values in enum gsm0503_amr_dtx_frames:

  * AFS_SID_UPDATE - precursor of SID UPDATE,
  * AFS_SID_UPDATE_CN - the actual SID UPDATE.

The former is internally used by libosmocoding to mark the current
frame as a precursor of the actual SID UPDATE frame - the later.

  +---+---+---+---+---+---+---+---+
  | _ | _ | _ | _ | a | b | c | d |  AFS_SID_UPDATE
  +---+---+---+---+---+---+---+---+
  | a | b | c | d | _ | _ | _ | _ |  AFS_SID_UPDATE_CN
  +---+---+---+---+---+---+---+---+
  ^
  |
  | We're here.

Do not treat the precursor frames as a SUB frames, as they contain
no information (rc=-1) and usually have *expected* BER ~50%.  This
fixes unexpected RXQUAL-SUB > 0 in the Uplink measurements during DTX.

Change-Id: I46f32bbbcb6284615d05b8703945c5ca4da55b92
Related: SYS#5853
2022-05-15 08:10:10 +00:00
Vadim Yanitskiy 284f16e7d7 measurement: fix matching of SUB frames by TDMA FN
3GPP TS 45.008, section 8.3 defines active TDMA frame subsets for
TCH channels, which shall always be transmitted even during the
silence periods in DTX mode of operation.  Each frame number
listed in this section corresponds to a single burst.

The Uplink measurements always contain TDMA FN of the *first* burst
of a block, so it does not make sense to match the given FN against
all FNs in the respective subset.  Instead, we should match only
specific FNs in accordance with the block mapping rules defined in
3GPP TS 45.002, section 7, table 1.

In the active subset for TCH/F there is only one *complete* block
starting at FN=52.  Incomplete blocks {52, 53, 54, 55} and {56, 57,
58, 59} contain only 50% of the useful bits (partial SID) and thus
~50% BER, so we don't treat them as SUB.

In the active subsets for TCH/H there are two *complete* blocks
for each sub-slot.  Their respective first FNs can be efficiently
defined in a lookup table (see ts45008_dtx_tchh_fn_map[]).  Note
that we can use a single lookup table for both sub-slots of TCH/H
because their TDMA FNs do not overlap.

This patch fixes unexpected SUB-RxQual values > 0 on TCH channels
with DTXu enabled and other than AMR (HR, FR, EFR) codec in use.

Change-Id: I8cc3a755a8ad4dc564439aab2298c1e97ac0592d
Related: SYS#5853
2022-05-10 16:49:16 +03:00
Vadim Yanitskiy 991f3f64d9 measurement: move SACCH detection to process_l1sap_meas_data()
SACCH detection can be simplified by checking the RSL Link ID in
process_l1sap_meas_data().  This eliminates the need to lookup
the multiframe position by calling trx_sched_is_sacch_fn(), which
definitely takes more CPU time than just L1SAP_IS_LINK_SACCH().

Calling trx_sched_is_sacch_fn() is still required for BTS models
reporting the measurements via PRIM_MPH_INFO (legacy way),
separately from the related Uplink blocks.

This patch can be summarized as follows:

* detect SACCH and set .is_sub=1 in process_l1sap_meas_data();
** for PRIM_MPH_INFO use trx_sched_is_sacch_fn();
** for PRIM_PH_DATA use L1SAP_IS_LINK_SACCH();
* do not call trx_sched_is_sacch_fn() from ts45008_83_is_sub();
* modify the unit test - test_ts45008_83_is_sub_single();
** remove test_ts45008_83_is_sub_is_sacch().

Change-Id: I507e96ee34ac0f8b7a2a6f16a8c7f92bc467df60
Related: SYS#5853
2022-05-10 16:30:39 +03:00
Vadim Yanitskiy 0ad31d8956 measurement: log SUB/FULL as text in lchan_new_ul_meas()
Change-Id: Idfaf8ad2ac0fd4da57a0981563e6ad6104fa4e41
Related: SYS#5853
2022-05-10 01:19:18 +03:00
Vadim Yanitskiy 7bf970ede4 tests/meas: improve test_ts45008_83_is_sub_is_sub()
This function should also take lchan type into account.

Change-Id: I6920a04e0a6c846647fa1b6b3a3c80bbd6617b99
Related: SYS#5853
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy d399f49261 tests/meas: improve logging in test_ts45008_83_is_sub_single()
* Print unexpected TDMA FNs, each on a separate new line.
* Do not abort() on mismatch, keep running.

Change-Id: I32c104b139f32a39c8347de19de6ad7caec811de
Related: SYS#5853
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy 523b6de593 struct bts_ul_meas: reflect C/I units in field name s/c_i/ci_cb/
Change-Id: If07f7f2a3ea996cbfc6a9087fa34402e38a7fd9f
Related: SYS#5853
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy cf09b0cb50 scheduler: trx_sched_is_sacch_fn(): make ts pointer const
Change-Id: I48a1a549d7c1553bccaa01cdc818873a4c6cdf0a
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy 8aab8d484b osmo-bts-trx: drop Uplink loss detection from Downlink path
Attempting to detect missing Uplink frames in the *Downlink* path
is an ugly hack, that was needed before we had proper per-lchan
detection of missing bursts and NOPE indications in TRXDv1.

* [1] per-lchan detection of missing bursts was fixed in Aug 2018.
* [2] TRXDv1 support was introduced in Jul 2019.

Today is 2022 and it makes no sense to keep this hack.  Even if
the transceiver does not support TRXDv1, per-lchan detection
will compensate the missing Uplink bursts.

Change-Id: Ic292d180ba64206fb4d88adb284f9f9d058b4587
Related: [1] I70d05b67a35ddcbdd1b6394dbd7198404a440e76
Related: [2] If61c71d20d590bf07bfd019afb33000a0b6135bd
2022-05-06 12:55:18 +00:00
Vadim Yanitskiy 4cbc2acde8 pcu_sock: comment out {dl,ul}_tbf_ext related warnings
The gitlog shows that these warnings were added in
744f745d7a by jolly (in 2012!).

As nobody has bothered for the past ten years, degrade them to comments.

Change-Id: Iebf9961cffbd7aa20b263f7dc0016a44782dec60
Related: osmo-bsc.git I9ef7e18f56aa86b48f0ffeec58406260736170f3
2022-04-29 13:32:04 +03:00
Vadim Yanitskiy e178269890 osmo-bts-trx: rx_{tchh,tchf}_fn(): improve logging of AMR DTX frames
Change-Id: I0ec06113fff2a89d7810cd4d8c26d6e0c74f93bd
Related: SYS#5853
2022-04-29 08:02:30 +00:00
Oliver Smith d99e20f97a src/common/bts.c: set BTS_FEAT_CCN
OsmoBSC assumed since If91d85331d402c3ab9c32b70c2c66cd7ba6ceb28 that
OsmoBTS has CCN (NACC, Network Assisted Cell Change). With OsmoBSC
Idf2d933aa8b03b1f708e56a08707fe6c620a97aa, instead of hardcoding some
features for OsmoBTS in OsmoBSC, only the features reported by the
BTS are used. Therefore report that BTS_FEATURE_CCN is supported in
OsmoBTS.

For previous OsmoBSC versions, this fixes the message:
  Get Attributes Response: reported feature 'CCN' is not supported, while we thought it is.

Related: SYS#5922, OS#5538
Change-Id: Ic407e3be82afe61ed64b1cecf3dc94d2caff380a
2022-04-26 15:15:05 +02: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 8630f898b2 model_init: order features alphabetically, part 2
Order the ones I've overlooked as well.

Related: SYS#5922, OS#5538
Change-Id: I0aa344de9ea4849de0fcd7b44bfaa70274af594b
2022-04-25 11:14:30 +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 11fb108221 osmo-bts-trx: check if scheduling of [dummy] FACCH/H is allowed
Currently (without this patch) if tch_dl_dequeue() yields nothing we're
scheduling dummy FACCH/H *regardless* if it's permitted to start at the
given TDMA FN or not.  This may result in misaligned FACCH transmission,
so the MS will not able to decode anything and will report BER>0.

With this patch applied we schedule FACCH/H if it's allowed to start
at the current TDMA FN;  otherwise send half-filled bursts with even
numbered bits contaning 232 encoded bits of the previous L2 frame
and 232 odd numbered bits all set to 0.

This patch does not guard against sporadic gaps in the Downlink TCH
queue.  However when tch_dl_dequeue() constantly yields nothing, e.g.
when we end up with a codec mismatch, then this additional check saves
us from starting misaligned FACCH/H transmission.  If we start at a wrong
TDMA offset, then all subsequent FACCH frames will be scheduled at wrong
offsets and thus none of them will be decoded by the MS.

Change-Id: I6f8af140a6ccf3d5fd7b98f6cb5c18e2c5e2f61b
Related: SYS#5919, OS#4823
2022-04-21 06:23:48 +00:00
Vadim Yanitskiy 0fb9517fed VTY: fix NULL-pointer dereference in 'show transceiver'
Change-Id: I403a027f064a4898eb74a11381bab3c884ec8ccf
2022-04-21 00:23:05 +03:00
Vadim Yanitskiy 1422a80cae osmo-bts-trx: fix scheduling of dummy FACCH/H and FACCH/F
* dl_ongoing_facch must be set for correct FACCH/H scheduling;
* dl_facch_bursts must be set for FACCH overpower to work.

Change-Id: Ief12eb67ad80de3b71f5226858dc2e0c8ae76948
Related: SYS#5919, OS#4823
2022-04-20 19:51:25 +00:00
Vadim Yanitskiy 5a9eaf7088 osmo-bts-trx: tx_tchh_fn(): make handling of FACCH/H cleaner
If set, chan_state->dl_ongoing_facch indicates that we're sending
the 2 (out of 6) middle bursts of FACCH/H.  In this case there is
no room for encoding an additional frame, because both even and
odd numbered bits are occupied by a previously encoded FACCH/H.

Right after calling tch_dl_dequeue():

* do not check the dequeued message against NULL,
* do not compare the message length to GSM_MACBLOCK_LEN,
* immediately free() it and jump to the sending part.

Change-Id: Ib923b8f5cc1063e9fc18acd2bdd003fd09f4b70f
Related: SYS#5919, OS#4823
2022-04-20 19:51:25 +00:00
Vadim Yanitskiy fbbc019f7d osmo-bts-trx: prioritize FACCH in s/tx_tch_common()/tch_dl_dequeue()/s
Unlike SACCH, FACCH has no dedicated slots on the multiframe layout.
It's multiplexed together with TCH (speech or data) frames basically
by replacing (stealing) them.  This is common for both TCH/F and
TCH/H, with the only difference that FACCH/H steals two TCH frames
(not just one) due to a longer interleaving period.

Let's implement the multiplexing in the common function, which is
used to dequeue to be transmitted frames - this slightly reduces
code duplication.  Use a new name, so that it's clear what it does.

Change-Id: I9822b1a17185d5487f0f6d3ed0203e806c053d7d
Related: SYS#5919, OS#4823
2022-04-20 19:51:25 +00:00
Pau Espin 0f3d7ea35b bts-trx: sched_lchan_tchh.c: Workaround gcc false positive error
Manual analysis of code didn't end up in finding any issue, so this
seems a false positive (I can really understand gcc failing to do proper
job here, this function has way to many jumps here and there.

"""
/sched_lchan_tchh.c:88:13: error: ‘rc’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   88 |         int rc, amr = 0;
      |             ^~
"""

Change-Id: Ifebaee63a9dad04976ffb4438c32360687ef095a
2022-04-20 16:09:31 +02:00
Vadim Yanitskiy 8b83a4a70f osmo-bts-trx: amr_loop: do not miss C/I samples
Keep collecting C/I samples even if the MS has not yet applied
previously requested codec mode.  The C/I ratio is expected to
stay more or less the same, no matter which codec mode is used.

Change-Id: Ieb5473ead7200f652b5d0e339e4e252d6567482d
Related: SYS#5917, OS#4984
2022-04-20 15:39:30 +03:00
Vadim Yanitskiy b1d5b8639c osmo-bts-trx: amr_loop: log if AMR mode remains unchanged
Change-Id: I0272d11cfaad0e1c13d2858b3bc61d6527898018
Related: SYS#5917, OS#4984
2022-04-20 15:18:32 +03:00
Vadim Yanitskiy 64192c26e6 osmo-bts-trx: amr_loop: allow upgrading codec mode > 0
With the current implementation the AMR loop is unable to upgrade
the current codec mode unless it reaches the worst possible value.
The problem is in the 'else' statement connection both 'if's.

Change-Id: I4c0fb28813373c3d4addd28c66f5136d2c4f9ed8
Related: SYS#5917, OS#4984
2022-04-20 15:18:32 +03:00
Vadim Yanitskiy 95f2201148 osmo-bts-trx: amr_loop: improve logging in trx_loop_amr_input()
Currently we're logging AMR mode *indexes*, not the actual modes.
Let's make it cleaner for the user by logging both mode and index.

Change-Id: I4feb3a3823799a290a50a48275e45f3331874d1a
Related: SYS#5917, OS#4984
2022-04-20 12:18:08 +00:00
Vadim Yanitskiy 44cb0113cf osmo-bts-trx: use C/I in the AMR link adaptation loop
Change-Id: Ide84bf864f56020c0265cfb9731615d4f7bad7f5
Related: SYS#5917, OS#4984
2022-04-20 12:18:08 +00:00
Vadim Yanitskiy cfabf6275e osmo-bts-trx: amr_loop: simplify trx_loop_amr_set()
Change-Id: Ibeed00ef48450edfe1e0d4e179fb4c777b11beb9
Related: SYS#5917, OS#4984
2022-04-20 12:18:08 +00:00
Vadim Yanitskiy 5c95312487 common: fix coding style: if is not a function
Change-Id: I890d7734c83d108d3c2cd2c7699ace880f13ca8b
2022-04-19 04:04:36 +03: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
Vadim Yanitskiy c350b9a9f6 tests: use 'check_PROGRAMS' instead of 'noinst_PROGRAMS'
When using 'check_PROGRAMS', autoconf/automake generates smarter
Makefiles, so that the test programs are not being compiled during
the normal 'make all', but only during 'make check'.

Change-Id: I18ebb7395024a490da743c0bcb20959e6e9c7017
2022-04-15 01:01:16 +03:00
Vadim Yanitskiy 56585bb351 amr: fix parsing of threshold and hysteresis in amr_parse_mr_conf()
Change-Id: I8febb60b0ad91903c7869871f41d1c123dbe5ce3
Related: SYS#5917, OS#4984
2022-04-13 18:04:20 +03:00
Vadim Yanitskiy 4765a5d195 tests/amr: add a unit test for amr_parse_mr_conf()
This unit test demonstrates a problem in amr_parse_mr_conf(): the
threshold and hysteresis values are parsed incorrectly.  They are
expected to match what we have in amr_fr_bts_mode_def[]:

  Mode[0] = 0/13/4
  Mode[1] = 2/25/4
  Mode[2] = 5/37/4

This will be fixed in a follow-up patch.

Change-Id: Iab7e8878e62f598959e80fcb7e729b7f496962a2
Related: SYS#5917, OS#4984
2022-04-13 18:04:20 +03:00
Vadim Yanitskiy f576e673a3 tests/amr/Makefile.am: use proper binary name prefix 'amr_test_'
Both misc_test_{SOURCES,LDADD} were simply ignored because
binary 'misc_test' is not listed in noinst_PROGRAMS...

Change-Id: Ia1739bab76261ff6d50824462b8ed2e0b34fb464
Related: SYS#5917, OS#4984
2022-04-13 18:04:20 +03:00
Vadim Yanitskiy cf3d314501 rsl: use hard-coded defaults if the MultiRate conf IE is absent
This configuration will be used as a fall-back when the MultiRate
configuration IE is not included in the CHAN ACT/MODIFY messages.

Change-Id: Ie96af636105ee1ffe2d9a0bd9eea375faebad149
Related: osmo-bsc.git Ic5f8d55d250976d8d4c9cae2d89480fd52326717
Related: SYS#5917, OS#4984
2022-04-13 18:04:20 +03:00
Vadim Yanitskiy c02876eae2 osmo-bts-trx: bts_report_interf_meas(): remove unused fn param
Change-Id: Iec25b28e418ce1f66bbc7e0696a3ceebb02e9c82
2022-04-13 15:03:20 +00:00
Vadim Yanitskiy bab872cc0d l1sap: l1sap_chan_act(): remove unused *tp argument
Change-Id: I2030f05b55fc9370e71ff12b26ffe1142f4acfc8
2022-04-13 15:03:20 +00:00
Vadim Yanitskiy 7af62e2d0f l1sap: l1sap_chan_act(): alloc DTX FSM only for TCH
Change-Id: Ieb5728b7a9e7d7c58449deaa5a6c4d8755b6e213
2022-04-13 15:03:20 +00:00
Vadim Yanitskiy 9ae443d368 osmo-bts-virtual: remove unused 'codec_mode_request' argument
Change-Id: If5001d7b19820478d0e88fea3126e5dd4fbd2634
2022-04-13 15:03:20 +00:00
Vadim Yanitskiy 468c9e0a90 rsl: misc / cosmetic fixes for tx_ipac_XXcx_nack()
Change-Id: Ia7367cdfc6e1b1ebaabdf21e0a050fc1543968b2
2022-04-13 15:01:21 +00:00
Vadim Yanitskiy 128039a163 rsl: always check return value of rsl_tlv_parse()
Change-Id: I07cbd2849d83af28eb0458547f0eacc81347df23
2022-04-13 15:01:21 +00:00
Vadim Yanitskiy 851047b759 logging: use a different color tone for DLOOP
Normal blue (34) is really hard to read on terminals with dark
background.  Let's use light blue (94) instead.

Change-Id: Iadc9b8fb74ec17455435893a532c2f12e02cb804
2022-04-13 17:23:55 +03:00
Vadim Yanitskiy ab4ab48178 rsl: parse_multirate_config(): check if AMR codec is used
3GPP TS 48.058 defines the MultiRate configuration IE as optional,
and states that it's "included if the Channel Mode indicates that a
multi-rate codec is used".  If I understand this correctly, it may
be omitted even if a multi-rate codec is requested.  Otherwise it
would have been defined as a conditional IE.

For now let's print a warnig if this IE was expected, but missing.
We may need to apply some hard-coded defaults in this case.

If this IE is present, but the Channel Mode indicates a codec other
than AMR, let's send NACK with cause=RSL_ERR_OPT_IE_ERROR, assuming
that the CHAN ACT/MODIFY message is malformed.

Change-Id: I6ddc0b46a268ed56ac727cda57d0d68b2746fd59
Related: SYS#5917, OS#4984
2022-04-12 02:28:35 +03:00
Vadim Yanitskiy e3ff3bc4e0 rsl: rsl_rx_chan_{activ,modif}: do not sent an Error Report
Sending an Error Report along with a NACK makes no sense.

Change-Id: Idae55645c34970f839bb0eef61a7326a1026b20c
Related: SYS#5917, OS#4984
2022-04-12 01:12:28 +03:00
Vadim Yanitskiy 9b0c60ea63 rsl: de-duplicate parsing of MultiRate configuration IE
Change-Id: I98e10c3e947b9a4605e9db5bf7f499dc24bccad7
Related: SYS#5917, OS#4984
2022-04-12 00:49:18 +03:00
Vadim Yanitskiy 7bb3024764 osmo-bts-trx: amr_loop: remove unneeded #includes
Change-Id: I6d181f19711dc14695abd0f8e2586329e91aa68d
Related: SYS#5917, OS#4984
2022-04-11 23:42:29 +03:00
Vadim Yanitskiy 9ab2472851 osmo-bts-trx: use '#pragma once' in amr_loop.h
Change-Id: I98e42485955de4a261b6c8d865e84c313c1145d5
Related: SYS#5917, OS#4984
2022-04-11 23:39:58 +03:00
Vadim Yanitskiy 5cbd18cfce osmo-bts-trx: rename 'loops.[ch]' to 'amr_loop.[ch]'
There is nothing else except the AMR link adaptation loop in these files.

Change-Id: Iff2c0d32da5cd89824197d05f4732ce974c12f28
Related: SYS#5917, OS#4984
2022-04-11 20:06:51 +03:00
Vadim Yanitskiy 3ed84cc26b osmo-bts-{trx,virtual}: tx_tchh_fn(): remove FACCH/H alignment check
This check is redundant because it's guaranteed in rts_tchh_fn()
that FACCH/H is always scheduled at the correct frame offset.

Change-Id: I2f0c26f6007455aa1e3e8b27bc9d173f6b1f8c38
Related: SYS#5916, OS#5518
2022-04-10 19:07:16 +03:00
Vadim Yanitskiy 3ac0cf8c39 osmo-bts-trx: rx_tchh_fn(): use a lookup table for FACCH/H
Since change [1], in rts_tchh_fn() we're using a lookup table for
DL FACCH/H.  Let's do the same for UL FACCH/H in rx_tchh_fn().

Change-Id: I7c4e3befdd33bef4d89a04a4c7cb1a2d4078c156
Related: [1] I3dba243e5a1b7c8008ef0178ea18ed885256c50d
Related: SYS#5916, OS#5518
2022-04-10 19:04:29 +03:00
Vadim Yanitskiy 93e3a220b1 scheduler: rts_tchh_fn(): use a lookup table for FACCH/H
Unlike TCH/F, TCH/H imposes some additional requirements on the FACCH
transmission, so that a signalling block can be transmitted only at
specific TDMA frame numbers defined in 3GPP TS 45.002, table 1.

This is why in rts_tchh_fn() we need to check the given TDMA frame
number and tell rts_tch_common() whether FACCH/H is permitted or
not.  The check is based on a magic formula, which I find a bit
hard to read and understand.  Let's better use a lookup table.

Change-Id: I3dba243e5a1b7c8008ef0178ea18ed885256c50d
Related: SYS#5916, OS#5518
2022-04-10 18:25:53 +03:00
Vadim Yanitskiy 14b00bb8b2 scheduler: remove redundant OSMO_ASSERT() statements
It's guaranteed by the calling function bts_model_l1sap_down() that
the prim's operation is PRIM_OP_REQUEST and that the msg is present.

Change-Id: I6a01bba7b5eb337ae1552c442d74447565c52e25
2022-04-09 19:48:55 +03:00
Vadim Yanitskiy 94f7b4753a power_ctrl_params_def_reset(): set .ctrl_interval for both UL/DL
For the sake of consistency and code readability, initialize the
power loop control interval (P_Con_INTERVAL) for both Uplink and
Downlink directions in the same function.

Change-Id: If7c804e51eb104d9fe73294a3867ab3b551d83c3
2022-04-08 20:39:35 +00:00
Vadim Yanitskiy dd7bed3415 osmo-bts-trx: rx_tchf_fn(): clarify indexes in the AMR CMI lookup table
Change-Id: If81ff0bd449fe20da43cc3d96dadf38568507054
Related: SYS#5916
2022-04-08 19:05:45 +03:00
Vadim Yanitskiy 94806cee7b osmo-bts-trx: rx_tchh_fn(): fix indexes in the AMR CMI lookup table
In change [1] I didn't take into account that the TCH/H burst buffer
is 6 bursts wide, and that we're decoding 2 bursts late:

  +---+---+---+---+---+---+
  | a | b | c | d | e | f |  Burst 'a' received first, 'f' last
  +---+---+---+---+---+---+
   ^^^^^^^^^^^^^^^           Speech frame (bursts 'a' .. 'd')
   ^^^^^^^^^^^^^^^^^^^^^^^   FACCH frame  (bursts 'a' .. 'f')

The lookup table for TCH/H was calculated with the assumption that
in rx_tchh_fn() the 'bi->fn' indicates TDMA frame number for burst
'd', but in reality it holds the frame number of burst 'f'.

Change-Id: I4f22cf49fd52ed26f8017f76461059a701c181e1
Fixes: [1] I46def864729c8f9063af201750456771ea5558d5
Related: SYS#5916
2022-04-08 19:01:40 +03:00
Vadim Yanitskiy c4368ce3ab osmo-bts-trx: move AMR CMI lookup tables to the respective files
It makes no sense to have these tables in the header file, because
they're not used anywhere outside of the respective lchan handlers.

Change-Id: Ibdebfb9b1ef78c960b08240ebdb4c7af92cbed11
Related: SYS#5916
2022-04-08 18:37:08 +03:00
Vadim Yanitskiy f5b756e484 osmo-bts-trx: rx_tchh_fn(): fix meas reporting in signalling mode
In change [1] I broke measurement reporting for TCH/H in signalling
mode.  The problem is that in rx_tchh_fn() we started to invalidate
the Uplink RSSI for FACCH regardless of the channel mode: speech or
signalling.  In speech mode, the averaged measurements are carried
over by the two BFIs.  In signalling mode we send no BFIs, so:

* let's use the proper averaging mode S6N6 (not S6N4), and
* send the averaged measurements together with the FACCH.

This change fixes BTS_Tests.TC_meas_res_sign_tchh[_toa256].

Change-Id: If98aa1f0f7255f20344460bdd07e2c896dd6e56f
Fixes: [1] I7902b4709bc3f418174e8373f52e87bb31cdc826
Related: SYS#5853
2022-04-07 20:36:36 +03:00
Vadim Yanitskiy 5ce5c7db9b osmo-bts-trx: rx_{tchh,tchf}_fn(): use tch_mode directly
There is no reason not to use 'chan_state->tch_mode' directly in
the 'switch' statement.  If a logical channel is in signalling
mode, then both 'chan_state->{rsl,tch}_cmode' are set to
RSL_CMOD_SPD_SIGN and GSM48_CMODE_SIGN, respectively.

Change-Id: I9e5e2c891c80c32fc522b53c9371b71ea32dd54d
Related: SYS#5853
2022-04-07 20:27:46 +03:00
Vadim Yanitskiy 5a8413166f osmo-bts-trx: rx_{tchh,tchf}_fn(): use AMR CMI lookup tables
3GPP TS 45.009 defines that Codec Mode Indications shall be sent
with speech frames having specific TDMA frame numbers of their
*first* bursts, which are defined in tables 3.2.1.3-{1,2,3,4}.

Performance-wise it's batter to have these tables implemented as
arrays, rather then using the 'switch' statement.  We can simplify
things even further and have TDMA frame numbers corresponding to
the *last* bursts in them.  This eliminates the need of doing an
additional last-to-first mapping, so that bi->fn can be used.

Change-Id: I46def864729c8f9063af201750456771ea5558d5
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy 12b3921a4a osmo-bts-trx: rx_{tchf,tchh}_fn(): get TDMA FN from meas history
Once we have an Uplink speech or FACCH frame decoded, we need to
hand it over to the upper layers indicating TDMA frame number of
the *first* burst corresponding to the beginning of a block.

Currently we use libosmogsm's gsm0502_fn_remap() API to calculate
the first TDMA frame number from the given last frame number.
This API involves iterating over the pre-calculated offset tables
for different channel and payload types, and thus imposes some
additional CPU cycles.  Another downside of the current approach
is that we have to perform such lookups several times for each
decoded L2 frame, e.g. for FACCH on TCH/AHS we do it three times!

In this patch I propose an alternative approach of storing TDMA
frame numbers in the measurement history, together with the
associated samples.  This way we can easily get N-th frame number
from there without performing any additional computations, other
than what we already do during the measurement processing.

Change-Id: Id9a2b7b0f1a1ad7cfbbab862faf521e135c90605
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy 333e35439d osmo-bts-trx: rx_{tchf,tchh}_fn(): ensure complete set of bursts
The idea of this change is to avoid attempting to decode the burst
buffer unless it's filled up completely.  This eliminates expected
decoding errors in the beginning of lchan's lifetime.  Moreover
this allows us to be sure that the measurement history is complete,
so that we can abuse it to store TDMA frame numbers later.

Note that even in the absence of NOPE indications (TRXDv0 case)
we can still be sure that the burst mask has no gaps due to lost
bursts, because they are compensated by trx_sched_calc_frame_loss().

Change-Id: I56bebe1374eb803e3c1e9f08dda4da50a074ab0b
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy 6d04bd95ee osmo-bts-trx: rx_{tchf,tchh}_fn(): shift Rx burst buffer on bid=0
For both TCH/F and TCH/H, the receive burst buffer needs to be
periodically shifted leftwards due to the nature of block-diagonal
interleaving.  Currently we do this on receipt of bid=3 for TCH/F
and bid=1 for TCH/H, right after attempting to decode the buffer.

If for some reason we return early before attempting to decode the
buffer, the content of that buffer might not be shifted and some
bursts might be overwritten.  This can be easily avoided by doing
the shifting on receipt of bid=0 for both TCH/H and TCH/F.

Change-Id: I0bd69f5a8f5c665fb5f00c127bc3fe1d91167abb
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy b8b6066450 osmo-bts-trx: rx_{tchf,tchh}_fn(): also use meas_avg for BFI
In the current implementation of both TCH/F and TCH/H lchans, we
set the 'bfi_flag' to true only if decoding fails.  Perhaps this
was not the case when I wrote [1], so using meas_avg might result
in using uninitialized memory.  This is not the case anymore.

Pass the *averaged* measurememnts regardless of decoding result.

Change-Id: I23f767364a018d30d04885990adf69b50b2c9738
Related: [1] I2b02b51fea5664f161382a4ddc63dbf14ffc9ac5
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy da433bba7b osmo-bts-trx: rx_tchh_fn(): get rid of chan_state->meas_avg_facch
FACCH/H takes out two speech frames, so we send two BFIs once we
have received it in rx_tchh_fn().  The upper layers responsible
for handling of the Uplink measurements expect a fixed amount of
measurement samples, so currently we do:

* send a FACCH frame with the associated measurememnts (S6N6),
* send the 1st BFI with invalidated measurements (RSSI=0),
* send the 2nd BFI with the stored measurememnts of FACCH.

This is achieved by preserving a copy of the FACCH measurememnts
in chan_state->meas_avg_facch and then using it two bursts later.

The same goal can be achieved a lot easier by sending the associated
measurements with both BFIs as if no FACCH was received:

* send a FACCH frame with invalidated measurememnts (RSSI=0),
* send the 1st BFI with the associated measurememnts (S6N4),
* send the 2nd BFI with the associated measurememnts (S6N4).

This eliminates the need to store anything outside of the existing
measurement history and simplifies the code a lot.  Also, this
eliminates the need for using a dedicated averaging mode S6N6.

Varified by running BTS_Tests.TC_meas_res_speech_tchh_facch.

Change-Id: I7902b4709bc3f418174e8373f52e87bb31cdc826
Related: I1ad9fa3815feb2b4da608ab7df716a87ba1f2f91
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy bd7ef4101b osmo-bts-trx: rx_tchh_fn(): indicate BER10k=0 for FACCH BFIs
It makes no sense to store BER10k value of an Uplink FACCH frame
in order to indicate it in a BFI later on.  Given that these BFIs
are generated artificially, it's fine to indicate BER10k=0.

Change-Id: I24d12892760dca0ad0a5c2abca9fc66523d9e614
Related: I1ad9fa3815feb2b4da608ab7df716a87ba1f2f91
2022-04-05 13:45:31 +00:00
Pau Espin 7a2f307246 doc: rsl: Fix description of 'IP Connection Statistics' IE
Related: SYS#5915
Change-Id: Ic524d73a0c47fde528b78f9dfe7b72b7286550e1
2022-04-04 19:27:59 +02:00
Vadim Yanitskiy 5bb7031366 fix gsm_bts_get_cbch(): CBCH can be allocated on Cn
According to 3GPP TS 45.002, table 3, unlike the CCCH+SDCCH/4+CBCH
combination, which can only be allocated on C0/TS0, the SDCCH/8+CBCH
can be allocated on C0..n/TS0..3.  In other words, having CBCH on
e.g. C1/TS2 is perfectly legal.  This is why in gsm_bts_get_cbch()
we should check all transceivers, not just the C0.

Without this change osmo-bts does not send CBCH Load Indications
at all if the CBCH is allocated on C1..n.

Change-Id: Ib5976783b53521047fbdfc18e0e236e8bce8eaae
Related: osmo-bsc.git Ie79ccff4f8f0f1134757ec0c35e18b58081cc158
Related: SYS#5905
2022-03-31 19:57:10 +03:00
Vadim Yanitskiy b147878f9e trx_sched_ul_burst(): get rid of the 'switch' statement
Both TRXC_RACH and TRXC_PTCCH are handled in the rx_rach_fn(),
so we can eliminate the need of having a 'switch' statement in
the general (perfrmance critical) code path.

Change-Id: I66d8785a63215af37a77e258039549e4e6292e49
2022-03-22 18:28:15 +00:00
Vadim Yanitskiy 35e601a322 osmo-bts-trx: rx_tchh_fn(): use proper meas averaging mode
Compared to TCH/F, TCH/H is a bit special in a way that:

* speech frames are interleaved over 4 consecutive bursts,
* while FACCH frames are interleaved over 6 consecutive bursts.

This is why in rx_tchh_fn() we allocate a buffer large enough to
store up to 6 bursts.  Let's say we have that buffer filled up
completely with all 6 bursts (from 'a' to 'f').  Now attempting
to decode them may yield either a speech frame or a FACCH frame:

  +---+---+---+---+---+---+
  | a | b | c | d | e | f |  Burst 'a' received first, 'f' last
  +---+---+---+---+---+---+
   ^^^^^^^^^^^^^^^           Speech frame (bursts 'a' .. 'd')
   ^^^^^^^^^^^^^^^^^^^^^^^   FACCH frame  (bursts 'a' .. 'f')

For FACCH we use measurement averaging mode SCHED_MEAS_AVG_M_S6N6,
so that 6 last samples are averaged - so far so good.  For speech
we use SCHED_MEAS_AVG_M_S4N4, so that 4 last samples corresponding
to bursts 'c', 'd', 'e', 'f' are averaged - this is wrong.

We actually need to average the *first* 4 samples corresponding to
bursts 'a', 'b', 'c', 'd' in the case of speech.  Let's add and use
a new averaging mode SCHED_MEAS_AVG_M_S6N4 for that.

Change-Id: Iea6f4e5471550f4c2b57aaebeac83c80e879489d
2022-03-18 03:53:08 +03:00
Vadim Yanitskiy 523598e655 osmo-bts-trx: use a lookup table in trx_sched_meas_avg()
This should be better performance-wise and would also allow to avoid
having the same switch statement duplicated in functions added later.

Change-Id: If8124dcd38e7c8408a9f3b9a574d9e3181a2eb15
2022-03-18 03:53:06 +03:00
Vadim Yanitskiy 2de4d9baa8 osmo-bts-trx: use consistent naming for 'enum sched_meas_avg_mode'
This is a purely cosmetic change.  The new naming clearly indicates
how deep to go back in the measurement history (S) and how many
samples to average (N).  For example:

* SCHED_MEAS_AVG_M_S4N4 - go S=4 steps back and average N=4 samples;
* SCHED_MEAS_AVG_M_S6N2 - go S=6 steps back and average N=2 samples.

Change-Id: I96a8dd08084c7c179f879fc00e75c5edcfb11caa
2022-03-18 03:53:02 +03:00
Vadim Yanitskiy 4e9affee0b osmo-bts-trx: rx_tchh_fn(): mark valid SID frames as such
Set the FT (Frame Type) in the ToC (Type-of-Content) section as
defined in section 5.2 of RFC 5993.  Before this change SID frames
had FT = 000 (Good Speech frame), because gsm0503_tch_hr_decode()
does not distinguish between speech and SID frames internally.

Change-Id: I09cec984bb60c754908126acf0300a2cc602485c
Related: SYS#5853
2022-03-16 13:04:55 +03:00
Vadim Yanitskiy eb8059b615 osmo-bts-trx: rx_tchh_fn(): fix HR SID detection (wrong offset)
According to RFC5993, which is referenced by 3GPP TS 48.103, the
complete RTP HR payload consists of a Table-of-Contents (ToC) byte
followed by the 14 bytes of the HR codec frame.  See section 5.2.

gsm0503_tch_hr_decode() outputs frames in the RTP format with
length of 15 bytes (120 bits): 1 (ToC) + 14 (HR frame):

  +-------------+-------------------------
  | ToC section | HR codec frame ...
  +-------------+-------------------------

osmo_hr_check_sid() expects a HR codec frame of 14 bytes (112 bits)
as the input, so we should skip the ToC section when calling it.

Change-Id: Ie5fa776dcb2b2203a97aed56ecbf2450af7d87c1
Related: SYS#5853
2022-03-16 12:43:11 +03:00
Vadim Yanitskiy d32cf22fbc rsl: fix wrong IE being checked in rsl_rx_chan_activ()
According to 3GPP TS 48.058, section 4.1.4, BTS shall start transmission
on SACCH if both MS Power and *Timing Advance* IEs are present.  There
can be no Access Delay IE in the RSL CHANnel ACTIVation message.

Change-Id: Icd8ccfd6e37ded8966125a473b5003845ba87fec
Fixes: I170b63c9856230d5f1a10654a9d950ada8e730d7
Related: SYS#5838
2022-03-14 12:21:44 +00:00
Vadim Yanitskiy 79aaec8f01 osmo-bts-trx: rx_tchh_fn(): do not calculate BER10k for FACCH twice
We already have BER10k calculated in the generic code path, so do
not calculate it once again in the FACCH specific branch.

Change-Id: I5d3955d09990e280d11d687385eeaf5edf437395
2022-03-14 11:31:32 +00:00
Vadim Yanitskiy dc17d1036b osmo-bts-trx: do not run osmo_{fr,hr}_check_sid() on FACCH/U frames
It makes no sense to perform the SID codeword lookup in signalling
frames (FACCH), because it can be present only in speech frames.

Change-Id: I2f8137993acfe8a8add3fc2af276e5eb4da1605e
Related: SYS#5853
2022-03-10 17:23:27 +03:00
Vadim Yanitskiy 8ec3f28fad VTY: fix ambiguity in BTS specific command definitions
Most of the BTS specific VTY commands restrict BTS number to '<0-0>',
while bts_c0_power_red_cmd has '<0-255>'.  This confuses libosmovty:

  OsmoBTS# bts ?
    <0-0>    BTS number
    <0-255>  BTS Number

  OsmoBTS# bts 0 ?
  % Ambiguous command.

  OsmoBTS# bts 0 c0-power-red 0
  % Ambiguous command.

Let's stick to '<0-0>', we don't support multiple BTS anyway.

Change-Id: I937ac421143678b97627c1bc4fe573831ce097f6
2022-03-09 07:23:50 +00:00
Vadim Yanitskiy d84567779c osmo-bts-trx: new rate counter 'trx_sched:dl_fh_cache_miss'
This new rate counter allows to monitor the efficiency of the
radio carrier cache used for routing Downlink bursts when
baseband frequency hopping is in use.

Change-Id: Ie6da829e47298476267c8df2dcedafad564cbbb4
Related: SYS#5855
2022-03-09 07:22:27 +00:00
Vadim Yanitskiy ff30ca63a9 osmo-bts-trx: cosmetic: use rate_ctr_inc2() instead of rate_ctr_inc()
Change-Id: Id4c5999876ff284b80a021e075bf46eb9d4670a2
Related: SYS#5855
2022-03-09 07:22:27 +00:00
Vadim Yanitskiy 577de3a5a2 osmo-bts-trx: make use of OSMO_UNLIKELY() when handling TRXD PDUs
Given how often we send and receive TRXD PDUs, I believe it maks
sense to use OSMO_UNLIKELY() in the error checking conditions.
Theoretically this should improve performance.

Change-Id: I9266aaf2bbc0acfe21e9bfb12c9f38621d120553
2022-03-06 16:51:14 +03:00
Pau Espin ad8426e40c bts-trx: Log lchan if avaialble in Meas Avg
Change-Id: I1460715fa46c4195c5aaac91be776ad770d8099e
2022-03-03 19:03:07 +01:00
Pau Espin a3dca762dd rsl: Conditionally decrease log level if cause is normal event
This avoid a NOTICE log line like the following when gsm_lchan_release()
is called.
"""
rsl.c:2484 (bts=0,trx=0,ts=2,ss=0) Sending RTP delete indication: cause = Normal event, unspecified
"""
Change-Id: I0ce78c52644983220f5810bc5c661b07afd9e543
2022-03-02 19:07:01 +01:00
Pau Espin a6a0c6ad1e Change some log levels NOTICE->INFO
Change-Id: I65cccf2b48288353c2db2044ad1f3651ca9f68ec
2022-03-02 19:02:16 +01:00
Pau Espin bd02811e7e bts-trx: amr: Fix return code of osmo_amr_rtp_dec() checked too late
If len is < 0, it means osmo_amr_rtp_dec() failed and some of the out
variables there are not set. We should check the return code before
continuing and using potentially uninitialized values.

Change-Id: I76020c6b5dc8d3e52e8c5be8cdecdf8a0bb52ed9
2022-03-02 13:54:48 +01:00
Vadim Yanitskiy df505a503f logging: get rid of logging category DSUM
DSUM is somewhat similar to DMAIN, generic logging category used
in other Osmocom projects.  This category is rarely used in a few
places, where the other categories could fit better.  Remove it.

Change-Id: Ia9db783bc92b23ba87b4fdf1e4ed07d59ea6bbce
2022-02-08 14:31:58 +06:00
Vadim Yanitskiy 41d9e2c093 phy_instance_destroy(): fix NULL pointer dereference
It's possible that a PHY instance has no associated TRX instance.

Change-Id: Id028577ef92d1b3ce63ba62b63b8b29edb2ae5a4
Fixes: OS#5377
2021-12-28 22:01:35 +06:00
Oliver Smith d4ebb1f6c4 treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I12b250e16426b125124def49e124e40ae93d0d58
2021-12-14 12:11:11 +01:00
Vadim Yanitskiy 374939f8cc cbch: cosmetic: use talloc_zero() in bts_process_smscb_cmd()
Change-Id: Ibb5090b7cd53c1a485d0b9474c6470fa5831de67
2021-12-12 19:37:32 +03:00
Vadim Yanitskiy 7ce4fa4325 osmo-bts-trx: fix a memleak in trx_sched_set_lchan()
An additional burst buffer is allocated in rx_data_fn() for Uplink
SACCH repetition, but unlike the main buffer it never gets free()d.

Change-Id: I93310e7aed91a49c0511e2ed30e000440617f95a
Fixes: I7e4cc33cc010866e41e3b594351a7f7bf93e08ac
Related: OS#4795, SYS#5114
2021-12-12 19:03:05 +03:00
Vadim Yanitskiy 487feeb0ff osmo-bts-trx: use l1ts as talloc context for burst buffers
Before a massive refactoring of the scheduler structures [1] it was
impossible to have a clean hierarchy, in which the burst buffers
get allocated as children of their parent timeslot structures.

This change makes it easier to read talloc reports and simplifies
memory management, offloading free()ing of the burst bufferes to
talloc.

Change-Id: Idb1ceaf83c433d2d0eb84d77c2187a00a657905c
Related: [1] I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-12-12 18:59:34 +03:00
Vadim Yanitskiy 4b3fe16200 oml: assign unique names to 'struct tlv_parsed' chunks
Change-Id: Ie248d2a65a11da914324a7e65b767b894ed8644a
2021-12-12 16:22:48 +03:00
Vadim Yanitskiy 1475a45492 oml: fix copy-pasted comments in oml_rx_set_*_attr()
Change-Id: Iaa0e630b28b2a86312c069e7e55dd8bc5743759a
2021-12-12 16:22:30 +03:00
Vadim Yanitskiy 1d9106d768 oml: use ts->trx as talloc-context in oml_rx_set_chan_attr()
Change-Id: I6dc3706a486726afa9eec5d2e5369bd62c511455
2021-12-12 16:14:36 +03:00
Vadim Yanitskiy 4275bf7232 oml: use proper talloc context in oml_rx_set_radio_attr()
Change-Id: I69b6c72d85f68e4225d7786646f24259a5964998
2021-12-12 16:07:41 +03:00
Oliver Smith a271ca7fc7 debian/control: add osmo-bts meta-package
Add an osmo-bts meta-package that depends on the subpackages
osmo-bts-trx and osmo-bts-virtual. This is important, because the
downstream packaging of debian does not split osmo-bts in subpackages,
it has only one osmo-bts package. So without this, when installing
"osmo-bts" in debian while having the Osmocom binary package repository
installed and expecting to get the newer version, the user will actually
get the older version from debian.

Closes: OS#5319
Related: https://salsa.debian.org/debian-mobcom-team/osmo-bts/-/blob/master/debian/control
Change-Id: I1a6edf2eb146616ac51b7957368a8d057caa685f
2021-11-30 09:03:12 +01:00
Harald Welte 127c419d08 [lc15,oc2g,octphy] Fix memory leak on write queue overflow
Callers of osmo_wqueue_enqueue must always check the return value
and free the message themselves in the error case.

Change-Id: Ic67fbef23e419c0c8a7bcfb16d134e1bf649de72
Related: OS#5329
2021-11-25 13:15:30 +00:00
Harald Welte cf12cee46c cbch: Fix dangling cur_msg leading to double-free in bts_cbch_reset()
If a new default message is installed via RSL, and the old default
message is currently being transmitted, we must set cur_msg to NULL.

The old default message must be talloc_free()d unconditionally whenever
a new default message is being set.

We can do that by using the TALLOC_FREE macro.

Change-Id: Id32c2074b61cd1f09957b9d1558ffb3a7691a8e0
Related: OS#5325
2021-11-24 20:02:42 +01:00
Harald Welte 79f21c4ed1 cbch: Fix bts_smscb_state_reset() to avoid double-free
If the currently transmitted message is the default message,
bts_ss->cur_msg == bts_ss->derfault_msg.  In this case we cannot
simply talloc_free() both of them, as it would result in a boudle-free.

Change-Id: I2d3645e34d31507b012a53ffe12d14223682f808
Closes: OS#5325
Fixes: Ib01d38c59ba9fa083fcc0682009c13d2db3664fe
2021-11-24 20:02:42 +01:00
Pau Espin 40e97f3d02 bts: Properly free bts->shutdown_fi when struct gsm_bts is freed
Change-Id: I8c59f030c39c83a91b8504d4c5ce3b2058206fcf
2021-11-23 14:42:09 +01:00
Pau Espin 02532bafb8 bts_shutdown_fsm.h: Remove wrong comment describing enum
Change-Id: I963234255ce5a648a842ae6dbfd9966a694d0c09
2021-11-23 14:32:26 +01:00
Pau Espin 77524ea511 Bump version: 1.3.0.348-f42287-dirty → 1.4.0
Change-Id: Ibf3ce0bfd0cf67148229dd988ebde6e6b8d744cc
2021-11-16 16:40:05 +01:00
Neels Hofmeyr f422873087 gsm_lchan_interf_meas_calc_avg(): adapt to the order of boundaries
The order of interference level boundaries is not clearly defined by
3GPP, so we should support both ascending and descending variants.

Change-Id: I88d841d8d835bde8392c7b606b28c9070b7adc6e
Related: SYS#5313
2021-11-12 03:04:47 +03:00
Vadim Yanitskiy efc0d5bf57 gsm_lchan_interf_meas_calc_avg(): fix band calculation
This patch makes osmo-bts bahave similar to ip.access nanoBTS.

Change-Id: I1bcc6d6ba154f82aef95d05fb9af0eab490923c9
Related: SYS#5313
2021-11-11 09:01:15 +00:00
Vadim Yanitskiy b9fcb85a29 oml: use ARRAY_SIZE() in oml_rx_set_bts_attr()
Change-Id: I89dab55e39fe49c8b4d3afb4b46d1b7f2bf3663c
2021-11-11 09:01:15 +00:00
Vadim Yanitskiy bc7a490dbc rsl: exclude disabled timeslots from interference reports
It may happen after the A-bis connection recovery that the RF RESource
INDication message gets sent too early, while some timeslots are not
yet configured.  This confuses the BSC and provokes error messages.

Change-Id: I00bc6fe67ea1bbedcd5d8640e73bd8b16b9e667f
Related: SYS#5313, SYS#4971
2021-11-09 15:28:30 +03:00
Vadim Yanitskiy 8104922d81 common/Makefile.am: reformat {AM_CPPFLAGS,AM_CFLAGS,LDADD}
Change-Id: If475999cccc215b6792f276b9cc6c494a0c1ad81
2021-11-07 03:33:12 +03:00
Pau Espin 5dcafedc33 gsm_ts_release(): Make sure pchan{,is_want} is reset to NONE
Let's make sure all ts->pchan* related data is reset when we release the
TS. This is important for pchan_is, since in bts-trx upon shutdown
finish the PDCH lchan of a osmo dyn TS is set to
lchan->state=LCHAN_S_NONE, and as a result when the PCU tries to release
it by means of PCUIF act_req later, it may be ignored since the lchan is
already in erased state.

Related: SYS#4971
Change-Id: Ic7c34c0de23101ce094ffd03e00b4d2f6a551152
2021-11-05 13:17:09 +00:00
Vadim Yanitskiy 333d8787ff measurement: make use of gsm48_meas_res_is_valid()
Change-Id: Iea6ab7b69defd7ce88c2aa92fcf2b84370a4c135
Depends: Iae2bd508a08c4b5093d36e514c22218763e11edf
2021-11-04 17:47:02 +03:00
Vadim Yanitskiy 9833a4e198 [overpower] Turn it on and off depending on DL RxQual
Change-Id: Iaa812d4661ee17c4cd4a8c4ae4bd3e94c1a2e6cc
Depends: Ia28293a12de0af71f55e701fb65c46e905dae217
Related: SYS#5319
2021-11-04 16:05:33 +03:00
Vadim Yanitskiy fbd9aaca66 measurement: pass *mr to lchan_bs_pwr_ctrl()
As a side effect, we have to sacrifice a unit test (TC_inval_dummy)
because it becomes impossible to pass a dummy or invalid SACCH block
to lchan_bs_pwr_ctrl().

Change-Id: I937117cf26fb718d57920382f6972390ad498c51
Related: SYS#4918
2021-11-04 15:46:04 +03:00
Vadim Yanitskiy e714406632 measurement: pass *mr to repeated_dl_facch_active_decision()
Change-Id: Idbf5f95d632aa2270c49b351ad5561ca2182bf9a
Related: SYS#5114
2021-11-04 15:46:04 +03:00
Vadim Yanitskiy 81a4b3c090 measurement: get rid of *le in lchan_meas_handle_sacch()
The current Timing Advance value can be obtained either from the
L1 SACCH header (if received) or from lchan->ta_ctrl.current.

Change-Id: I2b3693a0e49f03f2b4496c9dbd30cf47e9bc86b5
2021-11-04 15:46:04 +03:00
Vadim Yanitskiy 110ec15fe9 lchan_meas_handle_sacch(): check if Measurement Result is valid
We should not rely on measurement data marked as invalid.

Change-Id: I4aaac742674ce3ac15e9a4a32fe7c72db81d32d2
2021-11-04 15:46:04 +03:00
Vadim Yanitskiy c13b325877 l1sap: rework handling of DATA.ind on SACCH
Currently an Uplink SACCH block is being passed to LAPDm first, and
then gets forwareded to the BSC in handle_ms_meas_report(), together
with the Uplink measurements collected so far.

This approach has a serious flaw: handle_ms_meas_report() won't be
called if an Uplink block contains SAPI=3 data (SMS) or was not
decoded at all (len=0) fow whatever reason.  Therefore, no RSL
MEASurement RESult message will be sent to the BSC.

Rename handle_ms_meas_report() to lchan_meas_handle_sacch(), and call
it from l1sap_ph_data_ind().  This way perioduc RSL MEASurement RESult
messages will be sent regardless of what happens on Uplink SACCH.

Change-Id: Ifed91f87fd653debc87a09da3fd31ad64a13f330
Fixes: TC_meas_res_speech_{tchf,tchh}_sapi3
Related: SYS#5319
2021-11-04 15:46:04 +03:00
Pau Espin 5c705a676d abis: Try one reconnect to previously connected BSC before trying next one
This way we keep all BTS connected to the same BSC if there was a
spurious network problem.

Related: SYS#4971
Change-Id: I16b75da5987584d099edc3a640f3a5cd61f3ad69
2021-11-03 20:21:28 +01:00
Pau Espin 84dceb5245 abis: Drop unneded if condition in else clause
priv->current_bsc will for sure be != last, otherwise it would have
entered the if clause above it.

Change-Id: I0a6519f7b93f0b45c67d19fef4f50daeeefc7340
2021-11-03 20:14:38 +01:00
Pau Espin 3ca3243e57 bts-trx: sched_lchan_tchf: Change log level to debug for line informing about missing dl prim
This scenario is actually expected when the call is being set up or torn
down, since we may not be receiving RTP from the MGW to send to the MS.
Hence, let's lower the log level to DEBUG to avoid having log clogged
for each call start/stop if INFO is used.

Related: SYS#5676
Change-Id: Ib7f274b97cc66d671316eae429ee4baf16831534
2021-11-03 18:44:08 +01:00
Pau Espin 5826136a9d scheduler: Fix FACCH msg with l2len==0 going to lower layers and logging errors
Recent commit (see below) changed a check to avoid weird results for msg
which had l2h=NULL, since l2len would return unexpected results there.
However, some code branches like FACCH or TCH seem to be always setting
l2h even if len=0. Hence, we must test either of the 2 scenarios (null
pointer and l2len()).

This commit fixes the following message appearing all the time during
calls:
"""
TCH/F: Prim has odd len=0 != 23
"""

Fixes: fb905b8d23
Related: SYS#5676
Related: SYS#4919
Change-Id: I43152bc8484a35cd004d3303d3a6e6efcdefa890
2021-11-03 18:28:44 +01:00
Pau Espin c64d7ae4a1 bts-trx: sched_lchan_tchf: Drop impossible code path
It cannot happen that msg1 is NULL and msg2 is not null, since they are
deuqueed from same place. Only possible combinations are:
msg1!=NULL && msg2!=NULL
msg1!=NULL && msg2==NULL

Change-Id: Ifd789844b1a7dfba596664de440d4c20b9f4c78f
2021-11-03 17:00:45 +01:00
Martin Hauke 7bb7889012 osmo-bts-trx-calypso.cfg: Adjust settings to work with current osmo-bts versions
* Remove deprecated configuration options:
  'osmotrx timing-advance-loop' is deprecated, Timing Advance loop is now active by default
  'osmotrx ms-power-loop <-127-127>' is deprecated, MS Power Control is now managed by BSC
* Adjust 'ipa unit-id' (1801 -> 6969) to match the one from the example osmo-bsc.cfg
* Set clock advance values to known working values:
  + 'osmotrx fn-advance' -> 20
  + 'osmotrx rts-advance' -> 5
* Set 'nominal-tx-power' since the calypso-bts tranceiver does not support NOMTXPOWER

Change-Id: I69436b914cf1bec57f9fe7acea4a896e7c46b3a9
2021-11-01 15:29:02 +01:00
Vadim Yanitskiy 98a47e8c9d rsl: fix a memory leak in handle_gprs_susp_req()
Change-Id: I65d9c12888aa5e5112680b3b3f38817e322ecc1c
2021-10-28 22:56:36 +03:00
Vadim Yanitskiy 5c93b8b671 l1sap: make 'l1sap' argument of process_l1sap_meas_data() const
Change-Id: Idc3004b0c74f7b98c96f20560c8b60a1fb4eb9c8
2021-10-28 22:38:20 +03:00
Vadim Yanitskiy 36062825de l1sap: process_l1sap_meas_data() accepts pointer to lchan
In 2/3 cases when calling process_l1sap_meas_data() we already have
a pointer to the logical channel, so let's pass it as the first
argument instead of a pointer to the transceiver.  This way we
avoid calling get_active_lchan_by_chan_nr() two times.

In l1sap_ph_data_ind(), call process_l1sap_meas_data() below the
conditional branch handling PDCH, so it won't be called for
GSM_LCHAN_PDTCH anymore.  GPRS specific measurements are handled
by the PCU and not of interest for the BSC.

Change-Id: I9de67a0b2d2b18923f2c2003b400387a0f1af411
2021-10-27 18:12:09 +03:00
Vadim Yanitskiy 7001816773 l1sap: use designated initializers in process_l1sap_meas_data()
Change-Id: I5169a6c5f6865655dbfebb6b68d5f67941d9cdb1
2021-10-27 18:12:09 +03:00
Vadim Yanitskiy a1377d9080 l1sap: move false PTCCH/U detection into PDCH branch
This check is only relevant for PDCH timeslots.

Change-Id: I187fef8f3de0b41b502b0b18acfb11c56c5551f0
2021-10-27 18:12:09 +03:00
Vadim Yanitskiy 03cf6042fb l1sap: fix handling of lchan->pending_rel_ind_msg
After merging the patch [1] fixing handling of the RLL RELease
INDication message in lapdm_rll_tx_cb(), ttcn3-bts-test shows
several regressions:

  pass->fail: BTS_Tests.TC_rll_rel_ind_DCCH_0
  pass->fail: BTS_Tests.TC_rll_rel_ind_DCCH_3
  pass->fail: BTS_Tests.TC_rll_rel_ind_ACCH_0
  pass->fail: BTS_Tests.TC_rll_rel_ind_ACCH_3
  pass->fail: BTS_Tests_LAPDm.TC_sabm_dm

[1] I823c9101bcca72d5792e16379b02d3602ffc2726
    991020c049

The problem is actually *not* in patch [1], but in the older one
[2] which we attempted to fix.  While a logical channel is in
signalling mode, the lower layers do not produce PRIM_TCH_RTS,
and thus the l1sap_tch_rts_ind() is not being called.

Unlike l1sap_tch_rts_ind(), the l1sap_ph_rts_ind() is being called
regardless of the channel mode (signalling vs speech), so let's
move handling of lchan->pending_rel_ind_msg there.

Change-Id: I2c380f9045624f0a0a8f988bb207bc73d8354857
Fixes: [2] Ie4f70c75f0137b4bd72d579b3a32575bac2fca3
2021-10-27 18:12:09 +03:00
Pau Espin b71d2f5a4b scheduler: Avoid crash upon call to trx_sched_set_lchan if l1ts is uninitialized
It could happen if for instance l1 code called trx_sched_clean() when
closing the phy, and after that some code called (erroneously)
trx_sched_set_lchan(). Let's make sure we don't allow other modules to
crash the process when using this function.

Related: SYS#4971
Change-Id: I93af7c3dcf0e34e9317eec0ee183dbf18b8d2f3b
2021-10-26 18:57:24 +02:00
Pau Espin 887fa01977 l1sap: Avoid re-(de)activating already (de)active lchans
This avoids triggering all sorts of unexpected paths where one tries to
release an already released lchan, etc.
This can happen for instance if BTS shuts down due to BSC link going
down, and hence resets all lchans, announcing it to the PCU. Then the
PCU may try to deactivate the channel sending act_req (disable), but the
BTS already unilaterally dropped the channels.
That code path seems to trigger some crash, probably because something
in lchan has been freed.

Related: SYS#4971
Change-Id: I093e4d4e23b527b10bf5d6ff538460626c30a8f8
2021-10-26 18:57:16 +02:00
Pau Espin c2ae1df890 bts-trx: sched: tx_pdtch_fn: Drop log line clogging logs
The burst is properly pre-filled to _sched_dummy_burst in
bts_sched_init_buffers(), so we are fine doing nothing on C0.

Related: SYS#5676
Related: SYS#4919
Fixes: 300e31ed13

Change-Id: Ia7045724a1a3206f5890c0b12843711ad2360ed8
2021-10-25 18:32:54 +02:00
Pau Espin fb905b8d23 scheduler: Fix check against empty PDCH blocks
msgb_l2len() will return nonzero values if msg->l2h is NULL.
Let's check against msg->l2h being NULL instead.

Related: SYS#5676
Related: SYS#4919
Fixes: 300e31ed13
Change-Id: I18b61fcaa858a53887191a18d560c2e929478c64
2021-10-25 18:32:54 +02:00
Pau Espin 5c5982067d Revert "bts-trx: sched: tx_pdtch_fn: Handle PCU idle blocks properly"
This reverts commit 8a85b71167.

This is actually the wrong fix. Proper fix comes as a follow-up patch,
since the root cause happens earlier in upper layers. No msg with
l2h=NULL should reach this point of code ever.

Change-Id: Ie23d94924f824bd7e89437ccf73b260f542477c6
2021-10-25 18:32:52 +02:00
Pau Espin 8a85b71167 bts-trx: sched: tx_pdtch_fn: Handle PCU idle blocks properly
PCU idle blocks are identified by being 0 length, and hence msg->l2h
being null. Don't try to encode those, but simply discard them silently.

In case there's a missing block in C0, we want to log the event since
the BTS is expected to send something on C0.

Related: SYS#5676
Related: SYS#4919
Fixes: 300e31ed13
Change-Id: I57e215fedeb415db4e67fdc56bf0f1410b5f7130
2021-10-25 15:57:24 +00:00
Pau Espin 991b4f6283 bts-trx: sched_lchan_pdtch: Refactor tx_pdtch_fn to get rid of goto tag
With this change the error case is moved at the end of the function,
which is more usual. At the same time, one goto tag can be removed,
simplifying the function.

This is also a preparation for next patch improvinga bit the logic
around same place.

Related: SYS#5676
Related: SYS#4919
Change-Id: Ifbd95ccbebf4d810b1fe0a162722e63fe69106b8
2021-10-25 15:57:24 +00:00
Vadim Yanitskiy 2e8332d650 [overpower] scheduler: handle {sacch,facch}_enabled flags
The new [bit-]fields in the RSL_IE_OSMO_TEMP_OVP_ACCH_CAP allow
more fine-grained control over the overpower feature, which
can be enabled:

  * for both SACCH and FACCH,
  * for SACCH only, or
  * for FACCH only.

Change-Id: Iaaab675a20bbefece832d913963c8c5ae32ff80c
Depends: Ia28293a12de0af71f55e701fb65c46e905dae217
Related: SYS#5319
2021-10-25 14:51:21 +00:00
Vadim Yanitskiy e50223074e [overpower] lchan_dump_full_vty(): print overpower state
Change-Id: I052f1d68b27b2dc7203835b4a93d40c94b0c8d82
Depends: Ia28293a12de0af71f55e701fb65c46e905dae217
Related: SYS#5319
2021-10-25 14:51:21 +00:00
Vadim Yanitskiy c5f75f0bcf [overpower] rsl: store full content of RSL_IE_OSMO_TEMP_OVP_ACCH_CAP
The new fields in 'struct abis_rsl_osmo_temp_ovp_acch_cap' allow:

  * selectively enabling SACCH and/or FACCH,
  * setting the RxQual (BER) threshold.

Both features are implemented in the follow-up commits.

Change-Id: I370c8f95fb64eceb60a9dc2eae1412f8a0df0f4e
Depends: Ia28293a12de0af71f55e701fb65c46e905dae217
Related: SYS#5319
2021-10-25 14:51:21 +00:00
Harald Welte 430954630b initial support for static userspace probes via systemtap
This adds a --enable-systemtap configure option, which will then
add static tracepoints to the generated osmo-bts-* binary.

At this point, only two sets of tracepoints are supported, and
only in osmo-bts-trx: ul_data_{start,done} and dl_rts_{start,done}.

The probes are intended to be used for analyzing the amount of time
needed for processing of uplink bursts / generation of downlink bursts.

Change-Id: Ibb4962253f1a195dc1a54405bac058ccb2545799
2021-10-25 10:06:09 +00:00
Vadim Yanitskiy 778aaedb95 lchan: introduce and use lchan_is_tch() helper
Change-Id: Icd832667cad1189e3e819c88bde837c4260aa252
2021-10-23 15:42:32 +03:00
Harald Welte 991020c049 rsl: fix handling of REL IND in lapdm_rll_tx_cb()
During the merge of [1] the patch hunk was applied at a slightly
wrong location, so the code path has become unreacheable.

Change-Id: I823c9101bcca72d5792e16379b02d3602ffc2726
Fixes: [1] Ie4f70c75f0137b4bd72d579b3a32575bac2fca3
2021-10-23 01:42:45 +03:00
Vadim Yanitskiy 184fcb8010 lchan_set_state(): also free pending messages if any
A logical channel may have associated messages, which are pending
for transmission until some event occurs.  Do not leak them.

Change-Id: I3264e6caa007e9e9cb9c1c2f8627c408bbb28b9e
2021-10-23 01:42:41 +03:00
Vadim Yanitskiy 5f3d01eed4 osmo-bts-trx: fix potential NULL pointer dereference
Change-Id: Ic9c1f3a3fb9c151bba4f6c3e605746fc8d43f44f
Fixes: CID#240207
2021-10-23 01:18:27 +03:00
Vadim Yanitskiy df6e4533dd measurement: fix wrong operator used in handle_ms_meas_report()
Change-Id: Iad781dde0406d341bf385734ceddf51999558dd3
Fixes: CID#240263
2021-10-23 01:18:27 +03:00
Vadim Yanitskiy de8e202d83 struct gsm_lchan: move tch.rep_facch to rep_acch.dl_facch
Finally we have all ACCH repetition state variables in one place.

Change-Id: I1469619528bb69c78c2fdc25bc1db208ead936d0
Related: SYS#5114
2021-10-22 02:53:00 +03:00
Vadim Yanitskiy e0154aa09b struct gsm_lchan: group ACCH repetition state fields
Change-Id: I2680c88f2a51b64f085a92233bc125338622babf
Related: SYS#5114
2021-10-22 02:53:00 +03:00
Vadim Yanitskiy ea0247e26c cosmetic: s/repeated_acch_capability/rep_acch_cap/g
Shorter symbol names are easier to read.

Change-Id: Ib1d51f91139b4c2fe794e37fc8543b2d7a9b9c07
Related: SYS#5114
2021-10-22 02:52:28 +03:00
Vadim Yanitskiy dffb6fac25 measurement: make sure that DL measurements are valid
In repeated_dl_facch_active_decision() we rely on the Measurement
Report message, that in some cases may not contain valid Downlink
measurements.  In this case, we should simply ignore it.

Change-Id: I0d72b454f2b770d5762303fb70a15a8cdc9d07d7
Related: SYS#5114
2021-10-22 02:51:36 +03:00
Vadim Yanitskiy 45094096b1 measurement: move repeated_dl_facch_active_decision() here
For the sake of consistency, call repeated_dl_facch_active_decision()
from handle_ms_meas_report(), so we have all functions using the
measurement results for Downlink executed in a single place.

Change-Id: Ibd5377ce642e49161f320ac8c33e9f966b3ddfaf
Related: SYS#5114, SYS#5319
2021-10-22 02:51:36 +03:00
Vadim Yanitskiy 31637b4673 measurement: handle_ms_meas_report() accepts const gh
Change-Id: Iba37c1a92b8b17a8ba8c958fb6c296747578cb1b
2021-10-22 02:51:36 +03:00
Vadim Yanitskiy e3818832b0 rsl: send NACK if BTS_FEAT_ACCH_REP is not supported
Change-Id: I7993cf7842ffde561f2bdc50f56516c3a188b2bc
Related: SYS#5114
2021-10-22 02:51:33 +03:00
Vadim Yanitskiy 26417d4574 rsl: rsl_tx_meas_res() does not change l3, make it const
Change-Id: Ie60a34f90f7872464e503dc7b56935aee95f0f80
2021-10-22 01:32:27 +03:00
Pau Espin ae606d69a4 Reset CBCH state after BTS shutdown
Related: OS#5273
Change-Id: Ib01d38c59ba9fa083fcc0682009c13d2db3664fe
2021-10-20 16:13:03 +02:00
Pau Espin d9079b192b gsm_pchan2chan_nr(): Properly assert if unexpected pchan is passed
A bit of archeology, history & recap:
ec1b5a0e9e2b6549e0ede48e803095e569997355 (openbsc.git) Adds assert in gsm_ts2chan_nr()
2f44693fad8505255293d3ed37dbd4e7cabebd37 (openbsc.git) ASSERT is disabled due to reported hit in octphy and
						       litecell in gerrit for ec1b5a0e9e2b6549e0ede48e803095e569997355
5cef0623ef (osmo-bts,git) minor fixes to gsm_ts2chan_nr() regarding the pragma
c9079d9106 (osmo-bts.git) GSM_PCHAN_NONE case is introduced in gsm_ts2chan_nr()

This code has long evolved and robustness has improved, it's not even
part of openbsc.git for several years now. Let's always assert if we
receive an unexpected value there, since they are all internally handled
values and hence we have control over them.

Related: OS#2906
Change-Id: I25e2cf0c922bc9902336e9add75a47535b9355bf
2021-10-19 12:39:55 +02:00
Pau Espin 3b02b9ad53 bts_shutdown_fsm: Make sure pending power ramping are aborted before closing TRX
It can happen when using several TRX that all of them go alreadyunder
shutdown target tx power level, but that due to configuration the BTS
still may want to keep pushing the tx power level even lower. Hence, we
end up in a situation where the FSM is trying to close all the TRX while the
power ramp procedure is ongoing for some of them. As a result, race
conditions can happen where for instance the power ramping procedure for
one TRX ends and calls the cb to send SETPOWER after the TRX PHY has
been closed (and hence TRXC link is unavaialble).
If that happens, the trx_if lower layers store the SETPOWER and attempt
a later retransmit, which may take up to 2 seconds after TRX becomes
active if BTS reconnects immediatelly.
Hence, we end up in some test cases where BTS reconnects and configures
some TRX while others are kep unconfigured for a while due to the
mentioned delay, hence the test attempting to use the TS while it hasn't
been yet configured.

The solution is to avoid this kind of unexpected events with ongoing
powe ramp once we have decided tx power is lower enough to shutdown the
TRX completely. Hence we abort the pending power ramp procedure.

Change-Id: Ibca581131eb142d7c38c917a0d6990efec03123c
2021-10-18 18:45:37 +02:00
Pau Espin 3cd4745efe lchan: Call lapdm_channel_exit() when state changes to NONE
Fixes crash when TTCN3 BTS_Tests_LAPDm TC_rr_response_frame_loss
runs run after TC_t200_n200.

The BTS was shutdown after TC_t200_n200 failed (drop oml link), and
lchan was moved ACTIVE->NONE without lapdm_channel_exit() being called
on it. Hence, on next test (TC_rr_response_frame_loss), when
lchan_init_lapdm() was called again, some memory corruption was caused.

The lapdm_channel_exit can be dropped from gsm_lchan_release() and
rsl_tx_rf_rel_ack() since it's already called in the same path:
"""
rsl_rx_rf_chan_rel
	gsm_lchan_release(lchan, LCHAN_REL_ACT_RSL);
		l1sap_chan_rel(lchan->ts->trx, gsm_lchan2chan_nr(lchan));
			l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_DEACTIVATE)
				bts_model_l1sap_down
					bts_model_lchan_deactivate_sacch(lchan);
						-
					lchan_deactivate(lchan);
						bts_model_lchan_deactivate
							lchan_set_state(lchan, LCHAN_S_NONE); <---------
					mph_info_chan_confirm(trx, chan_nr, PRIM_INFO_DEACTIVATE, 0);
						l1sap_info_rel_cnf
							rsl_tx_rf_rel_ack(lchan);
								lapdm_channel_exit(&lchan->lapdm_ch);
		lapdm_channel_exit(&lchan->lapdm_ch);
"""

Related: SYS#5262
Change-Id: If0ec5f0c7be4d15c8d684d33e15e24d68bd5192e
2021-10-14 17:59:28 +02: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
Pau Espin 07232521a9 Move lchan_deactivate() to lchan.c
Change-Id: If75ed432fa9dcb10159a0dac9b8ba7efe6958b35
2021-10-14 17:48:31 +02:00
Pau Espin ac81d2789a lchan: Avoid applying transition changes if state new==old
Let's avoid running over state change conditions or even printing log
lines if there's no state change.

Change-Id: I1ca86aa846084f53751076643665cb6dabc26a06
2021-10-14 17:04:24 +02:00
Pau Espin 578b540711 lchan: Update log line level to use macro and level INFO
Change-Id: Idd48fd8fbb13b715096a4765dcb08a18d85098a7
2021-10-14 17:03:45 +02:00
Pau Espin fd051b0f5c Move lchan related code to lchan.{c,h}
Change-Id: I17ebe6af69e31d1b4dbad7656bbf043f4c9243c1
2021-10-14 14:55:35 +02:00
Pau Espin 03cb50f809 lchan: Setup early_rr_ia timer only once during init
There's no need to re-setup it every time.

Mark the cb as static since its private to the module, and move it
above its use point so it can be referenced.

Change-Id: I90324f26d8ca09d425c7523a25b3e6c951fa49d6
2021-10-14 14:41:41 +02:00
Vadim Yanitskiy 72d9981cd0 osmo-bts-trx: refactor 'maxdly' / 'maxdlynb' commands
* Move way too verbose command description to the manuals.
* None of these commands apply immediately, correct the attributes.
** Remove meaningless call to l1if_provision_transceiver_trx().
* Make 'maxdlynb' hidden, so it only appears in the expert mode.
* One GMSK symbol actually corresponds to 550m.

Change-Id: I46839cf56bba2dcdc70303cd393e86d35aa2f3f5
2021-10-13 20:01:08 +00:00
Pau Espin 0e2a20bfb4 bts-trx: Guard call to trx_sched_clean with NULL trx ptr
trx_phy_inst_open() already guards against NULL trx ptr when calling
trx_sched_init(). Later on, in same path, trx_phy_inst_close() can be
called which ends up calling trx_sched_clean(trx), this time not being
guarded against NULL trx. This fixes Coverity CID#240498.

Fixes: CID#240498
Change-Id: I00afc739559d57dd98db68c76f2a85006c15e875
2021-10-13 17:47:25 +02:00
Eric Wild 7643be1d55 osmo-trx: fix maxdly
- one gsm symbol is 0,00000369 seconds
- 2*550m/c = 0,00000366 seconds
-> one ta symbol is a DISTANCE of 550m (or a RTT of 550m*2) between bts and ue.
-> no idea why this was constrained to TA/2.

Change-Id: I8d79080c82411e6427eec37d008614fa5d5e1ace
Related: OS#5140
2021-10-12 16:08:00 +00:00
Pau Espin 3e2b7faed6 rsl: Fix all shadow TS being Chan Act NACKed
The OML NM Channel FSM state only apply to primary timeslots, hence we
need to make sure we pick the primary TS (the non-shadow one).

Due to this bug, all channels on shadow TS where NACKed because the
related state was never "Enabled Ok".

Fixes: c97a7f51e1
Related: OS#5249
Related: OS#5251
Change-Id: If47e4bdd45a05ed1b5709b6e3d541f2830723e37
2021-10-11 13:53:27 +02:00
Pau Espin 074672b604 Make sure lchan allocated memory from shadow_ts is properly freed
Since non-shadow TS are currently not allocated as talloc contexts,
lchan objects tend to allocate their own memory on trx talloc ctx
instead. That's fine for non-shadow TS, since the TS follow trx lifecycle
since they are part of the same talloc context. However, shadow TS are
recreated (re-allocated) each time the BTS reconnects, hence when htey
are freed we need to free substructs (lchan) memory in order to avoid it
being kept in trx talloc ctx.

Related: OS#5248
Change-Id: I73742535eb3c40a6866731acbff782940dab06c3
2021-10-11 11:38:35 +02:00
Pau Espin 33b4b15f75 Add new gsm_bts_trx_free_shadow_ts() function
Use it as a counterpart of gsm_bts_trx_init_shadow_ts()

Change-Id: I38baa2b2cfcf6221325d45860b3c7dd53235b8ff
2021-10-11 11:19:11 +02:00
Vadim Yanitskiy 8e7d00f1ce trx_sched_clean(): also free() the shadow timeslot
Change-Id: Ic14e9de7487ba8152ffb1aa1bab508a2b9a11ea0
Related: OS#5248
2021-10-11 08:41:56 +00:00
Vadim Yanitskiy 0eb6891259 trx_sched_clean_ts(): also free() the associated 'struct l1sched_ts'
Change-Id: I44a8f18c81dd8bc76ca07dfaae7bcdb2fedc9261
Related: OS#5248
2021-10-11 08:41:56 +00:00
Pau Espin be688f1603 nm_*_fsm: reset mo.nm_attr from previous runs when entering state NOT_INSTALLED
Code in oml.c, upon receiving net attributes, merges the new attributes
with old ones (for some reason I don't really know). Hence, if we
disconnect from a BSC and go to NOT_INSTALLED state, we must free
previous nm_attr in order to avoid mixing them once we connect to a new
(potentially different) BSC upon reconnect.

Related: OS#5248
Change-Id: I45cc22dd68121a7930301581bfd0a8db37879c77
2021-10-08 20:58:50 +00:00
Pau Espin 9419319ab5 nm_*_fsm: Move reset state code to st_op_disabled_notinstalled_on_enter
Let's rather put it there instead of the shutdown code path, since we'll
be adding more and more reset coe there.

Change-Id: I43a136ade731a2c58c0a29d97875088e9b6d4414
2021-10-08 20:58:50 +00:00
Vadim Yanitskiy 556a966952 vty: show interference level / band in 'show lchan'
Change-Id: Ide45a0f7836bf35ffbe88070fa8367022311ca44
Related: SYS#5313
2021-10-08 16:54:20 +06:00
Vadim Yanitskiy ee5eb61694 l1sap: check if BTS model supports interference reporting
Currently, only osmo-bts-trx is capable of reporting the interference
levels to L1SAP.  Thus it does not make sense to trigger the averaging
logic and send empty reports over the A-bis/RSL and the PCUIF.

Change-Id: Ic17eb46bdca3c33ac4d6e560a093b635b75424a5
Related: SYS#5313
2021-10-08 16:54:20 +06:00
Vadim Yanitskiy 605cb85afd osmo-bts-trx: report PDCH interference levels to L1SAP
Starting from [1], interference levels on PDCH timeslots are also
reported over the A-bis/RSL.  They may be useful for the BSC to
determine whether dynamic PDCH timeslots might be better used for
new circuit switched connections, or whether alternative PDCH slots
should be allocated for interference reasons.

 * Handle GSM_LCHAN_PDTCH in lchan_report_interf_meas().
 * Rework pcu_tx_interf_ind() to accept 'struct gsm_bts_trx'.
 * Call pcu_tx_interf_ind() from l1sap_interf_meas_report().

Regarding pcu_tx_interf_ind(), it's better to call this function
from the upper layers once, rather than calling it from various
places in the model specific code.

[1] I5b4d1da0920e788ac8063cc765fe5b0223c76758

Change-Id: I3fbaad5dbc3bbd305b3ad4cb4bfb431a42cfbffc
Related: SYS#5313
2021-10-08 16:54:20 +06:00
Vadim Yanitskiy 187e099c3b rsl_tx_rf_res(): also report noise levels for PDTCH
This information may be useful for the BSC to determine whether
dynamic PDCH timeslots might be better used for new circuit
switched connections, or whether alternative PDCH slots should
be allocated for interference reasons.

Change-Id: I5b4d1da0920e788ac8063cc765fe5b0223c76758
Related: SYS#5313
2021-10-08 10:48:51 +00:00
Vadim Yanitskiy e73516ed00 rsl_tx_rf_res(): separate interference AVG / band calculation
It's cleaner from the architectural point of view to have the
interference measurements processed in a separate function.

Change-Id: I3981608e01a50585359cad673c38c8a305027d30
Related: SYS#5313
2021-10-08 10:48:51 +00:00
Vadim Yanitskiy 7726d23327 rsl: prevent race condition during timeslot re-configuration
It may happen that the BSC requests logical channel activation on a
dynamic timeslot, which is in a process of switching from one pchan
type to another due to a preceding channel activation request.

In this case 'struct gsm_bts_trx_ts' already holds an msgb with the
preceding RSL CHANnel ACTIVation message, that is normally handled
once the PHY completes the process of timeslot re-configuration.

On receipt of subsequent RSL CHANnel ACTIVation messages, in function
dyn_ts_l1_reconnect() we overwrite the preceeding msgb (memleak), by
the most recent one.  And once the timeslot re-configuration is done,
only the most recent CHANnel ACTIVation message gets ACKed.

In order to avoid this, let's move the msgb ownership to 'struct
gsm_lchan', so it cannot be overwritten by the CHANnel ACTIVation
message that is related to a different lchan on the same timeslot.

Change-Id: Ia625c2827fca883ea712076706d5ef21ed793ba6
Related: I3b602ac9dbe0ab3e80eb30de573c9b48a79872d8
Fixes: OS#5245
2021-10-08 05:23:08 +00:00
Vadim Yanitskiy 2e62159c8d .gitignore: add tests/amr/amr_test
Change-Id: Id1f8710f0d6b7511fff6ab221e6ec974a94c6f8b
Fixes: I94a934a6b3b397b4cd0e9da3577325de58814335
2021-10-08 05:21:32 +00:00
Pau Espin 715ff2900a nm_bts_fsm: Reset si_valid bitmask when BTS is shut down
Otherwise after reconnecting some SI are still marked as valid despite
the new BSC conn didn't set them.

Change-Id: I71e2a5cdf4e2e287db7b05df1a165a1e32c958ca
2021-10-07 16:25:19 +02:00
Pau Espin 15c23179dc nm_channel_fsm: Release lchans after BTS shutdown
This fixes some TTCN3 tests where some lchan resources were kept from
previous tests.

Change-Id: I78dca32cd061fba86cc88c4c4f323b33d51c58d0
2021-10-07 14:16:41 +02:00
Pau Espin b1409015fa Introduce gsm_lchan_release function helper
Change-Id: I0525beaba3c833f8d7adf9701fe373761a7720d3
2021-10-07 12:11:52 +00:00
Pau Espin db5bf829cd lchan.h: Add related ticket info to FIXME comment
Change-Id: I09ea92e843383d65c8033196814d345135ff918e
2021-10-07 12:11:52 +00:00
Pau Espin 36bbf1c328 Move lchan,power_control related code from gsm_data.c to their own files
We already have similar classification in osmo-bsc.

Change-Id: I1493f40d99f88a565f15d3e0943a512fb9b8719a
2021-10-07 12:11:52 +00:00
Pau Espin e525584f3a Move lchan,power_ctrl specific code from gsm_data.h to their own files
Let's split all lchan and power_control specific stuff into their own headers,
it helps finding out data and operations available related to them.

We already have similar classification in osmo-bsc.

Change-Id: I6424dcbd2e329fc1a516f8886359554ed7e9487e
2021-10-07 12:11:52 +00:00
Pau Espin e4d60ff8ff load_indication.c: Avoid sending if CCCH is still not operational
It makes no sense to transmit load information if the channel is still
not operational. This solves errors messages seen in osmo-bsc.

Related: OS#4872
Change-Id: I7ddda9776158eed0694df9e458f3f91df90bf674
2021-10-07 11:22:07 +00:00
Pau Espin 3c32cce087 MS Power Control Loop: Use P_CON_INTERVAL=2 by default
Have a more stable loop with less temporary oscillations at the expense
of increased reaction time.

4 SACCH blocks (P_CON_INTERVAL=2) is the minimum interval to get stable
measurements for the last requested MS Power level. With P_CON_INTERVAL=1,
are also made during a period with stable power being use to transmit,
but the MS Power level used (and announced in MR) is not the last one
requested by the BTS, but the one requested in the previous loop
iteration. This can make the MS and BTS bounce 2 values forth and back,
and create some temporary oscillation.

See osmo-bsc User manual section "Power Control" for more information.

Related: SYS#5371
Change-Id: I91c505447f68714239a4f033d4f06e91893df201
2021-10-07 10:47:00 +00:00
Pau Espin 77e014f061 Introduce gsm_lchan_init() function helper
Let's move lchan specific struct stuff into lchan.c

Change-Id: I9cb96707c63b8b7d76591d25fe906f02e34bb76b
2021-10-07 10:26:24 +00:00
Pau Espin c97a7f51e1 rsl: NACK Chan Activation for lchans on disabled TS
A broken BSC could send a Chan Activation on a TS which has not yet been
enabled (or even configured). This is the case with our TTCN3 tests,
where OML side is currently handled in parallel by an osmo-bsc while
TTCN3 takes care of the RSL side. This can actually be seen as a
malfunctioning BSC, but it was spotted that given this sequence of
events osmo-bts can crash (see ticket below).

Hence, let's NACK any attempt from a BSC to activate an lchan on a
disabled TS.

Related: OS#5249
Change-Id: I9c3b68487c12efc412a057728a561e061560c544
2021-10-07 11:12:21 +02:00
Pau Espin 93fbcdfb39 trx_provision_fsm: Fix shutdown while POWERON in transit
EV_CLOSE in state OPEN_WAIT_POWERON_CNF was not permitted, hence TRX0
was finally moved and kept to state OPEN_POWERON while other TRX were
moved OPEN_POWERON->OPEN_WAIT_POWER_CNF:

"""
20211004090637640 DL1C <0006> trx_provision_fsm.c:86 TRX_PROV(phy0-0)[0x55fddfb1fda0]{OPEN_POWEROFF}: Received Event TRX_PROV_EV_NOMTXPOWER_CNF
20211004090637640 DL1C <0006> trx_provision_fsm.c:498 TRX_PROV(phy0-0)[0x55fddfb1fda0]{OPEN_POWEROFF}: state_chg to OPEN_WAIT_POWERON_CNF
20211004090637640 DTRX <000b> trx_if.c:256 phy0.0: Enqueuing TRX control command 'CMD POWERON'
...
20211004090637641 DABIS <000d> abis.c:397 E1L(0) Signalling link down
...
20211004090637642 DOML <0001> bts_shutdown_fsm.c:74 BTS_SHUTDOWN(bts0)[0x55fddfb0b4e0]{NONE}: state_chg to WAIT_TRX_CLOSED
...
20211004090637642 DL1C <0006> l1_if.c:191 TRX_PROV(phy0-3)[0x55fddfb238b0]{OPEN_POWERON}: Received Event TRX_PROV_EV_CLOSE
20211004090637642 DL1C <0006> trx_provision_fsm.c:606 TRX_PROV(phy0-3)[0x55fddfb238b0]{OPEN_POWERON}: state_chg to OPEN_WAIT_POWEROFF_CNF
20211004090637642 DOML <0001> l1_if.c:194 NM_RCARRIER_OP(bts0-trx3)[0x55fddfb2ab20]{DISABLED_OFFLINE}: Received Event DISABLE
20211004090637642 DOML <0001> l1_if.c:195 NM_BBTRANSC_OP(bts0-trx3)[0x55fddfb2ae00]{DISABLED_OFFLINE}: Received Event DISABLE
20211004090637642 DL1C <0006> l1_if.c:191 TRX_PROV(phy0-2)[0x55fddfb22500]{OPEN_POWERON}: Received Event TRX_PROV_EV_CLOSE
20211004090637642 DL1C <0006> trx_provision_fsm.c:606 TRX_PROV(phy0-2)[0x55fddfb22500]{OPEN_POWERON}: state_chg to OPEN_WAIT_POWEROFF_CNF
20211004090637642 DOML <0001> l1_if.c:194 NM_RCARRIER_OP(bts0-trx2)[0x55fddfb27410]{DISABLED_OFFLINE}: Received Event DISABLE
20211004090637642 DOML <0001> l1_if.c:195 NM_BBTRANSC_OP(bts0-trx2)[0x55fddfb27660]{DISABLED_OFFLINE}: Received Event DISABLE
20211004090637642 DL1C <0006> l1_if.c:191 TRX_PROV(phy0-1)[0x55fddfb21150]{OPEN_POWERON}: Received Event TRX_PROV_EV_CLOSE
20211004090637642 DL1C <0006> trx_provision_fsm.c:606 TRX_PROV(phy0-1)[0x55fddfb21150]{OPEN_POWERON}: state_chg to OPEN_WAIT_POWEROFF_CNF
20211004090637642 DOML <0001> l1_if.c:194 NM_RCARRIER_OP(bts0-trx1)[0x55fddfb23b50]{DISABLED_OFFLINE}: Received Event DISABLE
20211004090637642 DOML <0001> l1_if.c:195 NM_BBTRANSC_OP(bts0-trx1)[0x55fddfb23e60]{DISABLED_OFFLINE}: Received Event DISABLE
20211004090637642 DL1C <0006> l1_if.c:191 TRX_PROV(phy0-0)[0x55fddfb1fda0]{OPEN_WAIT_POWERON_CNF}: Received Event TRX_PROV_EV_CLOSE
20211004090637642 DL1C <0006> l1_if.c:191 TRX_PROV(phy0-0)[0x55fddfb1fda0]{OPEN_WAIT_POWERON_CNF}: Event TRX_PROV_EV_CLOSE not permitted
20211004090637642 DOML <0001> l1_if.c:194 NM_RCARRIER_OP(bts0-trx0)[0x55fddfb0bb70]{DISABLED_OFFLINE}: Received Event DISABLE
20211004090637642 DOML <0001> l1_if.c:195 NM_BBTRANSC_OP(bts0-trx0)[0x55fddfb0be50]{DISABLED_OFFLINE}: Received Event DISABLE
20211004090637642 DTRX <000b> trx_if.c:672 phy0.0: Response message: 'RSP POWERON 0'
20211004090637642 DL1C <0006> trx_provision_fsm.c:56 TRX_PROV(phy0-0)[0x55fddfb1fda0]{OPEN_WAIT_POWERON_CNF}: Received Event TRX_PROV_EV_POWERON_CNF
"""

This left the BTS in an unexpected broken state and TTCN3 tests after
this race condition failed.

Change-Id: Ic4831201a5be1bc9aff757a9a061c637d98582de
2021-10-04 14:33:09 +00:00
Pau Espin 0d8f51f1a5 trx_provision_fsm: poweronoff_sent flag: track POWERON and POWEROFF separately
It helps better understanding the code, and will allow handling
situations where for instance a POWERON in in transit while the BTS is
instructed to shutdown, hence a POWEROFF needs to be sent.

Change-Id: Iaf62217ceab7420afa4140cba61e1c2f983c61b4
2021-10-04 14:33:09 +00:00
Pau Espin 582d9cf0d5 trx_provision_fsm: Drop impossible paths
config.enabled is always true in that state. Hence, those paths can be
securely dropped since only add confusion.

Change-Id: Icf00c52e61ddedd8e32eb37223cea5686005e6a3
2021-10-04 14:33:09 +00:00
Pau Espin 3440104723 trx_provision_fsm: Drop unneeded reset of fields
Since recently, reset of all fields is already properly done in
trx_provision_reset().

Change-Id: I3e6bc8205704e425644507dd1f1b299dea4cd851
2021-10-04 14:33:09 +00:00
Vadim Yanitskiy fa9dd74d83 rsl: remove redundant logging in rsl_rx_chan_activ()
The first check in this function ensures that the state is NONE.
Therefore it does not make sense to print it below..

Change-Id: I62ea4117dd5e1eebb8774809134e5cb73774945c
2021-10-04 12:44:24 +00:00
Vadim Yanitskiy 61349d6f14 abis: fix memory leak in abis_oml_sendmsg()
Change-Id: Ifc46b94b4540705f7d9b4678a7398158f3aaf7c5
Fixes: Iecd3c7cb96f5fff3b4c7e04c74e031df0f7a6987
2021-10-04 12:44:04 +00:00
Pau Espin 66f5fb0577 bts-trx: Keep the process ongoing trying to reconnect on Abis link down
Change-Id: I28cb36a43b44865caa409b3255c05963acc74848
2021-10-03 20:02:57 +00: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
Vadim Yanitskiy 5fa08dee72 fix handle_ms_meas_report(): properly count measurement reports
Each RSL MEASurement RESult message contains a Measurement Number
IE, which is basically a monolithically increasing number.  We
shall not increase this counter if for whatever reason the report
has not been sent to the BSC.

Change-Id: I441adb4b202e94ddee8c0b6777849e36ea644b1d
Fixes: Id67259ec9ac4c2c33bd0eef3f64450affbe3fb9f
Fixes: OS#5243
2021-09-30 11:36:47 +00:00
Pau Espin 1c3431db95 Delay abis reconnect while bts is shutting down
Avoid re-connecting to a new BSC while BTS is in shutting down. All the
FSMs are complex enough to even try to re-start when stopping has not
yet finished...

Change-Id: I1727828a16f4ec8043b00cc6b2e02a4c35f71377
2021-09-30 13:15:24 +02:00
Pau Espin d17beeacde bts-trx: Delay power ramp up until RCARRIER is ENABLED
Prior to this patch, the power ramping started when the PHY is
available, but that doesn't necessarily mean the RCARRIER is enabled.

Due to this, it was spotted a situation where BTS bootstrap failed after
PHY turning up, when RSL connection establishment failed. Hence
bts_shutdown_fsm triggered a shutdown while an active power ramping up
was ongoing...

Change-Id: I17208b74ea2649b1bbb717aee0aa355e42b7e860
2021-09-30 13:14:08 +02:00
Pau Espin 134c999103 trx_provision_fsm: Support OPEN_POWEROFF->CLOSED transition
This may happen if bts_shutdown starts a poweroff procedure while
POWERON was still not sent to the TRX. In this case, we want to go back
to initial closed state to fullfill expected state when BTS is shutdown.

Change-Id: Id660fa1018ef175ab237733b37629c56313c061d
2021-09-30 11:12:43 +00:00
Pau Espin 304de2e115 trx_provision_fsm: Fix TRX!=0 never going back to CLOSED state
Change-Id: I39bef8b5776cbf1098753865c597b1c99d355bec
2021-09-30 11:12:43 +00:00
Pau Espin 27f42205ea abis: Fix line leaked & recreated upon every reconnect
Previous code creating a new line was really a workaround to have it
working while previous lines were being stacked internally inside
libosmo-abis.
Let's handle reference counts for the line properly and keep using the
same line always (since it can be further configured by libosmo-abis' VTY).
Recent patches to libosmo-abis fixed a bug where e1inp_line_update()
would only work the first time it was called on a e1np_line, and follow
up calls would be no-ops. This fix allows re-configuring and hence
reusing the same line to reconnect to BSC.

Depends: libosmo-abis Change-Id: Iff8092f88726cf238dac2abb99e135ac5864272d
Change-Id: Id7fd3ef81bbc517821def31f1a60f905a0e2fb52
2021-09-30 11:12:43 +00:00
Vadim Yanitskiy 414bc76ea5 scheduler: fix comments explaining the interleaving of TCH/H
Change-Id: I2820e42ae10f05ba1ca956b948ea0d77e6abeb3d
2021-09-30 11:11:34 +00:00
Philipp Maier 1f213a2402 rsl: parse temporary overpower value RSL CHAN ACT / MODIFY
The temporary overpower value that is to be used with FACCH and SACCH is
transferred using a proprietary RSL IE (RSL_IE_OSMO_TOP_ACCH_CAP). The
parsed value is then stored in lchan->bs_acch_overpower_db so that it
can be used.

Change-Id: I426c2510865c4a986c68f2027cc676aaac0d8a4c
Related: SYS#5319
2021-09-29 07:54:45 +00:00
Pau Espin d680a62975 scheduler: Fix lqual_cb not populated for TCH.ind
Change-Id: I79c83b974149b1e94155bc61172b57de8003891e
2021-09-28 12:02:15 +02:00
Pau Espin 0468376c53 Move TA & Power Loops further up the stack, take DTXu flag into account
Only once we receive the Measurement Result on L3 from MS we are able to
find out whether DTXu was used, and hence whether SUB or FULL
measurement set should be used.

Let's move all control loops there to have them in one place together,
and have it at a similar level where it would lay if it was to be
implemented in the BSC.

Related: SYS#4917
Change-Id: Ic152473577ff7c33d30b3f4ee7e321fcb523f723
2021-09-28 12:02:15 +02:00
Pau Espin 3871c1ff0c Decouple handling of Measurement Report from lapdm
This is a preparation commit in order to move power loops up in the
stack in order to have DTXu information available, in order to decide
whether SUB or FULL ul measurements should be used in the MS Power
Control Loop.

Function rsl_tx_meas_res() is stripped from code changing state, and it
simply encodes content and transmits the message.

Change-Id: Id67259ec9ac4c2c33bd0eef3f64450affbe3fb9f
2021-09-28 12:02:03 +02:00
Pau Espin 5f4e729122 bts-trx: Fix rxgain & maxdly VTY values being reset
Recent commit added code to reset trx_provision_fsm state fields in orer
to support re-using the FSM once BTS is reconnected to a BSC.

However, some values being reset there are not set up when reconnecting
to the BSC, but rather configured through VTY at startup. Hence those
values should be kept.

Fixes: 32b51eca7d
Change-Id: I5c31241327b98386c313cd9377cf76c009456105
2021-09-27 20:20:18 +02:00
Vadim Yanitskiy d6ef2bf12f osmo-bts-trx: implement Temporary Overpower for SACCH/FACCH
GSM/EDGE Evolution and Performance, Section 12.3 suggests Temporary
Overpower as another solution to improve SACCH/FACCH performance in
case of bad C/I. The idea here is that you increment the DL transmit
power by 2..4dB only for FACCH/SACCH bursts, while keeping all voice
bursts at the lower (normal) level as determined by BS power control.

SACCH blocks can be recognized by the channel type, since they're
always transmitted in specific frames of a multiframe.  FACCH blocks,
however, are not predictable and can substitute voice blocks at
(almost) any time.  Thus we need to mark FACCH bursts as such in
the logical channel handlers (using TRX_BR_F_FACCH).

Change-Id: Ie8a626fefccf1eb07271058e5126ec106cb1abcf
Related: SYS#5319
2021-09-27 16:02:26 +00:00
Vadim Yanitskiy 056a3632dc osmo-bts-trx: remove an 'else' branch in _sched_dl_burst()
When I introduced this branch in change [1], I was under assumption
that PDCHs never have an associated 'struct gsm_lchan'.  This is
incorrect: the association actually happens during PDCH activation,
i.e. when osmo-pcu establishes connection over the PCUIF.

Enforcing attenuation of 0 dB for other channel types makes no sense.

[1] I3dcee6e910ccc61c5c63c728db9ea04327e2fc98

Change-Id: I77a839725f22be1be4a025f579c4c9ccdfb53460
2021-09-27 16:02:26 +00:00
Vadim Yanitskiy 4034e61d03 trx_sched_set_lchan(): use LOGL_INFO for logging messages
There is no need to log channel activation / deactivation messages
as LOGL_NOTICE - this is a normal event requiring no attention.

Change-Id: I7765fecb7f7ec67c8f96e91c378626e21e48c71d
2021-09-26 13:33:38 +06:00
Vadim Yanitskiy 7b80dde7b5 osmo-bts-trx: bts_model_l1sap_down(): remove chan_nr patching
Thanks to [1], there is no need to patch chan_nr for PDCH anymore.
The upper layers are now expected to use the correct values.

[1] I01680140c7201bf5284b278bceaea8ae01c122b2

Change-Id: I26eb2081eddb4ce900a7867897bc69c3f77dbd73
Related: OS#5238
2021-09-26 13:23:41 +06:00
Vadim Yanitskiy e51fb333ae gsm_lchan2chan_nr(): separate RSL specific variant of this API
The ip.access style dynamic timeslots are a bit special in a way that
on the A-bis/RSL we always use the Channel Number value of TCH/F,
even in PDCH mode.  This is why gsm_lchan2chan_nr() would always
return values corresponding to TCH/F for TCH/F_PDCH.

This behavior is only acceptable in the context of RSL messages, while
other parts of the code base may not work properly due to this trick.
A good example is the scheduler in osmo-bts-trx, where we have to
patch Channel Number value to make channel activation work.

  DPCU INFO pcu_sock.c:853 Activate request received: TRX=0 TS=5
  DL1C INFO l1sap.c:2043 (bts=0,trx=0,ts=5,ss=0) Activating channel TCH/F on TS5
  DL1C NOTICE scheduler.c:1097 (bts=0,trx=0,ts=5,ss=0) Activating PDTCH
  DL1C NOTICE scheduler.c:1097 (bts=0,trx=0,ts=5,ss=0) Activating PTCCH

In the code branch responsible for channel deactivation, we somehow
forgot to add the same workaround, so deactivation does not work:

  DL1C INFO l1sap.c:2076 (bts=0,trx=0,ts=5,ss=0) Deactivating channel TCH/F on TS5
  DTRX INFO trx_if.c:255 phy0.0: Enqueuing TRX control command 'CMD NOHANDOVER 5 0'
  DRSL NOTICE rsl.c:1286 (bts=0,trx=0,ts=5,ss=0) (bts=0,trx=0,ts=5,ss=0) not sending REL ACK

Because of that, TCH/F_PDCH timeslots actually remain active after
deactivation, so the scheduler keeps producing L1SAP DATA.ind.

  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DL1P ERROR l1sap.c:732 1583426/1194/00/29/14 No lchan for DATA MEAS IND (chan_nr=PDCH on TS5)
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message
  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message
  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DL1P ERROR l1sap.c:732 1583430/1194/04/33/18 No lchan for DATA MEAS IND (chan_nr=PDCH on TS5)
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message
  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message

Instead of patching Channel Number in various places, let's rather
make the RSL specific behavior configurable by having two variants
of gsm_lchan2chan_nr().

Change-Id: I01680140c7201bf5284b278bceaea8ae01c122b2
Fixes: OS#5238
2021-09-26 13:23:41 +06:00
Vadim Yanitskiy 9e2262b667 l1sap: unify channel (de)activation/modification messages
LOGPLCHAN() prepends the contextual information for us, there
is no need to print trx->nr again.  Take a chance to apply
some additional cosmetic changes, like fixing capital letter.

Change-Id: Ia199d584c937eef4118c99af4523fd91b2e46107
2021-09-26 13:23:41 +06:00
Vadim Yanitskiy 9be6b56033 osmo-bts-trx: return -ENODEV if 'bursts_p' is NULL
In functions responsible for Downlink burst scheduling, it may happen
that the buffer, containing a complete set of to be transmitted bursts,
a) is not yet allocated or b) was de-allocated intentionally.  In this
case, we return early to avoid NULL pointer dereference.  The returned
value is then checked against 0 in _sched_dl_burst().

Returning 0 makes _sched_dl_burst() apply per-burst attenuation, as
well as the A5/x encryption (if enabled).  And this makes no sense
in either of the cases mentioned above.

Moreover, in the BCCH power reduction mode, this causes some bursts
(bid > 0) of idle PDTCH/PTCCH blocks to be transmitted at full power,
breaking the energy saving feature.

Change-Id: I18aa73cc950fdfac030b63f7a434a71b4596095d
Related: SYS#4919
2021-09-24 23:41:44 +06:00
Pau Espin 72d81b978a osmo-bts-omldummy: Fix crash accessing null phy
osmo-bts-omldummy is known to be specially in the sense that it has no
phy. This should ideally be changed to have some dummy object, but so
far that's how it is. A recent commit checking the phy's forgot about
the fact that BTS model has no phy. Let's fix it.

Fixes: 4ddc37ce71
Change-Id: Iba7873530aac74b3bf799819890641196dacf170
2021-09-23 22:48:41 +02:00
Pau Espin e12f911bbb Revert "abis: Fix line leaked & recreated upon every reconnect"
This reverts commit bc6d35f52d.

Change-Id: I15063f0156ed8910795cd5ffe045e2d0cbca6276
2021-09-23 22:48:41 +02:00
Pau Espin 9a3a5cbc9c Revert "bts-trx: Keep the process ongoing trying to reconnect on Abis link down"
This reverts commit 0c44a92197.

Change-Id: Ib367d5ddfaccfad3f1b6acc53abf25a0f1834255
2021-09-23 22:23:47 +02:00
Pau Espin 0c44a92197 bts-trx: Keep the process ongoing trying to reconnect on Abis link down
Change-Id: If24c7d8d58875dd8baf4031a8fc2a8656702a2b5
2021-09-23 14:07:53 +02:00
Pau Espin bc6d35f52d abis: Fix line leaked & recreated upon every reconnect
Previous code creating a new line was really a workaroudn to have it
working while previous lines were being stacked internally inside
libosmo-abis.
Let's handle reference counts for the line properly and erase +
re-create it every time.
Recent patches to libosmo-abis fixed a crash happening when refcount
being 0 and destroying the object (object was not removed from a global
llist).

Depends: libosmo-abis Change-Id I1314d6b917ecb622994507475eb894e649a1a2ad
Change-Id: Ic37ae5bf657247e8cce99182c40d9adf890a5e41
2021-09-23 14:07:53 +02:00
Pau Espin 127e8fc416 abis: Fix memory leak of bts->osmo_link upon link going down
Commit below (see "Fixes" section) wrongly erased the code re-introduced
in this commit, due to not spotting different between "oml_link" and
"osmo_link". This commit is hence a revert of such commit, updated to
current code.

Fixes: c2ba34d9c1
Change-Id: Id436116e5cd0bec024b2f9943fbff8d0bdc956ac
2021-09-23 14:07:53 +02:00
Pau Espin 2e90e0f756 Avoid sending Load Indications when BTS is not RSL-connected
Change-Id: I97e8dd7dd58ee2ec90c3a38d45dfd944db44c412
2021-09-23 14:07:53 +02:00
Pau Espin 130e2e59c6 bts_trx: Drop non-executed path in trx_link_estab()
This function is only called during sign_link_up() e1inp callback, hence
only the link!=NULL condition (UP) is ever executed. Let's drop the DOWN
path and make it a function only used to trigger events when link
becomes up, similar to what bts_link_estab() does with OML.

Here it becomes clear the NM_EV_RSL_DOWN was never sent. It's not much
of an issue though since it would only make transition RCARRIER/BBTRANSC
Enabled->DisabledOffline. However, since due to libosmo-abis limitation
we receive a sign_link_down() for the entire line when 1 of its links
goes down, we don't care much since we go for shutdown of the entire BTS
anyway. Ideally, libosmo-abis would support simply telling us 1 of the
links in the line went down and if it was not OML and not RSL TRX==C0,
then we could keep on running and simply disable the related TRX.

Change-Id: Iac553c68339c0da32fd313676995747eb4344087
2021-09-23 12:07:29 +00:00
Pau Espin 49979bb794 abis: Call bts_model_abis_close() when Abis link goes down
This way based on BTS model features it can attempt to reconnect or
simply exit the process.

Change-Id: I42b43a0128bd4b579d9695e6dd2bccf6dc7e1d41
2021-09-23 12:07:29 +00:00
Pau Espin 37f63f12f7 bts_shutdown_fsm: Allow configuring FSM to shutdown without exiting process
This feature is not yet used by any bts_shutdown_fsm caller, but will be
used in the future when Abis link goes down.

Change-Id: I5dc282fdbcf862067be326e72b6183dd544222ae
2021-09-23 12:07:29 +00:00
Pau Espin 4ddc37ce71 nm_bts_fsm: Make sure PHYs are opened when SW_ACTivating it
Since recently we support shutting down phys when BTS goes into shutdown
mode. Let's make sure they are opened again when we connect again to the
BSC.

Change-Id: Ia1df6f4a1e0e6daeffe7303d518776a04b023930
2021-09-23 12:07:29 +00:00
Pau Espin dfedf2cb76 phy_link: Introduce bts_model_phy_link_close() and use it in bts-trx
This step is required while turning off the BTS without killing the
process. Right now only osmo-bts-trx supports this feature, so this
function is only available and used by osmo-bts-trx.
Later on, when the feature is support more generally, we can move call
to this function to common place like bts_shutdown_fsm or alike.

Change-Id: I3253112700a31b85db82dc7ccadec8542bac745e
2021-09-23 12:07:29 +00:00
Pau Espin 192390c797 trx_sched_clean_ts: Clean VAMOS shadow TS too
trx_sched_init_ts does it properly, but apparently it was forgotten to
do the same upon clean up.

Change-Id: Ice751870a46548af42b14846b8482335f636a84a
2021-09-23 11:09:15 +00:00
Pau Espin ce9ec4963c bts-trx: Submit TRX SW_ACT when PHY becomes connected
Once the TRXC link is available, we can signal SW_ACT which will
transit rcarrier and bbtransc NM FSMs to Disabled Offline and announce
availability to be configured to the BSC through transmission of
Software Activated Report.

Change-Id: I6e62ec2fdd4cae58b52d83fa851552f7ed51c821
2021-09-23 11:09:15 +00:00
Pau Espin ddd357f3e3 bts-trx: Avoid race condition configuring TS-specific TSC values
In OML, if Set Attributes comes first for Channel object and then for
BTS object, BSIC will still not be set. Hence, when applying Channel
(TS) specific TSC, the code would compare against an unset value,
enabling use of TRXC extensions (which osmo-trx doesn't support)
without need for it, since actually the TSC of the TS matches the BSIC
of the BTS once both are set.

In order to fix it, don't check for the BSIC when receiving the OML
messages, but rather later when we apply the settings to the the lower
layers once trx_provision_fsm allows for it.

Fixes: 3c1151f945
Change-Id: I49fc7e35acb44ecc4f37ae71acd4c684248548e7
2021-09-23 11:09:15 +00:00
Pau Espin 300e31ed13 l1sap: Support rx of empty rlcmac blocks from PCU
This way the PCU can signal idle RLCMAC blocks (no transmission
required) to the BTS, which can then send dummy/fill blocks aplying
power reduction as needed by TRX.

The block with len=0 is submitted to lower layers up to the scheduler,
which will finally drop it in trx_sched_ph_data_req().

Change-Id: I734c66e236bf3e2015a4571ea1fd84849a9ef02c
Related: SYS#4919
2021-09-23 10:03:23 +00:00
Pau Espin 2f3cd4b697 MS Power Control Loop: Disable threshold comparison on {LOWER,UPPER}_CMP_N=0
This way we provide an effective way to disable C/I based decision
taking in the MS Power Control Loop. With this set up, MS Power Level is
decided only based on RxLev. This allows for working setup in following
scenarios:
* BTS L1 not passing proper C/I values to upper layers (eg. TRXDv0).
* User not willing to spend time configuring proper C/I levels for each
  channel type.

Related: SYS#4917
Change-Id: Ibd10eb96a5d072d5c19f7449a8b11e64aad1cd4c
2021-09-23 10:02:59 +00:00
Pau Espin 137166fd5f bts-trx: Get rid of check_transceiver_availability_trx()
Get rid of this helper function, which is a remain of past epochs
(pre-FSM). In the current uses, there's only 2 real cases: the "if" path
upon SET BTS ATTR received (and even that one should be moved as per
what the code comment states), and the one happening when the TRX is
closed.

it really makes no sense to DISABLE the TRX as a result of SET BTS ATTR.

Change-Id: I48adfeecd722684152c589bcba827079b0a78c3a
2021-09-23 10:00:24 +00:00
Pau Espin 7c466d8cc7 bts-trx: Submit TRX_PROV_EV_CFG_ARFCN for C0 during SetBtsAttr
In oml_rx_set_bts_attr, arfcn for C0 is assigned from NM_ATT_BCCH_ARFCN.
The rest of the TRX get their arfcn from oml_rx_set_radio_attr()
NM_ATT_ARFCN_LIST.

Change-Id: I8aa9652622107fe0a707b2cbcbe8be6c71e19087
2021-09-23 10:00:24 +00:00
Pau Espin 32b51eca7d trx_provision_fsm: Properly reset FSM state upon starting listening for events
Change-Id: If0d078bc0170091efbca351c44ee412dad1e944a
2021-09-23 10:00:24 +00:00
Pau Espin eab7068d58 trx_if: delete retrans timer when flushing the Tx queue
Change-Id: Ic31dc5629ed950f3b4b8feb9917d11779696f6eb
2021-09-23 10:00:24 +00:00
Pau Espin 4444262a6a trx_if: Allow calling trx_if_flush/close from within TRXC callback
Change-Id: Ic3baa95ffe4e6ca95c6d02276ea8eb0cb9fa0064
2021-09-23 09:59:29 +00:00
Philipp Maier 3bf40e4f3a rsl: simplfy parse_repeated_acch_capability
The separate TLVP_PRESENT and TLVP_LEN calls can be replaced by
a single TLVP_PRES_LEN

Change-Id: I6bde1b9df50fdf355e768f5066e86422238b98e9
2021-09-23 08:21:57 +00:00
Pau Espin 03c74baa83 trx_if: Set pointer to null after freeing it
Change-Id: Icd93c9968095a8801aafe9440806cb5786320cbc
2021-09-22 12:57:02 +02:00
Pau Espin 3c56335094 bts_shutdown_fsm: Fix event name
Change-Id: Id042ae37f7c9dbd2edbb76932abb91d605d85e26
2021-09-22 12:57:02 +02: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 5a2d8716ef abis: Drop internal OML msg queue
There's no real use for this queue. If the link is gone, it makes no
sense to keep old messages. Instead, BTS should generate new messages
sharing current state when link becomes established (it actually does
so already).

Change-Id: Iecd3c7cb96f5fff3b4c7e04c74e031df0f7a6987
2021-09-20 16:25:47 +02:00
Pau Espin 92186c672d nm_*_fsm: Move to state Disabled NotInstalled Locked when shtudown proc ends
Change-Id: I5c070adbba6b4abb19467a02d6449a443657ae2b
2021-09-20 16:25:47 +02:00
Pau Espin c56d120b29 MS Power Control Loop: Fix oscillations within good MS Power Levels
Related: SYS#4917
Change-Id: Ib33a94eba92004f9327c91e020a506dfa9a957c3
2021-09-20 14:57:15 +02:00
Pau Espin 43a4a1d5e7 nm_*_fsm: Set adminsitrative state 'shutting down' when shutdown procedure starts
Change-Id: I0d14840a55642812b865687a6cb208e7ffd22829
2021-09-20 12:22:53 +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
Pau Espin 729aff7938 nm_*_fsm: Add missing item in event mask list for state ENABLED
Change-Id: Iebaa7dcfc01978cee2e4b08609503eb4e25598b7
2021-09-20 12:22:53 +02:00
Pau Espin 82275d5eb2 trx_provision_fsm: Add missing state transition OPEN_WAIT_POWEROFF_CNF => OPEN_POWEROFF
Change-Id: I361c1acddfe7ebffb44d886d0545240ef1bbd347
2021-09-20 12:22:53 +02:00
Pau Espin 8dd699e545 abis.c: Loop over list of BSCs until connection succeeds
Do not exit if all BSCs in the list fail to connect, keep trying
forever. This commit still doesn't change the logic after BTS has
successfully connected to a BSC. In that situation, if the link goes
down, BTS will exit in order to reset all state and let the user/system
restart it.

Related: SYS#4971
Change-Id: I67bba3b7e2d9d62b98a59a74987ae55206a3ec51
2021-09-20 12:22:53 +02:00
Pau Espin 3f7bd192a6 abis.c: Fix mess with priv->bsc_oml_host
The pointer was used as "struct bsc_oml_host" sometimes, and other times
as "struct llist_head". It just worked because bsc_oml_host->list is the
first item in the script. The code was really confusing, also because
the bts list of items has a name really similar to the one currently
assigned. Let's rename the currently assigned address to "current_bsc",
store it always as "struct bsc_oml_host*" and finally use llist_entry
helpers when needed.

The related code is also moved to a helper function to enclose there the
logic to get next BSC in list. This change actually changes the logic
where a remote address is removed from VTY, since now the next address
in list is picked at the time, and later when reconnecting the list is
forwarded another time, meaning one address will be skipped.
This could be considered a bug, but this situation is really special
and anyway the entire logic will be changed in new commits where we'll
keep reconnecting in loop without exiting when reaching the end of the
list, so we are fine with it. Think of this commit as a preparation
commit for next ones.

Change-Id: I3cc8a4148b3d63bc185b72dab8108105a6644910
2021-09-20 12:22:53 +02:00
Pau Espin 65c0341f3d abis.c: Transition to CONNECTED state only when OML link is up
This clarifies the different states and transitions between them:
OML LINK UP: CONNECTING->CONNECTED
ANY LINK DOWN: CONNECTING->CONNECTING, CONNECTED->FAILED
In follow up commits, support to reconnect instead of exit after the BTS
has already connected will be added, so only the last transition needs
to be changed.

Related: SYS#4971
Change-Id: I43e83b1b04fbaa1f87818c096e6ad3920801b1f6
2021-09-20 12:22:53 +02:00
Pau Espin 79a92cfc50 abis: Shorten string names of events
Change-Id: I7a5dab3d38e917a8f37c72765e27f263c324ed96
2021-09-20 12:22:53 +02:00
Pau Espin 5831512c2c abis: Move FSM registration to constructor function
We commonly do it this way since there's only need to call it once at
the startup of the program.

Change-Id: I6ee5b89175ee32bc12a8afc9682a8f90d1713291
2021-09-20 12:22:53 +02:00
Pau Espin a09c9a8c32 cosmetic: Fix formatting of conditional operator
Change-Id: Ib0da405d1d9ed30bea97b433b7cf07b1084348ef
2021-09-20 12:20:14 +02:00
Pau Espin 4a1e34c077 tests: MS Power Control Loop: Show oscillation among good power levels
This test showcases the current issue where the loop keeps bouncing
between 2 good MS Power Level values due to the loop "accepting" and
"reporting back" the previously considered good MS Power Level
announced/used by the MS. Hence, upon report back from the network, the
MS will switch to this new MS Power Level, and same thing will ocurr
over and over.

Related: SYS#4917
Change-Id: I16ed7fe8a123b99008e0c041d2f3e4232057d55c
2021-09-17 14:20:46 +02:00
Pau Espin 41fe4089a8 power_control: Drop unused param in function
Change-Id: I6c0c2b983e153b06b84664565bd485e748a8af7d
2021-09-16 13:02:11 +02:00
Pau Espin 3f51571a2f abis.c: Convert early return to assert()
This should simply not happen. If other event is received, something is
terribly wrong, so we should exit immediately instead of silently
failing.

Change-Id: I5f4953be735f526bb8b926979233b3c26ba67ce9
2021-09-15 16:17:37 +02:00
Pau Espin daadbc33aa abis.c: Rearrange code to follow logic state order
CONNECTING state comes first in logical order of states (as properly
seen in enum of states), however, the FSM struct definition and state
action functions are swapped. Let's put them in order.

Change-Id: I0cae561926b460dc5882390db969b7c925903e5d
2021-09-15 16:17:37 +02:00
Pau Espin a17043f2b4 cosmetic: fix typo in comment
Change-Id: I0e4fdad66c0bad849a7b960cf78f9f45b56fcb95
2021-09-15 16:17:37 +02:00
Pau Espin bc7c8a42f3 abis.h: Drop unused state
Change-Id: I11173af3a543f6679ca9d43064bf071c214b1898
2021-09-15 16:17:37 +02:00
Pau Espin c2ba34d9c1 abis: Clear code and drop code not executed
abis_init() sets "g_bts = bts;", hence bts object is the same as g_bts
(since we only have 1 BTS object in osmo-bts). As a result, dropping
checking first bts->... and later g_bts->... makes no sense: the later
condition will always be false.

Change-Id: I5018199221fb3c3329a59d0b91e827f077cef85d
2021-09-15 16:17:37 +02:00
Pau Espin e1dbc616b0 MS Power Control Loop: Fix sub vs full being passed to algo
Fixes: c80abd109b
Change-Id: Ib66ac938e3e71409848927a2972f1f77b9bacde2
2021-09-15 14:30:13 +02:00
Pau Espin c81b41c62e Support configuring TA loop SACCH block rate
Similar to what is already provided for power control loops. However,
there's no existing way to communicate TA control parameters from the
BSC to the BTS, so implement them locally in BTS vty.

Related: SYS#5371
Change-Id: I9fa71f836bb9a79b0ef2567bfcfdf38ff217840b
2021-09-14 11:42:58 +02:00
Pau Espin c85027a510 Power Control Loop: Set P_CON_INTERVAL to 1 by default
TS 45.008 section 4.7.1:
"""
Upon receipt of a command from an SACCH to change its power level on the corresponding uplink channel, the MS
shall change to the new level at a rate of one nominal 2 dB power control step every 60 ms (13 TDMA frames), i.e. a
range change of 15 steps should take about 900 ms. The change shall commence at the first TDMA frame belonging to
the next reporting period (as specified in subclause 8.4). The MS shall change the power one nominal 2 dB step at a
time, at a rate of one step every 60 ms following the initial change, irrespective of whether actual transmission takes
place or not.
"""

Since the reported MS_PWR in L1 SACCH Header is, according to specs, the
one used for the last block of the previous SACCH period, it becomes
clear the first SACCH block after a requested MS Power Level change by
the network may contain mismatches between the announced MS_PWR by the
MS and the measured Rxlev/RxQual. Hence, let's better use a
P_CON_INTERVAL of 1 which retriggers the MS Power Control Loop every second
SACCH block.

Change-Id: If6cb8945645a2031f2b2ee65d9b9f51e75cd9af1
Related: SYS#5371
2021-09-14 11:42:58 +02:00
Pau Espin 132b67a7a0 TA Control Loop: Change toa256 switch threshold to 75% of a symbol
As per 3GPP TS 45.010 sec 5.6.3 Delay assessment error:
"""
the delay shall be assessed in such a way that the assessment error
(due to  noise and interference) is less than 1/2 normal symbol periods
for stationary MS. For MS moving at a speed up to 500  km/h the additional
error shall be less than 1/4 normal symbol period.
"""

Hence, required TA loop calculation should take into account an error of
up to 1/2 + 1/4 = 75% of a symbol. By changing the threshold variable
to that percentage we make sure we take into account bigger deviations
and update TA accordingly.

Related: SYS#5371
Change-Id: I4c5825df4291d3851a113027abf7566de343a190
2021-09-14 11:42:44 +02:00
Pau Espin c80abd109b MS Power Control Loop: Feed UL C/I from correct measurement period
As per 3GPP TS 45.008 sec 4.2, the ms_pwr received in L1 SACCH Header is
the value used over previous measurement period. Hence, we need to feed
the algo with the measurements taken over that same period.

Related: SYS#4917
Change-Id: I13c0014fdd73f823ae5b1256c35bfa7d97cfa334
2021-09-13 17:52:24 +02:00
Pau Espin 8d21891959 MS Power Control Loop: Feed UL RSSI from correct measurement period
As per 3GPP TS 45.008 sec 4.2, the ms_pwr received in L1 SACCH Header is
the value used over previous measurement period. Hence, we need to feed
the algo with the measurements taken over that same period.

Related: SYS#4917
Change-Id: I00852cb37a3613606e37476c169f5a32d6b5d75e
2021-09-13 17:52:24 +02:00
Pau Espin 22a160bd24 lchan: Move TA CTRL param to its own substruct
Field is renamed to look similar to similar fields in power control
loop. This is a preparation commit, next one will add functionality to
skip SACCH blocksi (P_CON_INTERVAL).

Related: SYS#5371
Change-Id: I169ce58ab827e38b64f4b15f935097a9118fa118
2021-09-13 12:53:44 +02:00
Pau Espin f54a7462dd ta_control: Allow switching TA quicker
From TS 45.010 5.6.1 (delay tracking for circuit switched channels):
"""
Restricting the change in timing advance to 1 symbol period at a time
gives the simplest implementation of the BTS.  However the BTS may use
a larger change than this but great care must then be used in the BTS design.
"""

In general 1 TA at a time (every 480ms of SACCH block) should be enough,
since section 5.6.3 states:
"""
The control loop for the timing advance shall be implemented in such a way that it will cope with MSs moving at a
speed up to 500 km/h
"""
Which is ~140 m/s, and 1 TA step around 500m, so most of the time we
should be save and no steps of more than 1 TA should be required.
However, unlikely changes from reflected to direct signal or vice versa
could produce higher increments, so let's increase the maximum step size
allowed to 2 in order to give more room.

Change-Id: I9e48faabf3090588233e274b2b39065cf85fbec7
2021-09-13 12:53:22 +02:00
Pau Espin f21b9231dd TA loop: Take into account UL SACCH 'Actual Timing advance' field
First step improving and reworking TA loop:
Move trigger of the loop to similar place done by BS/MS Power Control
Loop, that is, upon receivial of UL SACCH block, which contains
information about the TA used to transmit the block encode in L1SACCH
Header. Hence, from computed received TOA and TA used when transmitting
from the MS, we can infer the desired TA to be used by the MS, which
will send back to it later during DL SACCH block.

The values taken are actually the ones calculated for the previous SACCH
block and stored in lchan->meas.ms_toa256. That's because L1SACCH
contains the TA used for the previous reporting period, similarly to
what's specified for MS Power Control loop (TS 45.008 sec 4.2):
"""
The MS shall confirm the power control level that it is currently employing
in the SACCH L1 header on each uplink  channel. The indicated value shall
be the power control level actually used by the mobile for the last burst
of the  previous SACCH period.
"""
(The reader may observe that currently this is not properly done for MS
Power Control loop when calling lchan_ms_pwr_ctrl(): this is a bug.)

This new method also permits changing TA quicker, since we have more
confidence that the TA we request is aligned with the one used to
transmit, and we don't simply increment/decrement based on the value we
request to transmit.

Related: SYS#5371
Change-Id: I2d0f128c8dcac93ee382283a1c91fca76623b8fc
2021-09-13 12:25:32 +02:00
Neels Hofmeyr 494b251109 early IA: change default X15 timer to 0 ms
Tests have shown that even a delay of 0, i.e. a simple defer until the
next select() loop, makes the difference from failing to working early
IA. So set the default to 0, achieving such defer.

Related: SYS#5559
Change-Id: I95365649edd51114bcf6028f0dc3bbe4186f96d2
2021-09-11 13:10:33 +00:00
Neels Hofmeyr da7c56ab8e early IMM ASS: add configurable delay for RR IMM ASS
During live testing, it has become apparent that some IMM ASS still fail
when sending the RR IMM ASS directly upon the target channel becoming
active.

Add a bit of delay after activation, to give some time for the channel
to light up for the MS. Default is 50ms.

Related: OS#5559
Change-Id: Ia1e63b98944dc840cde212fc732e20277cdc5585
2021-09-11 13:10:33 +00:00
Pau Espin 314a0db113 l1sap: Take L1SACCH MS_PWR from bitfield instead of manual parsing
Change-Id: Ib2918d5d6b8463c659896f6e535a0c6eaca4bd87
2021-09-06 17:58:38 +02:00
Pau Espin 746d0a7500 comsetic: measurement.c: fix typo in comment
Change-Id: I3ed3486bbc3d55088e3ebe27e4a76f932d6f7a59
2021-09-06 16:19:05 +02:00
Pau Espin 5ed69d0fd5 Power Control Loop: Move skip loop logic to function helper
Let's move duplicate logic to function helper.

Related: SYS#5371
Change-Id: Ic26c17564ec61cdadaab0184c4246b9bf863c69a
2021-09-06 13:17:03 +02:00
Pau Espin e0febb700a MS/BS Power Control Loop: Fix downscaling averaging bug
The bug showed up in previous commit and is fixed in this commit. It can
be seen how rounding error is carried over time in the average
measurement, and affects final values.

Change-Id: I680d1c94bd4bae179b14b26662a819fa1462a5c8
2021-09-03 19:06:22 +02:00
Pau Espin aac12bfd67 MS/BS Power Control Loop: Do RxLEV meas avg & delta calculations directly on RxLevels
Before this comits, averaging and delta calculation was done in RSSI,
but stored the averaging cached state in variables named "rxlev", which
was really confusing. Let's keeping averaging and delta calculations
based on RxLevels.

Some of the tests change results due to test passing RSSI -45, which is
an invalid Rxlev (only up to -47 is supported).
Others fail due to an unrelated bug showing up now. Basically the averaging algo
is doing rounding  the wrong way when downscaling the values. It will be
fixed in a follow-up commit.

Change-Id: I4cff8394f22b5d47789163051364ff594b2bcd74
2021-09-03 19:06:22 +02:00
Pau Espin e2f9abee58 BS Power Control Loop: Increase attenuation if RxQual is better than upper threshold
If RxQual is considered good enough, attenuation can be increased in
order to lower overall cross-channel noise among different MS.

Change-Id: Ie97898980acd152de15f6b4b619d492048855ef4
2021-09-03 19:06:22 +02:00
Pau Espin dd97023388 BS Power Control Loop: Support EWMA average algo for RxQual meas
params->rxqual_meas.upper_thresh is left unchecked in
lchan_bs_pwr_ctrl() on this commit on purpose, to keep this
commit with old behavior wrt to algo logic.

Change-Id: If7e3987df89d680cfa443195ab2f225681d0e6cf
2021-09-03 19:06:14 +02:00
Pau Espin cd11905f64 BS Power Control Loop: refactor lchan_bs_pwr_ctrl() to look similar to lchan_ms_pwr_ctrl()
This commit reworks the code in function lchan_bs_pwr_ctrl()
and logging to look similar to that of lchan_ms_pwr_ctrl(), so that
reader can easily spot similarities between both and add simillar
features more easily.

This commit is also a preparation to add EWMA avg support for RxQual
measurements. Logging is also reworked now to look similar to that of MS
Power Control Loop, because having several parameters driving the algo
(RxLev and RxQual), it becomes more suitable to log all of them together instead
of intermediate info only aplicable to one param such as "delta".

Change-Id: Ida76b55f0da722135eb61ed06ea2b3a1862df600
2021-09-03 19:03:48 +02:00
Pau Espin 160da8ea2b MS Power Control Loop: Improve logging
Change-Id: I8babd42566c41935079fd414d930ebf2d737892e
2021-09-03 19:03:48 +02:00
Pau Espin 085a4cb91e MS Power Control Loop: Support EWMA algorithm for C/I measurements
Change-Id: I52eb0558fd7a215a6ee0b2aced189ae4a37d8a22
Related: SYS#4917
2021-09-03 19:03:48 +02:00
Pau Espin 0617afdb5f MS Power Control Loop: Take C/I into account
This commit extends existing MS Power Control Loop algorithm to take
into account computed C/I values on the UL, received from MS. The
related C/I parameters used by the algorithm are configured at and
provided by the BSC, which transmits them to the BTS similar to already
existing parameters.

Using C/I instead of existing RxQual is preferred due to extended
granularity of C/I (bigger range than RxQual's 0-7).
Furthermore, existing literature (such as "GSM/EDGE: Evolution and Performance"
Table 10.3) provides detailed information about expected target values,
even different values for different channel types. Hence, it was decided
to support setting different MS Power Parameters for different channel
types.

These MS Power Parameters are Osmocom specific, ie. supported only by
newish versions of osmo-bts. Older versions of osmo-bts should ignore
the new IEs added just fine. The new IEs containing the MS POwer
Parameters are not send for non osmo-bts BTSs, hence this commit is
secure with regards to running  osmo-bsc against an ip.access BTS such
as nanoBTS.

Related: SYS#4917
Depends: libosmocore.git Change-Id Iffef0611430ad6c90606149c398d80158633bbca
Change-Id: I5dfd8ff9ab6b499646498b507624758dcc160fb6
2021-09-03 18:57:13 +02:00
Philipp Maier 7c23017806 sched_lchan_tch_x: use ul_cmr and ul_ft when generating RTP bad frame
All generated RTP that originates from the BTS relates to uplink. When
generating AMR BAD frame RTP packets, we must use ul_cmr/ul_ft and not
dl_cmr/dl_ft.

Change-Id: Ifa009819791cf7df2dd8201f442b0dae06f622a4
Related: SYS#5549
2021-09-02 17:43:15 +00:00
Philipp Maier a65cf63619 sched_lchan_tch_x: use functions to determine AMR tranmssion phase
The AMR transmission phase directly depends on the frame number. The
transmission phase is used to tell if a received AMR frame contains a
CMI (frame type that is currently used) or CMR (frame type that the
receiver should use) codec identifier. The formulas in the present
implementation seem to be correct but they do not reflect the numbers in
the spec very well, nor do they have unit-tests. Lets replace them with
more readble functions and test those functions with unit-tests.

Change-Id: I94a934a6b3b397b4cd0e9da3577325de58814335
Related: SYS#5549
2021-09-02 17:43:15 +00:00
Philipp Maier ca41f091fc sched_lchan_tch_x: do not use cmr as ft
CMR and FT are updated each time an AMR voice frame is received from the
radio interface. The transmission phase decides whether the voice frame
contains CMR or FT. The code follows the transmission phase and keeps
ul_cmr and ul_ft up to date.

In contrast to the AMR frames on the radio interface, an AMR RTP packet
always contains the CMR and the FT value.

When generating the RTP payloed, The present implementation uses the CMR
in the position where the FT should be and the FT is ignored. This is not
correct.

Change-Id: I6bb10ff3c76f67b9830787497653b546cf27fe8e
Related: SYS#5549
2021-09-02 17:43:15 +00:00
Oliver Smith 8f37660fd6 debian/control: remove dh-systemd build-depend
Related: OS#5223
Change-Id: Ieb8669a9a43ea1acc6b2d8d2e363f2466c51697a
2021-09-01 16:07:06 +02:00
Pau Espin 298a259b7c rsl: Support parsing up to 3 RSL_IPAC_EIE_MEAS_AVG_CFG IEs
struct ipac_preproc_cfg seems to suggest that there may be up to 3 IEs
in some cases:
"struct ipac_preproc_ave_cfg ms_ave_cfg[3];"

Change-Id: I02633713eb557ee52e790a239f7b13b8c5b2b3bd
Fixes: 9238c3549d
Related: SYS#4918
2021-08-31 08:14:32 +00:00
Harald Welte 6aa959ecf4 l1sap/gsmtap: Don't log UI fill frames [zero information field]
When generating GSMTAP, we are already suppressing generation for
fill frames on PCH and AGCH.  Let's expand that also to dedicated
channels SDCCH, TCH/F and TCH/H.  The fill frames just clog up the
logs without providing much benefit.

SACCH is still being logged, as it contains SI or MEAS REP, so every
active channel still sees GSMTAP traffic every 480ms (SACCH interval).

Change-Id: I0dd37d8848eb0379f84d15f5f006142b16823c6a
2021-08-31 06:55:56 +00:00
Pau Espin 294fa4e061 rsl: Fix rx of multiple RSL_IPAC_EIE_MEAS_AVG_CFG IEs
So far only the first one was applied.

Fixes: 9238c3549d
Related: SYS#4918
Change-Id: Ib4f3c165a988e77b61a8852b254fc0904aa12482
2021-08-30 12:05:24 +00:00
Vadim Yanitskiy c485901d3d osmo-bts-trx: send dummy FACCH in the absense of RTP frames
If for whatever reason the transmit queue of a TCH/{F,H} contains
neither speech frames nor signalling blocks, osmo-bts-trx would
currently transmit garbage.  Of course, this causes decoding
errors at the MS side.

Ideally, we should employ an ECU (Error Concealment Unit) for the
given codec in use.  However, a simpler solution is to transmit
dummy LAPDm frames over FACCH.  This is what e.g. nanoBTS does.

Change-Id: I868afecbcb6890f40c8f146e3ce00e836b794dd3
Related: OS#4823
2021-08-29 08:21:32 +00:00
Neels Hofmeyr f616294d8c add osmo_tdef groups, exposing T timers on VTY config
We have two osmocom specific timers used in the BTS, X1 and X2. Expose
those on the VTY configuration, as timer group 'bts'.

This prepares for a subsequent patch, where I would like to add another
configurable timer. This provides the basic infrastructure for that.

Related: SYS#5559
Change-Id: I0f56f9425134679219884b0c3c2f29e77aff5e64
2021-08-18 17:27:04 +02:00
Neels Hofmeyr bb840eceb9 jenkins: enable new flag --enable-external-tests
Change-Id: Iac47ce865c833d892c84425b49e9420838e100ca
2021-08-18 17:27:04 +02:00
Neels Hofmeyr 9eb8c9f0d7 add VTY transcript testing
This is not as trivial as with OsmoBSC or OsmoMSC, because normally the
osmo-bts process exits right away when there is no BSC. Hence add
--vty-test option to main.

Use 'osmo-bts-virtual --vty-test' for testing. The other BTS models
require dependencies / configure switches to be built.

Essentially copied from osmo-bsc.git:
configure.ac: add --enable-external-tests
tests/Makefile.am: add 'vty-test' target

Add osmo-bts.vty, some trivial VTY node testing.

This prepares for adding VTY tests for T timer configuration added in a
subsequent patch.

Related: SYS#5559
Change-Id: I730daf548a3a9bb116aa8b6d5772ca9af0ada08f
2021-08-18 17:27:04 +02:00
Neels Hofmeyr f1312f9818 enable Early Immediate Assignment
When an Immediate Assignment comes in targeting an lchan that is not yet
active, then hold back the RR Immediate Assignment until the channel
becomes active.

This allows the BSC to send the Immediate Assignment before first
waiting for the Channel Activation ACK, saving one Abis roundtrip, and
helping avoid double allocation on high latency Abis links.

Related: SYS#5559
Related: I56c25cde152040fb66bdba44399bd37671ae3df2 (osmo-bsc)
Related: Ifb2c62431a91dafa6116b5d6b9410930f00a6e18 (osmo-ttcn3-hacks)
Change-Id: Ie52765b238b01f22fb327fe12327fbf10abcad4c
2021-08-18 17:27:04 +02:00
Neels Hofmeyr 30c838fdfa remove unused LCHAN_S_INACTIVE
Change-Id: Ia738eaa796264fe0a97a2c86d6bbd37eaffe0a59
2021-08-16 20:40:20 +02:00
Philipp Maier 6611e7f305 allow to configure multiple oml remote-ip addresses
At the moment we can only configure a single BSC in the BTS
configuration. This also means that if this single BSC fails for some
reason the BTS has no alternate BSC to connect to. Lets extend the
remote-ip parameter so that it can be used multiple times so that an
operater can configure any number of BSCs that are tried one after
another during BTS startup.

Change-Id: I205f68a3a7f35fee4c38a7cfba2b014237df2727
Related: SYS#4971
2021-07-19 10:39:06 +02:00
Pau Espin ace4e500ed Make gcc 11.1.0 false positivies happy
Make gcc 11.1.0 false positivies happy

After my system's gcc was upgraded, I get false positivies in a couple
places. Let's initialize those to make gcc happy.

"""
//git/osmo-bts/src/common/vty.c: In function ‘lchan_summary’:
//git/osmo-bts/src/common/vty.c:1881:23: error: ‘ts’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1881 |                 lchan = &ts->lchan[lchan_nr];
      |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
//git/osmo-bts/src/common/vty.c:1869:20: error: ‘trx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1869 |                 ts = &trx->ts[ts_nr];
      |                 ~~~^~~~~~~~~~~~~~~~~
//git/osmo-bts/src/common/vty.c:1852:34: error: ‘bts’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1852 |                 if (trx_nr >= bts->num_trx) {
"""

Change-Id: I93477142a5a4b3f3829b7398d6e564c127263596
2021-07-15 13:51:38 +02:00
Philipp Maier dda5cf4bb7 paging: prioritize CS related paging over PS related pagings.
When the paging queue is filled up to a critical level, pagings from the
PCU should be dropped as each immediate assignment paging from the PCU
is worth 4 normal CS pagings. Also the PCU may still issue pagings if the
paginging queue is already full and CS pagings are dropped. In a
congestion situation it is more important to get the CS rather than PS
pagings through.

Change-Id: I30f97672d7a0c369c4a656e878ab8cbbd83e31ea
Related: SYS#5306
2021-07-06 11:35:50 +02:00
Vadim Yanitskiy a5602d593c gsm_lchan_interf_meas_calc_band(): also print number of AVG samples
Change-Id: I4cebb0c5eef16f7e20fce85c506fc271127d7259
2021-07-05 12:07:55 +00:00
Vadim Yanitskiy 454a2516f2 rsl: use tlvp_val16be() in rsl_rx_ipac_XXcx()
Instead of using tlvp_val16_unal() and then doing ntohs() here
and there, convert the remote port to the host byte order once.

Change-Id: Id883a976a03fd3022ed9d66f703b01244df2d9db
2021-07-05 12:07:55 +00:00
Vadim Yanitskiy 471df615e2 manuals/abis/rsl.adoc: clarify RF Resource Indication conformance
Change-Id: Ia582c55c3c20f1f91993b3113d77ef2f34ca2eda
Related: SYS#5313, OS#1569
2021-07-05 12:07:55 +00:00
Pau Espin ae783bcb0e Support SDCCH8 in osmo dyn ts
Change-Id: Id541dee6c224d2b8d97c07b916085883354cecbc
2021-07-05 08:03:08 +00:00
Pau Espin a4b9073989 Rename osmo dyn ts enums to contain SDCCH8
They will gain support to be activated as SDCCH/8 soon too.

Related: SYS#5309
Depends: libosmocore.git I56dcfe4d17899630b17f80145c3ced72f1e91e68
Change-Id: Ia617d20fc52f09dbab8f4516c06fa1efac08e898
2021-07-05 08:03:08 +00:00
Vadim Yanitskiy 30aea88c2c power_control: constrain BS power reduction on BCCH carrier
BS Power Control is not allowed on the BCCH/CCCH carrier, unless
the BTS is operating in the BCCH carrier power reduction mode.

Allow constrained BS power reduction (up to 6 dB) on active logical
channels iff BCCH carrier power reduction mode is enabled.

Change-Id: I3299b6cdd230d3767321c3d6c64d468b7f5e1d02
Related: SYS#4919, SYS#4918
2021-07-01 02:01:22 +02:00
Vadim Yanitskiy 0e8d68437a osmo-bts-trx: implement BCCH carrier power reduction mode
The BCCH carrier (sometimes called C0) of a BTS shall maintain
discontinuous Downlink transmission at full power in order to
stay 'visible' to the mobile stations.  Because of that, early
versions of 3GPP TS 45.008 prohibited BS power reduction on C0.

However, in the recent 3GPP TS 45.008 there is a feature called
'BCCH carrier power reduction operation'.  This is a special
mode of operation, where the variation of RF level for some
timeslots is relaxed for the purpose of energy saving.

In BCCH carrier power reduction operation, for timeslots on the
C0 carrier, except timeslots carrying BCCH/CCCH, the output power
may be lower than the output power used for timeslots carrying
BCCH/CCCH.  In this case the maximum allowed difference in output
power actually transmitted by the BTS is 6 dB.

The power reduction operation can be controlled by the BSC by
sending BS POWER CONTROL on the A-bis/RSL with the Channel Number
IE set to 0x80 (RSL_CHAN_BCCH).  This makes osmo-bts reduce the
transmission power on inactive timeslots of the BCCH carrier.

This is a non-standard, Osmocom specific extension, so indicate
support of this feature to the BSC in the feature vector.  Also
add a VTY command to allow enabling/disabling the power reduction
locally.  Add some signalling notes to the A-bis/RSL manual.

For more details, see 3GPP TS 45.008, section 7.1.

Change-Id: I3dcee6e910ccc61c5c63c728db9ea04327e2fc98
Depends: I69283b3f35988fc7a1a1dcf1a1ad3b67f08ec716
Related: SYS#4919
2021-07-01 02:01:22 +02:00
Vadim Yanitskiy f50b684594 osmo-bts-omldummy: indicate BTS_FEAT_BCCH_POWER_RED as supported
This is required for ttcn3-bsc-test, see change [1].

Change-Id: I765d5e38cb0746e0458773abf3717ee9bf1cb7d1
Related: [1] I084f7736cd7d09b68ed49f8ba52a14de928d4c01
Related: SYS#4919
2021-06-30 23:45:12 +02:00
Vadim Yanitskiy c3b3ca358a Revert "power_control: BS power shall not be reduced on C0"
This reverts commit cd30a40be1.

As a part of SYS#4919 "BTS energy saving", we want to support
constrained (up to 6 dB) BS power control on BCCH carriers.

Change-Id: I0d2b48c4b2af2d8e94f4ad02fa4774dbd0a0a654
Related: SYS#4919
2021-06-30 23:45:12 +02:00
Pau Espin 8bf5cbea49 Support forwarding proto IPAC_PROTO_EXT_PCU BSC<->PCU
This new extension protocol is used to forward Osmocom PCUIF messages
BSC<->BTS<->PCU.
It will be sent re-using the IPA multiplex of the OML link between
BSC and BTS. BTS is responsible for forwarding the message over the unix
socket to the PCU.

PCUIF existing RX path needs to be reworked in order to accept
variable-size messages, in order to be able to transparently forward
messages without knowing about them (the new container message is
variable-length).

Related: SYS#5303
Change-Id: I73fdb17107494ade9263a62d1f729e67303fce87
2021-06-30 08:13:21 +00:00
Pau Espin 80ce85295b pcuif_proto.h: Add new container messages
Related: SYS#5303
Change-Id: I8deef11f9ec191475c99133629cd5cd9048c4bcb
2021-06-30 08:13:21 +00:00
Pau Espin 1fe9a89308 gsm_data: Drop unused function gsm_pchan_parse()
Change-Id: I8f49811c1b694c5ef1fb9178d5ff4558172089b0
2021-06-29 16:09:15 +02:00
Pau Espin b53a84ac75 doc: rsl.adoc: Fix trailing whitespace
Change-Id: Ibc93a87ad51c77fff08ecc54dcc01784756fb39f
2021-06-29 12:13:59 +02:00
Eric Wild 4d845ccbb6 osmo-bts-trx: indicate A5/4 support, handle Kc128
Change-Id: Ib8e04fe79f30b443a54c38f395a7a3626ff97c45
Related: SYS#5324
2021-06-23 21:59:31 +02:00
Vadim Yanitskiy f1bdf605b5 scheduler: fix: use ts_pchan() in trx_sched_set_cipher()
Properly handle dynamic timeslots, do not access 'pchan' directly.

Change-Id: Iccb8794253face54164af1ba344204eadab8f98b
Fixes: [1] I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-06-22 19:03:47 +02:00
Vadim Yanitskiy a6af31cd44 scheduler: fix wrong union field in trx_sched_tch_req()
I introduced this regression in [1] during a massive refactoring.
Basically, I copy-pasted a chunk from trx_sched_ph_data_req(), but
forgot to change the union field.  This broke voice calls, because
all TCH.req primitives would be enqueued to wrong timeslot.

Change-Id: If841e6ac40a3c6344c304ab970755d6a2d292156
Fixes: [1] I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-06-22 18:59:16 +02:00
Vadim Yanitskiy f47fa70b9f osmo-bts-trx: report PDCH interference levels to the PCU
The PDCH multiframe contains 48 data slots, 2 PTCCH slots, and
2 IDLE slots.  The later two can be used for the interference
measurements, since the UEs shall not transmit on them.

bts_report_interf_meas() is called every 104 TDMA frames, what
corresponds to 2 PDCH multiframe periods.  Report interference
levels on PDCH timeslots from this function.

Change-Id: I56f83db5264c246ec1b4b8a973105a4fc09931fb
Related: SYS#5313, OS#1569
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy 54d0931330 osmo-bts-trx: measure interference levels on TRXC_IDLE
We already do the intereference measurements on inactive logical
channels.  For the active channels we can still use the IDLE
slots, on which the UEs shall not transmit Uplink bursts.

Change-Id: Ic3030dba5eb223177298aa4e43559a93dc3d1392
Related: SYS#5313, OS#1569
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy c126870c5f osmo-bts-trx: print timeslot brief info in 'show transceiver'
Change-Id: Ibe624e4b801cae2dc00feb99441b7d606005b846
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy 8a1a74e6ca scheduler: unset TRX_CHAN_FLAG_AUTO_ACTIVE for TRXC_IDLE
Neither we expect any Uplink bursts on IDLE channels, nor we need
to send any Downlink bursts.  Automatic activation of TRXC_IDLE
channels does not make sense.

Change-Id: Ifade0eab0605154196322ff20b1b3a44495f8a2e
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy dded16c4c9 osmo-bts-{trx,virtual}: get rid of dummy tx_idle_fn()
This logical channel handler does nothing more than just logging.

Change-Id: I438705f8dd902193e6c7b499d8ee55c56b6a1c2e
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy 6fd4f77243 osmo-bts-trx: report interference levels to the upper layers
In trx_sched_ul_burst(), treat all BURST.ind and NOPE.ind mapped
to inactive logical channels as interference.  Average the RSSI
values on the fly using a sliding average with constant a=0.5.

Report averaged values for each logical channel every 104 TDMA
frames (SACCH period) by calling gsm_lchan_interf_meas_push().

Change-Id: I4686448e42a40df56c1d27a14fd0a4d43fd144a5
Related: I78b6d8beffa5228a28231b75728e7aebdd3cb23c
Related: SYS#5313, OS#1569
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy a484742793 scheduler: reorder enum trx_chan_type, add TRX_CHAN_IS_DEDIC()
With the new ordering, all TRXC_* values starting from TRXC_TCHF
belong to dedicated channels.  This is useful for the interference
reporting logic, where we're not interested in broadcast channels.

Change-Id: I7148f4d0bd1abbfe309bc5477e32a56d884533ea
Related: SYS#5313, OS#1569
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy d4efc3f9c5 Report interference levels in RSL RF RESource INDication
This change implements general interference averaging logic for
the higher layers.  In l1sap_info_time_ind(), where we receive
TDMA time updates from BTS model, call rsl_tx_rf_res() for each
transceiver according to the interval defined by the Intave
parameter received from the BSC.  In rsl_tx_rf_res() perform
the actual averaging for each inactive logical channel, and
then send everything to the BSC over the A-bis/RSL.

The BTS model specific code needs to report the measurements
for each logical channel every 104 TDMA frames (SACCH period)
by calling gsm_lchan_interf_meas_push().

Change-Id: Id80fdbef087de625149755165c025c0a9563dc85
Related: SYS#5313, OS#1569
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy 64e1c1222e oml: fix handling of NM_ATT_INTERF_BOUND attribute
Looks like this part of the code has never been tested.  The old
code would dereference the same value in the loop and assign it
to all members in array 'bts->interference.boundary'.

Change-Id: I7f83d8e6eb6cc19e3e9529ba06617a902de23e35
Related: SYS#5313, OS#1569
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy 4e8d4d5bb8 osmo-bts-trx: fix copy-pasted comment: s/sysmoBTS/osmo-bts-trx/
Change-Id: If796a8d55f1ad0642e5a81689161c7e7b70f4b5e
2021-06-18 16:48:36 +00:00
Vadim Yanitskiy a556c49114 osmo-bts-trx: fix typo: s/bisc/bsic/ in 'show transceiver'
Change-Id: I39c6138e950ca7d3cda9c52d4e1cdaa218624641
2021-06-18 18:40:53 +02:00
Pau Espin b04ffc11fb pcu_sock: Transmit SI2
OsmoPCU will need this SI2 in order to gain knowledge of the BCCH
Frequency List being broadcasted, in order to build a per-MS specific
Neighbour List using NC_FREQUENCY_LIST bits in Packet Measurement Order.

Related: SYS#5303
Change-Id: If70c64f941f621a9a68aef2c846639b5c7f2f74b
2021-06-11 23:19:59 +02:00
Vadim Yanitskiy ef4a6a0f43 l1sap: fix TDMA frame number arithmetic in fn_ms_adj()
Using the normal arithmetic for TDMA frame numbers is wrong.

Change-Id: Ie17670d150489014a4a2e140cede42086100bbc0
2021-06-10 21:50:48 +00:00
Vadim Yanitskiy 4590b099bf osmo-bts-octphy: drop talloc_replace(), use osmo_talloc_replace_string()
Change-Id: Ied39cc594fedc712d751ab1c7b636bbbff527bd6
2021-06-10 21:50:48 +00:00
Pau Espin 52f6fc5aab rsl: Use switch statement in rsl_rx_bcch_info()
This is a preparation for new commit, which makes it easier to add new
SIs being sent.

Change-Id: I27774ca36d1e740b6a502cfb280aba0ea82b9dbe
2021-06-10 12:58:18 +00:00
Vadim Yanitskiy 5acd0102e4 vty: ensure all warning messages are prefixed with '%%'
Change-Id: I23fc1cd8aa5725de06651f061c9fce6a022adfa8
2021-06-10 11:53:24 +00:00
Vadim Yanitskiy 85c2d641d5 common/vty: facilitate finding duplicate PHY/TRX associations
In cfg_trx_phy_cmd(), use phy_instance_link_to_trx() and ensure
that a PHY instance can be bound to a transceiver only once.

Change-Id: I132e08fc496abef278b94254cebfac7a4285a7c2
2021-06-10 11:53:24 +00:00
Vadim Yanitskiy bd49fd2492 [VAMOS] trx_sched_init_ts(): assign names to per-timeslot counters
Thanks to [1], it's now possible to associate a human-readable
name with a rate counter group.  Before this API, we had to use
weird index values for each timeslot, and with introduction
of the shadow timeslots the situation got even worse.

Change-Id: Ie872ab37661fa5d44f219f59c7daaa1033113289
Depends: [1] I0dc510783dd9ae8436dae8005a7b3330e80d36f3
Related: SYS#4895, OS#4941
2021-06-09 22:45:10 +02:00
Vadim Yanitskiy 43adbe200c measurement: remove over-defensive checks in is_meas_complete()
The timeslot number ts->nr is set in gsm_bts_trx_alloc() and can
never be greater than 7.  Regarding the physical channel type
returned by ts_pchan(), it's also unlikely to be greater than
_GSM_PCHAN_MAX.

Change-Id: I6d20d7cba49cc8b6d1dc2192598ca372b7d2c5bf
2021-06-09 20:20:42 +00:00
Vadim Yanitskiy fc8c9880d9 conf_lchans_as_pchan(): initialize all lchans with GSM_LCHAN_NONE
This function is called during the OML bootstrapping, and also
when a dynamic timeslot switches between PDCH and TCH/{F,H}.
In the later case, after switching from TCH/{F,H} to PDCH, some
lchans might still have the old type assigned.

Let's ensure that all logical channels are properly updated.

Change-Id: I44726f2bfb979c2fa2f5f30c5b11700cf4b3399d
Related: SYS#5313, OS#1569
2021-06-08 02:04:53 +02:00
Vadim Yanitskiy 628853de74 conf_lchans_as_pchan(): fix GSM_LCHAN_{CCCH->CBCH} regression
This regression was introduced (by me) in [1] and broke CCCH.

Change-Id: I403ad06574a8505b69dd06781f7fe0f7cabf416f
Fixes: [1] I1c5a033e89d9ca5fb01ebe9ffb521fd67d159bee
Related: SYS#4895, OS#4941
2021-06-08 01:53:14 +02:00
Vadim Yanitskiy 177799fe7e l1sap: fix TDMA frame number wrap in l1sap_info_time_ind()
Using the normal arithmetic for TDMA frame numbers may result
in getting wrong values.  Consider the following situation:

  'info_time_ind->fn' is 0 (beginning of period)
   'bts->gsm_time.fn' is 2715647 (end of period)

With these input values the following expression:

  info_time_ind->fn - bts->gsm_time.fn

will be equal to:

  0 - 2715647 or -2715647

In this case osmo-bts does not log an error, because:

  if (-2715647 > 0) // is false

As a consequence, we do not increment number of RACH slots that
have passed by since the last time indication:

  for (i = 0; i < -2715647; i++) // is false

This is why we introduced GSM_TDMA_FN_{SUB,SUM,DIFF,INC} API.

Change-Id: I6168dd75daea50bbe2e19338e637185ac9ac87ef
2021-06-07 01:49:16 +02:00
Neels Hofmeyr 68671291f3 [VAMOS] osmo-bts-omldummy: allocate shadow timeslots
Change-Id: I4aa9a8bb35bd828d6f25d5690297e727dace5974
Related: SYS#4895, OS#4941, SYS#5316, OS#4940
2021-06-05 00:34:36 +02:00
Vadim Yanitskiy 6d20a49806 [VAMOS] osmo-bts-trx: schedule bursts on 'shadow' timeslots
Change-Id: I3e0bdf8c03273f66991aa1764029ab1dd3528d7e
Related: SYS#4895, OS#4941
2021-06-05 00:34:36 +02:00
Vadim Yanitskiy 0686ae6128 [VAMOS] Implement the concept of 'shadow' timeslots
Change-Id: I48b44b4df9ffb1cca105aebbd868c29b21f3b1d6
Depends: Ia0bd8695a3f12331b696fe69117189cdd48b584d
Related: SYS#4895, OS#4941
2021-06-05 00:34:36 +02:00
Vadim Yanitskiy d9daa3fd9e [VAMOS] conf_lchans_as_pchan(): improve readability
Change-Id: I1c5a033e89d9ca5fb01ebe9ffb521fd67d159bee
2021-06-05 00:34:36 +02:00
Vadim Yanitskiy b99db695a7 [VAMOS] scheduler: drop meaningless channel number checks
Change-Id: Icc57e58feece51c2d1c421454352bc821e338973
2021-06-05 00:34:36 +02:00
Vadim Yanitskiy 28cd8a318f trx_sched_is_sacch_fn(): fix handling of dynamic timeslots
There is no GSM_PCHAN_TCH_F{_TCH_H}_PDCH in trx_sched_multiframes[],
so find_sched_mframe_idx() would always return -1 for these.  Fix
this by using ts_pchan(), which returns currently active pchan type.

Change-Id: Ia5e337e897b595e7de6e504664c969b583cc02a1
2021-06-04 20:06:58 +00:00
Vadim Yanitskiy 5b8080208a osmo-bts-trx: fix NULL pointer dereference in trx_if_send_burst()
Starting from TRXDv2 [1], trx_if_send_burst() would keep batching
PDUs to the static buffer, unless it's called with br = NULL, so
we cannot dereference br in the logging statement.

Of course, we could also store TDMA frame number in a static
variable, but I don't think it's worth it just for logging.

Change-Id: I4a361777fc40bdedcebbe54df6274bc5573f77a8
Fixes: [1] I9b4cc8e10cd683b28d22e32890569484cd20372d
Fixes: CID#236232
2021-06-04 20:06:58 +00:00
Vadim Yanitskiy f6716bf846 manuals/abis/rsl.adoc: add VAMOS specific Channel Number values
Change-Id: Ib3ad7652dfcbd104d25b031ac89f5491da2673a6
Related: SYS#4895, OS#4941
2021-06-04 20:05:20 +00:00
Vadim Yanitskiy 510fb2e2b8 manuals/abis/rsl.adoc: add missing CBCH Channel Number values
Change-Id: Iab64c35a384978ba2eb1878f619de2c3827cd8c5
Related: SYS#4895, OS#4941
2021-06-04 20:05:20 +00:00
Vadim Yanitskiy 8cb5a25874 manuals/abis/rsl.adoc: rework Channel Number description
Change-Id: I3013c6b2c38db33d7d80e174b3d4910f8b01963d
Related: SYS#4895, OS#4941
2021-06-04 20:05:20 +00:00
Vadim Yanitskiy c5844779e8 manuals/abis/rsl.adoc: s/TS 08.58/TS 48.058/
Change-Id: Iae8e184f98f089c95dce4c51f512971521c4b059
Related: SYS#4895, OS#4941
2021-06-04 20:05:20 +00:00
Vadim Yanitskiy 069796bcd8 [VAMOS] oml_rx_set_chan_attr(): clarify NM_ATT_CHAN_COMB handling
Change-Id: I8a4aace97515ca59ac4c6b5d50a9ee242edfe409
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy a02d9e57b0 [VAMOS] l1sap: get_lchan_by_chan_nr() may return NULL
Change-Id: Ic309622d0ee818302dfc66d69fd2914ae28261d6
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy bcdbb6c556 [VAMOS] gsm_data: rework and rename gsm_lchan_name_compute()
Change-Id: Id5cc40db04a654d94f5f75d4aad45439d66528cc
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy 5d888e5064 [VAMOS] rsl_lchan_lookup(): make it more readable
Change-Id: I3160929c739a521fe494716c3da3d3b72370a98a
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy 0704b29d6d [VAMOS] rsl_lchan_lookup(): use ABIS_RSL_CHAN_NR_CBITS_* macros
Change-Id: Iec3250e3a59f8d428d7e7be2ceb71f7086a68e7b
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy 24e5f72f83 [VAMOS] gsm_pchan2chan_nr(): use ABIS_RSL_CHAN_NR_CBITS_* macros
Change-Id: I2b1480d3c330951cccc15333450cf7243b9505fc
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy dd3b7d469e [VAMOS] common/oml: generalize checking BTS_FEAT_MULTI_TSC
Change-Id: Iaa5aced70e166963106c27ebdb09adaae22daea4
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy d8598005ce [VAMOS] l1sap_chan_act(): handle Osmocom specific TSC IE
This is an Osmocom specific RSL IE that, if present, takes
precedence over the values indicated via the A-bis/OML.

Change-Id: I717e5b2a6ca5b4faeaab9cae4bb971907945871b
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy 60fc1d3763 [VAMOS] scheduler: add new GMSK training sequences from 3GPP 45.002
Change-Id: I03fe712da5a3cc1a59f40a98a57f43306c3586c6
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy 3c1151f945 [VAMOS] osmo-bts-trx: properly handle per-timeslot TSC values
Each timeslot can have its own Training Sequence Code value, which
may optionally be included in the NM_MT_SET_CHAN_ATTR message sent
over the A-bis/OML.  If it's not present, then the TSC value for a
timeslot is derived from the BCC part of BSIC, which is always
included in the NM_MT_SET_BTS_ATTR message.

On the TRXC interface, the BTS global TSC value is indicated to the
transceiver using either of the 'SETTSC' or 'SETBSIC' commands.
The transceiver then applies this value for all timeslots by default,
however it can be redefined for each timeslot individually using
additional arguments of the 'SETSLOT' command (see section 25.2.4.1
in the user manual [1] for more details).

Currently, trx_set_ts_as_pchan() sends TRX_PROV_EV_CFG_TSC to the
transceiver provisioning FSM, together with the per-timeslot TSC
value.  This event causes the FSM to modify the global TSC value,
that is going to be or has already been sent to the transceiver.
This is wrong, the global TSC value shall not be overwritten.

Remove the TRX_PROV_EV_CFG_TSC, and include per-timeslot Training
Sequence Code and Set in the data structure that gets passed together
with the TRX_PROV_EV_CFG_TS instead.  Implement handling of the
optional per-timeslot TSC in trx_if_cmd_setslot().

[1] https://downloads.osmocom.org/docs/latest/osmobts-usermanual.pdf

Change-Id: Idc5796151e3e83f42d60c2d4cb7c35890d76a7f5
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy 207d56afe5 [VAMOS] osmo-bts-trx: rework handling of Training Sequence
The TSC (Training Sequence Code) value in 'struct gsm_bts_trx_ts'
is always initialized in oml_rx_set_chan_attr() during the OML
bootstrapping, so there is no need for gsm_ts_tsc() - remove it.

Store the initial TSC value in 'struct gsm_bts_trx_ts', so we can
apply a different TSC value during the RSL CHANnel ACTIVation.

Store the Training Sequence Code/Set in 'struct trx_dl_burst_req'.
These values are indicated to the transceiver (TRXDv2 PDUs, 'MTS'
field) and used by the new TRX_{GMSK,8PSK}_NB_TSC macros.

Change-Id: I3744bc308b99ef941e6e9d139444e414abebc14b
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Pau Espin 163ff40dd5 Use new stat item/ctr getter APIs
Generated with spatch:
"""
@@
expression E1, E2;
@@
- &E2->ctr[E1]
+ rate_ctr_group_get_ctr(E2, E1)
"""

Change-Id: I9b8e31adcbb3142d3d09f1f0e0ae7e435bb2c5ca
2021-06-04 17:59:43 +02:00
Philipp Maier 91054e78ef main,abis: change model name from sysmoBTS to osmo-bts
The model name when used when abis_open() is called is sysmoBTS, since
we recently decided to deprecate the type name "sysmobts" in osmo-bsc we
might consider the same thing here.

Change-Id: I3c61d92f5527ae0145316b5ff92660f8b467a8dc
2021-06-02 17:53:02 +02:00
Vadim Yanitskiy ef5c364bba [VAMOS] common/scheduler: unify symbol names for training sequences
Change-Id: Ice464e5b02b11b0f13df247fe6a01420a29bf1c5
Related: SYS#4895, OS#4941
2021-06-01 02:46:43 +00:00
Vadim Yanitskiy bdef33d527 [VAMOS] bts_supports_cm(): handle RSL_CMOD_CRT_OSMO_TCH_VAMOS_{Bm,Lm}
Change-Id: I61040df30246ff79c9b13055bb1fec92fe64f3dd
Related: SYS#5315, OS#4940
2021-06-01 02:46:43 +00:00
Vadim Yanitskiy c70196240c [VAMOS] rsl: call bts_supports_cm() from rsl_handle_chan_mod_ie()
Ensure that we check the PHY capabilities in both cases:

  * RSL CHANnel ACTIVation, and
  * RSL CHANnel MODE MODIFY,

by calling bts_supports_cm() from rsl_handle_chan_mod_ie().

Modify bts_supports_cm() to accept a 'struct rsl_ie_chan_mode',
so we can handle VAMOS enabled channel modes and CSD later on.

Change-Id: I31a444592436705ec9d6ddade3cbfa7f8cb4bb91
Related: SYS#5315, OS#4940
2021-06-01 02:46:43 +00:00
Vadim Yanitskiy e02612d863 [VAMOS] rsl_rx_mode_modif(): handle Channel Identification IE
For some reason, handling of the Channel Identification IE was done
in l1sap_chan_act().  This function is being called on reciept
of the CHANnel ACTIVation message, but not on MODE MODIFY.

Change-Id: I07f95e69e6230a1daca62cc0a7c64954f191fa8a
Related: SYS#5315, OS#4940
2021-06-01 02:46:43 +00:00
Vadim Yanitskiy 13d595a9ef [VAMOS] osmo-bts-trx: indicate MTS in Downlink TRXDv2 PDUs
Change-Id: I1a17a25883214c068f9b1a6d651128b8f760d1fb
Related: SYS#4895, OS#4941
2021-06-01 02:46:43 +00:00
Vadim Yanitskiy ec1045a01b [VAMOS] osmo-bts-trx: implement and enable PDU batching for TRXDv2
This change implements TRXD PDU batching approach b), which is described
in section 25.3.4 of the user manual [1].  This approach is quite easy
to implement on the transceiver side, so we can enable it by default.

  .Example: datagram structure for combination b)
  ----
  +--------+----------------+---------+------------------------+
  | TRXN=N | TDMA FN=F TN=0 | BATCH=1 | Hard-/Soft-bits        |
  +--------+----------------+---------+------------------------+
  | TRXN=N | TDMA FN=F TN=1 | BATCH=1 | Hard-/Soft-bits        |
  +--------+----------------+---------+------------------------+
  | TRXN=N | TDMA FN=F TN=2 | BATCH=1 | Hard-/Soft-bits        |
  +--------+----------------+---------+------------------------+
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  +--------+----------------+---------+------------------------+
  | TRXN=N | TDMA FN=F TN=7 | BATCH=0 | Hard-/Soft-bits        |
  +--------+----------------+---------+------------------------+
  ----

Other PDU batching approaches can be introduced later.

[1] https://downloads.osmocom.org/docs/latest/osmobts-usermanual.pdf

Change-Id: I9b4cc8e10cd683b28d22e32890569484cd20372d
Related: SYS#4895, OS#4941
2021-06-01 02:46:43 +00:00
Pau Espin 272d474ccb pcuif: Set missing bsic field during Tx of info_ind
Change-Id: I5c0194644083f04799174464445ec21dae82f368
2021-05-31 16:18:13 +02:00
Keith Whyte d89938afa7 sysmobts-mgr: Fix path to hwmon in /sys
The path to the temperature sensor was wrong which
results in the SysmoBTS manager always considering
that the state is critical and hence powering OFF
the PA on startup. (with the default config)

As a further side-effect, the temperatures were not
available in the vty 'show manager' command.

Redacted log previous to this patch:

  sysmobts_misc.c:128 Error reading temperature
  sysmobts_mgr_2050.c:323 Going to enable the PA.
  sysmobts_mgr_temp.c:252 Failed to read the digital temperature. rc=-1
  sysmobts_mgr_temp.c:267 Failed to read the RF temperature. rc=-1
  sysmobts_mgr_temp.c:203 Moving from state NORMAL to CRITICAL.
  sysmobts_mgr_temp.c:185 System has reached critical warning.
  sysmobts_mgr_temp.c:236 OML alert sent: 0

and in the vty:

  Temperature control state: CRITICAL
  Current Temperatures
   Digital: -0.001000 Celsius
   RF:      -0.001000 Celsius

With this patch we correctly enable the PA and now can show in the vty:

  Temperature control state: NORMAL
  Current Temperatures
   Digital: 39.000000 Celsius
   RF:      35.125000 Celsius

Change-Id: Iac8e9a866ad6326874af91bd12a981f39a9a24c7
2021-05-28 17:54:26 +00:00
Vadim Yanitskiy a179a9434a Fix regression in 'osmo-bts-trx: rework and split up bts_sched_fn()'
In [1] I forgot to update tx_fcch_fn(), where we assume that the
burst buffer is already zero-initialized and do not call memset().
This results in sending dummy bursts on FCCH (instead of zeros).

Change-Id: I491b3b5702b3cfca45c12c002b41e60c629b05b9
Fixes: [1] Iec78989517865b3275a9784d1042a5ebd1d2815f
2021-05-27 21:31:09 +02:00
Pau Espin 949874433f Add missing value_string for NM_EV_* introduced recently
Fixes: 0277cddab2
Change-Id: I70266767d4f85e8c14ecf477af7fab0706698067
2021-05-27 18:58:59 +02:00
Pau Espin 1cad2f51c6 Fix regression in 'bts: Clean up TS selection in sign_link_up'
Fixes: 518ada9414
Change-Id: I63af96235eb6e0a7334936f65e1f44d4422198a5
2021-05-26 19:05:58 +02:00
Pau Espin 518ada9414 bts: Clean up TS selection in sign_link_up
Change-Id: I0c92dfd05bf2ae40887980ef10b7e4c679213b6a
2021-05-25 11:36:35 +00:00
Vadim Yanitskiy 97193ced54 [VAMOS] osmo-bts-trx: rework and split up bts_sched_fn()
Currently, in bts_sched_fn() we send a Downlink burst to the PHY
immediately after calling the associated logical channel handler.
Together with the obvious performance advantages, this approach
imposes some serious limitations.  The code has already become
quite complex with the introduction of the baseband frequency
hopping, and now it's not possible anymore to extend it further.

TRXD PDU batching, which is essential for VAMOS implementation,
requires us to make the scheduler more flexible at the expense of
increased memory consumption and additional CPU cycles.  This patch
splits up Downlink burst scheduling into 3 main steps:

  1. bts_sched_init_buffers(): initialization of per-TRX Downlink
     burst buffers allocated by phy_instance_create().  For C0/TRX0
     all timeslots are pre-initialized with dummy burst.
  2. bts_sched_fn(): generating burst bits for all active lchans.
  3. bts_sched_flush_buffers(): sending everything to the PHY.

This approach allows us to a) get rid of the ugly tail in bts_sched_fn()
that was responsible for sending dummy bursts on C0/TRX0;  b) implement
the PDU batching and have several variants of bts_sched_flush_buffers()
providing the alternative batching approaches later on;  c) implement
PDU merging for the upcoming shadow transceivers.

Change-Id: Iec78989517865b3275a9784d1042a5ebd1d2815f
Related: SYS#4895, OS#4941
2021-05-23 12:10:38 +00:00
Vadim Yanitskiy bdc5095368 common: phy_links_open(): warn about dangling PHY instances
Change-Id: I8d84bf7a00da6b985cb3dc314e86cacac8d4f48c
2021-05-23 10:36:05 +00:00
Vadim Yanitskiy d4abdd80fe [VAMOS] gsm_data.h: introduce and use BTS_TSC macro
Change-Id: I0cf915d2d3a640aa1442cf6abe9a314261b4a64e
Related: SYS#5315, OS#4940
2021-05-23 10:09:27 +00:00
Vadim Yanitskiy a344db979f [VAMOS] gsm_data.h: fix wrong bit-mask in BSIC2BCC macro
BCC takes 3 LSB bits of the BSIC, so we should apply 0b111 or 0x07.
The BSIC is specified in 3GPP TS 03.03 section 4.3.2.

Change-Id: Id24ad64e6c6de080ab43faa272daf844fbba6954
Related: SYS#5315, OS#4940
2021-05-23 10:09:27 +00:00
Vadim Yanitskiy d7323d6f1f [VAMOS] common: make 'struct gsm_bts_trx_ts' pointers const
Change-Id: I0369ef4ae603a4afed0661a5894df6a7135b1919
2021-05-23 10:09:27 +00:00
Vadim Yanitskiy e24279508d common: make the arguments of phy_{link,instance}_name() const
Change-Id: Ic01d131148065c9143d3a90f8020e2e133941292
Related: CID#236092 "Dereference before null check"
2021-05-19 16:53:06 +02:00
Vadim Yanitskiy 6ad89f2f58 osmo-bts-{trx,virtual}: fix: pinst->trx may be NULL
We assume that it's legal to have dangling PHY instances that are
not associated with any TRX instances in the configuration file.
Obviously, such PHY instances have pinst->trx set to NULL.

The DSP based models seem to handle dangling PHY instances without
any problems, so let's ensure that we always check pinst->trx
against NULL in the osmo-bts-{trx,virtual} specific code.

Change-Id: Ib7d9cb7ae47fead723fa46454cd64bf6e88756bb
Fixes: CID#236092 "Dereference before null check"
2021-05-19 16:53:06 +02:00
Vadim Yanitskiy dd9a6f16bc osmo-bts-trx: clarify logging messages in trx_if_{open,close}()
Change-Id: I48e64b5b52fc476f915d3a93535b21f0f192b7a9
2021-05-19 16:28:26 +02:00
Vadim Yanitskiy 462bf0952a [VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):

  - struct l1sched_trx (struct gsm_bts_trx),
  - struct l1sched_ts (struct gsm_bts_trx_ts),
  - struct l1sched_chan_state (struct gsm_lchan).

These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead.  Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.

                                 + gsm_network
                                 |
                                 --+ gsm_bts (0..255)
                                   |
  --+ l1sched_trx --------------------> gsm_bts_trx (0..255)
    |                                |
    --+ l1sched_trx_ts               --+ gsm_bts_trx_ts (8)
      |                                |
      --+ l1sched_chan_state           --+ gsm_lchan (up to 8)

I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.

In this path I slightly change the architecture as follows:

                                 + gsm_network
                                 |
                                 --+ gsm_bts (0..255)
                                   |
                                   --+ gsm_bts_trx (0..255)
                                     |
    --+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
      |                                |
      --+ l1sched_chan_state           --+ gsm_lchan (up to 8)

Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping.  The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.

osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.

Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-18 19:11:06 +00:00
Vadim Yanitskiy b4c0e43c60 osmo-bts-trx: fix hopping pointer bug in bts_sched_fn()
In change [1] together with the actual implementation I introduced
a serious bug to bts_sched_fn(): if a timeslot is configured to use
frequency hopping, both 'pinst' and 'l1h' pointers are *overwriten*
in the inner loop, so the Downlink burst is re-directed to the
approproate PHY instance.  However, if a subsequent timeslot is not
hopping, the Downlink burst would be re-directed to the wrong PHY
instance because both pointers were overwriten during a previous
iteration.

Let's move the 'struct phy_instance' pointer to the inner loop, so
it's properly re-initialized for each timeslot iteration.

Change-Id: I9afbbef8dc5d885763356470c27d4392dce8e815
Fixes: [1] I68f4ae09fd0789ad0d8f1c1e17e17dfc4de8e462
Related: SYS#4868, OS#4546
2021-05-18 19:11:06 +00:00
Vadim Yanitskiy 98aeaf6fa7 osmo-bts-trx: remove redundant assert() in bts_sched_fn()
trx_phy_instance() does assert() that the given TRX pointer is
not NULL.  In bts_sched_fn() it can never be NULL, so drop it.

Change-Id: I896ff5117588f2229cc54619ce62fd027a9ef25f
2021-05-18 19:11:06 +00:00
Vadim Yanitskiy e728f22136 osmo-bts-trx: cosmetic: s/trx_sched_fn/bts_sched_fn/g
Change-Id: I47e05b5b3f586430aa0b56c3d3c9a1da23077513
2021-05-18 19:00:55 +00:00
Vadim Yanitskiy 641ffaaef3 scheduler.h: cosmetic: use #pragma once
Change-Id: I551ce74f8cec8ec8d80768ec6c0559a203a8143c
2021-05-18 19:00:55 +00:00
Pau Espin 0277cddab2 sysmo,oc2g,lc15: Make RadioChannel MO depend on RadioCarrier MO
lower layer specific APIs require first to enable the TRX object
(GsmL1_PrimId_MphInitReq, which requires ARFCN received during Set
Radio Carrier Attributes) before enabling the per-TS structure.
Hence, OPSTART must happen in RCARRIER MO before OPSTART can be sent to
the Radio Channel MOs, otherwise the initialization of the TS objet will
fail and OPSTART for the RadioChannel MO will send back a NACK.
In order to avoid this, we need to keep the RadioChannel MO announced as
"Disabled Dependency" until RCARRIER is OPSTARTed.

Related: OS#5157
Change-Id: I8c6e5ff98c32a3cd5006f5e5ed6875bcabb1d85f
2021-05-17 14:23:30 +02:00
Vadim Yanitskiy 4733b099f5 osmo-bts-trx: implement TRXDv2 protocol support
Change-Id: I3532a6693bb335043ec390049138308991083e66
Related: SYS#4895, OS#4941, OS#4006
2021-05-11 10:55:55 +00:00
Vadim Yanitskiy 05493ca810 [VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments.  With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures.  This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.

However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there.  This change is a logical conclusion of the original change
mentioned above.

As a part of this change, the new LOGL1SB() macro is introduced.  It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.

Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-11 04:00:37 +02:00
Vadim Yanitskiy c74f25bdcc [VAMOS] Merge bts_trx_init() into gsm_bts_trx_alloc()
gsm_bts_trx_alloc() already does initialize some fields of the
allocated 'struct gsm_bts_trx' instance, and having an additional
function for initializing the other fields makes no sense.

Note that I intentionally didn't merge a call to bts_model_trx_init()
into gsm_bts_trx_alloc(), because this would break some assumptions
regarding the order of initialization and cause regressions.

This also allows us to not call bts_model_trx_init() from tests.

Change-Id: I4aefaf47b05a67ec0c4774c1ee7abcc95e04cc13
2021-05-11 03:54:07 +02:00
Vadim Yanitskiy b6d3e2c360 [VAMOS] struct gsm_bts_trx: fix the PHY instance pointer
First of all, there is no reason to use a void pointer because
it's always 'struct phy_instance'.  Also, no need to encapsulate
this pointer into 'role_bts' because there are no other roles in
osmo-bts (we used to have shared headers years ago).

This commit also fixes a bug in test_sysmobts_auto_band(), where a
pointer to 'struct femtol1_hdl' was directly assigned to trx.pinst.

Change-Id: I9bd6f0921e0c6bf824d38485486ad78864cbe17e
2021-05-09 02:05:48 +02:00
Vadim Yanitskiy 2dda5d835a osmo-bts-{lc15,oc2g}: drop redundant checks in VTY commands
Change-Id: I4fea6d661b7193c3a04e88c9399a9e2bc402254f
2021-05-09 02:05:48 +02:00
Vadim Yanitskiy 0dcaf34927 common/sysinfo: make struct gsm_bts_trx const in num_agch()
Change-Id: I776defc7e9699a378c9a03304c63e15d023476d0
2021-05-08 17:41:02 +02:00
Vadim Yanitskiy 57ebf04171 struct gsm_bts_trx: remove unused leftovers from openbsc
Change-Id: I667fc1d6a5eaccb69b45197da71d4a699f52fcfc
2021-05-06 01:10:16 +02:00
Vadim Yanitskiy 9e09441814 rsl: fix wrong value printed in rsl_handle_chan_mod_ie()
Change-Id: I724504a39702393402fae20b0e9775c3486da966
2021-05-05 02:09:26 +02:00
Vadim Yanitskiy c9635b0ad1 osmo-bts-trx: refactor parse_rsp(), fix compilation warnings
For a long time, we see this annoying -Wstringop-truncation warning:

  In function ‘parse_rsp’,
      inlined from ‘trx_ctrl_read_cb’ at trx_if.c:647:6:
  trx_if.c:416:2: warning: ‘strncat’ output may be truncated copying
                  between 0 and 45 bytes from a string of length 1495
    416 |  strncat(rsp->cmd, buf_in + 4, p - buf_in - 4);
        |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is no real need to use strncat() in parse_rsp(), because we
do not concatenate any strings but simply copy TRXC response parts
from the input buffer to the corresponding 'name' and 'parameters'
buffers.  Let's use memcpy() instead.  This also fixes the warning.

Change-Id: Ia10adf7d76abe9a423b07e828852fbfb53b95125
2021-04-30 21:07:41 +02:00
Vadim Yanitskiy 38cdafd656 common/abis: fix the use of deprecated e1inp_line_get() API
We need curly braces becausee1inp_line_get2() is basically a macro
that calls OSMO_ASSERT(), which in its turn contains an 'if' stmt.

Change-Id: I41a5fd13a7fa40e16bcf1a8099624b654274cee3
2021-04-30 21:07:41 +02:00
Vadim Yanitskiy d2eafadc25 vty: fix the use of deprecated osmo_bts_feature_name()
Change-Id: I67863da286b0fd1ec42088bce12d3c76e4be30ba
Depends: I9dfdb5e81037b6000effbd340af4e5db0dcfd69c
2021-04-30 21:07:02 +02:00
Vadim Yanitskiy f3e3a3ac99 osmo-bts-trx: reduce code nasting in trx_if_send_burst()
If the PHY is not powered on and we are not supposed to send any
bursts to it, then trx_if_send_burst() should just return early.

Change-Id: I578bd5a731ad88ebff283c75bb7eb268d9e7e787
Related: SYS#4895, OS#4941, OS#4006
2021-04-30 19:02:15 +00:00
Vadim Yanitskiy 67b141c567 osmo-bts-trx: assert PDU version in trx_if_send_burst()
If somehow the TRXC logic negotiates a non-supported TRXD PDU version,
then it's a serious bug in the code.  Let's add an assert() for that.

Change-Id: I301377bcebd5e2bbcfc18b3637253ef261bb5b2e
2021-04-30 19:02:15 +00:00
Vadim Yanitskiy 7651b078b1 osmo-bts-trx: enlarge and share TRXD message buffer
Starting from TRXDv2, several PDUs may be batched together and sent in
all together a single datagram.  This requires us to increase the buffer
size that we use for sending and receiving TRXD messages.  Let's use
65536 matching the default MTU value for 'lo' interface on Linux.

Given that 65536 is quite a big number, let's allocate a shared Rx/Tx
buffer statically to avoid [potential] stack overflow.

Change-Id: I729451c8ecdc7ff2631beb423f15523db16b3ee3
Related: SYS#4895, OS#4941, OS#4006
2021-04-30 19:02:15 +00:00
Vadim Yanitskiy 010841644b osmo-bts-trx: refactor handling of version specific TRXD parts
This is a preparatory change for the upcoming TRXDv2 support:

* move common TRXDv0/v1 header parser into a separate function;
* move burst handling into a single, version independent function;
** determine modulation and burst length in trx_data_parse_pdu_v0();

Change-Id: I7aedd85a8d4f6d6191cd3b75272a688208fb2879
Related: SYS#4895, OS#4941, OS#4006
2021-04-30 19:02:15 +00:00
Harald Welte 1896c8f03e manuals: Update copyright years
Change-Id: I353013ddfc8c5506599e723e713d93f3f041f15d
2021-04-30 08:24:00 +02:00
Harald Welte 75f56805e0 manual: Remove manual revision history; we don't use it anywawy
Change-Id: I25c4d8b694756c6eed81c9b552a389ca5bd04ea7
2021-04-30 08:24:00 +02:00
Harald Welte 134062e335 manual: Include QoS chapter and add osmo-bts specific example
Change-Id: I8fcd524c550b43a851b3094effc215e5203d28be
Requires: osmo-gsm-manuals.git Id344c29eda2a9b3e36376302b425e9db1f6c0f28
Requires: libosmo-abis.git I8991dd6eb406a5b9a70498974fc1ad339452f871
2021-04-30 08:24:00 +02:00
Harald Welte b1b100ce59 Introduce ability to set socket priority of RTP sockets
This significantly simplifies setups in which not only the IP DSCP
but also the IEEE 802.1Q PCP is to be set for RTP packets.

Depends: libosmo-abis.git I52c08f4b2a46981d002ef0c21e6549445d845a6e
Change-Id: Ia3a91e6788285be3e2e73defee63e6bd79c6258e
Related: SYS#5427
2021-04-30 08:23:56 +02:00
Neels Hofmeyr 9c321b8486 omldummy: add cmdline arg --features
The current usage is to make osmo-bts-omldummy indicate BTS_FEAT_VAMOS
on OML, so that we can test osmo-bsc's behavior when VAMOS is enabled.

Related: SYS#4895
Depends: I699cd27512887d64d824be680303e70fff3677c1 (libosmocore)
Change-Id: Ib50990109f07884ef999ba5a4566f5d1d457b0ae
2021-04-27 13:38:34 +00:00
Vadim Yanitskiy dd8439f889 osmo-bts-trx: pass 'struct phy_instance' to TRXD dissectors
All these functions need the PHY instance pointer for logging,
they don't really need a pointer to 'struct trx_l1h'.

Change-Id: I626b4392a8bc57a3fe5e8c931aa1ce9dd505676c
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:48:03 +00:00
Vadim Yanitskiy 8a99365281 osmo-bts-trx: generalize checking of TRXD header length
Change-Id: I7df851c3afb82133f84dc805e0926438a90efe07
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:56 +00:00
Vadim Yanitskiy ac55dcb5d0 osmo-bts-trx: cosmetic: get rid of TRX_CHDR_LEN macro
The 'CHDR' stands for 'Common Header', but this does not apply to
TRXDv2 because TDMA frame number may not be present in the batched
PDUs.  Let's avoid potential confusion by removing it.

Change-Id: I80495df474c432f4c0a4cfa6f917821d7b35859a
2021-04-24 08:47:00 +00:00
Vadim Yanitskiy 17350e2fd6 osmo-bts-trx: move TDMA frame number check to trx_data_read_cb()
Change-Id: Ib3c4a5ad7f16196dc5c591aa0b4d7e0ec3267f05
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:00 +00:00
Vadim Yanitskiy 974bf725a4 osmo-bts-trx: discard TRXD PDUs with unexpected version
Change-Id: Icdc3d12a7686428046113f9fa8f21a99569e651a
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:00 +00:00
Vadim Yanitskiy 16c2998069 osmo-bts-trx: move MTS parser into trx_data_parse_mts()
This would allow to re-use this code from the TRXDv2 parser.

Change-Id: I2de2cb2d58110452d8dedbcacfef28f85f6d67c1
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:00 +00:00
Vadim Yanitskiy b619da5e72 osmo-bts-trx: 'burst type' is actually modulation type
Burst type and modulation type are actually different things.

Change-Id: Ic06c96434ad32dd3770b88cb1fefcbefb2fc3928
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:00 +00:00
Vadim Yanitskiy 61fcfa6ae7 osmo-bts-trx: define TRXC/TRXD message buffer size
Change-Id: I4cb05600fa8af33e1c92e93cc1a86c14f21b9fb2
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:00 +00:00
Neels Hofmeyr 708fca343e omldummy: introduce using getopt_long
Prepare for adding the --features cmdline arg following in a subsequent
patch.

Related: SYS#4895
Change-Id: I72ccf65ba894e87ee7b0f6bed879f94728f34ccc
2021-04-22 20:45:02 +02:00
Neels Hofmeyr 823cd52964 Abis manual: add RSL_IE_OSMO_TRAINING_SEQUENCE
Change-Id: Ie583bd5969fdb45f772af198033e58d7c4077306
2021-04-22 20:45:02 +02:00
Neels Hofmeyr 7177e666bb Abis manual: add VAMOS to BTS features
Change-Id: I108e3300e96087f4be47bd9ea237a9d28982839f
2021-04-22 20:45:02 +02:00
Neels Hofmeyr 6072be9be4 Abis manual: add Get Attributes, add BTS features
Change-Id: I99631272334537ab49ba8c530240aaeb67dde9d7
2021-04-22 20:44:51 +02:00
Neels Hofmeyr 93b04aa4c3 Abis manual: s/TS 12.21/TS 52.021
Change-Id: I662a3419a6ec741fe162ccc7c7221df20b2780b1
2021-04-21 16:15:01 +02:00
Neels Hofmeyr b03ff89876 osmobts-abis.adoc: add missing bibliography
Change-Id: I6a86416466eba14090026a3e6ec82a0e8548209a
2021-04-21 16:15:01 +02:00
Vadim Yanitskiy b11012c1f5 osmo-bts-trx: cosmetic: use '#pragma once' in trx_if.h
Change-Id: I78b93a8f5fbbd94141d30518d37c1ce05f8a681f
2021-04-21 01:26:00 +02:00
Vadim Yanitskiy ab5cc5e6c5 osmo-bts-trx: remove outdated TRXD protocol documentation
We do have TRXC/TRXD documentation in osmo-gsm-manuals repository.
This big comment is out of sync with what we have in the manuals,
so let's better remove it to avoid maintaining docs in several places.

Change-Id: Ibfcefcbb5f30fe9b6c691578a93e6fedd5644b30
Related: SYS#4895, OS#4941, OS#4006
2021-04-21 01:26:00 +02:00
Vadim Yanitskiy 32ef94cac0 osmo-bts-trx: cosmetic: TRXD 'header version' -> 'PDU version'
TRXDv2 brings significant changes to the whole PDU structure, not
just the header.  Let's highlight this in the code / strings.

Change-Id: Id0274bd1ae5c419548596ed1852e6a28ec62b713
Related: SYS#4895, OS#4941, OS#4006
2021-04-21 01:26:00 +02:00
Vadim Yanitskiy 0b33ab8ac2 lchan2lch_par(): fix missing default branch in switch
New channel mode values have recently been added with change [1]
to 'enum gsm48_chan_mode'.  The lack of default branch in
lchan2lch_par() caused build failures on Jenkins:

  oml.c:956:2: error: enumeration value ‘GSM48_CMODE_SPEECH_V2_VAMOS’
                      not handled in switch [-Werror=switch]
  oml.c:956:2: error: enumeration value ‘GSM48_CMODE_SPEECH_V3_VAMOS’
                      not handled in switch [-Werror=switch]
  oml.c:956:2: error: enumeration value ‘GSM48_CMODE_SPEECH_V5_VAMOS’
                      not handled in switch [-Werror=switch]

This function is duplicated in osmo-bts-{lc15,oc2g,octphy,sysmo},
so we unfortunately need to apply the same fix to all copy-pasted files.

Change-Id: I557ff8cac6564d22485c101fba9212f5f0e95bb7
Related: [1] Ie0ea592da5610ae70290106d004e549cf3212a89
2021-04-20 22:50:14 +02:00
Vadim Yanitskiy 8de227fd13 rsl: add missing Channel Mode values to rsl_handle_chan_mod_ie()
Change-Id: I125cdaaf5adac0891a964c9834b99eb5a35ce262
Depends-On: I40eca759380c8895d7923b2b4259d37a50978160
Depends-On: Icf4c83fa443b8410f4362c119b0a85419036b9cd
2021-04-19 16:12:20 +02:00
Vadim Yanitskiy aee336eaac rsl: rename, fix and refactor lchan_tchmode_from_cmode()
In change [1] I added the missing 'default' branch to the 'switch'
statement in lchan_tchmode_from_cmode().  This caused massive
regressions in ttcn3-bts-test, because osmo-bts started to NACK
some RSL CHANnel ACTIVation messages.

What caused a lot of regressions in ttcn3-bts-test is actually the
missing branch for RSL_CMOD_SPD_SIGN in the 'switch' statement.
It was not a problem before [1], because the 'default' branch was
not there.  I was about to add the missing 'cause' when I realized
that this function needs to be reworked first...

First of all, lchan_tchmode_from_cmode() does a bit more than just
deriving RR (TS 44.018) channel mode from RSL (TS 48.058) channel
mode.  It additionally stores the 'Speech or data indicator' to
the logical channel state, and also changes some global DTXd related
flags in 'struct gsm_bts'.  Let's use a more precise name.

  lchan_tchmode_from_cmode() -> rsl_handle_chan_mod_ie()

Together with renaming, it becomes logical to have the IE presence
check in rsl_handle_chan_mod_ie(), so that we can reduce code
duplication in the calling functions a bit.

Finally, the main problem is that coding and interpretation of the
6-th octet 'Speech coding algor./data rate + transp ind' depends on
the 4-th octet of the Channel Mode IE.  We cannot handle all values
in one 'switch' statement without proper discrimination:

  a) If octet 4 indicates Speech, then octet 6 shall be interpreted
     as the GSM speech coding algorithm (FR, HR, AMR, etc.).

  b) If octet 4 indicates Signalling, then octet 6 shall be set
     to '00'O, because this is the only value defined in version
     16.0.0 of 3GPP TS 48.058.  All other values are reserved.

  c) If octet 4 indicates Data, then octet 6 shall be interpreted
     as CSD data rate further discriminated by service transparency.

Therefore, we need take both values into account.  This can be
achieved by mixing them together using the bitwise operators,
just like we do in L1SAP code.

Change-Id: Iba967f5bd0cc8ad6cd3ccd40cca38b15ffe96b2c
Related: [1] I67a70132999be6580a29e6b814763309a6df4ae9
Related: SYS#4895, OS#4941
2021-04-19 06:29:29 +02:00
Vadim Yanitskiy 5ac4456173 l1sap: fix incorrect pointer cast in l1sap_chan_act()
In [1] I introduced a regression, so osmo-bts started to complain:

  This PHY does not support lchan TSC 3 != BSIC-TSC 7

on channel activation, despite the TSC in RSL_IE_CHAN_IDENT was 7.

The problem is that this statement:

  cd = (const struct gsm48_chan_desc *) TLVP_VAL(tp, RSL_IE_CHAN_IDENT) + 1;

is basically equivalent to:

  cd = ((const struct gsm48_chan_desc *) TLVP_VAL(tp, RSL_IE_CHAN_IDENT)) + 1;

so we actually shift the pointer by sizeof(struct gsm48_chan_desc)
and skip 3 octets instead of just one (IEI octet).  Fix this.

Change-Id: Ic3a81396b60577e03c541d32839d07dc6d45c838
Fixes: [1] Id100f4c56fd5c1adad5d925d97240bed82981b9b
Fixes: OS#5121
2021-04-18 23:57:20 +02:00
Vadim Yanitskiy 9cf65a7af5 manuals: document new 'gsmtap-remote-host' command
Change-Id: I7f75fbac77a612493ce187cfac3c4ae203c81b23
2021-04-18 06:53:33 +00:00
Vadim Yanitskiy 078682d7b5 manuals: remove deprecated command line parameters
Change-Id: Ie49abeb9647e3c8abdc9e110ab1a71c116f5def6
2021-04-18 06:53:33 +00:00
Vadim Yanitskiy 976e7e51e6 rsl: do not blindly ignore unhandled/unknown Channel Mode
Change-Id: I67a70132999be6580a29e6b814763309a6df4ae9
Related: SYS#4895
2021-04-16 20:57:08 +02:00
Vadim Yanitskiy 479ff386ff osmo-bts-trx: correct definition of 'osmotrx rx-gain' command
* Calling l1if_provision_transceiver_trx() yelds nothing.
* It does not apply immediately, full restart required.

Change-Id: I93c9e19d0543f19528cec842b8be332b4d93214e
2021-04-16 15:15:16 +00:00
Vadim Yanitskiy cabfbf470f manuals: document GSMTAP 'enable-all' / 'disable-all'
Change-Id: Iadbcf9d3184ab17c11c51e191aa3e80665839c22
2021-04-16 14:53:57 +00:00
Vadim Yanitskiy 1334316844 manuals: fix wrong VTY node for 'gsmtap-sapi' command
Change-Id: Ifcf1cf9cdbad40862d48415e004865a91a61d1b1
2021-04-16 14:42:55 +00:00
Vadim Yanitskiy f88f539c77 l1sap: fix wrong IEI and parsing in l1sap_chan_act()
As the prefix in 'GSM48_IE_CHANDESC_2' implies, this IE belongs
to 3GPP TS 04.08 (or TS 44.018), so it can be used in the Radio
Resource assignment messages sent to the MS.  While in this
function we're dealing with 3GPP TS 48.058, and thus the IEI
may be (and actually is) different for the RSL messages.

Also, according to 3GPP TS 48.058, section 9.3.5, the Channel
Description IE is included together with its element identifier,
so we need to skip one byte when doing the pointer casting.

Change-Id: Id100f4c56fd5c1adad5d925d97240bed82981b9b
Related: SYS#4895, OS#4941
2021-04-07 04:55:48 +02:00
Vadim Yanitskiy 2915bbf4c5 l1sap: check BTS_FEAT_MULTI_TSC in l1sap_chan_act()
Instead of blindly assuming what the PHY does support, and what
it does not, let's check the related feature vector.

Change-Id: I699cdddbfab111855998853548d9cfe956f7c60c
Related: SYS#4895, OS#4941
2021-04-07 04:54:04 +02:00
Vadim Yanitskiy 1adcc27eb9 l1sap: use TLVP_PRES_LEN() macro in l1sap_chan_act()
Change-Id: I6793623622fd7303d7dc22117a163a6990497c28
Related: SYS#4895, OS#4941
2021-04-07 04:53:27 +02:00
Vadim Yanitskiy 180ddb0da3 l1sap: use the passed 'trx' pointer in l1sap_chan_act()
Change-Id: Id94363f2a22eb905ae01e68ddfdf48fc8c646aaf
Related: SYS#4895, OS#4941
2021-04-07 04:52:38 +02:00
Vadim Yanitskiy 9dd7e3c907 osmo-bts-trx: fix segfault on trx_phy_inst_open() failure
If for whatever reason it fails to initialize the TRXD or TRXC
interface, trx_phy_inst_open() would return an error.  This
would cause bts_model_phy_link_open() to call trx_if_close()
on each of the PHY links, including those that were never
opened.  This leads to a segfault in trx_if_close().

Make sure that in trx_if_init() we properly init 'struct trx_l1h',
so it's safe to call trx_if_close() at any time and in any state.

Change-Id: I1f128813528f505fede04799e84456f6271058d0
2021-04-01 15:21:44 +00:00
Philipp Maier fd5151668c sched_lchan_tchh: fix frame number and fill FACCH gap
The measurement results / TCH indications that are handed when decoding
the TCH/H are off by two bursts. Since a measurement result / TCH block
is expected every two bursts anyway the problem can only be noticed when
a FACCH transmission is going on and the frame numbers of the BFI TCH
blocks appear to be missaligned towards the FACCH block.

The reason is that the incoming bursts are shifted into a 6 burst wide
buffer. The decoding functions always look at the beginning of that
buffer while the bursts are shifted into the buffer from the end. A
facch will always fit exactly in that buffer but TCH/H blocks are only
4 bursts wide and thereofre they need two additional bursts until they
reach the coverage of the decoding function. Lets fix this by putting
the correct frame number (from two bursts before) into the remap
functions in order to get the correct beginning of the block.

Since the FACCH transmission uses six blocks it takes out two TCH
blocks. This means that if we count the FACCH block we end up with a gap
of one TCH voice block. Lets generate a dummy measurement to compensate
the gap. This will also match the behavior of the osmo-bts-sysmo phy.

Change-Id: I1ad9fa3815feb2b4da608ab7df716a87ba1f2f91
Related: OS#4799
2021-03-27 18:37:55 +00:00
Vadim Yanitskiy ca1628fb7a osmo-bts-trx: fix: do not call trx_if_close() two times
It's called by trx_phy_inst_open() if trx_if_open() fails.

Change-Id: Ic672f865ab513043a58979471a254a59d44daa6d
2021-03-18 07:52:45 +01:00
Pau Espin 29c4f3173f bts-trx: reorder first timerfd schedule to decrease first timeout skew
By reordering the instruction, we scheduler the timerfd prior to
processing the FN on the upper layers. This means the first timerfd
expiration even will happen more inline with the expected time, that is,
CLOCK IND time + GSM_TDMA_FN_DURATION_nS.

Let T(trx_sched_fn) be the time spent executing function trx_sched_fn().
With previous order, the timerfd would have been scheduled later, which
in the end would mean expiration would happen at time CLOCK_IND +
GSM_TDMA_FN_DURATION_nS + T(trx_sched_fn), hence ending up with an extra
skew of T(trx_sched_fn) added by ourselves.
This extra skew added may be important specially at startup time (when
this code path is used), since usually the load in the system is high
and skew is usually already higher, which means helping crossing
unacceptable thresholds which may end up in osmo-bts-trx stopping with
"No clock from osmo-trx" reason.

Change-Id: Ie2ba35cd87f0bd4078ac3b4b5ec2eacad36c4258
2021-03-15 18:33:14 +01:00
Pau Espin 8593b38616 bts-trx: Drop duplicate set of last_clk_ind
These fields are always aready set by the only caller of the function
trx_setup_clock(), so there's no use in re-setting them.

Change-Id: Id8a7141984e07eb11abae08e0c63ae7ebc333511
2021-03-15 18:12:41 +01:00
Pau Espin 7a7beb9b35 bts-trx: Avoid submitting first data_ind with FN=0 to upper layers
It can happen that the first burst we receive after enabling the PDCH
channel (when PCU connects to the BTS) is bid!=0. As a result,
chan_state->ul_first_fn is never set and defautl value 0 in there is
passed to the upper layers. As a result, when the 2nd block is
transmitted, this time with correct FN, the PCU will see a huge jump in
FNs. Since in PDCH the bursts are always consecutive, let's simply use
bi->fn - 3 as a first_fn and be done with the issue.

Related: OS#5020
Change-Id: Ie982caeb29f3ffd880b44e88a89b85ea3e6e6947
2021-03-11 18:42:00 +01:00
Pau Espin 166b10059b bts-trx: Always submit rx PDTCH DATA.ind to l1sap
Similar to what we have been doing for TCH channels, we want to make
sure all MAC blocks get to the upper layers, even if containing invalid
data (flagging it with data_len=0) so that upper layers (osmo-pcu
through PCUIF in this case) can rely on FN clock without gaps due to
Rx errors.

Related: OS#5020
Change-Id: I343c7a721dab72411edbca816c8864926bc329fb
2021-03-11 17:41:48 +00:00
Pau Espin 6a1a5f988b l1sap: Transmit pdtch invalid MAC blocks to PCU
Similar to what we have been doing for TCH channels, we want to make
sure all MAC blocks get to the upper layers, even if containing invalid
data (flagging it with data_len=0) so that upper layers (osmo-pcu
through PCUIF in this case) can rely on FN clock without gaps due to
Rx errors.

Related: OS#5020
Change-Id: I0b04b013b7bad5ff53d6a969ff0128b37f7f62d5
2021-03-11 17:41:48 +00:00
Vadim Yanitskiy ffce0e45a5 doc/examples: enable stderr logging for osmo-bts-virtual.cfg
Shippig configuration examples with disabled logging is... not ok.

Change-Id: Iecb62b3537afe8906f6f816bfa7cc79b12a1ca26
2021-03-09 11:14:23 +01:00
Vadim Yanitskiy 9fa152a981 doc/examples: remove obsolete power control parameters
We should not have deprecated parameters in configuration examples.

Change-Id: I77cbe68023aa15ccf9829ef14c8cc7bccc84b58d
2021-03-09 11:06:08 +01:00
Philipp Maier 3f3cdff773 l1sap: add logging and VTY introspection for ACCH repetition
At the moment osmo-bts is not looging much ACCH repetition related
information. This makes testing ACCH repetition difficult. Lets add some
debug output that informs the user when ACCH repetition is turned on or
off. Lets also add an ACCH repetition status display to the show lchan
VTY command.

Change-Id: I59d11fd03be3d29fb8a4279d9945b03006764c0e
Related: SYS#5114
2021-03-01 19:47:56 +00:00
Philipp Maier 6940d34ee5 l1sap: Store status of SRR in an lchan struct memeber
The MS sets the SRR bit in the L1 SACCH header to request DL-SACCH
repetition from the BTS. At the moment we access the l1_info stored in
tle lchan struct each time we want to check the status of the SRR bit.
However, it is more convinient to do this once at reception and store
the status of the status of the flag in a separate struct member.

Change-Id: Ieddd45d7890343d64db14b9c726f6fa2f25714f6
Related: SYS#5114
2021-03-01 19:47:56 +00:00
300 changed files with 28591 additions and 8362 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
open_collective: osmocom

7
.gitignore vendored
View File

@ -54,6 +54,8 @@ src/osmo-bts-oc2g/misc/.dirstamp
tests/atconfig
tests/package.m4
tests/amr/amr_test
tests/csd/csd_test
tests/agch/agch_test
tests/paging/paging_test
tests/cipher/cipher_test
@ -92,6 +94,7 @@ debian/tmp/
doc/manuals/*.html
doc/manuals/*.svg
doc/manuals/*.pdf
doc/manuals/vty/*.pdf
doc/manuals/*__*.png
doc/manuals/*.check
doc/manuals/generated/
@ -103,3 +106,7 @@ doc/manuals/common
doc/manuals/build
contrib/osmo-bts.spec
contrib/ber/rtp_ber
contrib/ber/rtp_gen_map
arm-poky-linux-gnueabi-libtool

View File

@ -27,16 +27,16 @@ Homepage
--------
The official homepage of the project is
https://osmocom.org/projects/osmobts/wiki
<https://osmocom.org/projects/osmobts/wiki>
GIT Repository
--------------
You can clone from the official osmo-bts.git repository using
git clone git://git.osmocom.org/osmo-bts.git
git clone https://gitea.osmocom.org/cellular-infrastructure/osmo-bts
There is a cgit interface at https://git.osmocom.org/osmo-bts/
There is a web interface at <https://gitea.osmocom.org/cellular-infrastructure/osmo-bts>
Documentation
-------------
@ -57,6 +57,13 @@ There also is an
[Abis reference Manual](https://ftp.osmocom.org/docs/latest/osmobts-abis.pdf)
describing the OsmoBTS specific A-bis dialect.
Forum
-----
We welcome any osmo-bts related discussions in the
[Cellular Network Infrastructure -> 2G RAN (GERAN)](https://discourse.osmocom.org/c/cni/geran)
section of the osmocom discourse (web based Forum).
Mailing List
------------
@ -69,6 +76,13 @@ Please observe the [Osmocom Mailing List
Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules)
when posting.
Issue Tracker
-------------
We use the [issue tracker of the osmo-bts project on osmocom.org](https://osmocom.org/projects/osmobts/issues) for
tracking the state of bug reports and feature requests. Feel free to submit any issues you may find, or help
us out by resolving existing issues.
Contributing
------------
@ -96,7 +110,6 @@ Common Core
* System Information limited to 1,2,2bis,2ter,2quater,3,4,5,6,9,13
* No RATSCCH in AMR
* Will reject TS 12.21 STARTING TIME in SET BTS ATTR / SET CHAN ATTR
* No reporting of interference levels as part of TS 08.58 RF RES IND
* No support of TS 08.58 MultiRate Control
* No support of TS 08.58 Supported Codec Types
* No support of Bter frame / ENHANCED MEASUREMENT REPORT

View File

@ -0,0 +1,12 @@
# When cleaning up this file: bump API version in corresponding Makefile.am and rename corresponding debian/lib*.install
# according to https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
# In short:
# LIBVERSION=c:r:a
# If the library source code has changed at all since the last update, then increment revision: c:r + 1:a.
# If any interfaces have been added, removed, or changed since the last update: c + 1:0:0.
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
libosmogsm >1.9.0 added new PRIM_INFO to include/osmocom/gsm/l1sap.h
libosmogsm >1.9.0 use of RLP code in libosmogsm
libosmoctrl >1.9.0 use ctrl_cmd_send2()

View File

@ -69,14 +69,15 @@ then
fi
dnl checks for libraries
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOCODING, libosmocoding >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.1.0)
PKG_CHECK_MODULES(LIBOSMOTRAU, libosmotrau >= 1.1.0)
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOCODING, libosmocoding >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMOTRAU, libosmotrau >= 1.5.0)
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.4.0)
AC_MSG_CHECKING([whether to enable support for sysmobts calibration tool])
AC_ARG_ENABLE(sysmobts-calib,
@ -349,6 +350,56 @@ then
AC_SUBST([OSMO_GSM_MANUALS_DIR])
fi
AC_ARG_ENABLE([external_tests],
AC_HELP_STRING([--enable-external-tests],
[Include the VTY/CTRL tests in make check [default=no]]),
[enable_ext_tests="$enableval"],[enable_ext_tests="no"])
if test "x$enable_ext_tests" = "xyes" ; then
AC_CHECK_PROG(PYTHON3_AVAIL,python3,yes)
if test "x$PYTHON3_AVAIL" != "xyes" ; then
AC_MSG_ERROR([Please install python3 to run the VTY/CTRL tests.])
fi
AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
AC_MSG_ERROR([Please install https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests to run the VTY/CTRL tests.])
fi
fi
AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
AC_MSG_RESULT([$enable_ext_tests])
AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
#
# SystemTap support
#
AC_MSG_CHECKING([whether to include systemtap tracing support])
AC_ARG_ENABLE([systemtap],
[AS_HELP_STRING([--enable-systemtap],
[Enable inclusion of systemtap trace support])],
[ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no'])
AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes])
AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
if test "x${ENABLE_SYSTEMTAP}" = xyes; then
# Additional configuration for --enable-systemtap is HERE
AC_CHECK_PROGS(DTRACE, dtrace)
if test -z "$DTRACE"; then
AC_MSG_ERROR([dtrace not found])
fi
AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'],
[SDT_H_FOUND='no';
AC_MSG_ERROR([systemtap support needs sys/sdt.h header])])
AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using SystemTap probes.])
AC_ARG_WITH([tapset-install-dir],
[AS_HELP_STRING([--with-tapset-install-dir],
[The absolute path where the tapset dir will be installed])],
[if test "x${withval}" = x; then
ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"
else
ABS_TAPSET_DIR="${withval}"
fi], [ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"])
AC_SUBST(ABS_TAPSET_DIR)
fi
# https://www.freedesktop.org/software/systemd/man/daemon.html
AC_ARG_WITH([systemdsystemunitdir],
[AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
@ -393,10 +444,13 @@ AC_OUTPUT(
tests/tx_power/Makefile
tests/power/Makefile
tests/meas/Makefile
tests/amr/Makefile
tests/csd/Makefile
doc/Makefile
doc/examples/Makefile
doc/manuals/Makefile
contrib/Makefile
contrib/ber/Makefile
contrib/systemd/Makefile
contrib/osmo-bts.spec
Makefile)

View File

@ -1 +1 @@
SUBDIRS = systemd
SUBDIRS = systemd ber

28
contrib/ber/Makefile.am Normal file
View File

@ -0,0 +1,28 @@
AM_CPPFLAGS = \
$(all_includes) \
-I$(top_srcdir)/include \
-I$(top_builddir)/include \
-I$(builddir) \
$(NULL)
AM_CFLAGS = \
-Wall \
$(LIBOSMOCORE_CFLAGS) \
$(LIBOSMOTRAU_CFLAGS) \
$(LIBOSMOCODEC_CFLAGS) \
$(NULL)
LDADD = \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOTRAU_LIBS) \
$(LIBOSMOCODEC_LIBS) \
$(NULL)
noinst_PROGRAMS = rtp_ber rtp_gen_map
rtp_ber_SOURCES = rtp_ber.c codec_bit_class.h
rtp_gen_map_SOURCES = rtp_gen_map.c
update_codec_bit_class_h: rtp_gen_map
$(AM_V_GEN)./$< > $(top_srcdir)/contrib/ber/codec_bit_class.h

26
contrib/ber/README Normal file
View File

@ -0,0 +1,26 @@
BER testing tool
----------------
* Check all configs (MSC/BSC/BTS) for proper codec support
- FR enabled
- EFR enabled
- AMR 12.2 enabled (and all other modes disabled !)
- Use `amr-payload octet-aligned` in BSC config
* Check BTS config
- Disable jitter buffer : `bts N / rtp jitter-buffer 0`
* Check BSC config
- Disable radio timeout : `network / bts n / radio-link-timeout infinite`
* Start BER testing tool
- `./rtp_ber 4000`
* On the MSC CLI, start a silent-call, then request GSM to test loop
- `subscriber imsi <XXX> silent-call start tch/f speech-amr`
- `subscriber imsi <XXX> ms-test close-loop b`
Don't forget to terminate the loop and terminate the silent call !
- `subscriber imsi <XXX> ms-test open-loop`
- `subscriber imsi <XXX> silent-call stop`

View File

@ -0,0 +1,59 @@
static const int gsm_fr_bitclass[] = {
-1, -1, -1, -1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 1, 2, 2,
0, 0, 1, 2, 2, 0, 0, 1, 2, 2, 0, 1, 1, 2, 0, 1,
2, 2, 0, 1, 2, 1, 2, 2, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 0, 0, 0, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1,
1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1,
2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2,
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1,
2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2,
1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1,
1, 2, 1, 1, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 0, 0, 0, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1,
1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1,
2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2,
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1,
2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2,
1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1,
2, 2, 1, 2, 2, 1, 2, 2,
};
static const int gsm_efr_bitclass[] = {
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
1, 1, 1, 1, 2, 2, 1, 2,
};
static const int gsm_amr_12_2_bitclass[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, -1, -1, -1, -1,
};

483
contrib/ber/rtp_ber.c Normal file
View File

@ -0,0 +1,483 @@
/* RTP based GSM BER testing for osmo-bts, implementing ideas described in
* https://osmocom.org/projects/osmobts/wiki/BER_Testing
*
* In short: The command transmits a PRBS sequence encapsulated in RTP frames, which are sent
* to the BTS, which transmits that data in the (unimpaired) downlink. The mobile station
* receives the data and is instructed to loop it back in the (possibly impaired) uplink.
* The BTS receives that uplink, puts in in RTP frames which end up being received back by this
* very tool. By correlating the received RTP with the PRBS sequence, this tool can compute
* the BER (Bit Error Rate) of the (possibly impaired) uplink. Doing this with different
* RF channel model simulators in the uplink allows to establish BER at different levels and
* channel conditions. */
/* (C) 2019 sysmocom - s.f.m.c. GmbH; Author: Sylvain Munaut
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <osmocom/codec/codec.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/prbs.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/utils.h>
#include <osmocom/trau/osmo_ortp.h>
#include <codec_bit_class.h>
struct app_state {
struct osmo_rtp_socket *rs;
enum {
WAIT_CONN = 0, /* Wait for incoming connection */
WAIT_LOOP, /* Wait for a somewhat valid packet to start measuring */
RUNNING, /* Main state */
} state;
int pt;
int ref_len;
uint8_t ref_bytes[GSM_FR_BYTES]; /* FR is the largest possible one */
ubit_t ref_bits[8*GSM_FR_BYTES];
struct osmo_timer_list rtp_timer;
uint16_t rx_last_seq;
uint32_t rx_last_ts;
uint32_t rx_idx;
uint32_t tx_idx;
const int *err_tbl; /* Classification table */
int err_frames; /* Number of accumulated frames */
int err_cnt[3]; /* Bit error counter */
int err_tot[3]; /* Total # bits in that class */
};
#define FLOW_REG_TX_MAX_ADVANCE 200
#define FLOW_REG_TX_MIN_ADVANCE 50
const struct log_info log_info;
static const uint8_t amr_size_by_ft[] = {
[0] = 12, /* 4.75 */
[1] = 13, /* 5.15 */
[2] = 15, /* 5.9 */
[3] = 17, /* 6.7 */
[4] = 19, /* 7.4 */
[5] = 20, /* 7.95 */
[6] = 26, /* 10.2 */
[7] = 31, /* 12.2 */
[8] = 5, /* SID */
};
static const char * const amr_rate_by_ft[] = {
[0] = "4.75",
[1] = "5.15",
[2] = "5.9",
[3] = "6.7",
[4] = "7.4",
[5] = "7.95",
[6] = "10.2",
[7] = "12.2",
[8] = "SID",
};
static void
_gsm_fr_gen_ref(struct app_state *as)
{
struct osmo_prbs_state pn9;
/* Length */
as->ref_len = GSM_FR_BYTES;
/* Marker */
as->ref_bits[0] = 1;
as->ref_bits[1] = 1;
as->ref_bits[2] = 0;
as->ref_bits[3] = 1;
/* PN */
osmo_prbs_state_init(&pn9, &osmo_prbs9);
pn9.state = 31;
osmo_prbs_get_ubits(&as->ref_bits[4], 260, &pn9);
/* Convert to bytes */
osmo_ubit2pbit_ext(as->ref_bytes, 0, as->ref_bits, 0, 8*GSM_FR_BYTES, 0);
/* Init error classes */
as->err_tot[0] = 50;
as->err_tot[1] = 132;
as->err_tot[2] = 78;
as->err_tbl = gsm_fr_bitclass;
}
static void
_gsm_efr_gen_ref(struct app_state *as)
{
struct osmo_prbs_state pn9;
/* Length */
as->ref_len = GSM_EFR_BYTES;
/* Marker */
as->ref_bits[0] = 1;
as->ref_bits[1] = 1;
as->ref_bits[2] = 0;
as->ref_bits[3] = 0;
/* PN */
osmo_prbs_state_init(&pn9, &osmo_prbs9);
pn9.state = 31;
osmo_prbs_get_ubits(&as->ref_bits[4], 244, &pn9);
/* Convert to bytes */
osmo_ubit2pbit_ext(as->ref_bytes, 0, as->ref_bits, 0, 8*GSM_EFR_BYTES, 0);
/* Init error classes */
as->err_tot[0] = 50;
as->err_tot[1] = 125;
as->err_tot[2] = 73;
as->err_tbl = gsm_efr_bitclass;
}
static void
_gsm_amr_gen_ref(struct app_state *as)
{
struct osmo_prbs_state pn9;
uint8_t hdr[2];
/* Length */
as->ref_len = 33;
/* Header */
hdr[0] = 0x70;
hdr[1] = 0x3c;
osmo_pbit2ubit_ext(as->ref_bits, 0, hdr, 0, 16, 0);
/* PN */
osmo_prbs_state_init(&pn9, &osmo_prbs9);
pn9.state = 31;
osmo_prbs_get_ubits(&as->ref_bits[16], 244, &pn9);
/* Unused bits */
as->ref_bits[260] = 0;
as->ref_bits[261] = 0;
as->ref_bits[262] = 0;
as->ref_bits[263] = 0;
/* Convert to bytes */
osmo_ubit2pbit_ext(as->ref_bytes, 0, as->ref_bits, 0, 264, 0);
/* Init error classes */
as->err_tot[0] = 81;
as->err_tot[1] = 163;
as->err_tot[2] = -1;
as->err_tbl = gsm_amr_12_2_bitclass;
}
static void
_gsm_gen_ref(struct app_state *as)
{
switch (as->pt) {
case RTP_PT_GSM_FULL:
_gsm_fr_gen_ref(as);
break;
case RTP_PT_GSM_EFR:
_gsm_efr_gen_ref(as);
break;
case RTP_PT_AMR:
_gsm_amr_gen_ref(as);
break;
default:
fprintf(stderr, "[!] Unsupported payload type for BER measurement\n");
}
}
static int
_gsm_ber(struct app_state *as, const uint8_t *payload, unsigned int payload_len)
{
ubit_t rx_bits[8*33];
int err[3]; /* Class 1a, 1b, 2 */
int ones;
int i, j;
if (payload) {
/* Process real-payload */
osmo_pbit2ubit_ext(rx_bits, 0, payload, 0, 8*payload_len, 0);
err[0] = err[1] = err[2] = 0;
ones = 0;
for (i = 0; i < 8 * payload_len; i++) {
j = as->err_tbl[i];
if (j >= 0) {
err[j] += rx_bits[i] ^ as->ref_bits[i];
ones += rx_bits[i];
}
}
if (ones < 32) { // This frames is probably us underrunning Tx, don't use it
fprintf(stderr, "[w] Frame ignored as probably TX underrun %d %d\n", as->tx_idx, as->rx_idx);
return 1;
}
} else {
/* No payload -> Lost frame completely */
err[0] = as->err_tot[0] / 2;
err[1] = as->err_tot[1] / 2;
err[2] = as->err_tot[2] / 2;
}
if (as->state == RUNNING) {
/* Update records */
if (err[0] != 0) {
/* Class 1a bits bad -> Frame error */
as->err_cnt[0]++;
}
as->err_cnt[1] += err[1]; /* Class 1b */
as->err_cnt[2] += err[2]; /* class 2 */
as->err_frames++;
/* Enough for a read-out ? */
if (as->err_frames == 200) {
printf("FBER: %4.2f C1b RBER: %5.3f C2 RBER: %5.3f\n",
100.0f * as->err_cnt[0] / as->err_frames,
100.0f * as->err_cnt[1] / (as->err_tot[1] * as->err_frames),
100.0f * as->err_cnt[2] / (as->err_tot[2] * as->err_frames)
);
memset(as->err_cnt, 0, sizeof(as->err_cnt));
as->err_frames = 0;
}
}
return err[0] != 0;
}
static int
_rtp_check_payload_type(const uint8_t *payload, unsigned int payload_len)
{
uint8_t ft;
int pt = -1;
switch (payload_len) {
case GSM_FR_BYTES: /* FR or AMR 12.2k */
/* Check for AMR */
ft = (payload[1] >> 3) & 0xf;
if (ft == 7)
pt = RTP_PT_AMR;
/* Check for FR */
else if ((payload[0] & 0xF0) == 0xD0)
pt = RTP_PT_GSM_FULL;
/* None of the above */
else
fprintf(stderr, "[!] FR without 0xD0 signature or AMR with unknwon Frame Type ?!?\n");
break;
case GSM_EFR_BYTES: /* EFR */
if ((payload[0] & 0xF0) != 0xC0)
fprintf(stderr, "[!] EFR without 0xC0 signature ?!?\n");
pt = RTP_PT_GSM_EFR;
break;
case GSM_HR_BYTES: /* HR */
pt = RTP_PT_GSM_HALF;
break;
default: /* AMR */
{
uint8_t cmr, cmi, sti;
cmr = payload[0] >> 4;
ft = (payload[1] >> 3) & 0xf;
if (payload_len != amr_size_by_ft[ft]+2)
fprintf(stderr, "AMR FT %u(%s) but size %u\n",
ft, amr_rate_by_ft[ft], payload_len);
switch (ft) {
case 0: case 1: case 2: case 3:
case 4: case 5: case 6: case 7:
cmi = ft;
printf("AMR SPEECH with FT/CMI %u(%s), "
"CMR %u\n",
cmi, amr_rate_by_ft[cmi],
cmr);
break;
case 8: /* SID */
cmi = (payload[2+4] >> 1) & 0x7;
sti = payload[2+4] & 0x10;
printf("AMR SID %s with CMI %u(%s), CMR %u(%s)\n",
sti ? "UPDATE" : "FIRST",
cmi, amr_rate_by_ft[cmi],
cmr, amr_rate_by_ft[cmr]);
break;
}
}
break;
}
return pt;
}
static void
rtp_timer_cb(void *priv)
{
struct app_state *as = (struct app_state *)priv;
/* Send at least one frame if we're not too far ahead */
if (as->tx_idx < (as->rx_idx + FLOW_REG_TX_MAX_ADVANCE)) {
osmo_rtp_send_frame(as->rs, as->ref_bytes, as->ref_len, GSM_RTP_DURATION);
as->tx_idx++;
} else {
fprintf(stderr, "Skipped\n");
}
/* Then maybe a second one to try and catch up to RX */
if (as->tx_idx < (as->rx_idx + FLOW_REG_TX_MIN_ADVANCE)) {
osmo_rtp_send_frame(as->rs, as->ref_bytes, as->ref_len, GSM_RTP_DURATION);
as->tx_idx++;
}
/* Re-schedule */
osmo_timer_schedule(&as->rtp_timer, 0, 20000);
}
static int
rtp_seq_num_diff(uint16_t new, uint16_t old)
{
int d = (int)new - (int)old;
while (d > 49152)
d -= 65536;
while (d < -49152)
d += 65536;
return d;
}
static void
rtp_rx_cb(struct osmo_rtp_socket *rs,
const uint8_t *payload, unsigned int payload_len,
uint16_t seq_number, uint32_t timestamp, bool marker)
{
struct app_state *as = (struct app_state *)rs->priv;
int pt, rc, d;
// printf("Rx(%u, %d, %d, %d): %s\n", payload_len, seq_number, timestamp, marker, osmo_hexdump(payload, payload_len));
/* Identify payload */
pt = _rtp_check_payload_type(payload, payload_len);
/* First packet ? */
if (as->state == WAIT_CONN) {
/* Setup for this payload type */
as->pt = pt;
osmo_rtp_socket_set_pt(as->rs, pt);
_gsm_gen_ref(as);
/* Timer every 20 ms */
osmo_timer_setup(&as->rtp_timer, rtp_timer_cb, as);
osmo_timer_add(&as->rtp_timer);
osmo_timer_schedule(&as->rtp_timer, 0, 20000);
/* Init our time tracking */
as->rx_last_seq = seq_number;
as->rx_last_ts = timestamp;
/* Now we wait for a loop */
as->state = WAIT_LOOP;
}
/* RX sequence & timstamp tracking */
if (rtp_seq_num_diff(seq_number, as->rx_last_seq) > 1)
fprintf(stderr, "[!] RTP sequence number discontinuity (%d -> %d)\n", as->rx_last_seq, seq_number);
d = (timestamp - as->rx_last_ts) / GSM_RTP_DURATION;
as->rx_idx += d;
as->rx_last_seq = seq_number;
as->rx_last_ts = timestamp;
/* Account for missing frames in BER tracking */
if (d > 1) {
fprintf(stderr, "[!] RTP %d missing frames assumed lost @%d\n", d-1, seq_number);
while (--d)
_gsm_ber(as, NULL, 0);
}
/* BER analysis */
rc = _gsm_ber(as, payload, payload_len);
if ((as->state == WAIT_LOOP) && (rc == 0))
as->state = RUNNING;
}
int main(int argc, char **argv)
{
struct app_state _as, *as = &_as;
int rc, port;
/* Args */
if (argc < 2)
return -1;
port = atoi(argv[1]);
/* App init */
memset(as, 0x00, sizeof(struct app_state));
log_init(&log_info, NULL);
osmo_rtp_init(NULL);
/* Start auto-connect RTP socket */
as->rs = osmo_rtp_socket_create(NULL, 0);
as->rs->priv = as;
as->rs->rx_cb = rtp_rx_cb;
/* Jitter buffer gets in the way, we want the raw traffic */
osmo_rtp_socket_set_param(as->rs, OSMO_RTP_P_JIT_ADAP, 0);
osmo_rtp_socket_set_param(as->rs, OSMO_RTP_P_JITBUF, 0);
/* Bind to requested port */
fprintf(stderr, "[+] Binding RTP socket on port %u...\n", port);
rc = osmo_rtp_socket_bind(as->rs, "0.0.0.0", port);
if (rc < 0) {
fprintf(stderr, "[!] error binding RTP socket: %d\n", rc);
return rc;
}
/* We 'connect' to the first source we hear from */
osmo_rtp_socket_autoconnect(as->rs);
/* Main loop */
while (1)
osmo_select_main(0);
return 0;
}

145
contrib/ber/rtp_gen_map.c Normal file
View File

@ -0,0 +1,145 @@
/* utility to generate codec_bit_class.h, a file with structures
* describing which [protection] class each bit of a given codec frame belongs to */
/* (C) 2019 sysmocom - s.f.m.c. GmbH; Author: Sylvain Munaut
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <osmocom/codec/codec.h>
static int
gen_table_fr(int *tbl)
{
int i, j;
tbl[0] = tbl[1] = tbl[2] = tbl[3] = -1;
for (i = 0; i < 260; i++) {
j = 4 + gsm610_bitorder[i];
if (i < 50)
tbl[j] = 0; /* Class 1a */
else if (i < 182)
tbl[j] = 1; /* Class 1b */
else
tbl[j] = 2; /* Class 2 */
}
return GSM_FR_BYTES * 8;
}
static int
gen_table_efr(int *tbl)
{
int i, j, k;
tbl[0] = tbl[1] = tbl[2] = tbl[3] = -1;
for (i = 0; i < 260; i++) {
j = gsm660_bitorder[i];
if (j < 71)
k = j;
else if (j < 73)
k = 71;
else if (j < 123)
k = j - 2;
else if (j < 125)
k = 119;
else if (j < 178)
k = j - 4;
else if (j < 180)
k = 172;
else if (j < 230)
k = j - 6;
else if (j < 232)
k = 222;
else if (j < 252)
k = j - 8;
else
continue;
if (i < 50)
tbl[k] = 0; /* Class 1a */
else if (i < 182)
tbl[k] = 1; /* Class 1b */
else
tbl[k] = 2; /* Class 2 */
}
return GSM_EFR_BYTES * 8;
}
static int
gen_table_amr_12_2(int *tbl)
{
int i;
for (i = 0; i < 16; i++)
tbl[i] = -1;
for (i = 0; i < 244; i++)
tbl[i+16] = i < 81 ? 0 : 1;
for (i = 0; i < 4; i++)
tbl[i+16+244] = -1;
return 8 * 33;
}
static void
print_table(const char *name, int *tbl, int len)
{
int i;
printf("static const int %s[] = {\n", name);
for (i = 0; i < len; i++) {
if ((i & 15) == 0)
printf("\t");
printf("%2d", tbl[i]);
if (((i & 15) == 15) || (i == len-1))
printf(",\n");
else
printf(", ");
}
printf("};\n\n");
}
int main(int argc, char *argv[])
{
int tbl[33*8];
int rv;
rv = gen_table_fr(tbl);
print_table("gsm_fr_bitclass", tbl, rv);
rv = gen_table_efr(tbl);
print_table("gsm_efr_bitclass", tbl, rv);
rv = gen_table_amr_12_2(tbl);
print_table("gsm_amr_12_2_bitclass", tbl, rv);
return 0;
}

View File

@ -9,7 +9,8 @@ export LD_LIBRARY_PATH="$inst/lib"
osmo-build-dep.sh libosmocore "" --disable-doxygen
osmo-build-dep.sh libosmo-abis
osmo-build-dep.sh libosmo-abis "" --disable-dahdi
osmo-build-dep.sh libosmo-netif "" --disable-doxygen
cd "$deps"
@ -17,6 +18,7 @@ configure_flags="\
--enable-sanitize \
--enable-werror \
--enable-trx \
--enable-external-tests \
"
build_bts "osmo-bts-trx" "$configure_flags"

View File

@ -9,7 +9,8 @@ osmo-build-dep.sh libosmocore "" --disable-doxygen
export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$inst/lib"
osmo-build-dep.sh libosmo-abis
osmo-build-dep.sh libosmo-abis "" --disable-dahdi
osmo-build-dep.sh libosmo-netif "" --disable-doxygen
cd "$deps"
osmo-layer1-headers.sh lc15 "$FIRMWARE_VERSION"

View File

@ -9,7 +9,8 @@ osmo-build-dep.sh libosmocore "" --disable-doxygen
export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$inst/lib"
osmo-build-dep.sh libosmo-abis
osmo-build-dep.sh libosmo-abis "" --disable-dahdi
osmo-build-dep.sh libosmo-netif "" --disable-doxygen
cd "$deps"
osmo-layer1-headers.sh oc2g "$FIRMWARE_VERSION"

View File

@ -9,7 +9,8 @@ osmo-build-dep.sh libosmocore "" --disable-doxygen
export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$inst/lib"
osmo-build-dep.sh libosmo-abis
osmo-build-dep.sh libosmo-abis "" --disable-dahdi
osmo-build-dep.sh libosmo-netif "" --disable-doxygen
cd "$deps"
osmo-layer1-headers.sh oct "$FIRMWARE_VERSION"

View File

@ -9,7 +9,8 @@ export LD_LIBRARY_PATH="$inst/lib"
osmo-build-dep.sh libosmocore "" --disable-doxygen
osmo-build-dep.sh libosmo-abis
osmo-build-dep.sh libosmo-abis "" --disable-dahdi
osmo-build-dep.sh libosmo-netif "" --disable-doxygen
cd "$deps"
@ -20,6 +21,7 @@ configure_flags="\
--with-octsdr-2g=$deps/layer1-headers/ \
--enable-octphy \
--enable-trx \
--enable-external-tests \
"
build_bts "osmo-bts-octphy+trx" "$configure_flags"

View File

@ -9,7 +9,8 @@ osmo-build-dep.sh libosmocore "" --disable-doxygen
export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$inst/lib"
osmo-build-dep.sh libosmo-abis
osmo-build-dep.sh libosmo-abis "" --disable-dahdi
osmo-build-dep.sh libosmo-netif "" --disable-doxygen
cd "$deps"
osmo-layer1-headers.sh sysmo "$FIRMWARE_VERSION"
@ -21,6 +22,7 @@ configure_flags="\
--enable-werror \
--enable-sysmocom-bts \
--with-sysmobts=$inst/include/ \
--enable-external-tests \
"
# This will not work for the femtobts

View File

@ -27,16 +27,15 @@ BuildRequires: pkgconfig >= 0.20
%if 0%{?suse_version}
BuildRequires: systemd-rpm-macros
%endif
BuildRequires: pkgconfig(libosmoabis) >= 1.1.0
BuildRequires: pkgconfig(libosmocodec) >= 1.5.0
BuildRequires: pkgconfig(libosmocoding) >= 1.5.0
BuildRequires: pkgconfig(libosmocore) >= 1.5.0
BuildRequires: pkgconfig(libosmoctrl) >= 1.5.0
BuildRequires: pkgconfig(libosmogsm) >= 1.5.0
BuildRequires: pkgconfig(libosmotrau) >= 1.1.0
BuildRequires: pkgconfig(libosmovty) >= 1.5.0
### FIXME: DependencyHACK to include osmocom/gprs/protocol/gsm_04_60.h
BuildRequires: pkgconfig(libosmogb)
BuildRequires: pkgconfig(libosmocodec) >= 1.9.0
BuildRequires: pkgconfig(libosmocoding) >= 1.9.0
BuildRequires: pkgconfig(libosmocore) >= 1.9.0
BuildRequires: pkgconfig(libosmoctrl) >= 1.9.0
BuildRequires: pkgconfig(libosmogsm) >= 1.9.0
BuildRequires: pkgconfig(libosmovty) >= 1.9.0
BuildRequires: pkgconfig(libosmoabis) >= 1.5.0
BuildRequires: pkgconfig(libosmotrau) >= 1.5.0
BuildRequires: pkgconfig(libosmo-netif) >= 1.4.0
%{?systemd_requires}
%description

View File

@ -2,11 +2,15 @@
Description=osmo-bts manager for LC15 / sysmoBTS 2100
After=lc15-sysdev-remap.service
Wants=lc15-sysdev-remap.service
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
NotifyAccess=all
WatchdogSec=21780s
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2

View File

@ -2,11 +2,15 @@
Description=osmo-bts manager for OC-2G
After=oc2g-sysdev-remap.service
Wants=oc2g-sysdev-remap.service
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
NotifyAccess=all
WatchdogSec=21780s
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2

View File

@ -1,17 +1,22 @@
[Unit]
Description=osmo-bts for LC15 / sysmoBTS 2100
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/osmo-bts-lc15 -t 2 -s -c /etc/osmocom/osmo-bts-lc15.cfg -M
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
RuntimeDirectory=osmo-bts
Restart=always
RestartSec=2
RestartPreventExitStatus=1
# The msg queues must be read fast enough
# CPU scheduling policy:
CPUSchedulingPolicy=rr
CPUSchedulingPriority=1
# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):
CPUSchedulingPriority=11
# See sched(7) for further details on real-time policies and priorities
[Install]
WantedBy=multi-user.target

View File

@ -1,17 +1,22 @@
[Unit]
Description=osmo-bts for OC-2G
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/osmo-bts-oc2g -s -c /etc/osmocom/osmo-bts-oc2g.cfg -M
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
RuntimeDirectory=osmo-bts
Restart=always
RestartSec=2
RestartPreventExitStatus=1
# The msg queues must be read fast enough
# CPU scheduling policy:
CPUSchedulingPolicy=rr
CPUSchedulingPriority=1
# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):
CPUSchedulingPriority=11
# See sched(7) for further details on real-time policies and priorities
[Install]
WantedBy=multi-user.target

View File

@ -1,5 +1,7 @@
[Unit]
Description=osmo-bts for sysmocom sysmoBTS
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
@ -7,13 +9,16 @@ ExecStartPre=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness'
ExecStart=/usr/bin/osmo-bts-sysmo -s -c /etc/osmocom/osmo-bts-sysmo.cfg -M
ExecStopPost=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness'
ExecStopPost=/bin/sh -c 'cat /lib/firmware/sysmobts-v?.bit > /dev/fpgadl_par0 ; sleep 3s; cat /lib/firmware/sysmobts-v?.out > /dev/dspdl_dm644x_0; sleep 1s'
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2
RestartPreventExitStatus=1
# The msg queues must be read fast enough
# CPU scheduling policy:
CPUSchedulingPolicy=rr
CPUSchedulingPriority=1
# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):
CPUSchedulingPriority=20
# See sched(7) for further details on real-time policies and priorities
[Install]
WantedBy=multi-user.target

View File

@ -1,15 +1,21 @@
[Unit]
Description=Osmocom osmo-bts for osmo-trx
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/osmo-bts-trx -s -c /etc/osmocom/osmo-bts-trx.cfg
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2
# Let it process messages quickly enough
# CPU scheduling policy:
CPUSchedulingPolicy=rr
CPUSchedulingPriority=1
# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):
CPUSchedulingPriority=11
# See sched(7) for further details on real-time policies and priorities
[Install]
WantedBy=multi-user.target

View File

@ -1,15 +1,21 @@
[Unit]
Description=Osmocom GSM BTS for virtual Um layer based on GSMTAP/UDP
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/osmo-bts-virtual -s -c /etc/osmocom/osmo-bts-virtual.cfg
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2
# Let it process messages quickly enough
# CPU scheduling policy:
CPUSchedulingPolicy=rr
CPUSchedulingPriority=1
# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):
CPUSchedulingPriority=11
# See sched(7) for further details on real-time policies and priorities
[Install]
WantedBy=multi-user.target

View File

@ -1,9 +1,13 @@
[Unit]
Description=osmo-bts manager for sysmoBTS
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/sysmobts-mgr -ns -c /etc/osmocom/sysmobts-mgr.cfg
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2

813
debian/changelog vendored
View File

@ -1,3 +1,816 @@
osmo-bts (1.7.0) unstable; urgency=medium
[ arehbein ]
* common: Fix memleak in get_smscb_block()
* doc: Adapt to use of 'telnet_init_default'
* common: Remove redundant checks
* common: Remove unused function gsm_objclass2nmstate()
* gsm_objclass2mo(): Change signature/set NACK cause
* gsm_objclass2obj(): Change signature/set NACK cause
* PCU interface: Log version when starting listener
* common: Have PCU socket connection use osmo_wqueue
* common: Make socket queue max. length configurable
[ Max ]
* bts-virtual: fix segfault
* osmo-bts-trx: log TRXC/TRXD connection address
* osmo-bts-trx: use bool for true/false flags
* GSMTAP: allow configuring local address
* license: fix typos
[ Vadim Yanitskiy ]
* paging_add_imm_ass(): remove meaningless from_pcu argument
* osmo-bts-{trx,virtual}: clean up bts_model_l1sap_down()
* osmo-bts-{trx,virtual}: check lchan against NULL in bts_model_l1sap_down()
* osmo-bts-{trx,virtual}: set rc on error in bts_model_l1sap_down()
* GSMTAP: print 'gsmtap-local-host' if not NULL
* osmo-bts-virtual: indicate BTS_FEAT_[E]GPRS to the BSC
* rsl: remove redundant gsm_lchan_name() in rsl_tx_rf_rel_ack()
* rsl: reduce logging verbosity on some messages
* tests: use -no-install libtool flag to avoid ./lt-* scripts
* scheduler: log pchan value in trx_sched_set_pchan()
* osmo-bts-virtual: properly handle dynamic TS in vbts_set_ts()
* contrib/osmo-bts.spec.in: do not depend on libosmogb
* osmo-bts-trx: properly activate [CBCH/]BCCH/CCCH
* rsl: rsl_handle_chan_mod_ie(): add missing GSM48_CMODE_* values
* osmo-bts-{sysmo,lc15,oc2g}: fix segfault in ph_tch_req()
* tests: $(BUILT_SOURCES) is not defined, depend on osmo-bts-virtual
* osmo-bts-virtual: properly activate [CBCH/]BCCH/CCCH
* flags: add missing entries to bts_impl_flag_desc[]
* flags: group BTS_INTERNAL_FLAG_* into an enum
* flags: ensure completeness of bts_impl_flag_desc[]
* fixup: common: Remove unused function gsm_objclass2nmstate()
* oml: gsm_objclass2{mo,obj}(): cosmetic: return immediately
* oml: gsm_objclass2{mo,obj}(): set cause for unknown obj_class
* oml: reset BCCH carrier power reduction mode (if enabled)
* copyright: fix typo: sysmocom s/s.m.f.c./s.f.m.c./ GmbH
* osmo-bts-trx: alloc/free burst buffers in trx_sched_set_lchan()
* osmo-bts-trx: use direct pointer to chan_state->{ul,dl}_bursts
* osmo-bts-trx: tch_dl_dequeue(): do not drop CSD frames
* osmo-bts-trx: tx_pdtch_fn(): use msgb_l2len()
* osmo-bts-trx: fix recent regression in Tx lchan handlers
* osmo-bts-trx: remove redundant memset() on receipt of NOPE.ind
* l1sap: use gsm0502_fn2ccch_block() from libosmogsm
* scheduler: fix wrong union field in _sched_compose_tch_ind()
* scheduler: use msgb_hexdump_l2() in _sched_compose_tch_ind()
* scheduler: unify argument names/order for _sched_compose_*_ind()
* scheduler: constify *data pointer in _sched_compose_*_ind()
* scheduler: use size_t for data_len in _sched_compose_*_ind()
* fix bts_supports_cm(): properly check feature flags for VGCS/VBS
* measurement: suppress unsupported tch_mode warnings for CSD
* osmo-bts-trx: pull the AMR header in tch_dl_dequeue()
* osmo-bts-trx: implement CSD scheduling support
* osmo-bts-trx: implement FACCH/[FH] support for CSD
* osmo-bts-trx: implement TCH/F2.4 support for CSD
* osmo-bts-trx: visualize rx_tch[fh]_fn() functions
* osmo-bts-trx: unify and enrich 'Received bad data' logging
* osmo-bts-trx: rx_tchf_fn(): move compute_ber10k() above
* osmo-bts-trx: rx_tch[fh]_fn(): combine rc-checking ifs
* osmo-bts-trx: change 'Received bad data' back to LOGL_DEBUG
* osmo-bts-trx: tx_tch[fh]_fn(): fix NULL pointer dereference
* osmo-bts-trx: document/clarify the meaning of BUFMAX=24
* l1sap: proper rate adaptation for CSD (RFC4040 'clearmode')
* csd_v110_rtp_encode(): properly set E1/E2/E3 bits
* osmo-bts-trx: bts_supports_cm_data(): allow non-transparent modes
* rsl: rsl_handle_chan_mod_ie(): set lchan->csd_mode
* rsl: rsl_handle_chan_mod_ie(): do not use legacy defines
* csd_v110: fix comments in csd_v110_rtp_{en,de}code()
* csd_v110: properly set E1/E2/E3 for non-transparent data
* csd_v110: handle empty/incomplete Uplink frames gracefully
[ Philipp Maier ]
* pcu_sock: rename rc to fd
* pcu_sock: cosmetic: remove whitespace after type cast
* pcu_sock: cosmetic: remove unnecessary line breaks
* pcu_sock: do not mess with the osmo fd flags directly
* sched_lchan_tchx: use GSM_HR_BYTES_RTP_RFC5993 constant
* l1sap: fix wording in comment
* pcu_sock: don not continue when running out of TRX space
* paging: cosmetic: rename all IMM.ASS references to MAC block
* paging: parse PCUIF data indication outside of paging.c
* paging: do not confirm PAGING COMMAND messages
* pcu_sock: move variable declaration of imsi[4] into related scope
* l1sap: cosmetic: rename payload_len to rtp_pl_len
* pcu_sock: use PCUIF version 11 (direct TLLI)
* paging: also accept zero length IMSI strings 3
* pcuif_proto: rename tlli to msg_id
* pcu_sock: get rid of fn parameter in pcu_tx_pch_data_cnf
* pcuif_proto: remove unnecessary members from gsm_pcu_if_data_cnf_dt
* pcuif_proto: get rid of _DT, _dt (Direct TLLI)
* bts: make bts_agch_dequeue static
* pcuif_proto: use confirm flag in struct gsm_pcu_if_pch
* pcu_sock: use PCU_IF_SAPI_AGCH_2 instead PCU_IF_SAPI_AGCH
* pcu_sock: print SAPI and msg_id when sending confirmation
[ Pau Espin Pedrol ]
* bts-trx: Fix no NM Radio{Carrier,Channel} switching to Enabled if one TRX is rf_locked
* pcu_sock: Submit all DATA.ind regardless of link quality
* pcu_sock.c: Call osmo_fd_unregister() before closing and changing bfd->fd
* Rewrite pcu_sock_write()
* lchan: Improve error path logging in gsm_pchan2chan_nr()
* cosmetic: gsm_pchan2chan_nr(): Update spec documentation
* cosmetic: bts_trx.h: Fix whitespace
* Avoid tx RF Resource Ind for disabled TRX
* bts-trx: Avoid pushing interf_meas for disabled TRX
* contrib/ber: Avoid regenerating codec_bit_class.h every build
* bts-trx: Drop unused param to internal function
* Clarify configuration of TSC on each timeslot
* bts_model_apply_oml(): Drop unneded code
* oml.c: Remove dot character at the end of log lines
* nm: Apply BTS/TRX/TS OML Attributes through NM FSMs
* nm: Drop NM_EV_SETATTR_{ACK/NACK}
* oml: Get rid of unused tlv_parsed param in bts_model_apply_oml()
* bts_model_apply_oml(): Improve definition of parameter
* lc15,oc2g,sysmo: Update GPRS NM object state at the right time
* Simplify implementation of bts_model_opstart() in all bts types
* nm: Apply OPSTART through NM FSMs
* NM: NACK received OML OPSTART if no attributes were set beforehand
* Introduce NM FSM for GPRS NSE object
* Fix octet 2 of NM GPRS Cell
* Introduce NM FSM for GPRS Cell object
* Rearrange declaration of struct gsm_bts_gprs_nsvc
* Move NSVC structs to be part of NSE
* bts: Simplify lifecycle of BTS inside bts_list
* Introduce NM FSM for GPRS NSVC object
* nm: Dispatch NM_EV_SW_ACT in cascade to BTS SiteMgr children
* Merge gsm_network into gsm_bts_sm and place gsm_bts under it
* Move GPRS NSE under BTS SiteMgr
* Drop NM_EV_BBTRANSC_INSTALLED in favour of generic NM_EV_SW_ACT
* nm: Document current state of SW_ACT in TRX related objects
* Properly report all states through NM FSM upon OML link up
* Update g_bts_sm->num_bts when bts is added/removed from bts list
* Move pcu_sock_state to gprs section of bts_sm
* pcu_sock: Allocate pcu_sock_state using g_bts_sm talloc context
* pcu_sock: Drop bts_sm pointer
* oml: Fix potential null ptr access on trx object
* bts-sysmo: Fix pinst->version filled too early
* bts-sysmo: Delay marking phy_link as connected until L1 reset + got info
* vty.c: Use already available tpp pointer
* octphy: Fix clearly wrong noop assignment
* bbtransc/rcarrier: Fix statechg done twice upon NM_EV_RX_OPSTART
* Increase PCUIF wqueue size
* bts-trx: Fix CCCH not enabled if BS_AG_BLKS_RES!=1 is provided by BSC
* rsl: Improve logic reactivating CCCH upon SI3 BS_AG_BLKS_RES change
[ Oliver Smith ]
* gitignore: add vty pdf
* doc: rsl: add RSL_IE_IPAC_RTP_CSD_FORMAT
* rsl_rx_ipac_XXcx: parse csd_fmt_d/ir
* debian: set compat level to 10
* systemd: depend on networking-online.target
* gitignore: add arm-poky-linux-gnueabi-libtool
* osmo-bts-sysmo: trx_mute_on_init_cb: call bts_update_status
* osmo-bts-sysmo: activate_rf: no dispatch on fail
* osmo-bts-sysmo/l1_if: move mute_rf_compl_cb up
* osmo-bts-sysmo: mute PHY until OML is ready
[ Harald Welte ]
* DTX: bts-{sysmo,oc2g,lc15}: Print DEBUG messages about ONSET
* cosmetic: Replace %i with %d
* Introduce LOGPLCFN() for logging lchan-name + frame number
* bts-{sysmo,oc2g,lc15}: Fix RTP of AMR SID_FIRST_P1
* common/vty: Print AMR MultiRate Configuration in "show lchan"
* bts-{sysmo,oc2g,lc15}: Dump logical channel params during MPH-ACTIVATE.req
* cosmetic: use __func__ instead of __FUNCTION__
* lc15: fix compiler warning about wrong indent
* lc15: Remove unused warning
* lc15/oc2g: remove unused variables
* oc2g: Fix 'unused variable' compiler warning
* cosmetic: Remove "FIXME?" from Odd AMR CMI phase
* lc15: fix compiler warning about unused variable cell_size
* Replace explicit gsm_lchan_name() calls with LOGPLCHAN
* logging: Introduce LOGPLCGT()
* cosmetic: Change LOGPLCFN argument order
* paging: Add support for generating NLN/NLN-Status in P1 Rest Octets
* Add ASCI (advanced speech call items) log sub-system
* ASCI: NCH / NOTIFICATION support
* validate RSL "channel rate and type" against VGCS/VBS flags
* Store "Channel rate and type" from RSL Channel Mode IE in BTS
* ASCI: VGCS/VBS RACH -> RSL TALKER/LISTENER DETECT
* sysmo: Enable VGSCS + VBS feature flags
* omldummy: Claim to support VBS + VGCS towards BSC
[ Mychaela N. Falconia ]
* trx: detect UL SID in EFR just like in FR
* sysmo: fix handling of SID in EFR
* common: implement rtp continuous-streaming mode
* rtp continuous-streaming: fix BFI in the quality-suppressed case
* sysmo: emit empty RTP ticks during FACCH stealing on TCH/F
* bts-{lc15,oc2g,sysmo}: support EFR in repeat_last_sid()
* RTP input, FR & EFR: preen incoming payloads for SID errors
* lc15,oc2g: fix handling of SID in EFR
* all models, FR/EFR UL: change SID check to _is_any_sid()
* trx: remove model-specific BFI packet formats
* refactor: replace rtppayload_is_valid() with preening before enqueue
* all models, HR1 codec: accept both TS101318 and RFC5993 formats
* trx: fix HR1 codec breakage from format change
* trx, HR1 codec: change UL PHY output format to TS 101 318
* all models, HR1 codec: select RTP output format via vty option
* FR/HR/EFR TCH DL: implement DTX rules
* HR1 codec: validate ToC header in RFC5993 RTP input
* HR1 codec: act on SID indication in RFC5993 RTP input
* trx TCH DL: transmit invalid speech blocks instead of dummy FACCH
* ECU in UL path: make it optional per vty config
* ECU in UL path: move state alloc/free to l1sap
* ECU in UL path: move it from trx model to l1sap
[ Sylvain Munaut ]
* contrib: Add BER testing tool
[ Andreas Eversberg ]
* Change return value of bts_supports_cm() from int to bool
* ASCI: Add function to reactivate channel
* ASCI: Retrieve NCH position from System Information 1
* ASCI: Add Notification CHannel (NCH) support
* ASCI: Add support for rest octets in Paging request type 2 and 3
* ASCI: Send only NLN on Paging request type 1 rest octets
* ASCI: Add Notification/FACCH support
* ASCI: Repeat UPLINK FREE message until uplink becomes busy
* Add test cases for rest octets of Paging Requests
* ASCI: Enable UPLINK ACCESS on various BTS models
[ Keith ]
* Fix incorrect order of params passed to logging macro
-- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 12 Sep 2023 16:05:30 +0200
osmo-bts (1.6.0) unstable; urgency=medium
[ Vadim Yanitskiy ]
* osmo-bts-trx: call osmo_timer_del() unconditionally
* osmo-bts-trx: amr_loop: trigger the loop unconditionally
* osmo-bts-trx: fix handling of ciphering params in PRIM_INFO_MODIFY
* osmo-bts-trx: rx_rach_fn(): properly detect handover RACH
* osmo-bts-trx: handle MTS 0b0110 indicating an Access Burst
* osmo-bts-trx: use lookup tables for checking AMR CMI/CMR on Downlink
* osmo-bts-trx: drop ul_amr_fn_is_cmi() / dl_amr_fn_is_cmi()
[ Pau Espin Pedrol ]
* rsl: rx ipac crcx/mdcx: Log payload_type2
* logging: Move category descriptions to be in order with enum
* Clean up osmo-bts-*/Makefile.am
* Split out lchan rtp socket creation from rsl handling code
* Avoid counting lchan->dl_tch_queue length every time a msg is enqueued
* Use libosmocore API msgb_queue_free() to free lists
* rsl: Reduce scope of variable
* Move lchan_dl_tch_queue_enqueue to lchan.c and make it public
* cosmetic: Fix formatting of if-else block brackets
* Depend on libosmo-netif
* Clarify RTP AMR header offset in TCH enc/dec
* tests/*/Makefile.am: Fix typo in LIBOSMONETIF_CFLAGS
* tests/*/Makefile.am: Add missing libosmo-netif cflags
* oc2g: Makefile.am Fix typo in LIBOSMONETIF_LIBS
* Introduce Osmux support
* abis: Avoid TCP/IPA RSL sockets continue conn establishment while shutting down
* osmux: Log sendto() error
* lchan: Reset Abis RTP/Osmux config during lchan release
* vty: Fix SPEECH_MODE printed with hex prefix but dec value
* vty: Print Osmux CID on lchans using Osmux
* Allocate struct osmux_in_handle through new libosmo-netif APIs
* osmux: Drop logging of osmux internal counters
* osmux: Match remote address in osmux_lchan_find()
* osmux: Log remote address upon rx of osmux pkt
* osmux: Lower log level when osmux batch received for unknown CID
* osmux: nullify osmux.rtpst after freeing it
* osmux: Skip lchans in lookup which still have no remote associated
* osmux: Close osmux socket when bts is freed
* osmux: Fix null ptr dereference sending UL data before the remote is configured
* osmux: Rotate over available Osmux CID when allocating a new one
* osmux: Use new osmux_xfrm_input API to set name on each link
* vty: Fix typo in write-config: osmux / local-port
* vty: Fix typo in symbol name
[ Max ]
* Set working directory in systemd service file
* Don't manually create pid file
* Document realtime options in .service units
* Update realtime scheduling priority in service file
* ctrl: take both address and port from vty config
* Add SI10 support
[ Philipp Maier ]
* pcu_sock: fix sourcecode formatting
* measurement: do not call msgb_l3len without checking
* l1sap: do not call msgb_l2hlen without checking
* rsl: use unsigned int
* pcuif_proto: cosmetic: add constant PCU_IF_NUM_NSVC and replace magic numbers
* sched_lchan_tchf: replace numeric constant with define constant
* l1sap: remove unused pointer variable
* pcuif_proto: use define constant to specify nax number of trx
* pcu_sock: use ARRAY_SIZE rather then magic number
[ Keith ]
* osmo-bts-trx: respond to tx-attenuation config in real time.
[ Harald Welte ]
* update outdated vty copyright statement
[ Daniel Willmann ]
* shutdown_fsm: Only ramp down power when stopping bts through Ctrl-C
* shutdown_fsm: Add power_ramp_force() to jump straight to the tgt power
[ daniel ]
* Revert "shutdown_fsm: Only ramp down power when stopping bts through Ctrl-C"
[ Alexander Couzens ]
* OML: NSVC[1] MO should have the same initial state as NVSC[0]
[ Oliver Smith ]
* oc2gbts_mgr_calib: fix build against gpsd >= 3.20
* contrib/jenkins: build libosmo-abis without dahdi
[ arehbein ]
* osmo-bts: Transition to use of 'telnet_init_default'
-- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 07 Feb 2023 17:15:52 +0100
osmo-bts (1.5.0) unstable; urgency=medium
[ Pau Espin Pedrol ]
* bts_shutdown_fsm.h: Remove wrong comment describing enum
* bts: Properly free bts->shutdown_fi when struct gsm_bts is freed
* bts-trx: amr: Fix return code of osmo_amr_rtp_dec() checked too late
* Change some log levels NOTICE->INFO
* rsl: Conditionally decrease log level if cause is normal event
* bts-trx: Log lchan if avaialble in Meas Avg
* doc: rsl: Fix description of 'IP Connection Statistics' IE
* bts-trx: sched_lchan_tchh.c: Workaround gcc false positive error
* bts-sysmo: Replace use of deprecated ipa_client_conn_create API
[ Harald Welte ]
* cbch: Fix bts_smscb_state_reset() to avoid double-free
* cbch: Fix dangling cur_msg leading to double-free in bts_cbch_reset()
* [lc15,oc2g,octphy] Fix memory leak on write queue overflow
* update git URLs (git -> https; gitea)
[ Oliver Smith ]
* debian/control: add osmo-bts meta-package
* treewide: remove FSF address
* model_init: order features alphabetically
* model_init: set BTS_FEAT_PAGINATION_COORDINATION
* model_init: order features alphabetically, part 2
* src/common/bts.c: set BTS_FEAT_PAGING_COORDINATION
* src/common/bts.c: set BTS_FEAT_CCN
[ Vadim Yanitskiy ]
* oml: use proper talloc context in oml_rx_set_radio_attr()
* oml: use ts->trx as talloc-context in oml_rx_set_chan_attr()
* oml: fix copy-pasted comments in oml_rx_set_*_attr()
* oml: assign unique names to 'struct tlv_parsed' chunks
* osmo-bts-trx: use l1ts as talloc context for burst buffers
* osmo-bts-trx: fix a memleak in trx_sched_set_lchan()
* cbch: cosmetic: use talloc_zero() in bts_process_smscb_cmd()
* phy_instance_destroy(): fix NULL pointer dereference
* logging: get rid of logging category DSUM
* osmo-bts-trx: make use of OSMO_UNLIKELY() when handling TRXD PDUs
* osmo-bts-trx: cosmetic: use rate_ctr_inc2() instead of rate_ctr_inc()
* osmo-bts-trx: new rate counter 'trx_sched:dl_fh_cache_miss'
* VTY: fix ambiguity in BTS specific command definitions
* osmo-bts-trx: do not run osmo_{fr,hr}_check_sid() on FACCH/U frames
* osmo-bts-trx: rx_tchh_fn(): do not calculate BER10k for FACCH twice
* rsl: fix wrong IE being checked in rsl_rx_chan_activ()
* osmo-bts-trx: rx_tchh_fn(): fix HR SID detection (wrong offset)
* osmo-bts-trx: rx_tchh_fn(): mark valid SID frames as such
* osmo-bts-trx: use consistent naming for 'enum sched_meas_avg_mode'
* osmo-bts-trx: use a lookup table in trx_sched_meas_avg()
* osmo-bts-trx: rx_tchh_fn(): use proper meas averaging mode
* trx_sched_ul_burst(): get rid of the 'switch' statement
* fix gsm_bts_get_cbch(): CBCH can be allocated on Cn
* osmo-bts-trx: rx_tchh_fn(): indicate BER10k=0 for FACCH BFIs
* osmo-bts-trx: rx_tchh_fn(): get rid of chan_state->meas_avg_facch
* osmo-bts-trx: rx_{tchf,tchh}_fn(): also use meas_avg for BFI
* osmo-bts-trx: rx_{tchf,tchh}_fn(): shift Rx burst buffer on bid=0
* osmo-bts-trx: rx_{tchf,tchh}_fn(): ensure complete set of bursts
* osmo-bts-trx: rx_{tchf,tchh}_fn(): get TDMA FN from meas history
* osmo-bts-trx: rx_{tchh,tchf}_fn(): use AMR CMI lookup tables
* osmo-bts-trx: rx_{tchh,tchf}_fn(): use tch_mode directly
* osmo-bts-trx: rx_tchh_fn(): fix meas reporting in signalling mode
* osmo-bts-trx: move AMR CMI lookup tables to the respective files
* osmo-bts-trx: rx_tchh_fn(): fix indexes in the AMR CMI lookup table
* osmo-bts-trx: rx_tchf_fn(): clarify indexes in the AMR CMI lookup table
* power_ctrl_params_def_reset(): set .ctrl_interval for both UL/DL
* scheduler: remove redundant OSMO_ASSERT() statements
* scheduler: rts_tchh_fn(): use a lookup table for FACCH/H
* osmo-bts-trx: rx_tchh_fn(): use a lookup table for FACCH/H
* osmo-bts-{trx,virtual}: tx_tchh_fn(): remove FACCH/H alignment check
* osmo-bts-trx: rename 'loops.[ch]' to 'amr_loop.[ch]'
* osmo-bts-trx: use '#pragma once' in amr_loop.h
* osmo-bts-trx: amr_loop: remove unneeded #includes
* rsl: de-duplicate parsing of MultiRate configuration IE
* rsl: rsl_rx_chan_{activ,modif}: do not sent an Error Report
* rsl: parse_multirate_config(): check if AMR codec is used
* logging: use a different color tone for DLOOP
* rsl: always check return value of rsl_tlv_parse()
* rsl: misc / cosmetic fixes for tx_ipac_XXcx_nack()
* osmo-bts-virtual: remove unused 'codec_mode_request' argument
* l1sap: l1sap_chan_act(): alloc DTX FSM only for TCH
* l1sap: l1sap_chan_act(): remove unused *tp argument
* osmo-bts-trx: bts_report_interf_meas(): remove unused fn param
* rsl: use hard-coded defaults if the MultiRate conf IE is absent
* tests/amr/Makefile.am: use proper binary name prefix 'amr_test_'
* tests/amr: add a unit test for amr_parse_mr_conf()
* amr: fix parsing of threshold and hysteresis in amr_parse_mr_conf()
* tests: use 'check_PROGRAMS' instead of 'noinst_PROGRAMS'
* struct amr_multirate_conf: remove ms_mode[], raname bts_mode[]
* common: fix coding style: if is not a function
* osmo-bts-trx: amr_loop: simplify trx_loop_amr_set()
* osmo-bts-trx: use C/I in the AMR link adaptation loop
* osmo-bts-trx: amr_loop: improve logging in trx_loop_amr_input()
* osmo-bts-trx: amr_loop: allow upgrading codec mode > 0
* osmo-bts-trx: amr_loop: log if AMR mode remains unchanged
* osmo-bts-trx: amr_loop: do not miss C/I samples
* osmo-bts-trx: prioritize FACCH in s/tx_tch_common()/tch_dl_dequeue()/s
* osmo-bts-trx: tx_tchh_fn(): make handling of FACCH/H cleaner
* osmo-bts-trx: fix scheduling of dummy FACCH/H and FACCH/F
* VTY: fix NULL-pointer dereference in 'show transceiver'
* osmo-bts-trx: check if scheduling of [dummy] FACCH/H is allowed
* osmo-bts-trx: rx_{tchh,tchf}_fn(): improve logging of AMR DTX frames
* pcu_sock: comment out {dl,ul}_tbf_ext related warnings
* osmo-bts-trx: drop Uplink loss detection from Downlink path
* scheduler: trx_sched_is_sacch_fn(): make ts pointer const
* struct bts_ul_meas: reflect C/I units in field name s/c_i/ci_cb/
* tests/meas: improve logging in test_ts45008_83_is_sub_single()
* tests/meas: improve test_ts45008_83_is_sub_is_sub()
* measurement: log SUB/FULL as text in lchan_new_ul_meas()
* measurement: move SACCH detection to process_l1sap_meas_data()
* measurement: fix matching of SUB frames by TDMA FN
* osmo-bts-trx: rx_tchf_fn(): do not treat AFS_SID_UPDATE as SUB frame
* Revert "osmo-bts-trx: rx_tchf_fn(): do not treat AFS_SID_UPDATE as SUB frame"
-- Pau Espin Pedrol <pespin@sysmocom.de> Wed, 29 Jun 2022 09:41:38 +0200
osmo-bts (1.4.0) unstable; urgency=medium
[ Philipp Maier ]
* l1sap: Store status of SRR in an lchan struct memeber
* l1sap: add logging and VTY introspection for ACCH repetition
* sched_lchan_tchh: fix frame number and fill FACCH gap
* main,abis: change model name from sysmoBTS to osmo-bts
* paging: prioritize CS related paging over PS related pagings.
* allow to configure multiple oml remote-ip addresses
* sched_lchan_tch_x: do not use cmr as ft
* sched_lchan_tch_x: use functions to determine AMR tranmssion phase
* sched_lchan_tch_x: use ul_cmr and ul_ft when generating RTP bad frame
* rsl: simplfy parse_repeated_acch_capability
* rsl: parse temporary overpower value RSL CHAN ACT / MODIFY
[ Vadim Yanitskiy ]
* doc/examples: remove obsolete power control parameters
* doc/examples: enable stderr logging for osmo-bts-virtual.cfg
* osmo-bts-trx: fix: do not call trx_if_close() two times
* osmo-bts-trx: fix segfault on trx_phy_inst_open() failure
* l1sap: use the passed 'trx' pointer in l1sap_chan_act()
* l1sap: use TLVP_PRES_LEN() macro in l1sap_chan_act()
* l1sap: check BTS_FEAT_MULTI_TSC in l1sap_chan_act()
* l1sap: fix wrong IEI and parsing in l1sap_chan_act()
* manuals: fix wrong VTY node for 'gsmtap-sapi' command
* manuals: document GSMTAP 'enable-all' / 'disable-all'
* osmo-bts-trx: correct definition of 'osmotrx rx-gain' command
* rsl: do not blindly ignore unhandled/unknown Channel Mode
* manuals: remove deprecated command line parameters
* manuals: document new 'gsmtap-remote-host' command
* l1sap: fix incorrect pointer cast in l1sap_chan_act()
* rsl: rename, fix and refactor lchan_tchmode_from_cmode()
* rsl: add missing Channel Mode values to rsl_handle_chan_mod_ie()
* lchan2lch_par(): fix missing default branch in switch
* osmo-bts-trx: cosmetic: TRXD 'header version' -> 'PDU version'
* osmo-bts-trx: remove outdated TRXD protocol documentation
* osmo-bts-trx: cosmetic: use '#pragma once' in trx_if.h
* osmo-bts-trx: define TRXC/TRXD message buffer size
* osmo-bts-trx: 'burst type' is actually modulation type
* osmo-bts-trx: move MTS parser into trx_data_parse_mts()
* osmo-bts-trx: discard TRXD PDUs with unexpected version
* osmo-bts-trx: move TDMA frame number check to trx_data_read_cb()
* osmo-bts-trx: cosmetic: get rid of TRX_CHDR_LEN macro
* osmo-bts-trx: generalize checking of TRXD header length
* osmo-bts-trx: pass 'struct phy_instance' to TRXD dissectors
* osmo-bts-trx: refactor handling of version specific TRXD parts
* osmo-bts-trx: enlarge and share TRXD message buffer
* osmo-bts-trx: assert PDU version in trx_if_send_burst()
* osmo-bts-trx: reduce code nasting in trx_if_send_burst()
* vty: fix the use of deprecated osmo_bts_feature_name()
* common/abis: fix the use of deprecated e1inp_line_get() API
* osmo-bts-trx: refactor parse_rsp(), fix compilation warnings
* rsl: fix wrong value printed in rsl_handle_chan_mod_ie()
* struct gsm_bts_trx: remove unused leftovers from openbsc
* common/sysinfo: make struct gsm_bts_trx const in num_agch()
* osmo-bts-{lc15,oc2g}: drop redundant checks in VTY commands
* [VAMOS] struct gsm_bts_trx: fix the PHY instance pointer
* [VAMOS] Merge bts_trx_init() into gsm_bts_trx_alloc()
* [VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
* osmo-bts-trx: implement TRXDv2 protocol support
* scheduler.h: cosmetic: use #pragma once
* osmo-bts-trx: cosmetic: s/trx_sched_fn/bts_sched_fn/g
* osmo-bts-trx: remove redundant assert() in bts_sched_fn()
* osmo-bts-trx: fix hopping pointer bug in bts_sched_fn()
* [VAMOS] Re-organize osmo-bts-trx specific structures
* osmo-bts-trx: clarify logging messages in trx_if_{open,close}()
* osmo-bts-{trx,virtual}: fix: pinst->trx may be NULL
* common: make the arguments of phy_{link,instance}_name() const
* [VAMOS] common: make 'struct gsm_bts_trx_ts' pointers const
* [VAMOS] gsm_data.h: fix wrong bit-mask in BSIC2BCC macro
* [VAMOS] gsm_data.h: introduce and use BTS_TSC macro
* common: phy_links_open(): warn about dangling PHY instances
* [VAMOS] osmo-bts-trx: rework and split up bts_sched_fn()
* Fix regression in 'osmo-bts-trx: rework and split up bts_sched_fn()'
* [VAMOS] osmo-bts-trx: implement and enable PDU batching for TRXDv2
* [VAMOS] osmo-bts-trx: indicate MTS in Downlink TRXDv2 PDUs
* [VAMOS] rsl_rx_mode_modif(): handle Channel Identification IE
* [VAMOS] rsl: call bts_supports_cm() from rsl_handle_chan_mod_ie()
* [VAMOS] bts_supports_cm(): handle RSL_CMOD_CRT_OSMO_TCH_VAMOS_{Bm,Lm}
* [VAMOS] common/scheduler: unify symbol names for training sequences
* [VAMOS] osmo-bts-trx: rework handling of Training Sequence
* [VAMOS] osmo-bts-trx: properly handle per-timeslot TSC values
* [VAMOS] scheduler: add new GMSK training sequences from 3GPP 45.002
* [VAMOS] l1sap_chan_act(): handle Osmocom specific TSC IE
* [VAMOS] common/oml: generalize checking BTS_FEAT_MULTI_TSC
* [VAMOS] gsm_pchan2chan_nr(): use ABIS_RSL_CHAN_NR_CBITS_* macros
* [VAMOS] rsl_lchan_lookup(): use ABIS_RSL_CHAN_NR_CBITS_* macros
* [VAMOS] rsl_lchan_lookup(): make it more readable
* [VAMOS] gsm_data: rework and rename gsm_lchan_name_compute()
* [VAMOS] l1sap: get_lchan_by_chan_nr() may return NULL
* [VAMOS] oml_rx_set_chan_attr(): clarify NM_ATT_CHAN_COMB handling
* manuals/abis/rsl.adoc: s/TS 08.58/TS 48.058/
* manuals/abis/rsl.adoc: rework Channel Number description
* manuals/abis/rsl.adoc: add missing CBCH Channel Number values
* manuals/abis/rsl.adoc: add VAMOS specific Channel Number values
* osmo-bts-trx: fix NULL pointer dereference in trx_if_send_burst()
* trx_sched_is_sacch_fn(): fix handling of dynamic timeslots
* [VAMOS] scheduler: drop meaningless channel number checks
* [VAMOS] conf_lchans_as_pchan(): improve readability
* [VAMOS] Implement the concept of 'shadow' timeslots
* [VAMOS] osmo-bts-trx: schedule bursts on 'shadow' timeslots
* l1sap: fix TDMA frame number wrap in l1sap_info_time_ind()
* conf_lchans_as_pchan(): fix GSM_LCHAN_{CCCH->CBCH} regression
* conf_lchans_as_pchan(): initialize all lchans with GSM_LCHAN_NONE
* measurement: remove over-defensive checks in is_meas_complete()
* [VAMOS] trx_sched_init_ts(): assign names to per-timeslot counters
* common/vty: facilitate finding duplicate PHY/TRX associations
* vty: ensure all warning messages are prefixed with '%%'
* osmo-bts-octphy: drop talloc_replace(), use osmo_talloc_replace_string()
* l1sap: fix TDMA frame number arithmetic in fn_ms_adj()
* osmo-bts-trx: fix typo: s/bisc/bsic/ in 'show transceiver'
* osmo-bts-trx: fix copy-pasted comment: s/sysmoBTS/osmo-bts-trx/
* oml: fix handling of NM_ATT_INTERF_BOUND attribute
* Report interference levels in RSL RF RESource INDication
* scheduler: reorder enum trx_chan_type, add TRX_CHAN_IS_DEDIC()
* osmo-bts-trx: report interference levels to the upper layers
* osmo-bts-{trx,virtual}: get rid of dummy tx_idle_fn()
* scheduler: unset TRX_CHAN_FLAG_AUTO_ACTIVE for TRXC_IDLE
* osmo-bts-trx: print timeslot brief info in 'show transceiver'
* osmo-bts-trx: measure interference levels on TRXC_IDLE
* osmo-bts-trx: report PDCH interference levels to the PCU
* scheduler: fix wrong union field in trx_sched_tch_req()
* scheduler: fix: use ts_pchan() in trx_sched_set_cipher()
* Revert "power_control: BS power shall not be reduced on C0"
* osmo-bts-omldummy: indicate BTS_FEAT_BCCH_POWER_RED as supported
* osmo-bts-trx: implement BCCH carrier power reduction mode
* power_control: constrain BS power reduction on BCCH carrier
* manuals/abis/rsl.adoc: clarify RF Resource Indication conformance
* rsl: use tlvp_val16be() in rsl_rx_ipac_XXcx()
* gsm_lchan_interf_meas_calc_band(): also print number of AVG samples
* osmo-bts-trx: send dummy FACCH in the absense of RTP frames
* osmo-bts-trx: return -ENODEV if 'bursts_p' is NULL
* l1sap: unify channel (de)activation/modification messages
* gsm_lchan2chan_nr(): separate RSL specific variant of this API
* osmo-bts-trx: bts_model_l1sap_down(): remove chan_nr patching
* trx_sched_set_lchan(): use LOGL_INFO for logging messages
* osmo-bts-trx: remove an 'else' branch in _sched_dl_burst()
* osmo-bts-trx: implement Temporary Overpower for SACCH/FACCH
* scheduler: fix comments explaining the interleaving of TCH/H
* fix handle_ms_meas_report(): properly count measurement reports
* abis: fix memory leak in abis_oml_sendmsg()
* rsl: remove redundant logging in rsl_rx_chan_activ()
* .gitignore: add tests/amr/amr_test
* rsl: prevent race condition during timeslot re-configuration
* rsl_tx_rf_res(): separate interference AVG / band calculation
* rsl_tx_rf_res(): also report noise levels for PDTCH
* osmo-bts-trx: report PDCH interference levels to L1SAP
* l1sap: check if BTS model supports interference reporting
* vty: show interference level / band in 'show lchan'
* trx_sched_clean_ts(): also free() the associated 'struct l1sched_ts'
* trx_sched_clean(): also free() the shadow timeslot
* osmo-bts-trx: refactor 'maxdly' / 'maxdlynb' commands
* rsl: rsl_tx_meas_res() does not change l3, make it const
* rsl: send NACK if BTS_FEAT_ACCH_REP is not supported
* measurement: handle_ms_meas_report() accepts const gh
* measurement: move repeated_dl_facch_active_decision() here
* measurement: make sure that DL measurements are valid
* cosmetic: s/repeated_acch_capability/rep_acch_cap/g
* struct gsm_lchan: group ACCH repetition state fields
* struct gsm_lchan: move tch.rep_facch to rep_acch.dl_facch
* measurement: fix wrong operator used in handle_ms_meas_report()
* osmo-bts-trx: fix potential NULL pointer dereference
* lchan_set_state(): also free pending messages if any
* lchan: introduce and use lchan_is_tch() helper
* [overpower] rsl: store full content of RSL_IE_OSMO_TEMP_OVP_ACCH_CAP
* [overpower] lchan_dump_full_vty(): print overpower state
* [overpower] scheduler: handle {sacch,facch}_enabled flags
* l1sap: fix handling of lchan->pending_rel_ind_msg
* l1sap: move false PTCCH/U detection into PDCH branch
* l1sap: use designated initializers in process_l1sap_meas_data()
* l1sap: process_l1sap_meas_data() accepts pointer to lchan
* l1sap: make 'l1sap' argument of process_l1sap_meas_data() const
* rsl: fix a memory leak in handle_gprs_susp_req()
* l1sap: rework handling of DATA.ind on SACCH
* lchan_meas_handle_sacch(): check if Measurement Result is valid
* measurement: get rid of *le in lchan_meas_handle_sacch()
* measurement: pass *mr to repeated_dl_facch_active_decision()
* measurement: pass *mr to lchan_bs_pwr_ctrl()
* [overpower] Turn it on and off depending on DL RxQual
* measurement: make use of gsm48_meas_res_is_valid()
* common/Makefile.am: reformat {AM_CPPFLAGS,AM_CFLAGS,LDADD}
* rsl: exclude disabled timeslots from interference reports
* oml: use ARRAY_SIZE() in oml_rx_set_bts_attr()
* gsm_lchan_interf_meas_calc_avg(): fix band calculation
[ Pau Espin Pedrol ]
* l1sap: Transmit pdtch invalid MAC blocks to PCU
* bts-trx: Always submit rx PDTCH DATA.ind to l1sap
* bts-trx: Avoid submitting first data_ind with FN=0 to upper layers
* bts-trx: Drop duplicate set of last_clk_ind
* bts-trx: reorder first timerfd schedule to decrease first timeout skew
* sysmo,oc2g,lc15: Make RadioChannel MO depend on RadioCarrier MO
* bts: Clean up TS selection in sign_link_up
* Fix regression in 'bts: Clean up TS selection in sign_link_up'
* Add missing value_string for NM_EV_* introduced recently
* pcuif: Set missing bsic field during Tx of info_ind
* Use new stat item/ctr getter APIs
* rsl: Use switch statement in rsl_rx_bcch_info()
* pcu_sock: Transmit SI2
* doc: rsl.adoc: Fix trailing whitespace
* gsm_data: Drop unused function gsm_pchan_parse()
* pcuif_proto.h: Add new container messages
* Support forwarding proto IPAC_PROTO_EXT_PCU BSC<->PCU
* Rename osmo dyn ts enums to contain SDCCH8
* Support SDCCH8 in osmo dyn ts
* Make gcc 11.1.0 false positivies happy
* rsl: Fix rx of multiple RSL_IPAC_EIE_MEAS_AVG_CFG IEs
* rsl: Support parsing up to 3 RSL_IPAC_EIE_MEAS_AVG_CFG IEs
* MS Power Control Loop: Take C/I into account
* MS Power Control Loop: Support EWMA algorithm for C/I measurements
* MS Power Control Loop: Improve logging
* BS Power Control Loop: refactor lchan_bs_pwr_ctrl() to look similar to lchan_ms_pwr_ctrl()
* BS Power Control Loop: Support EWMA average algo for RxQual meas
* BS Power Control Loop: Increase attenuation if RxQual is better than upper threshold
* MS/BS Power Control Loop: Do RxLEV meas avg & delta calculations directly on RxLevels
* MS/BS Power Control Loop: Fix downscaling averaging bug
* Power Control Loop: Move skip loop logic to function helper
* comsetic: measurement.c: fix typo in comment
* l1sap: Take L1SACCH MS_PWR from bitfield instead of manual parsing
* TA loop: Take into account UL SACCH 'Actual Timing advance' field
* ta_control: Allow switching TA quicker
* lchan: Move TA CTRL param to its own substruct
* MS Power Control Loop: Feed UL RSSI from correct measurement period
* MS Power Control Loop: Feed UL C/I from correct measurement period
* TA Control Loop: Change toa256 switch threshold to 75% of a symbol
* Power Control Loop: Set P_CON_INTERVAL to 1 by default
* Support configuring TA loop SACCH block rate
* MS Power Control Loop: Fix sub vs full being passed to algo
* abis: Clear code and drop code not executed
* abis.h: Drop unused state
* cosmetic: fix typo in comment
* abis.c: Rearrange code to follow logic state order
* abis.c: Convert early return to assert()
* power_control: Drop unused param in function
* tests: MS Power Control Loop: Show oscillation among good power levels
* cosmetic: Fix formatting of conditional operator
* abis: Move FSM registration to constructor function
* abis: Shorten string names of events
* abis.c: Transition to CONNECTED state only when OML link is up
* abis.c: Fix mess with priv->bsc_oml_host
* abis.c: Loop over list of BSCs until connection succeeds
* trx_provision_fsm: Add missing state transition OPEN_WAIT_POWEROFF_CNF => OPEN_POWEROFF
* nm_*_fsm: Add missing item in event mask list for state ENABLED
* Allow setting administrative state through oml_mo_state_chg()
* nm_*_fsm: Set adminsitrative state 'shutting down' when shutdown procedure starts
* MS Power Control Loop: Fix oscillations within good MS Power Levels
* nm_*_fsm: Move to state Disabled NotInstalled Locked when shtudown proc ends
* abis: Drop internal OML msg queue
* nm_*fsm: Make FSMs aware of object being properly configured or not
* bts_shutdown_fsm: Fix event name
* trx_if: Set pointer to null after freeing it
* trx_if: Allow calling trx_if_flush/close from within TRXC callback
* trx_if: delete retrans timer when flushing the Tx queue
* trx_provision_fsm: Properly reset FSM state upon starting listening for events
* bts-trx: Submit TRX_PROV_EV_CFG_ARFCN for C0 during SetBtsAttr
* bts-trx: Get rid of check_transceiver_availability_trx()
* MS Power Control Loop: Disable threshold comparison on {LOWER,UPPER}_CMP_N=0
* l1sap: Support rx of empty rlcmac blocks from PCU
* bts-trx: Avoid race condition configuring TS-specific TSC values
* bts-trx: Submit TRX SW_ACT when PHY becomes connected
* trx_sched_clean_ts: Clean VAMOS shadow TS too
* phy_link: Introduce bts_model_phy_link_close() and use it in bts-trx
* nm_bts_fsm: Make sure PHYs are opened when SW_ACTivating it
* bts_shutdown_fsm: Allow configuring FSM to shutdown without exiting process
* abis: Call bts_model_abis_close() when Abis link goes down
* bts_trx: Drop non-executed path in trx_link_estab()
* Avoid sending Load Indications when BTS is not RSL-connected
* abis: Fix memory leak of bts->osmo_link upon link going down
* abis: Fix line leaked & recreated upon every reconnect
* bts-trx: Keep the process ongoing trying to reconnect on Abis link down
* Revert "bts-trx: Keep the process ongoing trying to reconnect on Abis link down"
* Revert "abis: Fix line leaked & recreated upon every reconnect"
* osmo-bts-omldummy: Fix crash accessing null phy
* bts-trx: Fix rxgain & maxdly VTY values being reset
* Decouple handling of Measurement Report from lapdm
* Move TA & Power Loops further up the stack, take DTXu flag into account
* scheduler: Fix lqual_cb not populated for TCH.ind
* abis: Fix line leaked & recreated upon every reconnect
* trx_provision_fsm: Fix TRX!=0 never going back to CLOSED state
* trx_provision_fsm: Support OPEN_POWEROFF->CLOSED transition
* bts-trx: Delay power ramp up until RCARRIER is ENABLED
* Delay abis reconnect while bts is shutting down
* bts-trx: Keep the process ongoing trying to reconnect on Abis link down
* trx_provision_fsm: Drop unneeded reset of fields
* trx_provision_fsm: Drop impossible paths
* trx_provision_fsm: poweronoff_sent flag: track POWERON and POWEROFF separately
* trx_provision_fsm: Fix shutdown while POWERON in transit
* rsl: NACK Chan Activation for lchans on disabled TS
* Introduce gsm_lchan_init() function helper
* MS Power Control Loop: Use P_CON_INTERVAL=2 by default
* load_indication.c: Avoid sending if CCCH is still not operational
* Move lchan,power_ctrl specific code from gsm_data.h to their own files
* Move lchan,power_control related code from gsm_data.c to their own files
* lchan.h: Add related ticket info to FIXME comment
* Introduce gsm_lchan_release function helper
* nm_channel_fsm: Release lchans after BTS shutdown
* nm_bts_fsm: Reset si_valid bitmask when BTS is shut down
* nm_*_fsm: Move reset state code to st_op_disabled_notinstalled_on_enter
* nm_*_fsm: reset mo.nm_attr from previous runs when entering state NOT_INSTALLED
* Add new gsm_bts_trx_free_shadow_ts() function
* Make sure lchan allocated memory from shadow_ts is properly freed
* rsl: Fix all shadow TS being Chan Act NACKed
* bts-trx: Guard call to trx_sched_clean with NULL trx ptr
* lchan: Setup early_rr_ia timer only once during init
* Move lchan related code to lchan.{c,h}
* lchan: Update log line level to use macro and level INFO
* lchan: Avoid applying transition changes if state new==old
* Move lchan_deactivate() to lchan.c
* Move lchan_init_lapdm inside lchan_set_state(LCHAN_S_ACTIVE)
* lchan: Call lapdm_channel_exit() when state changes to NONE
* bts_shutdown_fsm: Make sure pending power ramping are aborted before closing TRX
* gsm_pchan2chan_nr(): Properly assert if unexpected pchan is passed
* Reset CBCH state after BTS shutdown
* bts-trx: sched_lchan_pdtch: Refactor tx_pdtch_fn to get rid of goto tag
* bts-trx: sched: tx_pdtch_fn: Handle PCU idle blocks properly
* Revert "bts-trx: sched: tx_pdtch_fn: Handle PCU idle blocks properly"
* scheduler: Fix check against empty PDCH blocks
* bts-trx: sched: tx_pdtch_fn: Drop log line clogging logs
* l1sap: Avoid re-(de)activating already (de)active lchans
* scheduler: Avoid crash upon call to trx_sched_set_lchan if l1ts is uninitialized
* bts-trx: sched_lchan_tchf: Drop impossible code path
* scheduler: Fix FACCH msg with l2len==0 going to lower layers and logging errors
* bts-trx: sched_lchan_tchf: Change log level to debug for line informing about missing dl prim
* abis: Drop unneded if condition in else clause
* abis: Try one reconnect to previously connected BSC before trying next one
* gsm_ts_release(): Make sure pchan{,is_want} is reset to NONE
[ Neels Hofmeyr ]
* osmobts-abis.adoc: add missing bibliography
* Abis manual: s/TS 12.21/TS 52.021
* Abis manual: add Get Attributes, add BTS features
* Abis manual: add VAMOS to BTS features
* Abis manual: add RSL_IE_OSMO_TRAINING_SEQUENCE
* omldummy: introduce using getopt_long
* omldummy: add cmdline arg --features
* [VAMOS] osmo-bts-omldummy: allocate shadow timeslots
* remove unused LCHAN_S_INACTIVE
* enable Early Immediate Assignment
* add VTY transcript testing
* jenkins: enable new flag --enable-external-tests
* add osmo_tdef groups, exposing T timers on VTY config
* early IMM ASS: add configurable delay for RR IMM ASS
* early IA: change default X15 timer to 0 ms
* gsm_lchan_interf_meas_calc_avg(): adapt to the order of boundaries
[ Harald Welte ]
* Introduce ability to set socket priority of RTP sockets
* manual: Include QoS chapter and add osmo-bts specific example
* manual: Remove manual revision history; we don't use it anywawy
* manuals: Update copyright years
* l1sap/gsmtap: Don't log UI fill frames [zero information field]
* rsl: fix handling of REL IND in lapdm_rll_tx_cb()
* initial support for static userspace probes via systemtap
[ Keith ]
* sysmobts-mgr: Fix path to hwmon in /sys
[ Eric Wild ]
* osmo-bts-trx: indicate A5/4 support, handle Kc128
[ Oliver Smith ]
* debian/control: remove dh-systemd build-depend
[ Eric ]
* lc15, oc2g, sysmo: fix show dsp-trace-flags
* osmo-trx: fix maxdly
[ Martin Hauke ]
* osmo-bts-trx-calypso.cfg: Adjust settings to work with current osmo-bts versions
-- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 16 Nov 2021 16:40:05 +0100
osmo-bts (1.3.0) unstable; urgency=medium
[ Michael McTernan ]

2
debian/compat vendored
View File

@ -1 +1 @@
9
10

33
debian/control vendored
View File

@ -2,25 +2,41 @@ Source: osmo-bts
Maintainer: Osmocom team <openbsc@lists.osmocom.org>
Section: net
Priority: optional
Build-Depends: debhelper (>= 9),
Build-Depends: debhelper (>= 10),
pkg-config,
dh-autoreconf,
dh-systemd (>= 1.5),
autotools-dev,
pkg-config,
libosmocore-dev (>= 1.5.0),
libosmo-abis-dev (>= 1.1.0),
libosmocore-dev (>= 1.9.0),
libosmo-abis-dev (>= 1.5.0),
libosmo-netif-dev (>= 1.4.0),
libgps-dev,
txt2man,
osmo-gsm-manuals-dev (>= 1.1.0)
osmo-gsm-manuals-dev (>= 1.5.0)
Standards-Version: 3.9.8
Vcs-Browser: http://git.osmocom.org/osmo-bts/
Vcs-Git: git://git.osmocom.org/osmo-bts
Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-bts
Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-bts
Homepage: https://projects.osmocom.org/projects/osmobts
Package: osmo-bts
Architecture: any
Depends: osmo-bts-trx, osmo-bts-virtual, ${misc:Depends}
Description: Base Transceiver Station for GSM
OsmoBTS is a software implementation of Layer2/3 of a BTS. It implements the
following protocols/interfaces:
LAPDm (GSM 04.06)
RTP
A-bis/IP in IPA multiplex
OML (GSM TS 12.21)
RSL (GSM TS 08.58)
.
OsmoBTS is modular and has support for multiple back-ends. A back-end talks to
a specific L1/PHY implementation of the respective BTS hardware. Based on this
architecture, it should be relatively easy to add a new back-end to support
so-far unsupported GSM PHY/L1 and associated hardware.
Package: osmo-bts-trx
Architecture: any
Conflicts: osmo-bts
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: osmo-bts-trx GSM BTS with osmo-trx
osmo-bts-trx to be used with the osmo-trx application
@ -35,7 +51,6 @@ Description: Debug symbols for the osmo-bts-trx
Package: osmo-bts-virtual
Architecture: any
Conflicts: osmo-bts
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Virtual Osmocom GSM BTS (no RF hardware; GSMTAP/UDP)
This version of OsmoBTS doesn't use actual GSM PHY/Hardware/RF, but

View File

@ -1,16 +1,29 @@
OSMOCONF_FILES = virtual/osmo-bts-virtual.cfg
# all config examples must be listed here unconditionally, so that
# all of them end up in the release tarball (see OS#6349)
EXTRA_DIST = \
trx/osmo-bts-trx.cfg \
trx/osmo-bts-trx-calypso.cfg \
octphy/osmo-bts-trx2dsp1.cfg \
octphy/osmo-bts-octphy.cfg \
oc2g/osmo-bts-oc2g.cfg \
oc2g/oc2gbts-mgr.cfg \
sysmo/sysmobts-mgr.cfg \
sysmo/osmo-bts-sysmo.cfg \
litecell15/osmo-bts-lc15.cfg \
litecell15/lc15bts-mgr.cfg \
virtual/osmo-bts-virtual.cfg \
$(NULL)
doc_virtualdir = $(docdir)/examples/osmo-bts-virtual
doc_virtual_DATA = \
virtual/osmo-bts-virtual.cfg
EXTRA_DIST = $(doc_virtual_DATA)
OSMOCONF_FILES = virtual/osmo-bts-virtual.cfg
if ENABLE_SYSMOBTS
doc_sysmodir = $(docdir)/examples/osmo-bts-sysmo
doc_sysmo_DATA = \
sysmo/osmo-bts-sysmo.cfg \
sysmo/sysmobts-mgr.cfg
EXTRA_DIST += $(doc_sysmo_DATA)
OSMOCONF_FILES += sysmo/osmo-bts-sysmo.cfg sysmo/sysmobts-mgr.cfg
endif
@ -19,7 +32,6 @@ doc_trxdir = $(docdir)/examples/osmo-bts-trx
doc_trx_DATA = \
trx/osmo-bts-trx.cfg \
trx/osmo-bts-trx-calypso.cfg
EXTRA_DIST += $(doc_trx_DATA)
OSMOCONF_FILES += trx/osmo-bts-trx.cfg
endif
@ -28,7 +40,6 @@ doc_octphydir = $(docdir)/examples/osmo-bts-octphy
doc_octphy_DATA = \
octphy/osmo-bts-trx2dsp1.cfg \
octphy/osmo-bts-octphy.cfg
EXTRA_DIST += $(doc_octphy_DATA)
OSMOCONF_FILES += octphy/osmo-bts-octphy.cfg
endif
@ -37,7 +48,6 @@ doc_lc15dir = $(docdir)/examples/osmo-bts-lc15
doc_lc15_DATA = \
litecell15/osmo-bts-lc15.cfg \
litecell15/lc15bts-mgr.cfg
EXTRA_DIST += $(doc_lc15_DATA)
OSMOCONF_FILES += litecell15/osmo-bts-lc15.cfg litecell15/lc15bts-mgr.cfg
endif
@ -46,7 +56,6 @@ doc_oc2gdir = $(docdir)/examples/osmo-bts-oc2g
doc_oc2g_DATA = \
oc2g/osmo-bts-oc2g.cfg \
oc2g/oc2gbts-mgr.cfg
EXTRA_DIST += $(doc_oc2g_DATA)
OSMOCONF_FILES += oc2g/osmo-bts-oc2g.cfg oc2g/oc2gbts-mgr.cfg
endif

View File

@ -3,10 +3,12 @@
!!
!
log stderr
logging filter all 1
logging color 1
logging print category 0
logging print category-hex 0
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
logging level temp info
logging level fw info
logging level find info

View File

@ -4,7 +4,11 @@
!
log stderr
logging color 1
logging print category-hex 0
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
logging level rsl info
logging level oml info
logging level rll notice

View File

@ -3,10 +3,12 @@
!!
!
log stderr
logging filter all 1
logging color 1
logging print category 0
logging print category-hex 0
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
logging level temp info
logging level fw info
logging level find info

View File

@ -4,7 +4,11 @@
!
log stderr
logging color 1
logging print category-hex 0
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
logging level rsl info
logging level oml info
logging level rll notice

View File

@ -4,7 +4,11 @@
!
log stderr
logging color 1
logging print category-hex 0
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
logging level rsl info
logging level oml info
logging level rll notice

View File

@ -4,7 +4,11 @@
!
log stderr
logging color 1
logging print category-hex 0
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
logging level rsl info
logging level oml info
logging level rll notice

View File

@ -4,7 +4,11 @@
!
log stderr
logging color 1
logging print category-hex 0
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
logging level rsl info
logging level oml info
logging level rll notice

View File

@ -3,9 +3,12 @@
!!
!
log stderr
logging filter all 1
logging color 1
logging print category-hex 0
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
logging level temp info
logging level fw info
logging level find info

View File

@ -1,11 +1,15 @@
!
! OsmoBTS configuration example for CalypsoBTS
! http://osmocom.org/projects/baseband/wiki/CalypsoBTS
! https://osmocom.org/projects/baseband/wiki/CalypsoBTS
!!
!
log stderr
logging color 1
logging print category-hex 0
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
logging level rsl notice
logging level oml notice
logging level rll notice
@ -24,14 +28,15 @@ phy 0
instance 0
osmotrx ip local 127.0.0.1
osmotrx ip remote 127.0.0.1
osmotrx timing-advance-loop
osmotrx ms-power-loop -65
osmotrx legacy-setbsic
osmotrx fn-advance 20
osmotrx rts-advance 5
bts 0
oml remote-ip 127.0.0.1
ipa unit-id 1801 0
ipa unit-id 6969 0
gsmtap-sapi pdtch
gsmtap-sapi ccch
band 900
trx 0
phy 0 instance 0
nominal-tx-power 23

View File

@ -4,7 +4,11 @@
!
log stderr
logging color 1
logging print category-hex 0
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
logging level rsl notice
logging level oml notice
logging level rll notice

View File

@ -3,10 +3,12 @@
!!
!
log stderr
logging filter all 0
logging color 0
logging color 1
logging print category-hex 0
logging print category 1
logging timestamp 0
logging print file basename last
logging print level 1
logging level rsl info
logging level oml info
logging level rll notice
@ -50,7 +52,6 @@ bts 0
rtp jitter-buffer 100
paging queue-size 200
paging lifetime 0
uplink-power-target -75
min-qual-rach 50
min-qual-norm -5
trx 0

View File

@ -3,16 +3,17 @@
=== List of Messages
The following tables list the OML messages used by OsmoBTS, grouped by their
level of compliance with 3GPP TS 12.21.
level of compliance with 3GPP TS 52.021 [[3gpp-ts-52-021]] (previously 3GPP TS
12.21).
==== Messages Compliant With TS 12.21
==== Messages Compliant With TS 52.021
Specific limitations apply, see the linked sections.
.Messages compliant with TS 12.21
.Messages compliant with TS 52.021
[options="header",cols="10%,10%,20%,35%,5%,20%"]
|===
| TS 12.21 § | type code (hex) | This document § | Message | <-/-> | Received/Sent by OsmoBTS
| TS 52.021 § | type code (hex) | This document § | Message | <-/-> | Received/Sent by OsmoBTS
6+<| *SW Download Management Messages:*
| 8.3.7 | 0x10 | <<sw_act_rep>> | SW Activated Report | -> | Sent
6+<| *Air Interface Management Messages:*
@ -34,12 +35,16 @@ Specific limitations apply, see the linked sections.
.3+.| 8.9.2 | 0x74 .3+.| <<opstart>> | Opstart | <- | Received
| 0x75 | Opstart Ack | -> | Sent
| 0x76 | Opstart Nack | -> | Sent
6+<| *Other Messages:*
.3+.| 8.11.1 | 0x81 | <<get_attributes>> | Get Attributes | <- | Received
| 8.11.3 | 0x82 | <<get_attr_resp>> | Get Attribute Response | -> | Sent
| 8.11.1 | 0x83 | | Get Attributes Nack | -> | Sent
|===
==== Messages Specific to OsmoBTS
.Messages specific to OsmoBTS, not found in 3GPP TS 12.21
.Messages specific to OsmoBTS, not found in 3GPP TS 52.021
[options="header"]
[options="header",cols="20%,55%,5%,20%"]
|===
@ -49,10 +54,10 @@ Specific limitations apply, see the linked sections.
==== Messages Not Implemented by OsmoBTS
.3GPP TS 12.21 messages not implemented by OsmoBTS
.3GPP TS 52.021 messages not implemented by OsmoBTS
[options="header",cols="10%,10%,80%"]
|===
| TS 12.21 § | type code (hex) | Message
| TS 52.021 § | type code (hex) | Message
3+<| *SW Download Management Messages:*
.3+.| 8.3.1 | 0x01 | Load Data Initiate
| 0x02 | Load Data Initiate Ack
@ -136,9 +141,6 @@ Specific limitations apply, see the linked sections.
| 8.10.3 | 0x8C | Stop Measurement
| 8.10.4 | 0x8D | Start Measurement
3+<| *Other Messages:*
| 8.11.1 | 0x81 | Get Attributes
| 8.11.3 | 0x82 | Get Attribute(s) Response
| 8.11.1 | 0x83 | Get Attributes Nack
.3+.| 8.11.2 | 0x84 | Set Alarm Threshold
| 0x85 | Set Alarm Threshold Ack
| 0x86 | Set Alarm Threshold Nack
@ -151,7 +153,7 @@ Specific limitations apply, see the linked sections.
==== SW Activated Report
OsmoBTS will send an _SW Activated Report_ when RF has been activated
successfully. The message is compliant with 3GPP TS 12.21 § 8.3.7.
successfully. The message is compliant with 3GPP TS 52.021 § 8.3.7.
Upon RF activation, two _SW Activated Report_ messages will be sent, for the Object Classes
@ -163,13 +165,13 @@ Upon RF activation, two _SW Activated Report_ messages will be sent, for the Obj
OsmoBTS will receive a _Set BTS Attributes_ message and reply with a
corresponding ACK message on success. IE handling is fully compliant to TS
12.21, except that a change of BCCH ARFCN or BSIC while in operation is not
52.021, except that a change of BCCH ARFCN or BSIC while in operation is not
supported, and hence the _Starting Time_ IE is rejected.
._Set BTS Attributes_ IEs not handled by OsmoBTS
[options="header",cols="10%,30%,60%"]
|===
| TS 12.21 § | IE Name | Handling
| TS 52.021 § | IE Name | Handling
| 9.4.52 | Starting Time | not supported (provokes NACK cause 0x10)
|===
@ -177,13 +179,13 @@ supported, and hence the _Starting Time_ IE is rejected.
[[set_radio_attr]]
==== Set Radio Carrier Attributes
This message conforms to 3GPP TS 12.21, with the following limitation,
This message conforms to 3GPP TS 52.021, with the following limitation,
as frequency hopping is not supported by OsmoBTS:
._Set Radio Carrier Attributes_ IE limitations
[options="header",cols="10%,30%,60%"]
|===
| TS 12.21 § | IE Name | Handling
| TS 52.021 § | IE Name | Handling
| 9.4.5 | ARFCN List | ignored
|===
@ -191,14 +193,14 @@ as frequency hopping is not supported by OsmoBTS:
[[set_chan_attr]]
==== Set Channel Attributes
This message conforms to 3GPP TS 12.21, with the following limitation: the
following 3GPP TS 12.21 IEs provoke a NACK response when sent to OsmoBTS, as
This message conforms to 3GPP TS 52.021, with the following limitation: the
following 3GPP TS 52.021 IEs provoke a NACK response when sent to OsmoBTS, as
frequency hopping is not supported:
._Set Channel Attributes_ IE limitations
[options="header",cols="10%,30%,60%"]
|===
| TS 12.21 § | IE Name | Handling
| TS 52.021 § | IE Name | Handling
| 9.4.21 | HSN | not supported (provokes NACK cause 0x10)
| 9.4.27 | MAIO | not supported (provokes NACK cause 0x10)
| 9.4.52 | Starting Time | not supported (provokes NACK cause 0x10)
@ -207,34 +209,54 @@ frequency hopping is not supported:
[[state_changed_rep]]
==== State Changed Event Report
This message is compliant with 3GPP TS 12.21. Exactly these IEs are sent by
This message is compliant with 3GPP TS 52.021. Exactly these IEs are sent by
OsmoBTS:
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message Type (0xf5) | 3GPP TS 12.21 9.1 | M | V | 1
| Object Class | 3GPP TS 12.21 9.2 | M | V | 1
| Object Instance | 3GPP TS 12.21 9.3 | M | V | 3
| Operational State | 3GPP TS 12.21 9.4.38 | O | TV | 2
| Availability Status | 3GPP TS 12.21 9.4.7 | O | TL16V (with length of 1) | 3
| Message Type (0xf5) | 3GPP TS 52.021 9.1 | M | V | 1
| Object Class | 3GPP TS 52.021 9.2 | M | V | 1
| Object Instance | 3GPP TS 52.021 9.3 | M | V | 3
| Operational State | 3GPP TS 52.021 9.4.38 | O | TV | 2
| Availability Status | 3GPP TS 52.021 9.4.7 | O | TL16V (with length of 1) | 3
|===
[[chg_adm_state]]
==== Change Administrative State
This message is compliant with 3GPP TS 12.21 § 8.8.5. It applies to all of the
Object Classes defined in 3GPP TS 12.21 § 9.2 as well as
This message is compliant with 3GPP TS 52.021 § 8.8.5. It applies to all of the
Object Classes defined in 3GPP TS 52.021 § 9.2 as well as
<<addnl_obj_classes>>.
[[opstart]]
==== Opstart
This message is compliant with 3GPP TS 12.21 § 8.9.2. It applies to all of the
Object Classes defined in 3GPP TS 12.21 § 9.2 as well as
This message is compliant with 3GPP TS 52.021 § 8.9.2. It applies to all of the
Object Classes defined in 3GPP TS 52.021 § 9.2 as well as
<<addnl_obj_classes>>.
[[get_attributes]]
==== Get Attributes
This message is compliant with 3GPP TS 52.021 § 8.11.1.
For a list of supported attributes, see <<get_attr_resp>>.
[[get_attr_resp]]
==== Get Attribute Response
This message is compliant with 3GPP TS 52.021 § 8.11.3.
The following attributes are provided by OsmoBTS:
[options="header"]
|===
| 3GPP TS 52.021 chapter | description | see
| 9.4.61 | SW Configuration | <<NM_ATT_SW_CONFIG>>
| 9.4.30 | Manufacturer Id | <<NM_ATT_MANUF_ID>>
|===
=== Details on OsmoBTS Specific Messages
@ -252,9 +274,9 @@ The message specifics depend on the Object Class and are detailed in
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message Type (0xf5) | 3GPP TS 12.21 9.1 | M | V | 1
| Object Class | 3GPP TS 12.21 9.2 | M | V | 1
| Object Instance | 3GPP TS 12.21 9.3 | M | V | 3
| Message Type (0xf5) | 3GPP TS 52.021 9.1 | M | V | 1
| Object Class | 3GPP TS 52.021 9.2 | M | V | 1
| Object Instance | 3GPP TS 52.021 9.3 | M | V | 3
5+<| _Object Class specific IEs follow, see <<addnl_obj_classes>>..._
|===
@ -262,7 +284,7 @@ The message specifics depend on the Object Class and are detailed in
[[addnl_obj_classes]]
=== Additional Object Classes
In addition to 3GPP TS 12.21 Chapter 9.2, the following managed objects
In addition to 3GPP TS 52.021 Chapter 9.2, the following managed objects
are supported:
.Additional Managed Object Classes
@ -284,9 +306,9 @@ with the following Information Elements:
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message Type | 3GPP TS 12.21 9.1 | M | V | 1
| Object Class | 3GPP TS 12.21 9.2 | M | V | 1
| Object Instance | 3GPP TS 12.21 9.3 | M | V | 3
| Message Type | 3GPP TS 52.021 9.1 | M | V | 1
| Object Class | 3GPP TS 52.021 9.2 | M | V | 1
| Object Instance | 3GPP TS 52.021 9.3 | M | V | 3
| GPRS NSEI | <<NM_ATT_IPACC_NSEI>> | O | TL16V | >= 5
| GPRS NS Configuration | <<NM_ATT_IPACC_NS_LINK_CFG>> | O | TL16V | >= 10
| GPRS BSSGP Configuration | <<NM_ATT_IPACC_BSSGP_CFG>> | O | TL16V | >= 14
@ -301,9 +323,9 @@ message with the following Information Elements:
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message Type | 3GPP TS 12.21 9.1 | M | V | 1
| Object Class | 3GPP TS 12.21 9.2 | M | V | 1
| Object Instance | 3GPP TS 12.21 9.3 | M | V | 3
| Message Type | 3GPP TS 52.021 9.1 | M | V | 1
| Object Class | 3GPP TS 52.021 9.2 | M | V | 1
| Object Instance | 3GPP TS 52.021 9.3 | M | V | 3
| GPRS Routing Area Code | <<NM_ATT_IPACC_RAC>> | O | TL16V | >= 4
| GPRS Paging Configuration | <<NM_ATT_IPACC_GPRS_PAGING_CFG>> | O | TL16V | >= 5
| GPRS RLC Configuration | <<NM_ATT_IPACC_RLC_CFG>> | O | TL16V | >= 12
@ -321,9 +343,9 @@ Attribute* message with the following Information Elements:
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message Type | 3GPP TS 12.21 9.1 | M | V | 1
| Object Class | 3GPP TS 12.21 9.2 | M | V | 1
| Object Instance | 3GPP TS 12.21 9.3 | M | V | 3
| Message Type | 3GPP TS 52.021 9.1 | M | V | 1
| Object Class | 3GPP TS 52.021 9.2 | M | V | 1
| Object Instance | 3GPP TS 52.021 9.3 | M | V | 3
| GPRS NSVCI | <<NM_ATT_IPACC_NSVCI>> | O | TL16V | >= 5
| GPRS NS Link Configuration | <<NM_ATT_IPACC_NS_LINK_CFG>> | O | TL16V | >= 11
|===
@ -332,9 +354,9 @@ Attribute* message with the following Information Elements:
=== Information Elements Overview
All of the IEs handled by OsmoBTS are listed below, with limitations and
additions to TS 12.21 specified in more detail.
additions to TS 52.021 specified in more detail.
==== IEs Conforming to TS 12.21
==== IEs Conforming to TS 52.021
The following Information Elements are accepted by OsmoBTS.
@ -346,10 +368,10 @@ IEs marked __ignored__ and additionally marked as being received by OsmoBTS
(<-) are in fact parsed and their values are stored by OsmoBTS, but these
stored items are currently not used in the OsmoBTS code base.
.IEs conforming to TS 12.21
.IEs conforming to TS 52.021
[options="header",cols="5%,10%,40%,5%,40%"]
|===
| tag (hex) | TS 12.21 § | IE name | <-/-> | Received/Sent by OsmoBTS
| tag (hex) | TS 52.021 § | IE name | <-/-> | Received/Sent by OsmoBTS
| 0x00 | 9.4.1 | Abis Channel | | _ignored_
| 0x01 | 9.4.2 | Additional Info | | _ignored_
| 0x02 | 9.4.3 | Additional Text | | _ignored_
@ -372,8 +394,8 @@ stored items are currently not used in the OsmoBTS code base.
| 0x13 | 9.4.19 | File Version | | _ignored_
| 0x14 | 9.4.20 | GSM Time | | _ignored_
| 0x16 | 9.4.22 | HW Configuration | | _ignored_
| 0x18 | 9.4.24 | Intave Parameter | <- | _ignored_
| 0x19 | 9.4.25 | Interference level Boundaries | <- | _ignored_
| 0x18 | 9.4.24 | Intave Parameter | <- |
| 0x19 | 9.4.25 | Interference level Boundaries | <- |
| 0x1a | 9.4.26 | List of Required Attributes | | _ignored_
| 0x1c | 9.4.28 | Manufacturer Dependent State | | _ignored_
| 0x1d | 9.4.29 | Manufacturer Dependent Thresholds | | _ignored_
@ -405,20 +427,20 @@ stored items are currently not used in the OsmoBTS code base.
| 0x38 | 9.4.58 | VSWR Thresholds | | _ignored_
| 0x39 | 9.4.59 | Window Size | | _ignored_
| 0x40 | 9.4.60 | TSC | <- | Received, with limitations: see <<NM_ATT_TSC>>
| 0x41 | 9.4.61 | SW Configuration | | _ignored_
| 0x41 | 9.4.61 | SW Configuration | -> | Sent, see <<NM_ATT_SW_CONFIG>>
| 0x43 | 9.4.63 | Perceived Severity | | _ignored_
| 0x44 | 9.4.64 | Get Attribute Response Info | | _ignored_
| 0x44 | 9.4.64 | Get Attribute Response Info | -> | Sent, see <<NM_ATT_MANUF_ID>>
| 0x45 | 9.4.65 | Outstanding Alarm Sequence | | _ignored_
| 0x46 | 9.4.66 | HW Conf Change Info | | _ignored_
| 0x47 | 9.4.32 | Measurement Result | | _ignored_
|===
==== IEs Not Conforming to TS 12.21
==== IEs Not Conforming to TS 52.021
.IEs not conforming to TS 12.21
.IEs not conforming to TS 52.021
[options="header",cols="5%,10%,30%,55%"]
|===
| tag (hex) | TS 12.21 § | IE name | Description
| tag (hex) | TS 52.021 § | IE name | Description
| 0x15 | 9.4.21 | HSN | presence causes NACK response
| 0x17 | 9.4.23 | HW Description | _ignored_ by OsmoBTS, but coding may differ, see <<ie_hw_desc>>
| 0x1b | 9.4.27 | MAIO | presence causes NACK response
@ -431,14 +453,14 @@ stored items are currently not used in the OsmoBTS code base.
==== Additional Attributes and Parameters
The following Information Elements are defined in addition to those
specified in 3GPP TS 12.21 Chapter 9.4.
specified in 3GPP TS 52.021 Chapter 9.4.
All of these additional IEs are _received_ by OsmoBTS.
These attributes are not used by OsmoBTS, but
simply passed to OsmoPCU connected to the PCU socket.
.Additional IEs handled by OsmoBTS but not defined in TS 12.21
.Additional IEs handled by OsmoBTS but not defined in TS 52.021
[options="header",cols="5%,50%,45%"]
|===
| tag (hex) | IE name | Description
@ -465,7 +487,7 @@ simply passed to OsmoPCU connected to the PCU socket.
[[ie_hw_desc]]
==== HW Description
TS 12.21 suggests a series of 5 length-value pairs for the _HW Description_ IE.
TS 52.021 suggests a series of 5 length-value pairs for the _HW Description_ IE.
Instead, OsmoBTS interprets it as a single TL16V. The value of this IE is
ignored by OsmoBTS, yet the coding may affect message parsing.
@ -487,7 +509,7 @@ exactly one ARFCN.
[[ie_chan_comb]]
==== Additional Channel Combinations
In addition to 3GPP TS 12.21 Chapter 9.4.13, the following channel
In addition to 3GPP TS 52.021 Chapter 9.4.13, the following channel
combinations are supported:
.Additional Channel Combinations
@ -513,7 +535,7 @@ work, please see the <<rsl-dynamic-channels>>.
[[ie_conn_fail_crit]]
==== Connection Failure Criterion
3GPP TS 12.21 Chapter 9.4.14 specifies two different options for the
3GPP TS 52.021 Chapter 9.4.14 specifies two different options for the
_Connection Failure Criterion_. OsmoBTS only implements the option
coded as 0x01, i.e. based upon uplink SACCH error rate
(RADIO_LINK_TIMEOUT).
@ -523,7 +545,7 @@ coded as 0x01, i.e. based upon uplink SACCH error rate
Due to limitations in the currently supported PHY implementations,
OsmoBTS supports only one global TSC for all channels on one TRX, rather
than a separate TSC for each timeslot, as expected by 3GPP TS 12.21.
than a separate TSC for each timeslot, as expected by 3GPP TS 52.021.
[[NM_ATT_IPACC_DST_IP]]
@ -783,10 +805,91 @@ It is encoded as follows:
This attribute is not used by OsmoBTS, but
simply passed to OsmoPCU connected to the PCU socket.
[[NM_ATT_SW_CONFIG]]
==== SW Configuration
The SW Configuration IE is compliant with 3GPP TS 52.021 9.4.61: it contains a
number of SW Description IEs (9.4.62).
.Coding of SW Configuration IE
[options="header",cols="20%,80%"]
|===
| octet | value
| 1 | NM_ATT_SW_CONFIG IEI (0x41)
| 2-3 | length of value part
| 4 | NM_ATT_SW_DESCR IEI (0x42)
| 5 | NM_ATT_FILE_ID IEI (0x12)
| 6-7 | length of file name
| 8-N | ASCII coded file name (without terminating nul)
| N+1 | NM_ATT_FILE_VERSION IEI (0x13)
| N+2 - N+3 | length of file content
| N+4 - M | file content
| M+1 | NM_ATT_SW_DESCR IEI (0x42)
| M+2 | NM_ATT_FILE_ID IEI (0x12)
2+| ...
|===
.File names and content sent in the SW Configuration IE
[options="header",cols="20%,80%"]
|===
| file name | content
| 'osmobts' | ASCII coded OsmoBTS version number like "1.2.3" or "1.2.3.4-abcd"
| 'BTS_TYPE_VARIANT' | one of "osmo-bts-lc15", "osmo-bts-oc2g", "osmo-bts-octphy",
"osmo-bts-omldummy", "osmo-bts-sysmo", "osmo-bts-trx", "osmo-bts-virtual"
| 'BTS_SUB_MODEL' | This file may be omitted; if present, may contain an ASCII
coded model number like "sysmoBTS 1002"
|===
[[NM_ATT_MANUF_ID]]
==== Manufacturer Id
The coding of the Manufacturer Id attribute is a sequence of bit flags (a bit
vector), where a zero flag indicates absence and a set flag indicates presence
of a specific BTS feature.
The number of flags transmitted depends on the software version of OsmoBTS and
the BTS backend in use. More flags may be added in the future. The flag bits
transmitted are followed by zero bits up to the next full octet boundary.
These features are currently defined:
.coding of BTS feature flags sent in the Manufacturer Id attribute
[options="header",cols="5%,5%,30%,60%"]
|===
| octet | bit | feature name | description
.8+.| 0 | 7 | HSCSD | High-Speed Circuit-Switched Data
| 6 | GPRS | General Packet Radio Service
| 5 | EGPRS | Enhanced GPRS (EDGE)
| 4 | ECSD | Enhanced Circuit-Switched Data
| 3 | HOPPING | Frequency Hopping
| 2 | MULTI_TSC | Multi-TSC
| 1 | OML_ALERTS | OML Alerts
| 0 | AGCH_PCH_PROP | AGCH/PCH proportional allocation
.8+.| 1 | 7 | CBCH | Cell Broadcast Channel
| 6 | SPEECH_F_V1 | Fullrate speech V1
| 5 | SPEECH_H_V1 | Halfrate speech V1
| 4 | SPEECH_F_EFR | Fullrate speech EFR
| 3 | SPEECH_F_AMR | Fullrate speech AMR
| 2 | SPEECH_H_AMR | Halfrate speech AMR
| 1 | ETWS_PN | ETWS Primary Notification via PCH
| 0 | PAGING_COORDINATION | BSS Paging Coordination
.8+.| 2 | 7 | IPV6_NSVC | NSVC IPv6
| 6 | ACCH_REP | FACCH/SACCH Repetition
| 5 | CCN | Cell Change Notification
| 4 | VAMOS | Voice services over Adaptive Multi-user channels on One Slot
| 3 2.4+.| reserved for future use, sent as zero
| 2
| 1
| 0
|===
=== A-bis OML Initialization / BTS bring-up
At the time an Abis/IP BTS connects to via OML to the BSC, it is
initialized according to the procedures described in 3GPP TS 12.21 as
initialized according to the procedures described in 3GPP TS 52.021 as
amended by this document.
Each Managed Object (MO) is separately initialized. The initialization

View File

@ -3,16 +3,16 @@
=== List of Messages
The following tables list the RSL messages used by OsmoBTS A-bis/IP,
grouped by their level of compliance with 3GPP TS 08.58.
grouped by their level of compliance with 3GPP TS 48.058.
==== Messages Compliant With TS 08.58
==== Messages Compliant With TS 48.058
Specific additions and limitations apply, see the linked sections.
.Messages compliant with TS 08.58
.Messages compliant with TS 48.058
[options="header",cols="10%,20%,45%,5%,20%"]
|===
| TS 08.58 § | This document § | Message | <-/-> | Received/Sent by OsmoBTS
| TS 48.058 § | This document § | Message | <-/-> | Received/Sent by OsmoBTS
5+<| *Radio link layer management messages*
| 8.3.1 | - | DATA REQUEST | <- | Received
| 8.3.2 | - | DATA INDICATION | -> | Sent
@ -59,7 +59,7 @@ Specific additions and limitations apply, see the linked sections.
==== Messages Specific to OsmoBTS
.Messages specific to OsmoBTS, not found in 3GPP TS 08.58
.Messages specific to OsmoBTS, not found in 3GPP TS 48.058
[options="header",cols="15%,15%,45%,5%,20%"]
|===
2+| This document § | Message | <-/-> | Received/Sent by OsmoBTS
@ -87,10 +87,10 @@ Specific additions and limitations apply, see the linked sections.
==== Messages Not Implemented by OsmoBTS
.3GPP TS 08.58 messages not implemented by OsmoBTS
.3GPP TS 48.058 messages not implemented by OsmoBTS
[options="header",cols="10%,90%"]
|===
| TS 08.58 § | Message
| TS 48.058 § | Message
2+<| *DEDICATED CHANNEL MANAGEMENT MESSAGES*
| 8.4.12 | PHYSICAL CONTEXT REQUEST
| 8.4.13 | PHYSICAL CONTEXT CONFIRM
@ -123,7 +123,7 @@ Specific additions and limitations apply, see the linked sections.
==== Channel Activation
When used on a timeslot using the non-standard channel combination
'NM_CHANC_OSMO_TCHFull_TCHHalf_PDCH' as configured by OML, the regular
'NM_CHANC_OSMO_DYN' as configured by OML, the regular
RSL channel activation procedures can not only be used for activation
of circuit-switched channels, but also for activation of a PDCH.
@ -135,24 +135,24 @@ dynamic PDCH protocol employed by nanoBTS devices (<<ipa_style_pdch_mgmt>>).
[[MEASUREMENT_RESULT]]
==== Measurement Result
Conforms to 3GPP TS 08.58 § 8.4.8 with this limitation:
Conforms to 3GPP TS 48.058 § 8.4.8 with this limitation:
._Measurement Result_ IE limitations
[options="header",cols="10%,30%,60%"]
|===
| TS 08.58 § | IE Name | Handling
| TS 48.058 § | IE Name | Handling
| 9.3.37 | MS Timing Offset | never sent by OsmoBTS
|===
[[MODE_MODIFY]]
==== Mode Modify
Conforms to 3GPP TS 08.58 § 8.4.9 with these limitations:
Conforms to 3GPP TS 48.058 § 8.4.9 with these limitations:
._Mode Modify_ IE limitations
[options="header",cols="10%,30%,60%"]
|===
| TS 08.58 § | IE Name | Handling
| TS 48.058 § | IE Name | Handling
| 9.3.45 | Main channel reference | _ignored_
| 9.3.53 | MultiRate Control | _ignored_
| 9.3.54 | Supported Codec Types | _ignored_
@ -161,12 +161,12 @@ Conforms to 3GPP TS 08.58 § 8.4.9 with these limitations:
[[MS_POWER_CONTROL]]
==== MS Power Control
Conforms to 3GPP TS 08.58 § 8.4.15 with these limitations:
Conforms to 3GPP TS 48.058 § 8.4.15 with these limitations:
._MS Power Control_ IE limitations
[options="header",cols="10%,30%,60%"]
|===
| TS 08.58 § | IE Name | Handling
| TS 48.058 § | IE Name | Handling
| 9.3.31 | MS Power Parameters | _ignored_
|===
@ -174,12 +174,12 @@ Conforms to 3GPP TS 08.58 § 8.4.15 with these limitations:
[[SACCH_INFO_MODIFY]]
==== SACCH Info Modify
Conforms to 3GPP TS 08.58 § 8.4.20, with these exceptions:
Conforms to 3GPP TS 48.058 § 8.4.20, with these exceptions:
._SACCH Info Modify_ IE limitations
[options="header",cols="10%,30%,60%"]
|===
| TS 08.58 § | IE Name | Handling
| TS 48.058 § | IE Name | Handling
| 9.3.30 | System Info Type | See below for available types
| 9.3.23 | Starting Time | not supported, provokes an _Error Report_ response
|===
@ -192,6 +192,7 @@ Conforms to 3GPP TS 08.58 § 8.4.20, with these exceptions:
| 0x06 | RSL_SYSTEM_INFO_6
| 0x0d | RSL_SYSTEM_INFO_5bis
| 0x0e | RSL_SYSTEM_INFO_5ter
| 0x0f | RSL_SYSTEM_INFO_10
| 0x47 | RSL_EXT_MEAS_ORDER
| 0x48 | RSL_MEAS_INFO
|===
@ -199,12 +200,12 @@ Conforms to 3GPP TS 08.58 § 8.4.20, with these exceptions:
[[BCCH_INFORMATION]]
==== BCCH Information
Conforms to 3GPP TS 08.58 § 8.5.1, with these limitations and extensions:
Conforms to 3GPP TS 48.058 § 8.5.1, with these limitations and extensions:
._BCCH Information_ IE details
[options="header",cols="10%,30%,60%"]
|===
| TS 08.58 § | IE Name | Handling
| TS 48.058 § | IE Name | Handling
| 9.3.30 | System Info Type | See <<SACCH_INFO_MODIFY>> for available types
| 9.3.11 | L3 Info | This IE may be included instead of a 9.3.39 _Full BCCH Info_ IE.
The _Full BCCH Info_ takes precedence over _L3 Info_.
@ -215,12 +216,12 @@ Conforms to 3GPP TS 08.58 § 8.5.1, with these limitations and extensions:
[[CHANNEL_REQUIRED]]
==== Channel Required
Conforms to 3GPP TS 08.58 § 8.5.3, with these limitations:
Conforms to 3GPP TS 48.058 § 8.5.3, with these limitations:
._Channel Required_ message IE details
[options="header",cols="10%,30%,60%"]
|===
| TS 08.58 § | IE Name | Handling
| TS 48.058 § | IE Name | Handling
| 9.3.16 | Physical Context | never sent by OsmoBTS
|===
@ -228,12 +229,12 @@ Conforms to 3GPP TS 08.58 § 8.5.3, with these limitations:
[[PAGING_COMMAND]]
==== Paging Command
Conforms to 3GPP TS 08.58 § 8.5.5, with these limitations:
Conforms to 3GPP TS 48.058 § 8.5.5, with these limitations:
._Paging Command_ message IE details
[options="header",cols="10%,30%,60%"]
|===
| TS 08.58 § | IE Name | Handling
| TS 48.058 § | IE Name | Handling
| 9.3.49 | eMLPP Priority | _ignored_
|===
@ -244,28 +245,28 @@ in any way.
[[RF_RESOURCE_INDICATION]]
==== RF Resource Indication
This message does not conform to 3GPP TS 08.58 § 8.6.1, in that it omits the
_Resource Information_ IE that would contain the actual payload data, which
renders this message void.
For all osmo-bts variants, except osmo-bts-trx, this message does not conform
to 3GPP TS 48.058 § 8.6.1, in that it omits the _Resource Information_ IE that
would contain the actual payload data, which renders this message void.
._RF Resource Indication_ message IE exceptions
[options="header",cols="10%,30%,60%"]
|===
| TS 08.58 § | IE Name | Handling
| 9.3.21 | Resource Information | OsmoBTS omits this IE, though TS 08.58
specifies it as mandatory.
| TS 48.058 § | IE Name | Handling
| 9.3.21 | Resource Information | DSP based osmo-bts variants omit this IE, though
TS 48.058 specifies it as mandatory.
|===
[[SACCH_FILLING]]
==== SACCH Filling
Conforms to 3GPP TS 08.58 § 8.6.2, with these limitations:
Conforms to 3GPP TS 48.058 § 8.6.2, with these limitations:
._SACCH Filling_ message IE limitations
[options="header",cols="10%,30%,60%"]
|===
| TS 08.58 § | IE Name | Handling
| TS 48.058 § | IE Name | Handling
| 9.3.30 | System Info Type | See <<SACCH_INFO_MODIFY>> for available types
| 9.3.23 | Starting Time | _ignored_
|===
@ -275,7 +276,7 @@ Conforms to 3GPP TS 08.58 § 8.6.2, with these limitations:
=== User Plane Transport Management
This chapter defines the A-bis/IP specific RSL procedures that are
introduced in addition to the 3GPP TS 08.58 standard procedures.
introduced in addition to the 3GPP TS 48.058 standard procedures.
In classic A-bis over E1, user plane traffic is carried over 16kBps
sub-slots of 64kBps E1 time-slots according to ETSI/3GPP TS 08.60. As
@ -417,16 +418,16 @@ include::dyn_ts_ipa_style2.msc[]
==== Osmocom Style Dynamic Channels
This method is in use when OML uses
'NM_CHANC_OSMO_TCHFull_TCHHalf_PDCH' (0x90) for the given time-slot.
'NM_CHANC_OSMO_DYN' (0x90) for the given time-slot.
The activation of PDCH is performed by using the regular 'RSL CHANNEL ACTIVATE'
procedure according to <<CHANNEL_ACTIVATION>>, with these modifications:
* The 'C-bits' part of the 'Channel Number' IE take the non-standard binary
value 11000 (C5 through C1 as seen in 3GPP TS 08.58 § 9.3.1).
value 11000 (C5 through C1 as seen in 3GPP TS 48.058 § 9.3.1).
* The 'A-bits' part of the 'Activation Type' IE take the non-standard binary
value 1111, with an additional fourth bit (add A4 to A3 through A1 as seen in
3GPP TS 08.58 § 9.3.3; all remaining reserved bits as well as the 'R' bit are
3GPP TS 48.058 § 9.3.3; all remaining reserved bits as well as the 'R' bit are
coded as zero).
* The normally mandatory 'Channel Mode' IE is omitted; none of the optional IEs
are included.
@ -436,7 +437,7 @@ Hence the message consists of exactly these IEs:
.PDCH type _Channel Activation_ message IEs
[options="header",cols="10%,30%,60%"]
|===
| TS 08.58 § | IE Name | Handling
| TS 48.058 § | IE Name | Handling
| 9.1 | Message discriminator | Dedicated Channel Management
| 9.2 | Message type | CHANnel ACTIVation
| 9.3.1 | Channel number | 'C-bits' 11000, plus TS bits as usual
@ -476,6 +477,26 @@ signaling for it.
See <<OSMO_ETWS_CMD>> for the Osmocom implementation.
=== BCCH carrier power reduction operation
According to 3GPP TS 45.008, section 7.1, the BCCH carrier (sometimes called C0) of
a BTS shall maintain discontinuous Downlink transmission at full power in order to
stay "visible" to the mobile stations. Because of that, early versions of this 3GPP
document prohibited BS power reduction on C0. However, a new feature was introduced
version 13.0.0 (2015-11) - "BCCH carrier power reduction operation".
This is a special mode of operation, in which the variation of RF power level for
some timeslots is relaxed for the purpose of energy saving. In other words, the
output power on some timeslots, except the timeslot(s) carrying BCCH/CCCH, can be
lower than the full power. In this case the maximum allowed difference is 6 dB.
Unfortunately, 3GPP did not specify in which way the BTS is instructed to activate
and deactivate the BCCH carrier power reduction mode. Osmocom had to invent their
own non-standard approach: the BSC needs to send _BS POWER CONTROL_ message with
the _Channel Number_ IE set to 0x80 (BCCH) and the _Message Discriminator_ set to
0x06 (Common Channel Management messages).
=== Message Formats and Contents
[[rsl_crcx_msg]]
@ -488,14 +509,15 @@ number*.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
| Destination IP Address | <<RSL_IE_IPAC_REMOTE_IP>> | O | TV | 5
| Destination IP Port | <<RSL_IE_IPAC_REMOTE_PORT>> | O | TV | 3
| IP Speech Mode | <<RSL_IE_IPAC_SPEECH_MODE>> | O | TV | 2
| RTP Payload Type 2 | <<RSL_IE_IPAC_RTP_PAYLOAD2>> | O | TV | 2
| RTP CSD Format | <<RSL_IE_IPAC_RTP_CSD_FORMAT>> | O | TV | 2
|===
[[rsl_crcx_msg_ack]]
@ -508,10 +530,10 @@ in response to the *Create Connection (CRCX)*.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
| Connection Id | <<RSL_IE_IPAC_CONN_ID>> | M | TV | 3
| Source IP Address | <<RSL_IE_IPAC_LOCAL_IP>> | O | TV | 5
| Source IP Port | <<RSL_IE_IPAC_LOCAL_PORT>> | O | TV | 3
@ -528,13 +550,13 @@ sent in response to the *Create Connection (CRCX)*.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
| Destination IP Address | <<RSL_IE_IPAC_REMOTE_IP>> | O | TV | 5
| Destination IP Port | <<RSL_IE_IPAC_REMOTE_PORT>> | O | TV | 3
| Cause | 08.58 9.3.26 | O | TLV | >= 3
| Cause | 48.058 9.3.26 | O | TLV | >= 3
|===
@ -547,15 +569,16 @@ properties of a user-plane RTP connection.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
| Connection Id | <<RSL_IE_IPAC_CONN_ID>> | O | TV | 3
| Destination IP Address | <<RSL_IE_IPAC_REMOTE_IP>> | O | TV | 5
| Destination IP Port | <<RSL_IE_IPAC_REMOTE_PORT>> | O | TV | 3
| IP Speech Mode | <<RSL_IE_IPAC_SPEECH_MODE>> | O | TV | 2
| RTP Payload Type 2 | <<RSL_IE_IPAC_RTP_PAYLOAD2>> | O | TV | 2
| RTP CSD Format | <<RSL_IE_IPAC_RTP_CSD_FORMAT>> | O | TV | 2
|===
[[rsl_mdcx_msg_ack]]
@ -568,10 +591,10 @@ response to a *Modify Connection (MDCX)*
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
| Connection Id | <<RSL_IE_IPAC_CONN_ID>> | O | TV | 3
| Source IP Address | <<RSL_IE_IPAC_LOCAL_IP>> | C | TV | 5
| Source IP Port | <<RSL_IE_IPAC_LOCAL_PORT>> | C | TV | 3
@ -589,11 +612,11 @@ Connection (MDCX)*.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Cause | 08.58 9.3.26 | M | TLV | >= 3
| Channel number | 48.058 9.3.1 | M | TV | 2
| Cause | 48.058 9.3.26 | M | TLV | >= 3
|===
[[rsl_dlcx_ind_msg]]
@ -606,13 +629,13 @@ time of RF Channel release.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
| Connection Id | <<RSL_IE_IPAC_CONN_ID>> | M | TV | 3
| Connection Id | <<RSL_IE_IPAC_CONN_STAT>> | M | TV | 3
| Cause | 08.58 9.3.26 | M | TLV | >= 3
| Cause | 48.058 9.3.26 | M | TLV | >= 3
|===
[[rsl_dlcx_msg]]
@ -625,10 +648,10 @@ number.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
| Connection Id | <<RSL_IE_IPAC_CONN_ID>> | O | TV | 3
|===
@ -643,10 +666,10 @@ Channel number. It is sent in response to the *Delete Connection
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
| Connection Id | <<RSL_IE_IPAC_CONN_ID>> | O | TV | 3
| Connection Statistics | <<RSL_IE_IPAC_CONN_STAT>> | C | TV | 29
|===
@ -662,12 +685,12 @@ Channel number. It is sent in response to the *Delete Connection
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
| Connection Id | <<RSL_IE_IPAC_CONN_ID>> | O | TV | 3
| Cause | 08.58 9.3.26 | M | TLV | >= 3
| Cause | 48.058 9.3.26 | M | TLV | >= 3
|===
[[rsl_pdch_act]]
@ -679,10 +702,10 @@ a IPA style dynamic TCH/F+PDCH channel.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
|===
NOTE:: This message is *not* used by Osmocom style dynamic channels
@ -696,11 +719,11 @@ of a PDCH on a IPA style dynamic TCH/F+PDCH channel.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Frame Number | 08.58 9.3.8 | O | TV | 3
| Channel number | 48.058 9.3.1 | M | TV | 2
| Frame Number | 48.058 9.3.8 | O | TV | 3
|===
NOTE:: This message is *not* used by Osmocom style dynamic channels
@ -714,11 +737,11 @@ of a PDCH on a IPA style dynamic TCH/F+PDCH channel.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Cause | 08.58 9.3.26 | M | TLV | >= 3
| Channel number | 48.058 9.3.1 | M | TV | 2
| Cause | 48.058 9.3.26 | M | TLV | >= 3
|===
NOTE:: This message is *not* used by Osmocom style dynamic channels
@ -732,10 +755,10 @@ on a IPA style dynamic TCH/F+PDCH channel.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
|===
NOTE:: This message is *not* used by Osmocom style dynamic channels
@ -749,10 +772,10 @@ of a PDCH on a IPA style dynamic TCH/F+PDCH channel.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Channel number | 48.058 9.3.1 | M | TV | 2
|===
NOTE:: This message is *not* used by Osmocom style dynamic channels
@ -766,11 +789,11 @@ on a IPA style dynamic TCH/F+PDCH channel.
[options="header"]
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| Cause | 08.58 9.3.26 | M | TLV | >= 3
| Channel number | 48.058 9.3.1 | M | TV | 2
| Cause | 48.058 9.3.26 | M | TLV | >= 3
|===
NOTE:: This message is *not* used by Osmocom style dynamic channels
@ -794,10 +817,10 @@ The Channel Number IE is set to the Downlink CCCH (PCH).
[cols="30%,25%,15%,15%,15%"]
|===
| INFORMATION ELEMENT | REFERENCE | PRESENCE | FORMAT | LENGTH
| Message discriminator | 08.58 9.1 | M | V | 1
| Message discriminator | 48.058 9.1 | M | V | 1
| Message type | <<own_msg_types>> | M | V | 1
| Channel number | 08.58 9.3.1 | M | TV | 2
| SMSCB Message | 08.58 9.3.42 | M | TLV | 2-58
| Channel number | 48.058 9.3.1 | M | TV | 2
| SMSCB Message | 48.058 9.3.42 | M | TLV | 2-58
|===
@ -807,7 +830,7 @@ The Channel Number IE is set to the Downlink CCCH (PCH).
==== A-bis/IP specific RSL Message discriminators
The following message discriminators are used in addition to those
indicated in 3GPP TS 08.58 Section 9.1:
indicated in 3GPP TS 48.058 Section 9.1:
.OsmoBTS specific new message discriminators
[options="header",cols="10%,50%,40%"]
@ -835,7 +858,7 @@ indicated in 3GPP TS 08.58 Section 9.1:
==== A-bis/IP specific RSL IEIs
The following Information Element Identifiers (IEIs) are used in
addition to those indicated in 3GPP TS 08.58 Section 9.3:
addition to those indicated in 3GPP TS 48.058 Section 9.3:
.A-bis/IP specific information elements
[options="header",cols="10%,50%,40%"]
@ -843,30 +866,44 @@ addition to those indicated in 3GPP TS 08.58 Section 9.3:
| IEI | Name | This document §
| 0x01 | RSL_IE_CHAN_NR | <<RSL_IE_CHAN_NR>>
| 0x60 | RSL_IE_OSMO_REP_ACCH_CAP | <<RSL_IE_OSMO_REP_ACCH_CAP>>
| 0xf0 | RSL_IE_IPAC_REMOTE_IP | <<RSL_IE_IPAC_REMOTE_IP>>
| 0x61 | RSL_IE_OSMO_TRAINING_SEQUENCE | <<RSL_IE_OSMO_TRAINING_SEQUENCE>>
| 0xf0 | RSL_IE_IPAC_REMOTE_IP | <<RSL_IE_IPAC_REMOTE_IP>>
| 0xf1 | RSL_IE_IPAC_REMOTE_PORT | <<RSL_IE_IPAC_REMOTE_PORT>>
| 0xf3 | RSL_IE_IPAC_LOCAL_PORT | <<RSL_IE_IPAC_LOCAL_PORT>>
| 0xf4 | RSL_IE_IPAC_SPEECH_MODE | <<RSL_IE_IPAC_SPEECH_MODE>>
| 0xf5 | RSL_IE_IPAC_LOCAL_IP | <<RSL_IE_IPAC_LOCAL_IP>>
| 0xf6 | RSL_IE_IPAC_CONN_STAT | <<RSL_IE_IPAC_CONN_STAT>>
| 0xf8 | RSL_IE_IPAC_CONN_ID | <<RSL_IE_IPAC_CONN_ID>>
| 0xf9 | RSL_IE_IPAC_RTP_CSD_FORMAT | <<RSL_IE_IPAC_RTP_CSD_FORMAT>>
| 0xfc | RSL_IE_IPAC_RTP_PAYLOAD2 | <<RSL_IE_IPAC_RTP_PAYLOAD2>>
|===
[[RSL_IE_CHAN_NR]]
==== RSL_IE_CHAN_NR
This information element is coded like 3GPP TS 08.58 Section 9.3.1,
but in addition supports the following extended coding:
This information element is coded as described in 3GPP TS 48.058 Section 9.3.1,
but in addition supports the following vendor specific values:
* C5..C1 bits 0b11000 for PDCH type channels
.RSL Channel Number extensions
[options="header",cols="5%,5%,5%,5%,5%,75%"]
|===
| C5 | C4 | C3 | C2 | C1 | Description
| 1 | 1 | 0 | 0 | 0 | PDCH `<1>`
| 1 | 1 | 0 | 0 | 1 | CBCH on SDCCH4
| 1 | 1 | 0 | 1 | 0 | CBCH on SDCCH8
| 1 | 1 | 1 | 0 | 1 | VAMOS TCH/F `<2>`
| 1 | 1 | 1 | 1 | T | VAMOS TCH/H `<2>`
|===
`<1>` This extension is only valid on an Osmocom-style dynamic channel, having
configured the 'NM_CHANC_IPAC_TCHFull_PDCH' channel combination by OML.
`<2>` These Osmocom specific values are used by osmo-bsc to address logical
channels on the shadow timeslots in VAMOS mode, iff the BTS is an osmo-bts
and VAMOS capable.
The TN-Bits are not re-defined in this case but use the same encoding
as specified in TS 08.58 Section 9.3.1.
as specified in TS 48.058 Section 9.3.1.
NOTE:: The above extension is only valid on an Osmocom-style dynamic
channel, having configured the 'NM_CHANC_IPAC_TCHFull_PDCH' channel
combination by OML.
[[RSL_IE_IPAC_REMOTE_IP]]
==== RSL_IE_IPAC_REMOTE_IP
@ -920,8 +957,8 @@ IEI followed by four bytes IPv4 address.
This information element contains statistics about the RTP connection.
It is encoded as 29 bytes, with the first byte as IEI and 28 bytes
fixed-length payload encoded as follows:
It is encoded as 30 bytes, with the first byte as IEI, the second byte as length
(=28), and 28 bytes fixed-length payload encoded as follows:
.A-bis/IP Connection Statistics
[options="header",width="60%",cols="15%,15%,70%"]
@ -979,6 +1016,112 @@ If the IE is not present, then ACCH repetition completely is disabled.
(Bits 7 is reserved for future use and must be set to zero.)
[[RSL_IE_OSMO_TRAINING_SEQUENCE]]
==== RSL_IE_OSMO_TRAINING_SEQUENCE
This TLV IE instructs the BTS to use a specific training sequence set and
training sequence code for a given lchan. It is sent by OsmoBSC in RSL CHANNEL
ACTIVATION and MODE MODIFY messages to the BTS, iff the BTS is VAMOS-capable,
i.e. if an Abis-over-IP connected BTS indicated BTS_FEAT_VAMOS in the OML BTS
features (Manufacturer Id information element, see <<NM_ATT_MANUF_ID>>).
If this information element is present, the receiver shall ignore any other
training sequence set and training sequence code bits from other information
elements of the same RSL message.
This is an Osmocom-specific extension of the RSL layer, which was added to
express more than two TSC sets. For VAMOS operation, OsmoBSC selects from one
of four separate training sequence codings per modulation scheme, while usual
RSL IEs are only able to express a single-bit TSC set number. For clarity, this
IE contains both the TSC set and the TSC in one IE, and is defined as
overruling any other IEs containing TSC or TSC set numbers.
The first value octet indicates the training sequence set, and the second octet
indicates the training sequence code to be used. Receiving values from a
reserved value range should be considered an error condition.
.RSL_IE_OSMO_TRAINING_SEQUENCE
[options="header",width="80%",cols="20%,80%"]
|===
| IE octet | value
| octet 1 | RSL_IE_OSMO_TRAINING_SEQUENCE IEI (0x61)
| octet 2 | length of the value part (2)
| octet 3 | TSC set
| octet 4 | TSC
|===
The training sequence set (TSC set) is coded like the 'CS Domain TSC Set' bits,
as defined in the 'Extended TSC Set' IE in 3GPP TS 44.018 10.5.2.82
<<3gpp-ts-44-018>>, and corresponds to the 'TSC Set' as defined in 3GPP TS
45.002 <<3gpp-ts-45-002>>. The encoded training sequence set number ranges from
0 to 3, any other values are reserved for future use. The encoded 0 corresponds
to TSC Set 1, see <<RSL_IE_OSMO_TRAINING_SEQUENCE__TSC_set_coding>>.
[[RSL_IE_OSMO_TRAINING_SEQUENCE__TSC_set_coding]]
.TSC set (octet 3) coding
[options="header",width="80%",cols="20%,80%"]
|===
| octet 3 value | interpretation
| 0 | 'TSC Set 1' as in 3GPP TS 45.002
| 1 | 'TSC Set 2'
| 2 | 'TSC Set 3'
| 3 | 'TSC Set 4'
| 4..255 | reserved values
|===
The training sequence code (TSC) corresponds to the 'TSC' bits as defined in
the 'Channel Description 2' IE in 3GPP TS 44.018 10.5.2.5a <<3gpp-ts-44-018>>.
The training sequence code ranges from 0 to 7, any other values are reserved
for future use.
.TSC (octet 4) coding
[options="header",width="80%",cols="20%,80%"]
|===
| octet 4 value | interpretation
| 0 | 'Training Sequence Code (TSC) 0' as in 3GPP TS 45.002
| 1 | 'Training Sequence Code (TSC) 1'
| 2 | 'Training Sequence Code (TSC) 2'
| 3 | 'Training Sequence Code (TSC) 3'
| 4 | 'Training Sequence Code (TSC) 4'
| 5 | 'Training Sequence Code (TSC) 5'
| 6 | 'Training Sequence Code (TSC) 6'
| 7 | 'Training Sequence Code (TSC) 7'
| 8..255 | reserved values
|===
[[RSL_IE_IPAC_RTP_CSD_FORMAT]]
==== RSL_IE_IPAC_RTP_CSD_FORMAT
This information element contains the RTP Circuit Switched Data format.
.A-bis/IP RTP CSD Format
[options="header",width="60%",cols="15%,15%,70%"]
|===
| Offset | Size | Description
| 0 | 4 | RTP CSD Format D
| 4 | 4 | RTP CSD Format IR
|===
.A-bis/IP RTP CSD Format D Values
[options="header",width="40%",cols="20%,80%"]
|===
| Value | Description
| 0 | External TRAU format
| 1 | Non-TRAU Packed format
| 2 | TRAU within the BTS
| 3 | IWF-Free BTS-BTS Data
|===
.A-bis/IP RTP CSD Format IR Values
[options="header",width="40%",cols="20%,80%"]
|===
| Value | Description
| 0 | 8 kb/s
| 1 | 16 kb/s
| 2 | 32 kb/s
| 3 | 48 kb/s
|===
=== A-bis RSL Initialization / BTS bring-up
Upon receiving the 'IPA RSL CONNECT' OML message by the respective
@ -1003,4 +1146,3 @@ The initialization of the primary and secondary TRX slightly differ, as
illustrated by the differences of <<rsl-msc-pri>> and <<rsl-msc-sec>>.
Since the secondary TRX has no BCCH, it does not (need to) receive any 'RSL
BCCH INFORMATION' messages from the BSC.

View File

@ -82,13 +82,13 @@ order to specify which PHY instance is allocated to this specific TRX.
| bts-specific | bts_model_phy_instance_set_defaults() | Called for every PHY Instance created
| common | bts_controlif_setup() | Initialization of Control Interface
| bts-specific | bts_model_ctrl_cmds_install() | Install model-specific control interface commands
| common | telnet_init() | Initialization of telnet interface
| common | telnet_init_default() | Initialization of telnet interface
| common | pcu_sock_init() | Initialization of PCU socket
| common | main() | Installation of signal handlers
| common | abis_open() | Start of the A-bis connection to BSC
| common | phy_links_open() | Iterate over list of configured PHY links
| bts-specific | bts_model_phy_link_open() | Open each of the configured PHY links
| common | write_pid_file() | Generate the pid file
| bts-specific | bts_model_phy_link_close() | Close each of the configured PHY links
| common | osmo_daemonize() | Fork as daemon in background (if configured)
| common | bts_main() | Run main loop until global variable quit >= 2
|===

View File

@ -19,7 +19,7 @@ The OsmoBTS executables (`osmo-bts-sysmo`, `osmo-bts-trx`,
generic command line options:
==== SYNOPSIS
*osmo-bts-sysmo* [-h|-V] [-d 'DBGMASK'] [-D] [-c 'CONFIGFILE' ] [-s] [-T] [-e 'LOGLEVEL'] [-r 'PRIO'] [-i 'GSMTAP-IP'] [-t <1-255>]
*osmo-bts-sysmo* [-h|-V] [-d 'DBGMASK'] [-D] [-c 'CONFIGFILE' ] [-s] [-T] [-e 'LOGLEVEL']
==== OPTIONS
*-h, --help*::
@ -48,16 +48,6 @@ generic command line options:
Set the global log level for logging to stderr. This has mostly
been deprecated by VTY based logging configuration, see
<<logging>> for further information.
*-r, --realtime 'PRIO'*::
Enable use of the Linux kernel realtime priority scheduler with
the specified priority.
It is recommended you use this option on low-performance
embedded systems or systems that encounter high non-GSM/GPRS
load.
*-i, --gsmtap-ip 'GSMTAP-IP'*::
Specify the destination IP address for GSMTAP messages.
*-t, --trx-num <1-255>*::
Specify the number of TRX supported by this BTS.
There may be additional, hardware specific command line options by the
different bts_model implementations.
@ -118,11 +108,22 @@ them via UDP/IP. At that point, they can be captured with utilities like
*tcpdump* or *tshark* for further analysis by the *wireshark* protocol
analyzer.
In order to activate this feature, you first need to make sure to start
OsmoBTS using the `-i` or `--gsmtap-ip` command line option, specifying
the destination IP address for the GSMTAP messages. In most cases,
using 127.0.0.1 for passing the messages over the loopback (`lo`) device
will be sufficient.
In order to activate this feature, you first need to make sure to specify
the remote address of _GSMTAP_ host in the configuration file. In most
cases, using 127.0.0.1 for passing the messages over the loopback (`lo`)
device will be sufficient:
.Example: Enabling GSMTAP Um-frame logging to localhost
----
bts 0
gsmtap-remote-host 127.0.0.1 <1>
----
<1> Destination address for _GSMTAP_ Um-frames
NOTE: Changing this parameter at run-time will not affect the existing
_GSMTAP_ connection, full program restart is required.
NOTE: Command line parameters `-i` and `--gsmtap-ip` have been deprecated.
OsmoBTS can selectively trace such messages by their L1 SAPI, for both
Rx and Tx. For a complete list of L1 SAPI values, please refer to the
@ -137,8 +138,7 @@ node of the OsmoBTS VTY.
OsmoBTS> enable
OsmoBTS# configure terminal
OsmoBTS(config)# bts 0
OsmoBTS(bts)# trx 0
OsmoBTS(trx)# gsmtap-sapi sdcch
OsmoBTS(bts)# gsmtap-sapi sdcch
OsmoBTS(trx)# write <1>
----
<1> the `write` command will make the configuration persistent in the
@ -146,12 +146,25 @@ configuration file. This is not required if you wish to enable GSMTAP
only in the current session of OsmoBTS.
De-activation can be performed similarly by using the `no gsmtap-sapi
sdcch` command at the `trx` node of the OsmoBTS VTY.
sdcch` command at the `bts` node of the OsmoBTS VTY.
It may be useful to enable all SAPIs with a few exceptions, or vice versa
disable everything using one command. For this purpose, the VTY provides
`gsmtap-sapi enable-all` and `gsmtap-sapi disable-all` commands.
.Example: Enabling all SAPIs except PDTCH and PTCCH
----
bts 0
gsmtap-sapi enable-all <1>
no gsmtap-sapi pdtch <2>
no gsmtap-sapi ptcch <2>
----
<1> Enable all available SAPIs
<2> Exclude PDTCH and PTCCH SAPIs
From the moment they are enabled via VTY, GSMTAP messages will be
generated and sent in UDP encapsulation to the IANA-registered UDP port
for GSMTAP (4729) at the IP address specified in the command line
argument.
for GSMTAP (4729) of the specified remote address.
==== Configuring power ramping

View File

@ -0,0 +1,39 @@
include::{commondir}/chapters/osmux/osmux.adoc[]
=== Osmux Support in {program-name}
Osmux usage in {program-name} in managed through the VTY commands in node
`osmux`. Command `use (on|off|only)` is used to configure use policy of Osmux
within {program-name}. Once enabled (`on` or `only`), {program-name} will
announce the _OSMUX_ BTS feature towards the BSC over OML. This way, the BSC
becomes aware that this BTS supports using Osmux to transfer voice call user
data when the AMR codec is selected.
It is then up to the BSC to decide whether to use Osmux or not when establishing
a new call. If the BSC decides to use Osmux for a given call, then the _IPACC
CRCX/MDCX_ messages sent by the BSC will contain an extra _Osmux CID_ IE
appended, which contains the Osmux CID to be used by the BTS to send Osmux
frames to the co-located BSC MGW (aka the BSC MGW' local CID, or {program-name}'
remote CID). The IP address and port provided in the same messages refer to the
address and port where Osmux frames with the provided CID are expected to be
received. Similarly, {program-name} appends an _Osmux CID_ IE to the _IPACC
CRCX/MDCX ACK_ message it generates, this time with its own local Osmux CID.
Same goes for the BTS' local IP address and port where Osmux frames are expected
to be received.
{program-name} will behave differently during call set up based on the VTY
command `use (on|off|only)` presented above:
* `off`: If _IPACC CRCX_ from BSC contains _Osmux CID_ IE, meaning
BSC wants to use Osmux for this call, then {program-name} will reject the
request and the call set up will fail.
* `on`: {program-name} will support and accept both Osmux and non-Osmux (RTP)
upon call set up. If _IPACC CRCX_ from BSC contains the _Osmux CID_ IE on a
AMR call (`Channel Mode GSM3`), it will set up an Osmux stream on its end and
provide the BSC with the BTS-local CID. If the BSC provides no _Osmux CID_ IE,
then {program-name} will set up a regular RTP based call.
* `only`: Same as per `on`, except that {program-name} will accept only Osmux
calls on the CN-side, this is, if _IPACC CRCX_ from BSC doesn't
contain an _Osmux CID_ IE, it will reject the assignment and the call set up
will fail. This means also that only AMR calls (`Channel Mode GSM3`) are
allowed.

View File

@ -0,0 +1,50 @@
==== Full example of QoS for osmo-bts uplink QoS
In the below example we will show the full set of configuration required
for both DSCP and PCP differentiation of uplink Abis traffic by osmo-bts.
What we want to achieve in this example is the following configuration:
.DSCP and PCP assignments for osmo-bts uplink traffic in this example
[options="header",width="30%",cols="2,1,1"]
|===
|Traffic |DSCP|PCP
|A-bis RSL | 56| 7
|A-bis RTP | 46| 6
|A-bis OML | 34| 5
|===
. configure the osmocom program to set the DSCP value
. configure an egrees QoS map to map from priority to PCP
.Example Step 1: add related VTY configuration to `osmo-bts.cfg`
----
...
e1_input
ipa ip-dscp oml 34
ipa socket-priority oml 5
ipa ip-dscp rsl 56
ipa socket-priority rsl 7
...
bts 0
rtp ip-dscp 46
rtp socket-priority 6
...
----
.Example Step 2: egress QoS map to map from socket priority to PCP values
----
$ sudo ip link set dev eth0.9<1> type vlan egress-qos-map 0:0 1:1 5:5 6:6 7:7 <2>
----
<1> make sure to specify your specific VLAN interface name here instead of `eth0.9`.
<2> create a egress QoS map that maps the priority value 1:1 to the PCP. We also include the
mapping 1:1 from the osmo-pcu example (see <<userman-osmopcu>>) here.
NOTE:: The settings of the `ip` command are volatile and only active until
the next reboot (or the network device or VLAN is removed). Please refer to
the documentation of your specific Linux distribution in order to find out how
to make such settings persistent by means of an `ifup` hook whenever the interface
comes up. For CentOS/RHEL 8 this can e.g. be achieved by means of an `/sbin/ifup-local
script` (when using `network-scripts` and not NetworkManager). For Debian or Ubuntu,
this typically involves adding `up` lines to `/etc/network/interfaces` or a `/etc/network/if-up.d`
script.

View File

@ -1,39 +1,3 @@
<revhistory>
<revision>
<revnumber>1</revnumber>
<date>December 2015</date>
<authorinitials>NJH, HW</authorinitials>
<revremark>
Initial version, reflecting OsmoBTS master branch as on 2015-Dec-7
(commit e28a20a2d9d049cd6312e218a7646593bbc43431).
</revremark>
</revision>
<revision>
<revnumber>2</revnumber>
<date>February 2016</date>
<authorinitials>HW</authorinitials>
<revremark>
Updated version with Message Sequence Chart of OML and RSL bring-up.
</revremark>
</revision>
<revision>
<revnumber>2.1</revnumber>
<date>February 2016</date>
<authorinitials>HW</authorinitials>
<revremark>
Fix A-bis OML/RSL port number swap in message seqeuence charts.
</revremark>
</revision>
<revision>
<revnumber>2.2</revnumber>
<date>July 2016</date>
<authorinitials>NJH, HW</authorinitials>
<revremark>
Add description on Dynamic Channel Configuration in OML and activation in RSL.
</revremark>
</revision>
</revhistory>
<authorgroup>
<author>
@ -61,7 +25,7 @@
</authorgroup>
<copyright>
<year>2015-2016</year>
<year>2015-2021</year>
<holder>sysmocom - s.f.m.c. GmbH</holder>
</copyright>

View File

@ -87,6 +87,8 @@ include::{srcdir}/abis/rtp.adoc[]
include::./common/chapters/port_numbers.adoc[]
include::./common/chapters/bibliography.adoc[]
include::./common/chapters/glossary.adoc[]
include::./common/chapters/gfdl.adoc[]

View File

@ -1,14 +1,3 @@
<revhistory>
<revision>
<revnumber>1</revnumber>
<date>January 2016</date>
<authorinitials>HW</authorinitials>
<revremark>
Initial version, reflecting OsmoBTS master branch as on FIXME
(commit FIXME).
</revremark>
</revision>
</revhistory>
<authorgroup>
<author>
@ -25,7 +14,7 @@
</authorgroup>
<copyright>
<year>2016</year>
<year>2016-2021</year>
<holder>sysmocom - s.f.m.c. GmbH</holder>
</copyright>

View File

@ -1,4 +1,5 @@
:gfdl-enabled:
:program-name: OsmoBTS
OsmoBTS User Manual
===================
@ -30,6 +31,10 @@ include::{srcdir}/chapters/bts-models.adoc[]
include::{srcdir}/chapters/architecture.adoc[]
include::{srcdir}/chapters/osmux_bts.adoc[]
include::./common/chapters/qos-dscp-pcp.adoc[]
include::./common/chapters/vty_cpu_sched.adoc[]
include::./common/chapters/trx_if.adoc[]

View File

@ -1,29 +1,3 @@
<revhistory>
<revision>
<revnumber>1</revnumber>
<date>October 2016</date>
<authorinitials>HW</authorinitials>
<revremark>
Initial version
</revremark>
</revision>
<revision>
<revnumber>2</revnumber>
<date>November 2016</date>
<authorinitials>MS</authorinitials>
<revremark>
FSM added
</revremark>
</revision>
<revision>
<revnumber>3</revnumber>
<date>July 2017</date>
<authorinitials>PE</authorinitials>
<revremark>
Add section and update sequence charts to describe requirement to receive all PH-DATA.ind events
</revremark>
</revision>
</revhistory>
<authorgroup>
<author>
@ -51,7 +25,7 @@
</authorgroup>
<copyright>
<year>2016</year>
<year>2016-2021</year>
<holder>sysmocom - s.f.m.c. GmbH</holder>
</copyright>

View File

@ -1 +1,26 @@
<vtydoc xmlns='urn:osmocom:xml:libosmocore:vty:doc:1.0'/>
<!-- ex:ts=2:sw=2:et -->
<vtydoc xmlns='urn:osmocom:xml:libosmocore:vty:doc:1.0'>
<node id='phy-inst'>
<!-- FIXME: This command appears twice for some reason. -->
<command id='osmotrx maxdly &lt;0-63&gt;'>
<description>
Access Burst is the first burst a mobile transmits in order to establish a connection and it
is used to estimate Timing Advance (TA) which is then applied to Normal Bursts to compensate
for signal delay due to distance. So changing this setting effectively changes maximum range
of the cell, because Access Bursts with a delay higher than this value will be ignored.
</description>
</command>
<!-- FIXME: This command appears unconditionally, despite being hidden. -->
<command id='osmotrx maxdlynb &lt;0-63&gt;'>
<description>
USE FOR TESTING ONLY, DO NOT CHANGE IN PRODUCTION USE!
During the normal operation, delay of Normal Bursts is controlled by the Timing Advance loop
and thus Normal Bursts arrive to a BTS with no more than a couple GSM symbols, which is
already taken into account in osmo-trx. Changing this setting will have no effect in
production installations except increasing osmo-trx CPU load. This setting is only useful
when testing with a transmitter which cannot precisely synchronize to the BTS downlink
signal, like R&amp;S CMD57.
</description>
</command>
</node>
</vtydoc>

View File

@ -12,12 +12,6 @@
<book>
<info>
<revhistory>
<revision>
<revnumber>v1</revnumber>
<date>13th October 2016</date>
<authorinitials>hw</authorinitials>
<revremark>Initial</revremark>
</revision>
<revision>
<revnumber>v2</revnumber>
<date>@@REV_DATE@@</date>

View File

@ -21,13 +21,12 @@ The start-up procedure of OsmoBTS can be described as follows:
| bts-specific | bts_model_phy_instance_set_defaults() | Called for every PHY Instance created
| common | bts_controlif_setup() | Initialization of Control Interface
| bts-specific | bts_model_ctrl_cmds_install()
| common | telnet_init() | Initialization of telnet interface
| common | telnet_init_default() | Initialization of telnet interface
| common | pcu_sock_init() | Initialization of PCU socket
| common | main() | Installation of signal handlers
| common | abis_open() | Start of the A-bis connection to BSC
| common | phy_links_open() | Iterate over list of configured PHY links
| bts-specific | bts_model_phy_link_open() | Open each of the configured PHY links
| common | write_pid_file() | Generate the pid file
| common | osmo_daemonize() | Fork as daemon in background (if configured)
| common | bts_main() | Run main loop until global variable quit >= 2
| bts-specific | bts_model_oml_estab() | Called by core once OML link is established

98
doc/trx_sched_tch.txt Normal file
View File

@ -0,0 +1,98 @@
== rx_tchf_fn(): TCH/FS, TCH/EFS, TCH/AFS, TCH/F2.4, and FACCH/F
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|---+---+---+---+---+---+---+---+ << 4
| | | | | | | | | | | | | | | | | | | | | a | b | c | d | Rx bid={0,1,2,3}, decode
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|---+---+---+---+---+---+---+---+ << 4
| | | | | | | | | | | | | | | | | a | b | c | d | e | f | g | h | Rx bid={0,1,2,3}, decode
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|---+---+---+---+---+---+---+---+ << 4
|
|<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>| frame A
| |<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>| frame B
@ decoding from here
== rx_tchf_fn(): TCH/F14.4, TCH/F9.6, TCH/F4.8
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 4
| | | | | | | | | | | | | | | | | | | | | a | b | c | d | Rx bid={0,1,2,3}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 4
| | | | | | | | | | | | | | | | | a | b | c | d | e | f | g | h | Rx bid={0,1,2,3}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 4
| | | | | | | | | | | | | a | b | c | d | e | f | g | h | i | j | k | l | Rx bid={0,1,2,3}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 4
| | | | | | | | | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | Rx bid={0,1,2,3}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 4
| | | | | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | Rx bid={0,1,2,3}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 4
| a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | Rx bid={0,1,2,3}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 4
|
|<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>| frame A
| |<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>| frame B
@ decoding from here
== rx_tchh_fn(): TCH/HS, TCH/AHS
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | | | | | | | | | | | a | b | | | Rx bid={0,1}, decode
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | | | | | | | | | a | b | c | d | | | Rx bid={0,1}, decode
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | | | | | | | a | b | c | d | e | f | | | Rx bid={0,1}, decode
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|---+---+---+---+---+---+---+---+ << 2
|
|<~~~~~~~~~~~~~>| frame A
| |<~~~~~~~~~~~~~>| frame B
@ decoding from here
== rx_tchh_fn(): FACCH/H
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | | | | | | | | | | | a | b | | | Rx bid={0,1}, decode
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | | | | | | | | | a | b | c | d | | | Rx bid={0,1}
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | | | | | | | a | b | c | d | e | f | | | Rx bid={0,1}, decode
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|---+---+---+---+---+---+---+---+ << 2
|
|<~~~~~~~~~~~~~~~~~~~~~>| frame A
| |<~~~~~~~~~~~~~~~~~~~~~>| frame B
@ decoding from here
== rx_tchh_fn(): TCH/H4.8, TCH/H2.4
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | | | | | | | | | | | a | b | | | Rx bid={0,1}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | | | | | | | | | a | b | c | d | | | Rx bid={0,1}
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | | | | | | | a | b | c | d | e | f | | | Rx bid={0,1}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | | | | | a | b | c | d | e | f | g | h | | | Rx bid={0,1}
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | | | a | b | c | d | e | f | g | h | i | j | | | Rx bid={0,1}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | | | a | b | c | d | e | f | g | h | i | j | k | l | | | Rx bid={0,1}
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
| | | | | | | | | a | b | c | d | e | f | g | h | i | j | k | l | m | n | | | Rx bid={0,1}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
| | | | | | | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | | | Rx bid={0,1}
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
| | | | | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | | | Rx bid={0,1}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
| | | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | | | Rx bid={0,1}
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
| a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | | | Rx bid={0,1}, decode
|---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ << 2
|
|<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>| frame A
| |<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>| frame B
@ decoding from here

View File

@ -1,8 +1,11 @@
noinst_HEADERS = \
abis.h \
abis_osmo.h \
asci.h \
bts.h \
bts_model.h \
bts_shutdown_fsm.h \
bts_sm.h \
bts_trx.h \
gsm_data.h \
logging.h \
@ -10,6 +13,7 @@ noinst_HEADERS = \
oml.h \
paging.h \
rsl.h \
rtp_input_preen.h \
signal.h \
vty.h \
amr.h \
@ -20,7 +24,9 @@ noinst_HEADERS = \
tx_power.h \
control_if.h \
cbch.h \
csd_v110.h \
l1sap.h \
lchan.h \
power_control.h \
scheduler.h \
scheduler_backend.h \
@ -28,4 +34,6 @@ noinst_HEADERS = \
dtx_dl_amr_fsm.h \
ta_control.h \
nm_common_fsm.h \
notification.h \
osmux.h \
$(NULL)

View File

@ -6,19 +6,15 @@
#include <osmo-bts/gsm_data.h>
#define OML_RETRY_TIMER 5
#define OML_PING_TIMER 20
enum {
LINK_STATE_IDLE = 0,
LINK_STATE_RETRYING,
LINK_STATE_CONNECTING,
LINK_STATE_CONNECT,
enum abis_link_fsm_event {
ABIS_LINK_EV_SIGN_LINK_OML_UP,
ABIS_LINK_EV_SIGN_LINK_DOWN,
ABIS_LINK_EV_VTY_RM_ADDR, /* data: struct bsc_oml_host* being removed */
};
void abis_init(struct gsm_bts *bts);
struct e1inp_line *abis_open(struct gsm_bts *bts, char *dst_host,
char *model_name);
int abis_open(struct gsm_bts *bts, char *model_name);
int abis_oml_sendmsg(struct msgb *msg);

View File

@ -0,0 +1,10 @@
#pragma once
#include <osmocom/core/msgb.h>
#include <osmo-bts/pcuif_proto.h>
struct gsm_bts;
int down_osmo(struct gsm_bts *bts, struct msgb *msg);
int abis_osmo_pcu_tx_container(struct gsm_bts *bts, const struct gsm_pcu_if_container *container);

View File

@ -14,5 +14,6 @@ int amr_parse_mr_conf(struct amr_multirate_conf *amr_mrc,
void amr_set_mode_pref(uint8_t *data, const struct amr_multirate_conf *amr_mrc,
uint8_t cmi, uint8_t cmr);
unsigned int amr_get_initial_mode(struct gsm_lchan *lchan);
void amr_init_mr_conf_def(struct gsm_lchan *lchan);
#endif /* _OSMO_BTS_AMR_H */

43
include/osmo-bts/asci.h Normal file
View File

@ -0,0 +1,43 @@
#pragma once
#include <stdint.h>
#include <osmo-bts/lchan.h>
enum {
VGCS_TALKER_NONE = 0,
VGCS_TALKER_WAIT_FRAME,
VGCS_TALKER_ACTIVE,
};
void vgcs_rach(struct gsm_lchan *lchan, uint8_t ra, uint8_t acc_delay, uint32_t fn);
void vgcs_lchan_activate(struct gsm_lchan *lchan);
void vgcs_lchan_react(struct gsm_lchan *lchan);
void vgcs_talker_frame(struct gsm_lchan *lchan);
void vgcs_talker_reset(struct gsm_lchan *lchan, bool ul_access);
void vgcs_listener_reset(struct gsm_lchan *lchan);
static inline bool vgcs_is_uplink_free(struct gsm_lchan *lchan)
{
return lchan->asci.uplink_free;
}
static inline void vgcs_uplink_free_get(struct gsm_lchan *lchan, uint8_t *msg)
{
memcpy(msg, lchan->asci.uplink_free_msg, GSM_MACBLOCK_LEN);
}
static inline void vgcs_uplink_free_set(struct gsm_lchan *lchan, uint8_t *msg)
{
memcpy(lchan->asci.uplink_free_msg, msg, GSM_MACBLOCK_LEN);
lchan->asci.uplink_free = true;
}
static inline void vgcs_uplink_free_reset(struct gsm_lchan *lchan)
{
lchan->asci.uplink_free = false;
}

View File

@ -5,6 +5,7 @@
#include <osmocom/core/socket.h>
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/bts_trx.h>
#include <osmo-bts/osmux.h>
struct gsm_bts_trx;
@ -18,15 +19,27 @@ enum bts_global_status {
enum {
BTS_CTR_PAGING_RCVD,
BTS_CTR_PAGING_DROP,
BTS_CTR_PAGING_DROP_PS,
BTS_CTR_PAGING_SENT,
BTS_CTR_PAGING_CONG,
BTS_CTR_RACH_RCVD,
BTS_CTR_RACH_DROP,
BTS_CTR_RACH_HO,
BTS_CTR_RACH_VGCS,
BTS_CTR_RACH_CS,
BTS_CTR_RACH_PS,
BTS_CTR_AGCH_RCVD,
BTS_CTR_AGCH_SENT,
BTS_CTR_AGCH_DELETED,
BTS_CTR_RTP_RX_TOTAL,
BTS_CTR_RTP_RX_MARKER,
BTS_CTR_RTP_RX_DROP_PREEN,
BTS_CTR_RTP_RX_DROP_LOOPBACK,
BTS_CTR_RTP_RX_DROP_OVERFLOW,
BTS_CTR_RTP_RX_DROP_V110_DEC,
BTS_CTR_RTP_TX_TOTAL,
BTS_CTR_RTP_TX_MARKER,
};
/* Used by OML layer for BTS Attribute reporting */
@ -50,31 +63,28 @@ enum gsm_bts_type_variant {
};
const char *btsvariant2str(enum gsm_bts_type_variant v);
/* TODO: add a brief description of this flag */
#define BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP (1 << 0)
/* When this flag is set then the measurement data is included in
* (PRIM_PH_DATA) and struct ph_tch_param (PRIM_TCH). Otherwise the
* measurement data is passed using a separate MPH INFO MEAS IND.
* (See also ticket: OS#2977) */
#define BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB (1 << 1)
enum bts_impl_flag {
/* TODO: add a brief description of this flag */
BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP,
/* When this flag is set then the measurement data is included in
* (PRIM_PH_DATA) and struct ph_tch_param (PRIM_TCH). Otherwise the
* measurement data is passed using a separate MPH INFO MEAS IND.
* (See also ticket: OS#2977) */
BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB,
/* Whether the BTS model requires RadioCarrier MO to be in Enabled state
* (OPSTARTed) before OPSTARTing the RadioChannel MOs. See OS#5157 */
BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER,
/* Whether the BTS model reports interference measurements to L1SAP. */
BTS_INTERNAL_FLAG_INTERF_MEAS,
_BTS_INTERNAL_FLAG_NUM, /* must be at the end */
};
/* BTS implementation flags (internal use, not exposed via OML) */
#define bts_internal_flag_get(bts, flag) \
((bts->flags & (typeof(bts->flags)) flag) != 0)
((bts->flags & (typeof(bts->flags))(1 << flag)) != 0)
#define bts_internal_flag_set(bts, flag) \
bts->flags |= (typeof(bts->flags)) flag
struct gsm_bts_gprs_nsvc {
struct gsm_bts *bts;
/* data read via VTY config file, to configure the BTS
* via OML from BSC */
int id;
uint16_t nsvci;
struct osmo_sockaddr local; /* on the BTS */
struct osmo_sockaddr remote; /* on the SGSN */
struct gsm_abis_mo mo;
};
bts->flags |= (typeof(bts->flags))(1 << flag)
struct gprs_rlc_cfg {
uint16_t parameter[_NUM_RLC_PAR];
@ -123,14 +133,28 @@ struct bts_power_ctrl_params {
} pf;
};
/* BTS Site Manager */
struct gsm_bts_sm {
/* GPRS CELL; ip.access specific NM Object */
struct gsm_gprs_cell {
struct gsm_abis_mo mo;
uint16_t bvci;
uint8_t timer[11];
struct gprs_rlc_cfg rlc_cfg;
struct {
uint32_t gprs_codings; /* see NM_IPAC_F_GPRS_CODING_* flags */
} support;
};
/* Struct that holds one OML-Address (Address of the BSC) */
struct bsc_oml_host {
struct llist_head list;
char *addr;
};
#define BTS_PCU_SOCK_WQUEUE_LEN_DEFAULT 100
/* One BTS */
struct gsm_bts {
/* list header in net->bts_list */
/* list header in g_bts_sm->bts_list */
struct llist_head list;
/* number of the BTS in network */
@ -144,6 +168,7 @@ struct gsm_bts {
/* Base Station Identification Code (BSIC), lower 3 bits is BCC,
* which is used as TSC for the CCCH */
uint8_t bsic;
bool bsic_configured;
/* type of BTS */
enum gsm_bts_type_variant variant;
enum gsm_band band;
@ -164,6 +189,8 @@ struct gsm_bts {
/* how do we talk OML with this TRX? */
struct e1inp_sign_link *oml_link;
struct timespec oml_conn_established_timestamp;
/* OSMO extenion link associated to same line as oml_link: */
struct e1inp_sign_link *osmo_link;
/* Abis network management O&M handle */
struct gsm_abis_mo mo;
@ -177,7 +204,7 @@ struct gsm_bts {
/* CCCH is on C0 */
struct gsm_bts_trx *c0;
struct gsm_bts_sm site_mgr;
struct gsm_bts_sm *site_mgr;
/* bitmask of all SI that are present/valid in si_buf */
uint32_t si_valid;
@ -207,18 +234,7 @@ struct gsm_bts {
/* Not entirely sure how ip.access specific this is */
struct {
struct {
struct gsm_abis_mo mo;
uint16_t nsei;
uint8_t timer[7];
} nse;
struct {
struct gsm_abis_mo mo;
uint16_t bvci;
uint8_t timer[11];
struct gprs_rlc_cfg rlc_cfg;
} cell;
struct gsm_bts_gprs_nsvc nsvc[2];
struct gsm_gprs_cell cell;
uint8_t rac;
} gprs;
@ -234,8 +250,9 @@ struct gsm_bts {
int16_t boundary[6];
uint8_t intave;
} interference;
unsigned int t200_ms[7];
uint32_t t200_fn[7];
unsigned int t3105_ms;
unsigned int t3115_ms; /* VGCS UPLINK GRANT repeat timer */
struct {
uint8_t overload_period;
struct {
@ -258,6 +275,7 @@ struct gsm_bts {
} rach;
} load;
uint8_t ny1;
uint8_t ny2; /* maximum number of repetitions for the VGCS UPLINK GRANT */
uint8_t max_ta;
/* AGCH queuing */
@ -287,9 +305,17 @@ struct gsm_bts {
bool pni; /* Primary Notification Identifier */
} etws;
/* Advanced Speech Call Items (VBS/VGCS) + NCH related bits */
struct {
int pos_nch; /* position of the NCH or < 0, if not available */
uint8_t nln, nln_status; /* current notification list number and status */
struct llist_head notifications;
int notification_entries; /* current number of entries in the list */
int notification_count; /* counter to count all entries */
} asci;
struct paging_state *paging_state;
char *bsc_oml_host;
struct llist_head oml_queue;
struct llist_head bsc_oml_hosts;
unsigned int rtp_jitter_buf_ms;
bool rtp_jitter_adaptive;
@ -297,9 +323,15 @@ struct gsm_bts {
uint16_t rtp_port_range_end;
uint16_t rtp_port_range_next;
int rtp_ip_dscp;
int rtp_priority;
bool rtp_nogaps_mode; /* emit RTP stream without any gaps */
bool use_ul_ecu; /* "rtp internal-uplink-ecu" option */
bool emit_hr_rfc5993;
struct {
uint8_t ciphers; /* flags A5/1==0x1, A5/2==0x2, A5/3==0x4 */
uint8_t max_ta; /* maximum timing advance */
} support;
struct {
uint8_t tc4_ctr;
@ -325,6 +357,9 @@ struct gsm_bts {
struct gsm_power_ctrl_params bs_dpc_params; /* BS Dynamic Power Control */
struct gsm_power_ctrl_params ms_dpc_params; /* MS Dynamic Power Control */
/* Maximum BCCH carrier power reduction */
uint8_t c0_power_red_db;
/* used by the sysmoBTS to adjust band */
uint8_t auto_band;
@ -341,17 +376,26 @@ struct gsm_bts {
struct {
char *sock_path;
unsigned int sock_wqueue_len_max;
} pcu;
/* GSMTAP Um logging (disabled by default) */
struct {
struct gsmtap_inst *inst;
char *remote_host;
char *local_host;
uint32_t sapi_mask;
uint8_t sapi_acch;
bool rlp;
bool rlp_skip_null;
} gsmtap;
struct osmux_state osmux;
struct osmo_fsm_inst *shutdown_fi; /* FSM instance to manage shutdown procedure during process exit */
bool shutdown_fi_exit_proc; /* exit process when shutdown_fsm is finished? */
bool shutdown_fi_skip_power_ramp; /* Skip power ramping and change power in one step? */
struct osmo_fsm_inst *abis_link_fi; /* FSM instance to manage abis connection during process startup and link failure */
struct osmo_tdef *T_defs; /* Timer defines */
void *model_priv; /* Allocated by bts_model, contains model specific data pointer */
@ -364,44 +408,60 @@ extern void *tall_bts_ctx;
#define GSM_BTS_HAS_SI(bts, i) ((bts)->si_valid & (1 << i))
#define GSM_BTS_SI(bts, i) (void *)((bts)->si_buf[i][0])
static inline struct gsm_bts *gsm_bts_sm_get_bts(struct gsm_bts_sm *site_mgr) {
return (struct gsm_bts *)container_of(site_mgr, struct gsm_bts, site_mgr);
static inline struct gsm_bts *gsm_gprs_cell_get_bts(struct gsm_gprs_cell *cell)
{
return (struct gsm_bts *)container_of(cell, struct gsm_bts, gprs.cell);
}
struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num);
struct gsm_bts *gsm_bts_num(const struct gsm_network *net, int num);
struct gsm_bts *gsm_bts_alloc(struct gsm_bts_sm *bts_sm, uint8_t bts_num);
struct gsm_bts *gsm_bts_num(const struct gsm_bts_sm *bts_sm, int num);
int bts_init(struct gsm_bts *bts);
void bts_shutdown(struct gsm_bts *bts, const char *reason);
void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc, bool skip_power_ramp);
int bts_link_estab(struct gsm_bts *bts);
int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg);
struct msgb *bts_agch_dequeue(struct gsm_bts *bts);
int bts_agch_max_queue_length(int T, int bcch_conf);
int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt,
int is_ag_res);
enum ccch_msgt {
CCCH_MSGT_AGCH,
CCCH_MSGT_PCH,
CCCH_MSGT_NCH,
};
int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt, enum ccch_msgt ccch);
int bts_supports_cipher(struct gsm_bts *bts, int rsl_cipher);
uint8_t *bts_sysinfo_get(struct gsm_bts *bts, const struct gsm_time *g_time);
void regenerate_si3_restoctets(struct gsm_bts *bts);
void regenerate_si4_restoctets(struct gsm_bts *bts);
int get_si4_ro_offset(const uint8_t *si4_buf);
uint8_t *lchan_sacch_get(struct gsm_lchan *lchan);
int lchan_init_lapdm(struct gsm_lchan *lchan);
void load_timer_start(struct gsm_bts *bts);
void load_timer_stop(struct gsm_bts *bts);
bool load_timer_is_running(const struct gsm_bts *bts);
void bts_update_status(enum bts_global_status which, int on);
struct gsm_time *get_time(struct gsm_bts *bts);
int bts_main(int argc, char **argv);
int bts_supports_cm(struct gsm_bts *bts, enum gsm_phys_chan_config pchan,
enum gsm48_chan_mode cm);
bool bts_supports_cm(const struct gsm_bts *bts,
const struct rsl_ie_chan_mode *cm);
int32_t bts_get_avg_fn_advance(const struct gsm_bts *bts);
/* return the gsm_lchan for the CBCH (if it exists at all) */
struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts);
int bts_set_c0_pwr_red(struct gsm_bts *bts, const uint8_t red);
/* Context information to be put in the control buffer (db) of the AGCH msg
* buffer */
struct bts_agch_msg_cb {
uint32_t msg_id;
bool confirm;
} __attribute__ ((packed));
#endif /* _BTS_H */

View File

@ -5,6 +5,7 @@
#include <osmocom/gsm/tlv.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/protocol/gsm_12_21.h>
#include <osmo-bts/gsm_data.h>
@ -20,8 +21,8 @@ int bts_model_check_oml(struct gsm_bts *bts, uint8_t msg_type,
struct tlv_parsed *old_attr, struct tlv_parsed *new_attr,
void *obj);
int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
struct tlv_parsed *new_attr, int obj_kind, void *obj);
int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
struct gsm_abis_mo *mo, void *obj);
int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
void *obj);

View File

@ -1,6 +1,6 @@
/* BTS shutdown FSM */
/* (C) 2020 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
/* (C) 2020 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* Author: Pau Espin Pedrol <pespin@sysmocom.de>
*
* All Rights Reserved
@ -13,7 +13,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -24,7 +24,6 @@
#include <osmocom/core/fsm.h>
/* 3GPP TS 24.008 § 4.1.3.3 GMM mobility management states on the network side */
enum bts_shutdown_fsm_states {
BTS_SHUTDOWN_ST_NONE,
BTS_SHUTDOWN_ST_WAIT_RAMP_DOWN_COMPL,
@ -39,3 +38,6 @@ enum bts_shutdown_fsm_events {
};
extern struct osmo_fsm bts_shutdown_fsm;
struct gsm_bts;
bool bts_shutdown_in_progress(const struct gsm_bts *bts);

48
include/osmo-bts/bts_sm.h Normal file
View File

@ -0,0 +1,48 @@
#pragma once
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/socket.h>
#include <osmocom/gsm/gsm23003.h>
#include <osmo-bts/oml.h>
struct pcu_sock_state;
/* GPRS NSVC; ip.access specific NM Object */
struct gsm_gprs_nse;
struct gsm_gprs_nsvc {
struct gsm_abis_mo mo;
struct gsm_gprs_nse *nse;
/* data read via VTY config file, to configure the BTS
* via OML from BSC */
int id;
uint16_t nsvci;
struct osmo_sockaddr local; /* on the BTS */
struct osmo_sockaddr remote; /* on the SGSN */
};
/* GPRS NSE; ip.access specific NM Object */
struct gsm_gprs_nse {
struct gsm_abis_mo mo;
uint16_t nsei;
uint8_t timer[7];
struct gsm_gprs_nsvc nsvc[2];
};
struct gsm_bts *gsm_gprs_nse_get_bts(const struct gsm_gprs_nse *nse);
/* BTS Site Manager */
struct gsm_bts_sm {
struct gsm_abis_mo mo;
struct llist_head bts_list;
unsigned int num_bts;
struct osmo_plmn_id plmn;
struct {
struct pcu_sock_state *pcu_state;
struct gsm_gprs_nse nse;
} gprs;
};
extern struct gsm_bts_sm *g_bts_sm;
struct gsm_bts_sm *gsm_bts_sm_alloc(void *talloc_ctx);

View File

@ -1,9 +1,16 @@
#pragma once
#include <osmocom/core/sockaddr_str.h>
#include <osmo-bts/gsm_data.h>
struct gsm_bts_bb_trx {
struct gsm_abis_mo mo;
/* how do we talk RSL with this TRX? */
struct {
struct osmo_sockaddr_str rem_addrstr;
uint8_t tei;
struct e1inp_sign_link *link;
} rsl;
};
/* One TRX in a BTS */
@ -16,9 +23,6 @@ struct gsm_bts_trx {
uint8_t nr;
/* human readable name / description */
char *description;
/* how do we talk RSL with this TRX? */
uint8_t rsl_tei;
struct e1inp_sign_link *rsl_link;
/* NM Radio Carrier and Baseband Transciever */
struct gsm_abis_mo mo;
@ -27,26 +31,25 @@ struct gsm_bts_trx {
uint16_t arfcn;
int nominal_power; /* in dBm */
unsigned int max_power_red; /* in actual dB */
uint8_t max_power_backoff_8psk; /* in actual dB OC-2G only */
uint8_t c0_idle_power_red; /* in actual dB OC-2G only */
uint8_t max_power_backoff_8psk; /* in actual dB OC-2G only */
uint8_t c0_idle_power_red; /* in actual dB OC-2G only */
uint8_t ta_ctrl_interval; /* 1 step is 2 SACCH periods */
struct trx_power_params power_params;
struct gsm_power_ctrl_params *bs_dpc_params; /* BS Dynamic Power Control */
struct gsm_power_ctrl_params *ms_dpc_params; /* MS Dynamic Power Control */
bool ms_pwr_ctl_soft; /* is power control loop done by osmocom software? */
struct {
void *l1h;
} role_bts;
/* The associated PHY instance */
struct phy_instance *pinst;
struct {
uint32_t freq_bands; /* see NM_IPAC_F_FREQ_BAND_* flags */
uint32_t chan_types; /* see NM_IPAC_F_CHANT_* flags */
uint32_t chan_modes; /* see NM_IPAC_F_CHANM_* flags */
} support;
union {
struct {
unsigned int test_state;
uint8_t test_nr;
struct rxlev_stats rxlev_stat;
} ipaccess;
};
struct gsm_bts_trx_ts ts[TRX_NR_TS];
};
@ -55,15 +58,17 @@ static inline struct gsm_bts_trx *gsm_bts_bb_trx_get_trx(struct gsm_bts_bb_trx *
}
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
int bts_trx_init(struct gsm_bts_trx *trx);
struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num);
void gsm_bts_trx_init_shadow_ts(struct gsm_bts_trx *trx);
void gsm_bts_trx_free_shadow_ts(struct gsm_bts_trx *trx);
char *gsm_trx_name(const struct gsm_bts_trx *trx);
const char *gsm_trx_unit_id(struct gsm_bts_trx *trx);
int trx_link_estab(struct gsm_bts_trx *trx);
void trx_operability_update(struct gsm_bts_trx *trx);
uint8_t num_agch(struct gsm_bts_trx *trx, const char * arg);
uint8_t num_agch(const struct gsm_bts_trx *trx, const char * arg);
int pos_nch(const struct gsm_bts_trx *trx, const char *arg);
bool trx_ms_pwr_ctrl_is_osmo(const struct gsm_bts_trx *trx);
#define LOGPTRX(trx, ss, lvl, fmt, args...) LOGP(ss, lvl, "%s " fmt, gsm_trx_name(trx), ## args)

View File

@ -21,3 +21,5 @@ int bts_process_smscb_cmd(struct gsm_bts *bts, struct rsl_ie_cb_cmd_type cmd_typ
/* call-back from bts model specific code when it wants to obtain a CBCH
* block for a given gsm_time. outbuf must have 23 bytes of space. */
int bts_cbch_get(struct gsm_bts *bts, uint8_t *outbuf, struct gsm_time *g_time);
void bts_cbch_reset(struct gsm_bts *bts);

View File

@ -1,5 +1,4 @@
#pragma once
int bts_ctrl_cmds_install(struct gsm_bts *bts);
struct ctrl_handle *bts_controlif_setup(struct gsm_bts *bts,
const char *bind_addr, uint16_t port);
struct ctrl_handle *bts_controlif_setup(struct gsm_bts *bts, uint16_t port);

View File

@ -0,0 +1,23 @@
#pragma once
/* RFC4040 "clearmode" RTP payload length */
#define RFC4040_RTP_PLEN 160
struct gsm_lchan;
struct csd_v110_frame_desc {
uint16_t num_blocks;
uint16_t num_bits;
};
struct csd_v110_lchan_desc {
struct csd_v110_frame_desc fr;
struct csd_v110_frame_desc hr;
};
extern const struct csd_v110_lchan_desc csd_v110_lchan_desc[256];
int csd_v110_rtp_encode(const struct gsm_lchan *lchan, uint8_t *rtp,
const uint8_t *data, size_t data_len);
int csd_v110_rtp_decode(const struct gsm_lchan *lchan, uint8_t *data,
const uint8_t *rtp, size_t rtp_len);

View File

@ -9,15 +9,13 @@
#include <osmocom/core/statistics.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/codec/ecu.h>
#include <osmocom/gsm/lapdm.h>
#include <osmocom/core/tdef.h>
#include <osmocom/gsm/gsm23003.h>
#include <osmocom/gsm/gsm0502.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/gsm/rxlev_stat.h>
#include <osmocom/gsm/sysinfo.h>
#include <osmocom/gsm/meas_rep.h>
#include <osmocom/gsm/bts_features.h>
#include <osmocom/gsm/gsm48_rest_octets.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
@ -29,6 +27,7 @@
#include <osmo-bts/paging.h>
#include <osmo-bts/tx_power.h>
#include <osmo-bts/oml.h>
#include <osmo-bts/lchan.h>
#define GSM_FR_BITS 260
#define GSM_EFR_BITS 244
@ -42,23 +41,6 @@
#define GSM_BTS_AGCH_QUEUE_LOW_LEVEL_DEFAULT 41
#define GSM_BTS_AGCH_QUEUE_HIGH_LEVEL_DEFAULT 91
#define LOGPLCHAN(lchan, ss, lvl, fmt, args...) LOGP(ss, lvl, "%s " fmt, gsm_lchan_name(lchan), ## args)
struct gsm_network {
struct llist_head bts_list;
unsigned int num_bts;
struct osmo_plmn_id plmn;
struct pcu_sock_state *pcu_state;
};
enum lchan_ciph_state {
LCHAN_CIPH_NONE,
LCHAN_CIPH_RX_REQ,
LCHAN_CIPH_RX_CONF,
LCHAN_CIPH_RXTX_REQ,
LCHAN_CIPH_RX_CONF_TX_REQ,
LCHAN_CIPH_RXTX_CONF,
};
/* 16 is the max. number of SI2quater messages according to 3GPP TS 44.018 Table 10.5.2.33b.1:
4-bit index is used (2#1111 = 10#15) */
@ -70,351 +52,58 @@ enum lchan_ciph_state {
/* lchans 0..3 are SDCCH in combined channel configuration,
use 4 as magic number for BCCH hack - see osmo-bts-../oml.c:opstart_compl() */
#define CCCH_LCHAN 4
#define CBCH_LCHAN 2
#define TRX_NR_TS 8
#define TS_MAX_LCHAN 8
#define MAX_VERSION_LENGTH 64
struct gsm_lchan;
struct osmo_rtp_socket;
struct pcu_sock_state;
struct smscb_msg;
#define MAX_A5_KEY_LEN (128/8)
#define RSL_ENC_ALG_A5(x) (x+1)
/* state of a logical channel */
enum gsm_lchan_state {
LCHAN_S_NONE, /* channel is not active */
LCHAN_S_ACT_REQ, /* channel activation requested */
LCHAN_S_ACTIVE, /* channel is active and operational */
LCHAN_S_REL_REQ, /* channel release has been requested */
LCHAN_S_REL_ERR, /* channel is in an error state */
LCHAN_S_BROKEN, /* channel is somehow unusable */
LCHAN_S_INACTIVE, /* channel is set inactive */
};
#define MAX_NUM_UL_MEAS 104
#define LC_UL_M_F_L1_VALID (1 << 0)
#define LC_UL_M_F_RES_VALID (1 << 1)
#define LC_UL_M_F_OSMO_EXT_VALID (1 << 2)
struct bts_ul_meas {
/* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */
uint16_t ber10k;
/* timing advance offset (in 1/256 bits) */
int16_t ta_offs_256bits;
/* C/I ratio in dB */
float c_i;
/* flags */
uint8_t is_sub:1;
/* RSSI in dBm * -1 */
uint8_t inv_rssi;
};
struct amr_mode {
uint8_t mode;
uint8_t threshold;
uint8_t hysteresis;
};
struct amr_multirate_conf {
uint8_t gsm48_ie[2];
struct amr_mode ms_mode[4];
struct amr_mode bts_mode[4];
uint8_t num_modes;
};
enum lchan_csd_mode {
LCHAN_CSD_M_NT,
LCHAN_CSD_M_T_1200_75,
LCHAN_CSD_M_T_600,
LCHAN_CSD_M_T_1200,
LCHAN_CSD_M_T_2400,
LCHAN_CSD_M_T_9600,
LCHAN_CSD_M_T_14400,
LCHAN_CSD_M_T_29000,
LCHAN_CSD_M_T_32000,
};
/* State of the SAPIs in the lchan */
enum lchan_sapi_state {
LCHAN_SAPI_S_NONE,
LCHAN_SAPI_S_REQ,
LCHAN_SAPI_S_ASSIGNED,
LCHAN_SAPI_S_REL,
LCHAN_SAPI_S_ERROR,
};
/* What kind of release/activation is done? A silent one for
* the PDCH or one triggered through RSL? */
enum lchan_rel_act_kind {
LCHAN_REL_ACT_RSL,
LCHAN_REL_ACT_PCU,
LCHAN_REL_ACT_OML,
LCHAN_REL_ACT_REACT, /* remove once auto-activation hack is removed from opstart_compl() */
};
struct gsm_rep_facch {
struct msgb *msg;
uint32_t fn;
};
/* MS/BS Power related measurement averaging algo */
enum gsm_power_ctrl_meas_avg_algo {
GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE = 0x00,
GSM_PWR_CTRL_MEAS_AVG_ALGO_UNWEIGHTED = 0x01,
GSM_PWR_CTRL_MEAS_AVG_ALGO_WEIGHTED = 0x02,
GSM_PWR_CTRL_MEAS_AVG_ALGO_MOD_MEDIAN = 0x03,
/* EWMA is an Osmocom specific algo */
GSM_PWR_CTRL_MEAS_AVG_ALGO_OSMO_EWMA = 0x04,
};
/* MS/BS Power related measurement parameters */
struct gsm_power_ctrl_meas_params {
/* Thresholds (see 3GPP TS 45.008, section A.3.2.1) */
uint8_t lower_thresh; /* lower (decreasing) direction */
uint8_t upper_thresh; /* upper (increasing) direction */
/* Threshold Comparators for lower (decreasing) direction */
uint8_t lower_cmp_p; /* P1 for RxLev, P3 for RxQual */
uint8_t lower_cmp_n; /* N1 for RxLev, N3 for RxQual */
/* Threshold Comparators for upper (increasing) direction */
uint8_t upper_cmp_p; /* P2 for RxLev, P4 for RxQual */
uint8_t upper_cmp_n; /* N2 for RxLev, N4 for RxQual */
/* Hreqave and Hreqt (see 3GPP TS 45.008, Annex A) */
uint8_t h_reqave;
uint8_t h_reqt;
/* AVG algorithm and its specific parameters */
enum gsm_power_ctrl_meas_avg_algo algo;
union {
/* Exponentially Weighted Moving Average */
struct {
/* Smoothing factor: higher the value - less smoothing */
uint8_t alpha; /* 1 .. 99 (in %) */
} ewma;
};
};
/* MS/BS Power Control parameters */
struct gsm_power_ctrl_params {
/* Minimum interval between power level changes */
uint8_t ctrl_interval; /* 1 step is 2 SACCH periods */
/* Power change step size (maximum) */
uint8_t inc_step_size_db; /* increasing direction */
uint8_t red_step_size_db; /* reducing direction */
/* Measurement averaging parameters for RxLev & RxQual */
struct gsm_power_ctrl_meas_params rxqual_meas;
struct gsm_power_ctrl_meas_params rxlev_meas;
};
/* Default MS/BS Power Control parameters */
extern const struct gsm_power_ctrl_params power_ctrl_params_def;
/* Measurement pre-processing state */
struct gsm_power_ctrl_meas_proc_state {
/* Number of measurements processed */
unsigned int meas_num;
/* Algorithm specific data */
union {
struct {
/* Scaled up 100 times average value */
int Avg100;
} ewma;
};
};
struct lchan_power_ctrl_state {
/* Dynamic Power Control parameters (NULL in static mode) */
const struct gsm_power_ctrl_params *dpc_params;
/* Measurement pre-processing state (for dynamic mode) */
struct gsm_power_ctrl_meas_proc_state rxlev_meas_proc;
/* Number of SACCH blocks to skip (for dynamic mode) */
int skip_block_num;
/* Depending on the context (MS or BS power control), fields 'current' and 'max'
* reflect either the MS power level (magic numbers), or BS Power reduction level
* (attenuation, in dB). */
uint8_t current;
uint8_t max;
};
struct gsm_lchan {
/* The TS that we're part of */
struct gsm_bts_trx_ts *ts;
/* The logical subslot number in the TS */
uint8_t nr;
/* The logical channel type */
enum gsm_chan_t type;
/* RSL channel mode */
enum rsl_cmod_spd rsl_cmode;
/* If TCH, traffic channel mode */
enum gsm48_chan_mode tch_mode;
enum lchan_csd_mode csd_mode;
/* State */
enum gsm_lchan_state state;
const char *broken_reason;
/* Encryption information */
struct {
uint8_t alg_id;
uint8_t key_len;
uint8_t key[MAX_A5_KEY_LEN];
} encr;
struct {
uint32_t bound_ip;
uint32_t connect_ip;
uint16_t bound_port;
uint16_t connect_port;
uint16_t conn_id;
uint8_t rtp_payload;
uint8_t rtp_payload2;
uint8_t speech_mode;
struct osmo_rtp_socket *rtp_socket;
} abis_ip;
uint8_t rqd_ta;
char *name;
/* For handover, activation is described in 3GPP TS 48.058 4.1.3 and 4.1.4:
*
* | | Access || transmit | activate
* | MS Power | Delay || on main channel | dl SACCH
* ----------------------------------------------------------------------
* async ho no * --> yes no
* async ho yes * --> yes may be started
* sync ho no no --> yes no
* sync ho yes no --> yes may be started
* sync ho yes yes --> yes shall be started
*
* Always start the main channel immediately.
* want_dl_sacch_active indicates whether dl SACCH should be activated on CHAN ACT.
*/
bool want_dl_sacch_active;
/* Number of different GsmL1_Sapi_t used in osmo_bts_sysmo is 23.
* Currently we don't share these headers so this is a magic number. */
struct llist_head sapi_cmds;
uint8_t sapis_dl[23];
uint8_t sapis_ul[23];
struct lapdm_channel lapdm_ch;
struct llist_head dl_tch_queue;
struct {
/* bitmask of all SI that are present/valid in si_buf */
uint32_t valid;
/* bitmask of all SI that do not mirror the BTS-global SI values */
uint32_t overridden;
uint32_t last;
/* buffers where we put the pre-computed SI:
SI2Q_MAX_NUM is the max number of SI2quater messages (see 3GPP TS 44.018) */
sysinfo_buf_t buf[_MAX_SYSINFO_TYPE][SI2Q_MAX_NUM];
} si;
struct {
uint8_t flags;
/* RSL measurement result number, 0 at lchan_act */
uint8_t res_nr;
/* number of measurements stored in array below */
uint8_t num_ul_meas;
struct bts_ul_meas uplink[MAX_NUM_UL_MEAS];
/* last L1 header from the MS */
struct rsl_l1_info l1_info;
struct gsm_meas_rep_unidir ul_res;
int16_t ms_toa256;
/* Frame number of the last measurement indication receceived */
uint32_t last_fn;
/* Osmocom extended measurement results, see LC_UL_M_F_EXTD_VALID */
struct {
/* minimum value of toa256 during measurement period */
int16_t toa256_min;
/* maximum value of toa256 during measurement period */
int16_t toa256_max;
/* standard deviation of toa256 value during measurement period */
uint16_t toa256_std_dev;
} ext;
} meas;
struct {
struct amr_multirate_conf amr_mr;
struct {
struct osmo_fsm_inst *dl_amr_fsm;
/* TCH cache */
uint8_t cache[20];
/* FACCH cache */
uint8_t facch[GSM_MACBLOCK_LEN];
uint8_t len;
uint32_t fn;
bool is_update;
/* set for each SID frame to detect talkspurt for codecs
without explicit ONSET event */
bool ul_sid;
/* indicates if DTXd was active during DL measurement
period */
bool dl_active;
/* last UL SPEECH resume flag */
bool is_speech_resume;
} dtx;
uint8_t last_cmr;
uint32_t last_fn;
/* SLOT #0 and #1 to store FACCH for repetition */
struct gsm_rep_facch rep_facch[2];
} tch;
/* 3GPP TS 48.058 § 9.3.37: [0; 255] ok, -1 means invalid*/
int16_t ms_t_offs;
/* 3GPP TS 45.010 § 1.2 round trip propagation delay (in symbols) or -1 */
int16_t p_offs;
/* BTS-side ciphering state (rx only, bi-directional, ...) */
uint8_t ciph_state;
uint8_t ciph_ns;
uint8_t loopback;
struct {
uint8_t active;
uint8_t ref;
/* T3105: PHYS INF retransmission */
struct osmo_timer_list t3105;
/* counts up to Ny1 */
unsigned int phys_info_count;
} ho;
/* S counter for link loss */
int s;
/* Kind of the release/activation. E.g. RSL or PCU */
enum lchan_rel_act_kind rel_act_kind;
/* RTP header Marker bit to indicate beginning of speech after pause */
bool rtp_tx_marker;
/* MS/BS power control state */
struct lchan_power_ctrl_state ms_power_ctrl;
struct lchan_power_ctrl_state bs_power_ctrl;
/* MS/BS Dynamic Power Control parameters */
struct gsm_power_ctrl_params ms_dpc_params;
struct gsm_power_ctrl_params bs_dpc_params;
struct msgb *pending_rel_ind_msg;
/* ECU (Error Concealment Unit) state */
struct osmo_ecu_state *ecu_state;
struct abis_rsl_osmo_rep_acch_cap repeated_acch_capability;
bool repeated_dl_facch_active;
bool repeated_ul_sacch_active;
/* Message buffer to store DL-SACCH repeation candidate */
struct msgb *rep_sacch;
};
extern const struct value_string lchan_ciph_state_names[];
static inline const char *lchan_ciph_state_name(uint8_t state) {
return get_value_string(lchan_ciph_state_names, state);
}
/* NM_IPAC_F_CHANT_* mask for NM_IPAC_EIE_CHAN_TYPES (common) */
#define NM_IPAC_MASK_CHANT_COMMON \
(NM_IPAC_F_CHANT_TCHF | \
NM_IPAC_F_CHANT_TCHH | \
NM_IPAC_F_CHANT_SDCCH8 | \
NM_IPAC_F_CHANT_BCCH | \
NM_IPAC_F_CHANT_BCCH_SDCCH4)
/* NM_IPAC_F_CHANM_SPEECH_* mask for NM_IPAC_EIE_CHAN_MODES */
#define NM_IPAC_MASK_CHANM_SPEECH \
(NM_IPAC_F_CHANM_SPEECH_FS | \
NM_IPAC_F_CHANM_SPEECH_EFS | \
NM_IPAC_F_CHANM_SPEECH_AFS | \
NM_IPAC_F_CHANM_SPEECH_HS | \
NM_IPAC_F_CHANM_SPEECH_AHS)
/* NM_IPAC_F_CHANM_CSD_NT_* mask for NM_IPAC_EIE_CHAN_MODES */
#define NM_IPAC_MASK_CHANM_CSD_NT \
(NM_IPAC_F_CHANM_CSD_NT_4k8 | \
NM_IPAC_F_CHANM_CSD_NT_9k6 | \
NM_IPAC_F_CHANM_CSD_NT_14k4)
/* NM_IPAC_F_CHANM_CSD_T_* mask for NM_IPAC_EIE_CHAN_MODES */
#define NM_IPAC_MASK_CHANM_CSD_T \
(NM_IPAC_F_CHANM_CSD_T_1200_75 | \
NM_IPAC_F_CHANM_CSD_T_600 | \
NM_IPAC_F_CHANM_CSD_T_1k2 | \
NM_IPAC_F_CHANM_CSD_T_2k4 | \
NM_IPAC_F_CHANM_CSD_T_4k8 | \
NM_IPAC_F_CHANM_CSD_T_9k6 | \
NM_IPAC_F_CHANM_CSD_T_14k4)
/* NM_IPAC_F_GPRS_CODING_CS[1-4] mask for NM_IPAC_EIE_GPRS_CODING */
#define NM_IPAC_MASK_GPRS_CODING_CS \
(NM_IPAC_F_GPRS_CODING_CS1 | \
NM_IPAC_F_GPRS_CODING_CS2 | \
NM_IPAC_F_GPRS_CODING_CS3 | \
NM_IPAC_F_GPRS_CODING_CS4)
/* NM_IPAC_F_GPRS_CODING_MCS[1-9] mask for NM_IPAC_EIE_GPRS_CODING */
#define NM_IPAC_MASK_GPRS_CODING_MCS \
(NM_IPAC_F_GPRS_CODING_MCS1 | \
NM_IPAC_F_GPRS_CODING_MCS2 | \
NM_IPAC_F_GPRS_CODING_MCS3 | \
NM_IPAC_F_GPRS_CODING_MCS4 | \
NM_IPAC_F_GPRS_CODING_MCS5 | \
NM_IPAC_F_GPRS_CODING_MCS6 | \
NM_IPAC_F_GPRS_CODING_MCS7 | \
NM_IPAC_F_GPRS_CODING_MCS8 | \
NM_IPAC_F_GPRS_CODING_MCS9)
enum gsm_bts_trx_ts_flags {
TS_F_PDCH_ACTIVE = 0x1000,
@ -435,12 +124,22 @@ struct gsm_bts_trx_ts {
struct {
enum gsm_phys_chan_config pchan_is;
enum gsm_phys_chan_config pchan_want;
struct msgb *pending_chan_activ;
} dyn;
unsigned int flags;
struct gsm_abis_mo mo;
int tsc; /* -1 == use BTS TSC */
/* Training Sequence Code (range 0..7) */
uint8_t tsc_oml; /* configured via OML */
bool tsc_oml_configured;
uint8_t tsc_rsl; /* configured via RSL (Osmo extension) */
bool tsc_rsl_configured;
uint8_t tsc; /* TSC currently in use. Preference: RSL, OML, BTS-BSIC-OML */
/* Training Sequence Set (range 0..3) */
uint8_t tsc_set;
/* Actual BCCH carrier power reduction */
uint8_t c0_power_red_db;
/* Frequency hopping parameters (configured via OML) */
struct {
@ -454,11 +153,19 @@ struct gsm_bts_trx_ts {
/* Transceiver "cache" for frequency hopping */
const struct gsm_bts_trx *fh_trx_list[64];
/* Implementation specific structure(s) */
void *priv;
/* VAMOS specific fields */
struct {
/* NULL if BTS_FEAT_VAMOS is not set */
struct gsm_bts_trx_ts *peer;
bool is_shadow;
} vamos;
struct gsm_lchan lchan[TS_MAX_LCHAN];
};
#define GSM_LCHAN_SI(lchan, i) (void *)((lchan)->si.buf[i][0])
enum gprs_rlc_par {
RLC_T3142,
RLC_T3169,
@ -495,40 +202,33 @@ enum gprs_cs {
* OML connection will cause a special warning to be logged. */
#define OSMO_BTS_OML_CONN_EARLY_DISCONNECT 10 /* in seconds */
extern struct osmo_tdef_group bts_tdef_groups[];
extern struct osmo_tdef bts_T_defs[];
extern struct osmo_tdef abis_T_defs[];
extern const struct value_string gsm_pchant_names[13];
extern const struct value_string gsm_pchant_descs[13];
const char *gsm_pchan_name(enum gsm_phys_chan_config c);
enum gsm_phys_chan_config gsm_pchan_parse(const char *name);
const char *gsm_lchant_name(enum gsm_chan_t c);
char *gsm_ts_name(const struct gsm_bts_trx_ts *ts);
char *gsm_ts_and_pchan_name(const struct gsm_bts_trx_ts *ts);
char *gsm_lchan_name_compute(const struct gsm_lchan *lchan);
const char *gsm_lchans_name(enum gsm_lchan_state s);
static inline char *gsm_lchan_name(const struct gsm_lchan *lchan)
{
return lchan->name;
}
#define GSM_TS_NAME_FMT \
"bts=%u,trx=%u,ts=%u" "%s"
#define GSM_TS_NAME_ARGS(ts) \
(ts)->trx->bts->nr, (ts)->trx->nr, (ts)->nr, \
(ts)->vamos.is_shadow ? ",shadow" : ""
uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan);
uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan,
enum gsm_phys_chan_config as_pchan);
#define BSIC2BCC(bsic) ((bsic) & 0x3)
uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts);
#define BSIC2BCC(bsic) ((bsic) & 0x07)
#define BTS_TSC(bts) BSIC2BCC((bts)->bsic)
struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr,
int *rc);
enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts);
uint8_t ts_subslots(struct gsm_bts_trx_ts *ts);
bool ts_is_tch(struct gsm_bts_trx_ts *ts);
enum gsm_phys_chan_config ts_pchan(const struct gsm_bts_trx_ts *ts);
uint8_t ts_subslots(const struct gsm_bts_trx_ts *ts);
bool ts_is_tch(const struct gsm_bts_trx_ts *ts);
int lchan2ecu_codec(const struct gsm_lchan *lchan);
void lchan_set_state(struct gsm_lchan *lchan, enum gsm_lchan_state state);
int conf_lchans_as_pchan(struct gsm_bts_trx_ts *ts,
enum gsm_phys_chan_config pchan);
@ -537,4 +237,8 @@ int conf_lchans_as_pchan(struct gsm_bts_trx_ts *ts,
bool ts_is_pdch(const struct gsm_bts_trx_ts *ts);
void gsm_ts_apply_configured_tsc(struct gsm_bts_trx_ts *ts);
void gsm_ts_release(struct gsm_bts_trx_ts *ts);
#endif /* _GSM_DATA_H */

View File

@ -4,6 +4,8 @@
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/protocol/gsm_08_58.h>
#define L1SAP_MSGB_HEADROOM 128
/* lchan link ID */
#define LID_SACCH 0x40
#define LID_DEDIC 0x00
@ -19,9 +21,11 @@
#define L1SAP_IS_LINK_SACCH(link_id) \
((link_id & 0xC0) == LID_SACCH)
#define L1SAP_IS_CHAN_TCHF(chan_nr) \
((chan_nr & 0xf8) == RSL_CHAN_Bm_ACCHs)
((chan_nr & 0xf8) == RSL_CHAN_Bm_ACCHs || \
(chan_nr & 0xf8) == RSL_CHAN_OSMO_VAMOS_Bm_ACCHs)
#define L1SAP_IS_CHAN_TCHH(chan_nr) \
((chan_nr & 0xf0) == RSL_CHAN_Lm_ACCHs)
((chan_nr & 0xf0) == RSL_CHAN_Lm_ACCHs || \
(chan_nr & 0xf0) == RSL_CHAN_OSMO_VAMOS_Lm_ACCHs)
#define L1SAP_IS_CHAN_SDCCH4(chan_nr) \
((chan_nr & 0xe0) == RSL_CHAN_SDCCH4_ACCH)
#define L1SAP_IS_CHAN_SDCCH8(chan_nr) \
@ -37,6 +41,9 @@
#define L1SAP_IS_CHAN_CBCH(chan_nr) \
((chan_nr & 0xf8) == RSL_CHAN_OSMO_CBCH4) \
|| ((chan_nr & 0xf8) == RSL_CHAN_OSMO_CBCH8)
#define L1SAP_IS_CHAN_VAMOS(chan_nr) \
((chan_nr & 0xf8) == RSL_CHAN_OSMO_VAMOS_Bm_ACCHs || \
(chan_nr & 0xf0) == RSL_CHAN_OSMO_VAMOS_Lm_ACCHs)
/* rach type from ra */
#define L1SAP_IS_PACKET_RACH(ra) ((ra & 0xf0) == 0x70 && (ra & 0x0f) != 0x0f)
@ -91,10 +98,11 @@ void l1sap_rtp_rx_cb(struct osmo_rtp_socket *rs, const uint8_t *rtp_pl,
uint32_t timestamp, bool marker);
/* channel control */
int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr, struct tlv_parsed *tp);
int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr);
int l1sap_chan_rel(struct gsm_bts_trx *trx, uint8_t chan_nr);
int l1sap_chan_deact_sacch(struct gsm_bts_trx *trx, uint8_t chan_nr);
int l1sap_chan_modify(struct gsm_bts_trx *trx, uint8_t chan_nr);
int l1sap_uplink_access(struct gsm_lchan *lchan, bool active);
enum l1sap_common_sapi {
L1SAP_COMMON_SAPI_UNKNOWN,
@ -134,12 +142,11 @@ int add_l1sap_header(struct gsm_bts_trx *trx, struct msgb *rmsg,
#define msgb_l1sap_prim(msg) ((struct osmo_phsap_prim *)(msg)->l1h)
void radio_link_timeout_reset(struct gsm_lchan *lchan);
int bts_check_for_first_ciphrd(struct gsm_lchan *lchan,
uint8_t *data, int len);
int is_ccch_for_agch(struct gsm_bts_trx *trx, uint32_t fn);
void repeated_dl_facch_active_decision(struct gsm_lchan *lchan,
const uint8_t *l3, size_t l3_len);
enum ccch_msgt get_ccch_msgt(struct gsm_bts_trx *trx, uint32_t fn);
#endif /* L1SAP_H */

428
include/osmo-bts/lchan.h Normal file
View File

@ -0,0 +1,428 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <netinet/in.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/codec/codec.h>
#include <osmocom/codec/ecu.h>
#include <osmocom/gsm/lapdm.h>
#include <osmocom/gsm/sysinfo.h>
#include <osmocom/gsm/protocol/gsm_08_58.h>
#include <osmocom/gsm/gsm48_rest_octets.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/meas_rep.h>
#include <osmocom/netif/osmux.h>
#include <osmo-bts/power_control.h>
#define LOGPLCHAN(lchan, ss, lvl, fmt, args...) LOGP(ss, lvl, "%s " fmt, gsm_lchan_name(lchan), ## args)
enum lchan_ciph_state {
LCHAN_CIPH_NONE,
LCHAN_CIPH_RX_REQ,
LCHAN_CIPH_RX_CONF,
LCHAN_CIPH_RXTX_REQ,
LCHAN_CIPH_RX_CONF_TX_REQ,
LCHAN_CIPH_RXTX_CONF,
};
/* state of a logical channel */
enum gsm_lchan_state {
LCHAN_S_NONE, /* channel is not active */
LCHAN_S_ACT_REQ, /* channel activation requested */
LCHAN_S_ACTIVE, /* channel is active and operational */
LCHAN_S_REL_REQ, /* channel release has been requested */
LCHAN_S_REL_ERR, /* channel is in an error state */
LCHAN_S_BROKEN, /* channel is somehow unusable */
};
#define MAX_NUM_UL_MEAS 104
#define LC_UL_M_F_L1_VALID (1 << 0)
#define LC_UL_M_F_RES_VALID (1 << 1)
#define LC_UL_M_F_OSMO_EXT_VALID (1 << 2)
#define MAX_A5_KEY_LEN (128/8)
#define RSL_ENC_ALG_A5(x) (x+1)
struct bts_ul_meas {
/* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */
uint16_t ber10k;
/* timing advance offset (in 1/256 bits) */
int16_t ta_offs_256bits;
/* C/I ratio in cB */
int16_t ci_cb;
/* flags */
uint8_t is_sub:1;
/* RSSI in dBm * -1 */
uint8_t inv_rssi;
};
struct amr_mode {
uint8_t mode;
uint8_t threshold;
uint8_t hysteresis;
};
struct amr_multirate_conf {
uint8_t gsm48_ie[2];
struct amr_mode mode[4];
uint8_t num_modes;
};
enum lchan_csd_mode {
LCHAN_CSD_M_NT = 0,
LCHAN_CSD_M_T_1200_75,
LCHAN_CSD_M_T_600,
LCHAN_CSD_M_T_1200,
LCHAN_CSD_M_T_2400,
LCHAN_CSD_M_T_4800,
LCHAN_CSD_M_T_9600,
LCHAN_CSD_M_T_14400,
LCHAN_CSD_M_T_29000,
LCHAN_CSD_M_T_32000,
_LCHAN_CSD_M_NUM,
};
/* State of the SAPIs in the lchan */
enum lchan_sapi_state {
LCHAN_SAPI_S_NONE,
LCHAN_SAPI_S_REQ,
LCHAN_SAPI_S_ASSIGNED,
LCHAN_SAPI_S_REL,
LCHAN_SAPI_S_ERROR,
};
/* What kind of release/activation is done? A silent one for
* the PDCH or one triggered through RSL? */
enum lchan_rel_act_kind {
LCHAN_REL_ACT_RSL,
LCHAN_REL_ACT_PCU,
LCHAN_REL_ACT_OML,
LCHAN_REL_ACT_REACT, /* FIXME: remove once auto-activation hack is removed from opstart_compl() (OS#1575) */
};
struct gsm_rep_facch {
struct msgb *msg;
uint32_t fn;
};
struct lchan_power_ctrl_state {
/* Dynamic Power Control parameters (NULL in static mode) */
const struct gsm_power_ctrl_params *dpc_params;
/* Measurement pre-processing state (for dynamic mode) */
struct gsm_power_ctrl_meas_proc_state rxlev_meas_proc;
struct gsm_power_ctrl_meas_proc_state rxqual_meas_proc;
struct gsm_power_ctrl_meas_proc_state ci_meas_proc;
/* Number of SACCH blocks to skip (for dynamic mode) */
int skip_block_num;
/* Depending on the context (MS or BS power control), fields 'current' and 'max'
* reflect either the MS power level (magic numbers), or BS Power reduction level
* (attenuation, in dB). */
uint8_t current;
uint8_t max;
};
struct lchan_ta_ctrl_state {
/* Number of SACCH blocks to skip */
int skip_block_num;
/* Currently requested TA */
uint8_t current;
};
struct gsm_lchan {
/* The TS that we're part of */
struct gsm_bts_trx_ts *ts;
/* The logical subslot number in the TS */
uint8_t nr;
/* The logical channel type */
enum gsm_chan_t type;
/* RSL channel rate and type */
enum rsl_cmod_crt rsl_chan_rt;
/* RSL channel mode */
enum rsl_cmod_spd rsl_cmode;
/* If TCH, traffic channel mode */
enum gsm48_chan_mode tch_mode;
enum lchan_csd_mode csd_mode;
/* State */
enum gsm_lchan_state state;
const char *broken_reason;
/* Encryption information */
struct {
uint8_t alg_id;
uint8_t key_len;
uint8_t key[MAX_A5_KEY_LEN];
} encr;
struct {
uint32_t bound_ip;
uint32_t connect_ip;
uint16_t bound_port;
uint16_t connect_port;
uint16_t conn_id;
uint8_t rtp_payload;
uint8_t rtp_payload2;
uint8_t speech_mode;
struct {
bool use;
uint8_t local_cid;
uint8_t remote_cid;
/* Rx Osmux -> RTP, one allocated & owned per lchan */
struct osmux_out_handle *out;
/* Tx RTP -> Osmux, shared by all lchans sharing a
* remote endp (addr+port), see "struct osmux_handle" */
struct osmux_in_handle *in;
/* Used to build rtp messages we send to osmux */
struct osmo_rtp_handle *rtpst;
} osmux;
struct osmo_rtp_socket *rtp_socket;
} abis_ip;
char *name;
/* For handover, activation is described in 3GPP TS 48.058 4.1.3 and 4.1.4:
*
* | | Access || transmit | activate
* | MS Power | Delay || on main channel | dl SACCH
* ----------------------------------------------------------------------
* async ho no * --> yes no
* async ho yes * --> yes may be started
* sync ho no no --> yes no
* sync ho yes no --> yes may be started
* sync ho yes yes --> yes shall be started
*
* Always start the main channel immediately.
* want_dl_sacch_active indicates whether dl SACCH should be activated on CHAN ACT.
*/
bool want_dl_sacch_active;
/* Number of different GsmL1_Sapi_t used in osmo_bts_sysmo is 23.
* Currently we don't share these headers so this is a magic number. */
struct llist_head sapi_cmds;
uint8_t sapis_dl[23];
uint8_t sapis_ul[23];
struct lapdm_channel lapdm_ch;
/* It is required to have L3 info with DL establishment. */
bool l3_info_estab;
struct llist_head dl_tch_queue;
unsigned int dl_tch_queue_len;
struct {
/* bitmask of all SI that are present/valid in si_buf */
uint32_t valid;
/* bitmask of all SI that do not mirror the BTS-global SI values */
uint32_t overridden;
uint32_t last;
/* buffers where we put the pre-computed SI:
SI2Q_MAX_NUM is the max number of SI2quater messages (see 3GPP TS 44.018) */
sysinfo_buf_t buf[_MAX_SYSINFO_TYPE][SI2Q_MAX_NUM];
} si;
struct {
uint8_t flags;
/* RSL measurement result number, 0 at lchan_act */
uint8_t res_nr;
/* number of measurements stored in array below */
uint8_t num_ul_meas;
struct bts_ul_meas uplink[MAX_NUM_UL_MEAS];
/* last L1 header from the MS */
struct rsl_l1_info l1_info;
struct gsm_meas_rep_unidir ul_res;
int16_t ms_toa256;
int16_t ul_ci_cb_full;
int16_t ul_ci_cb_sub;
/* Frame number of the last measurement indication receceived */
uint32_t last_fn;
/* Osmocom extended measurement results, see LC_UL_M_F_EXTD_VALID */
struct {
/* minimum value of toa256 during measurement period */
int16_t toa256_min;
/* maximum value of toa256 during measurement period */
int16_t toa256_max;
/* standard deviation of toa256 value during measurement period */
uint16_t toa256_std_dev;
} ext;
/* Interference levels reported by PHY (in dBm) */
int16_t interf_meas_avg_dbm; /* Average value */
int16_t interf_meas_dbm[31]; /* Intave max is 31 */
uint8_t interf_meas_num;
uint8_t interf_band;
} meas;
struct {
struct amr_multirate_conf amr_mr;
struct {
struct osmo_fsm_inst *dl_amr_fsm;
/* TCH cache */
uint8_t cache[20];
/* FACCH cache */
uint8_t facch[GSM_MACBLOCK_LEN];
uint8_t len;
uint32_t fn;
bool is_update;
/* set for each SID frame to detect talkspurt for codecs
without explicit ONSET event */
bool ul_sid;
/* indicates if DTXd was active during DL measurement
period */
bool dl_active;
/* last UL SPEECH resume flag */
bool is_speech_resume;
} dtx;
struct {
bool last_rtp_input_was_sid;
uint8_t last_sid[GSM_FR_BYTES];
uint8_t last_sid_len;
uint8_t last_sid_age;
/* A SID was transmitted on the DL in the period
* beginning with the last transmitted speech frame
* or the last mandatory-Tx position, whichever was
* more recent. */
bool dl_sid_transmitted;
/* The current frame in the DL is taken up by FACCH */
bool dl_facch_stealing;
} dtx_fr_hr_efr;
uint8_t last_cmr;
uint32_t last_fn;
struct {
/* buffers to re-combine RLP frame from multiple Um blocks */
uint8_t rlp_buf_ul[576/8]; /* maximum size of RLP frame */
uint8_t rlp_buf_dl[576/8]; /* maximum size of RLP frame */
} csd;
} tch;
/* 3GPP TS 48.058 § 9.3.37: [0; 255] ok, -1 means invalid*/
int16_t ms_t_offs;
/* 3GPP TS 45.010 § 1.2 round trip propagation delay (in symbols) or -1 */
int16_t p_offs;
/* BTS-side ciphering state (rx only, bi-directional, ...) */
uint8_t ciph_state;
uint8_t ciph_ns;
uint8_t loopback;
struct {
uint8_t active;
uint8_t ref;
/* T3105: PHYS INF retransmission */
struct osmo_timer_list t3105;
/* counts up to Ny1 */
unsigned int phys_info_count;
} ho;
struct {
bool listener_detected;
uint8_t talker_active;
uint8_t ref;
uint32_t fn;
/* T3115: VGCS UPLINK GRANT retransmission */
struct osmo_timer_list t3115;
/* counts up to Ny2 */
unsigned int vgcs_ul_grant_count;
/* uplink free message */
bool uplink_free;
uint8_t uplink_free_msg[GSM_MACBLOCK_LEN];
} asci;
/* S counter for link loss */
int s;
/* Kind of the release/activation. E.g. RSL or PCU */
enum lchan_rel_act_kind rel_act_kind;
/* Pending RSL CHANnel ACTIVation message */
struct msgb *pending_chan_activ;
/* RTP header Marker bit to indicate beginning of speech after pause */
bool rtp_tx_marker;
/* TA Control Loop */
struct lchan_ta_ctrl_state ta_ctrl;
/* MS/BS power control state */
struct lchan_power_ctrl_state ms_power_ctrl;
struct lchan_power_ctrl_state bs_power_ctrl;
/* MS/BS Dynamic Power Control parameters */
struct gsm_power_ctrl_params ms_dpc_params;
struct gsm_power_ctrl_params bs_dpc_params;
/* Temporary ACCH overpower capabilities and state */
struct abis_rsl_osmo_temp_ovp_acch_cap top_acch_cap;
bool top_acch_active;
struct msgb *pending_rel_ind_msg;
/* ECU (Error Concealment Unit) state */
struct osmo_ecu_state *ecu_state;
/* Repeated ACCH capabilities and current state */
struct abis_rsl_osmo_rep_acch_cap rep_acch_cap;
struct {
bool dl_facch_active;
bool ul_sacch_active;
bool dl_sacch_active;
/* Message buffers to store repeation candidates */
struct gsm_rep_facch dl_facch[2];
struct msgb *dl_sacch_msg;
} rep_acch;
/* Cached early Immediate Assignment message: if the Immediate Assignment arrives before the channel is
* confirmed active, then cache it here and send it once the channel is confirmed to be active. This is related
* to the Early IA feature, see OsmoBSC config option 'immediate-assignment pre-chan-ack'. */
struct msgb *early_rr_ia;
struct osmo_timer_list early_rr_ia_delay;
};
extern const struct value_string lchan_ciph_state_names[];
static inline const char *lchan_ciph_state_name(uint8_t state)
{
return get_value_string(lchan_ciph_state_names, state);
}
#define GSM_LCHAN_SI(lchan, i) (void *)((lchan)->si.buf[i][0])
void gsm_lchan_init(struct gsm_lchan *lchan, struct gsm_bts_trx_ts *ts, unsigned int lchan_nr);
void gsm_lchan_name_update(struct gsm_lchan *lchan);
int lchan_init_lapdm(struct gsm_lchan *lchan);
void gsm_lchan_release(struct gsm_lchan *lchan, enum lchan_rel_act_kind rel_kind);
int lchan_deactivate(struct gsm_lchan *lchan);
const char *gsm_lchans_name(enum gsm_lchan_state s);
static inline char *gsm_lchan_name(const struct gsm_lchan *lchan)
{
return lchan->name;
}
uint8_t *lchan_sacch_get(struct gsm_lchan *lchan);
uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan);
uint8_t gsm_lchan2chan_nr_rsl(const struct gsm_lchan *lchan);
uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan,
enum gsm_phys_chan_config as_pchan);
void gsm_lchan_interf_meas_push(struct gsm_lchan *lchan, int dbm);
void gsm_lchan_interf_meas_calc_avg(struct gsm_lchan *lchan);
int lchan2ecu_codec(const struct gsm_lchan *lchan);
void lchan_set_state(struct gsm_lchan *lchan, enum gsm_lchan_state state);
int lchan_rtp_socket_create(struct gsm_lchan *lchan, const char *bind_ip);
int lchan_rtp_socket_connect(struct gsm_lchan *lchan, const struct in_addr *ia, uint16_t connect_port);
void lchan_rtp_socket_free(struct gsm_lchan *lchan);
void lchan_dl_tch_queue_enqueue(struct gsm_lchan *lchan, struct msgb *msg, unsigned int limit);
static inline bool lchan_is_dcch(const struct gsm_lchan *lchan)
{
switch (lchan->type) {
case GSM_LCHAN_SDCCH:
case GSM_LCHAN_TCH_F:
case GSM_LCHAN_TCH_H:
return true;
default:
return false;
}
}
#define lchan_is_tch(lchan) \
((lchan)->type == GSM_LCHAN_TCH_F || (lchan)->type == GSM_LCHAN_TCH_H)

View File

@ -20,7 +20,8 @@ enum {
DLOOP,
DABIS,
DRTP,
DSUM,
DOSMUX,
DASCI,
};
extern const struct log_info bts_log_info;
@ -37,4 +38,12 @@ extern const struct log_info bts_log_info;
#define DEBUGPFN(ss, fn, fmt, args...) \
LOGP(ss, LOGL_DEBUG, "%s " fmt, gsm_fn_as_gsmtime_str(fn), ## args)
/* LOGP with lchan + frame number prefix */
#define LOGPLCFN(lchan, fn, ss, lvl, fmt, args...) \
LOGP(ss, lvl, "%s %s " fmt, gsm_lchan_name(lchan), gsm_fn_as_gsmtime_str(fn), ## args)
/* LOGP with lchan + gsm_time prefix */
#define LOGPLCGT(lchan, gt, ss, lvl, fmt, args...) \
LOGP(ss, lvl, "%s %s " fmt, gsm_lchan_name(lchan), osmo_dump_gsmtime(gt), ## args)
#endif /* _LOGGING_H */

View File

@ -20,4 +20,6 @@ bool ts45008_83_is_sub(struct gsm_lchan *lchan, uint32_t fn);
int is_meas_complete(struct gsm_lchan *lchan, uint32_t fn);
void lchan_meas_handle_sacch(struct gsm_lchan *lchan, struct msgb *msg);
#endif

View File

@ -22,6 +22,9 @@ struct msgb;
/* Access 3rd part of msgb control buffer */
#define rtpmsg_ts(x) ((x)->cb[2])
/* Access 4th part of msgb control buffer */
#define rtpmsg_is_rfc5993_sid(x) ((x)->cb[3])
/**
* Classification of OML message. ETSI for plain GSM 12.21
* messages and IPA/Osmo for manufacturer messages.

View File

@ -1,7 +1,7 @@
/* Header for all NM FSM. Following 3GPP TS 12.21 Figure 2/GSM 12.21:
GSM 12.21 Objects' Operational state and availability status behaviour during initialization */
/* (C) 2020 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
/* (C) 2020 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* Author: Pau Espin Pedrol <pespin@sysmocom.de>
*
* All Rights Reserved
@ -14,7 +14,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -25,24 +25,34 @@
#include <osmocom/core/fsm.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/msgb.h>
/* Common */
enum nm_fsm_events {
NM_EV_SW_ACT,
NM_EV_RX_SETATTR, /* data: struct nm_fsm_ev_setattr_data */
NM_EV_RX_OPSTART,
NM_EV_OPSTART_ACK,
NM_EV_OPSTART_NACK,
NM_EV_SHUTDOWN_START,
NM_EV_SHUTDOWN_FINISH,
NM_EV_OML_UP,
NM_EV_RSL_UP, /* RadioCarrier and BaseBand Transceiver only */
NM_EV_RSL_DOWN, /* RadioCarrier and BaseBand Transceiver only */
NM_EV_PHYLINK_UP, /* RadioCarrier and BaseBand Transceiver only */
NM_EV_PHYLINK_DOWN, /* RadioCarrier and BaseBand Transceiver only */
NM_EV_DISABLE, /* RadioCarrier and BaseBand Transceiver only */
NM_EV_BBTRANSC_INSTALLED, /* Radio Channel only */
NM_EV_BBTRANSC_ENABLED, /* Radio Channel only */
NM_EV_BBTRANSC_DISABLED, /* Radio Channel only */
NM_EV_RCARRIER_ENABLED, /* Radio Channel only */
NM_EV_RCARRIER_DISABLED, /* Radio Channel only */
};
extern const struct value_string nm_fsm_event_names[];
struct nm_fsm_ev_setattr_data {
const struct msgb *msg;
};
/* BTS SiteManager */
enum nm_bts_sm_op_fsm_states {
@ -84,3 +94,30 @@ enum nm_chan_op_fsm_states {
NM_CHAN_ST_OP_ENABLED,
};
extern struct osmo_fsm nm_chan_fsm;
/* GPRS NSE */
enum nm_gprs_nse_op_fsm_states {
NM_GPRS_NSE_ST_OP_DISABLED_NOTINSTALLED,
NM_GPRS_NSE_ST_OP_DISABLED_DEPENDENCY,
NM_GPRS_NSE_ST_OP_DISABLED_OFFLINE,
NM_GPRS_NSE_ST_OP_ENABLED,
};
extern struct osmo_fsm nm_gprs_nse_fsm;
/* GPRS NSVC */
enum nm_gprs_nsvc_op_fsm_states {
NM_GPRS_NSVC_ST_OP_DISABLED_NOTINSTALLED,
NM_GPRS_NSVC_ST_OP_DISABLED_DEPENDENCY,
NM_GPRS_NSVC_ST_OP_DISABLED_OFFLINE,
NM_GPRS_NSVC_ST_OP_ENABLED,
};
extern struct osmo_fsm nm_gprs_nsvc_fsm;
/* GPRS CELL */
enum nm_gprs_cell_op_fsm_states {
NM_GPRS_CELL_ST_OP_DISABLED_NOTINSTALLED,
NM_GPRS_CELL_ST_OP_DISABLED_DEPENDENCY,
NM_GPRS_CELL_ST_OP_DISABLED_OFFLINE,
NM_GPRS_CELL_ST_OP_ENABLED,
};
extern struct osmo_fsm nm_gprs_cell_fsm;

View File

@ -0,0 +1,61 @@
/* Maintain and generate ASCI notifications */
/*
* (C) 2023 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* All Rights Reserved
*
* SPDX-License-Identifier: AGPL-3.0+
*
* Author: Harald Welte
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
/* one [concurrent] ASCI (VBS/VGCS) notification */
struct asci_notification {
struct llist_head list; /* linked to bts->asci.notifications */
/* Group call reference (TS 24.008 10.5.1.9 "Descriptive group or broadcast call reference") */
uint8_t group_call_ref[5];
/* Group Channel Description (TS 44.018 10.5.2.14b) */
struct {
bool present;
uint8_t value[255];
uint8_t len;
} chan_desc;
/* NCH DRX Information (TS 48.058 9.3.47) */
struct {
bool present;
struct rsl_ie_nch_drx_info value;
} nch_drx_info;
};
int bts_asci_notification_add(struct gsm_bts *bts, const uint8_t *group_call_ref, const uint8_t *chan_desc,
uint8_t chan_desc_len, const struct rsl_ie_nch_drx_info *nch_drx_info);
int bts_asci_notification_del(struct gsm_bts *bts, const uint8_t *group_call_ref);
int bts_asci_notification_reset(struct gsm_bts *bts);
const struct asci_notification *bts_asci_notification_get_next(struct gsm_bts *bts);
void append_group_call_information(struct bitvec *bv, const uint8_t *gcr, const uint8_t *ch_desc, uint8_t ch_desc_len);
int bts_asci_notify_nch_gen_msg(struct gsm_bts *bts, uint8_t *out_buf);
int bts_asci_notify_facch_gen_msg(struct gsm_bts *bts, uint8_t *out_buf, const uint8_t *group_call_ref,
const uint8_t *chan_desc, uint8_t chan_desc_len);

View File

@ -32,6 +32,7 @@ struct gsm_abis_mo {
struct gsm_bts *bts;
/* NM BTS Site Manager FSM */
struct osmo_fsm_inst *fi;
bool setattr_success;
bool opstart_success;
};
@ -47,7 +48,7 @@ int oml_mo_statechg_ack(const struct gsm_abis_mo *mo);
int oml_mo_statechg_nack(const struct gsm_abis_mo *mo, uint8_t nack_cause);
/* Change the state and send STATE CHG REP */
int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state);
int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state, int adm_state);
/* First initialization of MO, does _not_ generate state changes */
void oml_mo_state_init(struct gsm_abis_mo *mo, int op_state, int avail_state);
@ -62,11 +63,12 @@ int oml_tx_state_changed(const struct gsm_abis_mo *mo);
int oml_mo_tx_sw_act_rep(const struct gsm_abis_mo *mo);
int oml_fom_ack_nack(struct msgb *old_msg, uint8_t cause);
int oml_fom_ack_nack_copy_msg(const struct msgb *old_msg, uint8_t cause);
int oml_mo_fom_ack_nack(const struct gsm_abis_mo *mo, uint8_t orig_msg_type,
uint8_t cause);
extern const unsigned int oml_default_t200_ms[7];
extern const uint32_t oml_default_t200_fn[7];
/* Transmit failure event report */
int oml_tx_failure_event_rep(const struct gsm_abis_mo *mo, enum abis_nm_severity severity,
@ -76,11 +78,11 @@ void gsm_mo_init(struct gsm_abis_mo *mo, struct gsm_bts *bts,
uint8_t obj_class, uint8_t p1, uint8_t p2, uint8_t p3);
struct gsm_abis_mo *gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class,
const struct abis_om_obj_inst *obj_inst);
const struct abis_om_obj_inst *obj_inst,
enum abis_nm_nack_cause *c);
struct gsm_nm_state *gsm_objclass2nmstate(struct gsm_bts *bts, uint8_t obj_class,
const struct abis_om_obj_inst *obj_inst);
void *gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class,
const struct abis_om_obj_inst *obj_inst);
const struct abis_om_obj_inst *obj_inst,
enum abis_nm_nack_cause *c);
#endif // _OML_H */

48
include/osmo-bts/osmux.h Normal file
View File

@ -0,0 +1,48 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <osmocom/core/select.h>
#include <osmocom/netif/osmux.h>
struct gsm_bts;
struct gsm_lchan;
enum osmux_usage {
OSMUX_USAGE_OFF = 0,
OSMUX_USAGE_ON = 1,
OSMUX_USAGE_ONLY = 2,
};
struct osmux_state {
enum osmux_usage use;
char *local_addr;
uint16_t local_port;
struct osmo_fd fd;
uint8_t batch_factor;
unsigned int batch_size;
bool dummy_padding;
struct llist_head osmux_handle_list;
};
/* Contains a "struct osmux_in_handle" towards a specific peer (remote IPaddr+port) */
struct osmux_handle {
struct llist_head head;
struct gsm_bts *bts;
struct osmux_in_handle *in;
struct osmo_sockaddr rem_addr;
int refcnt;
};
int bts_osmux_init(struct gsm_bts *bts);
void bts_osmux_release(struct gsm_bts *bts);
int bts_osmux_open(struct gsm_bts *bts);
int lchan_osmux_init(struct gsm_lchan *lchan, uint8_t rtp_payload);
void lchan_osmux_release(struct gsm_lchan *lchan);
int lchan_osmux_connect(struct gsm_lchan *lchan);
bool lchan_osmux_connected(const struct gsm_lchan *lchan);
int lchan_osmux_send_frame(struct gsm_lchan *lchan, const uint8_t *payload,
unsigned int payload_len, unsigned int duration, bool marker);
int lchan_osmux_skipped_frame(struct gsm_lchan *lchan, unsigned int duration);

View File

@ -7,6 +7,55 @@
struct paging_state;
struct gsm_bts;
struct asci_notification;
/* abstract representation of P1 rest octets; we only implement those parts we need for now */
struct p1_rest_octets {
struct {
bool present;
uint8_t nln;
uint8_t nln_status;
} nln_pch;
bool packet_page_ind[2];
bool r8_present;
struct {
bool prio_ul_access;
bool etws_present;
struct {
bool is_first;
uint8_t page_nr;
const uint8_t *page;
size_t page_bytes;
} etws;
} r8;
};
/* abstract representation of P2 rest octets; we only implement those parts we need for now */
struct p2_rest_octets {
struct {
bool present;
uint8_t cn3;
} cneed;
struct {
bool present;
uint8_t nln;
uint8_t nln_status;
} nln_pch;
};
/* abstract representation of P3 rest octets; we only implement those parts we need for now */
struct p3_rest_octets {
struct {
bool present;
uint8_t cn3;
uint8_t cn4;
} cneed;
struct {
bool present;
uint8_t nln;
uint8_t nln_status;
} nln_pch;
};
/* initialize paging code */
struct paging_state *paging_init(struct gsm_bts *bts,
@ -35,9 +84,15 @@ int paging_si_update(struct paging_state *ps, struct gsm48_control_channel_descr
int paging_add_identity(struct paging_state *ps, uint8_t paging_group,
const uint8_t *identity_lv, uint8_t chan_needed);
/* Add an IMM.ASS message to the paging queue */
int paging_add_imm_ass(struct paging_state *ps, const uint8_t *data,
uint8_t len);
/* Add a ready formatted MAC block message to the paging queue, this can be an IMMEDIATE ASSIGNMENT, or a
* PAGING COMMAND (from the PCU) */
int paging_add_macblock(struct paging_state *ps, uint32_t msg_id, const char *imsi, bool confirm, const uint8_t *macblock);
/* Paging rest octests */
void append_p1_rest_octets(struct bitvec *bv, const struct p1_rest_octets *p1ro,
const struct asci_notification *notif);
void append_p2_rest_octets(struct bitvec *bv, const struct p2_rest_octets *p2ro);
void append_p3_rest_octets(struct bitvec *bv, const struct p3_rest_octets *p3ro);
/* generate paging message for given gsm time */
int paging_gen_msg(struct paging_state *ps, uint8_t *out_buf, struct gsm_time *gt,

View File

@ -1,8 +1,14 @@
#ifndef _PCU_IF_H
#define _PCU_IF_H
#include <osmo-bts/pcuif_proto.h>
struct gsm_bts_sm;
extern int pcu_direct;
#define PCUIF_HDR_SIZE (sizeof(struct gsm_pcu_if) - sizeof(((struct gsm_pcu_if *)0)->u))
int pcu_tx_info_ind(void);
int pcu_tx_si(const struct gsm_bts *bts, enum osmo_sysinfo_type si_type, bool enable);
int pcu_tx_app_info_req(struct gsm_bts *bts, uint8_t app_type, uint8_t len, const uint8_t *app_data);
@ -15,11 +21,13 @@ int pcu_tx_rach_ind(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
int16_t qta, uint16_t ra, uint32_t fn, uint8_t is_11bit,
enum ph_burst_type burst_type, uint8_t sapi);
int pcu_tx_time_ind(uint32_t fn);
int pcu_tx_interf_ind(const struct gsm_bts_trx *trx, uint32_t fn);
int pcu_tx_pag_req(const uint8_t *identity_lv, uint8_t chan_needed);
int pcu_tx_pch_data_cnf(uint32_t fn, uint8_t *data, uint8_t len);
int pcu_tx_data_cnf(uint32_t msg_id, uint8_t sapi);
int pcu_tx_susp_req(struct gsm_lchan *lchan, uint32_t tlli, const uint8_t *ra_id, uint8_t cause);
int pcu_sock_send(struct msgb *msg);
int pcu_sock_init(const char *path);
int pcu_sock_init(const char *path, int qlength_max);
void pcu_sock_exit(void);
bool pcu_connected(void);

View File

@ -3,40 +3,41 @@
#include <osmocom/gsm/l1sap.h>
#include <arpa/inet.h>
#include <osmocom/gsm/protocol/gsm_23_003.h>
#define PCU_SOCK_DEFAULT "/tmp/pcu_bts"
#define PCU_IF_VERSION 0x0a
#define PCU_IF_VERSION 0x0c
#define TXT_MAX_LEN 128
/* msg_type */
#define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */
#define PCU_IF_MSG_DATA_CNF 0x01 /* confirm (e.g. transmission on PCH) */
#define PCU_IF_MSG_DATA_IND 0x02 /* receive data from given channel */
#define PCU_IF_MSG_SUSP_REQ 0x03 /* BTS forwards GPRS SUSP REQ to PCU */
#define PCU_IF_MSG_APP_INFO_REQ 0x04 /* BTS asks PCU to transmit APP INFO via PACCH */
#define PCU_IF_MSG_RTS_REQ 0x10 /* ready to send request */
#define PCU_IF_MSG_DATA_CNF_DT 0x11 /* confirm (with direct tlli) */
#define PCU_IF_MSG_DATA_CNF_2 0x11 /* confirm (using message id) */
#define PCU_IF_MSG_RACH_IND 0x22 /* receive RACH */
#define PCU_IF_MSG_INFO_IND 0x32 /* retrieve BTS info */
#define PCU_IF_MSG_ACT_REQ 0x40 /* activate/deactivate PDCH */
#define PCU_IF_MSG_TIME_IND 0x52 /* GSM time indication */
#define PCU_IF_MSG_INTERF_IND 0x53 /* interference report */
#define PCU_IF_MSG_PAG_REQ 0x60 /* paging request */
#define PCU_IF_MSG_TXT_IND 0x70 /* Text indication for BTS */
#define PCU_IF_MSG_CONTAINER 0x80 /* Transparent container message */
/* sapi */
#define PCU_IF_SAPI_RACH 0x01 /* channel request on CCCH */
#define PCU_IF_SAPI_AGCH 0x02 /* assignment on AGCH */
#define PCU_IF_SAPI_PCH 0x03 /* paging/assignment on PCH */
#define PCU_IF_SAPI_BCCH 0x04 /* SI on BCCH */
#define PCU_IF_SAPI_PDTCH 0x05 /* packet data/control/ccch block */
#define PCU_IF_SAPI_PRACH 0x06 /* packet random access channel */
#define PCU_IF_SAPI_PTCCH 0x07 /* packet TA control channel */
#define PCU_IF_SAPI_AGCH_DT 0x08 /* assignment on AGCH but with additional TLLI */
#define PCU_IF_SAPI_PCH_2 0x08 /* assignment on PCH (confirmed using message id) */
#define PCU_IF_SAPI_AGCH_2 0x09 /* assignment on AGCH (confirmed using message id) */
/* flags */
#define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
#define PCU_IF_FLAG_SYSMO (1 << 1)/* access PDCH of sysmoBTS directly */
#define PCU_IF_FLAG_DIRECT_PHY (1 << 1)/* access PHY directly via dedicated hardware support */
#define PCU_IF_FLAG_CS1 (1 << 16)
#define PCU_IF_FLAG_CS2 (1 << 17)
#define PCU_IF_FLAG_CS3 (1 << 18)
@ -56,6 +57,20 @@
#define PCU_IF_ADDR_TYPE_IPV4 0x04 /* IPv4 address */
#define PCU_IF_ADDR_TYPE_IPV6 0x29 /* IPv6 address */
/* BTS model */
enum gsm_pcuif_bts_model {
PCU_IF_BTS_MODEL_UNSPEC,
PCU_IF_BTS_MODEL_LC15,
PCU_IF_BTS_MODEL_OC2G,
PCU_IF_BTS_MODEL_OCTPHY,
PCU_IF_BTS_MODEL_SYSMO,
PCU_IF_BTS_MODEL_TRX,
PCU_IF_BTS_MODEL_RBS,
};
#define PCU_IF_NUM_NSVC 2
#define PCU_IF_NUM_TRX 8
enum gsm_pcu_if_text_type {
PCU_VERSION,
PCU_OML_ALERT,
@ -81,19 +96,10 @@ struct gsm_pcu_if_data {
int16_t lqual_cb; /* !< \brief Link quality in centiBel */
} __attribute__ ((packed));
/* data confirmation with direct tlli (instead of raw mac block with tlli) */
struct gsm_pcu_if_data_cnf_dt {
/* data confirmation with message id (instead of raw mac block) */
struct gsm_pcu_if_data_cnf {
uint8_t sapi;
uint32_t tlli;
uint32_t fn;
uint16_t arfcn;
uint8_t trx_nr;
uint8_t ts_nr;
uint8_t block_nr;
int8_t rssi;
uint16_t ber10k; /* !< \brief BER in units of 0.01% */
int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */
int16_t lqual_cb; /* !< \brief Link quality in centiBel */
uint32_t msg_id;
} __attribute__ ((packed));
struct gsm_pcu_if_rts_req {
@ -138,7 +144,7 @@ struct gsm_pcu_if_info_trx {
struct gsm_pcu_if_info_ind {
uint32_t version;
uint32_t flags;
struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
struct gsm_pcu_if_info_trx trx[PCU_IF_NUM_TRX]; /* TRX infos per BTS */
uint8_t bsic;
/* RAI */
uint16_t mcc, mnc;
@ -167,14 +173,15 @@ struct gsm_pcu_if_info_ind {
uint8_t initial_cs;
uint8_t initial_mcs;
/* NSVC */
uint16_t nsvci[2];
uint16_t local_port[2];
uint16_t remote_port[2];
uint8_t address_type[2];
uint16_t nsvci[PCU_IF_NUM_NSVC];
uint16_t local_port[PCU_IF_NUM_NSVC];
uint16_t remote_port[PCU_IF_NUM_NSVC];
uint8_t address_type[PCU_IF_NUM_NSVC];
union {
struct in_addr v4;
struct in6_addr v6;
} remote_ip[2];
} remote_ip[PCU_IF_NUM_NSVC];
uint8_t bts_model; /* enum gsm_pcuif_bts_model */
} __attribute__ ((packed));
struct gsm_pcu_if_act_req {
@ -208,6 +215,48 @@ struct gsm_pcu_if_susp_req {
uint8_t cause;
} __attribute__ ((packed));
/* Interference measurements on PDCH timeslots */
struct gsm_pcu_if_interf_ind {
uint8_t trx_nr;
uint8_t spare[3];
uint32_t fn;
uint8_t interf[8];
} __attribute__ ((packed));
/* Contains messages transmitted BSC<->PCU, potentially forwarded by BTS via IPA/PCU */
struct gsm_pcu_if_container {
uint8_t msg_type;
uint8_t spare;
uint16_t length; /* network byte order */
uint8_t data[0];
} __attribute__ ((packed));
/* Struct to send a (confirmed) IMMEDIATE ASSIGNMENT message via PCH. The struct is sent as a data request
* (data_req) under SAPI PCU_IF_SAPI_PCH_2. */
struct gsm_pcu_if_pch {
/* message id as reference for confirmation */
uint32_t msg_id;
/* IMSI (to derive paging group) */
char imsi[OSMO_IMSI_BUF_SIZE];
/* GSM mac-block (with immediate assignment message) */
uint8_t data[GSM_MACBLOCK_LEN];
/* Set to true in case the receiving end must send a confirmation
* when the MAC block (data) has been sent. */
bool confirm;
} __attribute__((packed));
/* Struct to send a (confirmed) IMMEDIATE ASSIGNMENT message via AGCH. The struct is sent as a data request
* (data_req) under SAPI PCU_IF_SAPI_AGCH_2. */
struct gsm_pcu_if_agch {
/* message id as reference for confirmation */
uint32_t msg_id;
/* GSM mac-block (with immediate assignment message) */
uint8_t data[GSM_MACBLOCK_LEN];
/* Set to true in case the receiving end must send a confirmation
* when the MAC block (data) has been sent. */
bool confirm;
} __attribute__((packed));
struct gsm_pcu_if {
/* context based information */
uint8_t msg_type; /* message type */
@ -216,8 +265,7 @@ struct gsm_pcu_if {
union {
struct gsm_pcu_if_data data_req;
struct gsm_pcu_if_data data_cnf;
struct gsm_pcu_if_data_cnf_dt data_cnf_dt;
struct gsm_pcu_if_data_cnf data_cnf2;
struct gsm_pcu_if_data data_ind;
struct gsm_pcu_if_susp_req susp_req;
struct gsm_pcu_if_rts_req rts_req;
@ -228,6 +276,8 @@ struct gsm_pcu_if {
struct gsm_pcu_if_time_ind time_ind;
struct gsm_pcu_if_pag_req pag_req;
struct gsm_pcu_if_app_info_req app_info_req;
struct gsm_pcu_if_interf_ind interf_ind;
struct gsm_pcu_if_container container;
} u;
} __attribute__ ((packed));

View File

@ -48,9 +48,10 @@ struct phy_link {
uint32_t clock_advance;
uint32_t rts_advance;
bool use_legacy_setbsic;
uint8_t trxd_hdr_ver_max; /* Maximum TRXD header version to negotiate */
uint8_t trxd_pdu_ver_max; /* Maximum TRXD PDU version to negotiate */
bool powered; /* last POWERON (true) or POWEROFF (false) confirmed */
bool poweronoff_sent; /* is there a POWERON/POWEROFF in transit? (one or the other based on ->powered) */
bool poweron_sent; /* is there a POWERON in transit? */
bool poweroff_sent; /* is there a POWEROFF in transit? */
} osmotrx;
struct {
char *mcast_dev; /* Network device for multicast */
@ -97,7 +98,7 @@ struct phy_instance {
struct phy_link *phy_link;
/* back-pointer to the TRX to which we're associated */
struct gsm_bts_trx *trx;
struct gsm_bts_trx *trx; /* NOTE: may be NULL! */
union {
struct {
@ -112,11 +113,8 @@ struct phy_instance {
} sysmobts;
struct {
struct trx_l1h *hdl;
bool sw_act_reported;
struct trx_dl_burst_req br[TRX_NR_TS];
} osmotrx;
struct {
struct l1sched_trx sched;
} virt;
struct {
/* logical transceiver number within one PHY */
uint32_t trx_id;
@ -158,7 +156,7 @@ struct phy_instance {
struct phy_link *phy_link_by_num(int num);
struct phy_link *phy_link_create(void *ctx, int num);
void phy_link_destroy(struct phy_link *plink);
const char *phy_link_name(struct phy_link *plink);
const char *phy_link_name(const struct phy_link *plink);
void phy_link_state_set(struct phy_link *plink, enum phy_link_state state);
enum phy_link_state phy_link_state_get(struct phy_link *plink);
const char *phy_link_state_name(enum phy_link_state state);
@ -168,15 +166,16 @@ struct phy_instance *phy_instance_by_num(const struct phy_link *plink, int num);
struct phy_instance *phy_instance_create(struct phy_link *plink, int num);
void phy_instance_link_to_trx(struct phy_instance *pinst, struct gsm_bts_trx *trx);
void phy_instance_destroy(struct phy_instance *pinst);
const char *phy_instance_name(struct phy_instance *pinst);
const char *phy_instance_name(const struct phy_instance *pinst);
static inline struct phy_instance *trx_phy_instance(const struct gsm_bts_trx *trx)
{
OSMO_ASSERT(trx);
return trx->role_bts.l1h;
return trx->pinst;
}
int bts_model_phy_link_open(struct phy_link *plink);
int bts_model_phy_link_close(struct phy_link *plink);
#define LOGPPHL(plink, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " fmt, phy_link_name(plink), ##args)
#define LOGPPHI(pinst, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " fmt, phy_instance_name(pinst), ##args)

View File

@ -1,11 +1,90 @@
#pragma once
#include <stdint.h>
#include <osmo-bts/gsm_data.h>
#include <stdbool.h>
/* MS/BS Power related measurement averaging algo */
enum gsm_power_ctrl_meas_avg_algo {
GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE = 0x00,
GSM_PWR_CTRL_MEAS_AVG_ALGO_UNWEIGHTED = 0x01,
GSM_PWR_CTRL_MEAS_AVG_ALGO_WEIGHTED = 0x02,
GSM_PWR_CTRL_MEAS_AVG_ALGO_MOD_MEDIAN = 0x03,
/* EWMA is an Osmocom specific algo */
GSM_PWR_CTRL_MEAS_AVG_ALGO_OSMO_EWMA = 0x04,
};
/* MS/BS Power related measurement parameters */
struct gsm_power_ctrl_meas_params {
/* Thresholds (see 3GPP TS 45.008, section A.3.2.1) */
uint8_t lower_thresh; /* lower (decreasing) direction */
uint8_t upper_thresh; /* upper (increasing) direction */
/* Threshold Comparators for lower (decreasing) direction */
uint8_t lower_cmp_p; /* P1 for RxLev, P3 for RxQual */
uint8_t lower_cmp_n; /* N1 for RxLev, N3 for RxQual */
/* Threshold Comparators for upper (increasing) direction */
uint8_t upper_cmp_p; /* P2 for RxLev, P4 for RxQual */
uint8_t upper_cmp_n; /* N2 for RxLev, N4 for RxQual */
/* Hreqave and Hreqt (see 3GPP TS 45.008, Annex A) */
uint8_t h_reqave;
uint8_t h_reqt;
/* AVG algorithm and its specific parameters */
enum gsm_power_ctrl_meas_avg_algo algo;
union {
/* Exponentially Weighted Moving Average */
struct {
/* Smoothing factor: higher the value - less smoothing */
uint8_t alpha; /* 1 .. 99 (in %) */
} ewma;
};
};
/* MS/BS Power Control parameters */
struct gsm_power_ctrl_params {
/* Minimum interval between power level changes */
uint8_t ctrl_interval; /* 1 step is 2 SACCH periods */
/* Power change step size (maximum) */
uint8_t inc_step_size_db; /* increasing direction */
uint8_t red_step_size_db; /* reducing direction */
/* Measurement averaging parameters for RxLev & RxQual */
struct gsm_power_ctrl_meas_params rxqual_meas;
struct gsm_power_ctrl_meas_params rxlev_meas;
/* Measurement averaging parameters for C/I, per chan type */
struct gsm_power_ctrl_meas_params ci_fr_meas;
struct gsm_power_ctrl_meas_params ci_hr_meas;
struct gsm_power_ctrl_meas_params ci_amr_fr_meas;
struct gsm_power_ctrl_meas_params ci_amr_hr_meas;
struct gsm_power_ctrl_meas_params ci_sdcch_meas;
struct gsm_power_ctrl_meas_params ci_gprs_meas;
};
/* Measurement pre-processing state */
struct gsm_power_ctrl_meas_proc_state {
/* Number of measurements processed */
unsigned int meas_num;
/* Algorithm specific data */
union {
struct {
/* Scaled up 100 times average value */
int Avg100;
} ewma;
};
};
/* Default MS/BS Power Control parameters */
extern const struct gsm_power_ctrl_params power_ctrl_params_def;
void power_ctrl_params_def_reset(struct gsm_power_ctrl_params *params, bool is_bs_pwr);
struct gsm_lchan;
int lchan_ms_pwr_ctrl(struct gsm_lchan *lchan,
const uint8_t ms_power_lvl,
const int8_t ul_rssi_dbm);
const int8_t ul_rssi_dbm,
const int16_t ul_lqual_cb);
int lchan_bs_pwr_ctrl(struct gsm_lchan *lchan,
const struct gsm48_hdr *gh);
const struct gsm48_meas_res *mr);

View File

@ -4,7 +4,8 @@
#define LCHAN_FN_DUMMY 0xFFFFFFFF
#define LCHAN_FN_WAIT 0xFFFFFFFE
int msgb_queue_flush(struct llist_head *list);
bool rsl_chan_rt_is_asci(enum rsl_cmod_crt chan_rt);
bool rsl_chan_rt_is_vgcs(enum rsl_cmod_crt chan_rt);
int down_rsl(struct gsm_bts_trx *trx, struct msgb *msg);
int rsl_tx_rf_res(struct gsm_bts_trx *trx);
@ -16,8 +17,8 @@ int rsl_tx_chan_act_acknack(struct gsm_lchan *lchan, uint8_t cause);
int rsl_tx_conn_fail(const struct gsm_lchan *lchan, uint8_t cause);
int rsl_tx_rf_rel_ack(struct gsm_lchan *lchan);
int rsl_tx_hando_det(struct gsm_lchan *lchan, uint8_t *ho_delay);
int lchan_deactivate(struct gsm_lchan *lchan);
int rsl_tx_listener_det(struct gsm_lchan *lchan, uint8_t *acc_delay);
int rsl_tx_talker_det(struct gsm_lchan *lchan, uint8_t *acc_delay);
/* call-back for LAPDm code, called when it wants to send msgs UP */
int lapdm_rll_tx_cb(struct msgb *msg, struct lapdm_entity *le, void *ctx);
@ -34,6 +35,6 @@ void ipacc_dyn_pdch_complete(struct gsm_bts_trx_ts *ts, int rc);
int rsl_tx_cbch_load_indication(struct gsm_bts *bts, bool ext_cbch, bool overflow, uint8_t amount);
int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len, const struct lapdm_entity *le);
int rsl_tx_meas_res(struct gsm_lchan *lchan, const uint8_t *l3, unsigned int l3_len, int timing_offset);
#endif // _RSL_H */

View File

@ -0,0 +1,20 @@
/*
* RTP input validation function: makes the accept-or-drop decision,
* and for some codecs signals additional required actions such as
* dropping one header octet.
*/
#pragma once
#include <stdint.h>
#include <osmo-bts/lchan.h>
enum pl_input_decision {
PL_DECISION_DROP,
PL_DECISION_ACCEPT,
PL_DECISION_STRIP_HDR_OCTET,
};
enum pl_input_decision
rtp_payload_input_preen(struct gsm_lchan *lchan, const uint8_t *rtp_pl,
unsigned rtp_pl_len, bool *rfc5993_sid_flag);

View File

@ -1,17 +1,18 @@
#ifndef TRX_SCHEDULER_H
#define TRX_SCHEDULER_H
#pragma once
#include <osmocom/core/utils.h>
#include <osmocom/core/rate_ctr.h>
#include <osmo-bts/gsm_data.h>
/* Whether a logical channel must be activated automatically */
#define TRX_CHAN_FLAG_AUTO_ACTIVE (1 << 0)
#define TRX_GMSK_NB_TSC(br) \
_sched_train_seq_gmsk_nb[(br)->tsc_set][(br)->tsc]
/* FIXME: we should actually activate 'auto-active' channels */
#define TRX_CHAN_IS_ACTIVE(state, chan) \
(trx_chan_desc[chan].flags & TRX_CHAN_FLAG_AUTO_ACTIVE || (state)->active)
#define TRX_8PSK_NB_TSC(br) \
_sched_train_seq_8psk_nb[(br)->tsc]
#define TRX_CHAN_IS_DEDIC(chan) \
(chan >= TRXC_TCHF)
/* These types define the different channels on a multiframe.
* Each channel has queues and can be activated individually.
@ -23,6 +24,10 @@ enum trx_chan_type {
TRXC_BCCH,
TRXC_RACH,
TRXC_CCCH,
TRXC_CBCH,
TRXC_PDTCH,
TRXC_PTCCH,
/* Dedicated channels start here */
TRXC_TCHF,
TRXC_TCHH_0,
TRXC_TCHH_1,
@ -53,9 +58,6 @@ enum trx_chan_type {
TRXC_SACCH8_5,
TRXC_SACCH8_6,
TRXC_SACCH8_7,
TRXC_PDTCH,
TRXC_PTCCH,
TRXC_CBCH,
_TRX_CHAN_MAX
};
@ -63,13 +65,15 @@ enum trx_chan_type {
#define GPRS_BURST_LEN GSM_BURST_LEN
#define EGPRS_BURST_LEN 444
enum trx_burst_type {
TRX_BURST_GMSK,
TRX_BURST_8PSK,
enum trx_mod_type {
TRX_MOD_T_GMSK,
TRX_MOD_T_8PSK,
TRX_MOD_T_AQPSK,
};
/* A set of measurements belonging to one Uplink burst */
struct l1sched_meas_set {
uint32_t fn; /* TDMA frame number */
int16_t toa256; /* Timing of Arrival (1/256 of a symbol) */
int16_t ci_cb; /* Carrier-to-Interference (cB) */
float rssi; /* RSSI (dBm) */
@ -85,14 +89,13 @@ struct l1sched_chan_state {
/* scheduler */
bool active; /* Channel is active */
ubit_t *dl_bursts; /* burst buffer for TX */
enum trx_burst_type dl_burst_type; /* GMSK or 8PSK burst type */
enum trx_mod_type dl_mod_type; /* Downlink modulation type */
uint8_t dl_mask; /* mask of transmitted bursts */
sbit_t *ul_bursts; /* burst buffer for RX */
sbit_t *ul_bursts_prev;/* previous burst buffer for RX (repeated SACCH) */
uint32_t ul_first_fn; /* fn of first burst */
uint8_t ul_mask; /* mask of received bursts */
uint32_t ul_mask; /* mask of received bursts */
/* loss detection */
uint8_t lost_frames; /* how many L2 frames were lost */
uint32_t last_tdma_fn; /* last processed TDMA frame number */
uint32_t proc_tdma_fs; /* how many TDMA frames were processed */
uint32_t lost_tdma_fs; /* how many TDMA frames were lost */
@ -103,19 +106,20 @@ struct l1sched_chan_state {
/* AMR */
uint8_t codec[4]; /* 4 possible codecs for amr */
int codecs; /* number of possible codecs */
float ber_sum; /* sum of bit error rates */
int ber_num; /* number of bit error rates */
int lqual_cb_sum; /* sum of link quality samples (in cB) */
int lqual_cb_num; /* number of link quality samples */
uint8_t ul_ft; /* current uplink FT index */
uint8_t dl_ft; /* current downlink FT index */
uint8_t ul_cmr; /* current uplink CMR index */
uint8_t dl_cmr; /* current downlink CMR index */
uint8_t amr_loop; /* if AMR loop is enabled */
uint8_t amr_last_dtx; /* last received dtx frame type */
/* TCH/H */
uint8_t dl_ongoing_facch; /* FACCH/H on downlink */
uint8_t ul_ongoing_facch; /* FACCH/H on uplink */
uint8_t dl_facch_bursts; /* number of remaining DL FACCH bursts */
/* encryption */
int ul_encr_algo; /* A5/x encry algo downlink */
int dl_encr_algo; /* A5/x encry algo uplink */
@ -124,10 +128,14 @@ struct l1sched_chan_state {
uint8_t ul_encr_key[MAX_A5_KEY_LEN];
uint8_t dl_encr_key[MAX_A5_KEY_LEN];
/* Simple ring buffer (up to 8 unique measurements) */
/* Uplink measurements */
struct {
struct l1sched_meas_set buf[8];
/* Active channel measurements (simple ring buffer) */
struct l1sched_meas_set buf[24]; /* up to 24 (BUFMAX) entries */
unsigned int current; /* current position */
/* Interference measurements */
int interf_avg; /* sliding average */
} meas;
/* handover */
@ -135,6 +143,8 @@ struct l1sched_chan_state {
};
struct l1sched_ts {
struct gsm_bts_trx_ts *ts; /* timeslot we belong to */
uint8_t mf_index; /* selected multiframe index */
uint8_t mf_period; /* period of multiframe */
const struct trx_sched_frame *mf_frames; /* pointer to frame layout */
@ -147,25 +157,18 @@ struct l1sched_ts {
struct l1sched_chan_state chan_state[_TRX_CHAN_MAX];
};
struct l1sched_trx {
struct gsm_bts_trx *trx;
struct l1sched_ts ts[TRX_NR_TS];
};
struct l1sched_ts *l1sched_trx_get_ts(struct l1sched_trx *l1t, uint8_t tn);
/*! \brief Initialize the scheduler data structures */
int trx_sched_init(struct l1sched_trx *l1t, struct gsm_bts_trx *trx);
void trx_sched_init(struct gsm_bts_trx *trx);
/*! \brief De-initialize the scheduler data structures */
void trx_sched_exit(struct l1sched_trx *l1t);
void trx_sched_clean(struct gsm_bts_trx *trx);
/*! \brief Handle a PH-DATA.req from L2 down to L1 */
int trx_sched_ph_data_req(struct l1sched_trx *l1t, struct osmo_phsap_prim *l1sap);
int trx_sched_ph_data_req(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap);
/*! \brief Handle a PH-TCH.req from L2 down to L1 */
int trx_sched_tch_req(struct l1sched_trx *l1t, struct osmo_phsap_prim *l1sap);
int trx_sched_tch_req(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap);
/*! \brief PHY informs us of new (current) GSM frame number */
int trx_sched_clock(struct gsm_bts *bts, uint32_t fn);
@ -177,21 +180,25 @@ int trx_sched_clock_started(struct gsm_bts *bts);
int trx_sched_clock_stopped(struct gsm_bts *bts);
/*! \brief set multiframe scheduler to given physical channel config */
int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn,
enum gsm_phys_chan_config pchan);
int trx_sched_set_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config pchan);
/*! \brief set all matching logical channels active/inactive */
int trx_sched_set_lchan(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t link_id, bool active);
int trx_sched_set_lchan(struct gsm_lchan *lchan, uint8_t chan_nr, uint8_t link_id, bool active);
/*! \brief set uplink access on given logical channels active/inactive */
int trx_sched_set_ul_access(struct gsm_lchan *lchan, uint8_t chan_nr, bool active);
/*! \brief set all logical channels of BCCH/CCCH active/inactive */
int trx_sched_set_bcch_ccch(struct gsm_lchan *lchan, bool active);
/*! \brief set mode of all matching logical channels to given mode(s) */
int trx_sched_set_mode(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t rsl_cmode,
int trx_sched_set_mode(struct gsm_bts_trx_ts *ts, uint8_t chan_nr, uint8_t rsl_cmode,
uint8_t tch_mode, int codecs, uint8_t codec0, uint8_t codec1,
uint8_t codec2, uint8_t codec3, uint8_t initial_codec,
uint8_t handover);
/*! \brief set ciphering on given logical channels */
int trx_sched_set_cipher(struct l1sched_trx *l1t, uint8_t chan_nr, int downlink,
int algo, uint8_t *key, int key_len);
int trx_sched_set_cipher(struct gsm_lchan *lchan, uint8_t chan_nr, bool downlink);
/* frame structures */
struct trx_sched_frame {
@ -222,13 +229,17 @@ struct trx_sched_multiframe {
int find_sched_mframe_idx(enum gsm_phys_chan_config pchan, uint8_t tn);
/*! Determine if given frame number contains SACCH (true) or other (false) burst */
bool trx_sched_is_sacch_fn(struct gsm_bts_trx_ts *ts, uint32_t fn, bool uplink);
bool trx_sched_is_sacch_fn(const struct gsm_bts_trx_ts *ts, uint32_t fn, bool uplink);
extern const struct trx_sched_multiframe trx_sched_multiframes[];
#define TRX_BI_F_NOPE_IND (1 << 0)
#define TRX_BI_F_MOD_TYPE (1 << 1)
#define TRX_BI_F_TS_INFO (1 << 2)
#define TRX_BI_F_CI_CB (1 << 3)
#define TRX_BI_F_TRX_NUM (1 << 4)
#define TRX_BI_F_BATCH_IND (1 << 5)
#define TRX_BI_F_SHADOW_IND (1 << 6)
#define TRX_BI_F_ACCESS_BURST (1 << 7)
/*! UL burst indication with the corresponding meta info */
struct trx_ul_burst_ind {
@ -242,21 +253,44 @@ struct trx_ul_burst_ind {
int8_t rssi; /*!< Received Signal Strength Indication */
/* Optional fields (defined by flags) */
enum trx_burst_type bt; /*!< Modulation type */
enum trx_mod_type mod; /*!< Modulation type */
uint8_t tsc_set; /*!< Training Sequence Set */
uint8_t tsc; /*!< Training Sequence Code */
int16_t ci_cb; /*!< Carrier-to-Interference ratio (in centiBels) */
uint8_t trx_num; /*!< TRX (RF channel) number */
/* Used internally by the PDU parser */
uint8_t _num_pdus; /*!< Number of processed PDUs */
/* Internally used by the scheduler */
enum trx_chan_type chan;
uint8_t bid;
/*! Burst soft-bits buffer */
sbit_t burst[EGPRS_BURST_LEN];
size_t burst_len;
};
#define TRX_BR_F_FACCH (1 << 0)
/*! DL burst request with the corresponding meta info */
struct trx_dl_burst_req {
uint8_t flags; /*!< see TRX_BR_F_* */
/* Mandatory fields */
uint32_t fn; /*!< TDMA frame number */
uint8_t tn; /*!< TDMA timeslot number */
uint8_t att; /*!< Tx power attenuation */
int8_t scpir; /*!< SCPIR (for AQPSK only) */
uint8_t trx_num; /*!< TRX (RF channel) number */
enum trx_mod_type mod; /*!< Modulation type */
uint8_t tsc_set; /*!< Training Sequence Set */
uint8_t tsc; /*!< Training Sequence Code */
/* Internally used by the scheduler */
enum trx_chan_type chan;
uint8_t bid;
/*! Burst hard-bits buffer */
ubit_t burst[EGPRS_BURST_LEN];
@ -264,23 +298,29 @@ struct trx_dl_burst_req {
};
/*! Handle an UL burst received by PHY */
int trx_sched_route_burst_ind(struct trx_ul_burst_ind *bi, struct l1sched_trx *l1t);
int trx_sched_ul_burst(struct l1sched_trx *l1t, struct trx_ul_burst_ind *bi);
int trx_sched_route_burst_ind(const struct gsm_bts_trx *trx, struct trx_ul_burst_ind *bi);
int trx_sched_ul_burst(struct l1sched_ts *l1ts, struct trx_ul_burst_ind *bi);
/* Averaging mode for trx_sched_meas_avg() */
enum sched_meas_avg_mode {
/* last 4 bursts (default for xCCH, TCH/H, PTCCH and PDTCH) */
SCHED_MEAS_AVG_M_QUAD,
/* first 22 of last 24 bursts (for TCH/F14.4, TCH/F9.6, TCH/F4.8) */
SCHED_MEAS_AVG_M_S24N22,
/* last 22 bursts (for TCH/H4.8, TCH/H2.4) */
SCHED_MEAS_AVG_M_S22N22,
/* last 4 bursts (default for xCCH, PTCCH and PDTCH) */
SCHED_MEAS_AVG_M_S4N4,
/* last 8 bursts (default for TCH/F and FACCH/F) */
SCHED_MEAS_AVG_M_OCTO,
SCHED_MEAS_AVG_M_S8N8,
/* first 4 of last 6 bursts (default for TCH/H) */
SCHED_MEAS_AVG_M_S6N4,
/* last 6 bursts (default for FACCH/H) */
SCHED_MEAS_AVG_M_SIX,
SCHED_MEAS_AVG_M_S6N6,
/* first 4 of last 8 bursts */
SCHED_MEAS_AVG_M8_FIRST_QUAD,
SCHED_MEAS_AVG_M_S8N4,
/* first 2 of last 6 bursts */
SCHED_MEAS_AVG_M6_FIRST_TWO,
SCHED_MEAS_AVG_M_S6N2,
/* middle 2 of last 6 bursts */
SCHED_MEAS_AVG_M6_MIDDLE_TWO,
SCHED_MEAS_AVG_M_S4N2,
};
void trx_sched_meas_push(struct l1sched_chan_state *chan_state,
@ -288,5 +328,5 @@ void trx_sched_meas_push(struct l1sched_chan_state *chan_state,
void trx_sched_meas_avg(const struct l1sched_chan_state *chan_state,
struct l1sched_meas_set *avg,
enum sched_meas_avg_mode mode);
#endif /* TRX_SCHEDULER_H */
uint32_t trx_sched_lookup_fn(const struct l1sched_chan_state *chan_state,
const unsigned int shift);

View File

@ -1,19 +1,18 @@
#pragma once
#define LOGL1S(subsys, level, l1t, tn, chan, fn, fmt, args ...) \
#define LOGL1S(subsys, level, l1ts, chan, fn, fmt, args ...) \
LOGP(subsys, level, "%s %s %s: " fmt, \
gsm_fn_as_gsmtime_str(fn), \
gsm_ts_name(&(l1t)->trx->ts[tn]), \
gsm_ts_name((l1ts)->ts), \
chan >=0 ? trx_chan_desc[chan].name : "", ## args)
typedef int trx_sched_rts_func(struct l1sched_trx *l1t, uint8_t tn,
uint32_t fn, enum trx_chan_type chan);
/* Logging helper adding context from trx_{ul,dl}_burst_{ind,req} */
#define LOGL1SB(subsys, level, l1ts, b, fmt, args ...) \
LOGL1S(subsys, level, l1ts, (b)->chan, (b)->fn, fmt, ## args)
typedef int trx_sched_dl_func(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, struct trx_dl_burst_req *br);
typedef int trx_sched_ul_func(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, const struct trx_ul_burst_ind *bi);
typedef int trx_sched_rts_func(const struct l1sched_ts *l1ts, const struct trx_dl_burst_req *br);
typedef int trx_sched_dl_func(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br);
typedef int trx_sched_ul_func(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi);
struct trx_chan_desc {
/*! \brief Human-readable name */
@ -36,51 +35,39 @@ struct trx_chan_desc {
extern const struct trx_chan_desc trx_chan_desc[_TRX_CHAN_MAX];
extern const ubit_t _sched_dummy_burst[];
extern const ubit_t _sched_tsc[8][26];
extern const ubit_t _sched_egprs_tsc[8][78];
extern const ubit_t _sched_sch_train[64];
extern const ubit_t _sched_train_seq_gmsk_nb[4][8][26];
extern const ubit_t _sched_train_seq_8psk_nb[8][78];
extern const ubit_t _sched_train_seq_gmsk_sb[64];
struct msgb *_sched_dequeue_prim(struct l1sched_trx *l1t, int8_t tn, uint32_t fn,
enum trx_chan_type chan);
struct msgb *_sched_dequeue_prim(struct l1sched_ts *l1ts, const struct trx_dl_burst_req *br);
int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t *l2,
uint8_t l2_len, float rssi,
int _sched_compose_ph_data_ind(struct l1sched_ts *l1ts, uint32_t fn,
enum trx_chan_type chan,
const uint8_t *data, size_t data_len,
uint16_t ber10k, float rssi,
int16_t ta_offs_256bits, int16_t link_qual_cb,
uint16_t ber10k,
enum osmo_ph_pres_info_type presence_info);
int _sched_compose_tch_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t *tch, uint8_t tch_len,
int16_t ta_offs_256bits, uint16_t ber10k, float rssi,
int _sched_compose_tch_ind(struct l1sched_ts *l1ts, uint32_t fn,
enum trx_chan_type chan,
const uint8_t *data, size_t data_len,
uint16_t ber10k, float rssi,
int16_t ta_offs_256bits, int16_t link_qual_cb,
uint8_t is_sub);
int tx_idle_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, struct trx_dl_burst_req *br);
int tx_fcch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, struct trx_dl_burst_req *br);
int tx_sch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, struct trx_dl_burst_req *br);
int tx_data_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, struct trx_dl_burst_req *br);
int tx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, struct trx_dl_burst_req *br);
int tx_tchf_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, struct trx_dl_burst_req *br);
int tx_tchh_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, struct trx_dl_burst_req *br);
int tx_fcch_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br);
int tx_sch_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br);
int tx_data_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br);
int tx_pdtch_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br);
int tx_tchf_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br);
int tx_tchh_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br);
int rx_rach_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, const struct trx_ul_burst_ind *bi);
int rx_data_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, const struct trx_ul_burst_ind *bi);
int rx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, const struct trx_ul_burst_ind *bi);
int rx_tchf_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, const struct trx_ul_burst_ind *bi);
int rx_tchh_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t bid, const struct trx_ul_burst_ind *bi);
int rx_rach_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi);
int rx_data_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi);
int rx_pdtch_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi);
int rx_tchf_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi);
int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi);
void _sched_dl_burst(struct l1sched_trx *l1t, struct trx_dl_burst_req *br);
int _sched_rts(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn);
void _sched_act_rach_det(struct l1sched_trx *l1t, uint8_t tn, uint8_t ss, int activate);
void _sched_dl_burst(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br);
int _sched_rts(const struct l1sched_ts *l1ts, uint32_t fn);
void _sched_act_rach_det(struct gsm_bts_trx *trx, uint8_t tn, uint8_t ss, int activate);

View File

@ -15,4 +15,10 @@ enum signals_global {
S_NEW_NSVC_ATTR,
};
struct nm_statechg_signal_data {
struct gsm_abis_mo *mo;
uint8_t old_state;
uint8_t new_state;
};
#endif

View File

@ -2,4 +2,4 @@
#include <osmo-bts/gsm_data.h>
void lchan_ms_ta_ctrl(struct gsm_lchan *lchan);
void lchan_ms_ta_ctrl(struct gsm_lchan *lchan, uint8_t ms_tx_ta, int16_t toa256);

View File

@ -77,7 +77,13 @@ int get_p_trxout_target_mdBm_lchan(const struct gsm_lchan *lchan);
int get_p_trxout_actual_mdBm(const struct gsm_bts_trx *trx, uint8_t bs_power_red);
int get_p_trxout_actual_mdBm_lchan(const struct gsm_lchan *lchan);
int power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass, ramp_compl_cb_t ramp_compl_cb);
int _power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass_max_power, ramp_compl_cb_t ramp_compl_cb, bool skip_ramping);
#define power_ramp_start(trx, p_total_tgt_mdBm, bypass_max_power, ramp_compl_cb) \
_power_ramp_start(trx, p_total_tgt_mdBm, bypass_max_power, ramp_compl_cb, false)
#define power_ramp_force(trx, p_total_tgt_mdBm, bypass_max_power, ramp_compl_cb) \
_power_ramp_start(trx, p_total_tgt_mdBm, bypass_max_power, ramp_compl_cb, true)
void power_ramp_abort(struct gsm_bts_trx *trx);
void power_trx_change_compl(struct gsm_bts_trx *trx, int p_trxout_cur_mdBm);

View File

@ -12,6 +12,7 @@ enum bts_vty_node {
PHY_INST_NODE,
BTS_NODE,
TRX_NODE,
OSMUX_NODE,
};
extern struct cmd_element cfg_bts_auto_band_cmd;
@ -20,12 +21,9 @@ extern struct cmd_element cfg_bts_no_auto_band_cmd;
struct phy_instance *vty_get_phy_instance(struct vty *vty, int phy_nr, int inst_nr);
int bts_vty_go_parent(struct vty *vty);
int bts_vty_is_config_node(struct vty *vty, int node);
int bts_vty_init(void *ctx);
struct gsm_network *gsmnet_from_vty(struct vty *v);
extern struct vty_app_info bts_vty_info;
extern struct gsm_bts *g_bts;

View File

@ -1,6 +1,23 @@
AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include
AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOTRAU_CFLAGS) $(LIBOSMOCODEC_CFLAGS)
LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOTRAU_LIBS) $(LIBOSMOCODEC_LIBS)
AM_CPPFLAGS = \
$(all_includes) \
-I$(top_srcdir)/include \
-I$(top_builddir)/include \
$(NULL)
AM_CFLAGS = \
-Wall \
$(LIBOSMOCORE_CFLAGS) \
$(LIBOSMOTRAU_CFLAGS) \
$(LIBOSMOCODEC_CFLAGS) \
$(LIBOSMONETIF_CFLAGS) \
$(NULL)
LDADD = \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOTRAU_LIBS) \
$(LIBOSMOCODEC_LIBS) \
$(LIBOSMONETIF_LIBS) \
$(NULL)
if ENABLE_LC15BTS
AM_CFLAGS += -DENABLE_LC15BTS
@ -12,14 +29,19 @@ libbts_a_SOURCES = \
sysinfo.c \
logging.c \
abis.c \
abis_osmo.c \
oml.c \
osmux.c \
bts.c \
bts_sm.c \
bts_trx.c \
rsl.c \
rtp_input_preen.c \
vty.c \
paging.c \
measurement.c \
amr.c \
asci.c \
lchan.c \
load_indication.c \
pcu_sock.c \
@ -29,6 +51,7 @@ libbts_a_SOURCES = \
bts_ctrl_commands.c \
bts_ctrl_lookup.c \
bts_shutdown_fsm.c \
csd_v110.c \
l1sap.c \
cbch.c \
power_control.c \
@ -42,7 +65,23 @@ libbts_a_SOURCES = \
nm_bts_fsm.c \
nm_bb_transc_fsm.c \
nm_channel_fsm.c \
nm_gprs_cell_fsm.c \
nm_gprs_nse_fsm.c \
nm_gprs_nsvc_fsm.c \
nm_radio_carrier_fsm.c \
notification.c \
probes.d \
$(NULL)
libl1sched_a_SOURCES = scheduler.c
if ENABLE_SYSTEMTAP
probes.h: probes.d
$(DTRACE) -C -h -s $< -o $@
probes.lo: probes.d
$(LIBTOOL) --mode=compile $(AM_V_lt) --tag=CC env CFLAGS="$(CFLAGS)" $(DTRACE) -C -G -s $< -o $@
BUILT_SOURCES = probes.h probes.lo
libbts_la_LDADD = probes.lo
endif

View File

@ -13,7 +13,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -38,47 +38,319 @@
#include <osmocom/core/msgb.h>
#include <osmocom/core/signal.h>
#include <osmocom/core/macaddr.h>
#include <osmocom/core/fsm.h>
#include <osmocom/abis/abis.h>
#include <osmocom/abis/e1_input.h>
#include <osmocom/abis/ipaccess.h>
#include <osmocom/gsm/ipa.h>
#include <osmo-bts/abis.h>
#include <osmo-bts/logging.h>
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/bts.h>
#include <osmo-bts/rsl.h>
#include <osmo-bts/oml.h>
#include <osmo-bts/abis_osmo.h>
#include <osmo-bts/bts_model.h>
#include <osmo-bts/bts_trx.h>
#include <osmo-bts/bts_shutdown_fsm.h>
static struct gsm_bts *g_bts;
static struct e1inp_line_ops line_ops;
static struct ipaccess_unit bts_dev_info;
#define S(x) (1 << (x))
#define OML_RETRY_TIMER 5
enum abis_link_fsm_state {
ABIS_LINK_ST_WAIT_RECONNECT, /* OML link has not yet been established */
ABIS_LINK_ST_CONNECTING, /* OML link in process of been established */
ABIS_LINK_ST_CONNECTED, /* OML link is established, RSL links may be established or not */
ABIS_LINK_ST_FAILED, /* There used to be an active OML connection but it became broken */
};
static const struct value_string abis_link_fsm_event_names[] = {
{ ABIS_LINK_EV_SIGN_LINK_OML_UP, "SIGN_LINK_OML_UP", },
{ ABIS_LINK_EV_SIGN_LINK_DOWN, "SIGN_LINK_DOWN" },
{ ABIS_LINK_EV_VTY_RM_ADDR, "VTY_RM_ADDR" },
{}
};
struct abis_link_fsm_priv {
struct bsc_oml_host *current_bsc;
struct gsm_bts *bts;
char *model_name;
bool reconnect_to_current_bsc;
};
static void reset_oml_link(struct gsm_bts *bts)
{
if (bts->oml_link) {
struct timespec now;
e1inp_sign_link_destroy(bts->oml_link);
/* Log a special notice if the OML connection was dropped relatively quickly. */
if (bts->oml_conn_established_timestamp.tv_sec != 0 && clock_gettime(CLOCK_MONOTONIC, &now) == 0 &&
bts->oml_conn_established_timestamp.tv_sec + OSMO_BTS_OML_CONN_EARLY_DISCONNECT >= now.tv_sec) {
LOGP(DABIS, LOGL_FATAL, "OML link was closed early within %" PRIu64 " seconds. "
"If this situation persists, please check your BTS and BSC configuration files for errors. "
"A common error is a mismatch between unit_id configuration parameters of BTS and BSC.\n",
(uint64_t) (now.tv_sec - bts->oml_conn_established_timestamp.tv_sec));
}
bts->oml_link = NULL;
}
memset(&bts->oml_conn_established_timestamp, 0, sizeof(bts->oml_conn_established_timestamp));
/* Same for IPAC_PROTO_OSMO on the same ipa connection: */
if (bts->osmo_link) {
e1inp_sign_link_destroy(bts->osmo_link);
bts->osmo_link = NULL;
}
}
static int pick_next_bsc(struct osmo_fsm_inst *fi)
{
struct abis_link_fsm_priv *priv = fi->priv;
struct gsm_bts *bts = priv->bts;
struct bsc_oml_host *last;
if (llist_empty(&bts->bsc_oml_hosts)) {
LOGPFSML(fi, LOGL_ERROR, "List of BSCs to connect to is empty!\n");
return -1;
}
/* Keep current pointer to priv->current_bsc: */
if (priv->reconnect_to_current_bsc) {
OSMO_ASSERT(priv->current_bsc);
priv->reconnect_to_current_bsc = false;
return 0;
}
last = (struct bsc_oml_host *)llist_last_entry(&bts->bsc_oml_hosts, struct bsc_oml_host, list);
if (!priv->current_bsc || priv->current_bsc == last) /* Pick first one (wrap around): */
priv->current_bsc = (struct bsc_oml_host *)llist_first_entry(&bts->bsc_oml_hosts, struct bsc_oml_host, list);
else
priv->current_bsc = (struct bsc_oml_host *)llist_entry(priv->current_bsc->list.next, struct bsc_oml_host, list);
return 0;
}
static void abis_link_connecting_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
{
struct e1inp_line *line;
struct abis_link_fsm_priv *priv = fi->priv;
struct gsm_bts *bts = priv->bts;
if (bts_shutdown_in_progress(bts)) {
LOGPFSML(fi, LOGL_NOTICE, "BTS is shutting down, delaying A-bis connection establishment to BSC\n");
osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_WAIT_RECONNECT, OML_RETRY_TIMER, 0);
return;
}
if (pick_next_bsc(fi) < 0) {
LOGPFSML(fi, LOGL_FATAL, "No BSC available, A-bis connection establishment failed\n");
osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_FAILED, 0, 0);
return;
}
LOGP(DABIS, LOGL_NOTICE, "A-bis connection establishment to BSC (%s) in progress...\n", priv->current_bsc->addr);
/* patch in various data from VTY and other sources */
line_ops.cfg.ipa.addr = priv->current_bsc->addr;
osmo_get_macaddr(bts_dev_info.mac_addr, "eth0");
bts_dev_info.site_id = bts->ip_access.site_id;
bts_dev_info.bts_id = bts->ip_access.bts_id;
bts_dev_info.unit_name = priv->model_name;
if (bts->description)
bts_dev_info.unit_name = bts->description;
bts_dev_info.location2 = priv->model_name;
line = e1inp_line_find(0);
if (!line)
line = e1inp_line_create(0, "ipa");
if (!line) {
osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_FAILED, 0, 0);
return;
}
/* Line always comes already with a "ctor" reference, enough to keep it alive forever. */
e1inp_line_bind_ops(line, &line_ops);
/* This will open the OML connection now */
if (e1inp_line_update(line) < 0) {
osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_FAILED, 0, 0);
return;
}
/* The TCP connection to the BSC is now in progress.
* Wait for OML Link UP to transition to CONNECTED. */
}
static void abis_link_connecting(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
struct abis_link_fsm_priv *priv = fi->priv;
struct gsm_bts *bts = priv->bts;
switch (event) {
case ABIS_LINK_EV_SIGN_LINK_OML_UP:
osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_CONNECTED, 0, 0);
break;
case ABIS_LINK_EV_SIGN_LINK_DOWN:
reset_oml_link(bts);
osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_WAIT_RECONNECT, OML_RETRY_TIMER, 0);
break;
default:
OSMO_ASSERT(0);
}
}
static void abis_link_connected_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
{
bts_link_estab(g_bts);
}
static void abis_link_connected(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
struct abis_link_fsm_priv *priv = fi->priv;
struct gsm_bts *bts = priv->bts;
struct gsm_bts_trx *trx;
OSMO_ASSERT(event == ABIS_LINK_EV_SIGN_LINK_DOWN);
/* First remove the OML signalling link */
reset_oml_link(bts);
/* Then iterate over the RSL signalling links */
llist_for_each_entry(trx, &bts->trx_list, list) {
if (trx->bb_transc.rsl.link) {
e1inp_sign_link_destroy(trx->bb_transc.rsl.link);
trx->bb_transc.rsl.link = NULL;
if (trx == trx->bts->c0)
load_timer_stop(trx->bts);
} else {
/* If we have no rsl_link yet it may mean that lower
* layers are still establishing the socket (TCP, IPA).
* Let's tell it to stop connection establishment since
* we are shutting down. */
struct e1inp_line *line = e1inp_line_find(0);
if (line)
e1inp_ipa_bts_rsl_close_n(line, trx->nr);
}
/* Note: Here we could send NM_EV_RSL_DOWN to each
* trx->(bb_transc.)mo.fi, but we are starting shutdown of the
* entire BTS anyway through bts_model_abis_close(), so simply
* let bts_shutdown FSM take care of slowly powering down all
* the TRX. It would make sense to send NM_EV_RSL_DOWN only if a
* RSL link TRX!=C0 was going down, in order to selectively stop
* that TRX only. But libosmo-abis expects us to drop the entire
* line when something goes wrong... */
}
bts_model_abis_close(bts);
/* We want to try reconnecting to the current BSC at least once before switching to a new one: */
priv->reconnect_to_current_bsc = true;
osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_WAIT_RECONNECT, OML_RETRY_TIMER, 0);
}
static void abis_link_failed_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
{
struct abis_link_fsm_priv *priv = fi->priv;
struct gsm_bts *bts = priv->bts;
/* None of the configured BSCs was reachable or there was an existing
* OML/RSL connection that broke. Initiate BTS process shut down now. */
bts_model_abis_close(bts);
}
static void abis_link_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
struct abis_link_fsm_priv *priv = fi->priv;
struct gsm_bts *bts = priv->bts;
OSMO_ASSERT(event == ABIS_LINK_EV_VTY_RM_ADDR);
if (priv->current_bsc == data) {
if (llist_count(&bts->bsc_oml_hosts) <= 1)
priv->current_bsc = NULL;
else
pick_next_bsc(fi);
}
}
int abis_link_fsm_timer_cb(struct osmo_fsm_inst *fi)
{
switch (fi->state) {
case ABIS_LINK_ST_WAIT_RECONNECT:
osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_CONNECTING, 0, 0);
break;
default:
OSMO_ASSERT(0);
}
return 0;
}
static struct osmo_fsm_state abis_link_fsm_states[] = {
[ABIS_LINK_ST_WAIT_RECONNECT] = {
.name = "WAIT_RECONNECT",
.out_state_mask =
S(ABIS_LINK_ST_CONNECTING),
},
[ABIS_LINK_ST_CONNECTING] = {
.name = "CONNECTING",
.in_event_mask =
S(ABIS_LINK_EV_SIGN_LINK_OML_UP) |
S(ABIS_LINK_EV_SIGN_LINK_DOWN),
.out_state_mask =
S(ABIS_LINK_ST_WAIT_RECONNECT) |
S(ABIS_LINK_ST_CONNECTED) |
S(ABIS_LINK_ST_FAILED),
.onenter = abis_link_connecting_onenter,
.action = abis_link_connecting,
},
[ABIS_LINK_ST_CONNECTED] = {
.name = "CONNECTED",
.in_event_mask =
S(ABIS_LINK_EV_SIGN_LINK_DOWN),
.out_state_mask =
S(ABIS_LINK_ST_WAIT_RECONNECT),
.onenter = abis_link_connected_onenter,
.action = abis_link_connected,
},
[ABIS_LINK_ST_FAILED] = {
.name = "FAILED",
.onenter = abis_link_failed_onenter,
},
};
static struct osmo_fsm abis_link_fsm = {
.name = "abis_link",
.states = abis_link_fsm_states,
.num_states = ARRAY_SIZE(abis_link_fsm_states),
.log_subsys = DABIS,
.event_names = abis_link_fsm_event_names,
.allstate_action = abis_link_allstate,
.allstate_event_mask = S(ABIS_LINK_EV_VTY_RM_ADDR),
.timer_cb = abis_link_fsm_timer_cb,
};
int abis_oml_sendmsg(struct msgb *msg)
{
struct gsm_bts *bts = msg->trx->bts;
if (!bts->oml_link) {
llist_add_tail(&msg->list, &bts->oml_queue);
LOGP(DABIS, LOGL_INFO, "Drop Tx OML msg, OML link is down\n");
msgb_free(msg);
return 0;
} else {
/* osmo-bts uses msg->trx internally, but libosmo-abis uses
* the signalling link at msg->dst */
msg->dst = bts->oml_link;
return abis_sendmsg(msg);
}
}
static void drain_oml_queue(struct gsm_bts *bts)
{
struct msgb *msg, *msg2;
llist_for_each_entry_safe(msg, msg2, &bts->oml_queue, list) {
/* osmo-bts uses msg->trx internally, but libosmo-abis uses
* the signalling link at msg->dst */
llist_del(&msg->list);
msg->dst = bts->oml_link;
abis_sendmsg(msg);
}
/* osmo-bts uses msg->trx internally, but libosmo-abis uses
* the signalling link at msg->dst */
msg->dst = bts->oml_link;
return abis_sendmsg(msg);
}
int abis_bts_rsl_sendmsg(struct msgb *msg)
@ -92,32 +364,37 @@ int abis_bts_rsl_sendmsg(struct msgb *msg)
/* osmo-bts uses msg->trx internally, but libosmo-abis uses
* the signalling link at msg->dst */
msg->dst = msg->trx->rsl_link;
msg->dst = msg->trx->bb_transc.rsl.link;
return abis_sendmsg(msg);
}
static struct e1inp_sign_link *sign_link_up(void *unit, struct e1inp_line *line,
enum e1inp_sign_type type)
{
struct e1inp_sign_link *sign_link = NULL;
struct e1inp_ts *sign_ts;
struct gsm_bts_trx *trx;
int trx_nr;
switch (type) {
case E1INP_SIGN_OML:
sign_ts = e1inp_line_ipa_oml_ts(line);
LOGP(DABIS, LOGL_INFO, "OML Signalling link up\n");
e1inp_ts_config_sign(&line->ts[E1INP_SIGN_OML-1], line);
sign_link = g_bts->oml_link =
e1inp_sign_link_create(&line->ts[E1INP_SIGN_OML-1],
E1INP_SIGN_OML, g_bts->c0, 255, 0);
e1inp_ts_config_sign(sign_ts, line);
g_bts->oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML,
g_bts->c0, IPAC_PROTO_OML, 0);
if (clock_gettime(CLOCK_MONOTONIC, &g_bts->oml_conn_established_timestamp) != 0)
memset(&g_bts->oml_conn_established_timestamp, 0,
sizeof(g_bts->oml_conn_established_timestamp));
drain_oml_queue(g_bts);
bts_link_estab(g_bts);
break;
g_bts->osmo_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OSMO,
g_bts->c0, IPAC_PROTO_OSMO, 0);
osmo_fsm_inst_dispatch(g_bts->abis_link_fi, ABIS_LINK_EV_SIGN_LINK_OML_UP, NULL);
return g_bts->oml_link;
case E1INP_SIGN_RSL:
/* fall through to default to catch TRXn having type = E1INP_SIGN_RSL + n */
default:
trx_nr = type - E1INP_SIGN_RSL;
sign_ts = e1inp_line_ipa_rsl_ts(line, trx_nr);
LOGP(DABIS, LOGL_INFO, "RSL Signalling link for TRX%d up\n",
trx_nr);
trx = gsm_bts_trx_num(g_bts, trx_nr);
@ -126,50 +403,19 @@ static struct e1inp_sign_link *sign_link_up(void *unit, struct e1inp_line *line,
trx_nr);
break;
}
e1inp_ts_config_sign(&line->ts[type-1], line);
sign_link = trx->rsl_link =
e1inp_sign_link_create(&line->ts[type-1],
E1INP_SIGN_RSL, trx,
trx->rsl_tei, 0);
e1inp_ts_config_sign(sign_ts, line);
trx->bb_transc.rsl.link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL,
trx, trx->bb_transc.rsl.tei, 0);
trx_link_estab(trx);
break;
return trx->bb_transc.rsl.link;
}
return sign_link;
return NULL;
}
static void sign_link_down(struct e1inp_line *line)
{
struct gsm_bts_trx *trx;
LOGPIL(line, DABIS, LOGL_ERROR, "Signalling link down\n");
/* First remove the OML signalling link */
if (g_bts->oml_link) {
struct timespec now;
e1inp_sign_link_destroy(g_bts->oml_link);
/* Log a special notice if the OML connection was dropped relatively quickly. */
if (g_bts->oml_conn_established_timestamp.tv_sec != 0 && clock_gettime(CLOCK_MONOTONIC, &now) == 0 &&
g_bts->oml_conn_established_timestamp.tv_sec + OSMO_BTS_OML_CONN_EARLY_DISCONNECT >= now.tv_sec) {
LOGP(DABIS, LOGL_FATAL, "OML link was closed early within %" PRIu64 " seconds. "
"If this situation persists, please check your BTS and BSC configuration files for errors. "
"A common error is a mismatch between unit_id configuration parameters of BTS and BSC.\n",
(uint64_t)(now.tv_sec - g_bts->oml_conn_established_timestamp.tv_sec));
}
}
g_bts->oml_link = NULL;
memset(&g_bts->oml_conn_established_timestamp, 0, sizeof(g_bts->oml_conn_established_timestamp));
/* Then iterate over the RSL signalling links */
llist_for_each_entry(trx, &g_bts->trx_list, list) {
if (trx->rsl_link) {
e1inp_sign_link_destroy(trx->rsl_link);
trx->rsl_link = NULL;
}
}
bts_model_abis_close(g_bts);
osmo_fsm_inst_dispatch(g_bts->abis_link_fi, ABIS_LINK_EV_SIGN_LINK_DOWN, NULL);
}
@ -190,6 +436,9 @@ static int sign_link_cb(struct msgb *msg)
case E1INP_SIGN_RSL:
down_rsl(link->trx, msg);
break;
case E1INP_SIGN_OSMO:
down_osmo(link->trx->bts, msg);
break;
default:
msgb_free(msg);
break;
@ -235,7 +484,7 @@ static int inp_s_cbfn(unsigned int subsys, unsigned int signal,
static struct ipaccess_unit bts_dev_info = {
.unit_name = "sysmoBTS",
.unit_name = "osmo-bts",
.equipvers = "", /* FIXME: read this from hw */
.swversion = PACKAGE_VERSION,
.location1 = "",
@ -265,33 +514,30 @@ void abis_init(struct gsm_bts *bts)
osmo_signal_register_handler(SS_L_INPUT, &inp_s_cbfn, bts);
}
struct e1inp_line *abis_open(struct gsm_bts *bts, char *dst_host,
char *model_name)
int abis_open(struct gsm_bts *bts, char *model_name)
{
struct e1inp_line *line;
struct abis_link_fsm_priv *abis_link_fsm_priv;
/* patch in various data from VTY and other sources */
line_ops.cfg.ipa.addr = dst_host;
osmo_get_macaddr(bts_dev_info.mac_addr, "eth0");
bts_dev_info.site_id = bts->ip_access.site_id;
bts_dev_info.bts_id = bts->ip_access.bts_id;
bts_dev_info.unit_name = model_name;
if (bts->description)
bts_dev_info.unit_name = bts->description;
bts_dev_info.location2 = model_name;
if (llist_empty(&bts->bsc_oml_hosts)) {
LOGP(DABIS, LOGL_FATAL, "No BSC configured, cannot start BTS without knowing BSC OML IP\n");
return -EINVAL;
}
line = e1inp_line_find(0);
if (line)
e1inp_line_get(line); /* We want a new reference for returned line */
else
line = e1inp_line_create(0, "ipa"); /* already comes with a reference */
if (!line)
return NULL;
e1inp_line_bind_ops(line, &line_ops);
bts->abis_link_fi = osmo_fsm_inst_alloc(&abis_link_fsm, bts, NULL, LOGL_DEBUG, "abis_link");
OSMO_ASSERT(bts->abis_link_fi);
/* This will open the OML connection now */
if (e1inp_line_update(line) < 0)
return NULL;
abis_link_fsm_priv = talloc_zero(bts->abis_link_fi, struct abis_link_fsm_priv);
OSMO_ASSERT(abis_link_fsm_priv);
abis_link_fsm_priv->bts = bts;
abis_link_fsm_priv->model_name = model_name;
bts->abis_link_fi->priv = abis_link_fsm_priv;
return line;
osmo_fsm_inst_state_chg(bts->abis_link_fi, ABIS_LINK_ST_CONNECTING, 0, 0);
return 0;
}
static __attribute__((constructor)) void abis_link_fsm_init(void)
{
OSMO_ASSERT(osmo_fsm_register(&abis_link_fsm) == 0);
}

135
src/common/abis_osmo.c Normal file
View File

@ -0,0 +1,135 @@
/* OSMO extenion link associated to same line as oml_link: */
/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* Author: Pau Espin Pedrol <pespin@sysmocom.de>
*
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <errno.h>
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/ipa.h>
#include <osmocom/gsm/protocol/ipaccess.h>
#include <osmo-bts/bts.h>
#include <osmo-bts/logging.h>
#include <osmo-bts/pcu_if.h>
#include <osmo-bts/pcuif_proto.h>
#include <osmo-bts/bts_sm.h>
#define OM_HEADROOM_SIZE 128
////////////////////////////////////////
// OSMO ABIS extensions (PCU)
///////////////////////////////////////
static struct msgb *abis_osmo_pcu_msgb_alloc(uint8_t msg_type, uint8_t bts_nr, size_t extra_size)
{
struct msgb *msg;
struct gsm_pcu_if *pcu_prim;
msg = msgb_alloc_headroom(OM_HEADROOM_SIZE + sizeof(struct gsm_pcu_if) + extra_size,
OM_HEADROOM_SIZE, "IPA/ABIS/OSMO");
/* Only header is filled, caller is responible for reserving + filling
* message type specific contents: */
msgb_put(msg, PCUIF_HDR_SIZE);
pcu_prim = (struct gsm_pcu_if *) msgb_data(msg);
pcu_prim->msg_type = msg_type;
pcu_prim->bts_nr = bts_nr;
return msg;
}
/* Send a OML NM Message from BSC to BTS */
int abis_osmo_sendmsg(struct gsm_bts *bts, struct msgb *msg)
{
msg->dst = bts->osmo_link;
msg->l2h = msg->data;
return abis_sendmsg(msg);
}
/* Send IPA/OSMO/PCU extension Abis message from PCU to BSC */
static int abis_osmo_pcu_sendmsg(struct gsm_bts *bts, struct msgb *msg)
{
ipa_prepend_header_ext(msg, IPAC_PROTO_EXT_PCU);
return abis_osmo_sendmsg(bts, msg);
}
int abis_osmo_pcu_tx_container(struct gsm_bts *bts, const struct gsm_pcu_if_container *container)
{
uint16_t data_length = osmo_load16be(&container->length);
struct msgb *msg = abis_osmo_pcu_msgb_alloc(PCU_IF_MSG_CONTAINER, bts->nr, data_length);
struct gsm_pcu_if *pcu_prim = (struct gsm_pcu_if *) msgb_data(msg);
struct gsm_pcu_if_container *tx_cont = &pcu_prim->u.container;
msgb_put(msg, sizeof(*tx_cont) + data_length);
tx_cont->msg_type = container->msg_type;
tx_cont->length = container->length;
if (data_length)
memcpy(tx_cont->data, container->data, data_length);
return abis_osmo_pcu_sendmsg(bts, msg);
}
/* incoming IPA/OSMOEXT/PCU Abis message from BSC */
static int rx_down_osmo_pcu(struct gsm_bts *bts, struct msgb *msg)
{
struct gsm_pcu_if *pcu_prim;
if (msgb_l2len(msg) < PCUIF_HDR_SIZE) {
LOGP(DPCU, LOGL_ERROR, "ABIS_OSMO_PCU message too short\n");
oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
"ABIS_OSMO_PCU message too short\n");
msgb_free(msg);
return -EIO;
}
pcu_prim = msgb_l2(msg);
LOGP(DPCU, LOGL_INFO, "Rx BSC->BTS%d ABIS_OSMO_PCU msg type %u\n",
pcu_prim->bts_nr, pcu_prim->msg_type);
/* we patch the bts_nr received from BTS with the bts_nr we used to set up in the local PCU */
pcu_prim->bts_nr = bts->nr;
/* Trim Abis lower layers: */
msgb_pull_to_l2(msg);
/* we simply forward it to PCUIF: */
return pcu_sock_send(msg);
}
/* incoming IPA/OSMO extension Abis message from BSC */
int down_osmo(struct gsm_bts *bts, struct msgb *msg)
{
uint8_t *type;
if (msgb_l2len(msg) < 1) {
oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
"OSMO message too short\n");
msgb_free(msg);
return -EIO;
}
type = msgb_l2(msg);
msg->l2h = type + 1;
switch (*type) {
case IPAC_PROTO_EXT_PCU:
return rx_down_osmo_pcu(bts, msg);
default:
oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
"OSMO message unknown extension %u\n", *type);
msgb_free(msg);
return -EIO;
}
}

View File

@ -6,6 +6,85 @@
#include <osmo-bts/logging.h>
#include <osmo-bts/amr.h>
/* Reasonable defaults for AMR-FR and AMR-HR rate configuration.
* The values are taken from 3GPP TS 51.010-1 (version 13.11.0).
* See 14.2.19.4.1 and 14.2.20.4.1 for AMR-FR and AMR-HR, respectively.
*
* ^ C/I (dB) | FR / HR |
* | |
* | |
* MODE4 | |
* = | ----+---- THR_MX_Up(3) | 20.5 / 18.0 |
* | | |
* | = ----+---- THR_MX_Dn(4) | 18.5 / 16.0 |
* MODE3 | |
* | = ----+---- THR_MX_Up(2) | 14.5 / 14.0 |
* | | |
* = | ----+---- THR_MX_Dn(3) | 12.5 / 12.0 |
* MODE2 | |
* = | ----+---- THR_MX_Up(1) | 8.5 / 10.0 |
* | | |
* | = ----+---- THR_MX_Dn(2) | 6.5 / 8.0 |
* MODE1 | |
* | |
* | |
*/
static const struct gsm48_multi_rate_conf amr_fr_mr_cfg_def = {
.m4_75 = 1,
.m5_90 = 1,
.m7_95 = 1,
.m12_2 = 1,
};
static const struct amr_mode amr_fr_bts_mode_def[] = {
{
.mode = 0, /* 4.75k */
.threshold = 13, /* THR_MX_Dn(2): 6.5 dB */
.hysteresis = 4, /* THR_MX_Up(1): 8.5 dB */
},
{
.mode = 2, /* 5.90k */
.threshold = 25, /* THR_MX_Dn(3): 12.5 dB */
.hysteresis = 4, /* THR_MX_Up(2): 14.5 dB */
},
{
.mode = 5, /* 7.95k */
.threshold = 37, /* THR_MX_Dn(4): 18.5 dB */
.hysteresis = 4, /* THR_MX_Up(3): 20.5 dB */
},
{
.mode = 7, /* 12.2k */
/* this is the last mode, so no threshold */
},
};
static const struct gsm48_multi_rate_conf amr_hr_mr_cfg_def = {
.m4_75 = 1,
.m5_90 = 1,
.m6_70 = 1,
.m7_95 = 1,
};
static const struct amr_mode amr_hr_bts_mode_def[] = {
{
.mode = 0, /* 4.75k */
.threshold = 16, /* THR_MX_Dn(2): 8.0 dB */
.hysteresis = 4, /* THR_MX_Up(1): 10.0 dB */
},
{
.mode = 2, /* 5.90k */
.threshold = 24, /* THR_MX_Dn(3): 12.0 dB */
.hysteresis = 4, /* THR_MX_Up(2): 14.0 dB */
},
{
.mode = 3, /* 6.70k */
.threshold = 32, /* THR_MX_Dn(4): 16.0 dB */
.hysteresis = 4, /* THR_MX_Up(3): 18.0 dB */
},
{
.mode = 5, /* 7.95k */
/* this is the last mode, so no threshold */
},
};
void amr_log_mr_conf(int ss, int logl, const char *pfx,
struct amr_multirate_conf *amr_mrc)
{
@ -16,9 +95,9 @@ void amr_log_mr_conf(int ss, int logl, const char *pfx,
for (i = 0; i < amr_mrc->num_modes; i++)
LOGPC(ss, logl, ", mode[%u] = %u/%u/%u",
i, amr_mrc->bts_mode[i].mode,
amr_mrc->bts_mode[i].threshold,
amr_mrc->bts_mode[i].hysteresis);
i, amr_mrc->mode[i].mode,
amr_mrc->mode[i].threshold,
amr_mrc->mode[i].hysteresis);
LOGPC(ss, logl, "\n");
}
@ -27,7 +106,7 @@ static inline int get_amr_mode_idx(const struct amr_multirate_conf *amr_mrc,
{
unsigned int i;
for (i = 0; i < amr_mrc->num_modes; i++) {
if (amr_mrc->bts_mode[i].mode == cmi)
if (amr_mrc->mode[i].mode == cmi)
return i;
}
return -EINVAL;
@ -117,23 +196,26 @@ int amr_parse_mr_conf(struct amr_multirate_conf *amr_mrc,
for (i = 0; i < 8; i++) {
if (mr_conf[1] & (1 << i)) {
amr_mrc->bts_mode[j++].mode = i;
amr_mrc->mode[j++].mode = i;
}
}
/* skip the first two octets of the IE */
mr_conf += 2;
if (num_codecs >= 2) {
amr_mrc->bts_mode[0].threshold = mr_conf[1] & 0x3F;
amr_mrc->bts_mode[0].hysteresis = mr_conf[2] >> 4;
amr_mrc->mode[0].threshold = mr_conf[0] & 0x3F;
amr_mrc->mode[0].hysteresis = mr_conf[1] >> 4;
}
if (num_codecs >= 3) {
amr_mrc->bts_mode[1].threshold =
((mr_conf[2] & 0xF) << 2) | (mr_conf[3] >> 6);
amr_mrc->bts_mode[1].hysteresis = (mr_conf[3] >> 2) & 0xF;
amr_mrc->mode[1].threshold =
((mr_conf[1] & 0xF) << 2) | (mr_conf[2] >> 6);
amr_mrc->mode[1].hysteresis = (mr_conf[2] >> 2) & 0xF;
}
if (num_codecs >= 4) {
amr_mrc->bts_mode[2].threshold =
((mr_conf[3] & 0x3) << 4) | (mr_conf[4] >> 4);
amr_mrc->bts_mode[2].hysteresis = mr_conf[4] & 0xF;
amr_mrc->mode[2].threshold =
((mr_conf[2] & 0x3) << 4) | (mr_conf[3] >> 4);
amr_mrc->mode[2].hysteresis = mr_conf[3] & 0xF;
}
return num_codecs;
@ -171,3 +253,26 @@ unsigned int amr_get_initial_mode(struct gsm_lchan *lchan)
}
}
}
void amr_init_mr_conf_def(struct gsm_lchan *lchan)
{
const struct gsm48_multi_rate_conf *mr_cfg;
const struct amr_mode *bts_mode;
unsigned int num_modes;
if (lchan->type == GSM_LCHAN_TCH_F) {
num_modes = ARRAY_SIZE(amr_fr_bts_mode_def);
bts_mode = &amr_fr_bts_mode_def[0];
mr_cfg = &amr_fr_mr_cfg_def;
} else {
num_modes = ARRAY_SIZE(amr_hr_bts_mode_def);
bts_mode = &amr_hr_bts_mode_def[0];
mr_cfg = &amr_hr_mr_cfg_def;
}
memcpy(lchan->tch.amr_mr.gsm48_ie, mr_cfg,
sizeof(lchan->tch.amr_mr.gsm48_ie));
memcpy(&lchan->tch.amr_mr.mode[0], &bts_mode[0],
sizeof(lchan->tch.amr_mr.mode));
lchan->tch.amr_mr.num_modes = num_modes;
}

211
src/common/asci.c Normal file
View File

@ -0,0 +1,211 @@
/* ASCI (VGCS/VBS) related common code */
/* (C) 2023 by Harald Welte <laforge@osmocom.org>
*
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/rsl.h>
#include <osmo-bts/bts.h>
#include <osmo-bts/bts_model.h>
#include <osmo-bts/rsl.h>
#include <osmo-bts/logging.h>
#include <osmo-bts/l1sap.h>
#include <osmo-bts/asci.h>
static int tx_vgcs_ul_grant(struct gsm_lchan *lchan)
{
struct gsm0408_vgcs_ul_grant ul_grant;
struct gsm_time gt;
struct msgb *msg;
gsm_fn2gsmtime(&gt, lchan->asci.fn);
/* build the RR VGCS UPLINK GRANT message as per TS 44.018 Section 9.1.49 */
ul_grant = (struct gsm0408_vgcs_ul_grant) {
.hdr = {
.proto_discr = GSM48_PDISC_RR,
.msg_type = GSM48_MT_RR_VGCS_UPL_GRANT,
},
.req_ref = {
.ra = lchan->asci.ref,
.t1 = gt.t1,
.t2 = gt.t2,
.t3_low = gt.t3 & 7,
.t3_high = gt.t3 >> 3,
},
.ta = lchan->ta_ctrl.current,
};
/* Wrap it in a RSL UNITDATA REQUEST */
msg = rsl_rll_simple(RSL_MT_UNIT_DATA_REQ, gsm_lchan2chan_nr(lchan), 0x00, 0);
msg->l3h = msg->tail; /* emulate rsl_rx_rll() behaviour */
msgb_tl16v_put(msg, RSL_IE_L3_INFO, sizeof(ul_grant), (uint8_t *) &ul_grant);
/* send it towards MS, just like a RSL message from the BSC */
return lapdm_rslms_recvmsg(msg, &lchan->lapdm_ch);
}
/* timer call-back for T3115 (VGCS UPLINK GRANT re-transmit) */
static void vgcs_t3115_cb(void *data)
{
struct gsm_lchan *lchan = data;
struct gsm_bts *bts = lchan->ts->trx->bts;
LOGPLCHAN(lchan, DASCI, LOGL_INFO, "T3115 timeout (%d resends left)\n",
bts->ny2 - lchan->asci.vgcs_ul_grant_count);
if (lchan->state != LCHAN_S_ACTIVE) {
LOGPLCHAN(lchan, DASCI, LOGL_NOTICE, "is not active. It is in state %s. Ignoring\n",
gsm_lchans_name(lchan->state));
return;
}
if (lchan->asci.vgcs_ul_grant_count >= bts->ny2) {
lchan->asci.vgcs_ul_grant_count = 0;
LOGPLCHAN(lchan, DASCI, LOGL_NOTICE, "NY2 reached, sending CONNection FAILure to BSC.\n");
rsl_tx_conn_fail(lchan, RSL_ERR_TALKER_ACC_FAIL);
lchan->asci.talker_active = VGCS_TALKER_NONE;
return;
}
tx_vgcs_ul_grant(lchan);
lchan->asci.vgcs_ul_grant_count++;
osmo_timer_schedule(&lchan->asci.t3115, 0, bts->t3115_ms * 1000);
}
/* Received random access on dedicated channel. */
void vgcs_rach(struct gsm_lchan *lchan, uint8_t ra, uint8_t acc_delay, uint32_t fn)
{
LOGPLCHAN(lchan, DASCI, LOGL_NOTICE, "VGCS RACH on dedicated channel type %s received with "
"TA=%u, ref=%u\n", gsm_lchant_name(lchan->type), acc_delay, ra);
if (ra == 0x25) { /* See TS 44.018 Table 9.1.45.1 */
/* Listener Detection (TS 48.058 Section 4.14) */
if (!lchan->asci.listener_detected) {
rsl_tx_listener_det(lchan, &acc_delay);
lchan->asci.listener_detected = true;
}
} else {
/* Talker Detection (TS 48.058 Section 4.13) */
struct gsm_bts *bts = lchan->ts->trx->bts;
/* Talker detection on group channels only */
if (!rsl_chan_rt_is_vgcs(lchan->rsl_chan_rt))
return;
if (lchan->asci.talker_active != VGCS_TALKER_NONE) {
LOGPLCHAN(lchan, DASCI, LOGL_DEBUG, "Ignoring RACH, there is an active talker already.\n");
return;
}
/* Set timing advance, power level and activate SACCH */
lchan->ta_ctrl.current = acc_delay;
lchan->ms_power_ctrl.current = lchan->ms_power_ctrl.max;
lchan->want_dl_sacch_active = true;
/* Stop RACH detection, wait for valid frame */
lchan->asci.talker_active = VGCS_TALKER_WAIT_FRAME;
if (l1sap_uplink_access(lchan, false) != 0) {
LOGPLCHAN(lchan, DASCI, LOGL_ERROR, "Failed to deactivate uplink access after TALKER DET.\n");
rsl_tx_conn_fail(lchan, RSL_ERR_EQUIPMENT_FAIL);
lchan->asci.talker_active = VGCS_TALKER_NONE;
return;
}
lchan->asci.ref = ra;
lchan->asci.fn = fn;
/* Send TALKER DETECT via RSL to BSC */
rsl_tx_talker_det(lchan, &acc_delay);
/* Send VGCS UPLINK GRANT */
lchan->asci.vgcs_ul_grant_count = 1;
tx_vgcs_ul_grant(lchan);
/* Start T3115 */
LOGPLCHAN(lchan, DASCI, LOGL_DEBUG, "Starting T3115 with %u ms\n", bts->t3115_ms);
lchan->asci.t3115.cb = vgcs_t3115_cb;
lchan->asci.t3115.data = lchan;
osmo_timer_schedule(&lchan->asci.t3115, 0, bts->t3115_ms * 1000);
}
}
/* Received channel activation. */
void vgcs_lchan_activate(struct gsm_lchan *lchan)
{
LOGPLCHAN(lchan, DASCI, LOGL_INFO, "Channel is activated.\n");
if (l1sap_uplink_access(lchan, true) != 0) {
LOGPLCHAN(lchan, DASCI, LOGL_ERROR, "Failed to activate uplink access after channel activation.\n");
rsl_tx_conn_fail(lchan, RSL_ERR_EQUIPMENT_FAIL);
}
}
/* Received channel reactivation. (for assignment) */
void vgcs_lchan_react(struct gsm_lchan *lchan)
{
LOGPLCHAN(lchan, DASCI, LOGL_INFO, "Channel is activated for assignment.\n");
lchan->asci.talker_active = VGCS_TALKER_WAIT_FRAME;
if (l1sap_uplink_access(lchan, false) != 0) {
LOGPLCHAN(lchan, DASCI, LOGL_ERROR, "Failed to deactivate uplink access for assignment.\n");
rsl_tx_conn_fail(lchan, RSL_ERR_EQUIPMENT_FAIL);
}
radio_link_timeout_reset(lchan);
}
/* Received first valid data frame on dedicated channel. */
void vgcs_talker_frame(struct gsm_lchan *lchan)
{
LOGPLCHAN(lchan, DASCI, LOGL_INFO, "First valid frame detected, talker now active.\n");
osmo_timer_del(&lchan->asci.t3115);
lchan->asci.talker_active = VGCS_TALKER_ACTIVE;
radio_link_timeout_reset(lchan);
}
/* Release VGCS Talker state. */
void vgcs_talker_reset(struct gsm_lchan *lchan, bool ul_access)
{
if (lchan->asci.talker_active == VGCS_TALKER_NONE)
return;
LOGPLCHAN(lchan, DASCI, LOGL_INFO, "Uplink released, no talker.\n");
/* Stop T3115 */
osmo_timer_del(&lchan->asci.t3115);
/* Talker released. */
lchan->asci.talker_active = VGCS_TALKER_NONE;
if (ul_access) {
if (l1sap_uplink_access(lchan, true) != 0) {
LOGPLCHAN(lchan, DASCI, LOGL_ERROR,
"Failed to activate uplink access after uplink became free.\n");
rsl_tx_conn_fail(lchan, RSL_ERR_EQUIPMENT_FAIL);
}
}
}
/* Release VGCS Listener state. */
void vgcs_listener_reset(struct gsm_lchan *lchan)
{
lchan->asci.listener_detected = false;
}

View File

@ -13,7 +13,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -44,8 +44,10 @@
#include <osmo-bts/abis.h>
#include <osmo-bts/bts.h>
#include <osmo-bts/bts_model.h>
#include <osmo-bts/bts_sm.h>
#include <osmo-bts/dtx_dl_amr_fsm.h>
#include <osmo-bts/pcuif_proto.h>
#include <osmo-bts/pcu_if.h>
#include <osmo-bts/rsl.h>
#include <osmo-bts/oml.h>
#include <osmo-bts/signal.h>
@ -54,17 +56,15 @@
#include <osmo-bts/bts_shutdown_fsm.h>
#include <osmo-bts/nm_common_fsm.h>
#include <osmo-bts/power_control.h>
#include <osmo-bts/osmux.h>
#include <osmo-bts/notification.h>
#define MAX_TA_DEF 63 /* default max Timing Advance value */
#define MIN_QUAL_RACH 50 /* minimum link quality (in centiBels) for Access Bursts */
#define MIN_QUAL_NORM -5 /* minimum link quality (in centiBels) for Normal Bursts */
static void bts_update_agch_max_queue_length(struct gsm_bts *bts);
struct gsm_network bts_gsmnet = {
.bts_list = { &bts_gsmnet.bts_list, &bts_gsmnet.bts_list },
.num_bts = 0,
};
void *tall_bts_ctx;
/* Table 3.1 TS 04.08: Values of parameter S */
@ -90,17 +90,29 @@ static int bts_signal_cbfn(unsigned int subsys, unsigned int signal,
static const struct rate_ctr_desc bts_ctr_desc[] = {
[BTS_CTR_PAGING_RCVD] = {"paging:rcvd", "Received paging requests (Abis)"},
[BTS_CTR_PAGING_DROP] = {"paging:drop", "Dropped paging requests (Abis)"},
[BTS_CTR_PAGING_DROP_PS] = {"paging:drop-ps", "Dropped paging requests (PS/PCU)"},
[BTS_CTR_PAGING_CONG] = {"paging:cong", "Paging congestion detected (Abis)"},
[BTS_CTR_PAGING_SENT] = {"paging:sent", "Sent paging requests (Um)"},
[BTS_CTR_RACH_RCVD] = {"rach:rcvd", "Received RACH requests (Um)"},
[BTS_CTR_RACH_DROP] = {"rach:drop", "Dropped RACH requests (Um)"},
[BTS_CTR_RACH_HO] = {"rach:handover", "Received RACH requests (Handover)"},
[BTS_CTR_RACH_VGCS] = {"rach:vgcs", "Received RACH requests (VGCS)"},
[BTS_CTR_RACH_CS] = {"rach:cs", "Received RACH requests (CS/Abis)"},
[BTS_CTR_RACH_PS] = {"rach:ps", "Received RACH requests (PS/PCU)"},
[BTS_CTR_AGCH_RCVD] = {"agch:rcvd", "Received AGCH requests (Abis)"},
[BTS_CTR_AGCH_SENT] = {"agch:sent", "Sent AGCH requests (Abis)"},
[BTS_CTR_AGCH_DELETED] = {"agch:delete", "Sent AGCH DELETE IND (Abis)"},
[BTS_CTR_RTP_RX_TOTAL] = {"rtp:rx:total", "Total number of received RTP packets"},
[BTS_CTR_RTP_RX_MARKER] = {"rtp:rx:marker", "Number of received RTP packets with marker bit set"},
[BTS_CTR_RTP_RX_DROP_PREEN] = {"rtp:rx:drop:preen", "Total number of received RTP packets dropped during preening"},
[BTS_CTR_RTP_RX_DROP_LOOPBACK] = {"rtp:rx:drop:loopback", "Total number of received RTP packets dropped during loopback"},
[BTS_CTR_RTP_RX_DROP_OVERFLOW] = {"rtp:rx:drop:overflow", "Total number of received RTP packets dropped during DL queue overflow"},
[BTS_CTR_RTP_RX_DROP_V110_DEC] = {"rtp:rx:drop:v110_dec", "Total number of received RTP packets dropped during V.110 decode"},
[BTS_CTR_RTP_TX_TOTAL] = {"rtp:tx:total", "Total number of transmitted RTP packets"},
[BTS_CTR_RTP_TX_MARKER] = {"rtp:tx:marker", "Number of transmitted RTP packets with marker bit set"},
};
static const struct rate_ctr_group_desc bts_ctrg_desc = {
"bts",
@ -126,7 +138,7 @@ static const struct rate_ctr_group_desc cbch_ctrg_desc = {
cbch_ctr_desc
};
static struct osmo_tdef bts_T_defs[] = {
struct osmo_tdef bts_T_defs[] = {
/* T-1: FIXME: Ideally should be dynamically calculated per trx at
* shutdown start based on params below, and highest trx value taken:
* + VTY's power-ramp step-interval.
@ -141,7 +153,11 @@ static struct osmo_tdef bts_T_defs[] = {
{}
};
static const uint8_t bts_nse_timer_default[] = { 3, 3, 3, 3, 30, 3, 10 };
struct osmo_tdef abis_T_defs[] = {
{ .T=-15, .default_val=0, .unit=OSMO_TDEF_MS, .desc="Time to wait between Channel Activation and dispatching a cached early Immediate Assignment" },
{}
};
static const uint8_t bts_cell_timer_default[] =
{ 3, 3, 3, 3, 3, 10, 3, 10, 3, 10, 3 };
static const struct gprs_rlc_cfg rlc_cfg_default = {
@ -199,32 +215,46 @@ const char *btsatttr2str(enum bts_attribute v)
const struct value_string bts_impl_flag_desc[] = {
{ BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP, "DSP/HW based MS Power Control Loop" },
{ BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB, "Measurement and Payload data combined" },
{ BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER, "OML RadioChannel MO depends on RadioCarrier MO" },
{ BTS_INTERNAL_FLAG_INTERF_MEAS, "Uplink interference measurements" },
{ 0, NULL }
};
/* Ensure that all BTS_INTERNAL_FLAG_* entries are present in bts_impl_flag_desc[] */
osmo_static_assert(ARRAY_SIZE(bts_impl_flag_desc) == _BTS_INTERNAL_FLAG_NUM + 1, _bts_impl_flag_desc);
static int gsm_bts_talloc_destructor(struct gsm_bts *bts)
{
if (bts->site_mgr.mo.fi) {
osmo_fsm_inst_free(bts->site_mgr.mo.fi);
bts->site_mgr.mo.fi = NULL;
}
if (bts->mo.fi) {
osmo_fsm_inst_free(bts->mo.fi);
bts->mo.fi = NULL;
}
if (bts->shutdown_fi) {
osmo_fsm_inst_free(bts->shutdown_fi);
bts->shutdown_fi = NULL;
}
bts_osmux_release(bts);
llist_del(&bts->list);
g_bts_sm->num_bts--;
return 0;
}
struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num)
struct gsm_bts *gsm_bts_alloc(struct gsm_bts_sm *bts_sm, uint8_t bts_num)
{
struct gsm_bts *bts = talloc_zero(ctx, struct gsm_bts);
int i;
struct gsm_bts *bts = talloc_zero(bts_sm, struct gsm_bts);
if (!bts)
return NULL;
talloc_set_destructor(bts, gsm_bts_talloc_destructor);
/* add to list of BTSs */
llist_add_tail(&bts->list, &bts_sm->bts_list);
g_bts_sm->num_bts++;
bts->site_mgr = bts_sm;
bts->nr = bts_num;
bts->num_trx = 0;
INIT_LLIST_HEAD(&bts->trx_list);
@ -232,36 +262,24 @@ struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num)
bts->T_defs = bts_T_defs;
osmo_tdefs_reset(bts->T_defs);
osmo_tdefs_reset(abis_T_defs);
bts->shutdown_fi = osmo_fsm_inst_alloc(&bts_shutdown_fsm, bts, bts,
LOGL_INFO, NULL);
osmo_fsm_inst_update_id_f(bts->shutdown_fi, "bts%d", bts->nr);
bts->site_mgr.mo.fi = osmo_fsm_inst_alloc(&nm_bts_sm_fsm, bts, &bts->site_mgr,
LOGL_INFO, "bts_sm");
gsm_mo_init(&bts->site_mgr.mo, bts, NM_OC_SITE_MANAGER,
0xff, 0xff, 0xff);
/* NM BTS */
bts->mo.fi = osmo_fsm_inst_alloc(&nm_bts_fsm, bts, bts,
LOGL_INFO, NULL);
osmo_fsm_inst_update_id_f(bts->mo.fi, "bts%d", bts->nr);
gsm_mo_init(&bts->mo, bts, NM_OC_BTS, bts->nr, 0xff, 0xff);
for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
bts->gprs.nsvc[i].bts = bts;
bts->gprs.nsvc[i].id = i;
gsm_mo_init(&bts->gprs.nsvc[i].mo, bts, NM_OC_GPRS_NSVC,
bts->nr, i, 0xff);
}
memcpy(&bts->gprs.nse.timer, bts_nse_timer_default,
sizeof(bts->gprs.nse.timer));
gsm_mo_init(&bts->gprs.nse.mo, bts, NM_OC_GPRS_NSE,
bts->nr, 0xff, 0xff);
memcpy(&bts->gprs.cell.timer, bts_cell_timer_default,
sizeof(bts->gprs.cell.timer));
gsm_mo_init(&bts->gprs.cell.mo, bts, NM_OC_GPRS_CELL,
bts->nr, 0xff, 0xff);
memcpy(&bts->gprs.cell.rlc_cfg, &rlc_cfg_default,
sizeof(bts->gprs.cell.rlc_cfg));
/* NM GPRS CELL */
bts->gprs.cell.mo.fi = osmo_fsm_inst_alloc(&nm_gprs_cell_fsm, bts, &bts->gprs.cell,
LOGL_INFO, NULL);
osmo_fsm_inst_update_id_f(bts->gprs.cell.mo.fi, "gprs_cell%d-0", bts->nr);
gsm_mo_init(&bts->gprs.cell.mo, bts, NM_OC_GPRS_CELL, bts->nr, 0, 0xff);
memcpy(&bts->gprs.cell.rlc_cfg, &rlc_cfg_default, sizeof(bts->gprs.cell.rlc_cfg));
memcpy(&bts->gprs.cell.timer, bts_cell_timer_default, sizeof(bts->gprs.cell.timer));
/* create our primary TRX. It will be initialized during bts_init() */
bts->c0 = gsm_bts_trx_alloc(bts);
@ -277,14 +295,14 @@ struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num)
return bts;
}
struct gsm_bts *gsm_bts_num(const struct gsm_network *net, int num)
struct gsm_bts *gsm_bts_num(const struct gsm_bts_sm *bts_sm, int num)
{
struct gsm_bts *bts;
if (num >= net->num_bts)
if (num >= bts_sm->num_bts)
return NULL;
llist_for_each_entry(bts, &net->bts_list, list) {
llist_for_each_entry(bts, &bts_sm->bts_list, list) {
if (bts->nr == num)
return bts;
}
@ -300,19 +318,14 @@ int bts_init(struct gsm_bts *bts)
static int initialized = 0;
void *tall_rtp_ctx;
/* add to list of BTSs */
llist_add_tail(&bts->list, &bts_gsmnet.bts_list);
bts->band = GSM_BAND_1800;
INIT_LLIST_HEAD(&bts->agch_queue.queue);
bts->agch_queue.length = 0;
bts->ctrs = rate_ctr_group_alloc(bts, &bts_ctrg_desc, bts->nr);
if (!bts->ctrs) {
llist_del(&bts->list);
if (!bts->ctrs)
return -1;
}
/* enable management with default levels,
* raise threshold to GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DISABLE to
@ -329,57 +342,67 @@ int bts_init(struct gsm_bts *bts)
bts->rtp_port_range_end = 17407;
bts->rtp_port_range_next = bts->rtp_port_range_start;
bts->rtp_ip_dscp = -1;
bts->rtp_priority = -1;
bts->emit_hr_rfc5993 = true;
/* Default (fall-back) MS/BS Power control parameters */
bts->bs_dpc_params = power_ctrl_params_def;
bts->ms_dpc_params = power_ctrl_params_def;
power_ctrl_params_def_reset(&bts->bs_dpc_params, true);
power_ctrl_params_def_reset(&bts->ms_dpc_params, false);
/* configurable via OML */
bts->bsic = 0xff; /* invalid value, guarded by bsc_configured=false */
bts->bsic_configured = false;
bts->load.ccch.load_ind_period = 112;
load_timer_start(bts);
bts->rtp_jitter_buf_ms = 100;
bts->max_ta = 63;
bts->max_ta = MAX_TA_DEF;
bts->ny1 = 4;
bts->ny2 = 4;
bts->t3105_ms = 300;
bts->t3115_ms = 300;
bts->min_qual_rach = MIN_QUAL_RACH;
bts->min_qual_norm = MIN_QUAL_NORM;
bts->max_ber10k_rach = 1707; /* 7 of 41 bits is Eb/N0 of 0 dB = 0.1707 */
bts->pcu.sock_path = talloc_strdup(bts, PCU_SOCK_DEFAULT);
for (i = 0; i < ARRAY_SIZE(bts->t200_ms); i++)
bts->t200_ms[i] = oml_default_t200_ms[i];
bts->pcu.sock_wqueue_len_max = BTS_PCU_SOCK_WQUEUE_LEN_DEFAULT;
for (i = 0; i < ARRAY_SIZE(bts->t200_fn); i++)
bts->t200_fn[i] = oml_default_t200_fn[i];
/* default RADIO_LINK_TIMEOUT */
bts->radio_link_timeout.oml = 32;
bts->radio_link_timeout.current = bts->radio_link_timeout.oml;
/* Start with the site manager */
oml_mo_state_init(&bts->site_mgr.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
/* Start with the BTS */
oml_mo_state_init(&bts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
/* set BTS attr to dependency */
oml_mo_state_init(&bts->gprs.nse.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
oml_mo_state_init(&bts->gprs.cell.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
oml_mo_state_init(&bts->gprs.nsvc[0].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
oml_mo_state_init(&bts->gprs.nsvc[1].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE);
oml_mo_state_init(&bts->gprs.cell.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
/* allocate a talloc pool for ORTP to ensure it doesn't have to go back
* to the libc malloc all the time */
tall_rtp_ctx = talloc_pool(tall_bts_ctx, 262144);
osmo_rtp_init(tall_rtp_ctx);
/* features implemented in 'common', available for all models */
/* Osmux */
rc = bts_osmux_init(bts);
if (rc < 0)
return rc;
/* features implemented in 'common', available for all models,
* order alphabetically */
osmo_bts_set_feature(bts->features, BTS_FEAT_ABIS_OSMO_PCU);
osmo_bts_set_feature(bts->features, BTS_FEAT_CCN);
osmo_bts_set_feature(bts->features, BTS_FEAT_DYN_TS_SDCCH8);
osmo_bts_set_feature(bts->features, BTS_FEAT_ETWS_PN);
osmo_bts_set_feature(bts->features, BTS_FEAT_IPV6_NSVC);
osmo_bts_set_feature(bts->features, BTS_FEAT_PAGING_COORDINATION);
/* Maximum TA supported by the PHY (can be overridden by PHY specific code) */
bts->support.max_ta = MAX_TA_DEF;
rc = bts_model_init(bts);
if (rc < 0) {
llist_del(&bts->list);
if (rc < 0)
return rc;
}
/* TRX0 was allocated early during gsm_bts_alloc, not later through VTY */
bts_trx_init(bts->c0);
bts_gsmnet.num_bts++;
bts_model_trx_init(bts->c0);
if (!initialized) {
osmo_signal_register_handler(SS_GLOBAL, bts_signal_cbfn, NULL);
@ -396,7 +419,10 @@ int bts_init(struct gsm_bts *bts)
bts->smscb_queue_tgt_len = 2;
bts->smscb_queue_hyst = 2;
INIT_LLIST_HEAD(&bts->oml_queue);
bts->asci.pos_nch = -ENOTSUP;
INIT_LLIST_HEAD(&bts->asci.notifications);
INIT_LLIST_HEAD(&bts->bsc_oml_hosts);
/* register DTX DL FSM */
rc = osmo_fsm_register(&dtx_dl_amr_fsm);
@ -413,97 +439,17 @@ int bts_init(struct gsm_bts *bts)
/* main link is established, send status report */
int bts_link_estab(struct gsm_bts *bts)
{
int i, j;
LOGP(DOML, LOGL_INFO, "Main link established, sending NM Status\n");
LOGP(DSUM, LOGL_INFO, "Main link established, sending NM Status.\n");
/* BTS SITE MGR becomes Offline (tx SW ACT Report), BTS is DEPENDENCY */
osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_SW_ACT, NULL);
osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_SW_ACT, NULL);
/* those should all be in DEPENDENCY */
oml_tx_state_changed(&bts->gprs.nse.mo);
oml_tx_state_changed(&bts->gprs.cell.mo);
oml_tx_state_changed(&bts->gprs.nsvc[0].mo);
oml_tx_state_changed(&bts->gprs.nsvc[1].mo);
/* All other objects start off-line until the BTS Model code says otherwise */
for (i = 0; i < bts->num_trx; i++) {
struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, i);
oml_tx_state_changed(&trx->mo);
oml_tx_state_changed(&trx->bb_transc.mo);
for (j = 0; j < ARRAY_SIZE(trx->ts); j++) {
struct gsm_bts_trx_ts *ts = &trx->ts[j];
oml_tx_state_changed(&ts->mo);
}
}
/* Signal OML UP to BTS SITE MGR. It will automatically SW_ACT repoort
* and become Disabled-Offline, then dispatch same event to its children
* objects.
*/
osmo_fsm_inst_dispatch(bts->site_mgr->mo.fi, NM_EV_OML_UP, NULL);
return bts_model_oml_estab(bts);
}
/* prepare the per-SAPI T200 arrays for a given lchan */
static int t200_by_lchan(int *t200_ms_dcch, int *t200_ms_acch, struct gsm_lchan *lchan)
{
struct gsm_bts *bts = lchan->ts->trx->bts;
/* we have to compensate for the "RTS advance" due to the asynchronous interface between
* the BTS (LAPDm) and the PHY/L1 (OsmoTRX or DSP in case of osmo-bts-{sysmo,lc15,oc2g,octphy} */
int32_t fn_advance = bts_get_avg_fn_advance(bts);
int32_t fn_advance_us = fn_advance * 4615;
int fn_advance_ms = fn_advance_us / 1000;
t200_ms_acch[DL_SAPI0] = bts->t200_ms[T200_SACCH_SDCCH] + fn_advance_ms;
t200_ms_acch[DL_SAPI3] = bts->t200_ms[T200_SACCH_SDCCH] + fn_advance_ms;
if (lchan->repeated_acch_capability.dl_facch_all && (lchan->type == GSM_LCHAN_TCH_F || lchan->type == GSM_LCHAN_TCH_H)) {
t200_ms_acch[DL_SAPI0] *= 2;
t200_ms_acch[DL_SAPI3] *= 2;
}
switch (lchan->type) {
case GSM_LCHAN_SDCCH:
t200_ms_dcch[DL_SAPI0] = bts->t200_ms[T200_SDCCH] + fn_advance_ms;
t200_ms_dcch[DL_SAPI3] = bts->t200_ms[T200_SDCCH_SAPI3] + fn_advance_ms;
break;
case GSM_LCHAN_TCH_F:
t200_ms_dcch[DL_SAPI0] = bts->t200_ms[T200_FACCH_F] + fn_advance_ms;
t200_ms_dcch[DL_SAPI3] = bts->t200_ms[T200_FACCH_F] + fn_advance_ms;
break;
case GSM_LCHAN_TCH_H:
t200_ms_dcch[DL_SAPI0] = bts->t200_ms[T200_FACCH_H] + fn_advance_ms;
t200_ms_dcch[DL_SAPI3] = bts->t200_ms[T200_FACCH_H] + fn_advance_ms;
break;
default:
/* Channels such as CCCH don't use lapdm DL, and hence no T200 is needed */
return -1;
}
return 0;
}
int lchan_init_lapdm(struct gsm_lchan *lchan)
{
struct lapdm_channel *lc = &lchan->lapdm_ch;
int t200_ms_dcch[_NR_DL_SAPI], t200_ms_acch[_NR_DL_SAPI];
if (t200_by_lchan(t200_ms_dcch, t200_ms_acch, lchan) == 0) {
LOGPLCHAN(lchan, DLLAPD, LOGL_DEBUG,
"Setting T200 D0=%u, D3=%u, S0=%u, S3=%u (all in ms)\n",
t200_ms_dcch[DL_SAPI0], t200_ms_dcch[DL_SAPI3],
t200_ms_acch[DL_SAPI0], t200_ms_acch[DL_SAPI3]);
lapdm_channel_init3(lc, LAPDM_MODE_BTS, t200_ms_dcch, t200_ms_acch, lchan->type,
gsm_lchan_name(lchan));
lapdm_channel_set_flags(lc, LAPDM_ENT_F_POLLING_ONLY);
lapdm_channel_set_l1(lc, NULL, lchan);
}
/* We still need to set Rx callback to receive RACH requests: */
lapdm_channel_set_l3(lc, lapdm_rll_tx_cb, lchan);
return 0;
}
#define CCCH_RACH_RATIO_COMBINED256 (256*1/9)
#define CCCH_RACH_RATIO_SEPARATE256 (256*10/55)
@ -698,7 +644,7 @@ int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg)
struct gsm48_imm_ass_rej *imm_ass_cmd = msgb_l3(msg);
if (bts->agch_queue.length > hard_limit) {
LOGP(DSUM, LOGL_ERROR,
LOGP(DRR, LOGL_ERROR,
"AGCH: too many messages in queue, "
"refusing message type %s, length = %d/%d\n",
gsm48_rr_msg_name(((struct gsm48_imm_ass *)msgb_l3(msg))->msg_type),
@ -726,7 +672,7 @@ int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg)
return 0;
}
struct msgb *bts_agch_dequeue(struct gsm_bts *bts)
static struct msgb *bts_agch_dequeue(struct gsm_bts *bts)
{
struct msgb *msg = msgb_dequeue(&bts->agch_queue.queue);
if (!msg)
@ -792,12 +738,12 @@ static void compact_agch_queue(struct gsm_bts *bts)
return;
}
int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt,
int is_ag_res)
int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt, enum ccch_msgt ccch)
{
struct msgb *msg = NULL;
int rc = 0;
int is_empty = 1;
const struct bts_agch_msg_cb *msg_cb;
/* Do queue house keeping.
* This needs to be done every time a CCCH message is requested, since
@ -806,26 +752,39 @@ int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt
*/
compact_agch_queue(bts);
/* Check for paging messages first if this is PCH */
if (!is_ag_res)
switch (ccch) {
case CCCH_MSGT_NCH:
/* Send NCH message, it has priority over AGCH and does not overlap with PCH. */
rc = bts_asci_notify_nch_gen_msg(bts, out_buf);
return rc;
case CCCH_MSGT_PCH:
/* Check whether the block may be overwritten by AGCH. */
rc = paging_gen_msg(bts->paging_state, out_buf, gt, &is_empty);
/* Check whether the block may be overwritten */
if (!is_empty)
return rc;
msg = bts_agch_dequeue(bts);
if (!msg)
return rc;
if (!is_empty)
return rc;
/* fall-through */
case CCCH_MSGT_AGCH:
/* If fallen here and the AGCH queue is empty, return empty PCH message. */
msg = bts_agch_dequeue(bts);
if (!msg)
return rc;
/* Continue to return AGCH message. */
break;
}
rate_ctr_inc2(bts->ctrs, BTS_CTR_AGCH_SENT);
/* Confirm sending of the AGCH message towards the PCU */
msg_cb = (struct bts_agch_msg_cb *) msg->cb;
if (msg_cb->confirm)
pcu_tx_data_cnf(msg_cb->msg_id, PCU_IF_SAPI_AGCH_2);
/* Copy AGCH message */
memcpy(out_buf, msgb_l3(msg), msgb_l3len(msg));
rc = msgb_l3len(msg);
msgb_free(msg);
if (is_ag_res)
if (ccch == CCCH_MSGT_AGCH)
bts->agch_queue.agch_msgs++;
else
bts->agch_queue.pch_msgs++;
@ -853,80 +812,201 @@ struct gsm_time *get_time(struct gsm_bts *bts)
return &bts->gsm_time;
}
int bts_supports_cm(struct gsm_bts *bts, enum gsm_phys_chan_config pchan,
enum gsm48_chan_mode cm)
bool bts_supports_cm_speech(const struct gsm_bts *bts,
const struct rsl_ie_chan_mode *cm)
{
enum osmo_bts_features feature = _NUM_BTS_FEAT;
/* We assume that signalling support is mandatory,
* there is no BTS_FEAT_* definition to check that. */
if (cm == GSM48_CMODE_SIGN)
return 1;
/* Stage 1: check support for the requested channel type */
switch (cm->chan_rt) {
case RSL_CMOD_CRT_TCH_GROUP_Bm:
case RSL_CMOD_CRT_TCH_GROUP_Lm:
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_VGCS))
return false;
break;
case RSL_CMOD_CRT_TCH_BCAST_Bm:
case RSL_CMOD_CRT_TCH_BCAST_Lm:
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_VBS))
return false;
break;
case RSL_CMOD_CRT_OSMO_TCH_VAMOS_Bm:
case RSL_CMOD_CRT_OSMO_TCH_VAMOS_Lm:
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_VAMOS))
return false;
break;
}
/* Before the requested pchan/cm combination can be checked, we need to
* convert it to a feature identifier we can check */
switch (pchan) {
case GSM_PCHAN_TCH_F:
switch(cm) {
case GSM48_CMODE_SPEECH_V1:
/* Stage 2: check support for the requested codec */
switch (cm->chan_rt) {
case RSL_CMOD_CRT_OSMO_TCH_VAMOS_Bm:
case RSL_CMOD_CRT_TCH_GROUP_Bm:
case RSL_CMOD_CRT_TCH_BCAST_Bm:
case RSL_CMOD_CRT_TCH_Bm:
switch (cm->chan_rate) {
case RSL_CMOD_SP_GSM1:
feature = BTS_FEAT_SPEECH_F_V1;
break;
case GSM48_CMODE_SPEECH_EFR:
case RSL_CMOD_SP_GSM2:
feature = BTS_FEAT_SPEECH_F_EFR;
break;
case GSM48_CMODE_SPEECH_AMR:
case RSL_CMOD_SP_GSM3:
feature = BTS_FEAT_SPEECH_F_AMR;
break;
default:
/* Invalid speech codec type => Not supported! */
return 0;
return false;
}
break;
case GSM_PCHAN_TCH_H:
switch(cm) {
case GSM48_CMODE_SPEECH_V1:
case RSL_CMOD_CRT_OSMO_TCH_VAMOS_Lm:
case RSL_CMOD_CRT_TCH_GROUP_Lm:
case RSL_CMOD_CRT_TCH_BCAST_Lm:
case RSL_CMOD_CRT_TCH_Lm:
switch (cm->chan_rate) {
case RSL_CMOD_SP_GSM1:
feature = BTS_FEAT_SPEECH_H_V1;
break;
case GSM48_CMODE_SPEECH_AMR:
case RSL_CMOD_SP_GSM3:
feature = BTS_FEAT_SPEECH_H_AMR;
break;
default:
/* Invalid speech codec type => Not supported! */
return 0;
return false;
}
break;
default:
LOGP(DRSL, LOGL_ERROR, "BTS %u: unhandled pchan %s when checking mode %s\n",
bts->nr, gsm_pchan_name(pchan), gsm48_chan_mode_name(cm));
return 0;
LOGP(DRSL, LOGL_ERROR,
"Unhandled RSL channel type=0x%02x/rate=0x%02x\n",
cm->chan_rt, cm->chan_rate);
return false;
}
/* Check if the feature is supported by this BTS */
if (osmo_bts_has_feature(bts->features, feature))
return 1;
return true;
return 0;
return false;
}
static bool bts_supports_cm_data(const struct gsm_bts *bts,
const struct rsl_ie_chan_mode *cm)
{
switch (bts->variant) {
case BTS_OSMO_TRX:
switch (cm->chan_rate) {
/* TODO: RSL_CMOD_CSD_NT_14k5 */
/* TODO: RSL_CMOD_CSD_T_14k4 */
case RSL_CMOD_CSD_NT_12k0:
case RSL_CMOD_CSD_T_9k6:
if (cm->chan_rt != RSL_CMOD_CRT_TCH_Bm)
return false; /* invalid */
/* fall-through */
case RSL_CMOD_CSD_NT_6k0:
case RSL_CMOD_CSD_T_4k8:
case RSL_CMOD_CSD_T_2k4:
case RSL_CMOD_CSD_T_1k2:
case RSL_CMOD_CSD_T_600:
case RSL_CMOD_CSD_T_1200_75:
return true;
default:
return false;
}
default:
return 0;
}
}
bool bts_supports_cm(const struct gsm_bts *bts,
const struct rsl_ie_chan_mode *cm)
{
switch (cm->spd_ind) {
case RSL_CMOD_SPD_SIGN:
/* We assume that signalling support is mandatory,
* there is no BTS_FEAT_* definition to check that. */
return true;
case RSL_CMOD_SPD_SPEECH:
return bts_supports_cm_speech(bts, cm);
case RSL_CMOD_SPD_DATA:
return bts_supports_cm_data(bts, cm);
default:
return false;
}
}
/* return the gsm_lchan for the CBCH (if it exists at all) */
struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts)
{
struct gsm_lchan *lchan = NULL;
struct gsm_bts_trx *trx = bts->c0;
/* According to 3GPP TS 45.002, table 3, CBCH can be allocated
* either on C0/TS0 (CCCH+SDCCH4) or on C0..n/TS0..3 (SDCCH/8). */
if (trx->ts[0].pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
lchan = &trx->ts[0].lchan[2];
else {
int i;
for (i = 0; i < 8; i++) {
if (trx->ts[i].pchan == GSM_PCHAN_SDCCH8_SACCH8C_CBCH) {
lchan = &trx->ts[i].lchan[2];
break;
}
return &trx->ts[0].lchan[2]; /* C0/TS0 */
llist_for_each_entry(trx, &bts->trx_list, list) { /* C0..n */
unsigned int tn;
for (tn = 0; tn <= 3; tn++) { /* TS0..3 */
struct gsm_bts_trx_ts *ts = &trx->ts[tn];
if (ts->pchan == GSM_PCHAN_SDCCH8_SACCH8C_CBCH)
return &ts->lchan[2];
}
}
return lchan;
return NULL;
}
/* BCCH carrier power reduction (see 3GPP TS 45.008, section 7.1) */
int bts_set_c0_pwr_red(struct gsm_bts *bts, const uint8_t red)
{
struct gsm_bts_trx *c0 = bts->c0;
unsigned int tn;
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_BCCH_POWER_RED)) {
LOGPTRX(c0, DRSL, LOGL_ERROR, "BCCH carrier power reduction "
"is not supported by this BTS model\n");
return -ENOTSUP;
}
if (red > 6 || red % 2 != 0) {
LOGPTRX(c0, DRSL, LOGL_ERROR, "BCCH carrier power reduction "
"value (%u dB) is incorrect or out of range\n", red);
return -EINVAL;
}
LOGPTRX(c0, DRSL, LOGL_NOTICE, "BCCH carrier power reduction: "
"%u dB (%s)\n", red, red ? "enabled" : "disabled");
/* Timeslot 0 is always transmitting BCCH/CCCH */
c0->ts[0].c0_power_red_db = 0;
for (tn = 1; tn < ARRAY_SIZE(c0->ts); tn++) {
struct gsm_bts_trx_ts *ts = &c0->ts[tn];
struct gsm_bts_trx_ts *prev = ts - 1;
switch (ts_pchan(ts)) {
/* Not allowed on CCCH/BCCH */
case GSM_PCHAN_CCCH:
/* Preceeding timeslot shall not exceed 2 dB */
if (prev->c0_power_red_db > 0)
prev->c0_power_red_db = 2;
/* fall-through */
/* Not recommended on SDCCH/8 */
case GSM_PCHAN_SDCCH8_SACCH8C:
case GSM_PCHAN_SDCCH8_SACCH8C_CBCH:
ts->c0_power_red_db = 0;
break;
default:
ts->c0_power_red_db = red;
break;
}
}
/* Timeslot 7 is always preceding BCCH/CCCH */
if (c0->ts[7].c0_power_red_db > 0)
c0->ts[7].c0_power_red_db = 2;
bts->c0_power_red_db = red;
return 0;
}

View File

@ -12,7 +12,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -84,12 +84,45 @@ static int set_oml_alert(struct ctrl_cmd *cmd, void *data)
return CTRL_CMD_REPLY;
}
static int verify_max_ber10k_rach(struct ctrl_cmd *cmd, const char *value, void *_data)
{
int max_ber10k_rach = atoi(cmd->value);
if (max_ber10k_rach < 0 || max_ber10k_rach > 10000) {
cmd->reply = "Value is out of range";
return 1;
}
return 0;
}
static int get_max_ber10k_rach(struct ctrl_cmd *cmd, void *data)
{
cmd->reply = talloc_asprintf(cmd, "%u", g_bts->max_ber10k_rach);
if (!cmd->reply) {
cmd->reply = "OOM";
return CTRL_CMD_ERROR;
}
return CTRL_CMD_REPLY;
}
static int set_max_ber10k_rach(struct ctrl_cmd *cmd, void *data)
{
g_bts->max_ber10k_rach = atoi(cmd->value);
cmd->reply = "OK";
return CTRL_CMD_REPLY;
}
CTRL_CMD_DEFINE(max_ber10k_rach, "max-ber10k-rach");
int bts_ctrl_cmds_install(struct gsm_bts *bts)
{
int rc = 0;
rc |= ctrl_cmd_install(CTRL_NODE_TRX, &cmd_therm_att);
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_oml_alert);
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_max_ber10k_rach);
g_bts = bts;
return rc;

View File

@ -12,7 +12,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -88,14 +88,12 @@ err_index:
return -ERANGE;
}
struct ctrl_handle *bts_controlif_setup(struct gsm_bts *bts,
const char *bind_addr, uint16_t port)
struct ctrl_handle *bts_controlif_setup(struct gsm_bts *bts, uint16_t port)
{
struct ctrl_handle *hdl;
int rc = 0;
hdl = ctrl_interface_setup_dynip(bts, bind_addr, port,
bts_ctrl_node_lookup);
hdl = ctrl_interface_setup(bts, port, bts_ctrl_node_lookup);
if (!hdl)
return NULL;

Some files were not shown because too many files have changed in this diff Show More