Commit Graph

156 Commits

Author SHA1 Message Date
Neels Hofmeyr 59fc0bda6e paging: pass struct osmo_mobile_identity, not encoded IE bytes
In get_paging_mi(), before this, an encoded buffer of Mobile Identity bytes is
returned. Code paths following this repeatedly decode the Mobile Identity
bytes, e.g. for logging. Also, in get_paging_mi(), since the TMSI is read in
from a different encoding than a typical Mobile Identity IE, the TMSI was
manually encoded into a typical Mobile Identity IE. This is essentially a code
dup of osmo_mobile_identity_encode(). Stop this madness.

Instead, in get_paging_mi(), return a decoded struct osmo_mobile_identity. Code
paths after this use the struct osmo_mobile_identity directly without repeated
decoding.

At the point of finally needing an encoded Mobile Identity IE (in
Encoding::write_paging_request()), do a proper osmo_mobile_identity_encode().

Since this may return errors, add an rc check for the caller of
write_paging_request(), gprs_rlcmac_paging_request().

A side effect is stricter validation of the Mobile Identity passing through the
Paging code path. Before, invalid MI might have passed through unnoticed.

Change-Id: Iad845acb0096b75dc453105c9c16b2252879b4ca
2020-08-24 01:12:16 +00:00
Pau Espin 72e395656d Set correct GSMTAP channel type for PDTCH messages returning error
For instance, that may happen because the len of the message is not
filling the expect size (because padding is missing for example). Still,
in this case we know the channel type, so we set it so that wireshark
tries to decode the message as a data one.

Change-Id: Ifea94095d669b528874e64ca823a776cd6e22b4b
2020-06-30 18:34:58 +02:00
Vadim Yanitskiy a0a0b7fb0e bts: refactor handling and parsing of RACH.ind
This patch is a set of tightly related changes:

  - group all RACH.ind parameters into struct 'rach_ind_params';
  - group Channel Request parameters into struct 'chan_req_params';
  - get rid of egprs_mslot_class_from_ra(), priority_from_ra(),
    and is_single_block(), introduce unified parse_rach_ind();
  - improve logging, get rid of redundant information.

This is needed for proper EGPRS Packet Channel Request handling.

Change-Id: I5fe7e0f51bf5c9eac073935cc4f4edd667c67c6e
Related: OS#1548
2020-06-03 12:49:40 +00:00
Vadim Yanitskiy 6fd4733041 l1if: fix: s/pcu_rx_rach_ind_pdtch/pcu_rx_rach_ind_ptcch/g
This is not a functional change, just fixing misleading function
name. Access Bursts on PTCCH/U have nothing to do with PDTCH.

Change-Id: I4ab710ba026315301cc6970263967616401a9fc8
2020-05-22 21:09:22 +07:00
Pau Espin 0b0391ff66 gsmtap: Set signal level and SNR fields
lqual (containing C/I value) is passed instead of SNR, but let's have
that better than nothing.

Change-Id: Ibe9502d42c8bd1b984069e7fd805dde87ecbab0c
2020-05-20 14:20:56 +02:00
Pau Espin 3301cc900e pcu_l1_if: Don't use GSMTAP_CHANNEL_PACCH when sending unknown gsmtap blocks
It's actually counter-productive when analyzing wireshark traces, since
one may not spot a decoding issue and assume PACCH is sent on the wrong
TS.

Change-Id: I7a96148f1ca1ebfa88a3ff714ea3bb8798866046
2020-04-29 20:56:31 +02:00
Vadim Yanitskiy b30f28f38d l1if: fix pcu_rx_rach_ind(): use proper format string specifiers
Change-Id: If95362ef4cc203a60856d6b47d95d441813a5c19
2020-04-02 05:42:57 +07:00
Pau Espin 754b093d16 pcu_l1_if.cpp: Add missing header ctype.h
The file uses the isdigit() function.

Change-Id: Id06ea25969ad9b964b3207479604132d25160f24
2020-03-26 14:49:04 +01:00
Vadim Yanitskiy bd0b0b3242 pcu_l1_if.cpp: fix NULL-pointer dereference in imsi2paging_group()
Passing NULL to strlen() would lead to a segmentation fault.

