Commit Graph

102 Commits

Author SHA1 Message Date
Pau Espin 13961c9b7a bts_pch_timer: Fix timer working only for MI type IMSI
This commit actually addresses 2 errors:

1- gprs_bssgp_pcu_rx_paging_ps() called gprs_rlcmac_paging_request()
with MI which can be either TMSI or IMSI, and the later always called
bts_pch_timer_start() passing mi->imsi regardless of the MI type. Hence,
trash was being accessed & stored into bts_pch_timer structures if MI
type used for paging was TMSI.

2- When the MS received the PS paging on CCCH and requests an UL TBF, it
will send some data. If one phase access is used for whatever reason,
the IMSI may not be yet available in the GprsMs object since we never
received it (and we'd only have it by means of PktResourceReq). Hence,
let's better first try to match the paging by TLLI/TMSI if set in both
places, and otherwise use the IMSI.

Related: OS#5297
Change-Id: Iedffb7c6978a3faf0fc26ce2181dde9791a8b6f4
2021-11-08 18:54:12 +00:00
Oliver Smith d3c7591304 Add counters: pcu.bts.N.pch.requests.timeout
Implement T3113 for paging over PCH with default value of 7s (same as
T3113 in OsmoBSC). Increase the new counter on timeout.

Related: SYS#4878
Change-Id: I97475c3dbe2cf00b9cbfec39e93a3c65cb7f749f
2021-08-11 13:42:30 +02:00
Oliver Smith 4df959d305 Add counters: pcu.bts.N.pch.requests
Count attempted paging requests over PCH.

Related: SYS#4878
Change-Id: I1026780ef8542f40060b961df2f37213e15c29d7
2021-08-10 10:35:18 +00:00
Pau Espin d1049dc8cc Allow multiple bts objects in PCU
This patch doesn't really tests whether osmo-pcu can work on a multi-bts
environment, but it prepares the data structures to be able to do so at
any later point in time.

Change-Id: I6b10913f46c19d438c4e250a436a7446694b725a
2021-01-20 12:36:21 +01:00
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
Neels Hofmeyr 0052051c07 use new osmo_mobile_identity api (avoid deprecation)
Note: subsequent patch Iad845acb0096b75dc453105c9c16b2252879b4ca will change to
passing a struct osmo_mobile_identity in the Paging code path, instead of
passing the encoded IE data.

Change-Id: Ibb03b8e601160427944f434761ca59811d1fc12f
2020-08-21 16:40:14 +02:00
Pau Espin 5530f12f71 Allow Gb PAGING-PS without P-TMSI
P-TMSI is optional IE, but IE is mandatory and hence always available.
Since the encoding is actually a Mobile Identity, the IMSI is used in
case P-TMSI is not available.

Change-Id: I4dbf8db04e81f98352a42ce34a5d91326be9bfd1
2020-01-06 10:26:46 +00: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 585cfb28b8 Fix trailing whitespace
Change-Id: I0515b5c8f6744fa501de88fa7808b7fc91981f0e
2019-12-10 20:02:21 +01:00
Pau Espin 05bca3524a Fix assertion hit upon CCCH Paging Request
Recent commit added an assertion to check for buffer boundaries and it
actually gets hit.
One of the 2 code paths calling pcu_l1if_tx_pch() was passing a buffer
of 23 bytes while one of maximum 22 is expected (because plen is not set
in the buffer but set inside pcu_l1if_tx_pch()).
So it seems before the assert, that code path was actually writing 1
byte outside the boundaries of data buffer, since bitvec_pack() uses
data_len field of bitvec.

Related: OS#4228
Fixes: 8dc09e73d0
Change-Id: I84c5dfd4d5580e9d4c00ed21887cb51bd9abbd2e
2019-10-16 14:36:28 +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
Max 7426c5f957 Add define for dummy burst string
Change-Id: I464920b3d6d47bb1c797a4ce06230f005a2e06a0
2019-02-19 18:58:04 +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
Max ef784e4e9e Remove unused includes and forward declarations
Change-Id: I59da04edd1b8ff965bbfbe00ccae1f7c9b6e5301
2017-12-18 22:05:22 +00: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
Holger Hans Peter Freyther 12c039cdb2 debug_diagram: Remove the special debug_diagram compilation mode
This approach is somehow flawed. We need/want to debug problems on
systems with real traffic and re-compiling it with debug_diagram
is not an option. All internal logging needs to be expressive enough
so we can understand what is going on (e.g. create a script to
post-process the output).
2013-11-26 20:57:24 +01:00
Holger Hans Peter Freyther 9948514086 tbf: Move the tx part into the tbf as it accesses internal data 2013-11-06 20:15:11 +01:00
Holger Hans Peter Freyther 474685e26e tbf: Make the tlli "private" and update the updating code
Now all updates to the tlli/tlli_valid are in one place. If we
implement the policy to update the matching/linked TBF we can
now to do it in a single place. Add a todo item for that as I
am waiting for feedback from the mailinglist.
2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther bd449f57a7 tbf: Create tbf_name and use it in log statements
This is like gsm_lchan_name and should be used in log statements.
This way we can easily change the information that is printed and
we know how to search things. The other part is that direct use
of tfi/tlli is removed which will allow us to make them private
and at the same time start to resolve the "tlli" updated in many
places.

Not old log statements are changed yet. This will done whenever
a bad log statement is seen on the console...
2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther 70ddde6929 tbf/bts: Move the tfi_find_free into the bts 2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther 6f9f434463 pdch: Move the dispatch of gprs_rlcmac_rcv_block into the pdch 2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 7ce21eb042 data: Move gprs_rlcmac_cs to the place it is used and make static 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 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 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 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 24e98d039d pdch: Move paging dequeue into the PDCH object
Rely on packet_paging_request returning NULL in case the queue
is empty. We should move the write_packet_paging_request into
a separate file/object as well.
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 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 1af73f6c81 bts: Remove global state from gprs_rlcmac_add_paging 2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther ee7a535608 bts: Remove global state from write_immediate_assignment 2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther 485860cc31 bts: Remove global state from write_packet_uplink_assignment 2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther 8d7a632eef bts: Remove global state frm gprs_rlcmac_rcv_control_block 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 ae947fcf67 bts: Remove the global state from write_packet_uplink_ack
Similiar to the previous patches
2013-10-30 21:20:44 +01:00
Holger Hans Peter Freyther 173a240a7e bts: Remove global state and the usage of the gprs_rlcmac_bts
Global state makes mocking/writing tests more difficult. Continue
by removing direct usage of the bts and adding it as pointer to
the function calls (showing the true dependencies of the functions)
2013-10-30 21:20:44 +01:00
Holger Hans Peter Freyther 96efa70a9e alloc: Call it trx_no and not trx as it is not trx object 2013-10-30 14:45:57 +01:00
Holger Hans Peter Freyther 02ab4a8803 alloc: Move the two timeslot alloc algorithms to a dedicated file 2013-10-30 14:45:57 +01:00
Holger Hans Peter Freyther 96173aec93 alloc: Move the "assignment" of the slot into a common function
Vladimir Rolbin pointed out that in case of the alloc_algorithm_a
the usf has not been assigned. For now move all the assignment into
a method and call it from the A and B algorithm.
2013-10-30 14:45:57 +01:00
Holger Hans Peter Freyther 7380babdba tbf: Move the tbf_timer_cb into the tbf class
Introduce the first instance method for printing out diagonistic
about itself and create a jump function for it.
2013-10-28 12:53:49 +04:00
Holger Hans Peter Freyther 0946f99b08 tbf: Remove dead code that called tbf_free 2013-10-28 12:53:29 +04:00
Holger Hans Peter Freyther 455613076a tbf: Move many routines related to the tbf from gprs_rlcmac to tbf.c 2013-10-28 12:52:59 +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 dcc9c39529 sba: Fix memory leak when all PDCHs are disabled 2013-10-17 11:36:11 +02:00
Holger Hans Peter Freyther 70862c9409 misc: Print the payload that is not known
Print the payload type that is not handled as this allows one to
look it up in the specification.
2013-10-16 16:37:22 +02:00
Holger Hans Peter Freyther 26da8361e9 rlc: Add missing break after GPRS_RLCMAC_CONTROL_BLOCK_OPT
Do not claim that the payload is not known. Add the missing break.

Do not print:
<0002> gprs_rlcmac.cpp:1174 GPRS_RLCMAC_CONTROL_BLOCK_OPT block payload is not supported.
<0002> gprs_rlcmac.cpp:1176 Unknown RLCMAC block payload.
2013-10-16 16:36:11 +02:00
Holger Hans Peter Freyther 483f77a275 misc: Fix some typos sed -i s,ressources,resources,g 2013-10-16 16:33:00 +02:00
Holger Hans Peter Freyther 985806030d misc: Fix format and typos in the code 2013-10-16 16:28:16 +02:00