Commit Graph

2440 Commits

Author SHA1 Message Date
Pau Espin 96b7a3ec72 cosmetic: tbf_ul_ack_fsm: Clean up use of ul_tbf and tbf pointers
Change-Id: I51ebe8174006380821eb978bbd78f600c10b02e7
2023-05-31 13:36:05 +02:00
Pau Espin a9b844d346 tbf: Improve TBF name description in logs
Change format to print the state at the end, to resemble more the same
format used by FSMs.
Furthermore, by moving it at the end, print it only when "enclousure" is
requested, aka when not requested by FSM to update its internal name.
The consequence of this logc is that log lines printed from FSM don't
end up with the same state string printed twice in different places.

While at it, shorten the EGPRS/GPRS indicator to one character, which
should be understandable enough since it matches what's usually seen in
mobile phones to signal one or another.

Change-Id: I86b5f042fae77721b22fc026228677bd56768ba9
2023-05-31 12:54:14 +02:00
Oliver Smith 2fc67e252c systemd: depend on networking-online.target
Related: SYS#6400
Change-Id: Ifbac18a38e086e42c67499b7818cdf08629d0000
2023-05-26 14:10:46 +02:00
Philipp Maier 98e5910ed8 gprs_rlcmac: also use PCU_IF_SAPI_PCH_DT for paging MAC blocks
In the current code we still send PAGING COMMAND MAC blocks via SAPI
PCU_IF_SAPI_PCH, which technically belongs to the older PCUIF version
(v.10), which we are going to deprecate soon.

Let's change this so that PAGING COMMAND MAC blocks will also be sent
through PCU_IF_SAPI_PCH_DT. Since PAGING COMMAND messages require no
confirmation by the receiving end we may set the TLLI field to
GSM_RESERVED_TMSI.

Depends: osmo-bsc.git I82443f2b402aa2416469c8c50b1c050323ef3b8f
Related: OS#5927
Change-Id: I99cfe373fa157cfb32b74c113ad9935347653a71
2023-05-22 12:35:09 +02:00
Vadim Yanitskiy 5fd0022b62 copyright: fix typo: sysmocom s/s.m.f.c./s.f.m.c./ GmbH
Change-Id: If51895e67271c0913e000ff9d28db8d8fe761201
2023-05-18 17:22:26 +07:00
Max 3d462354e5 ctrl: drop deprecated neighbor resolution interface
Related: OS#5809
Change-Id: Iff008c77ab49dd8855d54d2d44198475086012e4
2023-05-12 15:22:03 +00:00
Philipp Maier 8984afa5d0 pcu_l1_if: replace magic numbers with IMSI_DIGITS_FOR_PAGING
we have defined IMSI_DIGITS_FOR_PAGING but some parts of the code still
use magic numbers (3), let's replace those as well.

Change-Id: I9a1b6ba4578e2a8875d8d1a9e56c36dc2b33fe0d
2023-05-10 12:41:17 +00:00
Philipp Maier 6ee8d136d3 pcu_l1_if_phy: fix API function names
The functions l1if_open_pdch and l1if_close_pdch have a misleading
naming since what they actually do is opening and closing the TRX since
they return and accept a context (obj) that is valid for a whole TRX.
This also explains why the other functions accept a timeslot as
parameter in addition to the context. Let's rename those functions so
that it is clear what they do.

Related: OS#6022
Change-Id: I395a60b2fba39bac4facec78989bac20f0cef0d3
2023-05-03 09:57:38 +02:00
Philipp Maier 5e024342c4 er_ccu_l1_if: use one ccu_desr per timeslot
At the moment only allocate one CCU descriptor and use it as context for
the whole TRX. This is fine when running with one PDCH only but as soon
as multiple PDCHs are used the CCU descriptor gets messed up. Let's fix
this by introducing a TRX descriptor that contains an array of 8 CCU
descriptors, one for each timeslot.