Change-Id: I838e3a21a3b25c2bc8260f67d156c6cc284f4456
Fixes: CID#207484
2020-01-16 00:25:54 +07:00
Pau Espin d7c3265223 Pass paging group instead of imsi where later is not needed
Change-Id: Id0663a81f439f2d0b893b0d34f85a6db1927ef8e
2020-01-06 10:26:46 +00:00
Pau Espin fbfab297ee Split identity_lv param into mi+mi_len
It's not really needed to have those together in some function calls,
and makes it more difficult to follow the code. Furthermore, new callers
not having content already aligned (len+value) will be using these
functions in forthcoming commits.

Change-Id: Ifb9d3997bfb74b35366c3d1bc51ce458f19abf16
2020-01-01 16:10:15 +00:00
Pau Espin 32499b614b pcu_l1_if: Check pag_req id_lv len fits buffer
Related: OS#4316
Change-Id: I803e1d2577a0d210e74feb5ca4c216375a5024ea
2019-12-09 13:55:14 +01:00
Vadim Yanitskiy ffebd24456 PTCCH: properly handle RACH.ind for PCU_IF_SAPI_PTCCH
Change-Id: I482d60a46b9d253dfe0b16140eac9fea6420b30c
Related: OS#1545
2019-11-23 17:42:45 +07:00
Vadim Yanitskiy 78f58618f3 PTCCH: properly handle RTS.req for PCU_IF_SAPI_PTCCH
Change-Id: Ib204acce1a7e33f6651b9da2a7b4a9b9ae461093
Related: OS#1545
2019-11-17 02:58:31 +07:00
Pau Espin d752d7cebe pcu_l1_if.cpp: Replace value 23 with libosmocore's GSM_MACBLOCK_LEN
Change-Id: Ieec3dd028fffa1a735afaaf3f93da0a1202d122a
2019-10-07 21:04:19 +02:00
Pau Espin 8dc09e73d0 pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items
Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
2019-10-07 21:04:19 +02:00
Pau Espin f681f07cd0 pcu_l1_if.cpp: Drop unneeded byte in Imm Ass PCH buffer
paging group is 3 bytes and imm assign with plen prepended is 23 bytes,
so there's 1 extra byte not needed and makes code confusing.

Change-Id: Id7835e5aa1506505ff54e019b38f30111f79b5dc
2019-10-07 21:04:19 +02:00
Pau Espin 2ccb6aef89 pcu_l1_if.cpp: Fix GSMTAP Imm Assign PCH wrong encoding
Wireshark expects to receive the plen in order to decode it.

Fixes: 58543709e4
Change-Id: I91d1354689300b949760cdbaee03294eab958e12
2019-10-07 18:26:10 +02:00
Pau Espin 58543709e4 Log AGCH and PCH blocks using GSMTAP
Change-Id: I4d62f98801af1b0a290d3dd35bd213ccf3151035
2019-10-01 10:38:55 +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
Pau Espin 28f160e76c Introduce osmo_tdef infra and timer VTY commands
This will allow for configuration of some of the timers by the user,
and allow him to inspect current values being used.
It will be also useful for TTCN3 tests which may want to test some of
the timers without having to wait for lots of time.

Timers are splitted into 2 groups: BTS controlled ones and PCU controlled
ones. The BTS controlled ones are read-only by the user (hence no
"timer" VTY command is provided to change them).

TbfTest.err output changes due to timers being set up correctly as a
consequence of changes. Other application such as pcu_emu.cpp and
pcu_main.cpp had to previosuly set the initial values by hand (and did
so), but apparently TbfTest.c was missing that part, which is now fixed
for free.

Depends: libosmocore.git Id56a1226d724a374f04231df85fe5b49ffd2c43c
Change-Id: I5cfb9ef01706124be262d4536617b9edb4601dd5
2019-09-12 14:17:07 +02:00
Thorsten Alteholz 8bb7904458 fix spelling errors detected by lintian
Change-Id: I381618eb55cc513cfa9c2e384c27cead0935c8bf
2019-07-17 10:56:19 +00:00
Vadim Yanitskiy f17dfc062a src/pcu_l1_if.cpp: fix: properly pass measurements from PCUIF
The recent versions of OsmoBTS do provide the following measurements:

  - RSSI (Received Signal Strength Indication),
  - ToA (Timing of Arrival),
  - BER (Bit Error Rate),

