Commit Graph

2211 Commits

Author SHA1 Message Date
Max dc6a860d0a constify pdch_ulc_get_next_free_fn() parameter
Change-Id: I91738f951f57bd171d8cbd66fe5e5c46e6fa953b
2022-11-17 19:32:40 +03:00
Max 36342f4181 cosmetic: drop duplicated comment
Change-Id: Id349fbfe683b7b63ac9076d2e9998f7c3ecea112
2022-11-17 19:32:40 +03:00
Max 477178dc63 cosmetic: drop unused field from struct pdch_ulc
Change-Id: Icf6204d99f91531f5ecad05e3f9f89406e5d12b5
2022-11-17 19:32:40 +03:00
Max 1002c4330d Update and document realtime scheduling priority in service file
Related: OS#5687
Change-Id: I1694af74eee2624709ad6cebbc4fb37320e2ef9d
2022-11-14 10:18:38 +00:00
Harald Welte f94562a622 update horribly outdated copyright statement on VTY
Change-Id: I26cda7826e9d648ea086bb408293e431a9cac206
2022-11-11 18:20:07 +01:00
Vadim Yanitskiy 3cf9d536ed Makefile.am: drop unneeded '-ldl -pthread' from AM_CXXFLAGS
Change-Id: I833864aa51059be9c97c16329bc16913c53e171d
2022-11-09 03:15:59 +07:00
Pau Espin 38a9a25a70 Disable logging fsm addresses
FSM IDs are properly updated now, so there's no need for the pointer
address to properly follow them.

Change-Id: Ia48c6d5afcdd95e32c7c9b327774f78f07342a0f
2022-11-03 18:12:47 +01:00
Pau Espin 94f8258de7 Improve MS logging
Use same formatting similar to what's now used in TBF, which is far more
easy to grep and follow. This way one can easily follow what happens to
a given IMSI, a give TFI, a given TLLI, etc.

Change-Id: If9b325764c8fd540d60b6419f32223fd7f5a5898
2022-11-03 18:12:06 +01:00
Pau Espin 57843c571a Improve TBF logging
use a format in tbf::name() which is sanitized (osmo_sanitize) and hence
can be used both in regular log as well as for its internal FSM ids.
Until now, the FSMs contained a small amount of information with
different formatting than the regular LOGPTFB(), which made it difficult
to grep or follow a TBF through its lifetime looking at logs. The new
unified format makes that a lot easier.

Extra information is now printed if available, such as IMSI.
Furthermore, the TFI is updated to include BTS and TRX, since the TFI is
unique within the scope of a TRX.

Change-Id: I3ce1f53942a2f881d0adadd6e5643f5cdf6e31da
2022-11-03 13:58:57 +01:00
Pau Espin 01dfe04c37 tbf_ul: Assign DL-TBF if needed after UL-TBF has gone over contenion resolution
If data received from SGSN is waiting to be sent to the MS, we may have
created a DL-TBF assignment over PCH if the MS was not in packet-active
mode. If the MS instead reaches back to the PCU asking for an UL-TBF, the
PCU has to wait until Content Resolution of the UL-TBF has succeeded in order
to attempt now to assign the DL-TBF over PACCH.
The delay was already there, but the trigger to attempt the DL-TBF
assignment upon UL-TBF contention reslution success was missing.

Related: OS#5700
Change-Id: Ib8f7ad2390485ce9fd76a9de6cd349a5f4037568
2022-11-01 17:12:34 +01:00
Pau Espin f38a47ee01 tbf_fsm: Introduce new event to act upon contention resolution success
This is a preparation towards fixing MS not recreating a DL-TBF (being
assigned on CCCH) when MS starts an UL-TBF and finishes contention
resolution.

A counter is removed which was counting contention resolution (MS) on
the wrong place.