Related: OS#6022
Change-Id: I09a51f34ce0edef79a797c4686c7b1d27c376e49
2023-05-03 07:56:47 +00:00
Pau Espin e1a8915936 cosmetic: ms: fix formatting of function comment
Change-Id: I717c0ebd6e9af5388e94482842f5638777758b32
2023-04-28 14:46:32 +02:00
Pau Espin 7a491b9d5f ms: Fix unsafe iterating freeing items in list
Change-Id: I35cba6d617b3356515769405c7d05ba28cd5132b
2023-04-28 14:45:39 +02:00
Pau Espin 5faedf3432 ms: Mark ms_reset() as static
Change-Id: Idc42be62f9911b7e2fad3dade884e72e5c2965f4
2023-04-28 14:29:40 +02:00
Oliver Smith 96a3e7f48c debian: set compat level to 10
Related: OS#5958
Change-Id: Icdb0f4107fa426afb1e7c2bb4a808ea6f9cc46a8
2023-04-27 12:29:37 +00:00
Philipp Maier c564ce8965 pcu_l1_if: cosmetic: reformat comment
Change-Id: Ib4ae65e1bc118572135fbec02e64dbec35f208b4
2023-04-26 12:24:51 +00:00
Pau Espin 4d3639144d Move resource allocation outside of tbf allocation
This patch finally decouples TBF allocation from resource allocation.
This will allow in the future reserving resources without having to
require a TBF object to exist.

Change-Id: I2856c946cb62d6e5372a1099b60e5f3456eb8fd4
2023-04-26 13:29:03 +02:00
Pau Espin d6c555ebd6 Move out of alloc_algo code modifying the data model
This way the alloc_algo() becomes idempotent, simplifying implementation
of new alloc_algos as well as rolling back if allocation fails (for
instance because some resource is exhausted at the time).

For now the code applying the results is moved to tbf::alloc_algo(), but
it will eventually get out of tbf code, so that the MS object is
responsible for running it. As a result, there's no even need to create
TBF object before trying to allocate resources, which will help furher in
rollback operations described above.

Change-Id: I5ffd00f5f80bde4b73b78db44896f65e70e12b20
2023-04-26 13:28:55 +02:00
Pau Espin a42b174bec alloc_algo: Move printing outside of update_ms_reserved_slots()
Change-Id: I0d8838829c519bb6da8a68d62947b98bab35a39f
2023-04-21 14:43:30 +02:00
Pau Espin a6a972e11e alloc_algo: Pass a struct containing all req params
This is a first step towards isolating the allocation algorithm from
applying changes on PCU state.
In next steps the tbf pointer will be dropped and the allocation
algorithm will only result a "result" struct which then the caller can
apply to whatever TBF object it requires.

Change-Id: Ie4d9ace526ad012d97738bc55bdb5cc1472c632d
2023-04-21 14:43:30 +02:00
Pau Espin 51c903e1bb vty: Several improvements to 'show ms' output format
* Use UL/DL acronyms to decrease output verbosity
* Keep more stable MS properties at the top, move link quality changing
  entries to the bottom putting them together.

Change-Id: If9f4c6ba1a4a6f9060222cc04254054ad03d7a96
2023-04-21 14:42:10 +02:00
Pau Espin 4673eb0b76 ms: Log MS active/idle state in 'show ms' VTY commands
Change-Id: Ibcd34055c9ae390510c5c3ba26621fd96d2368fd
2023-04-21 14:36:28 +02:00
Pau Espin f086fede93 ms: Rename field timer -> release_timer
Rename it so that it becomes clear what the timer is used for.

Change-Id: Id4738ea196b232858e1ec9cdc439f9b81839058f
2023-04-21 14:36:28 +02:00
Pau Espin b53230acec ms: Get rid of ms->delay field
Simply apply the content of the configured timer when the MS goes idle.
Having that field is convenient to do tricky stuff in unit tests, but
makes the main osmo-pcu app more complex for no good enough reason.

