Commit Graph

70 Commits

Author SHA1 Message Date
Pau Espin e91c4c72b1 Convert osmo_bts_sock.cpp to C
There's no real point in using C++ there, and using C++ makes the
compiler fail to use llist_head in multi-bts patches added later due to:
"""
'offsetof' within non-standard-layout type is conditionally-supported
"""

Change-Id: I8965b5cc5a713e64788b5b6aa183d3035341ddbb
2021-01-19 16:28:13 +01:00
Pau Espin 8a35e640a3 Convert gprs_bssgp_pcu.cpp to C
There's no real use of C++ in that file, and it causes problems when
using llist_head entry macros in future patches adding initial support
for multiple BTS in PCU object, so let's move it to plain C.

Change-Id: Ic771a89fd78b5e66151a5384f0ff6a8895589466
2021-01-19 16:28:13 +01:00
Pau Espin 4a5209d8bc Get rid of unused gsm_timer.{cpp,h}
Those files are not really being used other than for calling
get_current_fn() which is just a placeholder to call
bts_current_frame_number on the global bts object.

Change-Id: I6d50a8c15c1de5e2a308a24b313a7776f94ae54f
2021-01-19 16:28:13 +01:00
Pau Espin ac3fd12026 Split PCU global PCU object from BTS object
Currently the BTS object (and gprs_rlcmac_bts struct) are used to hold
both PCU global fields and BTS specific fields, all mangled together.
The BTS is even accessed in lots of places by means of a singleton.

This patch introduces a new struct gprs_pcu object aimed at holding all
global state, and several fields are already moved from BTS to it. The
new object can be accessed as global variable "the_pcu", reusing and
including an already exisitng "the_pcu" global variable only used for
bssgp related purposes so far.

This is only a first step towards having a complete split global pcu and
BTS, some fields are still kept in BTS and will be moved over follow-up
smaller patches in the future (since this patch is already quite big).
So far, the code still only supports one BTS, which can be accessed
using the_pcu->bts. In the future that field will be replaced with a
list, and the BTS singletons will be removed.

The cur_fn output changes in TbfTest are actually a side effect fix,
since the singleton main_bts() now points internally to the_pcu->bts,
hence the same we allocate and assign in the test. Beforehand, "the_bts"
was allocated in the stack while main_bts() still returned an unrelated
singleton BTS object instance.

Related: OS#4935
Change-Id: I88e3c6471b80245ce3798223f1a61190f14aa840
2021-01-18 10:37:05 +00:00
Pau Espin Pedrol da971ee502 Convert GprsMS and helpers classes to C
As we integrate osmo-pcu more and more with libosmocore features, it
becomes really hard to use them since libosmocore relies heavily on C
specific compilation features, which are not available in old C++
compilers (such as designated initializers for complex types in FSMs).

GprsMs is right now a quite simple object since initial design of
osmo-pcu made it optional and most of the logic was placed and stored
duplicated in TBF objects. However, that's changing as we introduce more
features, with the GprsMS class getting more weight. Hence, let's move
it now to be a C struct in order to be able to easily use libosmocore
features there, such as FSMs.

Some helper classes which GprsMs uses are also mostly move to C since
they are mostly structs with methods, so there's no point in having
duplicated APIs for C++ and C for such simple cases.

For some more complex classes, like (ul_,dl_)tbf, C API bindings are
added where needed so that GprsMs can use functionalitites from that
class. Most of those APIs can be kept afterwards and drop the C++ ones
since they provide no benefit in general.

Change-Id: I0b50e3367aaad9dcada76da97b438e452c8b230c
2021-01-05 10:34:25 +00:00
Pau Espin 2ae8337669 Get rid of class GprsCodingScheme
We have same kind of object splitted into two layers, in coding_scheme
and gprs_coding_scheme. Let's merge them together and get rid of the
class, which is not really useful because it's only a set of functions
operating on one enum value.

This change also fixes gcc 10.1.0 error about memseting a complex type
in rlc.h init().