as well as C/I (Carrier-to-Interference ratio) since [1] (OS#4006).

[1] https://gerrit.osmocom.org/r/Ia58043bd2381a4d34d604522e02899ae64ee0d26

Change-Id: I0fd6c35e8cf0b1314f4e3c336b233b5f7e42dfc6
Related: OS#1855
2019-07-16 04:11:20 +00:00
Harald Welte 3447c4a8a4 Forward GPRS SUSPEND REQ from BTS to SGSN using BSSGP
As specified in 3GPP TS 03.60 Section 16.2.1 and 44.018 Section 3.4.15,
a Class B MS is sending a "RR GPRS SUSPEND REQ" via a DCCH to the BTS if
it wants to suspend GPRS services.  As of
Change-Id I3c1af662c8f0d3d22da200638480f6ef05c3ed1f, OsmoBTS forwards
this via the PCU socket, so we need to pick it up and send it via BSSGP
to the SGSN.

Change-Id: I7b4beb413a6f974373a404b5a11c44d86ba695d3
Closes: OS#2249
2019-03-27 07:39:02 +00:00
Harald Welte 1473b377c2 pcu_l1_if: Fix erroneous endian-swapping of the CellID
In Change-Id I787fed84a7b613158a5618dd5cffafe4e4927234 in February 2018
we accidentially introduced a change that would erroneously swap
the endianness of the CellID on the way between PCUIF socket and
BSGSP.  This meant that all OsmoPCU based BTSs would report the
wrong CellId to the SGSN.

Closes: OS#3854
Change-Id: I2f6cc930c5dbf8dac386b24b0756df2efe8199e4
2019-03-27 07:39:02 +00:00
Stefan Sperling 143b2da4f8 fix a one-byte stack buffer overrun in osmo-pcu
Address sanitizer uncovered a one-byte stack overrun due to an
off-by-one in the size of the 'data' buffer in pcu_l1if_tx_pch().
Fix the problem and add an assertion which triggers before the
overrun can occur.

Change-Id: I08a879d72fcb916f78f175612fd90467d7bdd57c
Related: OS#3289
2018-05-25 15:19:50 +02:00
Philipp Maier 7e8e3978fe pcu_l1_if: add frame number to log output
Currently, the log output lacks the frame number.

 - make get_current_fn() public
 - add frame number to the log statements in pcu_l1_if.cpp

Change-Id: Idce994dbf86a2bbf861907d75418a2a3867244db
Related: SYS#4139
Patch-by: Octasic inc.
2018-04-10 13:35:24 +02:00
Philipp Maier 8ccf704608 cosmetic: remove runaway semicolon
Change-Id: I33c335dc8d564a8357ffb5b1163c2c4b1a578b49
Related: SYS#4139
Patch-by: Octasic inc.
2018-04-10 13:35:18 +02:00
Neels Hofmeyr bdc55fad62 implement support for 3-digit MNC with leading zeros
Receive the mnc_3_digits flag from the PCU interface.

Bump the PCU interface to 9.
This is one part of the three identical pcuif_proto.h patches:
- I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 (osmo-bts)
- I787fed84a7b613158a5618dd5cffafe4e4927234 (osmo-pcu)
- I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 (osmo-bsc)

Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout
the code base to be able to handle an MNC < 100 that has three digits (leading
zeros).

Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore),
         Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore)

Change-Id: I787fed84a7b613158a5618dd5cffafe4e4927234
2018-03-11 00:47:14 +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 1187a7719c Update header includes
Many files include unnecessary headers and don't include headers which
are actually used. Because of that combined with the fact that OsmoPCU
is a mixture of C and C++, it makes it hard to modularize code. Fix
this (using iwyu [1] tool):

* add missing headers
* remove unused headers

[1] https://include-what-you-use.org/