Change-Id: I8d44318b37b6605afd84db8ccec0d75e6db293b9
2023-04-21 14:36:28 +02:00
Pau Espin c5104b7f30 meas: Improve logging formatting
Change-Id: I15d66da3f41a9f14a542b96436d65a0581bbb45a
2023-04-21 14:36:28 +02:00
Pau Espin 4fdf79e0b3 ms: Increase log level when scheduling release timer
Change-Id: Ie470b5b0c7b01d91f4ad693e52afd51860d6da2d
2023-04-21 14:36:28 +02:00
Pau Espin fe4d2f7dca Add new log category 'ms'
This is useful to track the lifecycle of MS objects. The RLCMAC cateogry
used so far in those log messages is too broad.

Change-Id: Ib4ce88d0f7309ac77c064a94bb0d667e8dbc33dd
2023-04-21 14:36:28 +02:00
Pau Espin 8456a3642b dl_tbf: Set BandWidth timestamps to current time directly
Change-Id: I01654534aef5255c6d1c3ba0c553190a0319e8e1
2023-04-21 14:36:28 +02:00
Pau Espin eae9147424 ms: Hold a reference during ms_alloc
Make the caller hold a reference to the MS object just allocated, so
that it hs to explicitly unref it and, in turn, if no new references
were added during its use, trigger release of the MS object.
This is useful to avoid leaking MS object if it was allocated and then
no TBF is attached to it because allocation of TBF failed.

Related: OS#6002
Change-Id: I2088a7ddd76fe9157b6626ef96ae4315e88779ea
2023-04-21 14:36:28 +02:00
Pau Espin 84b0ebc902 cosmetic: Fix indentation in comment
Change-Id: I15063346e4ff0367c0bf04f6b48ac62b9bdf2929
2023-04-21 14:36:28 +02:00
Pau Espin 759724ca74 tbf: Move enable_egprs() to constructor
Whether the TBF is GPRS or EGPRS is known at allocation time since it
comes from the information known in the MS object used to create it.
Hence, no need to delay calling it to later steps such as setup().

So far it was probably left in setup() due to the constrains about
requiring the subclass to be constructed (use of window() virtual API).

Change-Id: I2e9d2a98c666a930333d52fb6c0463d7593c2615
2023-04-21 14:36:15 +02:00
Pau Espin e0e4251a5b tbf_ul: Move rate_ctr allocation to constructor
Change-Id: I818eb05fe062e0610e86cb34273bde99b379aa3f
2023-04-21 14:35:52 +02:00
Pau Espin e1c84579cc tbf: Move m_ctrs alloc to constructor
Move rate_ctr allocation to the constructor since it's expected not to
fail. This simplifies further tbf::setup() function.

Change-Id: If64443c38624d159e68eec3a07d8e8caf369467b
2023-04-21 14:35:37 +02:00
Pau Espin f9783c58f7 tbf: Store initial timestamp during constructor
Like already done for other timestamps.
This helps in simplifying the setup() call.

Change-Id: Ia0c2d0f5456b211169fb6c71f5f3c2e2b8760a28
2023-04-20 20:40:52 +02:00
Pau Espin ac4d4a6d41 ms: Rewrite MS release lifecycle
This commit changes lots of stuff in the MS release lifecycle, but
there's no really good way to split this into patches which make sense,
since all the chaos is intensively entangled.

Get rid of the ms_callback complex mess, it is not needed at all.

Previous MS release was strange due to the existance of previous
ms_callback.idle concept and MS storage: the MS signalled when it went
idle (no TBFs attached) and waited for somebody outside to free it,
while then arming itself the release timer to release itself if it was
not released by whoever.

The new lifecycle follows an easier (expected) approach: Whenever all
TBFs become detached from the MS and it becomes idle (use_count becomes
0), then it frees its reserved resources (TFI, etc.) and either:
* frees itself immediatelly under certain conditions (release timeout
  configured = 0 or MS garbage with TLLI=GSM_RESERVED_TMSI)