Change-Id: Ie9ce2144ba9e8dbba9704d4e0000a2929e3e41df
2020-05-20 11:07:07 +00:00
Pau Espin b2653fe619 Move gsm_rlcmac.cpp -> .c
Original file from wireshark.git (packet-gsm_csn1.c) is being built and
maintained as a C file. There's no real need for us to maintain it as a
C++, and doing so will make both files derive over time (as already
happened). Let's keep it as a C compiler (which btw seems to be more
strict) to make it easier to port patches back and forth wireshark.git.

Take the chance to move some declarations we added to csn1.h to be able
to build it out of wireshark. Let's keep those in a separate header file
to ease looking for differences.

Change-Id: I818a8ae947f002d35142f9f5473454cfd80e1830
2020-03-30 10:08:02 +00:00
Vadim Yanitskiy 39a65056da csn1: get rid of C++ specific code, compile with GCC
The implementation of CSN.1 codec was taken from Wireshark, where
it's implemented in pure C. For some reason it was mixed with C++
specific features, mostly using references in parameter
declaration. Not sure what are the benefits.

Change-Id: I56d8b7fbd2f9f4e0bdd6b09d0366fe7eb7aa327a
2020-02-17 02:31:15 +07:00
Pau Espin 9d1cdb1f69 Move out tbf subclasses from tbf.h to their own headers
It's a good start towards clearing current mess between parent and the 2
children classes.

Change-Id: Ibc22ea2e02609af7ee058b8bc15df2115d4c6f60
2019-09-25 17:50:06 +02:00
Oliver Smith cfb6321b88 Forward ETWS Primary Notification to MS
Receive an Application Information Request from the BTS via PCU
interface. Construct a Packet Application Information message from it
(3GPP TS 44.060 11.2.47) and send it to all MS with active TBF.

The TTCN-3 test infrastructure to test this feature is not quite ready
yet, so I've added C unit tests instead.

Related: OS#4048
Change-Id: Ie35959f833f46bde5f2126314b6f96763f863b36
2019-09-14 15:28:43 +00:00
Jean-Francois Dionne c1e44908fe Initial commit for OC-2G support.
From-Commit: b77fd00608dd
From-Remote: https://gitlab.com/nrw_noa/osmo-pcu
Change-Id: I7cd89a549c9463e81893ca7dd925299f728e4453
2019-03-27 14:16:41 +01:00
Max 51754b6f35 MCS: move HeaderType enum outside of class definition
Move functions which compute number of blocks or bits depending on
header type and corresponding enum outside of GprsCodingScheme
class. This will allows us to use standard libosmocore value_sting
functions in upcoming patches for IA Rest Octet encoding/decoding.

Change-Id: Id0873f85e1f16a72e17e7fbc4ad76b194917067f
2019-03-19 18:27:06 +01:00
Max bea2edbc46 MCS: move Coding Scheme enum outside of class definition
Move generic MCS enum to C header file to simplify further modifications
to GprsCodingScheme class in follow-up patches. This also allows us
to use standard libosmocore value_sting functions in upcoming patches
for IA Rest Octet encoding/decoding.

Related: OS#3014
Change-Id: I993b49d9a82b8c7ad677d52d11003794aeabe117
2019-03-12 15:35:40 +01:00
Max 1f2e69fd35 Don't install pcuif_proto.h header
Both OsmoBTS and OsmoBSC use their own copies of this header nowadays so
we can simplify our installation slightly by making it local only.

Change-Id: I4a87395d4ab7212fe2fc055dae0a737e10d20c69
2019-02-14 16:35:36 +01:00
Max 6dc90b8c86 Move PDCH-related functions into separate files
The PDCH class and corresponding functions are rather self-contained and
independent from BTS implementation. Let's move them into separate file
to make bts.cpp more manageable. As additional benefit it allow us to
somewhat untangle all the different cross-dependent includes.

Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683
Related: OS#1539
2018-02-19 17:41:24 +01:00
Max 186206cff2 Allow specifying sysmocom headers explicitly
The headers for LC1.5 are specified explicitly. Add corresponding option
to specify sysmoBTS headers location and use it in jenkins build. While
at it, unify header fixup code with the one used in OsmoBTS.

