aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/Transceiver.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-09-09Transceiver: Don't stop TRX if pulling from OFF timeslotPau Espin Pedrol1-8/+16
BTS may have any timeslot disabled, or may have not yet sent initial SETSLOT cmd to properly configure the timeslot. Change-Id: Icf62e5d1200c7a440f255bb46023cdbf61532b7f
2019-09-09Transceiver: pullRadioVector(): Fix use of uninitialized value bi->tnPau Espin Pedrol1-13/+13
Change-Id: Ia0f2b5a51040663d7e8219e6ed51e0513b876548
2019-09-06Transceiver: Log error condition no burst in pullRadioVector()Pau Espin Pedrol1-1/+3
Change-Id: I4f180cc852582b131ba28a8139215335f7ba567d
2019-09-06Transceiver: Use LOGCHAN in logRxBurst to unify log formatPau Espin Pedrol1-2/+1
Change-Id: Iec33ab73a9bf90fd0bff9ba453c32ea11bf0670e
2019-09-06Transceiver: Fix logging TN and versionPau Espin Pedrol1-4/+4
Since tn is declared as uint8_t, it's actually a char, and by default c++'s ostream& operator<<(ostream&, unsigned char) tries to print chars with its ASCII visible character instead of numeric value. Change-Id: I534158e8e1719ad19a9cde7c747a8f8ad5a01a2b
2019-08-26Transceiver: Enable EDGE detection only on PDCH timeslotsPau Espin Pedrol1-6/+2
Related: OS#3664 Change-Id: Id16248a1c03f9bc9f323c707857cdf3bf34c4e3e
2019-08-26Transceiver: exit process when BTS drops connectionPau Espin Pedrol1-26/+49
We don't want to keep osmo-trx running in a started state once the BTS controlling it becomes unavailable. If a socket towards the BTS fails, it means the BTS is gone and the best thing to do is to stop the process (alternatively we could go back to stopped state instead, and wait for BTS to re-connect, fur so far this action is good enough). Related: OS#4170 Change-Id: I2ccbe3c17b39fb792ea7810f840235c348054d66
2019-08-26Transceiver: Fix idle ul burst indications being droppedPau Espin Pedrol1-1/+2
pullRadioVector() should return true on idle frames because those indications may be handled by upper layers (TRXDv1). Clarify return code in function documentation. Change-Id: If592ed1c04cf7e995f656b313f60edd4d40d1bfd
2019-08-26Transceiver: Clean up receival of downlink burstsPau Espin Pedrol1-25/+24
Use a packed structure to clearly indicate what is contained in the received buffer. Change-Id: I4d8c0e3c0c717699889f79e50c778d14b6058f2d
2019-08-26Transceiver: Check return value when binding IP addr for clock socketPau Espin Pedrol1-0/+2
No need to continue further since anyway we'll end up exiting. Change-Id: Id8b38b40df5744beb705d560defb06532cf0fd44
2019-08-26Transceiver: fix segfault during init if IP addr binding failsPau Espin Pedrol1-3/+5
If osmo-trx is started and IP addr binding fails (ie because the IP address is not assigned in the system), it will try to access a heap-allocated Thread instance which was not initialized (because init() function returned earlier). Fixes: OS#4147 Change-Id: I19f9745cd026c0ff6581895a66bf91b40113b07d
2019-08-21Drop old setPriority related codePau Espin Pedrol1-8/+0
This code is not needed anymore since we are setting SCHED_RR scheduler with a real time priority in main thread during startup, so all threads will inherit same rt priority, which should be enough to keep the process working reliably even on high system loads (from non rt processes). osmo-trx was tested to be reliable during test with stress-ng as explained in related ticket below. Related: OS#2344 Change-Id: I3a88946dd71e9aeeaac9d19d396e2236c302b608
2019-08-07Transceiver: Add missing include netinet/in.hPau Espin Pedrol1-0/+1
Previous commit started using IPPROTO_UDP without including required include. Newer versions of libosmocore's osmocom/core/socket.h include that header so the define is present, but older versions of libosmocore (such as 0.12.0) don't, so let's include it explicitly (the correct thing to do). Fixes: b9d2515704ac83cacd88d0a73ecba30323df0b2d Change-Id: I67ddf550f3a7fc6a650e1e1d9bde0bbb28785104
2019-07-23Transceiver: Clean up code passing parameters to threadsPau Espin Pedrol1-18/+24
TransceiverChannel naming was misleading there. It's simply a data type used to pass 2 parameters through the void* of the thread entry function, so let's clearly specify is a storage for thread params. Furthermore, we don't need a full C++ class for that, let's simply use a struct. Change-Id: I6e3898a8a66520cc5b2a7df9b9ae01b0b272387f
2019-07-23Transceiver: Store TRXD version per channelPau Espin Pedrol1-7/+8
The setting is negotiatied by osmo-bts-trx on each channel, so let's keep and use state per channel instead of overwriting the state from different channels. Take the chance to change related log lines to also print the channel number. Change-Id: If9cf95e89d38d0155ab48b8c0977ca5f381c2aad
2019-07-22Add SPDX annotationPau Espin Pedrol1-0/+2
Related: OS#3515 Change-Id: I3719bd8dc015569ecd81928fc079e27593cdca09
2019-07-19Transceiver: Initialize mExtRACH in constructorPau Espin Pedrol1-1/+2
Doing so should make Coverity happy: >>> CID 200212: Uninitialized members (UNINIT_CTOR) >>> Non-static class member "mExtRACH" is not initialized in this constructor nor in any functions that it calls. The current status is actually harmless since the field will be set during init() time, and the variable is never used before init() is called. Fixes: Coverity CID#200212 Change-Id: I17286570a9a6db695a75147e5cbb18c9da7d0fe6
2019-07-19driveTxPriorityQueue(): enrich logging messageVadim Yanitskiy1-1/+3
Change-Id: If25c2171f7d1ab98d65f0dbf93d0d8a5a635caf7
2019-07-19driveTxPriorityQueue(): check if message header format is supportedVadim Yanitskiy1-0/+12
Change-Id: I17abf95f5e23236abccc50476cd59931580f5cd3
2019-07-19driveTxPriorityQueue(): use trxd_hdr_common for message parsingVadim Yanitskiy1-6/+10
Change-Id: If6a93e2b7fc9ada55edbdd16352cd4f7040e3d2a
2019-07-19driveTxPriorityQueue(): cosmetic: use proper type for TDMA TNVadim Yanitskiy1-1/+1
Change-Id: I8396004616754f84fb465c972fde9e91b18cc49b
2019-07-19Transceiver: Support TRXD v1Pau Espin Pedrol1-2/+15
Related: OS#4006 Change-Id: I53db2678458a7377c87875b58b58b76a1b900517
2019-07-19Transceiver: Support SETFORMAT commandPau Espin Pedrol1-0/+14
Only old v0 is supported so far. Related: OS#4006 Change-Id: If9fc22f9987238a5ff870df7718de4efc9e04289
2019-07-19Transceiver: Move out TRXD socket send code to prepare for TRXDv1Pau Espin Pedrol1-29/+13
Only old v0 is supported so far. TRXD protocol related data/logic is moved to its own file out of Transceiver class. Code is refactored so it can be re-used later by TRXDv1. Related: OS#4006 Change-Id: I5786dd44b076202c6f1a6e82405670e8605797ed
2019-07-19sigProcLib: detectAnyBurst() family: Use struct to gather all out paramsPau Espin Pedrol1-5/+5
Currently we have 2 out parameters, but in forthcoming commits will add a third one. All those functions already have too many parameters, so let's put together all the output params in a struct to pass them easily and make it easier to understand they are the estimated output values. Related: OS#4006 Change-Id: I05cfa0ceaa2e633a5e6e404e2eae497ff4442dea
2019-07-03Transceiver: Support pulling idle frames in pullRadioVector()Pau Espin Pedrol1-11/+19
This logic will be used once we support TRXDv1, where idle indications are sent through the socket. Related: OS#4006 Change-Id: I46404f6e4055b6d3af3afffb0dfe4a19502917aa
2019-07-03Transceiver: pullRadioVector(): Move initialization of var to start of functionPau Espin Pedrol1-2/+3
This will be needed upon forthcoming refactor to support idle frames, which will add a goto return. Otherwise compiler complains: error: jump to label ret_idle [-fpermissive] note: crosses initialization of unsigned int max_toa Change-Id: Icd2793adc7b73a795184639b95fb5da336909b59
2019-07-03Transceiver: Simplify code on early error return when calling detectAnyBurstPau Espin Pedrol1-8/+4
We get rid of one branch and simplify code logic. Change-Id: I026e35262bfe42c3d23ebdc06d84e4908a8380e2
2019-07-03Transceiver: Avoid noise calculation formula in 2 branches in pullRadioVectorPau Espin Pedrol1-6/+5
Makes code easier to follow and will help in forthcoming refactoring once idle frames are supported. Change-Id: I56c84e9684ca460efd6c983d7e95d8e455bcac69
2019-07-02Transceiver: replace UDPSocket with libosmocore socket APIPau Espin Pedrol1-14/+50
We have a good socket API in libosmocore, let's drop osmo-trx socket API and use libosmocore's one instead of maintaining the two of them. Change-Id: Ib19856a3e0a7607f63436c4a80b1381a3f318764
2019-07-02Transceiver: Get rid of SoftVector in struct trx_ul_burst_indPau Espin Pedrol1-7/+15
Make the interface using trx_ul_burst_ind more implementation agnostic as well as easier to use. For instance, we don't care about SoftVector size one returned from pullRadioVector(); we want to use nbits instead. As a result, we no longer spend time normalizing guard periods. While at it, change vectorSLicer to return void since it always returns true. Change-Id: I726e5a98a43367a22c9a4ca5cbd9eb87e6765c7a
2019-07-02Transceiver: Drop use of GSM::Time from trx_ul_burst_indPau Espin Pedrol1-6/+9
Use of that class is really not needed since we don't need to do any calculation with those values, so we can simply store the final values in the struct. Related: OS#4006 Change-Id: Iadf2683d7f52138a2248598641f3b702252f325d
2019-07-02Transceiver: Move soft bits normalization to pullRadioVector()Pau Espin Pedrol1-3/+3
That's where all the filling logic happens, while in driveReceiveFIFO we mostly want to take the burst, generate a message and sent it over the socket. Related: OS#4006 Change-Id: Ibfb48877af4ff5ef0f56390901669c8353beaf48
2019-07-02Transceiver: Move calculation of normalized values (rssiOffset) to ↵Pau Espin Pedrol1-12/+10
pullRadioVector() That's where all the filling logic happens, while in driveReceiveFIFO we mostly want to take the burst, generate a message and sent it over the socket. In pullRadioVector this way we always provide normalized values based on user configuration (VTY rssi-offset). Related: OS#4006 Change-Id: I1ee28daf21dc287bec564d45d58086d63655c0f6
2019-07-02Transceiver: Move nbits burst size calculation to pullRadioVector()Pau Espin Pedrol1-11/+10
That's where all the filling logic happens, while in driveReceiveFIFO we mostly want to take the burst, generate a message and sent it over the socket. Related: OS#4006 Change-Id: Ib1df10c40d737954904290f57d58b1c77d65f82e
2019-07-02Transceiver: Drop unused rssi_valid struct fieldPau Espin Pedrol1-4/+0
That field is actually never used. Furthermore, if pullRadioVector() returns false, then the caller should consider the 'trx_ul_burst_ind' structure as uninitialized. Moreover, RSSI is mandatory - we cannot send burst indications without it. Related: OS#4006 Change-Id: Ia109298aebe8ba4750a39338ba7962555903cd82
2019-07-01Transceiver: refactor: gather uplink burst parameters in structPau Espin Pedrol1-48/+37
A new struct trx_ul_burst_ind is introduced, which will handle information filled by lower layers upon decoding of uplink bursts. Methods pullRadioVector() and logRxBurst() are adapted to use that struct. This way it's easier to understand in/out parameters and it's also easier to add further parameters to be filled in in the future. Related: OS#4006 Change-Id: I7e590fb1c0901de627e782f183251c20f4f68d48
2019-07-01Introduce structs to encode TRXD packetsPau Espin Pedrol1-10/+15
This will ease adding new protocol versions in the future. Related: OS#4006 Change-Id: I67ffede171eddde436f9057191ed76015a8ea6eb
2019-06-17Add option to set stack size in config file, default == 0 == OS defaultEric Wild1-7/+7
Change-Id: Id752f6b5ce9a96a67cd1ff835687ce0e03d3a50d
2019-06-05Rename and move STOP signal from Transceiver to mainPau Espin Pedrol1-13/+2
The callback actually belongs there, since it's the code/thread in main the one actually in charge of stopping everything. It simplifies current code, and more important, allows for new clients of this signal to use it. This callback will also be used in forthcoming commits by code controlling rate_ctr thresholds to stop the process if the VTY configured threshold is used. Change-Id: Id4159e64225c6606fef34a74b24f37c3a071aceb
2019-05-06Introduce LOGCHAN macro to standarize logging channel infoPau Espin Pedrol1-3/+3
Change-Id: I67d869499aa16af58c863ca7b74c356bcd979936
2019-01-24VTY: add extended (11-bit) RACH detection toggleVadim Yanitskiy1-8/+12
Since I838c21db29c54f1924dd478c2b34b46b70aab2cd we have both TS1 and TS2 synch. sequences, in addition to "default" TS0. Let's finally introduce the VTY configuration parameter, that can be used to toggle optional detection of both TS1 and TS2. Note: we keep this optional because of potentially bad impact on performance. There's no point in paying the performance penalty unless upper levels (BTS, PCU) actually make use of it. Change-Id: I1aee998d83b06692d76a83f79748f9129a2547e8 Related: OS#3054
2019-01-11cosmetic: Don't call the SDR "USRP" in error messageHarald Welte1-1/+1
Transceiver.cpp is used for all SDR hardware we support, not just USRP. Change-Id: I9b7ddb0d679f111407704048ef3ddd964db49441
2018-12-07transceiver: Log TRXCTRL iface responses towards osmo-bts-trxPau Espin Pedrol1-1/+2
Change-Id: I8128c42e63ab1fcd2a58812f3b7cf94435b5bbd8
2018-12-07Add TRXCTRL log categoryPau Espin Pedrol1-7/+7
This log category is applied to messages related to TRX CTRL socket interface, and it's printed in yellow, same color used in osmo-bts-trx for TRX category (so same messages are printed with same color in both sides). Change-Id: I98ec5e416272783ad3fbadf70478a4e48ae64983
2018-12-05transceiver: log chan on CTRL command receivedPau Espin Pedrol1-1/+1
Change-Id: Ia3b2a35e03a8aaddd6efebc8db2ccca872f51f20
2018-10-02Transciever: Log values causing Tx underrunPau Espin Pedrol1-1/+2
Change-Id: I68e18075eade55034567d96fc774d00a794afeeb
2018-09-28Use pthread_setname_np to name threadsPau Espin Pedrol1-0/+16
osmo-trx can start a considerable amount of threads that can make debugging it challenging at least. By using phtread_setname_np, the system sets a meaningful name to the thread which can be seen while debugging with gdb or by printing /proc/$pid/task/$tid/comm. Now we also log system TID when setting the name so we can identify different tasks in /proc even if pthread_setname_np fails. Change-Id: I84711739c3e224cb383fd12b6db933785b28209e
2018-09-04osmo-trx: Add osmo_signal to stop whole transceiver chain correctly on errorPau Espin Pedrol1-2/+21
Transceiver::stop() can only be called from either CTRL iface thread or from main thread (running osmocom loop). That's because stop attempts to cancel and then join all the other threads, which would then lock if attempting to stop from some of them. As a result, the best option is to indicate to the user of the transceiver option (osmo-trx.cpp) to stop it in a correct fashion by destroying the object from the main thread. Change-Id: Iac1d2dbe2328e735db2d4b933cb67b1af1babca1
2018-04-25Transceiver: log timing info of stale burstsPau Espin Pedrol1-1/+2
Change-Id: I043fd8199253bdf3912c7aec2ccf98f8cbe54251