Commit Graph

576 Commits

Author SHA1 Message Date
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
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
Pau Espin bf5e3cb3a4 bts: Call gprs_bssgp_destroy() in destructor
Change-Id: I7ed7f489f36f88277e2d5e393edcb339bf0cbba0
2022-05-09 16:40:43 +02:00
Pau Espin 9184e855a1 tests/tbf: Set up pcu timers in prepare_pcu()
Change-Id: I30a491f82cced558ad72108c3c5ed7015d1d4d3b
2022-05-09 16:32:03 +02:00
Pau Espin 0bdad9f388 tests/llc: Add test_llc_codel
Related: OS#5508
Change-Id: I9c87b65496a6fe0187a1bc9f3419e2d7269e66f0
2022-04-05 11:16:17 +00:00
Pau Espin 2f94b77d8e tests/llc: Add test_llc_meta_pdu_life_expire
Related: OS#5508
Change-Id: I7ba6be32778e2c2b22723db10fa66655812c8452
2022-04-05 11:16:17 +00:00
Pau Espin 6b1e9515c9 llc_queue: Refactor to handle codel_state per prio queue internally
A CoDel state per prio queue is needed, otherwise the sojourn time state
is not properly reset when a high prio packet is dequeued.

If we have a global codel state shared for all prio queues of an MS, then
basically high prio (GMM) packets will "never" be dropped because they are
handled/dequeued way quicker, so it's sojourn time will be below the
threshold most probably, stopping the "dropping" state for the rest of
lower prio packets.

The handling of different codel states is moved from MS object to the
llc_queue, also offloading already loaded dl_tbf.cpp in the process.
This will also allow in the future setting different CoDel parameters
for different priority queues if needed.

Tests need to be adapted since now the CoDel and PDU lifetime are
incorporated into the llc_queue_dequeue(). Also because dequeue now also
accesses related MS fields.

Related: OS#5508
Change-Id: I2bce2e82ab6389d8a70130a5c26a966a316b0fa4
2022-04-05 11:16:17 +00:00
Pau Espin 4f8384bfbb llc: Convert to C
There's no real reason (other than historical) why code in llc should be
kept as c++ code. Let's rewrite it as C so that it can be included by
existing C code without having to add C->C++ shim, ifdefs all around,
etc.
This simplifies code and easies modification/improvement of the related
objects.

Change-Id: I250680ba581167d7398b2f734769c756cbb61c48
2022-03-31 19:42:15 +02:00
Pau Espin 1463383505 llc: Convert to C: s/m_//g
Change-Id: Ia5272841392110b87725e87a7e6824c17a70d6d1
2022-03-31 19:09:08 +02:00
Oliver Smith 8d03c50024 treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I4a49dbeeec89b22624c968152118aecf8886dac6
2021-12-14 12:19:13 +01:00
Pau Espin 0dcbc07682 bts: Add counter availablePDCHAllocatedTime
We basically want to probe whether it's possible to allocate TBFs, or
whether we know it will fail due to all main resources being already in
use (TFI, USF).

Having bts_all_pdch_allocated() return false doesn't mean though that an
MS will be able to allocate a TBF for sure. That's because further
restrictions are applied based on MS: whether it was already attached to
a specific TRX, whether the ms_class allows for a certain multislot
combination, etc. However, it should provide a general idea on whether
for sure the PCU is unable to provide more allocations. More fine
grained state about failures can still be followed by looking at
tbf:alloc:failed:* rate counters.

Related: SYS#4878
Depends: Iabb17a08e6e1a86f168cdb008fba05ecd4776bdd (libosmocore)
Change-Id: Ie0f0c451558817bddc3fe1a0f0df531f14c9f1d3
2021-11-15 11:40:07 +01:00
Pau Espin 5deac1404d Fix MS ending up with assigned imsi 000
The whole paging path and data structre is cleaned up.
New MS helpers ms_imsi_is_valid() and ms_paging_group() are introduced
to help in the process and keep implementation details inside GprsMs
class.

