summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
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-18L1CTL/L1CTL_CRYPTO_REQ: add key length and channel infoVadim Yanitskiy5-11/+19
Previously, the L1CTL_CRYPTO_REQ message contained only a ciphering algorithm and actual Kc key to be used. The key length was calculated manually using the MSGB API. Let's avoid manual calculations here, as it may cause unexpected behavior if the message structure is changed. Also, let's fill the UL header with minimal information about a channel, which is going to be encrypted. Change-Id: I1813a188e755141241273479b17896415abcc3f1
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-16common/l1ctl.c move TCH bit-ordering to the firmwareVadim Yanitskiy3-40/+54
Previously, TCH frames coming from L1 were reordered to the RTP format. Moreover, the implementation had a few problems: - L1CTL is not the best place for such manipulations; - payloads with other than FR codec were corrupted. Let's use RTP-ordered payloads on the L1CTL interface, performing TCH frame reordering at the firmware. Please note, that actual FR reordering was moved to the firmware as is, without any codec determination. This could be fixed in a separate change. Change-Id: I235a9f535c39d8e57f5d2c6566daeaf883aeef9e
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
2017-12-09fake_trx: don't sent clock indications until POWERONVadim Yanitskiy2-1/+10
Change-Id: I86ccc9d26fc54e6511f74f858afdaebb2b284c19
2017-12-09fake_trx/clck_gen.py: reset the clck_src when calling stop()Vadim Yanitskiy1-0/+4
Change-Id: I1043f71a2cbe856a0cb605db8a7feab9defa6afd
2017-12-09fake_trx/clck_gen.py: send the first indication immediatelyVadim Yanitskiy1-6/+9
Change-Id: I0132dd939b02db357d248abf65c9116d6a1802d0
2017-12-05host/trxcon: forward Timing Advance value to transceiverVadim Yanitskiy3-1/+32
The time at which the phone is allowed to transmit a burst of traffic within a timeslot must be adjusted accordingly to prevent collisions with adjacent users. Timing Advance (TA) is the variable controlling this adjustment. The TA value is normally between 0 and 63, with each step representing an advance of one bit period (approximately 3.69 microseconds). As trxcon doesn't perform actual burst transmission, this value needs to be forwarded to the transceiver, which will take care about the timings. Change-Id: Ia8c0848827ab2b4cd7cf1efe128b28d5c06ec84e
2017-12-04host/trxcon/trx_if.c: get rid of useless commandsVadim Yanitskiy2-13/+0
The 'SETMAXDLY' command is used on the BTS side to limit maximal Time of Arrival for access bursts. As we don't receive RACH bursts on the MS side, the command is useless. The 'SETRXGAIN' command is used on the BTS side to set initial receive gain value for TRX. On the MS side it's possible to set that parameter via command-line options of TRX. Change-Id: I3e61b4b48193004cdcb241cefabb44c12db93120
2017-12-04host/trxcon/trx_ic.c: use osmo_ubit2sbit() from libosmocoreVadim Yanitskiy1-7/+2
No need to reimplement the existing functions... Change-Id: Ic9b232c8561609d42dac10e6249a3e1c58c4edc1
2017-11-23host/trxcon/scheduler: process frames in advanceVadim Yanitskiy4-5/+23
In order to get the transceiver more time to process bursts, the L1 scheduler should process the frames and send the bursts in advance (a few frames before), like OsmoBTS does. By default, the advance value is 20 frames, but this can be adjusted using a new command line option of trxcon '-f'. Change-Id: Ic258a169f3554f931d6277e18ca060d029b77f32
2017-11-21fake_trx: correct brief descriptions of filesVadim Yanitskiy4-7/+7
Change-Id: Ie76fee4a567681a5380be90e5744621c2aa3e5f0
2017-11-21fake_trx: implement a new tool for burst sendingVadim Yanitskiy2-1/+194
This change introduces a new tool for sending existing bursts from file or standard input either to L1 (OsmoBTS or OsmocomBB) or to TRX (OsmoTRX and GR-GSM TRX). Change-Id: I2c542583252d31daac466e6c7837317fda8a7020
2017-11-21fake_trx/burst_gen.py: remove unused importVadim Yanitskiy1-1/+0
Change-Id: I407877e2025663f706d1a2f93e6228770bfc253c
2017-11-21fake_trx/README: correct the branch nameVadim Yanitskiy1-1/+1
Change-Id: I9d65580570d9bced65a7bcc95ca073ecc3e130e5
2017-11-19fake_trx/ctrl_cmd.py: add help and basic command line optionsVadim Yanitskiy1-8/+53
Sometimes it's important to use different CTRL port, for example when OsmoTRX is running at the same time. This change adds the corresponding command line options and help message. Change-Id: Ic6eeb69d9a1fc151eab2e63f3708e3d70e2e558b
2017-11-19host/trxcon: fix: use valid names for FSM instancesVadim Yanitskiy2-5/+2
Since 8c4f5457 in libosmocore there are some limitations on FSM and FSM instance names. This change adjusts the names of both l1ctl_fsm and trx_fsm instances. Change-Id: Icaaac3f51bdcfe4f7723060179b8730c3a06529b
2017-11-19host/trxcon/scheduler: separate logging of data messagesVadim Yanitskiy6-15/+22
Change-Id: I3a33687a688db2a183b546425f71c7a0a7030594
2017-11-19host/trxcon/trx_if.c: separate logging of data messagesVadim Yanitskiy3-9/+16
Change-Id: I74ebe0441aeb41c324eafb6b586b2edd9ef4fd1a
2017-11-19host/trxcon: use LOGP instead of fprintfVadim Yanitskiy2-4/+4
There is no (performance) reason to use fprintf instead of LOGP. Second one provides more useful information, such as a file name and a line number. Change-Id: I86dda5b3d746c7802442e4226578a06c04941721
2017-11-19host/trxcon/trx_if.c: fix wrong logging categoryVadim Yanitskiy1-1/+1
Change-Id: I0df0205e160fd9ea5811852077db7c49cddc7e8a
2017-11-19host/trxcon/scheduler: fix prim queue flushing functionVadim Yanitskiy1-6/+8
For some reasons, the function, which is used to flush a queue of transmit primitives, was intended to flush a list of msgb instances instead of trx_ts_prim, so memory was being cleaned incorrectly. Moreover, the items weren't actually removed from queue. Change-Id: Ia84b57350a5c2eee0afebc65f62e30eaddb141d4
2017-11-19host/trxcon/scheduler: share common declarations of lchan handlersVadim Yanitskiy3-11/+11
The training sequences, data / traffic indication and confirmation helpers are used by several lchan handlers, like xCCC and TCH. It would be better to have them all declared within a shared header. Change-Id: I71980f09a0c0e023370e1a651afc24fff2491552
2017-11-19host/trxcon/l1ctl.c: handle L1CTL_TCH_MODE_REQVadim Yanitskiy1-0/+36
Change-Id: Ib2332e1610fa873755cdfa745153c7b7d4a72a62
2017-11-19host/trxcon/l1ctl.c: include DL frame info in L1CTL_DATA_CONFVadim Yanitskiy4-5/+51
The l1ctl_info_dl header is expected to be a part of a L1CTL_DATA_CONF message, but was missing previously. Change-Id: Ia8dfaed924fd84395ba9ae539164eaa94f52d30b
2017-11-19host/trxcon/l1ctl.c: use primitive management API for RACHVadim Yanitskiy1-20/+23
Change-Id: I956ddfc4d1b47575715375c08f46c55953ec5fb6
2017-11-19host/trxcon/l1ctl.c: share primitive management codeVadim Yanitskiy3-44/+90
This change introduces shared primitive management functions, exposed from the l1ctl_rx_data_req() implementation: - sched_trx_init_prim() - allocates memory for a new primitive and its payload. Initializes primitive's header, setting the logical channel type and the payload length. After initialization, the talloc context of a primitive is a trx instance, which passed as the first argument. - sched_trx_push_prim() - decodes the timeslot index from chan_nr and pushes a primitive to its transimt queue. The talloc context of primitive is changed to the parent trx_ts instance after queuing. Both functions will be used for handling both L1CTL_TRAFFIC_REQ and L1CTL_RACH_REQ. Change-Id: I8169a1ef4ef54d91b50f3e213e4842f54af8b499
2017-11-19host/trxcon/l1ctl.c: don't fill l1ctl_info_ul into a primitiveVadim Yanitskiy2-7/+3
The UL frame header isn't used by lchan handlers. Change-Id: Ia1c63b6f17c3802b29f54299da1151a39edf3a03
2017-11-19host/trxcon/l1ctl.c: retune TRX only if current ARFCN differsVadim Yanitskiy1-5/+9
Change-Id: I797dc284bd92d07ad4859f851a44d048407db86d
2017-11-19host/trxcon/scheduler: send stored tx_power to transceiverVadim Yanitskiy2-2/+2
Previously a fixed fake value (10) was used. Change-Id: I8ba70bbda6c8c9249f8eb4294aeb41ab8769a19a
2017-11-19host/trxcon/l1ctl.c: fix wrong log levelVadim Yanitskiy1-1/+1
Change-Id: I0ac65d94b0ae3dd370675318a26a65d11c49cbbe
2017-11-19host/trxcon: separate logging of L1 Control and L1 DataVadim Yanitskiy4-16/+23
L1 Data is quite verbose, while Control is typically limited. And if you would need to debug some Control message handling, the Data messages wont overflow your terminal anymore. This change introduces a new logging category named 'DL1D'. Change-Id: Id830c8bf913f7a8ddc87c47f70a337ee4623abd8
2017-11-19host/trxcon/l1ctl.c: do nothing if CCCH mode matchesVadim Yanitskiy1-2/+14
When the L1CTL_CCCH_MODE_REQ is received, we don't need to reconfigure anything if the current mode matches requested. Change-Id: Ib8a511e4edd7210b1806f47e83f316be00a8cbb1
2017-11-19fake_trx: whitespace fixVadim Yanitskiy2-6/+6
Change-Id: Iad2be36777e4a2454e181c856c7902574a4ab20c
2017-11-19fake_trx: separate DataInterface from burst_gen.pyVadim Yanitskiy2-81/+108
Change-Id: I325cf2ae59ef8834c2ddfb67206eede44d1e0acf
2017-11-19fake_trx: add options to specify fn, tn and pwrVadim Yanitskiy1-5/+31
Change-Id: Ifd4f4864707596a69fece11218a4800b98551c31
2017-11-19host/trxcon/scheduler: clean up some includesVadim Yanitskiy3-10/+0
Change-Id: I47e3b953b80f4f822d563579d15498181009ca80
2017-11-19host/trxcon/scheduler: share common code for lchan handlersVadim Yanitskiy3-59/+122
The training sequences array is currently used by xCCH handlers, but will be also used for handling both TCH/F and TCH/H bursts. Moreover the code that forwards decoded L2 payloads to L1CTL protocol handlers was separated into a new shared function. Change-Id: I34c3de351362ebd9a070f49bb78d7bd976784b04