Change-Id: I8b9555864d3615ce0a024b641c67921f82273a8d
2022-10-31 22:07:31 +01:00
Pau Espin 677bebbe5c Avoid losing DL-TBF during MS merge
It is desired to free pending DL-TBF under some scenarios, which somehow
are related to those where we call the ms_merge() procedure since it's at
time an MS can be identified when coming from packet-idle state.

Until now, the freeing of those DL-TBFs happen because the ms_merge()
procedure doesn't migrate DL-TBF from "old_ms" to "ms". This was done
manually under the cases where it was deemed necessary before calling
the ms_merge() procedure 8because old_ms and its tbfs are gone after
returning from it).
This logic, though convinient for the specific cases at hand, is quite
confusing for readers and program execution since one would expect the
ms merge to, well, merge everything.

Therefore, this patch changes the ms_merge() logic to always merge the
DL-TBF, and only under the specific cases where it makes sense to free
it, do so explicitly after MS merge, where all the info has been updated
and united.
2 code paths are now explicitly freeing the existing DL-TBF when needed:
- TBF_EV_FIRST_UL_DATA_RECVD: 1st data (containing TLLI) is
  received from MS, hence identifyng the MS and potentially having been
  merged with some old MS which used to have a DL-TBF, most probably in
  process of being assigned through CCCH (PCH). This event is triggered
  during MS using 1phase-access, and we should drop the exsitng DL-TBF
  because MS just came from packet-idle mode (CCCH).
- rcv_resource_request(): PktResourceRequest is received at an scheduled
  SBA, meaning the MS is doing 2phase-access, meaning MS also came from
  packet-idle mode (CCCH), so previous DL-TBF can be dropped.

Related: OS#5700
Change-Id: I29f4ffa904d79d58275c6596cc5ef6790b6e68c6
2022-10-31 22:07:31 +01:00
Pau Espin 338a5ae770 tbf_fsm: Introduce new event TBF_EV_FIRST_UL_DATA_RECVD
This allows easier tracking of this event. It will also extended later
on with more logic which is better placed in tbf_fsm.

Change-Id: I5c935914e13db3928c32621ec04eb2760367615d
2022-10-31 22:07:31 +01:00
Pau Espin 8abe13cf75 Rework tbf::update_ms()
That function was pretty confusing since it used a "enum
gprs_rlcmac_tbf_direction dir" param (whose type is expected to describe
the data direction of a TBF) to describe the direction of the the packet
which triggered its call.
The parameter was actually always called with "GPRS_RLCMAC_UL_TBF" which
in this case meant "uplink direction" which meant "TLLI was updated from
the MS, not the SGSN".
The DL direction was only used in unit tests, which can hence be simply
replaced by ms_confirm_tlli(), which this commit does.
So this update_ms() function was actually used in practice in osmo-pcu
to trigger update of TLLI and find duplicates only when an RLCMAC block
(control or data) was received from the MS. Therefore, this function is
renamed in this patch and moved to the gprs_ms class, since it really
does nothing with the TBF.

Related: OS#5700
Change-Id: I1b7c0fde15b9bb8a973068994dbe972285ad0aff
2022-10-31 22:07:31 +01:00
Pau Espin bda7bb7667 Rename tbf_alloc_ul_tbf -> ul_tbf_alloc
Use proper prefix according to the type being allocated.

Change-Id: Ic98c3c852c96c3f52f1c8f531b8d0fd28ce5aef5
2022-10-31 22:07:31 +01:00
Pau Espin b8ff74b37a gprs_ms: Add comment warning the user that a ptr may be freed after call to func
Change-Id: Ifa3d6b38fca89500ef02c9b972f514ceaf8fe83b
2022-10-31 22:07:31 +01:00
Pau Espin 32416fdcde Join ms_merge_and_clear_ms() and ms_merge_old_ms()
While at it, improve logging of the merge action

