Commit Graph

2115 Commits

Author SHA1 Message Date
Pau Espin afd9393a2d pcu_main: Mark -r cmdline param as deprecated
We have VTY support for it enabled in osmo-pcu since a while ago. Let's
mark it as depcreated now so that we can drop this cmdline arg in the
future.

Change-Id: Ic39c94984cb311aac0464d69f564af6d5447bd0f
2021-11-12 17:00:34 +01:00
Pau Espin 17bfbedbc7 tbf_{dl,ul}_ass_fsm.c: use proper macro to log tbf
TBF can be either UL or DL in that FSM.

Change-Id: Ief0cd5298e062f11b0f39716162a67b87c9ff35f
2021-11-12 13:14:19 +01:00
Pau Espin bd1b90f141 tbf_dl_ass_fsm: Fix missing transition to NONE if DL TBF is nonexistent
If by the time the PktDlAss is to be scheduled by the scheduler the DL
TBF is gone, the FSM will abort the assignment and go back to state
NONE.
However, the transition was missing, ending up in the scheduler trying
to schedule the message unsuccessfuly lots of times per second, clogging
the logs and disrupting normal operation.

Related: OS#5293
Change-Id: I6f421e5ddc9894fee72de1102df35a76cf2f2647
2021-11-12 12:03:00 +00: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 dbdf84eaff cosmetic: gprs_pcu.h: Fix typo in comment
Change-Id: I7140decb50e822bf412fa380dc8b6ef6486a5681
2021-11-11 14:11:40 +01:00
Pau Espin 7eb9e69506 tbf_ul_ass_fsm: Log both TBFs if old TBF is handling assignment for new one
Change-Id: If475560aab16b0a89743139189ff7720389132a5
2021-11-10 17:54:38 +01:00
Pau Espin 715aeb4ebc pdch: Increase log level of line informing about TS control change
This way it's the same log level as the one used in all other paths
using tbf_assign_control_ts() to assign tbf->control_ts =
tbf->first_common_ts, and this specific event is not lost from logs.

Change-Id: Ia32d835ee4c14d7d48391452b5e3d05ed88e0483
2021-11-10 17:21:43 +01:00
Pau Espin ace3b1bdc1 pdch: Drop previous UL TBF from MS who sent PktResReq through SBA
If the MS has a pending UL TBF but we just received a PktResReq on an
allocated SBA from it (same TLLI, hence same MS), then it means it
allocated the SBA through RACH req and hence it was on CCCH. That means
it was not active on any PDCH, hence for sure the previous UL TBF can be
dropped.

Related: OS#5293

Change-Id: I1f20dba56f46ea15cbb9b03bdc5b79d923491a3c
2021-11-10 16:11:19 +01:00
Pau Espin 54a126f6d4 pdch: Update ms_reserved_slots in GprsMS when TS becomes disabled
Otherwise, after the TS is disabled, a new TBF created for that MS may
end up in alloc_algorithm assigning the disabled TS, since it will be in
the mask of reserved PDCH TS for that MS.

Related: OS#5265
Change-Id: Ifc59ac37fa6b0ad9ecc8f76326928611e748b11c
2021-11-10 11:36:55 +01:00
Pau Espin 853cdf85eb ts_alloc: rename variable to clarify meaning
The variable counts reserved slots, not available one. It can easily be
seen by checking function count_slots() documentation "Number of
reserved TS".

The previous naming was used probably to indicate "available to reserve"
TS, but the naming is misleading.

Change-Id: Ib58e87d5a067d20d0b331fe32dff61b95ecc3e3f
2021-11-10 11:36:55 +01:00
Pau Espin 978071bce9 ts_alloc: rename function to clraify what it does
The function updates nothing, so it's misleading. It simply counts
slots, so let's call it like that.

Change-Id: I55954321d6f2b5e755177a8829512da371e934aa
2021-11-10 11:36:55 +01:00
Pau Espin d9066272ec ts_alloc: Simplify tfi_find_free logic
Avoid passing an extra pram which is accessible by GprsMs object already
being passed. Once, the "trx = ms_current_trx(ms)" is moved inside the
tfi_find_free function, it becomes clear that all the logic can be
further simplified.

Change-Id: I733d9bee3fa1dfc647da9f150b30014fbdab7442
2021-11-10 11:36:14 +01:00
Pau Espin fb904fbbd9 pdch: Log DL TBF originating the new UL TBF
Change-Id: Ie4257a2468d589464d0d56882e4408e4bcfe340f
2021-11-09 14:01:40 +01: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 ef8a730f6d bts_pch_timer: Avoid resend Paging Request over PCUIF if T3113 is armed
Let's avoid flooding the BTS and taking CCCH resources for no good
reason. If user configures everything correctly, the SGSN should not
attempt a retry after similar timer >= T3113.

