summaryrefslogtreecommitdiffstats
path: root/src/host/trxcon
AgeCommit message (Collapse)AuthorFilesLines
2018-04-15trxcon: Prefix SACCH fill frame with L1 headerHarald Welte1-2/+12
The main problem here is that the existing implementatin missing the L1 header in this message. A SACCH message doesn't have a 23byte LAPDm message, but only a 21 byte LAPDm message prefixed by a 2-byte Layer1 header. So on the receiver in the BTS, right now the first two bytes of the UL SACCH frame are misinterpreted as L1 header. This it what causes RLL ERROR INDICATION on the Abis side, which is why our BTS_Tests fail. Change-Id: Id7776bf3604d0e8a32e04547e01b8bd377903272 Related: OS#3170
2018-04-09host/trxcon: track talloc NULL contexts by defaultVadim Yanitskiy1-0/+3
In order to be able to introspect not only the root application context, but also all other contexts, e.g. allocated within libosmocore or other libraries, let's enable tracking the use of NULL contexts using the corresponding talloc API. Change-Id: Id21cd5ee340def443f7a5d0b2b8f37f41188dd87
2018-04-09host/trxcon: don't free root talloc contextVadim Yanitskiy1-2/+7
This is useless, and prevents us from finding potential memory leaks at exit. Let's print talloc report instead of that. Change-Id: Ibf04942070d654e97c3ed77d69ab19e44602758c
2018-04-09host/trxcon: use osmo_init_logging2()Vadim Yanitskiy1-1/+2
The osmo_init_logging() doesn't allow to specify a talloc context for libosmocore logging subsystem, so this is why the new version was introduced. Let's use it. Change-Id: I06c4a1f7f839f774bc428e89cfac30132bae904d
2018-04-04trxcon/l1ctl.c: hexdump content of unhandled messagesPau Espin Pedrol1-1/+2
Change-Id: Iec8fc6d49d1e35fe101960dd969de559e37a6a75
2018-04-02trxcon: Respect the tch_mode field of DM_EST_REQHarald Welte3-7/+8
the initial tch_mode is not always 0 (signalling) but can very well be directly a codec mode, if the initial activation of the channel is in speech mode as opposed to signalling Change-Id: I96e4c89da1165e9c5287d863e0e65d811460c606
2018-03-22trxcon/scheduler: add CHAN_IS_SACCH macroVadim Yanitskiy1-0/+3
Change-Id: I2fc90d4732433f221c628058c9812815edf9c8cb
2018-03-22trxcon/scheduler: share lchan link identifiersVadim Yanitskiy2-41/+41
Change-Id: Ie1632f274b2ae6147a8e918ebfea60eeeb6a234c
2018-03-22trxcon/sched_prim.c: fix: correct the first padding byteVadim Yanitskiy1-8/+9
According to TS 144.006, section 5.2, the first octet containing fill bits shall be set to the binary value "00101011" == 0x2b. Change-Id: I8f0304bf84613a2dc07cb78aff0cb8bb4c5adf6c
2018-03-11trxcon/sched_lchan_tchf.c: always send traffic indicationsVadim Yanitskiy1-17/+29
We shall always send traffic frame indications, even if received frame is incomplete or decoding was failed. This is required for proper Measurement Reporting. Change-Id: I99e134699796c7075299459e96b2f2d462636619
2018-03-11trxcon/sched_lchan_xcch.c: always send data indicationsVadim Yanitskiy1-6/+9
We shall always send data frame indications, even if received frame is incomplete or decoding was failed. This is required for proper Measurement Reporting. Change-Id: I7beee7e797f488d04c3b59bee9501ce823717092
2018-03-11trxcon/scheduler: enforce lchan handlers to set message typeVadim Yanitskiy4-21/+18
Since this change, each lchan handler shall manually indicate a type of both message indications and confirmations. Change-Id: I02e0b87d61c127d2f6f5b9532909af78332bf707
2018-03-11trxcon/sched_lchan_common.c: use static memory allocationVadim Yanitskiy1-28/+19
There is no need to allocate the DL header for each new message. Change-Id: Id7ad815c6b403f5c3d15fc02022397188f1d87fd
2018-03-11trxcon: clean up DATA / TRAFFIC indication APIVadim Yanitskiy3-27/+23
- change 'l1ctl_tx_data_ind' symbol to 'l1ctl_tx_dt_ind' in order to indicate that it's used for both DATA and TRAFFIC; - introduce a 'traffic' flag, which is used to define either TRAFFIC or DATA indication type; - pass L2 payload and its length separately from the Downlink info header. Change-Id: I9fe65ee9b2d772576b86b7bc85d53518530d1579
2018-03-11trxcon: clean up DATA / TRAFFIC confirmation APIVadim Yanitskiy3-16/+12
- change 'l1ctl_tx_data_conf' symbol to 'l1ctl_tx_dt_conf' in order to indicate that it's used for both DATA and TRAFFIC; - introduce a 'traffic' flag, which is used to define either TRAFFIC or DATA confirmation type; Change-Id: Iedd569086a264dc7d8740abea5c6e5ca21e299f6
2018-03-11trxcon/l1ctl.c: combine both DATA and TRAFFIC REQ handlersVadim Yanitskiy1-44/+16
Both functions are almost identical, and the only difference is the message type they set. Let's combine them into a single function and introduce a 'traffic' flag, which can be used to define a message type. Change-Id: I288f5d7b6cd242c4793973dcb3d2b1b6925d61a7
2018-03-11trxcon/l1ctl_link.c: allocate msgb after its length is readVadim Yanitskiy1-10/+8
Change-Id: I2b941c5ed91097c4ed2d859634bbe89f44546061
2018-03-11trxcon: clarify L1CTL message length fieldVadim Yanitskiy3-5/+19
Each L1CTL message gets its own length pushed in front before sending. This isn't specified in the 'l1ctl_proto.h', but assumed in the code. Let's clarify this. Change-Id: I118d00613aeaf5ff0bad1188fa5f7450d4ca8122
2018-03-11trxcon: use meaningful names for L1CTL messagesVadim Yanitskiy2-2/+2
There are two types of L1CTL messages: received and to be transmitted. Let's use proper names to indicate this. Change-Id: I7c17687579282fa389bca35dc7edbc3582e55701
2018-03-11trxcon/scheduler: transmit dummy frames on CBTX lchansVadim Yanitskiy4-0/+118
If at the moment of transmission there are no frames in TX buffer, then either a dummy LAPDm frame (0x01, 0x03, 0x01, 0x2b ...) or a silence frame (depending on a codec in use) shall be transmitted. This is required for proper measurements on the BTS side. Change-Id: Ie590990f2274ea476678f6b2079f90eeadab6501
2018-03-11trxcon/scheduler: introduce a new CBTX lchan flagVadim Yanitskiy2-30/+32
This new flag is intended to indicate that continuous burst transmission is assumed on particular logical channel. In other words, if a logical channel has this flag, but there is nothing to transmit in a TX buffer, then either a dummy LAPDm frame or a silence frame shall be sent. Change-Id: I25fcf9eeb787ffe5378d92532439e67d7d42fa65
2018-03-11trxcon/sched_trx.h: clarify lchan flags meaningVadim Yanitskiy1-1/+3
Change-Id: I51b663dd16e46a4523488c3d3000922a7c3640d1
2018-03-11trxcon/sched_trx.c: fix: omit inactive logical channelsVadim Yanitskiy1-0/+4
The sched_frame_clck_cb() is responsible for UL burst transmission. Iterating over each timeslot, it chooses a proper lchan handler according to a current frame number and a multiframe layout in use, takes a L2 UL frame from a TX buffer, and finally calls the chosen handler in order to to encode and transmit a taken frame. A handler should be called only for activated logical channels... but for some long time, there was a bug, so each lchan was processed, including inactive ones. It's time to fix this. Change-Id: I33e3ecc14be3ae64dfd02789c7f0970c945582c9
2018-03-11trxcon/sched_trx.c: fix: properly deallocate lchansVadim Yanitskiy1-2/+4
The llist_for_each_entry_safe() should be used instead of the llist_for_each_entry(), because it's safe against removal of llist entry. Found using Valgrind's memcheck tool. Change-Id: I65234971ec152df038c5388da537a503060c215b
2018-03-11trxcon/configure.ac: add --enable-sanitize optionVadim Yanitskiy1-0/+11
Change-Id: I099de726f9d67213c56d996039b4207f80a727c6
2018-03-02host/trxcon: use integer math for ToA (Timing of Arrival)Vadim Yanitskiy7-21/+23
There's no need to express ToA value as a float. Let's turn it into an int16_t with 1/256 symbol period accuracy throughout the code to avoid both float arithmetic as well as loosing any precision. Inspired by Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec. Change-Id: I99c0f38db08a530d5846c474aba352aa0b68fe86
2018-03-01trxcon: Fix '-i' to specify the "TRX IP address"Harald Welte3-35/+15
The command line help states '-i' is for 'TRX IP address', which is the remote IP address at which the TRX is to be found. Hoewever, it was used as the local (bind) IP address of the socket used towards the TRX. This is my attempt at fixing this. A more complete solution probably allows to specify both local (bind) and remote (connect) address, just to be clear. Change-Id: If0252b15e9c7942687c6dc470951d777f7af651c
2018-02-28trxcon: Define event names for osmo_fsm'sHarald Welte3-0/+19
Change-Id: Id3279e99966a0ab236923c497ac0abbc9ed2c93c
2018-02-23trxcon|fake_trx: change default TRX port number to 6700Harald Welte1-2/+2
In order to avoid clashes with OsmoTRX, which may be also running on the same host, let's use a different port range starting from 6700 by default. This idea was introduced as a result of OS#2984. Change-Id: I66b5f25aaba3b836448ed29839c39869b5622bed Related: OS#2984
2018-01-05trxcon/scheduler: use TCH frame length defs from libosmocodecVadim Yanitskiy2-5/+2
Change-Id: I6439d3cadd2dc1fa8fe401eb61c977a12ec844f2
2018-01-05trxcon/scheduler: drop meaningless TODO commentVadim Yanitskiy1-1/+0
Since both TA and AGC loops should be implemented in transceiver, this TODO is meaningless. Let's drop it. Change-Id: I84979712e2a1b849acaee53d5cd50de4e1e357c2
2018-01-05trxcon/scheduler: use linuxlist API for lchan managementVadim Yanitskiy3-58/+67
As there is no any order relation between logical channels, it's better to use the linuxlist API instead of talloc array. Change-Id: I5a78582c77ed1ab33817d240e065dc4cd4708199
2018-01-05trxcon/scheduler: deactivate lchans when resetting / deleting TSVadim Yanitskiy1-0/+9
Previously, when resetting or deleting a timeslot, we did not deactivate the logical channels, relaying on talloc hierarchical nature. This approach may cause some problems, e.g. on embedded systems with emulated talloc API. Change-Id: I8c34c793df87bd8c79b7bf1f05b949faf10520e8
2018-01-05trxcon/scheduler: reset lchan state after deactivationVadim Yanitskiy1-13/+45
Let's assume that a logical channel, which was already in use, is activated again for a new connection. As we don't reset the state variables, such as burst masks or ciphering data, it may cause an unexpected behaviour. In order to avoid this, let's always reset the logical channel state after deactivation. Change-Id: I91e736a97cb05b167614cb488a00d847a9a859e0
2018-01-05trxcon/scheduler: share chan / prim identification helpersVadim Yanitskiy2-9/+9
Because they would be also used outside. Change-Id: Ic8af9d7c72fdb124caef82e35170f92b84e16eb9
2018-01-04trxcon/scheduler: FIX: return NULL from TCH dequeue functionVadim Yanitskiy1-6/+6
Initially it was expected that a TCH transmit queue could contain TCH and FACCH primitives only. But there are also SACCH primitives, which are also being stored there. So, let's drop the assertations from the sched_prim_dequeue_tch(), and return NULL if nothing was found. Change-Id: Iae37057d35883c09a76f0612e52c2d14d9ff91cb
2017-12-18trxcon/scheduler: implement A5/X ciphering supportVadim Yanitskiy3-3/+125
This change implements the A5/X ciphering support transparently for the logical channel handlers. In other words, a DL burst is deciphered before being passed to a handler, and an UL burst is ciphered before being sent to transceiver. The implementation mostly relays on the libosmocore's A5 API. Change-Id: Ib53418d8c0f394fdece09cf5cc240887cb0bb5af
2017-12-18trxcon/scheduler: preprocess UL bursts before sendingVadim Yanitskiy5-12/+27
Having a possibility to preprocess UL burst before sending to transceiver is required for the further ciphering support integration and probably some other tasks. Change-Id: Ia6eead5d4f51d7c0bf277b9d5ebb0a74676df567
2017-12-18trxcon/scheduler: prioritize FACCH correctlyVadim Yanitskiy1-35/+43
Previously we used to compare two consecutive first primitives, taken from a transmit queue. This approach may cause some delay, which is critical for FACCH e.g. in case of handover. Let's walk through a whole transmit queue to find a pair of both FACCH frames, and only then decide what to do. Change-Id: I925cca77bfaa255dd095bc882c901d41c9bc4633
2017-12-18trxcon/scheduler: move prim management outside lchan handlersVadim Yanitskiy7-79/+118
Previously, each lchan handler used to obtain and delete primitives from a timeslot's tranmit queue itself. This approach entails many potential problems and bugs: - The lchan handlers shall not do that by definition, they should encode and decode frames according to GSM 05.03. - In some cases (e.g. TCH), a single transmit queue may contain primitives of different types (e.g. TCH, FACCH and SACCH). At the same time, the lchan handlers don't care and don't even know about each other. So, this could cause an unexpected behaviour in some cases. This change separates all primitive management routines, providing a new API for obtaining and dropping them. "Write programs that do one thing and do it well." Change-Id: I29503ece51903784bc53541015285234471c8d15
2017-12-18trxcon/scheduler: separate primitive management codeVadim Yanitskiy7-141/+214
It's good to write, keep and make the source code as much modular as possible. So, Tte primitive management code was separated to the 'sched_prim.c' and going to be extended in the near future. Change-Id: Ifec8c9e4f2c95c72b00772688bcb5dc9c11d6de7
2017-12-18trxcon/scheduler: BUGFIX: distinguish between SACCH and FACCHVadim Yanitskiy1-3/+6
Both SACCH and FACCH messages have the same 23-byte length, both are being queued together within a single transimt queue. So, previously a SACCH frame could be picked by TCH burst handler, and then sent as a FACCH frame. Let's fix this. A FACCH primitive may have one of the TRXC_TCH* logical channel types, while SACCH primitives have one of the TRXC_SACCH*. Change-Id: Ia7090384f3ff74c9d94997265135acbceffa0ffe
2017-12-16host/trxcon/scheduler: always print error messagesVadim Yanitskiy3-5/+5
Some error messages previously had incorrect logging level 'debug'. We aren't going to hide anything, right? Let's print them! Change-Id: I85fb37292046b667386bfe26b9bbb000600e1c6f
2017-12-16host/trxcon/scheduler: inform L2&3 about decoding errorsVadim Yanitskiy4-10/+21
Previously, we used to drop a frame if decoding wasn't successful. This way, the higher layers didn't even know about that, so the local counters and Measurement Reports were incomplete. This change makes scheduler to forward L2 frames in any case, setting the num_biterr for each of them. In case of decoding error, a dummy (payload filled by 0x00) L2 frame will be sent. Change-Id: I31011d8f3ca8b9a12474cd0bc653faed18391033
2017-12-16host/trxcon/scheduler: add initial TCH/F channel supportVadim Yanitskiy5-2/+386
This change implements basic TCH/F lchan handlers for both data reception and transmission. Only FACCH (signaling), FR and EFR payloads are supported at the moment. Change-Id: If6b0eaede2b484484d2a824e7219ff04483266a1
2017-12-16host/trxcon/l1ctl.c: handle L1CTL_TRAFFIC_REQVadim Yanitskiy1-0/+40
Change-Id: Ibdf2d4f6aa464250a4c6951af86c06eb3fd3b98b
2017-12-16host/trxcon/scheduler: use GSM_MACBLOCK_LEN definitionVadim Yanitskiy2-5/+8
Change-Id: Ie3b27ecb62d6f0e84f2e3ec0c1558e32bb213d33
2017-12-16host/trxcon/scheduler: drop meaningless memset callVadim Yanitskiy1-3/+1
Change-Id: I18a938cef350632673cfc820beed5e42f40d89e7
2017-12-16host/trxcon/scheduler: clean up the trx_lchan_stateVadim Yanitskiy3-70/+51
There were some BTS specific variables, which are meaningless. This change cleans them up, and also groups some measurement, encryption, and AMR specific variables into sub-structures. Change-Id: Ie753a7e3e7fa2b433d8319b3a05b85b8583d7be2
2017-12-16host/trxcon/scheduler: use new libosmocoding API for RACHVadim Yanitskiy1-2/+3
Since the 32e5641d, the gsm0503_rach_encode() is deprecated, and the library provides new API with extended (11-bit) RACH support. Change-Id: I1955fe46eebd173d6eddd1d47ee9f7318b9b4e2d