Change-Id: I39d9eac159448fc3c3a4db9e1b9c5364e906a78f
2022-10-31 22:07:31 +01:00
Pau Espin 76363e4334 update_ms(): Set TLLI of new MS object before merge with old MS
This way it becomes clearer in logs that we are merging MS which
contains the same TLLI.

Change-Id: Ifd232daa4219e1726c30449d647312a3a226a61d
2022-10-31 22:07:31 +01:00
Pau Espin 9438613792 Move UL allocation&assign functions to gprs_ms.c
Similar structure as what we have with DL-TBF.

Change-Id: I256aeede2a2678c9738539fb6ec4db9766fa85e4
2022-10-31 22:07:31 +01:00
Pau Espin 3f33929119 tbf_fsm: Identify several events as Dl-TBF only
This will help in the future when splitting tbf_fsm into different FSMs
for UL-TBF and DL-TBF, since only some of the events and states are
shared.
That means we can keep a single state and event enum, but the FSMs can
be implemented separately in different files, easing a lot extending and
understanding the logic.

Change-Id: Id97f0d532d2d7ab2791a35c1f836d7c8da050124
2022-10-31 22:07:18 +01:00
Pau Espin 0f85956991 ul_tbf: Define m_contention_resolution_done as bool
Change-Id: Ief048cc1b5e8a18ceaeb5432415d14f5ef7ee0ea
2022-10-31 10:51:20 +01:00
Pau Espin 091642a8f5 Replace tbf->establish_dl_tbf_on_pacch() refactoring GprsMs functions
ms_new_dl_tbf_assignment() is split into 2 functions, one to
allocate+assign on PACCH and another one for PCH.
This makes a lot clearer the aim of each caller of the function.
Once this is done, it becomes obvious tbf->establish_dl_tbf_on_pacch()
is basically doing the same as ms_new_dl_tbf_assigned_on_pacch() so drop
it.

Change-Id: I610210e3120c962d91ce8ff94c66161e086761ba
2022-10-28 18:13:41 +02:00
Pau Espin 8fa3e063f5 Rename function tbf_dl_request_dl_ack() -> dl_tbf_request_dl_ack()
Use the dl_tbf prefix which is usually used to easily distinguish from
"ul_tbf" specific APIs and "tbf" generic (parent class) APIs.

Change-Id: Ibf6ae20da99866af5f2b6e12184f3145d1fc0bbf
2022-10-28 17:40:29 +02:00
Pau Espin ee35008037 Refactor and clarify tbf->triger_ass() code
Split the function into 2 functions, one for assignment on PACCH and one
for assignment on PCH. This makes code calling this API far more clearer
on what is the exact aim when assigning the TBF.

Change-Id: Ic92867e55337b0bd6b5bfc97f13b7982eedb1cb7
2022-10-28 17:35:06 +02:00
Pau Espin 22b26d8a1c Delay ImmAss(PCH, PktDlAss) if waiting for PKT_CTRL_ACK answering UL_ACK_NACK (FinACK=1)
In that state (ul_tbf=TBF_ST_FINISHED), we are unable to reach the MS to
assign a new DL TBF.
* MS Is not available in CCCH because it's attached the PDCH.
* MS won't be able to PKT_CTRL_ACK a PktDlAss on PACCH, because next
  thing it will do is to PKT_CTRL_ACK the UL_ACK_NACK(FINACK=1) we
  already polled it for, and immediatelly after that it will release the
  UL TBF on its side and go back to packet idle mode.

Hence, we must wait for MS to send the PKT_CTRL_ACK to us in order to be
able to assign the DL TBF in PCH (CCCH).

Related: OS#5700
Change-Id: I7a30db9cc7dae70e04054f1a4dba004bd1780d4a
2022-10-28 16:33:45 +02:00
Pau Espin 3a7af57d03 rcv_resource_request(): Update meas before allocating and assigning new UL TBF
Those power params are applied in the Pkt Ul Ass sent to the
MS.
In practice it doesn't matter much because the Pkt Ul Ass message is
created later asynchronously by the scheduler (event CREATE_RLCMAC_MSG).
Still it's much cleaner applying the information before allocating the
UL-TBF, since that's an extra independent step.