Change-Id: I5248e8b389fd240b4d5a0bcf6c954d6115262462
2018-01-17 11:17:43 +00:00
Max 842d781b5e Move multislot table to separate file
To facilitate testing and addition of support for new multislot classes,
hide multislot class struct internals:

* introduce mslot_class_get_*() functions
* use those functions instead of direct access to array of structs
* use ms_class as a parameter to find_multi_slot() instead of entire
  object

Change-Id: Id796bcff1322b1e273a0e3236c66c23b9da8fac6
2017-11-21 10:45:24 +00:00
Harald Welte c136be04f7 lc15: further fixes regarding --with-litecell15
The fix in 0fb294a8dd was only partially
valid, as it unconditionally used $includedir, without any prefix.  This
polluted the include path with host include files in cross-compiling
builds.

Let's take a different approach and simply define LITECELL15_CFLAGS
(similar to what pkgconfig does), which makes the "-I" go away if no
--with-litecell15 has been specified.

Change-Id: I63393decfe42a24dab56c7654f716c1580416ab2
2017-06-11 11:40:18 +02:00
Alexander Couzens ccde5c9557 remove pcu own bitvector implementation
The osmocore bitvec is exact the same, but use a pointer instead of
a reference.

Change-Id: Id8f797631d89aa12b6e48efb2dc153a3e2f059f7
2017-05-15 12:46:33 +00:00
Harald Welte 68fc12775f Install the pcuif_proto.h header file
So far, we used to keep a copy of the header file around in
both osmo-pcu and osmo-bts projects.  Before we start introducing
a third copy in openbsc, let's have the osmo-pcu install the header
file and make the other programs use that.

Change-Id: I60976c9be5488256d1ff55fdc5aa548e3705400d
2016-11-17 21:09:55 +01:00
Pravin Kumarvel 0a4a6c1200 EGPRS: Add EPDAN CRBB Tree based decoding
Implemented tree based algorithm to decode compressed bitmap in EPDAN
as described in section 9.1.10 of 3GPP 44.060.
This algorithm intends to improve the performance over existing method.
New Regression test is added under bitcomp directory.
Test case is added to validate decompressed result of the bitmap
Present in EPDAN.
Test is done for multiple bitmaps of varying length.
Invalid inputs are also part of the test vector.

Change-Id: Ieae1992ed4b02bb1e09eec2d3de1a030eabd16ce
2016-10-17 11:00:57 +05:30
Yves Godin 660709dc7c Add support for NuRAN Wireless Litecell 1.5 BTS
Layer 1 compatibility with previous generation or NuRan GSM product,
therefore the support for the Litecell 1.5 uses its own sources instead
of using tons of ifdef/endif.

Max's amendments:
* make headers path configurable
* use configured TRX instead of hardcoded value
* split subdir-objects into separate commit
* cosmetic changes

Change-Id: Ib1287375cb10a889625bbac8528fa60deed23a2b
Fixes: SYS#2443
Reviewed-on: https://gerrit.osmocom.org/61
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-05-20 16:26:20 +00:00
Yves Godin f0bb25450c Enable subdir-objects automake option
Change-Id: I01fd264fd1f990f39cdbf309149e0eb857d7732f
Related: SYS#2443
Reviewed-on: https://gerrit.osmocom.org/60
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
2016-05-17 16:41:19 +00:00
Max de810f2005 Restructure sources
Move hardware-spicefic files into subdirectory similar to the way it's
done in OsmoBTS to make adding new hardware support easier.

Change-Id: I05004ad9032759a5dbfa57290ed1df83e89d5cb8
Related: SYS#2443
Reviewed-on: https://gerrit.osmocom.org/58
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-17 16:19:32 +00:00
Max cad867ec8d Rename define for direct hw access 2016-04-22 14:41:36 +02:00
Jacob Erlbeck 409f980a18 edge: Add GprsCodingScheme class
Currently the coding scheme is checked and compared at different
places which makes in cumbersome to extend it for EGPRS.

This class encapsules the coding scheme and provides required meta
information like sizes as well as helper methods.