Related: OS#5303
Change-Id: I4c0838b26ede58e4b711410eee2a8e4f71e9414b
2021-11-12 18:38:43 +01:00
Pau Espin 84f2b51a37 tbf_dl_ass_fsm: Log both TBFs if old TBF is handling assignment for new one
Change-Id: I4ec4eb2ca3f4fa576a4f9ada8c2462f59ca078b9
2021-11-12 12:03:00 +00:00
Pau Espin 304b10a8b5 pdch: Log TS enable/disable transitions
Change-Id: I6780634de4791382ccd25bf7b74f5286420e2c52
2021-11-09 12:22:48 +01:00
Pau Espin 20dfa54508 pdch: Log line detaching TBF at start of the function
Log before the action is done ("Detaching", not "Detached"). This way,
if something crashes we see that last line.

Change-Id: I6811d3772e2ac850741d3db5ec32be5c0812e81a
2021-11-09 12:15:23 +01:00
Pau Espin 19b3392166 tests/alloc: Extend test_bts_pch_timer() to validate MI type TMSI
Change-Id: I3673d387fa735b54fbc137ffaa18af581fa1b85a
2021-11-08 18:54:12 +00:00
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
Pau Espin dbd3b78a9b tbf_ul: Update FSM names for dummy reject TBFs
This allows easily identifying dummt TBFs created to send assignment
rejects.

Change-Id: I73a197795a9c8e9cd8dc06bf46ddb8f275d2c289
2021-11-08 16:33:51 +01:00
Pau Espin a02f945479 tbf: Set tfi to initial special value
This allows distinguishing when a TBF didn't set the TFI. Useful to
identify dummy reject TBFs, etc, and make sure a non-dummy TBF set its
TFI properly.

Change-Id: Iecf54a24041bd14f4ef5b86e57c3732e1b69d463
2021-11-08 13:24:20 +01:00
Pau Espin 063296883f tbf_ul: Set first_(common_)ts in handle_tbf_reject
Let's set them to match expectancies for this type of dummy TBFs, in
order to avoid acidental use/access of other timeslots to the one where
the reject was associated to.

Also use tbf_assign_control_ts() to log the TS used for the TBF, similar
to what's used in other places where control_ts is assigned.

Related: OS#5293
Change-Id: I32dcb29ad24519082b8665921efcce0b5a16d12e
2021-11-08 13:24:20 +01:00
Pau Espin 812a7d3fa3 bts: Improve logging to clarify RACH req is for 2 phase access
Change-Id: I047b688197a07e3592f19888f0ca71b9c3d2b3fd
2021-11-08 12:23:31 +00:00
Pau Espin 769e28114f bts: Introduce new RACH req counters for one/two phase access
These new counters allow the user to find out which kind of access are
MS requesting.

Related: SYS#4878
Change-Id: Id87c3a53d3acee92499987c843130e358f54742c
2021-11-08 12:23:31 +00:00
Pau Espin 1859ec38cc csn1: Avoid storing existence bit as true if content was actually NULL
If we decode Exist bit as "1" but we are at the end of the message, and
all the Next items we'd read are expected to be possibly NULL, then swap
the Exist bit in the decoded structure as "0" in order to tell the
decoder user that the related information structure is actually unset,
as if "0" was received.

Related: SYS#5552
Related: OS#4955
Related: OS#5020
Change-Id: I38602e4b680ed87297c7e440691a494c07cad446
2021-10-20 15:36:01 +02:00
Pau Espin ebdc0d8c17 csn1: Avoid failing if optional DownlinkDualCarrierCapability_r7 is missing
All additional release fields are considered optional, and the
CSN_DESCR for Content_t already marks almost all as such, except
DownlinkDualCarrierCapability_r7.