Change-Id: I63133aa42dcf27a86437b1bc8dc83c30d6718028
2022-10-28 16:17:54 +02:00
Pau Espin 5c516fdbd2 encoding: Use MT_PACKET_UPLINK_ASSIGNMENT define instead of hardcoded value
Change-Id: I05b39d3183fdf741d648a15ff803d20e324443af
2022-10-28 15:46:41 +02:00
Pau Espin 1e81b2e0a4 rcv_resource_request(): Validate expected message before MS lookup & allocation
There's no sense if doing the lookup and allocation if the message is
not expected, it will be unrefed (freed) afterwards anyway.
Moreover, this way we avoid doing stuff for the WIP code paths which act
on different request ID than TLLI.

Change-Id: I4be8858230a2eebdb33260093d082a005cb9fcd4
2022-10-28 15:39:37 +02:00
Pau Espin 36ada89373 pdch: Use helper function tbf_as_ul_tbf()
Change-Id: Ie2a0af7928578823e944b85781ce284722547661
2022-10-28 15:14:44 +02:00
Pau Espin 1e16e1dc92 use new {dl,ul}_tbf_as_tbf(_const) helper functions
Change-Id: I223d9d5823c90ff31089420d35a7bf0fe1ebf870
2022-10-28 15:14:44 +02:00
Pau Espin 24dd3bcefc tbf_ul_ack_fsm: get ul_tbf base class only when needed
Otherwise it may give the wrong impression that the FSM can be used by
both DL TBFs and UL TBFs, which is not the case (only used by UL TBFs).

Change-Id: I788eae58248fa21732efe802344aa3c0c5031b5a
2022-10-28 15:14:44 +02:00
Pau Espin cc30b052db Rename as_{dl,ul}_tbf -> tbf_as_{dl,ul}_tbf
Prefix the function accordingly to specify the input object.

Change-Id: I225568fe2cb5236817cdd9609354c24c66723606
2022-10-28 15:14:44 +02:00
Pau Espin bd1f01fd27 Fix mess with struct tbf types passed to LOGPTBF macro
It is quite common in all osmo-pcu code to have to convert between
parent class "tbf" and children "dl_tbf"/"ul_tbf", or other way around.
This commit adds new helper static inline functions to cast between
those while doing type checks.
This is used by new LOGPTBFDL and LOGPTBFUL macros to now expect the
proper subclass and cast securely inside the macro itself, hence sparing
all code calling those macros to have to cast explicitly the pointer to
the parent "tbf" class.

Change-Id: I7e4489ad4b93c9c8442213947e53c10b61fdc5e9
2022-10-28 15:14:44 +02:00
Pau Espin 29b9f94cac tbf_dl: Make dl_tbf_alloc API available in C code
It will called by GprsMs (C code) in a follow-up patch.

Change-Id: Ib586894bc5834c33d38d23b7194f6dfadf9bc375
2022-10-28 13:05:04 +00:00
Philipp Maier 2d222a130d pcuif_proto: cosmetic: rename gsm_pcu_if_info_ts to gsm_pcu_if_info_trx_ts
The struct gsm_pcu_if_info_ts is named "gsm_pcu_if_info_trx_ts" in
osmo-bts. Lets rename it since the definition in osmo-bts is newer.

Change-Id: If8b50181d3b609612aa8433b635052aadddd3484
2022-10-27 15:28:51 +02:00
Philipp Maier 2e490582fe pcuif_proto: cosmetic: rename struct member "h" to "hopping"
struct gsm_pcu_if_info_ts has a struct member "h", which controls
frequency hopping. This struct member is named "hopping" in osmo-bts, so
lets rename it here as well to be consistent.