Sponsored-by: On-Waves ehf
2015-12-15 15:19:42 +01:00
Harald Welte 08e5d604d3 remove obsolete OpenBTS PCU interface support
This OpenBTS socket interface was originally added to enable GPRS
capabilitie with a forked version of OpenBTS, at a time when the public
OpenBTS release didn't yet have any GPRS support.

Meanwhile, the later OpenBTS releases included their own version of
GPRS, without any external PCU/SGSN/GGSN, so this interface is no longer
needed.

This also means that the OsmoBTS socket interface is now the default at
compilation time.  There is no other interface.
2015-11-13 16:07:25 +01:00
Harald Welte d32cbbb130 rename sysmo_sock.cpp to osmobts_sock.cpp
This also renames the --enable-sysmbts option to --enable-osmobts

This socket interface was nevery sysmoBTS specific, but it is a generic
socket interface to any OsmoBTS supported layer1/hardware.  So it was a
mis-nomer so far.
2015-11-12 01:01:35 +01:00
Jacob Erlbeck 4f666bc113 llc: Add CoDel AQM implementation
This commit adds an implementation of the CoDel algorithm based on
the reference pseudocode presented in
http://queue.acm.org/appendices/codel.html. Instead of abstracting
the queue itself, the implementation provides a time stamp based
automaton which is invoked after a package has been dequeued.

Note that the modifications of the algorithm shown in
https://tools.ietf.org/html/draft-ietf-aqm-codel-01 are not yet
applied.

Sponsored-by: On-Waves ehf
2015-07-21 19:22:32 +02:00
Jacob Erlbeck b4584ff6c4 build: Add -lrt to AM_LDFLAGS
This is needed to link programs using clock_gettime and related
functions when compiling with older glibc versions.

This should fix the Jenkins build. Nevertheless fixing this in
configure.ac were probably nicer.

Sponsored-by: On-Waves ehf
2015-06-22 10:36:50 +02:00
Jacob Erlbeck 62e96a3535 vty: Add a file for C++ functions
Currently the pcu_vty.c doesn't compile with C++. Thus C++ object
cannot be access directly there.

This commit adds a helper C++ file that exports all functions with C
calling conventions and naming to work around that limitation until
the transition of pcu_vty.c is completed.

Sponsored-by: On-Waves ehf
2015-06-08 09:39:43 +02:00
Jacob Erlbeck 1db67e0a35 tbf: Remove TimingAdvance storage
Currently the TA storage stores up to 30 TLLI->TA mappings, if more
entries are created the oldest one is dropped. In theory this can
lead to missing TA information if many MS are present.

This commit removes the TimingAdvance class completely, since the TA
value is now stored in the GprsMs objects.

Note that the GprsMs objects are currently not kept after the TBFs
have detached from them, so the TA values are now kept for a shorter
time than before.

Ticket: #1674
Sponsored-by: On-Waves ehf
2015-05-28 13:59:25 +02:00
Jacob Erlbeck 5367086175 ms: Add MS storage class
Currently the MS objects are contained in the TBF objects only. To
allow for an extended life time after the TBF objects have been freed
and to find them based on TLLI, a container for the MS objects is
needed.

This commit adds the container class and also adds the corresponding
m_list member to GprsMs. Further integration into the PCU code is not
yet done.

Ticket: #1674
Sponsored-by: On-Waves ehf
2015-05-20 11:36:12 +02:00
Jacob Erlbeck dfef28de88 llist: Add a C++ wrapper for linux_list
This commit adds the LListHead class which is a wrapper around the
linuxlist. It adds an additional member to refer to the container,
since the container_of macro doesn't work properly with C++ classes.
All functions and macros from linuxlist.h are support except for the
entry macros (e.g. llist_entry, llist_for_each_entry, ...). To access
the container (entry), an entry() method is provided instead:

  llist_for_each(pos, &elems) {
      pos->entry()->do_something();
  }