It has been found that some MS transmits a MS RA Capability with a Length=61 bits
where the last bit in the buffer is setting the Exist bit for
DownlinkDualCarrierCapability_r7 as 1. Hence, the CSN1 decoder failed to
decode the whole message because it expected to keep reading there
despite there's no more bytes to read.

While this is could actually be considered an MS bug, let's relax our
expectancies and simply consider the case { 1 <end> } as it was { 0 },
and mark skip decoding DownlinkDualCarrierCapability_r7. That waht
wireshark (packet-gsm_a_gsm.c) or pycrate do for instance.

This patch itself doesn't fix the problem where actually the Exist bit
is stored as 1 in the output decoded structure, but simply allows keep
ongoing with decoding until the end. This issue will be fixed in a
follow-up patch.

Related: SYS#5552
Related: OS#4955
Related: OS#5020
Change-Id: I9a2541bd3544802a646890f32725201836abb0da
2021-10-20 15:36:01 +02:00
Pau Espin 089d734cd1 csn1: Add unit test showing RadioAccess Capability decoding failure
This RA Cap creaes a decoding error on our CSN1 decoder, but seems to be
handled properly by wireshark's own decoder as well as pycrate.

The ending bit of last byte in "MS RA capability 1" has a "1" which
according to spec should flag the existance of
DownlinkDualCarrierCapability_r7, but nothing else comes after it. This
matches the expectancies as per Length field of the first RA Cap.

Related: SYS#5552
Related: OS#4955
Related: OS#5020
Change-Id: I51235e8575f4b992b44078713ec67bbccfd13293
2021-10-20 15:36:01 +02:00
Pau Espin 4a1c561ce8 pdch_ulc: Log POLL reason upon timeout
Change-Id: I7cd59b60fe0af0bfdfcdf8a91e4cf8bd3f25b2f7
2021-10-12 11:01:07 +00:00
Pau Espin 0043005afb tbf_fsm: rename state NULL -> NEW
This helps distinguishing the case where a TBF is in the initial state
and the unexpected case where osmo_fsm_inst_state_name reports "NULL"
due to fi pointer being NULL.

Change-Id: Ieaabfc9fa0dedb299bcf4541783cf80e366a88c3
2021-10-12 11:01:07 +00:00
Pau Espin 2282b50e5c tests: RLCMACTest: Add one more sample RA capabilities to suite
This one is larger than some of the other already available.
The decoder is wroking as expected here.

Change-Id: I5d986f68395326f894349446194090b1ddaecd69
2021-10-07 18:32:54 +02:00
Pau Espin 422636d752 tests: TbfTest: Fix wrong behavior in test_tbf_dl_reuse()
The test uses get_poll_fn() to submit a UL ctrl block on the next
expected poll TS+FN.

During initial transmit_dl_data(), 2 POLLs for DL_ACK are set on
different TS, but the test only updates the clock for one of them in
send_ul_mac_block(). As a result, one POLL item is left in the rb_tree,
and later on, when send_control_ack() is called, get_poll_fn() will pick
that 2nd DL_ACK poll FN+TS which was left untouched (due to sending no
events to the PCU clock) instead of the FN+TS which was expected to be
allocated by PCU for DL_ASS.

Until now this was not an issue since rcv_control_ack() was not properly
veirfying what the poll scheduler was expecting and accepted it. This is
no longer the case after the follow up patch refactoring
rcv_control_ack() and improving its robustness.