Change-Id: I3156b39cc91da07ee3f97e8c8be60fc989cf112b
2022-10-27 15:28:51 +02:00
Pau Espin 8757384aec Rename tbf_alloc_dl_tbf() -> dl_tbf_alloc()
Rename it so that it follows the usual prefix for the type it allocates.

Change-Id: I7d30a85fefaa61d100fbd51af4601a3cf7de2159
2022-10-27 13:53:03 +02:00
Pau Espin bf2842e64b tbf_ul_ack_fsm: Pass ul_tbf instead of generic tbf
The UL_ACK_NACK FSM is only used in Uplink TBFs.

Change-Id: Ic9893d274f4b6fafc75a615f7d6dcb9433b94ace
2022-10-27 13:53:03 +02:00
Pau Espin 14beef6cfe Move LLC enqueuing and retransmit timer to MS object
The LLC queue is already in the MS object. The LLC timer and most
of the logic to enqueue its data is independent from the TBF.

Change-Id: I56b89fcac838d8eb732b629734d5e458e9c806d1
2022-10-27 13:52:59 +02:00
Vadim Yanitskiy d6bb6190d3 bts: bts_snd_dl_ass(): use GSM_TDMA_FN_SUM() macro
Change-Id: If363e3320372c798b9b16274327fa8041358e350
2022-10-26 20:39:24 +07:00
Vadim Yanitskiy 153cb7f47d bts: bts_snd_dl_ass(): clarify the meaning of last_rts_fn + 21216
Change-Id: I8127e17607426443bb95b42873b580fc9f400af9
2022-10-26 20:39:24 +07:00
Pau Espin 3547d64061 gprs_ms: Move creating string name of object to a function
This way it can be used outside of LOGPMS().

Change-Id: I8ab713154c8f308878f3e85b6f7e8afc5c4be249
2022-10-21 19:09:23 +02:00
Pau Espin 7f360e74b7 Call ms_store->get_ms() with GSM_RESERVED_TMSI instead of 0
That's the special value checked in the implementation of get_ms() to
skip lookups based on TLLI.
This should save some cicles trying to match TLLI 0.

Change-Id: I364d238ff8a82abb14281140fe18b273c0e8f541
2022-10-21 14:31:05 +02:00
Pau Espin 0b5997e8f7 gprs_ms: Document functions setting/updating TLLI
Based on information from original commit introducing the functions
(9399046729) and looking at the current
code.

Change-Id: Ia440c672a8d2e11169b41f787239bfbba0989231
2022-10-21 14:10:43 +02:00
Pau Espin de8eb7bb33 cosmetic: Update reference to func renamed in the past
Fixes: 8a35e640a3
Change-Id: I86d1fa1f3ea96ca06f3e8c8f07b8d5b14cf098c7
2022-10-21 13:20:01 +02:00
Pau Espin 940e5953ed bts_rcv_imm_ass_cnf(): Improve logging
Related: OS#5700
Change-Id: I29a290d1e8b6e237a74ac8fab8dd5e5e5db71796
2022-10-21 11:59:56 +02:00
Pau Espin bee29f46ae Clarify use RR imm_ass msg fields
Change-Id: I814c7d4c1bce3f56852cfb1c7aa69b41588cb245
2022-10-16 22:13:48 +02:00
Pau Espin f510f5bc1f Use GSM48_MT_RR_IMM_ASS instead of hardcoded 0x3f value
Change-Id: Id966cbab403763d006bd5e59757c5bf57402bf9d
2022-10-16 22:13:48 +02:00
Pau Espin e9cbee917d cosmetic: Add missing spacing between params
Change-Id: I45666ed52d15871b83aaca1d7cb3e521800751c2
2022-10-16 22:13:43 +02:00
Vadim Yanitskiy 2cfc8e2c9a bts_set_current_frame_number(): log expected TDMA FN
Change-Id: Id28776fb5f0f85cd35d3918c79f8c8e338156aae
2022-10-05 13:51:31 +07:00