Related: OS#1539
Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
2018-02-19 08:43:46 +00:00
Stefan Sperling 5b22fb7953 Make osmo-pcu wait for BTS to become available at start-up time.
After the PCU socket becomes available, the BTS might send an
INFO_IND message with the 'ACTIVE' flag cleared. If this happens,
do not exit immediately, but keep retrying until an INFO_IND
message with the 'ACTIVE' flag arrives.

Note that this change only affects behaviour at process start-up time.
If the BTS switches from active to inactive state then osmo-pcu will
still exit. If this behaviour should be changed as well it could be
done in a follow-up patch.

Tested against osom-bsc + osmo-bts-virtual.

Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309
Related: OS#2689
2018-02-14 19:55:05 +01:00
Max 84bf0faed9 Support receiving SI13 from BTS
* store SI13 in BTS struct
* check and handle BCCH SAPI

Change-Id: I610a93ce23725b182ec14e3507331295bd542f74
Related: OS#2400
2017-09-01 11:08:06 +02:00
Max b216c6b165 cosmetic: tighten direct-phy related code
* move the code to related SAPI case
* get rid of 'unused variable' warning if direct-phy is not used

Change-Id: If8cae6f3579cfdecc25bbe1d08fa88a4f664a03b
2017-09-01 11:08:06 +02:00
Harald Welte b1be6112bb GSMTAP: fix category checks in pcu_rx_data_ind and pcu_l1if_tx_ptcch
We needto shift the PCU_GSMTAP_C_* constants before comparing against
the mask of enabled GSMTAP categories.

Change-Id: Ieb9332c65ed7bd57baf1aeab5ab722f92fc23b24
2017-08-17 00:50:24 +02:00
Harald Welte bc219d5450 GSMTAP: Ad PTCCH as separate gsmtap category
This allows us to send GSMTAP for PTCCH only if requested by user/vty

Change-Id: Id720f4bebdce7f6152fbddddbe05036638c5866e
2017-07-29 13:43:30 +02:00
Harald Welte cd34dd3b2b GSMTAP: Fix logical channel of downlink PTCCH
Change-Id: I29ecc968d56d4d0165cffa206297c42d6fb02cf4
2017-07-29 13:43:30 +02:00
Harald Welte 717cdf5405 Introduce GSMTAP categories
When looking at GSMTAP output so far, one is easily overwhelmed by way
too much information being presented.  A lot of is consists of DUMMY
frames, which are probably of lowest interest, ever.

A concept similar to the "gsmtap-sapi" of OsmoBTS is introduced, by
which the user can configure which particular categories (uplink or
downlink control or data, gprs or egprs, ...) he actually wants to
see in his logs.

Change-Id: I297183690e98a7234dfc1608c18847d8981306e4
2017-07-21 22:15:28 +02:00
Max 3741f14689 Remove comment warning
It's unclear why the warning was placed next to commented log statement
to begin with, so let's just follow that warning's advice and drop it.

Change-Id: I3ef7a45d015a28fdadf75f97294bc5d4f825b8ae
2017-06-26 12:10:12 +02:00
Max 0a8fae8d14 Support sending OML Alerts via BTS
* extend BTS <-> PCU protocol with TXT messages
* use it to implement OML alerts support
* use it to implement version message
* add function to transmit both of them them
* send alerts for internal encoding problems as an example
* send version when BTS socket is connected

Note: requires corresponding change
If57459c0610f2c7b36d599b13087c8deef8bdd9e in libosmocore.

Related: OS#1614, 1615
Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7
2017-03-17 17:01:28 +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
Harald Welte 5d93f0f4ec Fix GSMTAP logging in case direct PHY access is enabled
In the existing code, GSMTAP messages were only generated in case no
direct PHY access was being used (i.e. in the case all user traffic goes
over the PCU socket).  I'm not quite sure what the reason is for that
would be and conclud this is not intentional.

Let's first send the message to GSMTAP and then decide whether to send
it via the direct PHY access or via the PCU socket into the BTS/BSC.

