Commit Graph

3284 Commits

Author SHA1 Message Date
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