aboutsummaryrefslogtreecommitdiffstats
path: root/CommonLibs
AgeCommit message (Collapse)AuthorFilesLines
2018-12-07Add TRXCTRL log categoryPau Espin Pedrol2-0/+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-05SigProcLib: Improve Vector buffer allocation messPau Espin Pedrol1-12/+31
Original issue: In order to use SSE instructions, 16-byte aligned memory chunks are needed, and C++ version < C++11 doesn't provide for a native new/delete store. For that reason, memalign() must be used in the implementation of convolve_h_alloc() for some buffers. On the other side, The C++ code relies on C++ "new T[]" operator to allocate a chunk of memory containing an array of class instances. As classes are complex types, they cannot be allocated through C structures (calling malloc). Experimentally can be seen too that it's unreliable and the process will crash during startup if malloc() is used and then a Complex<> deferred from it. Previous implementation allowed for use of convolve_h_alloc or new[] based on how the (signal)Vector is called, because then the buffer is not going to be managed internally. But that's unreliable since resize() calling resize() on it could use "delete" operator on a malloc'ed buffer, and end up having a new new[] allocated buffer. It was also found that some of the callers were actually leaking memory through ASan (because the buffer is not managed by the Vector instance). IMHO best option would be to rewrite all this code using C structures and malloc/free exclusively, since it would make all this cod eeasier to maintain. But for now, let's extend the Vector class to allow specifying an external alloc/free function and let the Vector instance take care of the ownership of the buffer in all scenarios. Change-Id: Ie484a4762a7f77fe1b105188ea03a6f025730b82
2018-12-03PointerFIFO: Fix memleak of ListNodePau Espin Pedrol2-0/+20
Found by ASan. when PointerFIFO::release() is called, alloicated node being released is actually stored into an internal list for later-reuse without having to access memory allocator. However, nodes from this list are never freed. Change-Id: I40e5e28603cde67005d9d92772967b05465ea2b8
2018-10-02CommonLibs/Makefile.am: Specify libcommon_la_LIBADDPau Espin Pedrol1-0/+1
This way the dependencies are passed after the .la object, which seems to be the correct order. Some setups may fail to find some symbols from libosmocore otherwise (OBS i586). Change-Id: I22c80055bcffd4179a0a8ca76533ba7aaa38c859
2018-09-28Use pthread_setname_np to name threadsPau Espin Pedrol2-2/+23
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-10Vector: Copy arrays in a sane way for non-trivially copyable typesPau Espin Pedrol1-3/+8
Avoids this type of compilation warnings: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of non-trivially copyable type ‘class Complex<float>’; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] Change-Id: I9724454dfb7b87f74f39074e4004580ac3b5fe5c
2018-09-10cosmetic: Fix trailing whitespace in several filesPau Espin Pedrol1-1/+1
Change-Id: Ibf5a69f0a3a309e87814635fd903b114fe68890c
2018-09-10SigProcLib: Use available copyTo Vector API instead of memcopyPau Espin Pedrol1-1/+1
This change allows to remove some wrong use of code as per compilation warning: osmo-trx/Transceiver52M/sigProcLib.cpp:1266:40: error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of non-trivially copyable type ‘class Complex<float>’; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] midMidamble->size() * sizeof(complex)); Change-Id: Id446711349bec70fa4e7c8efe0f7f9faf7e4f277
2018-09-04osmo-trx: Add osmo_signal to stop whole transceiver chain correctly on errorPau Espin Pedrol2-0/+36
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-09-03Logger: Disable pthread cancel point inside Logger destructorPau Espin Pedrol1-0/+3
pthread_cancel is implemented in c++ using exception handlers. In destructor of Log object, the log function is called which will eventually call fputs() to write to a file. Since that function is considered a cancelation point, if pthread_cancel has been called the exception handler will start unstacking frames and calling destructors in the process. At some point this will cause a runtime exception in c++ which will call std::terminate() to abort the process. The solution is thus to avoid starting the cancellation process inside the destructor. This behavior was spotted while calling the destructor of Transceiver object in forthcoming patches. See a more detailed example here: https://skaark.wordpress.com/2010/08/26/pthread_cancel-considered-harmful/ Change-Id: I71ca90f3fbc73df58b878a03361f7b7831d838b4
2018-08-27vty: Fix typo in gpsdo clock reference typePau Espin Pedrol1-1/+1
Change-Id: I3f553c2cec9689524728cacb15b7daaff8166925
2018-08-17logging: Introduce new "DDEV" category for device-specific codeHarald Welte2-1/+8
The DMAIN category got too overloaded. Let's have the code in Transceive52M/device/* use the new DDEV category. Also, in some cases the log levels have been adjusted to ensure that enabling INFO level should not result in a complete overflow of messages during normal operation. Change-Id: I844fe4a75bf277cd3cc5bd8fa06e06ad97b2ea95
2018-07-31Fix config file saving of {tx,rx}-path VTY config stringsHarald Welte1-2/+2
We were missing one indent level when writing the rx-path and tx-path Change-Id: I5d5b02c71d39220cabc2a23d059908ef3c6350e0 Closes: OS#3435
2018-06-13lms: Several improvements and compilation/runtime fixesPau Espin Pedrol3-0/+10
Continuation of initial work done on LimeSuite support from Harald. Change-Id: Ib2fca81b76d027b08e2891056fa076d071597783
2018-05-09trx_vty.c: fix: use CONFIG_NODE as parent by defaultVadim Yanitskiy1-1/+3
There are some configuration nodes, which are handled by extenral libraries, such as libosmoctrl. So, when switching back to the parent node, this should be kept in mind. Instead of aborting, let's got to the CONFIG_NODE by default. Fixes: OS#3250 Change-Id: Ia0600a46d19825806e5aed9257b6c57c3907808b
2018-04-27build: Fix make distcheckPau Espin Pedrol1-4/+0
Change-Id: I1fa5e34b44331cd56408ea7ad4483dcf6443b259
2018-04-25Logger: Print correct source file and line numberPau Espin Pedrol2-5/+8
Before this commit, always Logger.cpp:53 was being printed. Change-Id: Ie5c64b4961c7c41d23484784a93eda5e08331f08
2018-03-05vty: Implement VTY cfg parsing for current parametersPau Espin Pedrol2-1/+468
At this stage, osmo-trx still uses the cmdline parameters top run the device, but it is already able to parse all the same parameters from a cfg file through the VTY and filling a trx_ctx structure which will be later used to drive the device. Device config can be printed in the VTY with "show trx". Change-Id: Ie084c1b30b63f91c6e7640832ec1797d9e813832
2018-03-05Move enums required by VTY to a separate headerPau Espin Pedrol2-1/+22
This patch is a preparation for next patches, which add full VTY cfg support. Change-Id: I3d5b0576aa96869756f1629a40306c0043b6304b
2018-02-27Logger: Use libosmocore logging systemPau Espin Pedrol3-112/+29
We still need an intermediate class Logger due to osmo-trx being multi-threaded and requiring to have a lock to use libosmocore, which is not thread safe. Change-Id: I30baac89f53e927f8699d0586b43cccf88ecd493
2018-02-27Add initial support for logging, vty, ctrlPau Espin Pedrol5-2/+208
Up to this point, the logging system, vty and ctrl are initialized and can be used fine, though they don't have a lot of use yet. Depends on libosmocore Change-Id Ib79cdb62d45d8c78445c7b064e58eb7e9faeccf9 Related: OS#2184 Change-Id: I08982c37b4f873966304b3cfb38a10ee86eb3dad
2018-02-20Logger: Remove gLogToConsole flagPau Espin Pedrol2-15/+8
No code is using it and we always lock to console anyways. Change-Id: I5fde99c6af5a845e635b5d27abab855682071f14
2018-02-20Logger: Remove unused includesPau Espin Pedrol1-4/+0
Change-Id: I4d26c0b4f36ee3c66ed1a9e2e9fa2fa8272da16d
2018-02-20Logger: Drop support to log into filePau Espin Pedrol1-19/+1
This feature is currently not being used, so let's simplify current code to move to libosmocore logging system in the future. Change-Id: If2c77c776823f595130edac963be953026049423
2018-02-20Logger: Drop syslog supportPau Espin Pedrol2-39/+12
This feature is currently not being used, so let's drop it to make it easier to integrate into libosmocore logging system in the future. Change-Id: I8282745ef0282d41599eaf94fe460a1d29b18e2a
2018-02-20Logger: get rid of alarm APIsPau Espin Pedrol2-51/+0
It's only used internally inside the Logger module, and in case there's an "alarm" (level more than critical) we still print on cerr, so we can just rely on our system catching stderr instead of stdout to handle it. Change-Id: I6d6df1578c3a4c1a37bd0d69952d443f62eed2ab
2018-02-20Logger: Remove unused logging macrosPau Espin Pedrol1-17/+0
Change-Id: I1133e181183bec8dabe2fa77d0385f783458503f
2018-02-20Logger: Drop unused gLogEarlyPau Espin Pedrol2-35/+0
Change-Id: I2c8f24fbf453e0a94d7a95c3df7cc75f0e4bd456
2018-01-23Remove unneeded libdl dependencyPau Espin Pedrol1-1/+1
Closes: OS#1929 Change-Id: I0caea2a2a8e6bd07432fd73bae72b42b1ce022cd
2018-01-11Remove UDDSocket classPau Espin Pedrol2-67/+0
This class is not used anymore in osmo-trx, so we can safely remove it. Change-Id: I67f90aa3d6a2a5e92292436d10928e0705c8f8ff
2018-01-10Sockets.cpp: Fix initialization of UDD socketPau Espin Pedrol1-0/+1
Without this line, destination address for a UDD socket is left with incorrect value AF_UNSPEC. Later on when calling DatagramSocket:write(), sendto() fails with EINVAL. This commit fixes test SocketsTest.cpp. Change-Id: I6e1b7e743a781abdcf69aa9842b30be893633433
2018-01-10Set up GNU Autotest infrastructurePau Espin Pedrol8-529/+0
Test files are moved from CommonLibs/ to tests/CommonLibs/. Some tests are disabled in autotest because they generate timedate related output which cannot exactly match against expected output. Change-Id: I3d6ba625968be09297642d18090c496490e9b8fc
2018-01-09Remove Configuration module and libsqlite dependencyPau Espin Pedrol6-1928/+6
Change-Id: I823aea91367d586507bbf352f1b6f25bdd635baa
2018-01-09Drop use of ConfigurationTable gConfigPau Espin Pedrol2-9/+0
After latest changes, it is not being used anymore. Change-Id: I43a49aee94e3239194ad9742fb6374324acac0de
2018-01-09Logger: Stop using Log.File and Log.Level from configPau Espin Pedrol2-93/+17
This is a required step towards getting rid of ConfigurationTable class and libsqlite dependency. As a side effect, support for different log levels for different files is dropped, but it's not something really being used and we will end up dropping current logging system in favour of osmocom's one in the future anyway. Change-Id: I51cb12d1ab7e103e78190ac71a70fb5bb1d9ff51
2018-01-09Logger: Stop using Log.Alarms.Max from configPau Espin Pedrol2-13/+2
This is a first step towards removing ConfigurationTable class and sqlite3 dependency. Change-Id: Idcd789afe668a5c0271352f1d20d2efda826213a
2018-01-09cosmetic: Remove trailing whitespacePau Espin Pedrol2-6/+1
Change-Id: I64c8dbad3fc42bcb8dd4ac9b16bbd9c59a0cf5d5
2018-01-04Remove unused headersMax1-4/+0
Change-Id: Idadb17aeb85b011d114ffc1d81c920544bac1989
2017-11-07SocketsTest: Fix printing of non-nul-terminated stringHarald Welte1-1/+2
Change-Id: I33d0ddf851d84b81ab5252e3755422170cee54ee Fixes: Coverity CID#149363
2017-08-16Add -j option to bind to specific addressPau Espin Pedrol3-13/+13
Before this patch, the binding of the listening sockets was hardcoded to a local IP. Change-Id: I9ba184a1251c823e413a9230943ed263e52142ec
2017-06-19common: Declare explicit Vector move constructorTom Tsou1-2/+2
Vector class already has a semantically odd non-const copy constructor that serves the same function as a C++11 move constructor. Make the move constructor semantics explicit and address Coverity at the same time. Change-Id: I22e0099abe601b0c59beee808f7560837c6977dd Fixes: Coverity CID 170738
2017-06-08PRBS: a Pseudo-random binary sequence (PRBS) generator class.Alexander Chemeris3-0/+156
Implemeted with a Galois LFSR for speed and flexibility compared to Fibonacci version. Aliases for three popular PRBS' are added for convenience - PRBS9, PRBS15 and PRBS64. Note that we can't test PRBS64 completely, because the sequence is too long to be generated. Change-Id: Ib5331ba5d0b5819929541686fdd87905e2177b74
2017-05-30BitVector: Remove Generator class.Alexander Chemeris2-86/+0
It is not used in osmo-trx, because we're not doing FEC or CRC checks. Change-Id: I1509e785c1187ebdafe5b2518bd298fbbd1cd036
2017-05-30Configuration: Variables allocated with 'new' must be freed with 'delete'.Alexander Chemeris1-3/+3
Thank you Valgrind. Change-Id: I8477e4e37282947f9841cee9002565631ca0c0b6
2017-04-03Configuration: Fix const and signedness compile warningsTom Tsou2-2/+2
Change-Id: I701559814b2aee6f84f10e612f128da40f6a51c1
2017-03-24vector: Introduce shrink() function to shrink vector size without loosing data.Alexander Chemeris1-0/+7
Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099
2017-03-24vector: Introduce segmentMove() method to move data inside of a vector.Alexander Chemeris1-0/+15
Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433
2017-03-22BitVector: Convert SoftVector from 0..1 to -1..+1 soft bits.Alexander Chemeris2-13/+13
This makes code simpler and will allow us send -127..127 soft bits towards osmo-bts instead of 0..255 bits. Change-Id: I16ecc3d4c829dcf0f619ad995bc9d4a4ed8af0a4
2017-03-22BitVector: Remove convolutional codec - we don't use it in osmo-trx.Alexander Chemeris3-411/+1
Now we have more fexibility in how we represent SoftVector, since we no longer depend on the particular convolutional codec implementation. Change-Id: I3006b6a26c5eff59dbe9c034f689961802f1d0d0
2017-03-22CommonLibs: Print soft bits with less confidence to console when printing a ↵Alexander Chemeris1-0/+4
soft vector. We use other symbols to show that these bits has less confidence: o and . for 0 with less confidence | and ' for 1 with less confidence Change-Id: I747a17568ee48f1f3163e8dfab2e450af85e6435