Change-Id: I5d2e018f7009cb947abc874881c0c440feca3ade
2016-11-17 21:09:55 +01:00
Harald Welte bb47d957a8 pcu_l1_if: get rid of magic numbers and use ARRAY_SIZE() for array iteration
Change-Id: I61d00950b4eb0b8bcbaf386d5081be84580dac75
2016-11-17 21:09:55 +01:00
bhargava 959d1dee67 Change interface in osmo-pcu for 11 bit RACH
Interface structure between osmo-bts and osmo-pcu is updated with
the parameters to differentiate the type of RACH and further
support 11 bit RACH. The function prototype and definitions are
changed accordingly. Interface version number is increased.

Change-Id: I265c2d92d36d6cbcbeee60cdd8407dafe1da06a4
2016-08-27 01:22:48 +00:00
Max cbf9a721d6 Extend BTS <-> PCU protocol with measurement
Note: this increases the version of BTS <-> PCU protocol and thus
requires corresponding change in BTS.

Change-Id: Ide0e29b668ee38516605c1763fda85e87e867813
Related: OS#1616
2016-08-04 15:06:12 +00:00
Max 878bd1f296 Remove useless ARFCN parameter
ARFCN is already part of TRX struct so there's no need to supply it
explicitly in a separate parameter. I've tested and those are the same
anyway.

Change-Id: I8e975c52cbc819427880093b1e5371fe1f8ce460
2016-07-26 00:20:23 +00:00
Max 58b6646750 Change internal API for consistency
Make TRX API (void *) consistent with the way it's used (integer). Use
uint8_t for TRX numbering everywhere (we don't expect hardware with
more than 256 transceivers in the near future). This change helps to
avoid unnecessary casts and make API much clearer.

Change-Id: Ic584611184b0c8b5417ecff0ddae3d526b55a079
Related: SYS#2443
Reviewed-on: https://gerrit.osmocom.org/59
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-19 06:40:26 +00:00
Max cad867ec8d Rename define for direct hw access 2016-04-22 14:41:36 +02:00
Max 528ff3910f Add gsmtap support to generic bts
Instrument TX and RX functions dealing with regular BTS (without direct
DSP access) to use GSMTAP. Previously only DSP-related functions were
instrumented.
2016-02-22 14:50:58 +01:00
Max 2efdf69734 Introduce --gsmtap-ip/-i option
This option allows user to use custom IP address instead of default "localhost".
Correspondingly gsmtap init moved from sysmoBTS-specific code up to "bts" struct
level. This way it can be easier reused by other implementations. The
lack of regressions was verified by checking following command on
sysmoBTS: "./osmo-pcu -c osmo-pcu.cfg -r 1 -i 192.168.10.1" where
192.168.10.1 is the host which was running wireshark and netcat:
"nc -u -l 192.168.10.1 -p 4729" to accept gsmtap flow.
2016-02-22 14:00:17 +01:00
Jacob Erlbeck af75ce8e15 l1: Use the FN of all data_ind/ra_ind DSP messages
Currently all of these messages are discarded if they are assumend to
be caused by noise. But even in these cases, the FN and TN values
which are added by the DSP are valid. So these can be used to update
the current_frame value.

The osmo-bts sets the fBFILevel of a physical channel to -200dB if it
is used for PDTCH or PACCH which is the case for all PDCH. This way
a data_ind or ra_ind message is already send at least once per block
period (4 frames) per PDCH. These messages are passed to either
handle_ph_data_ind or handle_ph_ra_ind even if they contain garbage
data.

The ra_ind messages are sometimes sent a few frames earlier than
data_ind messages using the same frame.

This commit adds calls to update the current_frame value based on all
of these messages before they are discarded. The FN taken from ra_ind
are passed with an increased max_delay (5) to compensate for early
ra_ind messages.

Sponsored-by: On-Waves ehf
2015-08-28 12:23:07 +02:00
Jacob Erlbeck 20f6fd1b63 l1: Pass all L1 measurements upwards
Currently only the RSSI value is passed to the upper layers. Other
values like TA and BER which are needed for TA update respectively CS
selection are not propagated.

This commit introduces and passes a struct that contains a set of
measurement values.