Related: OS#5297
Change-Id: I2a77714648d16ccff2a340ce775e83dcc5ffe707
2021-11-08 18:54:12 +00: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 f8a93cb882 doc: Update counters_generated.adoc using osmo_vty_interact.py
osmo_interact_vty.py -c 'enable;show asciidoc counters' -p 4240 -H 127.0.0.1 -O doc/manuals/chapters/counters_generated.adoc

Change-Id: I88e8e5548876fd6515e6bfcccec47bc48ba0ceb4
2021-11-08 18:33:04 +00:00
Pau Espin ba5683194a Add counter for successful contention resolution procedures
This counter is related to succPDTCHSeizures,
(3GPP TS 52.402 B.2.1.51 Successful PDTCH seizures).

The relevant event when the first RLC block on the PDCH from the MS is
received is the fact that contention resolution is considered as done in
the network side. Hence, name the counter that way to ease
interpretation.

Related: SYS#4878
Change-Id: I3d67e3e68907921b43f2ca4398ad9578c0b2618c
2021-11-08 18:33:04 +00:00
Pau Espin cc77eed9d9 tbf_ul: Improve documentation of tbf_alloc_ul_pacch()
Change-Id: I59493788b4a54610a70f3eb4c31fd05f6e39e63d
2021-11-08 18:33:04 +00:00
Pau Espin 10b29153b7 pdch::rcv_resource_request(): Use local var to store bts pointer
Change-Id: Ica727c4b70cecc0ddb5d2a235bfc416735754b61
2021-11-08 18:33:04 +00:00
Pau Espin f61acd75c4 cosmetic: Add parenthesis around expression to clarify it
Change-Id: I621ef02868aff2bd23d82c8bc70e5cdbc391fbc2
2021-11-08 16:34:17 +01: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 dff399fa42 bts: Add counters for successful 1,2 phase pkt access
These counters relate to succPDTCHAssProcsPerCause
(B.2.1.50 Successful Packet Channel Assignment Procedures, per cause).

Related: SYS#4878
Change-Id: I494afab337f2557ffa38e4c7ff2c15a1647a1e04
2021-11-08 15:26:49 +00: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 d3d46de278 tbf: Mark initial first_(common_)ts with special value
This way it's easier to distinguish when this value was not properly
filled when debugging or looking at logs.

Change-Id: I0c9c9fdcfca9eb15125ea49efcbb76711850052e
2021-11-08 13:24:20 +01:00
Pau Espin de0eeafd2e tbf: Set m_created_ts in constructor
This way the timestamp is also set for dummy reject TBFs. For other
TBFs, setup() is called immediatelly after calling the constructor, so
we are fine too.

Change-Id: I2966ec7f3f9161d528a173d94797b72d1398c747
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 92cbe4aee0 pdch: Improve log line and increase log level
Change-Id: Ie593331a69f6b8ec3b21e2b274a1aa060b2dc439
2021-11-08 13:24:19 +01:00
Pau Espin b6babc39dc tbf: Increase log level of line about unable to allocate poll for TBF
Change-Id: I0bd972d3b68017f12a0816a27162e3a409b1893a
2021-11-08 13:24:19 +01:00
Pau Espin 48df600bfa bts: Count RACH Request with unexpected content
Change-Id: I86420b08a9a634ca2e1f5a1c7e66ec3d3c08ce0b
2021-11-08 12:23:31 +00: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 bf129c1437 vty: show tbf: Drop unneeded check for non-null ms
Since a while a go, a TBF is guaranteed to always have a MS assigned.
Hence, there's no point in checking it.

Change-Id: I89e062432ac671c73731ce68c889aeb5e24277f5
2021-11-05 20:46:08 +01:00
Pau Espin 14015124ed vty: Log tbf_state when showing a TBF
That's one of the most important information bits about a TBF when
debugging, and it's not shown currently, only when "show ms" is used.

Change-Id: I98e3c9cac4ca6fc29695768ecc6e0444e618b945
2021-11-05 20:44:49 +01:00
Pau Espin 43fc4a8690 vty: Avoid crash in tbf_print_vty_info with null ptr ctrg
Previous code did use a ctrg based on MS being EGPRS capable or not.
However, an MS being EGPRS capable doesn't mean necessarily that all its
TBFs are EGPRS, since we may known about the capability after we already
created some previous TBF, so it was not ugpraded. Hence, we were
sometimes accessing the wrong NULL ctrg.
Let's simply check for non NULL ctrg when deciding what to print.