Sponsored-by: On-Waves ehf
2015-05-20 11:36:06 +02:00
Jacob Erlbeck e04e0b0a20 ms: Add GprsMs class to hold per-MS information
Currently only TBF objects are used to handle the data flow between
the MS and the SGSN. MS specific data (e.g. pending LLC frames, TLLI)
is copied between successive TBFs. If all TBFs (uplink and downlink)
are idle for some time, all information about the MS is discarded in
the PCU. This makes the implementation of some features more
difficult, e.g. proper TLLI and timing advance handling,
connection based CS selection, and proper management of multiple TBF.

This commit adds the GprsMs class that is intended to hold
information directly related to the MS and to keep references to the
active TBFs.

The class is not yet integrated with the other PCU code. A GprsMs
object container and MS specific fields (TA, CS) will be added in
later commits.

Note that calling detach_tbf() can possibly delete the MS object
depending on the callback implementation.

Ticket: #1674
Sponsored-by: On-Waves ehf
2015-05-20 11:30:41 +02:00
Jacob Erlbeck 0a0b5dcb32 pcu: Add pcu_utils.h to Makefile.am
Addresses:
src/gprs_rlcmac_sched.cpp:26:23: error: pcu_utils.h: No such file or directory

Sponsored-by: On-Waves ehf
2015-03-29 13:55:42 +02:00
Daniel Willmann ca102af92b tbf: Split out UL/DL TBF methods into separate files
tbf_ul.cpp for UL TBF methods
tbf_dl.cpp for DL TBF methods

This commit contains no code changes.

Ticket: SYS#389
Sponsored by: On-Waves ehf
2014-08-12 19:24:49 +02:00
Holger Hans Peter Freyther 58db60c68e rlc: Start to move things out of the tbf into the rlc
Add remarks of possible broken behavior inside the tbf
routines. Move the preparation (and init) into the new
rlc.cpp file.
2013-11-19 21:26:43 +01:00
Holger Hans Peter Freyther be57081721 llc: Move the llc structure to a new header file 2013-11-07 08:02:10 +01:00
Holger Hans Peter Freyther 096f6f9f39 llc: Move the llc code out of the tbf.cpp into a new dedicated one 2013-11-07 07:21:06 +01:00
Holger Hans Peter Freyther 61a0a04d26 tbf: Move gprs_rlcmac_send_data_block_acknowledged into tbf
We can now remove the gprs_rlcmac_data as the code has been
moved into the tbf, pdch and bts.
2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther d11290b90b pdch/tbf: Move gprs_rlcmac_rcv_data_block_acknowledged into the pdch
Move the method into the PDCH. Extract the finding of TLLI into a
new class called Decoding. Move the assemble and forward LLC frames
into the TBF as it is poking in the internals of the TBF.
2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther cedf890928 sba: Create a SBAController that will manage the sbas for a BTS
The PollController is a friend of the SBAController and is allowed
to access the internal list. The list is hidden from everyone else.

This is done because the calculation of timeout should belong into
the PollController and not into the SBAController.
2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 621dc2fd01 sba: Move the sba code to a dedicated file
Move the code around and then turn it into an object...
2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 111614a994 ta: Create TimingAdvance class and make it belong to the BTS
This allows us to easily flush the state in case a PCU/BTS
connection is lost.
2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther d6ef5345e5 ta: Move timing advance related code into the ta.cpp file 2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 63f29d6f73 encoding: Move the functions into the encoding class
Add some TODO to this class. E.g. they could all work on the
bitvec and the parameter handling could better.
2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 6ca0a9076e encoding: Move encoding routines into a separate file 2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther b78adcdd11 bts: Introduce a PollController that has the responsibility to poll
For each frame indication received by the BTS the poll controller
is asked to expire timedout entries.
2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther b6acfdaa24 bts: Introduce a singleton for the BTS and use it in the code
Compared to the previous code there will be a branch to get the
global pointer so the code will be slightly slower than the previous
version but it allows us to start creating objects but still use
the code from C. It is best approach I have found so far.

One downside of C++ is that by default talloc will not be used
(unless we override the new operator to use talloc. Right now
we need to memset the C data structure by hand. The benefit of
enforcing a better structure should is more important though.
2013-10-30 21:20:45 +01:00