* Arms release_timer and frees itself when it triggers.

If during release_timer the MS is required again (for instance because a
new TBF with TLLI/IMSI of the MS is observed), then a TBF is attached to
the MS and it is considered to become active again, hence the release_timer
is stopped.

OS#6002
Change-Id: Ibe5115bc15bb4d76026918adc1be79469c2f4839
2023-04-20 20:40:52 +02:00
Pau Espin df6684fe50 ms: Log detaching tbf log line in proper place
It is interesting to log that a tbf is being detached *before* it
actually happens, so that the reader can see which TBF is being
detached.

Change-Id: I2008beb9ab8f97f7ea5ed7b45cfb3f23dfe7b27f
2023-04-20 20:40:52 +02:00
Pau Espin 6efa381248 ms: Make ms_{attach,detach}_tbf expectancies more robust
* Make sure that the tbf being attached has already the MS assigned.
* Check no re-attaching of alredy attached TBF ever happens.
* Document and early skip case where a non-attached TBF detach is
  attempted.
* Avoid recursive call mess to tbf_set_ms(tbf, NULL); during detach.
* MsTest needs to be modified since it uses fake TBF objects which use
  different set of calls than the regular TBFs in osmo-pcu. Since the
ul_tbf object is reused, it needs to be assigned ul_tbf->ms again before
re-assigning it, as per what happens usually in tbf_set_ms() in
osmo-pcu.

Change-Id: Ia18fe2de1fb3bf72f530157e5f30de64f2b11e12
2023-04-20 20:40:44 +02:00
Pau Espin 3ea467d104 ms: Make sure tbf!=NULL in ms_attach_{ul,dl}_tbf()
It makes no sense to pass "NULL" to attach function. There's a detach
function to be used if a given TBF has to be detached.

Change-Id: I0c5df195c080b21e5516aebfb46db22bdc55f2a2
2023-04-20 16:17:39 +02:00
Pau Espin 403e048ac0 ms: Use osmo_use_count to track references
Change-Id: Ib65629224e6bd5683bb9192ba4354e965e8d39ec
2023-04-20 16:17:39 +02:00
Pau Espin 9da0686371 Merge bts_alloc_ms() and ms_alloc()
gprs_default_cb_ms_idle() is changed to have the same implementation as
previous bts_ms_idle_cb(), since that's the only one being used in
osmo-pcu code. It makes no sense to use different callback logic in unit
tests.

This is another step towards simplifying the code and getting rid of the
idle/active_cb().

Change-Id: I2a06d17588572a21dc5a14ddbde83766076b446d
2023-04-20 16:17:39 +02:00
Pau Espin fe7aee9302 ms: store in bts->ms_list during alloc/destroy of ms object
With this change the MS no longer is removed from the llist without
potentially skipping free() if not idle in bts_ms_idle_cb().
As a result, some unit tests now can free it during bts tear down
instead of having them leaked.
The tests int MsTest need changes because the tbfs created are fake and
cannot be freed using tbf_free(), and hence cannot be detached from MS
using regular code paths. Instead first call explicit talloc_free(ms)
like other unit tests in the file already do.

Change-Id: Id53f8dfb9963366dd4b19a324615bbc83c4f23e7
2023-04-20 16:17:39 +02:00
Pau Espin eb0a0527e0 ms: Merge ms_storage into bts.cpp
That class is mostly a C++ class holding a llist plus some callbacks.
Having that in a separate class makes code more complex for no good
reason. This patch moves the llist into bts and allocates stuff directly
from within bts.
This will allow further cleanup of MS lieficyle in future patches.