"""
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7561ea6 in vty_out_rate_ctr_group (vty=vty@entry=0x897850, prefix=prefix@entry=0x4482cd " ", ctrg=0x0) at utils.c:82
82    utils.c: No such file or directory.
(gdb) bt
 #0  0x00007ffff7561ea6 in vty_out_rate_ctr_group (vty=vty@entry=0x897850, prefix=prefix@entry=0x4482cd " ", ctrg=0x0) at utils.c:82
 #1  0x000000000041437b in tbf_print_vty_info (vty=vty@entry=0x897850, tbf=0x3fb61f0) at pcu_vty_functions.cpp:98
 #2  0x0000000000414acc in pcu_vty_show_tbf_all (vty=vty@entry=0x897850, bts=bts@entry=0x7be650, flags=4294967295) at pcu_vty_functions.cpp:127
 #3  0x000000000041206f in show_tbf (self=<optimized out>, vty=0x897850, argc=<optimized out>, argv=0x7fffffffe040) at pcu_vty.c:1150
 #4  0x00007ffff755d167 in cmd_execute_command_real (vline=vline@entry=0x7bc300, vty=vty@entry=0x897850, cmd=<optimized out>) at command.c:2604
"""

Related: SYS#5689
Change-Id: I3979bfc12dd3b9a53b34b284537f271c356a3024
2021-11-05 20:44:39 +01:00
Pau Espin 7ce56d7c64 bts: Rename 11bit RACH request counter
This way it fits better the structure where the general one counts all
rachs, and 11bit only the 11 bits. More per-type splitting will be done
in follow-up commits where new types are added.

Change-Id: Ibdfb10dcc65d71e98e2fe8b05001cafea786f071
2021-11-02 16:47:08 +01:00
Pau Espin 858f038c1c tbf_ul: Document context where tbf_alloc_ul_ccch() is used
It can be seen that this function properly passes single=true to
tbf_alloc_ul_tbf().

Change-Id: Id83bfd78c88fa9e4fa98268cc726298c276e6f20
2021-11-02 16:45:42 +01:00
Pau Espin 7e8d5ab4c4 bts: Fix misleading log line in bts_rcv_rach()
If it's not single block packets access, then it's one phase packet
access. TS 44.018 Table 9.1.8.1:
"""
One phase packet access with request for single timeslot uplink transmission;
one PDCH is needed.
"""

Change-Id: Ic6beb6dcfebb77fd264b179b028f99a29c644fb1
2021-11-02 14:08:15 +01:00
Daniel Willmann dd28f82747 gprs_bssgp_pcu: Fix crash when configuring an existing ns bind
ns_configure_nse() only sets bind when it doesn't exist yet. If it
already exists bind[i] stays NULL and causes a segfault in
gprs_ns2_is_ip_bind() later on.
This patch ensures bind[i] is either created of set to the existing
bind.

Change-Id: I103e82e6c64324c087a4ff325a83eeab0e5a4ee9
Related: SYS#4971
2021-10-29 17:34:24 +02:00
Pau Espin 9ecdc11eb6 csn1_dec.c: Fix stored bit in CSN_NEXT_EXIST_LH
Fixup for previous patch, which forgot to update the pui using the new
variable, as done already in the same patch for M_NEXT_EXIST.

Change-Id: I92a04c708bcc6c15348324321e8890361bbc5c31
Fixes: 72cdb30ee2b1c0d71ff6d9583d51f46b2e5fdcea
2021-10-20 17:21:34 +02: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 c90e6f8de1 Split csn1.c into common, enc and dec files
The CSN1 encoder/decoder code is already lengthy and complex enough,
there's no need to keep it in the same file, specially because when
debugging, only is interested in one of the 2 functions, and they both
look really similar (long spaghetti switches).

Change-Id: I7d1b1f7e6d7f89b052b3fd73a960419bb2673020
2021-10-20 13:35:44 +00:00
Pau Espin fef3da24ae pcuif: Submit data_req with len=0 as idle frames
This way PCU always answers DATA.ind and the BTS can still clearly
identify idle frames. It also simplifies testing and verification of
correct behavior.

Related: SYS#4919
Change-Id: Ife718eeed2af011479c03099ea109518f04567bc
2021-10-20 13:35:10 +00:00
Pau Espin 9f43c65c99 cosmetic: Fix typo in comment
Change-Id: I9e6d0963533e15e73fb51bed11af563a62b92ecb
2021-10-19 14:20:11 +02:00
Pau Espin affd6a7f7a tbf: Drop unneeded braces in one line condition
Change-Id: Ief5e0ea0b7146d3330a17d5f0d171755b576fca3
2021-10-18 16:44:19 +02:00
Pau Espin e50b5f1e3f tbf: update(): return negative val on error
Let's follow usual convention where errors are returned as negative
values.

Change-Id: Ib4f4dc37ae82ba8efdc212ed85af7934e16a8a8d
2021-10-18 16:13:51 +02:00