Change-Id: I3a4b089fe66a99e73e07bd1c690cd4d67752fad9
2021-09-28 16:05:03 +02:00
Pau Espin e376fd57cf Use LOGPDCH macro to standarize log line
Change-Id: If815779b2e2e56707f36c72dbdbfd4c5b07165ed
2021-08-31 14:38:21 +02:00
Pau Espin d06ec27856 fix typo 's/dowlink/downlink/g'
Change-Id: Iae66aff9eed3856f09e58116ee26ec061733b076
2021-08-23 17:14:23 +02:00
Pau Espin f48de627f4 tbf: Move T3193 to tbf_state FSM
Related: OS#2709
Change-Id: Icf8249651e34132eb7ba99188a23662dec6f8653
2021-08-23 17:14:23 +02:00
Pau Espin ea8dbddab1 Move tbf ul_ack_state to osmocom FSM
Related: OS#2709
Change-Id: Icf23bf5a4b85fbcbf1542cebceb76b9ba7185d30
2021-08-23 17:14:23 +02:00
Pau Espin 3225290d77 Move timer X2002 to tbf_fsm
Related: OS#2709
Change-Id: I94b71c60ed49d51ebdf6d6b428056b4b94354676
2021-08-23 17:14:23 +02:00
Pau Espin fbc1baa139 tbf: Merge handle_ack_nack() into rcvd_dl_ack()
There's no real use in having those 2 methods separately, and only adds
complexity. Let's merge it to have 1 TBF code path handling DL ACK/NACK.

Change-Id: I546d2e46bda96a2f551b28673464e57831c71828
2021-08-23 17:14:23 +02:00
Pau Espin afe189e802 Get rid of lots of code only used by tests
There are 2 methods "rcvd_dl_ack()" in osmo-pcu code. One is used by
osmo-pcu itself, and the other is only used in tests.
Changing the tests to use the same method as osmo-pcu allows removing
the second one, and with it, a lot of code and complexity out of
osmo-pcu.

Change-Id: I14d9312cb61534dc97fca83141b9c0cd933c9206
2021-08-23 17:14:23 +02:00
Pau Espin 9d67e72e85 Move timer X2001 to tbf_fsm
The side effect is that the timer is enabled for other scenarios where a
PACCH assignment happens, like an Assignment Reject or Ul Assignment
(that's why there's more lines showing up now in TbfTest.err).

Change-Id: Ib8ab2f7397ad05c6fcd5dd74af55a1e2c56e1463
2021-08-23 17:14:22 +02:00
Pau Espin 5bc6560efc tbf: Drop unuseful flag GPRS_RLCMAC_FLAG_TO_DL_ASS
The flag is only used to print some non interesting stuff, let's drop it
in order to simplify code. We can add later whatever we want in the new
shiny FSM.

Change-Id: I13f92f058c219f230d57b3c00b8ae1d187603813
2021-08-23 17:14:22 +02:00
Pau Espin 49a2f404e8 replace dl_ass_state with osmocom FSM
Related: OS#2709
Change-Id: Ia33418478e17986a316ffda48b091030f53fa371
2021-08-23 17:14:22 +02:00
Pau Espin 432d4f3b89 tbf: Drop unuseful flag GPRS_RLCMAC_FLAG_TO_UL_ASS
The flag is only used to print some uninteresting stuff, let's drop it
in order to simplify code. We can add later whatever we want in the new
shiny FSM.

Change-Id: I20aa7f83cc4f32de129e64c74a91745b983a7b16
2021-08-23 17:14:22 +02:00
Pau Espin 6ad11a6990 Replace ul_ass_state with osmocom FSM
Related: OS#2709
Change-Id: Id414eafe9c04a9a8759c6fb1a483bf2ee093a4d2
2021-08-23 17:14:22 +02:00
Pau Espin b0ead922a1 tbf_free: Get rid of uneeded tbf_state transition
We are freeing the object immediately afterwards anyway, so no need to
pretend it went through the normal state release.
Leaving current state as it is actually provides more information on
what was the status/state at the time the TBF had to be freed.

Change-Id: I3016caaccc2c43e1e300f3c6042d69f8adcd9d69
2021-08-23 17:14:22 +02:00
Pau Espin 8c4f978483 Drop logging last mas report before freeing TBF
There's no much use in logging it since anyway we are immediately
getting rid of it.

Change-Id: I9b712f720b5874886cc19d998fb8fcd0e618d590
2021-08-23 17:14:21 +02:00