Sponsored-by: On-Waves ehf
2015-06-22 10:39:06 +02:00
Daniel Willmann 6d8884de49 Always exit and don't try to recover
The current code tries to recover from dropped connections and resets the
pcu state so it can keep running. However, this never worked correctly
which is why the -e option is used. This option exits the pcu as soon as
the internal state needs to be reset.

This patch removes this option and makes this behaviour default.

Ticket: SYS#390
Sponsored-by: On-Waves ehf
2014-06-15 19:28:51 +02:00
Holger Hans Peter Freyther 02beed5e98 bts: Move gprs_rlcmac_rcv_rach into the BTS class 2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther 40cfaa6837 bts: Move rcv_imm_ass_cnf into the bts code 2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther 9ae367f639 pdch: Instead of passing bts, trx, ts use the pdch
All dispatching will go through the PDCH. This will clean a lot
of the look-ups inside the gprs_rlcmac_data.c and continue with
adding structure to the pcu code.
2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 09ef27ae04 pdch: Simplify the reset code, rename variables to XYZ_no
Simplify the reset code now that the PDCH can know where it is
located. Rename the variables in the sba to trx_no and ts_no as
it stores the number and not the actual thing.
2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 34bd8bdf30 bts/tbf: Move the lists into the BTS and do the look-up from the BTS
The list belongs to the BTS. This makes cleaning this up more easy
and establishes a hierachy of resources that start from the BTS. The
debug_diagram code is now broken.
2013-10-30 21:24:10 +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 f0984897a5 bts/pdch: Move the adding of paging to the BTS/PDCH objects
Only the gprs_rlcmac_pdch will manipulate the paging list now. There
can be various more refactorings of the code but they can be done
later. E.g. on memory allocation failure we can continue instead
of leaving the code, we should also set any_tbf only after things
have been paged.
2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 17b0d83a1f pdch: Move enable/disable into the PDCH code
When a PDCH is disabled all resources should be freed. This is
currently not possible as the PDCH does not know where it belongs
to. On top of that the list (and other resources) should be
properly initialized on construction so that disable() is idempotent
and does not check if it was disabled. During the re-factoring I
noticed that during a sysmobts re-start some resources are not
freed. I left a warning in the code to resolve this issue later.
2013-10-30 21:24:09 +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 9b30c7f46e bts: Move the frame_number into the BTS sructure
The current_frame is an attribute of the BTS. Move it from the
pcu_l1_if.cpp into the BTS. As the next step we can trigger
actions depending on the change of the frame.
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
Holger Hans Peter Freyther 67ed34eedb bts: Move struct gprs_rlcmac_bts and other structs into a bts.h
Begin to make the BTS a real C++ object with real responsibilities.
The biggest issue will be the pcu_vty.c that might not like C++
at all.
2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther b19d7268c3 bts: Remove global state from gprs_rlcmac_rcv_rts_block 2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther 1af73f6c81 bts: Remove global state from gprs_rlcmac_add_paging 2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther b0250ebeac bts: Remove global state from gprs_rlcmac_rcv_rach 2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther 698b612188 bts: Remove global state from gprs_rlcmac_rcv_data_block_acknowledged 2013-10-30 21:20:44 +01:00
Holger Hans Peter Freyther 344ff48756 bts: Remove the global state gprs_rlcmac_trigger_downlink_assignment
Remove the global state from gprs_rlcmac_trigger_downlink_assignment
and walk up to the pcu_l1_if.cpp where I find the timeout handling
that should be part of the SBA and TBF functionality. In terms of
hierachies things start to be more clear.

