Commit Graph

113 Commits

Author SHA1 Message Date
Harald Welte d55a209d1c create libosmoisdn sub-library
There are some parts of libosmogsm which are not really GSM specific,
but rather ISDN bits that were inherited by GSM.  This includes the
I.460 multiplex as well as the core LAPD protocol.

Let's move those bits to its own libosmoisdn library, before we add
more ISDN specific bits to the wrong place.

Backwards-compatibility is created by making libosmogsm depend on
libosmoisdn, and by providing wrapper include files for source
compatibility.

Change-Id: Ib1a6c762322fd5047be3188b1df22408ef06aa50
2023-01-21 22:41:57 +01:00
Pau Espin d4c3dc8d59 Move src/*.{c,h} to src/core/
This way we have all libosmocore.so in an own subdir instead of having
lots of files in the parent dir, which also contains subdirs to other
libraries.
This also matches the schema under include/osmocom/.

Change-Id: I6c76fafebdd5e961aed88bbecd2c16bc69d580e2
2023-01-18 17:14:06 +01:00
Pau Espin a1584d237b Bump version: 1.6.0.132-0239-dirty → 1.7.0
Change-Id: Idb0d20aa4336a69cb100e140fb1fa9e7ac25b984
2022-06-28 17:00:51 +02:00
Philipp Maier b1ef8f5f69 select: gather statistics for TCP connections
osmocom applications are deployed in a variety of different situations.
Dependung on the medium that interconnects the network components
unexpected behaviour may occur. To debug problems with the
interconnection between network components it might help to monitor the
health of the related TCP connections.

Change-Id: I1416f95aff2adcf13689646b7574845de169fa3d
Related: SYS#5701
2021-12-23 14:52:15 +00:00
Pau Espin c7deaf28aa Bump version: 1.5.1.282-ab5e-dirty → 1.6.0
Change-Id: Ia3ac0a36b9e898996f596c6d2787e03cd59bfc11
2021-11-16 13:08:23 +01:00
Neels Hofmeyr 25c9741445 add osmo_time_cc, moved from osmo-bsc
Related: SYS#4878
Related: Ica9f908a1a30f334a24c59471affa11225117e12 (osmo-bsc)
Change-Id: Iabb17a08e6e1a86f168cdb008fba05ecd4776bdd
2021-11-15 09:06:03 +00:00
Neels Hofmeyr e90c7176be refactor stat_item: get rid of FIFO and "skipped" error
Intead of attempting to store all distinct values of a reporting period,
just store min, max, last as well as a sum and N of each reporting
period.

This gets rid of error messages like

  DLSTATS ERROR stat_item.c:285 num_bts:oml_connected: 44 stats values skipped

while at the same time more accurately reporting the max value for each
reporting period. (So far stats_item only reports the max value; keep
that part unchanged, as shown in stats_test.c.)

With the other so far unused values (min, sum), we are ready to also
report the minimum value as well as an average value per reporting
period in the future, if/when our stats reporter allows for it.

Store the complete record of the previous reporting period. So far we
only compare the 'max' value, but like this we are ready to also see
changes in min, last and average value between reporting periods.

This patch breaks API by removing:
- struct members osmo_stats_item.stats_next_id, .last_offs and .values[]
- struct osmo_stats_item_value
- osmo_stat_item_get_next()
- osmo_stat_item_discard()
- osmo_stat_item_discard_all()
and by making struct osmo_stats_item opaque.
In libosmocore, we do have a policy of never breaking API. But since the
above should never be accessed by users of the osmo_stats_item API -- or
if they are, would no longer yield useful results, we decided to make an
exception in this case. The alternative would be to introduce a new
osmo_stats_item2 API and maintaining an unused legacy osmo_stats_item
forever, but we decided that the effort is not worth it. There are no
known users of the removed items.

Related: SYS#5542
Change-Id: I137992a5479fc39bbceb6c6c2af9c227bd33b39b
2021-09-30 18:33:43 +00:00
Harald Welte 292f9e7014 base64: Migrate over to osmocom
This containts the osmocom changes to the mbedtls base64 code
merged in the previous commit.

Change-Id: I82c1bf5f827c8def370dbcb80b146e9e4184c4a3
2021-09-21 19:57:56 +00:00
Pau Espin Pedrol f286fdc87e Bump version: 1.4.0.535-e387-dirty → 1.5.0
Change-Id: I3bc0826c0000be4d76235ed6b5be86d216ea2e4d
2021-02-23 14:03:31 +01:00
Pau Espin 88e4058fc4 Introduce osmo_gettid() API
This API wraps conventional gettid() linux-specific API, which even in
Linux itself is sometimes not properly supported/announced.

This API also allows future porting to other platforms if needed, and so
far falls back to getpid() if no gettid(9 can be found.

Code ported from osmo-trx.git, see commit 7a07de1efd4eb7cc11c33d3ad25cb2df70aa1ef1.

Related: OS#5027
Change-Id: Id7534beeb22fcd50813dab76dd68818e2ff87ec2
2021-02-17 18:24:17 +01:00
Harald Welte 433005c87c initial support for static userspace probes via systemtap
This adds a --enable-systemtap configure option, which will then
add static tracepoints to the generated libosmocore binary.

At this point, only two tracepoints are supported: log_start
and log_done.  They can be used to trace the amount of time
a libosmocore-using application spends in potentiall blocking calls to
log to stderr or to files.

Related: OS#4311
Change-Id: I7e1ab664241deb524c9582cbd1bec31af46c747e
2021-02-03 13:55:40 +00:00
Harald Welte e4cd267ab1 Add inter-thread queue
This adds an inter-thread queue "it_q" to libosmocore. With it_q,
one can perform thread-safe enqueing of messages to another thread,
who will receive the related messages triggered via an eventfd
handled in the usual libosmocore select loop abstraction.

Change-Id: Ie7d0c5fec715a2a577fae014b0b8a0e9c38418ef
2021-01-06 00:22:13 +01:00
Harald Welte 53a2fde368 Integrate libmnl (minimal netlink) library with libosmocore select loop
This adds an easy way to listen to netlink events form the Linux kernel
from within libosmocore applications.

The new dependency can be disabled via the "--disable-lbimnl" configure flag.

Change-Id: I4f787ee68f0d6d04f0a5655eb57d55b3b326a42f
2020-12-02 21:04:51 +00:00
Vadim Yanitskiy e7bf4354b9 logging: introduce 'systemd-journal' target
This change implements 'systemd-journal' logging target, that is
similar to the existing 'syslog' target.  The key difference is
that 'systemd-journal' allows us to offload rendering of the meta
information, such as location (file name, line number), subsystem,
and logging level, to systemd.  Moreover, we can attach arbitrary,
user-specific fields [1] to the logging messages, so they can be
used for advanced log filtering (e.g. by IMSI/TMSI/TLLI):

  $ journalctl OSMO_SUBSYS=DMSC -f

Since we don't want to make libsystemd a required dependency, this
feature is optional, and needs to be enabled at build-time:

  $ ./configure --enable-systemd-logging

The new logging target can be configured in the same way as any
other one - via the VTY interface, or using the configuration file:

  log systemd-journal [raw]
    logging level set-all notice
    logging filter all 1

Two logging handlers are available: generic and raw.  The first one
behaves similarly to both 'syslog' and 'stderr', i.e. all the meta
information is rendered by libosmocore itself, and then passed to
systemd together with the logging message.  The later is more like
the 'gsmtap' target, so all available meta information is handed
over to systemd in form of fields [1]:

  - CODE_FILE / CODE_LINE - location info,
  - PRIORITY - syslog-compatible logging level,
  - OSMO_SUBSYS - Osmocom-specific sub-system (e.g. DMSC),
  - OSMO_SUBSYS_HEX - same as OSMO_SUBSYS, but encoded in hex,
  - MESSAGE - the logging message itself,

and then can be rendered in any supported format (e.g. JSON).

More details about the API can be found in [2].

[1] https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html
[2] https://www.freedesktop.org/software/systemd/man/sd-journal.html

Change-Id: I609f5cf438e6ad9038d8fc95f00add6aac29fb23
2020-10-19 15:02:00 +00:00
Harald Welte 5c5713e869 Bump version: 1.3.0.173-51974 → 1.4.0
Change-Id: I4fc6dd4f727c8ff5a64865bbb87e1d9feb7c5174
2020-08-13 11:06:36 +02:00
Vadim Yanitskiy 9b766bfafe src/Makefile.am: add conv_acc_neon_impl.h to EXTRA_DIST
Change-Id: I641c25f8aec249df43c781debfc967f07e221b9d
2020-08-07 02:45:39 +07:00
Eric Wild 3afc1d1777 libomsocoding: NEON viterbi acceleration
configure flag required to enable this: --enable-neon

Although autodetection according to __ARM_NEON would work because this
is only defined if the fpu is neon neon-fp16 neon-vfpv3 neon-vfpv4
neon-fp-armv8 crypto-neon-fp-armv8 doing that would lead to a unknown
performance impact, so it needs to be enabled manually.

Speedup is about ~1.3-1.5 on a unspecified single core Cortex A9. This
requires handling a special case for RACH with len 14 which is far too
short for neon and would actually incur a performance penalty of 25%.

Related: OS#4585
Change-Id: I58ff2cb4ce3514f43390ff0a2121f81e6a4983b5
2020-08-06 16:47:40 +00:00
Neels Hofmeyr 7e689c6577 add crcXXgen.c.tpl to EXTRA_DIST
'make distcheck' distributes the generated .c files, but it is good GPL
practice to also distribute the template.

Change-Id: I988acd3bc629e98985a99780d3142112125d13f7
2020-01-07 17:25:51 +01:00
Pau Espin 2862f9082e Bump version: 1.2.0.108-c6a8-dirty → 1.3.0
Change-Id: I5698bfe45467a8b0e44549105aaf27b8da500de8
2020-01-02 18:42:30 +01:00
Harald Welte c6a8697800 Introduce helper functions for safe fork+exec of processes
In some situations, we want to execute an external shell command
in a non-blocking way.  Similar to 'system', but without waiting for
the child to complete.  We also want to close all file descriptors
ahead of the exec() and filter + modify the environment.

Change-Id: Ib24ac8a083db32e55402ce496a5eabd8749cc888
Related: OS#4332
2019-12-17 13:49:28 +01:00
Pau Espin 3f464fc007 socket: Introduce API osmo_sock_init2_multiaddr()
This API will be used by libosmo-netif's osmo_stream for SCTP sockets,
which in turn will be used by libosmo-sccp to support multi-homed
connections.

Related: OS#3608
Change-Id: Ic8681d9e093216c99c6bca4be81c31ef83688ed1
2019-10-18 09:21:48 +00:00
Pau Espin d12f698dbb logging: Introduce mutex API to manage log_target in multi-thread envs
log_enable_multithread() enables use of locks inside the
implementation. Lock use is disabled by default, this way only
multi-thread processes need to enable it and suffer related
complexity/performance penalties.

Locks are required around osmo_log_target_list and items inside it,
since targets can be used, modified and deleted by different threads
concurrently (for instance, user writing "logging disable" in VTY while
another thread is willing to write into that target).

Multithread apps and libraries aiming at being used in multithread apps
should update their code to use the locks introduced here when
containing code iterating over osmo_log_target_list explictly or
implicitly by obtaining a log_target (eg. osmo_log_vty2tgt()).

Related: OS#4088
Change-Id: Id7711893b34263baacac6caf4d489467053131bb
2019-10-09 14:19:52 +02:00
Harald Welte 2d90611cb0 context: Add support for [per-thread] global talloc contexts
Rather than having applications maintain their own talloc cotexts,
let's offer some root talloc contexts in libosmocore.  Let's also
make them per thread right from the beginning.  This will help
some multi-threaded applications to use talloc in a thread-safe
way.

Change-Id: Iae39cd57274bf6753ecaf186f229e582b42662e3
2019-08-27 13:43:31 +02:00
Pau Espin 922d276035 Bump version: 1.1.0.107-afce-dirty → 1.2.0
Change-Id: I05dd1f2725e05f856f1d27c9201a0005de101b8f
2019-08-06 18:02:02 +02:00
Pau Espin 1fcdd0d1b8 Bump version: 1.0.1.143-cc72c → 1.1.0
Change-Id: I351411ca5913c8b40f23287ec7c9ebfe11bd2bb0
2019-05-07 18:36:51 +02:00
Neels Hofmeyr 0e8df1c7e4 add osmo_use_count API
Provide a common implementation of use counting that supports naming each user
as well as counting more than just one use per user, depending on the rules the
caller implies.

In osmo-msc, we were originally using a simple int counter to see whether a
connection is still in use or should be discarded. For clarity, we later added
names to each user in the form of a bitmask of flags, to figure out exactly
which users are still active: for logging and to debug double get / double put
bugs. This however is still not adequate, since there may be more than one CM
Service Request pending. Also, it is a specialized implementation that is not
re-usable.

With this generalized implementation, we can:

- fix the problem of inadequate counting of multiple concurrent CM Service
  Requests (more than one use count per user category),
- directly use arbitrary names for uses like __func__ or "foo" (no need to
  define enums and value_string[]s),
- re-use the same code for e.g. vlr_subscr and get fairly detailed VLR
  susbscriber usage logging for free.

Change-Id: Ife31e6798b4e728a23913179e346552a7dd338c0
2019-04-08 13:47:17 +00:00
Neels Hofmeyr 0c7826e9bd add osmo_sockaddr_str API
For handling RTP IP addresses and ports, osmo-mgw, osmo-bsc and osmo-msc
so far have their own separate shims and code duplication around
inet_ntoa(), htons(), sockaddr conversions etc. Unify and standardize
with this common API.

In the MGW endpoint FSM that was introduced in osmo-bsc and which I
would like to re-use for osmo-msc (upcoming patch moving that to
osmo-mgw), it has turned out that using char* IP address and uint16_t
port number types are a convenient common denominator for logging,
MGCP message composition and GSM48. Ongoing osmo-msc work also uses this
for MNCC.

This is of course potentially useful for any other IP+port combinations
besides RTP stream handling.

Needless to say that most current implementations will probably stay
with their current own conversion code for a long time; for current
osmo-{bsc,msc,mgw} work (MGW endpoint FSM) though, I would like to move
to this API here.

Change-Id: Id617265337f09dfb6ddfe111ef5e578cd3dc9f63
2019-04-08 13:47:17 +00:00
Neels Hofmeyr 0fd615fd7b add osmo_tdef API, originally adopted from osmo-bsc T_def
Move T_def from osmo-bsc to libosmocore as osmo_tdef. Adjust naming to be more
consistent. Upgrade to first class API:
- add timer grouping
- add generic vty support
- add mising API doc
- add C test
- add VTY transcript tests, also as examples for using the API

From osmo_fsm_inst_state_chg() API doc, cross reference to osmo_tdef API.

The root reason for moving to libosmocore is that I want to use the
mgw_endpoint_fsm in osmo-msc for inter-MSC handover, and hence want to move the
FSM to libosmo-mgcp-client. This FSM uses the T_def from osmo-bsc. Though the
mgw_endpoint_fsm's use of T_def is minimal, I intend to use the osmo_tdef API
in osmo-msc (and probably elsewhere) as well. libosmocore is the most sensible
place for this.

osmo_tdef provides:

- a list of Tnnnn (GSM) timers with description, unit and default value.
- vty UI to allow users to configure non-default timeouts.
- API to tie T timers to osmo_fsm states and set them on state transitions.

- a few standard units (minute, second, millisecond) as well as a custom unit
  (which relies on the timer's human readable description to indicate the
  meaning of the value).
- conversion for standard units: for example, some GSM timers are defined in
  minutes, while our FSM definitions need timeouts in seconds. Conversion is
  for convenience only and can be easily avoided via the custom unit.

By keeping separate osmo_tdef arrays, several groups of timers can be kept
separately. The VTY tests in tests/tdef/ showcase different schemes:

- tests/vty/tdef_vty_test_config_root.c:
  Keep several timer definitions in separately named groups: showcase the
  osmo_tdef_vty_groups*() API. Each timer group exists exactly once.

- tests/vty/tdef_vty_test_config_subnode.c:
  Keep a single list of timers without separate grouping.
  Put this list on a specific subnode below the CONFIG_NODE.
  There could be several separate subnodes with timers like this, i.e.
  continuing from this example, sets timers could be separated by placing
  timers in specific config subnodes instead of using the global group name.

- tests/vty/tdef_vty_test_dynamic.c:
  Dynamically allocate timer definitions per each new created object.
  Thus there can be an arbitrary number of independent timer definitions, one
  per allocated object.

T_def was introduced during the recent osmo-bsc refactoring for inter-BSC
handover, and has proven useful:

- without osmo_tdef, each invocation of osmo_fsm_inst_state_chg() needs to be
  programmed with the right timeout value, for all code paths that invoke this
  state change. It is a likely source of errors to get one of them wrong.  By
  defining a T timer exactly for an FSM state, the caller can merely invoke the
  state change and trust on the original state definition to apply the correct
  timeout.

- it is helpful to have a standardized config file UI to provide user
  configurable timeouts, instead of inventing new VTY commands for each
  separate application of T timer numbers.

Change-Id: Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5
2019-02-04 18:52:16 +01:00
Harald Welte 3927cc4368 Bump version: 1.0.0 → 1.0.1
Change-Id: I51696a3ace219ab69c294b0e3637371c5460291f
2019-01-21 17:40:34 +00:00
Harald Welte a0c1cba28a Bump version: 0.12.0.128-8dfde → 1.0.0
Change-Id: I1bd973754b1ebc42283f6a07defa60f58523f5a3
2019-01-19 22:07:56 +01:00
Alexander Couzens a2f696fa5c configure.ac: check clock_gettime for glib < 2.17
glib < 2.17 doesn't support clock_gettime directly, it is available
via librt.

Change-Id: Ice853d85ffe859b1d4df48b91b050c24d85c861b
2018-12-03 13:52:29 +00:00
Pau Espin 924ef0bc72 Bump version: 0.11.0.91-9d4a3-dirty → 0.12.0
Change-Id: I7e66432f37e13fd4c31389e3d89593fa0981e58f
2018-07-27 17:31:47 +02:00
Harald Welte 9da77abb6b isdnhdlc: Port from kernel to userspace
* prefix all symbols/constants with osmo_
* use stdint.h types instead of kernel types
* use Doxygen API documentation
* use Osmocom CRC16-CCITT functions
* use Osmocom bit-reversal functions
* integrate with Automake

Change-Id: I109085ab3e412c20b19cd42fb7137aa0e4167542
2018-05-11 21:57:46 +02:00
Pau Espin cacaa4a161 configure: Check separately for lib implementing dlopen and dlsym
Sometimes the library probiding dlopen is not the same one providing
dlsym.
This is the case when compiling with AddressSanitizer enabled. In this
case, AC_SEARCH_LIBS([dlopen]...) reports no lib is required, but tests
using dlsym still require to link against -ldl.

Change-Id: Ic619b0885688066b60c97caf1e2c7e5402c1d9f7
2018-05-04 19:25:16 +02:00
Pau Espin 13154ffabd Bump version: 0.10.2.284-bc47-dirty → 0.11.0
Remark: For libosmogb and libosmogsm, LIBVERSION was
already bumped in c4fce1425e.

Change-Id: Ib4fa53a9bb9954ae48d0a610ba9a81dd8e8b4ef6
2018-05-03 15:47:11 +02:00
Pau Espin 87fade88bd timer: Introduce osmo_clock_gettime to override clock_gettime
Change-Id: I5bebc6e01fc9d238065bc2517058f0ba85620349
2018-03-01 12:33:02 +00:00
Harald Welte b93f60f7cd conv_acc: Our code requires SSSE3, not just SSE3
The accelerated convolutional decoder uses SSSE3 instructions such
as PSIGNW (via _mm_sign_epi16) which go beyond what SSE3 offers.  So
let's make sure we use the right compiler flag (-mssse3) and also the
right runtime check.

Without this patch, we would use illegal instructions e.g. on Opteron
Gen3 such as Opteron 2427, which are also used as build.opensuse.org
build hosts (build31 through build36) where we wouldn't pass "make
check" as a result.

Change-Id: I2754164384109f2821fd98ffb48f625893f2923d
Fixes: OS#2386
2017-11-17 11:44:22 +01:00
Max ba1059c173 Move additional libraries to appropriate place
According to
https://www.gnu.org/software/automake/manual/automake.html#Libtool-Flags
the libraries supposed to be added to *_LDADD or *_LIBADD
while *_LDFLAGS should contain additional libtool linking
flags. Previously we used both. Let's unify this and move all the
libraries into proper automake variable. While at it - also add
libosmocore.la for tests to LDADD since all the tests link against it
anyway.

Change-Id: Ia657a66db75df831421af5df1175a992da5ba80f
2017-10-30 13:50:31 +01:00
Harald Welte faee5dead6 Tag/Release version 0.10.0
It's been way too long since the last release.  Almost one year and
468 commits.

A brief summary of the changes below:

* Doxygen for libosmo{coding,gb}
* pseudotalloc for embedded builds, jenkins for arm-none-gnueabi
* --disable-doxygen, --disable-ctrl, --disable-simd
* update debian packaging
* gsm0503 coding routines
* osmo_hton[sl]
* statistics.h -> counter.h
* QCDIAG in gsmtap
* llist_{first,last}_entry()
* llist_count()
* LOGPSRC() macro
* msgb_pull_to_l2()
* msgb_printf()
* prbs
* osmo_sock_init2()
* osmo_sock_mcast_{name,loop_set,ttl_set,all_set,subscribe,ip}()
* OSMO_STRINGIFY()
* OSMO_VALUE_STRING()
* OSMO_BYTES_FOR_BITS()
* osmo_talloc_asprintf()
* osmo_sub_auth_type_name()
* osmo_sub_auth_data support for IND/SQN_MS
* osmo_fsm ctrl interface
* ctrl_handle_alloc2()
* ctrl_interface_setup_dynip2()
* OSMO_CTRL_PORT_HLR
* bssgp_tx_bvc_ptp_reset()
* gprs_ns_inst connect/remote_{ip,port}
* osmo_gprs_{ul,dl}_block_size_{bits,bytes}()
* osmo_gprs_{dl,ul}_cs_by_block_bytes()
* gprs_ns_pdu_strings[]
* more BSSGP cause values
* abis_nm_admin_name()
* AoIP support in gsm0808
* gsm_fn_as_gsmtime_str()
* osmo_dump_gsmtime()
* gsup charging support
* ipa_ccm_make_id_resp()
* ipa_ccm_make_id_resp_from_req()
* struct gsm48_gprs_susp_req
* gsm_04_14.h
* rsl measurement preprocessing related IEs
* abis_nm_event_cause_names[]
* abis_nm_sw_desc and friends
* more SYSINFO_TYPE_ values
* osmo_earfcn_bit_size_ext()
* t16lv_put()
* msgb_t16lv_put()
* tlvp_val16be()
* tlvp_val32be()
* osmo_tlvp_copy()
* osmo_tlvp_merge()
* many additional VTY nodes
* cmd_node.name member
* bitvec_set_u64()
* bitvec_rl_curbit
* ctrl_lookup_register()
* osmo_fsm_find_by_name()
* osmo_fsm_inst_find_by_name()
* osmo_fsm_inst_find_by_id()

Change-Id: Ieb5db2e910a90db780ea058b3280f2facbd68d76
2017-10-27 20:18:49 +02:00
Harald Welte 216338c369 Rename 'statistics.c' to 'counter.c'
With stat_item, stats.c and stats_statsd.c, it is becoming a bit
difficult to understand file naming.  Also, the 'statistics.c' file
actually only contained osmo_counter handling, so let's rename it to
counter.c altogether.

Change-Id: I2cfb2310543902b7da46cb15a76e2da317eaed7d
2017-10-15 19:51:35 +02:00
Harald Welte 1389e86d11 Add pseudo-random bit sequence generator to libosmcoore
These PRBS sequences are specified in ITU-T O.150.  They are typically
used as test data to be transmitted for BER (bit error rate) testing.

Change-Id: I227b6a6e86a251460ecb816afa9a7439d5fb94d1
2017-07-10 23:42:02 +02:00
Neels Hofmeyr 39273b31c4 src/Makefile.am: fix build: use AM_CFLAGS, not CFLAGS
This allows passing 'make CFLAGS+="..."'
without breaking the build.

Suggested-by: zecke

Change-Id: I0628a9c739cded771605f5c55df7f21cb07beb3b
2017-06-19 21:46:43 +07:00
Vadim Yanitskiy e4fe71c04f core/conv: use proper filenames
We already have generic convolutional transcoding implementation
written by Sylvain Munaut and named 'conv.c', so 'viterbi_*' names
looked a bit confusing.

Let's use a single naming scheme for Viterbi related code.

Change-Id: I61062a8d1fbf5f5fc85b4fac58dc4e9fa8b5ef90
2017-06-19 14:35:21 +00:00
Vadim Yanitskiy 0d49f47aeb core/conv: do not mix up AVX and SSE code
According to GCC's wiki:

If you specify command-line switches such as -msse, the compiler
could use the extended instruction sets even if the built-ins are
not used explicitly in the program. For this reason, applications
that perform run-time CPU detection must compile separate files
for each supported architecture, using the appropriate flags. In
particular, the file containing the CPU detection code should be
compiled without these options.

So, this change introduces a separate Viterbi implementation,
which is almost the same as previous one, but is being compiled
with -mavx2. This implementation will be only used by CPUs with
both SSE and AVX support:

SSE3 and AVX2: viterbi_sse_avx.c
SSE3 only: viterbi_sse.c
Generic: viterbi_generic.c

Change-Id: I042cc76258df7e4c6c90a73af3d0a6e75999b2b0
2017-05-29 14:07:25 +00:00
Vadim Yanitskiy b51d51b29c core/conv: rename viterbi_gen.c to viterbi_generic.c
Let's avoid confusion with generated files which have
ending with _gen.* as well.

Change-Id: I3ecd8f9e73c05236f2cdc186f58b3d0ba552283f
2017-05-29 20:15:34 +07:00
Tom Tsou 34e228a9bc core/conv: add x86 SSE support for Viterbi decoder
Fast convolutional decoding is provided through x86 intrinsic based
SSE operations. SSE3, found on virtually all modern x86 processors,
is the minimal requirement. SSE4.1 and AVX2 are used if available.

Also, the original code was extended with runtime SIMD detection,
so only supported extensions will be used by target CPU. It makes
the library more partable, what is very important for binary
packages distribution. Runtime SIMD detection is currently
implemented through the __builtin_cpu_supports call.

Change-Id: I1da6d71ed0564f1d684f3a836e998d09de5f0351
2017-05-24 22:04:53 +00:00
Harald Welte 898ffefde4 add libpseudotalloc as super-simplistic talloc replacement
In tightly embedded builds (--enable-embedded), we want the ability to
replace talloc with a very simple heap allocator to avoid the complexity
of talloc without modifying all our code that assumes talloc.

This will break the hierarchical notion of the allocator, but
libosmo{core,gsm,coding,codec} don't rely on that anyway.

Change-Id: Ie341034076f242a813f081919dd09d845775ad35
2017-05-17 15:15:52 +01:00
Harald Welte 7af6d22a4e sercomm: Include in libosmocore Makefile
Change-Id: If9d50d634381f43b2c67b97fea36a462a66e4559
2017-05-17 15:15:09 +01:00
Tom Tsou 35536807ab core/conv: implement optimized Viterbi decoder
Add a separate, faster convolution decoding implementation for rates
up to N=4 and constraint lengths of K=5 and K=7, which covers the
most GSM code uses. The decoding algorithm exploits the symmetric
structure of the Viterbi add-compare-select (ACS) operation - commonly
known as the ACS butterfly. This shift-register optimization can be
found in the well-known text by Dave Forney.

Forney, G.D., "The Viterbi Algorithm," Proc. of the IEEE, March 1973.

Implementation is non-architecture specific and improves performance on
x86 as well as ARM processors. Existing API is unchanged with optimized
code being called internally for supported codes.

The original code was relicensed under GPLv2-or-later with permission
of copyright holder - Tom Tsou.

Change-Id: I74d355274b4176a7d924f91ef3c96912ce338fb2
2017-04-11 00:36:08 +00:00
Max 4e72ee0d0f Catch-up with git version tags
* update debian/changelog
* update TODO-RELEASE
* add comments to Makefile.am and TODO-RELEASE to simplify the process
  in future
* add link to libtool docs to Makefile.am to simplify LIBVERSION
  maintenance

Related: OS#1861
Change-Id: I22c257e357f597519120232d742d6a61289db021
2016-12-21 10:31:17 +00:00