Change-Id: I627f5db5073189c23ddf2b7f09c90abb24846f62
2023-04-20 16:17:38 +02:00
Pau Espin cde18c5632 bts: Rename bts_ms_by_{tlli,imsi} -> bts_get_ms_by_{tlli,imsi}
While at it, put them together and mark bts param as const.
This is a preparation for next patch.

Change-Id: Iad8aec4424f1f23cd4d02a14c4f9ec1b9fdb1f75
2023-04-20 16:17:38 +02:00
Pau Espin bfc9756c2b ms: Drop setting (egprs_)ms_class during bts_alloc_ms()
That information is not required during allocation of the object, and
most times it is not known.
Defer setting it only to meaningul values in paths obtaining the
information from peers.

Change-Id: I36f07dc389f7abe205fc4bcddbde93735f5d5cfc
2023-04-20 16:17:38 +02:00
Pau Espin 6d8315f724 tbf_dl: Avoid attempt scheduling DL ACK/NACK in TS != CTRL TS
Change-Id: I80cddc80f23992fd86637980f9e2bfc00a50e04e
2023-04-20 15:51:03 +02:00
Pau Espin f80cc5b9c8 ms: Drop setting tlli during ms_alloc()
Inside osmo-pcu code, the code path is to always call ms_alloc with
tlli=GSM_RESERVED_TMSI; a different value is only passed during unit
tests.
It makes no sense to have unit tests using differnet code paths than
ther app itself, since in the app it always desired to go through the
ms_set_tlli() and ms_confirm_tlli() which does more stuff.
Hence, drop the tlli param in ms_alloc and change the unit tests to use
the available APIs used by the application.

Change-Id: I730ec911a43b0f4e78faee4eeffb3ca8601564f8
2023-04-17 20:46:41 +02:00
Pau Espin 14379ef901 ms: Fix MS without PTMSI not freed immediatelly
This check (tlli != 0) was added in 2015 in
6d86628e5b, with the rationale below:

"""
To avoid dangling entries without a TLLI there (which cannnot be
retrieved anyway), the timer in the MS objects is not started after
all TBF have been detached, so that they get deleted immediately in
that case.
"""

The rationale makes sense, but through time the MS class was fixed to
return GSM_RESERVED_TMSI (0xFFFFFFFF) when no TMSI was available.
Hence, the check was wrong, and as a result, free() of MS containing
GSM_RESERVED_TMSI would be delayed over time by release timer.

Related: OS#6002
Change-Id: I7a694a30f8709c00af774846d7c4925cef253a71
2023-04-17 20:46:14 +02:00
Max cb947e0a0f gprs_rlcmac: convert from C++ to C
Change-Id: I7260ad1a67ebdc09767a679e579fead262f1627a
2023-04-12 16:13:10 +03:00
Vadim Yanitskiy 1083c01488 tests: $(BUILT_SOURCES) is not defined, depend on osmo-pcu
Change-Id: I6620a524b393a0db6201930a1e2795a439785824
2023-03-31 13:50:59 +00:00
Vadim Yanitskiy 52f882e8c4 fix pcu_rx(): actually discard malformed container message
Currently we do log an error, but then still call pcu_rx_container(),
passing it a malformed message.  The function does have an additional
length check inside, but let's better discard it early.

Change-Id: I8410ecf35442ab75741a5c9cd29d640ce5508e57
Related: OS#5963
2023-03-31 13:47:24 +00:00
Philipp Maier 1bdb132b43 pdch_ul_controller: log reserved frame numbers
When debugging frame number offset problems betwen l1 and below and the
upper layers of the PCU, it may be helpful do know which blocks/frame
numbers got reserverd for uplink transmissions.

Change-Id: I4277c572a4cc6cbbf3ac4e67442c9036be687627
Related: OS#5198
2023-03-27 09:14:40 +00:00
arehbein 1a5eb18e26 PCU interface: Log version when starting listener
Change-Id: Ic831ba20917293d8fa9b00ad276b31ad2ff77a64
2023-03-25 23:04:54 +00:00