There should be the BTS object. That holds the SBA and TBF Controllers
that can allocate TBFs and SBAs and will handle the timeout polling
for a BTS.
2013-10-30 21:20:44 +01:00
Holger Hans Peter Freyther 4f6a4e5d6d tbf: Add another variant of the free_all now by pdch 2013-10-28 12:52:33 +04:00
Holger Hans Peter Freyther 099535a1a7 tbf: Move the struct to the tbf.h header file
This is the begin of a long march of turning tbf into a C++ class
and properly hiding the secrets inside this implementation instead
of having it spread across various different files.
2013-10-28 12:51:38 +04:00
Holger Hans Peter Freyther 52c911b3b4 tbf: constify the IMSI argument for the downlink assignment 2013-10-02 18:09:10 +04:00
Holger Hans Peter Freyther e8d9a5fa54 bssgp: Return the gprs_bssgp_pcu instance from create/connect
This can be used to install handlers/testcases to register
callbacks and other data.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther b67a8a348a rlcmac: Reduce the depedency on the global gprs_rlcmac_bts variable
For mocking/unit-testing/emulation (and a dual trx-systems) having
global state is quite bad. Cut back on the usage of the global
struct gprs_rlcmac_bts. It also makes the complexity of certain
routines more clear.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther 421fe79e39 bssgp: The method creates and the connects.. reflect that in the name
Call things by what they do. This method is creating and then connecting
a BSSGP..
2013-08-02 13:39:30 +04:00
Holger Hans Peter Freyther f14ddb7830 pcu_l1_if.cpp: Remove unused method and comment
pcu_l1_if.cpp:195:13: warning: 'void pcu_l1if_tx_bcch(uint8_t*, int)' defined but not used [-Wunused-function]
2013-08-02 13:38:48 +04:00
Holger Hans Peter Freyther a30f47613a misc: Add an option exit/quit when the BSSGP is supposed to be destroyed
The PCU does not properly re-set the state when the connection to the
BTS is lost (and the SGSN potentially is re-started during that). This
results in the BSSGP BVCI > 1 remaining blocked and no data will be
accepted by the SGSN.

Add the '-e' option and exit the PCU when the BSSGP/NS are getting
destroyed.
2013-07-27 22:15:04 +02:00
Andreas Eversberg a004e6a823 Added timing advance support for up and downlink TBFs
The timing advance of any TBF is stored when it ends. Whenever a new TBF
with the same TLLI is created (downlink TBF), the stored TA is recalled.

This algorithm assumes that the mobile does not move too fast during
transfer. Also the mobile must start a connection in order to get correct
initial timing advance.

This algorithm does not implement the timing advance procedure as defined
in TS 04.60. To implement the standard timing advance procedure, the BTS
must decode RACH on certain bursts, the mobile is expected to send them.
This requires much more complexity to a transceiver like USRP/UmTRX or
Calypso BTS.

The algorithm was tested at TA >= 8 and works quite well.
2013-05-13 16:45:21 +02:00
Andreas Eversberg 81a12be317 Fix: Correctly display SGSN remote IP at debugging 2013-03-17 17:16:44 +01:00
Andreas Eversberg 570b44b29b Add RSSI of data blocks to PCU interface
This bumps the PCU API version to 5 and requires osmo-bts >= 0.2.0.
2013-03-17 17:16:18 +01:00
Harald Welte 30a73d8544 PCU: respect the PCU-side "local port" as configured via L1 IF
This makes sure that the UDP local port of the Gb link is actually
set to what is configured via OML from OpenBSC.
2013-03-10 08:57:03 +00:00
Andreas Eversberg 3afe56d7d8 Fixed closing of PDCH when enabling sysmo-bts' direct DSP access
If not compiled with this support, the closing function does not exists,
so it must not be called.

Removed a "#warning", because closing is already supported.
2013-01-25 07:22:59 +01:00
Andreas Eversberg a23c7eee15 Adding direct access to DSP of sysmoBTS for PDTCH traffice
In order to use this feature, sysmoBTS requires option "-M", otherwise
the traffic is forwarded through socket interface.

This is essential, if PCU runs on processor of sysmoBTS. The reaction
time and delay of PDTCH frames could heavily degrade proper packet flow.
2012-12-18 10:47:28 +01:00
Andreas Eversberg 8c3680dcc9 Added paging PS support by Ivan Kluchnikov
Original code: c7e7f6868b
(The code was committed earlier, but got lost somehow.)

I added IMSI, so the paging request is sent in correct paging group.
Also I excluded rest octets from pseudo length.

