Commit Graph

2440 Commits

Author SHA1 Message Date
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
Vadim Yanitskiy c2eb4b7405 Make linter happy: fix coding style issues
Change-Id: I6672fcd13d9617f054ab295232cfe486f5f17035
2022-10-04 03:06:55 +07:00
Vadim Yanitskiy f5dde9fe54 fix pcu_l1if_tx_ptcch(): do not send empty blocks to GSMTAP
This makes no sense and confuses Wireshark, so it shows malformed
packets.  We are not sending empty PDTCH blocks to GSMTAP either.

Change-Id: Ic7b6aca4f3af43a6fd47d033c950c711164685a4
Related: SYS#6045
2022-09-30 02:22:24 +07:00
Max 1ad2d3f811 Set working directory in systemd service file
By default systemd will execute service with root directory
(or home directory for user instance) which might result in
attempts to create files in unexpected place. Let's set it
to 'osmocom' subdir of state directory
(/var/lib for system instance) instead.

Related: OS#4821
Change-Id: Ib6acc84c3018e468f4c320bc2a3003ba906e4aeb
2022-09-09 18:42:38 +07:00
Vadim Yanitskiy 8c88219ecc {src,tests}/Makefile.am: $(COMMON_LA) is not definied
Change-Id: I4958b5d62645be6ed2a200a50a23c567c9a9f3c0
2022-08-09 16:05:35 +00:00
Vadim Yanitskiy e33c236db0 {ms,gprs_pcu}_talloc_destructor(): call osmo_timer_del() unconditionally
osmo_timer_del() does check if a timer is active internally.

Change-Id: I062c7636b59714860fa6b49a2d59c6528ebd57e3
2022-08-08 20:22:41 +00:00
Vadim Yanitskiy 8942a2c72f Makefile.am: add 'git-version-gen' to EXTRA_DIST
Change-Id: Idbf4bf70d83fbf697d4a094dbb47592deaea6114
2022-08-07 19:39:03 +07:00
Vadim Yanitskiy 559c9c219c Makefile.am: generate missing .version file
Change-Id: Id0cd2debf9b2d120c6dec1e534eefc4fe0a4210f
2022-08-07 19:31:47 +07:00
Vadim Yanitskiy a1f1128be5 tests: target 'check-local' does not depend on BUILT_SOURCES
Change-Id: I6cef8024cc10998b29e2bf7fc64c4c98fed7d8dd
2022-08-06 18:36:12 +00:00
Vadim Yanitskiy 19319ce487 tests: make target 'check-local' depend on 'atconfig'
I believe this may be related to sporadic failures we hit on Jenkins:

  test -z "atconfig" || rm -f atconfig
  ../../../tests/testsuite: line 987: ./atconfig: No such file or directory
  make[2]: *** [Makefile:1464: clean-local] Error 1

This dependency is present in all other Osmocom projects.

Change-Id: Id9bf06392ad31e1ecc66a5bd13069a915183a76b
2022-08-06 18:36:12 +00:00
Vadim Yanitskiy 5e0fbdcb9e tests/rlcmac: use ARRAY_SIZE macro
Change-Id: I6e9d95ef007e984d25403eb64f8aeab02e3fa8e7
2022-08-06 02:51:46 +07:00
Vadim Yanitskiy cc2da7ba2c tests/rlcmac: cosmetic: fix coding style in arrays
Change-Id: I65a5313704f692c411714006def143cfdb7cc04a
2022-08-06 02:51:46 +07:00
Vadim Yanitskiy 3094bb218a tests/rlcmac: make all test functions static
Change-Id: Ia7f1615edf1cac630631c14ccaeebab758aa4f72
2022-08-06 02:51:39 +07:00
Vadim Yanitskiy 97eb2f9446 tests/rlcmac: remove unused printSizeofRLCMAC()
Change-Id: I4858d1cb0c4ffb0a152b1d975e30d50efa6296a7
2022-08-06 02:18:58 +07:00
Vadim Yanitskiy 2f2935eadd tests/rlcmac: remove unused #includes
Change-Id: Ib3315f61eb90704b1216094a80e9f379f4150d33
2022-08-06 02:17:37 +07:00
Vadim Yanitskiy 0eaa3d3798 neigh_cache: fix: properly convert from nanoseconds to microseconds
Change-Id: I38dc7c04b1fd0e3a17af4c8caef991916f25f2b9
2022-07-20 00:12:46 +07:00
Pau Espin 263c75c912 nacc_fsm: Fix uninitialized plmn.mnc_3_digits parsing CTRL neigh resolution cmd
Fixes: Coverity CID#272987
Change-Id: I819bdb0cc126113542547e9c397673a2dee0f168
2022-06-30 08:58:29 +02:00
Vadim Yanitskiy 1a1e8307db encoding: fix an uninitialized field in gen_freq_params()
This is not critical, given that we set 'ElementsOf_RFL_NUMBER' to 0.
But still, let's ensure that all fields are initialized.

Change-Id: I4dd5202d1c4bd75baf0ab4f88ffefcc47272bd9c
Fixes: CID#272999
2022-06-29 11:55:28 +00:00
Pau Espin 7ebdfc29da Bump version: 1.0.0.21-b896-dirty → 1.1.0
Change-Id: Ie4c2e2c9462746a7a5577a3cc2601ab7dd74bc4a
2022-06-29 09:48:53 +02:00
Harald Welte b896b8e258 update git URLs (git -> https; gitea)
Change-Id: I52c1a8c3b1233433b786d0e4680d3016b181b242
2022-06-18 12:31:20 +02:00
Pau Espin cd18a5003d gprs_ms_stoage: Release all MS in ms_storage cleanup()
This makes sure all MS and TBF objects under a bts are freed when its
underlaying storage is freed (cleanup() is called).

Related: OS#5555
Change-Id: Idf3ad8b70c97313dec38a49d48cf36d6c9b404c7
2022-05-09 17:47:34 +02:00
Pau Espin 52e2c08f66 TbfTest: Reset MS timeout to 0 in test_tbf_dl_llc_loss()
The timeout is set to a high value to avoid freeing the MS during main
loop iteration. Let's set it back to 0 to have a common free path in
test infrastructure.

Change-Id: I6dc4765163fde1a46574b49f3185aea65391e0d0
2022-05-09 17:47:28 +02:00