It is tested and it work.
2012-12-18 10:03:34 +01:00
Andreas Eversberg 499ff415a9 Allow setting of seperate coding schemes for uplink and downlink 2012-10-03 14:21:36 +02:00
Andreas Eversberg a9be1547b1 Use PCH confirm from BTS to start downlink packet flow
Since we don't know when the IMM.ASS message is sent on it's paging group
on PCH, we will wait for confirm from BTS and start packet flow then.
2012-09-27 09:23:24 +02:00
Andreas Eversberg 514491d726 Fix: Correctly interpret MCC, MNC, CELL ID from BTS 2012-09-23 06:42:07 +02:00
Andreas Eversberg 07e97cf8a5 Adding single block allocation
It is mandatory to support it because MS may request a single block.
In this case the network must assign a single block.

It is possible to force single block allocation for all uplink requests
on RACH. (VTY option)
2012-08-07 16:00:56 +02:00
Andreas Eversberg 8b761a3419 VTY: Added option to force given CS and ignore the scheme given by BTS 2012-07-20 21:50:31 +02:00
Andreas Eversberg 3b7461c1b3 Fixed Paging RR on PACCH
Addition to 2b91464862
2012-07-20 11:19:59 +02:00
Andreas Eversberg 2b91464862 Added paging for RR connection on PACCH of active TBFs
Untested
2012-07-19 13:06:26 +02:00
Andreas Eversberg 8389fd0513 Update to version 3 of PCU socket interface (includes version check) 2012-07-18 10:06:48 +02:00
Andreas Eversberg b0c7ea72c8 Changed data structures for TBF and PDCH instances, to allow multislot
The new data structure is required to define slot/TFI assigment for MS
with multislot capability.

Now there are two lists for TBFs: uplink and downlink. It is possible to
have different TBFs with same TFI in the same direction, as long as they
are assigned on different timeslots.

See tbf.txt for description.

Note: This does not implement any multislot support. It defines the new
data structure. Currently only the first slot is assigned.
2012-07-13 14:46:03 +02:00
Andreas Eversberg e266bd48ac Adding signal handler to allow clean exit of PCU
The signal handler will end the main loop, so clean exit is performed.

The allocated memory is dumped in order to detect memory leaks.

All talloc functions use tall_pcu_ctx context instead of NULL, to track
memory leaks.
2012-07-13 14:00:21 +02:00
Ivan Kluchnikov ef7f28cc7f Merge branch 'jolly_new'
Merge is based on jolly_new branch with two modifications.
1. Modified PCU L1 interface.
pcu_l1_if.cpp - common functions for tx and rx messages on L1 interface.
sysmo_sock.cpp - SYSMO-PCU socket functions.
openbts_sock.cpp - OpenBTS-PCU socket functions.
pcuif_proto.h - L1 interface's primitives.
2. Modified encoding of RLC/MAC Control messages, now we use structures and encode_gsm_rlcmac_downlink() function for encode control blocks (without  hand-coding).
2012-07-12 14:49:15 +04:00
Andreas Eversberg e13fa2d569 Send downlink IMMEDIATE ASSIGNMENT on PCH and not on AGCH
The IMSI is used to define paging group on which it is sent.

This is tested with MS that requires correct paging group.
2012-07-09 17:10:44 +02:00
Andreas Eversberg 7b0450133c Fixed pseudo length of IMMEDIATE ASSIGNMENT message.
The pseudo length may not include the rest-octets, so it stays compatible
to non-GPRS phones.

At pcu_l1_if.c (OpenBTS) no pseudo length is given, so the frame is
only 22 bytes long. I could not test if it works.
2012-07-06 09:40:47 +02:00
Andreas Eversberg 3e372d57ed Cleanup of BSSGP code.
The hack for resetting BSSGP instance is removed and now performed
whenever the NS state changes to UNBLOCKED.

The BSSGP instance is now created only once, as it should be.

Received STATUS messages are ignored as they should be.

The creation and destruction of BSSGP/NS instances is now handled by
layer 1 interface alone.
2012-07-06 09:28:15 +02:00
Andreas Eversberg bf5a0f6e2c Move BSSGP/NS instances creation and desctruction to gprs_bssgp_pcu.cpp 2012-07-06 08:58:22 +02:00