Commit Graph

1421 Commits

Author SHA1 Message Date
Vadim Yanitskiy ef919cb8c1 fix inp_sig_cb(): dispatch TS_EV_OML_DOWN to all transceivers
When running a multi-trx setup, upon stopping osmo-bts one can see:

  DCHAN ERROR lchan_fsm.c:80 lchan(0-1-7-TCH_F-0)[0x612000010120]{UNUSED}:
              (type=NONE) lchan allocation failed in state UNUSED: LCHAN_EV_TS_ERROR
  DCHAN ERROR lchan_fsm.c:144 lchan(0-1-7-TCH_F-0)[0x612000010120]{UNUSED}:
              (type=NONE) lchan activation failed
              (lchan allocation failed in state UNUSED: LCHAN_EV_TS_ERROR)

These messages show up when the following conditions are met:

  * BTS model speaks A-bis over IP (ip.access, e.g. nanoBTS), and
  * BTS has more than one transceiver configured.

The problem is that unlike traditional E1 based BTS models, ip.access
ones have a single global A-bis/OML link for all transceivers.  Thus
when it goes down, in inp_sig_cb() we need to notify all timeslots
*of all TRXes*, not just TRX0.

Change-Id: I3dc657ac5a2c5334747bd4f4db1a658acb323942
Fixes: OS#5479
2022-03-09 08:30:40 +00:00
Neels Hofmeyr 9d0af34fc5 fix typo in name of BSS_MAP_MSG_ASSIGNMENT_RQST
Historically, we first only had
  BSS_MAP_MSG_ASSIGMENT_RQST
                   ^
with missing N. libosmocore has this renamed a long time ago and
provides a shim #define that makes the typo version still work.
Having the typo is bad for grepping, so rather use the non-typo name.

Also rename the constant for the ass req counter which so far has a
similar typo, and fix the same typo in the counter description.

The counter name exposed on CTRL luckily doesn't have this typo in it.

Change-Id: Ieaa4f4e6e6f7e1563b1bd15a83f0c1a9112d2312
2022-03-09 07:15:51 +00:00
Neels Hofmeyr c60fabb62b fix extraneous newlines in ho_fail() invocations
The ho_fail() macro includes a newline, so the callers should not add
one. Fix these cases where the extra '\n' fragments the logged message.

Related: SYS#5839
Change-Id: Ifdbce98be70c1aa127ae008d7a77b9795fd250d3
2022-03-09 07:15:51 +00:00
Neels Hofmeyr 826ec9ff75 inter-BSC incoming HO: store Codec List (MSC Preferred)
So far we completely ignore the codec list from the MSC in Handover
Request messages. This leads to error messages in subsequent handovers
because there is no Codec List stored on the conn:

  DHODEC ERROR handover_decision_2.c:390 [...] No Speech Codec List present, accepting all codecs

Besides the error log, in hodec2 we may subsequently take bogus or
unexpected codec decisions, ignoring the MSC's choice of codecs, or in
the worst case picking an unsupported codec.

This also has implications on what type of lchan we choose for handover
target in hodec2: say, if no half rate codec is supported as per the
MSC's request, we normally avoid handover to a TCH/H, etc.

Intra-BSC HO after an Inter-BSC incoming HO is the only case where this
problem occurs, in every other scenario there is an Assignment Request
from the MSC, from which we properly store the MSC's codec list.

3GPP TS 48.008 does indicate that on AoIP this codec list shall be
included. So reject HO Request with missing Codec List, as we already do
for Assignment Request on AoIP.

This makes TTCN3 BSC_Tests for inter-BSC incoming HO fail, because our
tests so far omit the Codec List (MSC Preferred) on AoIP. The related
fix of the tests is If06de9c9b43d79f749447a4e2a340176eef75c79.

Related: SYS#5839
Depends: If06de9c9b43d79f749447a4e2a340176eef75c79 (osmo-ttcn3-hacks)
Change-Id: I117cc29d6d11db77d160de654f43f5993db6ee21
2022-03-09 07:15:51 +00:00
Neels Hofmeyr 49a4820fc6 tweak error msg: s/inter-BSC MT/inter-BSC incoming
"inter-BSC MT" was the terminology of an early development stage of
inter-BSC handover, code review requested "incoming" instead. This one
was missed when applying code review.

Same in a code comment.

Related: SYS#5864
Change-Id: I1ca810542e89980ffda11876fd30626467e452d1
2022-03-09 00:01:06 +01:00
Neels Hofmeyr 908f014f09 support "empty" SCCP N-Connect from MSC
Teach osmo-bsc to handle empty N-Connect. So far we were always
expecting user data in an SCCP N-Connect from an MSC. However, it is
perfectly valid for an initial BSSMAP request to follow later.

This is relevant for:
- Handover Request (incoming inter-BSC handover)
- Perform Location Request (query physical location of the MS)

Add state WAIT_INITIAL_USER_DATA with new timeout net X25. Always enter
this state so that we don't have two separate code paths for handling
initial user data.

Related: SYS#5864
Change-Id: I535c791fa01e99a2226392eb05f676ba6c3cc16e
2022-03-09 00:01:06 +01:00
Neels Hofmeyr bdead6e87a add counter for inter-BSC incoming Handover Request
Related: SYS#5864
Change-Id: Icdde2bb339a5e367a4d297802214a1ef3f36eefa
2022-03-09 00:01:06 +01:00
Neels Hofmeyr d10d07b6e3 add missing counter increment for Perform Location Request
Also increment message counter for the case that a Perform Location
Request came in the initial SCCP N-Connect message.

Related: SYS#5864
Change-Id: I3f78ce73eb16fdff1f19359963405b2235000fc4
2022-03-08 23:00:21 +00:00
Vadim Yanitskiy 66a46ffa6a Fix description of BTS_CTR_BTS_RSL_FAIL: s/OML/RSL/
Change-Id: Icc3e603b08ab81869955ffa5b16ddfb458e83c78
Related: OS#4848
2022-03-06 20:20:47 +03:00
Neels Hofmeyr 1f089842a8 silence bogus error: event not permitted: READY_TO_SWITCH_RTP
During inter-BSC incoming handover, there is no previous lchan to be
switched, so this event always comes in the READY state of
lchan_rtp_fsm. No need to complain about that and confuse log readers.

Related: SYS#5864
Change-Id: I96fd53b8c8da621a40bd65f85070eabd030cc875
2022-03-03 23:19:46 +00:00
Neels Hofmeyr e761affc6a tweak logl to ERROR for invalid initial BSSMAP
Related: SYS#5864
Change-Id: Idd7d763129a5acdf19cd0ae86e82b77ee0073f2f
2022-03-03 22:22:12 +00:00
Vadim Yanitskiy df58a69bde bitvec2freq_list(): fix handling of E-GSM ARFCNs
According to 3GPP TS 44.018, section 10.5.2.1b.2, only ARFCN values
in range 1..124 can be encoded using the 'bit map 0' format.  Before
this patch, ARFCN values belonging to E-GSM band (0, 975..1023) were
ignored in bitvec2freq_list(), and thus not present in the resulting
Cell Channel Description IE.

Change-Id: I17739e6845cd84e2a81bc406dd532541f7c52cb6
Related: SYS#5854
2022-03-03 09:43:27 +00:00
Vadim Yanitskiy d1cacced51 bitvec2freq_list(): determine empty set by checking the ARFCN count
I find it cleaner to relay on the counter ('arfcns' in this case) to
check if the set is empty, rather than checking one of the resulting
values ('max').  There is just a cosmetic change.

Change-Id: I29ca51461beec053bcb8b8210f0ad24bb8c7765f
Related: SYS#5854
2022-03-03 09:43:27 +00:00
Vadim Yanitskiy 82aebfeacf system_information: fix unused 'mask' parameter in list_arfcn()
The callers of this function do pass different mask values, which
should be passed to gsm48_decode_freq_list().  Instead, 0xce was
passed regardless of the given mask value.

Change-Id: I47f2eab54ef8487b14992fd7a69d5c9ccbb3f5cf
2022-03-03 09:43:27 +00:00
Pau Espin 8f1597135d ipa oml: Fix encoding of T3105
As the comment above the fix suggest, the encoding is in 10ms units.
osmo-bts is also doing the proper:
"""
uint8_t t3105 = *TLVP_VAL(&tp, NM_ATT_BTS_AIR_TIMER);
bts->t3105_ms = t3105 * 10;
"""

Related: SYS#5838
Change-Id: Ie190514ee35d1ca81b70e9180bf7393b973d3504
2022-03-02 17:34:43 +01:00
Neels Hofmeyr 9972978365 inter-BSC HO in: add Codec List (BSS Supported) IE to HO Req Ack
Related: SYS#5839
Depends: Iab0a7b4d81592157fc111d1adb9e9f4cb53a94e9 (libosmocore)
Change-Id: I3c0576505a3ceb3cd5cc31dc69c5bc4a86a4ea08
2022-02-28 11:53:37 +01:00
Neels Hofmeyr c9c90cda71 inter-BSC HO in: add Speech Codec (Chosen) IE to HO Req Ack
Related: SYS#5839
Change-Id: I1d0b395c97145b5aa1af4ef67aec9338d2f8f43b
2022-02-28 11:53:25 +01:00
Neels Hofmeyr 0a704ee857 inter-BSC HO in: add speech IEs only on speech mode lchans
Related: SYS#5839
Change-Id: I830654f419e6f0a196dc6d3e58422e00b324af9e
2022-02-23 16:23:38 +01:00
Neels Hofmeyr ec8c1dd11e cosmetics around select_best_cipher()
Improve the function doc. Remove a comment at a caller, because that
information is what the function doc is for.

Rename the array to codec_by_strength, because it is not the codec
strength but the codec number listed in the array.

Related: SYS#5839
Change-Id: Iaed6b97c31e4ccb1f28ca7e64596d5e20563b392
2022-02-22 11:26:51 +00:00
Neels Hofmeyr 8bacb71c90 fix inter-BSC-in handover encryption
In the field we saw Handover Requests without any Chosen Encryption
Algorithm IE, and osmo-bsc completely failed on those. This made me
understand my mistake from when I wrote this handover code.

So far, from a BSSMAP Handover Request, we (I) used only the Chosen
Encryption Algorithm IE to pick the encryption to use on the target
lchan. That is very wrong.

Instead, figure out the intersection of permitted algorithms MSC & BSC,
and pick the best of those. Which means, actually, completely ignore the
Chosen Encryption Algorithm IE.

In the message, the permitted algorithms are passed as a bitmask. The
current code using gsm0808_dec_encrypt_info() passes this on as an
array. In order to select_best_cipher(), I could convert that array back
to a bitmask. Instead pass the bitmask on from message decoding
alongside the struct gsm0808_encrypt_info in req->ei_as_bitmask.

In handover_end(), change the condition so that we can also pass
HO_RESULT_FAIL_RR_HO_FAIL to emit a Handover Failure.

Related: SYS#5839
Change-Id: Iffedc981b60d309ed2e5decd5efedee07a757b53
2022-02-22 11:26:45 +00:00
Neels Hofmeyr a0fb37906d rename RSL_ENC_ALG_A5 to ALG_A5_NR_TO_RSL, clarify
The naming confused me so that I wrote buggy code again. Hopefully this
clarifies which representations the code paths are using.

In the macro code, highlight the error case of n <= -1 explicitly.

Also add ALG_A5_NR_TO_PERM_ALG_BITS. I need the 1<<n case in an
upcoming patch.

Related: SYS#5839
Change-Id: I7557ae97764bba09c906748a18e9031dfb362611
2022-02-18 13:21:56 +01:00
Pau Espin 3900aae7a3 bts: Add explicit switch case for Cell Id SAI
This patch imposes no logical change in the code on itself, but makes
sure people compiling osmo-bsc uses an old enough libosmocore
implementing Cell Identifier SAI. This is important since adding the SAI
ID (CELL_IDENT_SAI) displaced CELL_IDENT_WHOLE_GLOBAL_PS to a new
number outside of the 3GPP range for cell IDS (4 bits, this way we
garantee we won't have the same problem again).

This means there was an ABI breakage (see Depends below).
As a result, using an osmo-bsc compiled against an older libosmocore
, and then using at runtime against a newer version of libosmocore, will
most probably provoke some RIM features to not work properly, since
libosmocore will handle CGI-PS cell ids sent by osmo-bsc as SAI ones,
and most probably do wrong comparisons when matching (they only match up
to LAI included).

ABI break analysis:
osmo-bsc uses CELL_IDENT_WHOLE_GLOBAL_PS in:
* gsm0808_dec_cell_id_list2() -> this is called on stuff received from the
				 network, so it's actually fine handling it
				correctly as CELL_IDENT_UTRAN_SAI instead
				of CGI_PS.
* gsm0808_cell_id_list_add
	same_cell_id_list_entries
		gsm0808_enc_cell_id_list2
			cell_id_to_cgi-> On old osmo-bsc, When
					 CELL_IDENT_WHOLE_GLOBAL_PS is passed
					 to be encoded as CGI, RAC byte is
					 taken for encoding instead of 2nd CI byte.
* gsm0808_cell_ids_match
	gsm0808_cell_id_u_match
		cell_id_to_cgi -> If CELL_IDENT_WHOLE_GLOBAL_PS as 0x11
				  (CELL_IDENT_UTRAN_SAI), 1 byte offset when
				  comparing (1 byte of RAC is taken converting to
				  CGI instead of the 2nd byte of CI). That means
				  match would be wrong if 2nd byte of CI differs.

Related: SYS#5838
Depends: libosmocore.git Change-Id Id25e563febdb7640174540136225f399515a0089
Change-Id: I70972efffefd57fd36332fab539683696c32f4a5
2022-02-16 18:55:21 +01:00
Philipp Maier 49865023c9 bssmap_reset: make T4 user configurable
The timer (T4) that controls the re-sending of the BSSMAP RESET can not
be changed via the VTY, althrough it is defined via a tdef struct. Lets
add a description along with default values to make it configurable via
the VTY.

Change-Id: I1fb5699220ab8a643a168567a89c6f381fe433a7
Related: SYS#5796
2022-02-08 11:51:42 +01:00
Philipp Maier 99f97ee90f nm_bts_fsm: fix sourcecode formatting
Change-Id: If7db7f5611e0ebf69d66b135515c0a08c6edfb11
2022-01-17 11:29:02 +01:00
Pau Espin 326ee2ea49 Fix DLCI CC bits transmitted in SAPI "n" REJECT
The SAPI "n" REJECT messages were being sent with DLCI keeping the RSL
LINK ID format, which is not the same for CC bits.

With this patch, TTCN3 test BSC_Tests.TC_rll_sapi_n_reject_dlci_cc
passes again.

Related: OS#4728
Related: SYS#5047

Change-Id: Icc187f594743040a3d9b8beff7d9cfc21dd6eb08
2022-01-13 06:08:02 +00:00
Neels Hofmeyr 47d38f9967 gscon clear: without SCCP conn, no need to wait for RLSD timeout
Skip the BSSMAP Clear and SCCP RLSD parts and immediately deallocate the
gscon when there is no SCCP connection present. Before this patch, such
conn would stick around for a minute before a timeout deallocates it.

Related: OS#5337
Change-Id: I8c8537acf6b47b121903197608636c43ae601a57
2022-01-12 22:42:16 +06:00
Neels Hofmeyr 53b23c252e fix gscon clear 3/n: separate state for SCCP RLSD
Properly implement the separate conn release stages in separate FSM
states:

x) sent Clear Request, wait for a Clear Command from the MSC.
   Timeout after a configurable 60s.

y) after a Clear Command and sending a Clear Complete, wait for the SCCP
   RLSD. Timeout after a configurable 60s.

z) terminate after the RLSD is received / after timeout.

handover_test.c needs a little tweak to make the MGCP release work with
its fake MGCP client, because cleanup now ensures to invoke
gscon_forget_mgw_endpoint() in all cases.

Related: I680ec4ed866aa5f0b1ff29e7e98322615cfb288d (osmo-ttcn3-hacks)
Related: OS#5337
Change-Id: Ie975117d37f38ba853589dc7f8d3e94f8f9586b2
2022-01-12 22:41:33 +06:00
Neels Hofmeyr c2dba7c5b9 fix gscon clear 2/n: proper state transition to ST_CLEARING
The way the ST_CLEARING is entered before this patch has various
symptoms of how I / we used osmo_fsm when we were still FSM amateurs in
Osmocom. Patch that up:

- In gscon_bssmap_clear(), ask for a state transition to ST_CLEARING
  first. Go ahead only if it is allowed.

- move the Clear Request messaging to ST_CLEARING's onenter function.

- Fix the timeout behavior: by using conn_fsm_state_chg(), use the
  actual proper X4 timer value for ST_CLEARING from VTY configuration
  instead of hardcoded magic numbers.

Related: OS#5337
Change-Id: I234b2a754d0c98031056981823cdbc187e977741
2022-01-04 13:33:26 +00:00
Neels Hofmeyr c984dc1a86 fix gscon clear 1/n: store clear cause in gscon
Allow returning a context sensitive cause instead of a hardcoded one in
gscon pre_term().

Also, the conn->cause is needed to move message dispatch to an "onenter"
function in patch I234b2a754d0c98031056981823cdbc187e977741. I Split
this part off as a separate patch for better readability.

Related: OS#5337
Change-Id: Ib6432746040899129d1d73ae8dc59add2d88a915
2022-01-04 13:33:26 +00:00
Neels Hofmeyr bd1eac2fb2 lcs: fix bsc_subscr use_count leak
In lcs_ta_req_wait_ta_onenter(), fix use count leak of 'start-paging':
get() the use count only after the early exits.

osmo-ttcn3-hacks patch I69d4c5c6f8d499bb7f0b96a48af045361433c57b
introduces testing against this leak in various LCS tests (e.g.
BSC_Tests.TC_lcs_loc_req_for_active_ms_ta_req).

Related: OS#5355
Change-Id: Ibbfbfe766eafe42c78048ec5b3b503a11ef5535d
2022-01-04 13:33:26 +00:00
Neels Hofmeyr 3b4b7c1efd lchan/gscon: always clear both cross ref pointers
During specific release scenarios, it became clear that an lchan still
pointed at a conn even after it had been deallocated. That was due to
setting conn->lchan = NULL but not lchan->conn = NULL. Fix that.

Do lchan_forget_conn() first, because during gscon_forget_lchan() we may
enter the gscon clearing dance, which in case of no SCCP conn being
present will soon / should immediately deallocate the conn.

Related: OS#5337
Related: I8c8537acf6b47b121903197608636c43ae601a57 (osmo-bsc)
Change-Id: Idbfe4672233ba8105eff5ba77ee07fd871358255
2022-01-04 13:33:26 +00:00
Neels Hofmeyr 9aed5f541f log: always include timeouts in FSM transition logging
Before:
  state_chg to ACTIVE
  state_chg to WAIT_RLL_RTP_RELEASED
  state_chg to WAIT_SCCP_RLSD

After:
  State change to ACTIVE (no timeout)
  State change to WAIT_RLL_RTP_RELEASED (T3109, 5s)
  State change to WAIT_SCCP_RLSD (X4, 60s)

Change-Id: I94b7dc4d9e5e45dc731bcb3a843ede9fb6cc0839
2022-01-04 13:33:26 +00:00
Harald Welte d3b0db5515 om2000: Don't print "should not generate any message" on FAULT_REP
Change-Id: I65184ef5aa90a993491f9393614bb499c6998169
Closes: OS#4643
2022-01-04 13:08:20 +00:00
Harald Welte 9f53838c58 om2000: Don't print "should not generate any message" on CAL_TIME_REQ
Change-Id: Ic6f576250d56707cf325886d70209a3744163d79
Closes: OS#4670
2022-01-04 13:04:22 +00:00
Harald Welte 6e250bbf82 om2000: Fix memory leak in OM2000 message handling
Change-Id: I7a94320f3b3af65003df67c11fe7221dfc7d7d62
2022-01-02 15:15:25 +01:00
Philipp Maier 9b844df27b bts: fix sourcecode formatting (excess whitespace)
Change-Id: Ie4fad0426d1d089156481806a05982a24375b766
2021-12-20 15:29:52 +01:00
Philipp Maier 2544c1058c bts: add missing return -EINVAL statements
The checks that make sure that an ARFCN falls in the correct range do
not return with -EINVAL as they should, instead nothing happens. (Only
the check for GSM1800 is corrct)

Change-Id: Iddadafe3fbc47e2f980d8e4ab4f320998cb454ff
Related: SYS#5369
2021-12-20 15:29:25 +01:00
Oliver Smith 260eb1d256 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: Ifbbafe185931c0f508ff8148ef244f25a9620fd8
2021-12-14 12:51:44 +00:00
Philipp Maier 3ba9bd7c35 abis_nm: actively block BTSs with invalid configuration
At the moment the BTS configuration is checked, but the check does not
have much consequence other than that some initialization that is not
executed. The BTS will go into the OML bootstrap phase anyway and most
likely fail at some later point due to the invalid configuration. To
reduce noise and unexpected behaviour of the BTS lets make sure that the
OML boostrap phase can only proceed when the BSC conciders the
configuration as valid.

Change-Id: I42c1c26a9b800600787b1266a871f95f2114c26e
Related: SYS#5369
2021-12-13 18:03:12 +01:00
Neels Hofmeyr 67fb8b7c17 fix assignment success counters: count *before* cleanup of fsm state
Counting the Assignment success after osmo_fsm_inst_term() meant that we
were counting a cleared out channel mode, which always yielded
signalling mode.

Count the Assignment success *before* terminating, so that we correctly
count the successful assignment as speech mode.

Related: SYS#4878
Related: Icb1386ec2ccd70eb3c026301b9b08ad7177278f7 (osmo-ttcn3-hacks)
Change-Id: Ie9fcd1e86f27ecb2f11e2e8813faac365cb470b8
2021-11-30 14:19:11 +01:00
Neels Hofmeyr c309754ff9 dbg log: also log assignment counters on BTS level
Change-Id: I68b3e794ddf97c80f647c3536ec466217b338af9
2021-11-30 14:19:07 +01:00
Neels Hofmeyr fdf2262968 fix chreq:* counters: typos in chreq:successful_* constants
Related: SYS#4878
Related: I17a7702b151ac03fd9f7ecd6927ef42133aad953 (osmo-ttcn3-hacks)
Change-Id: I1fde77d5d5920093ab037184eb3518876804353d
2021-11-30 14:19:05 +01:00
Neels Hofmeyr 33e687a97e dbg log: abis_rsl print_meas_rep(): clarify rxlev
Change-Id: Ia2c1d59eac556b8f6a56c39abf12b35a3ba807eb
2021-11-29 15:10:49 +00:00
Oliver Smith 2df65db3da stats: add bsc.paging:expired
Similar to paging:attempted, count paging:expired not only per BTS, but
also for the whole BSC. Add active_paging_requests to struct bsc_subscr,
to increase the counter only once if paging expires, and not once per
BTS where paging expired.

Related: SYS#4878
Change-Id: I9c118e7e3d61ed8c9f1951111255b196905eba4d
2021-11-29 11:33:34 +01:00
Oliver Smith 61e041d92a Cosmetic: osmo-bsc/osmo_bsc_bssap: fix formatting
Change-Id: Icc4947e68fa46aab180f2047231e51b997cca71b
2021-11-29 11:28:10 +01:00
Pau Espin 90b689b577 Disable C/I based MS Power Control Loop by default
osmo-trx-uhd with a B200 has proven to provide bad (lower than usually
considered good) C/I values due to high noise (even with band filters in
place). Hence, default thresholds (gathered from literature on the topic)
are too high and end up in bad algorithm output decisions.
Furthermore, most users of Osmocom don't use it in densely populated
areas, hence RXLEV based algorithm used when C/I based one is disabled
is good enough.
Let's disable C/I based one by default, and let advanced users which
specific needs to enable and confiure thresholds specifically for their
needs (hardware, cell surrounding conditions, etc.).

Related: SYS#4917
Change-Id: If1a73c60695379bcfcd0f44c6ec6dd659563e279
2021-11-25 14:50:04 +01:00
Neels Hofmeyr 88f3c05202 hodec2: fix segv for inter-BSC ho target
Related: OS#5324 SYS#5259
Change-Id: I5a3345ab0005a73597f5c27207480912a2f5aae6
2021-11-24 19:22:34 +00:00
Oliver Smith 80afda444e bsc_subscr_conn_fsm: fix crash if !conn
Do not crash in gscon_ensure_mgw_endpoint() if conn is NULL.

Related: SYS#5728
Change-Id: Id579243cc9ebbe8f315cd11754166970329dc9cf
2021-11-24 14:38:10 +01:00
Philipp Maier 72bbdfcd35 abis_nm: use struct sdp_firmware from libosmocore
abis_nm locally declares its own struct for the ipaccess firmware
header, even though libosmocore defines it as well. Lets use the
definition from libosmocore.

Change-Id: I69cb45fc40bd20ea2533cc8cd6a68363b59cc408
2021-11-19 11:43:07 +01:00
Philipp Maier 0505e35cb7 abis_nm: fix typo
Change-Id: I2cb7b986db9d394db2c912247db861704d2c7c23
2021-11-19 11:43:00 +01:00
Neels Hofmeyr d13ef633d2 move time_cc to libosmocore osmo_time_cc
Related: SYS#4878
Depends: Iabb17a08e6e1a86f168cdb008fba05ecd4776bdd (libosmocore)
Change-Id: Ica9f908a1a30f334a24c59471affa11225117e12
2021-11-16 12:06:53 +01:00
Philipp Maier 7f7c83a7de osmo_bsc_main: move generate_ma_for_bts() into bootstrap_bts()
The function generate_ma_for_bts() is called when the OML TEI comes up.
In the same code path boostrap_bts() is called as well. It would be more
logical to call generate_ma_for_bts() from boostrap_bts() since it is
also part of the bootstrapping process.

Change-Id: Ib2ed5b1eac3701cfb3a3e8dd478488ba5404d1fd
Related: SYS#5369
2021-11-15 13:34:15 +01:00
Philipp Maier 4b706fa15d osmo_bsc_main: call bootstrap_bts when OML TEI comes up
At the moment check_bts and bootstrap_bts is called only once on startup.
When a new BTS is set up during runtime bootstrap_bts, nor check_bts is
called. This means that some parameters of the BTS stay uninitalized
until osmo-bsc is restarted. Lets rather call check_bts() and then
bootstrap_bts() when the OML TEI of the BTS comes up.

Change-Id: Ie599f809623efd6ea4ab3f39294195fc1ef84b85
Related: SYS#5369
2021-11-15 13:34:15 +01:00
Vadim Yanitskiy c122c10f34 [overpower] By default, permit only for speech channels using AMR
Change-Id: I087025f9db59348f2f70d4a291f8d887644d6b17
Related: SYS#5319
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy 335361fbeb [overpower] Allow configuring specific channel mode(s)
Change-Id: I34d29d7d0f66c629367f3d6e8a660e199ecbe080
Related: SYS#5319
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy 820b30d8c6 abis_rsl: s/*_acch_cap_for_bts/put_*_acch_cap_ie/g
Change-Id: I663023adb4f2381d4b8debb01786801803b3d741
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy 92442c9309 abis_rsl: {rep,top}_acch_cap_for_bts(): make *lchan const
Change-Id: I3e71bb88db7b1eadff5a73fdb98fe7eee2fc2540
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy f59abedb24 struct gsm_bts: s/temporary_overpower/top_acch_cap/g
Let's have a short and consistent naming for both ACCH repetition
and temporary ACCH overpower structures, like it's done in osmo-bts.

Change-Id: I39b98dcd14219402959646524315d5afea7c08cf
Related: Ib1d51f91139b4c2fe794e37fc8543b2d7a9b9c07
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy c8bd1eeaca struct gsm_bts: s/repeated_acch_policy/rep_acch_cap/g
Let's have a short and consistent naming for both ACCH repetition
and temporary ACCH overpower structures, like it's done in osmo-bts.

Change-Id: Ia12c83ad1af4744ce28ba655ac806784f746e88a
Related: Ib1d51f91139b4c2fe794e37fc8543b2d7a9b9c07
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy e0b9a7fb6c bts_vty: fix tabs-vs-spaces issues in cfg_bts_rep_dl_facch
The linter (executed by Jenkins) complains:

  src/osmo-bsc/bts_vty.c:653: ERROR:CODE_INDENT: code indent should use tabs where possible
  src/osmo-bsc/bts_vty.c:654: ERROR:CODE_INDENT: code indent should use tabs where possible
  src/osmo-bsc/bts_vty.c:656: ERROR:CODE_INDENT: code indent should use tabs where possible
  src/osmo-bsc/bts_vty.c:657: ERROR:CODE_INDENT: code indent should use tabs where possible

and blocks changes, adding V-1 when I am changing the related code.

Change-Id: If3c8c09ddff7cb945425e74344ceb4da989ddffc
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy 508058ee28 abis_rsl: cosmetic: fix coding style rep_acch_cap_for_bts()
The linter (executed by Jenkins) complains:

  src/osmo-bsc/abis_rsl.c:543: ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)"

and blocks changes, adding V-1 when I am changing the related code.

Change-Id: I0cf00ff898e69734850659e8ba0e2ff023f9b2dd
2021-11-15 11:59:03 +00:00
Vadim Yanitskiy 836947918c abis_rsl: simplify checking if channel mode is AMR
Change-Id: If933ce0fa0a162c4518ddab840f186ebaa1bcff9
2021-11-15 11:59:03 +00:00
Pau Espin c672ed8428 Properly handle dyn TS TCH with vamos after updating subslots_per_pchan
In the case of ts->pchan_from_config=GSM_PCHAN_OSMO_DYN,
ts->max_primary_lchans will be 8 due to SDCCH8 support, and we don't
want to set lchan->vamos.is_secondary=true for lchans at the end of the
array.

Related: OS#5278
Change-Id: If86af5fafe059d5e830c1f6d37034f7325d9a96c
2021-11-15 09:49:41 +00:00
Philipp Maier 9a310f818f osmo_bsc_ctrl: make sure strtok results are checked
The function set_bts_loc does not check the string pointers resturned by
strtok_r. In this particular case this is not a problem because the
function set_bts_lock will only see verfied input. However, lets check
the results anyway to avoid creating false positives in coverity scan.

Change-Id: Ie21c392e0405fc45811c6d55bf5508e9eb6784de
Fixes: CID#240849
2021-11-11 09:00:39 +00:00
Neels Hofmeyr a249babf20 implement bts.N.cm_serv_rej:<cause> rate counters
Related: I0214b27da18af87eca9715ebf7eeeff945e3e12a (osmo-ttcn3-hacks)
Related: SYS#4878
Change-Id: I79b1261e5a281d9797eaaf9c27d90edd8e27c78b
2021-11-10 17:53:44 +00:00
Philipp Maier c5b16956a7 osmo_bsc_main: move inp_sig_cb() below check_bts and bootstrap_bts
In order to be able to call check_bts() and bootstrap_bts() from
inp_sig_cb(), we must move it below bootstrap_bts.

Change-Id: I1a365bc2278368ec1f5c0db3f3e466b124b16e83
Related: SYS#5369
2021-11-10 15:35:09 +01:00
Philipp Maier 1140216a88 osmo_bsc_main: separate checks from bootstrap_bts
The function bootstrap_bts does a few checks before it does the actual
initialization. To make the code more modular, lets split the function
into two functions, check_bts and bootstrap_bts. Also be sure that we
print the BTS number when the check failes.

Change-Id: Id2b26f147d2f35e156e2da8ee58d2bbbb93de4ac
Related: SYS#5369
2021-11-10 14:33:26 +00:00
Philipp Maier c2a10a739b osmo_bsc_main: bootstrap_bts: print errornous ARFCN number
The function bootstrap_bts verifies that the ARFCN number is within the
valid range of the current band. In case of error it prints that the
ARFCN is out of range, but it does not print the BTS number, nor the
ARFCN number.

Change-Id: I432448b4bd5ea1a209838a6c5105cc1e9f7d80ee
2021-11-10 14:32:58 +00:00
Neels Hofmeyr aa09938d2c implement all_allocated:{static_sdcch,static_tch} rate counters
Same as all_allocated:{sdcch,tch}, but already trigger when all
non-dynamic timeslots are allocated.

Related: SYS#4878
Related: Ib3997a827c9cc43d1361bb0cf3bfab9f6d91bf82 (osmo-ttcn3-hacks)
Change-Id: I2fa14531f16d3f07085620f1c50eb839c420da6a
2021-11-10 13:27:43 +00:00
Neels Hofmeyr 41f143827d implement all_allocated:{sdcch,tch} rate counters
Based on allAvailable{SDCCH,TCH}Allocated performance indicators, see
3GPP TS 52.402.

Related: SYS#4878
Related: Ib3997a827c9cc43d1361bb0cf3bfab9f6d91bf82 (osmo-ttcn3-hacks)
Change-Id: I8b06e435a224c8708cd6c67e97ee5413718fc1ed
2021-11-10 13:27:43 +00:00
Neels Hofmeyr e0458c2e00 add time_cc API: cumlative counter for time, reported as rate_ctr
This is a candidate for adding to libosmocore (as osmo_time_cc), but
let's first use this in osmo-bsc to make sure that it works as intended.

I started out expecting to be done with this in half an hour, but I
found out that accumulating elapsed time to an integer counter has a
staggering amount of complexity to it, and a million pitfalls.

The intended use is to report allAvailableSDCCHAllocated and
allAvailableTCHAllocated performance indicators in OsmoBSC. Hopefully
this will also be generally useful elsewhere, to be worth the effort.

Related: SYS#4878
Change-Id: Icdd36f27cb54b2e1b940c9e6404ba9dd3692a310
2021-11-10 13:27:43 +00:00
Neels Hofmeyr e455f0ab02 refactor lchan counting
Add chan_counts_for_trx() and chan_counts_for_bts(). Drop
bts_count_free_ts() and trx_count_free_ts().

Rationale:

The bts_count_free_ts() and trx_count_free_ts() always returned the
number of free lchans, not timeslots. Hence, passing the pchan type as
argument never really matched the semantics.

Especially, when looking for free SDCCH, there is no clear match on a
gsm_phys_chan_config enum value: SDCCH8_SACCH8C, CCCH_SDCCH4,
CCCH_SDCCH4_CBCH, SDCCH8_SACCH8C_CBCH? -- GSM_LCHAN_SDCCH is clear.

==> Rather count free lchans by enum gsm_chan_t.

Counting lchans of distinct types required separate iterations for each
lchan type.

==> Rather compose an array of counts for all types, in one go.

I need to count the amount of free SDCCH lchans in an upcoming patch to
implement the performance indicator allAvailableAllocatedSDCCH (cumulate
time for which no SDCCH are available).

To implement allAvailableAllocated{SDCCH,TCH}, I need a count of both
the used as well as the total lchans for a type: it does not make sense
to flag "all available allocated" if none are ever available.

To properly count dynamic ts, I need the maximum total that can be
possible at any time. And to count currently free lchans, I need the
current total. This may seem counter intuitive, but consider, e.g.:

- Obviously, if a cell has only static TCH/F timeslots, it does not make
  sense to flag that all available TCH/H are occupied, because no TCH/H
  are available ever. Just stating this as contrast to dyn TS.

- If a cell has OSMO_DYN timeslots, I *do* want to flag that all TCH/H
  are occupied when all dyn timeslots are fully occupied.

- If those OSMO_DYN however are all used as TCH/F, the current total of
  TCH/H becomes zero, and it seems like TCH/H should not be considered.

- To count the nr of currently free lchans, I need the currently
  possible total of lchans and the nr of occupied lchans.

So return both a maximum total and a current total of lchans. In above
example, the maximum total shows that there would be TCH/H possible.

BTW, it would be nice to keep a chan_counts array on trx, bts and bsc
level and update as channels are allocated and released, instead of
counting them all over periodically. But it's less error prone this way.

Related: SYS#4878
Change-Id: I2fb48c549186db812b1e9d6b735a92e80f27b8d3
2021-11-10 13:27:43 +00:00
Vadim Yanitskiy 5944ff07a8 gsm_data: use ascending order for interference boundaries
It's more logical to have the boundaries sorted in ascending order:

  * band 1 represents lowest interference levels,
  * band 5 represents highest interference levels.

Change-Id: Ie9bf4bf0c89418685b8ea5096332d22cfba7c521
Related: SYS#5313
2021-11-10 14:45:12 +03:00
Vadim Yanitskiy 3b0858f36b abis_rsl: permit simultaneous ACCH repetition and overpower
As stated in "GSM/EDGE Evolution and Performance", section 12.3,
both features *can* be enabled simultaneously.

Change-Id: I2189f01bd78625dab3d642597240338ee581fc98
Related: SYS#5319
2021-11-08 18:30:06 +00:00
Vadim Yanitskiy 447ca13616 abis_rsl: print_meas_rep_{buf,uni}() accept const *mr
Change-Id: I5c3e27a00cd84f102558499072965ec538f5a87f
2021-11-07 21:28:18 +03:00
Vadim Yanitskiy 70ab41e9cd abis_rsl: do not pass lchan to print_meas_rep_buf()
Change-Id: If965c7dc6b989ee758ddec0190ec1cce8363b240
2021-11-07 21:28:18 +03:00
Neels Hofmeyr d5a6dca2f9 implement incoming_intra_bsc_ho:* rate counters
We have lots of counters for intra-BSC handover *away from* a given BTS,
but still missing are counters indicating how many handovers *targeted*
a given BTS. Also count incoming HO.

Related: SYS#4878
Related: Iba229313d73fa20266f6d4eac5820579fb14c604 (osmo-ttcn3-hacks)
Change-Id: Id9f2c6e2865ebe680879018fff08d283ce24c983
2021-11-06 17:02:38 +01:00
Neels Hofmeyr a521a3fa39 tweak intra-bsc ho counter descriptions
Related: SYS#4878
Change-Id: I00eaf42fcd705cf3f4e06e8c7434fd05dbad4b84
2021-11-06 17:02:38 +01:00
Neels Hofmeyr 1d63b925f4 cosmetic tweaks on handover counting code
I was a bit confused that grep did not find HO counters being used, so
let's add some comments to better explain and provide a grep hook.

Related: SYS#4878
Change-Id: I242de13e657286e09428a8ca6e583d8b5155faa2
2021-11-06 17:02:37 +01:00
Neels Hofmeyr 8700803fa8 for linter: s/while(0)/while (0)
Change-Id: Ib422e7d1a7d543dcd8738581839ce55bb8fc29d2
2021-11-06 17:01:58 +01:00
Neels Hofmeyr 0887442c20 drop unused gsm48_tx_mm_serv_ack()
Related: SYS#4878
Change-Id: Ia9d841a8243adca347e7ea79d31e3cd65eab27ea
2021-11-05 12:01:27 +01:00
Neels Hofmeyr 96887554f9 add chreq:successful_<reason> rate counters
Related: SYS#4878
Change-Id: I32c2c197a6199617a82986480b686c515fa40d62
2021-11-05 12:01:27 +01:00
Pau Espin 5dbed8160f lchan_fsm: Fix possible NULL ptr dereference in _lchan_on_mode_modify_failure()
_lchan_on_activation_failure(), which calls lchan_on_mode_modify_failure(),
already checks for !for_conn in other paths. Hence, it can be that
for_conn being passed to _lchan_on_mode_modify_failure() may be null.

"""
 Stack trace of thread 7077:
 #0  0x000055d25a463842 _lchan_on_mode_modify_failure (osmo-bsc)
 #1  0x000055d25a46b57c _lchan_on_activation_failure (osmo-bsc)
 #2  0x00007fe8b2083be4 state_chg (libosmocore.so.17)
 #3  0x00007fe8b208409d _osmo_fsm_inst_state_chg (libosmocore.so.17)
 #4  0x000055d25a46825a lchan_fsm_wait_rll_rtp_establish (osmo-bsc)
 #5  0x00007fe8b2084239 _osmo_fsm_inst_dispatch (libosmocore.so.17)
 #6  0x00007fe8b2083be4 state_chg (libosmocore.so.17)
 #7  0x00007fe8b208409d _osmo_fsm_inst_state_chg (libosmocore.so.17)
 #8  0x000055d25a46dbdc lchan_rtp_fsm_wait_ipacc_mdcx_ack (osmo-bsc)
 #9  0x00007fe8b2084239 _osmo_fsm_inst_dispatch (libosmocore.so.17)
 #10 0x000055d25a411d69 abis_rsl_rx_ipacc_mdcx_ack (osmo-bsc)
"""

Related: SYS#5698
Change-Id: If8b2895feef6e30f9c1db97394dd16d892b277f2
2021-11-05 10:26:39 +00:00
Pau Espin 93d84380e9 assignment_fsm: Log modified lchan in assignment_fsm_allstate_action()
Change-Id: I579c265e9d18402ce806e4d0ea836042185dedaa
2021-11-05 10:26:39 +00:00
Vadim Yanitskiy 140aa51ea1 rsl_tx_chan_activ(): fix manual channel activation for nanoBTS
nanoBTS would NACK a CHANnel ACTIVation message for an 'intra cell
channel change' if it does not contain the Timing Advance IE.  And
this is right, because according to 3GPP TS 48.058, section 8.4.1,
point '4)', it *must* be included.

Indeed, the actual Timing Advance value is not known during the
manual channel activation triggered from the VTY interface.  So
let's merely indicate 0 if it's not known.

Change-Id: Iee7ddb4cf1a9a7bb9b34e6c9f6f9899da480fbd0
2021-11-05 01:58:45 +03:00
Vadim Yanitskiy e74269bbe2 lchan_fsm: cosmetic: move a 'case' below the 'default' branch
It's unusual to have 'case' statements below the 'default' statement.

Change-Id: I523a6d55d9a103ba69351d9dc6d0c000a422a765
2021-11-05 01:25:00 +03:00
Oliver Smith ed10dc446d bsc_ctrl_commands: fix uninitialized value (mode)
Fixes: CID#240848
Change-Id: I571055b350d343318ef1ae469ae92475925d1910
2021-11-04 09:51:26 +01:00
Philipp Maier 3ca2ae1d0a bsc_ctrl_commands: change neighbor-list mode/arfcn via control interface
It is possible to change the neighbor-list mode via the VTY from
automatic mode to manual neighbor-list configuration. In the manual
mode, the user can add ARFCN values manually. This command can be found
under the bts node. Lets add pendant of this command on the control
interface as well.

Change-Id: Id97bc0d31a358db6221c385761773fb48670c921
Related: SYS#5641
2021-11-03 17:25:28 +00:00
Philipp Maier 085a92584f heighbor_ident: add/del neighbor cells via ctrl interface
The VTY allows flexible control over the neighbor cell information via
the neighbor command, which can be found in the configure terminal under
the bts node. Lets add pendant of this command on the control interface
as well.

Change-Id: I343a40e18fa9b91e6c381912c0426a002841e079
Related: SYS#5641
2021-11-03 17:25:28 +00:00
Philipp Maier fdcd49b081 neighbor_ident: add comment about Neighbor Address Resolution Service
The Neighbor Address Resolution Service is using the control interface
API as well. Lets add a comment to indicate that this service is not
related to the normal control interface.

Change-Id: Iec86f72548bfc54a2c86dadec69dd1c64813d852
2021-11-01 11:30:03 +01:00
Philipp Maier 298f6bff86 bsc_subscr_conn_fsm: fix mgw-pool ref counting
When the gsm_subscr_conn_fsm (GSCO) terminates abormally it might not go
through the forget-mgw-endpoint mechanism. It might be terminated
forcefully, which means only the pre_term callback runs. The pre_term
callback clears the endpoint, but it does not put the mgcp_client
reference back into the pool. This results into a wrong ref-count in the
mgw-pool.

Change-Id: I5a7ce6a1880a1060df74d03dd4eb38b51fd85c69
Related: SYS#5675
2021-10-29 05:48:43 +00:00
Philipp Maier 2537ddd23c osmo_bsc_main: remove unused option -t --testmode
The option -t --testmode is defined, but not evaluated. It seems that
the code of this option was removed long ago. Lets remove it now.

Change-Id: Ie11173f5a7aab568b9a25102ad7dcf37fd49f318
2021-10-28 12:10:38 +02:00
Pau Espin 7be36cfde6 Set subslots_per_pchan_vamos[GSM_PCHAN_OSMO_DYN] = 0
VAMOS secondary lchans are to be used specifically when the osmocom dyn
TS is set to pchan_is=TCH_{F,H}. Setting secondary subslots for
OSMO_DYN TS is not needed since it's only used to initialize the TS, and
OSMO DYN already initializes 8 subslots
(subslots_per_pchan[GSM_PCHAN_OSMO_DYN]=8). Otherwise, ts_setup_lchans()
will try to initialize 8+2 lchans on the TS, which is more than needed
and will access out of bounds in the array.

Related: OS#5278
Change-Id: I8727d5b446179c0ebcd8738507efe5a50afaf1e2
2021-10-25 19:17:51 +02:00
Pau Espin f147b5f617 timeslot_fsm: Add assert to make sure we never go out of bounds in ts->lchan array
Related: OS#5278
Change-Id: I23a5349838e0c540fbb54cad10f2af42268d7729
2021-10-25 19:17:40 +02:00
Pau Espin 410a1be79e Set subslots_per_pchan[GSM_PCHAN_OSMO_DYN] = 8
Since a while ago, osmocom types dynamic TS supports being configured as
SDCCH8, hence the maximum subslots is 8. This fixes issue where only up
to 2 subslots where being used on those TS.

Related: OS#5278
Related: SYS#5309
Fixes: 52b9912ef9
Change-Id: I50e6530284ef49cfd77d1944d4a183c5df345820
2021-10-25 13:43:48 +02:00
Vadim Yanitskiy b599a8baac [overpower] VTY: add more ACCH overpower related parameters
The new fields in 'struct abis_rsl_osmo_temp_ovp_acch_cap' allow:

  * selectively enabling SACCH and/or FACCH,
  * setting the RxQual (BER) threshold.

Change-Id: Ia2e01e11d718ea0ba2a7e49ae2b871d57991f31c
Depends: Ia28293a12de0af71f55e701fb65c46e905dae217
Related: SYS#5319
2021-10-24 13:55:51 +03:00
Vadim Yanitskiy 014f6232d5 [overpower] VTY: fix copy-pasted warning message
Change-Id: Ie0bc0b503c7c7e893b5c94597c84c47fa881874d
Related: SYS#5319
2021-10-21 18:12:04 +00:00
Vadim Yanitskiy 63cc810acc [overpower] VTY: cosmetic: fix lower case in command description
Change-Id: Iadce870b599b4af4269b9026bd8fbe746f1f4979
Related: SYS#5319
2021-10-21 18:12:04 +00:00
Philipp Maier 72c735603e osmo_bsc_main: remove not longer needed fixme note
It is not possible to operate a cell that has secondary TRXs in
different bands. Especially considering that DCS1800 and PCS1900 have
overlapping ARFCN numbers it would be hard for the MS to tell to which
band it should switch. Also the ImmAss. message only contains the ARFCN
number. It is impractical to have TRXs in different bands and probably
this also violates the sepec.

Change-Id: Icc2af9e2a9bca3897dbbb34d7b2c0fe6f843bedd
2021-10-13 11:47:05 +02:00
Philipp Maier d24d34aff0 bts: set ncc_permitted from bts_alloc
The value ncc_permitted is preset in osmo_bsc_main.c from
bootstrap_bts(). It is a constant value that also cannot be changed via
the VTY. Therefore it should be set from bts_alloc(). This also fixes
the problem that when the BTS is added at runtime from the VTY. BTSs
added at runtime would have an all zero ncc_permitted until the next
restart of osmo_bsc.

Change-Id: I9f02277d7b4b4bcb383e749435416a0b22efd5e8
Related: SYS#5369
2021-10-13 11:47:01 +02:00
Philipp Maier b818d5755f drop chan_load_samples_idx initalization from bootstrap_bts()
The index counter bts->chan_load_samples_idx is initialized to 0 in
bootstrap_bts. Since the bts object is allocated using talloc it is
already guaranteed that everything is set to zero. So we do not need to
initalize chan_load_samples_idx.

Change-Id: Ia75e59c44c3ccd653a2614c2cda7519faf999f09
2021-10-13 11:37:06 +02:00
Philipp Maier 8935c8a0b5 bts: set acs value in bts_alloc
The acs value is currently set from bootstrap_bts() in osmo_bsc_main.c.
The value is set to 0. Since the BTS object is allocated using
talloc it is guaranteed to be 0 from the beginning. Lets set it from
bts_alloc anyway so that we have a place holder that is easy to find.

Change-Id: Idc4e08c471e15c36b4ea7eb3981254e179115765
2021-10-13 11:36:47 +02:00
Philipp Maier c3c62f6051 bts: set pwrc value in bts_alloc
The pwrc value is currently set from bootstrap_bts() in osmo_bsc_main.c.
The value is set to 0. Since the BTS object is allocated using
talloc it is guaranteed to be 0 from the beginning. Lets set it from
bts_alloc anyway so that we have a place holder that is easy to find.

Change-Id: Id76879a94cf8cf8c07e8fc7e8aa399cd50e04e9a
2021-10-13 11:27:02 +02:00
Philipp Maier 314167c799 bts: set R99 MSC flag in SI13 in bts_alloc
At the moment we set the R99 flag from bootstrap_bts() in
osmo_bsc_main.c. However this constant flag should be set together
with the many preinitalized chan_desc values in bts_alloc

Change-Id: I5b78c4e25616ab552c37ba8b7c9948cf7052bad4
2021-10-13 11:27:02 +02:00
Philipp Maier 409718e590 osmo_bsc_main: remove code dup in bootstrap_bts()
The function gsm_set_bts_type() already takes care of setting the
model->started flag to true. There is no need to do this in
bootstrap_bts() again.

Change-Id: Ia70943d96d466ab506fe368ef178a2ccc7483adc
2021-10-13 11:27:02 +02:00
Neels Hofmeyr 065ff875e9 stat: add bts.N.num_trx:rsl_connected
Controversy: this duplicates bts.N.rsl_connected. I would like to add
this duplication for consistency, since we now have these counters:

  bsc.0.num_trx:rsl_connected
  bsc.0.num_trx:total
  bts.N.num_trx:total

and the old

  bts.N.rsl_connected

which does not fit well with above naming scheme. Any user will be
justified to expect a stat named bts.N.num_trx:rsl_connected as well.

Determine bts.N.num_trx:rsl_connected in the new function
bsc_update_connection_stats(), where the other num_trx:* are set.

Related: SYS#5542
Related: I5be1cb470930354c4561cbed301bc50a32484ed9 (osmo-ttcn3-hacks)
Depends: I137992a5479fc39bbceb6c6c2af9c227bd33b39b (libosmocore)
Change-Id: I55b55159fe13d937e441d8c2ed915734463e1154
2021-10-12 16:08:09 +00:00
Neels Hofmeyr 5f1317ba91 stat: add bts.N.num_trx:total
This is similar to bsc.0.num_trx:total but per single BTS.

Related: SYS#5542
Related: I5be1cb470930354c4561cbed301bc50a32484ed9 (osmo-ttcn3-hacks)
Depends: I137992a5479fc39bbceb6c6c2af9c227bd33b39b (libosmocore)
Change-Id: I283d38e7a8c032e274a5bd2fa150ec2c9a7157b4
2021-10-12 16:08:09 +00:00
Vadim Yanitskiy 1e88d691ed rsl_lchan_lookup(): fix handling of ABIS_RSL_CHAN_NR_CBITS_OSMO_PDCH
If an RF Resource Indication message includes interference band(s)
for 'pure' PDCH (i.e. not dynamic) timeslot(s), osmo-bsc logs:

  DRSL DEBUG abis_rsl.c:1515 (bts=0,trx=0) Rx Resource Indication
  DRSL ERROR bts_trx.c:236 (bts=0,trx=0) chan_nr 0xc7 cbits 0x18:
    (bts=0,trx=0,ts=7,pchan=PDCH,state=UNUSED) is not GSM_PCHAN_OSMO_DYN
  DRSL ERROR abis_rsl.c:141 (bts=0,trx=0,ts=7,pchan=PDCH,state=UNUSED)
    Abis RSL Rx Resource Indication: mismatching chan_nr=0xc7

Let's better check if a timeslot is capable of GSM_PCHAN_PDCH,
rather than checking if it's GSM_PCHAN_OSMO_DYN.

Change-Id: I2cac4acd4c5145c5c525c9952fdc754477ce0942
Related: SYS#5313
2021-10-08 00:51:39 +06:00
Vadim Yanitskiy 0fc23b9d2f rsl_rx_resource_indication(): check result of rsl_tlv_parse()
Change-Id: I3b4758f80f2cd87e22bd3617e189f12403461ea3
Related: SYS#5313
2021-10-08 00:14:37 +06:00
Pau Espin 74c15a8c8a nm_channel_fsm: drop ipa link if SetChannelAttr fails
Now that we solved all the interdependency symbol mess, we can finally
enable call to this function.

Change-Id: Id4c724ef17beae4bb0918ebd1a809665b59e4861
2021-10-07 14:08:37 +02:00
Pau Espin eb36819b4d Get rid of lots of stubs [4/4]
These are not needed anymore since we re-introduced libbsc, specially to
avoid all this churn.

Some specific methods are explicitly required to be overwritten by
tests, so we specificially mark those with __attribute__((weak)) in
order to be able to overwrite them.

This is the last step towards fixing interdependency mess of symbols and
stubs, and requires previous patches in order to have tests apssing
fine.

Change-Id: Ic7401b8a6eb903882e30fda1cf091ac99a254ef0
2021-10-07 14:08:29 +02:00
Pau Espin 40c7410f9e Move ts_fsm_init to static constructor [3/4]
This allows having it initialized automatically, as we usually do with
this type of code. As a result, tests or other apps importing libbsc
don't need to take care of calling it.

NOTE: This fix is required by follow-up patches where some stubs are removed
and hence some tests start using FSMs internally. Since tests were not
using those FSMs before, there was no need to call ts_fsm_init().

This is one further step towards fixing interdependency mess of symbols
and stubs.

Change-Id: I0e4b95b5e73fbb3844d83ba33e66786831088e1f
2021-10-07 14:08:22 +02:00
Pau Espin 12adbeaba3 Move global var bsc_gsmnet into libbsc [2/4]
This is used inside group of files forming libbsc (shared files used by
several apps). Let's instantie only once inside a file from libbsc
instead of doing so on each binary.

This is one further step towards fixing interdependency mess of symbols
and stubs.

Change-Id: I9b287aa492ca6aae5fc56133e1510aff3146fe25
2021-10-07 14:08:15 +02:00
Pau Espin 7974008436 bts_trx: Fix timeslot_fsm not properly freed during trx free() [1/4]
osmo_fsm_inst_free() must be called explicitly, otherwise the instance
is kept in the llist of instances and produces heap-use-after-free.

Note: This fix is required by follow-up patches where some stubs are removed
and hence some tests start using FSMs internally. Due to this bug, tests
will crash due to reason explain in previous paragraph.

This patch itself may introduced failures to build due to some new
interdependencies being introduced in same follow-up patches mentioned
above, which are in turn fixed by this present patch.
So they are expected to be merged together.

Change-Id: Ib0e5560efe518833f76f846d7269e82d85c186a1
2021-10-07 14:07:52 +02:00
Pau Espin d203d173f2 MS Power Control Loop: Use P_CON_INTERVAL=2 by default
Increase the reaction time at the expense of more stable loop with less
temporary oscillations.

See updated user manual documentation in this commit for a larger
description.

Related: SYS#5371
Change-Id: I46be244a5e01a74086e3a977ec3ea139742a0074
2021-10-07 10:44:44 +00:00
Pau Espin 71e90a1c43 cosmetic: Fix typo in comment
Change-Id: If95b653d9c31292f8e771f0d460fc8f008fd3e24
2021-10-05 18:24:12 +02:00
Neels Hofmeyr 1d31967ed6 tsc fixup: tweak condition for coverity
Related: CID#240352 SYS#4895
Change-Id: Idbc6b47df0aeca9b6d870386b037dd6fb7c96c82
2021-10-05 08:29:15 +02:00
Keith Whyte 2262245209 Implement MS Uplink Power Control Loop
* Adds vty option dyn-bsc for ms-power-control -> mode
* Imports power_control.c from osmo-bts project
  [at commit 2f3cd4b697972d8484f9a9d3b7ef634086f65fa5]
* Removes unused C/I code from osmo-bts's power_control.c

This patch then calls the power loop on receipt of measurement
reports and updates the MS Power Level accordingly.

Change-Id: Ibc307e758697eb5ca3fb86622f35709d6077db9e
2021-10-05 04:32:33 +00:00
Keith Whyte b263d860e6 Add vty command to manually force MS Uplink Power
Change-Id: Ie2642299ea696358db5822571f1f722b5e8f76b9
2021-10-04 19:42:36 +00:00
Neels Hofmeyr 62c4097dcf fix TSC / TSC Set used for Handover
From the nature of the lchan_activate_info.tsc_set and .tsc, it is easy
to forget to set tsc_set,tsc = -1 to use default TSC Set and TSC values.
Handover code is one such instance that forgets to set -1.

Change the semantics of tsc_set and tsc so that this kind of error can
not happen again as easily: use a separate bool to flag whether to use
the default config or explicit values.

Implicitly fix the lchan_activate_infos "launched" in handover_fsm.c as
well as abis_rsl_chan_rqd_queue_poll().

Related: OS#5244 SYS#4895
Related: I1ed6f068c85b01e5a2d7b5f2651498a1521f89af (osmo-ttcn3-hacks)
Change-Id: Iae20df4387c3d75752301bd5daeeea7508966393
2021-10-04 11:04:21 +00:00
Philipp Maier 335d7f730e assignment_fsm: Check for conn->lchan
When the SDCCH gets released while the TCH still beeing activated, then
the ChanActivACK that is received after the TCH is activated will trigger
a segmentation fault in the assignment_fsm. The reason for this is that
conn->lchan, which holds the SDCCH at that point in time, is now NULL.

To prevent osmo-bsc from crashing, the FSM should check for the presence
of conn->lchan first. If it does not exist, the FSM should terminate.
(Assignment failed)

Change-Id: I3b1cd88bea62ef0032f6c035bac95d3df9fdca7a
Related: SYS#5627
2021-10-04 12:33:58 +02:00
Neels Hofmeyr eb67a2fbac fix comment in lchan_fsm.c: s/modification/activation
Change-Id: I1f2eaf636d4edc170e1608ab782f60028e2b1eb8
2021-10-02 11:20:18 +02:00
Pau Espin 464227d071 MS Power Control Loop: Allow Turn off/on C/I independent from value setting
Improve the current VTY support to allow enabling/disabling C/I logic
independent from value setting. This way C/I support can be quickly
disabled & enabled.

Reminder: changing power parameters still require VTY Command "bts NR
resend-power-control-defaults" to be excuted prior to new parameters
being applied on the BTS.

Related: SYS#4917
Change-Id: Id1224c2d9a52db2ed805c49e048d3086ed0167f5
2021-09-29 15:39:17 +02:00
Pau Espin 1b90b3d27a bts_vty: Print C/I power params for osmo-bts only
Those are osmo-bts specific extensions, so there's no point in printing
related VTY config.

Change-Id: Ie85d2aefa1ab7bf943479e18cc79a0f56e54d431
2021-09-29 10:40:26 +00:00
Philipp Maier 89a9958e93 assignment_fsm: make assignment_fsm_allstate_action static
assignment_fsm_allstate_action is only used in module assignment_fsm.c,
so lets decalare it as static

Change-Id: I90d6c11bd485e3be80efc7f146e0129d93e18458
2021-09-28 18:55:35 +00:00
Philipp Maier 66363c033e assignment_fsm: make assignment_fsm_timer_cb static
assignment_fsm_timer_cb is only used in module assignment_fsm.c, so lets
decalare it as static

Change-Id: Ibb3aa01d21b0a83600dc22382a5c8001debbe054
2021-09-28 18:55:35 +00:00
Keith Whyte b7c4d801ff Fix MEAS parsing, as Ericsson RBS reports TA shifted by 2 bits.
This fixes call setup issues when more than ~1km from the tower.

NOTE: We use the last reported TA from the UE in the CHANnel ACTIVation.
When the UE is more than 1km from the tower, (unshifted) TA in the
measurement report can be 8 or greater. Once we send TA of 8 in the
CHAN ACTIV message, the lchan is unrecoverable.

Change-Id: I1c9bd5bf2fd126e62bcbec419f3499d2e0465559
2021-09-28 18:54:18 +00:00
Pau Espin df612507d6 MS Power Control Loop: Support turn off C/I based logic
Setting LOWER_CMP_N and UPPER_CMP_N for all channel types can be quite
cumbersome and end up in lengthy config files. Let's instead add a
placeholder command to apply it to all channel types of a BTS at once.
This is useful specially since a user disabling C/I capabilities
probably does so because it may require a fair amount of fine-tuning
parameters to have it working perfectly. Hence, a user not willing to
spend time configuring those parameters correctly (and for which default
ones doesn't work properly) will require quick way to get rid of C/I
based MS Power Control Loop. By disabling C/I comparison, osmo-bts will
rely on RxLev only when applying the MS Power Control Loop, which is
fine for non noisy environments.

Related: SYS#4917
Change-Id: I0e1a1a9228a15e9ec9c41b7952b03e1d25309706
2021-09-21 16:51:21 +02:00
Neels Hofmeyr aa4d99fd8b fixup comments for 'rf_states' CTRL command
Completely describe the 'rf_states' string elements (in one place), and
fix the missing <rsl_status> item in bsc_ctrl_commands.c comments.

Related: SYS#5542
Change-Id: Ifc3610c344b3e270111e2f6c5155a6fb90d8f2ac
2021-09-15 18:05:20 +00:00
Neels Hofmeyr 763f8ed771 add CTRL bts.N.trx.M.rf_locked (RW)
Add per-TRX command to lock/unlock single TRX.
(Besides the global root-node rf_locked command setting the global RF
policy.)

Corresponds to VTY command: 'bts N' / 'trx N' / 'rf_locked (0|1)'.

Related: SYS#5542
Related: I2bb5096732f75a7341c7e83951e63c5a2038b469 (osmo-ttcn3-hacks)
Depends: I4dac826aab00bc1780a5258b6b55d34ce7d50c60 (libosmocore)
Change-Id: Ie46fd730797b64fb185d705c3507e36f5f23ef4b
2021-09-14 08:44:45 +00:00
Neels Hofmeyr 0559bd9775 add CTRL 'rf_states' and 'bts.N.rf_states'
These commands return a listing of OML state, RF policy as well as RSL
connection status for each TRX in the form:

 <bts_nr>,<trx_nr>,<opstate>,<adminstate>,<rf_policy>,<rsl_status>;<bts_nr>,<trx_nr>,...

For example, the root node 'rf_states' may return:

 0,0,operational,unlocked,on,rsl-up;1,0,operational,unlocked,on,rsl-down;2,0,inoperational,locked,on,rsl-down;

A 'bts.N.rf_states' returns the same form of string, but lists only the
TRX for the given BTS nr.

Note, there is already a CTRL command 'bts.N.rf_state' (singular
'rf_state', not plural 'rf_states'), which only reflects the overall
status of all TRX combined. This new command has per-TRX resolution.

The rf-policy is so far always looked up in the global gsm_network flag,
as does the old 'rf_state' command; see osmo_bsc_rf_get_policy_by_bts()
which does not depend on the specific BTS at all. This may be worth
revisiting in the future, so I am already including the rf-policy in the
rf_state string for each TRX, even though it is globally identical.

Related: SYS#5542
Related: I01e6f391a5e71b0606c42be9b57f8a1687d59bcb (osmo-ttcn3-hacks)
Change-Id: I14fa2678fc8f2c11a879c5e9615ac552782c5b7e
2021-09-14 08:44:45 +00:00
Pau Espin 8367411772 Power Control Loop: Set P_CON_INTERVAL to 1 by default
TS 45.008 section 4.7.1:
"""
Upon receipt of a command from an SACCH to change its power level on the corresponding uplink channel, the MS
shall change to the new level at a rate of one nominal 2 dB power control step every 60 ms (13 TDMA frames), i.e. a
range change of 15 steps should take about 900 ms. The change shall commence at the first TDMA frame belonging to
the next reporting period (as specified in subclause 8.4). The MS shall change the power one nominal 2 dB step at a
time, at a rate of one step every 60 ms following the initial change, irrespective of whether actual transmission takes
place or not.
"""

Since the reported MS_PWR in L1 SACCH Header is, according to specs, the
one used for the last block of the previous SACCH period, it becomes
clear the first SACCH block after a requested MS Power Level change by
the network may contain mismatches between the announced MS_PWR by the
MS and the measured Rxlev/RxQual. Hence, let's better use a
P_CON_INTERVAL of 1 which retriggers the MS Power Control Loop every second
SACCH block.

Related: SYS#5371
Change-Id: Iade5b597e0e56b07c6d78995fcec7c641e4e643f
2021-09-13 17:48:48 +02:00
Pau Espin 506aa70d77 Support Neighbor Address Resolution over PCUIF IPA multiplex
While NACC was initially developed, it became clear there was need for
a way to interact PCU<->BSC in order resolve ARFCN+BSIC into CGI-PS
for later RIM usage.
Hence, this resolution was first (until today) implemented using an out
of bands RPC system using the CTRL interface, which required specific
config to be written and matches in osmo-pcu and osmo-bsc VTY (ip+port
of the CTRL interface to use).
However, this has several shortcomings:
* As explained above, specific configuration is required
* Since recently, we do support BSC redundancy in osmo-bts. Hence the BTS
  may switch to a BSC other than first one. If that happened, that'd mean
  the CTRL interface would still point to the initially configured one,
  which may not be the same currently serving the PCU.

During recent development of ANR related features, a similar need for
PCU<->BSC was required, but this time it was decided to extend the IPA
multiplex of the Abis OML connection to pass PCUIF messages,
transparently forwarded to each side by the BTS.
This has the advantage that connection PCU<->BTS is handled by BTS and
both sides send messages transparently.

Let's switch by default to using this new interface, while still
maintaing the old way for a while (announcing them as deprecated) to
avoid breaking existing deployments until they are upgraded to new
versions of osmo-pcu and osmo-bsc.

Change-Id: I9073a121564503f483c84263ac72476041e47c03
Related: SYS#4971
2021-09-13 16:04:05 +02:00
Pau Espin df93b188ec lchan_fsm: Avoid inheriting bs_power from old lchan
So far we were inherting the bs_power in used when activating an lchan
for an MS for which we already had previous lchan. For instance, when an
MS is first assigned an SDCCH, and later on, it is assigned a TCH to
place a voice call.
Doing so is, however, not correct because current and old lchans may be
placed on different TS or even on different TRX, which means they will
have different BS Power restrictions. In the scenario described above,
for instance, an SDCCH could have been assigned on C0 and hence have
a bs_power of 0, and later on, whenever the TCH lchan as created, it
would have inherited the C0 bs_power despite it may have been possible
to use a different (lower) max bs power.
Furthermore, the lchan->bs_power_db basically stores the *maximum* bs
power reduction. Hence it makes not sense at all to copy over the value,
since it is anyway not updated from MS measurement reports so far
anyway.

Fixes: 997a257f8d
Related: SYS#4919
Change-Id: I4a7736aa9a1395e0cc118b98b69896bd0f1e94e6
2021-09-09 14:21:21 +02:00
Pau Espin cf9cfb6621 lchan_fsm: Fix comment
A previous commit (Feb 05 2021) moved copy of TA value to some other
place to fix some related issues, but forgot to update the comment.

Fixes: b03e73f27b
Change-Id: Ia10038919b6650dff45b7233f58fea94e9808712
2021-09-09 14:07:45 +02:00
Neels Hofmeyr 5a1e12337c fixup for Early IMM ASS: use proper TSC
Testing has shown that the Training Sequence Code in pre-chan-ack mode
is inaccurate (only worked with a BSIC that incidentally yielded the
same TSC value as the wrong TSC value sent in the IMM ASS msg).

Move the code setting the correct TSC and TSC-Set to the first stage of
channel activation (lchan_fsm_wait_ts_ready_onenter()) so that it is
available for both pre-chan-ack and pre-ts-ack Early-IA modes.

Have a separate function for setting the preliminary values requested in
Channel Activation (lchan->activate.*) into the accepted operative
places (lchan->*). Call this early for early-IA modes.

Hence the TSC and TSC-Set used in the early IMM ASS message is now the
correct one, and the same as sent during Channel Activation.
There shouldn't be any, but if there are other values besides TSC
suffering from the same problem, they are now also set to the right
values before sending IMM ASS early.

Related: SYS#5559
Related: I4479244b0c53648e62e84e1ebf986f51d659484f (osmo-ttcn3-hacks)
Change-Id: I9f26074154600d854a0b3baee2f38a6666f4cb56
2021-09-09 11:46:12 +00:00
Pau Espin 27097081e6 lchan_fsm: Fix comment
bs_power_db, as its name suggests (also check vty code and
rsl_tx_chan_activ()) contains value in dB, not in 2dB steps.

Change-Id: I76bd6bb1b307ab75ba1292865747419228e0687a
2021-09-08 19:51:44 +00:00
Pau Espin 54283ba626 MS Power Control Loop: Support set up of C/I parameters for osmo-bts
This commit extends existing VTY and RSL infrastructure to configure and
manage MS Power Parameters used in MS Power Control loop, by adding
support to set up Carrier-to-Interference (CI) parameters.

Using C/I instead of existing RxQual is preferred due to extended
granularity of C/I (bigger range than RxQual's 0-7).
Furthermore, existing literature (such as "GSM/EDGE: Evolution and Performance"
Table 10.3) provides detailed information about expected target values,
even different values for different channel types. Hence, it was decided
to support setting different MS Power Parameters for different channel
types.

These MS Power Parameters are Osmocom specific, ie. supported only by
newish versions of osmo-bts. Older versions of osmo-bts should ignore
the new IEs added just fine. The new IEs containing the MS POwer
Parameters are not send for non osmo-bts BTSs, hence this commit is
secure with regards to running  osmo-bsc against an ip.access BTS such
as nanoBTS.

Related: SYS#4917
Depends: libosmocore.git Change-Id Iffef0611430ad6c90606149c398d80158633bbca
Change-Id: I7e76ec47b323d469f777624b74b08752d1f5584f
2021-09-06 12:07:20 +02:00
Pau Espin 32d917bec2 cosmetic: power_ctrl_params_def: Fix typo in comment
Change-Id: Ibbbb073fa674666f47d84d8e670790c4028ba874
2021-09-06 10:06:47 +00:00
Neels Hofmeyr 08de290aa8 add stat_items for BTS and TRX connection stati
So far we have stat items per BTS. Add stat items summing overall BTS
status.

Add stat items:
- num_bts:oml_connected
- num_bts:all_trx_rsl_connected
- num_bts:total
- num_trx:rsl_connected
- num_trx:total

Related: SYS#5542
Related: Ic1b35b7406547f92818afe399a2383d154576409 (osmo-ttcn3-hacks)
Change-Id: I2057a798e681a169cc03243a09b3d6449734c010
2021-09-05 16:24:18 +02:00
Philipp Maier 3da59936be osmo_bsc_msc: do not initalize MGCP proxy for AoIP MSCs
The MGCP proxy which is built into osmo-bsc is used to tunnel MGCP
messages through an SCCP-lite link. This is an SCCP-lite specific
implementation detail that is not present in SCCP/AoIP.

Change-Id: Id3a8c45ae38d6b9d9c106a9e83b3cbfff919650d
Related: SYS#5091
2021-09-04 19:41:17 +00:00
Philipp Maier 8d22e68706 osmo_bsc_main: integrate MGW pooling into osmo-bsc
Since the libosmo-mgcp-client now supports MGW pooling, lets use this
feature in osmo-bsc. Large RAN installations may benefit from
distributing the RTP voice stream load on multiple media gateways.

Depends: osmo-mgw Icaaba0e470e916eefddfee750b83f5f65291a6b0
Change-Id: I8f33ab2cea04b545c403a6fe479aa963a0fc0d0d
Related: SYS#5091
2021-09-03 15:03:38 +00:00
Philipp Maier 034cc1216a bty_vty: add VTY settungs for temporary overpower
To configure temporary overpower, new VTY commands are added. This patch
also addes the logic needed to attach the temporary overpower IE to the
RSL CHANNEL ACTIVATE message.

Change-Id: I488a91bb4ed86f630db56564a0cd293f39f0f690
Related: SYS#5319
2021-09-02 17:44:54 +00:00
Pau Espin fecf321a25 vty: Fix wrongs params passed in vty warning message
Change-Id: If1cc4c7fb70bd69cf8d1c0509e6be60ecae33685
2021-09-01 13:33:26 +02:00
Pau Espin c286a11054 vty: Fix wrong TSC sent when activating lchan through VTY
TSC was initially set to -1 (to be picked by callee), but erased when
using designated initializers later on in the function, hence TSC being
set to 0. As a result, TSC 0 would be requested to the BTS, which may
have configured a different BSIC containing BCC!=0.

Related: OS#5219
Change-Id: I26813561ee9e7783a4004f32225f19296bd6319c
2021-08-31 08:14:46 +00:00
Neels Hofmeyr a268523e3d add stat items bsc.0.num_msc:connected, .num_msc:total
We already have MSC connection stat items, but for hysterical raisins
there are separate such stats for each MSC. Hence we have N connection
counters, each being either 0 or 1, for a single MSC.

Add a new stat counting the *overall* MSCs that are connected,
and one indicating the total number of configured MSCs.

Related: SYS#5542
Related: I178dcf4516606aa561d47b06061b8a416d3c40cf (osmo-ttcn3-hacks)
Change-Id: If76bbf9b3adb64c68d5c31c6b526fa71a99996ae
2021-08-30 18:21:50 +02:00
Neels Hofmeyr a5d3c9d0f2 move BSC level stats and rate counters to new bsc_stats.[hc]
Instead of having static const structs in header files (which end up
duplicated in each and every compile unit!), have one .c file with the
rate_ctr and stat_item descriptions.

Related: SYS#5542
Change-Id: I8fd6380b5ae8ed2d3347e7cfbf674c30b6841ed9
2021-08-30 16:18:52 +00:00
Neels Hofmeyr f8bed50e05 vty: add "msc N bssmap reset" command
Allow resetting the BSSMAP link from VTY, for BSC_Tests.ttcn.

In the field, detecting that an MSC is lost is done by getting three
connection failures in a row. For the BSC_Tests, it is easier to just
provide a VTY command to reset an MSC's link status.

I want to add tests that verify the stat items reflecting the MSC
connection status. To be able to run a test expecting fewer connected
MSC after a test that launched more MSCs requires the links to be reset.

Related: SYS#5542
Related: Ice3056dc46c94f9399f8379db7aeb7193782f2f2 (osmo-ttcn3-hacks)
Change-Id: I1975941b790d2b30d0904d41e456220cba26ecff
2021-08-30 16:18:12 +00:00
Vadim Yanitskiy d4e2a2d5e1 gsm_04_08_rr: silently ignore RR UTRAN Classmark Change
Some UMTS capable phones (such as SE K800i) send this message
together with the 'normal' RR Classmark Change, what makes
osmo-bsc log the following warning:

  DCHAN NOTICE gsm_04_08_rr.c:1037
    lchan(0-0-1-SDCCH8-0)[0x562ea76d3ab0]{ESTABLISHED}:
      (type=SDCCH) Unknown RR message: UTRAN Classmark Change

We don't handle it, so just ignore without logging anything.

Change-Id: Icb8e44c9a06519ead9c3dc9308788c23505d4bb1
2021-08-29 17:50:05 +06:00
Neels Hofmeyr faf37254eb stat_item desc: add explicit indexes for clarity
Add explicit indexes like [BSC_STAT_NUM_BTS_TOTAL] = { ...

BSC_STAT_NUM_BTS_TOTAL == 0 and the first item of bsc_stat_desc of
course has index 0, but when grepping the code, it looks like
BSC_STAT_NUM_BTS_TOTAL is missing a name definition.

Same for MSC_STAT_MSC_LINKS_ACTIVE and MSC_STAT_MSC_LINKS_TOTAL.

Related: SYS#5542
Change-Id: Ie47e0857c41d517a9b37be96f6669d1825d24a6d
2021-08-27 07:02:47 +00:00
Neels Hofmeyr c746509d3c early IMM ASS 3/n: implement 'pre-ts-ack'
Add experimental 'pre-ts-ack' to the 'immediate-assignment' options:
send the IMM ASS even before a dynamic timeslot is switched. This
possibly saves an Abis roundtrip, but may be racy.

When pre-ts-ack is chosen, already do the IMM ASS before the dyn TS
pchan switch is ACKed.

In Immediate Assignment, in case the dyn TS is not ready yet, get the
pchan kind from lchan->type, which already reflects the target type, and
not from ts->pchan_is, which still reflects the previous pchan type.

Related test is in I2ae28cd92910d4bc341a88571599347a64a18fe5

Related: SYS#5559
Change-Id: I19e6a3d614aa5ae24d64eed96caf53e6f0e8bb74
2021-08-16 02:13:17 +02:00
Neels Hofmeyr eec43fa532 early IMM ASS 2/n: implement 'pre-chan-ack'
When 'immediate-assignment pre-chan-ack' is set, send the Immediate
Assignment directly after the Channel Activation, not waiting for the
Activation ACK, to save an Abis roundtrip.

Related test is in If71f4562d532b6c5faf55f5fd073449a8a137ebf

Related: SYS#5559
Change-Id: I56c25cde152040fb66bdba44399bd37671ae3df2
2021-08-16 02:13:17 +02:00
Neels Hofmeyr 225af37f48 early IMM ASS 1/n: add vty config option
This patch adds only the VTY config option without any effect, to ease
patch review.
The implementation follows in I56c25cde152040fb66bdba44399bd37671ae3df2

The new config option is written so that further variants of Immediate
Assignment sequencing may be added easily.
See also I19e6a3d614aa5ae24d64eed96caf53e6f0e8bb74.

Related: SYS#5559
Change-Id: I710343d1728153faf3db9758ff5a1ef26bb8d3d4
2021-08-16 02:13:17 +02:00
Neels Hofmeyr 1dbbc60769 error log: improve lchan lookup error msg
Looking for a bug, I spread this logging to understand what was
happening. Might as well keep it.

Related: SYS#5559
Change-Id: I46b660cd51a41e561712a0bd849ce0ee8d1a9588
2021-08-16 02:13:17 +02:00
Neels Hofmeyr 57af76cdcf introduce gsm48_lchan_and_pchan2chan_desc()
The function gsm48_lchan2chan_desc_as_configured() dups
gsm48_lchan2chan_desc() with merely a different pchan type
(ts->pchan_from_config instead of ts->pchan_is).

In an upcoming patch, I would like to do the same, just with yet another
pchan value (derived from lchan->type, because that reflects the channel
type even before a dynamic timeslot switched its pchan type).

So replace gsm48_lchan2chan_desc_as_configured() by
gsm48_lchan_and_pchan2chan_desc() with explicit pchan arg;
also call this from gsm48_lchan2chan_desc(), reducing code dup.

gsm48_lchan2chan_desc_as_configured() had more concise error logging.
Absorb that into the new gsm48_lchan_and_pchan2chan_desc().

Add gsm_lchan_and_pchan2chan_nr(), like gsm_lchan2chan_nr() just with
explicit pchan arg, to be able to pass the pchan down from the new
functions mentioned above.

Related: SYS#5559
Change-Id: I67f178c8160cdda1f2ab5513ac4f65c027d4012f
2021-08-16 00:12:12 +00:00
Neels Hofmeyr cd6f44c8f1 lchan_fsm_post_activ_ack(): return upon release
The bottom of the function changes the lchan state. If a failure branch
is reached, that should no longer happen. Change 'break' to 'return' in
four places to not mix up the channel release.

Related: SYS#5559
Change-Id: I4674752ab4f1c8e8147ef3366f90e9ea2abd5aec
2021-08-16 00:12:12 +00:00
Philipp Maier c96c05f07b osmo_bsc_main: remove unused commandline option -l
The option -l ("The local address of the MGCP") is still present in the
commandline help and the manual, but it is used nowhere and osmo-bsc
exists when it is used. Lets remove it.

Change-Id: Ia295f4414e0d6e78b388c0c72f1a5b8df8bc3d7e
2021-08-03 12:11:32 +02:00
Neels Hofmeyr e8708af1e1 coverity: quench null deref warning in gscon_change_primary_lchan()
The if conditions for logging an lchan change made it look like
new_lchan might actually be NULL, which it never is. So rather pin
new_lchan as non-NULL with an assert and simplify the logic.

Related: CID#237146
Related: b0d854556d
Change-Id: I8859c6cb9b3b15287e339ce4b6815b946965d0d9
2021-08-02 15:02:11 +00:00
Pau Espin fc842fba24 Clarify string name for GSM_CHREQ_REASON_CALL
The previous naming was confusing since when appearing on log files it
seemed to mean the reason was mainly only call reestablishment, when it
actually means either call establishment (the usual reason) OR call
re-establishment (should happen seldomly).
Let's add some parenthesis to make it clearer.

Related: SYS#5548
Change-Id: Id2dccd71803335c284a5ba271fa7f7890d253c27
2021-07-29 14:40:26 +02:00
Neels Hofmeyr 9612a7c23e vty: improve err msg for invalid subslot nr
Change-Id: I2f649bd2d8d9f217c22b62d2842e1e4fa101ba11
2021-07-24 00:09:21 +02:00
Neels Hofmeyr e2488eb268 vty: lchan deact: allow omitting the lchan type arg
In the command

  bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> deactivate fr

the final argument indicating the channel type does not make sense and
is not actually used. Define a separate vty command for 'deactivate', so
that it doesn't require arguments only used for 'activate'.

Change-Id: Ibdeca3b1d75b9f6092f566544e9d5f4da67fffce
2021-07-24 00:09:02 +02:00
Neels Hofmeyr b0d854556d debug log: indicate change of primary lchan on a conn
Change-Id: Ib4e9a1cde9248f5d3fd8d7d8277623b42670b059
2021-07-24 00:02:00 +02:00
Neels Hofmeyr 9bff117e4a log: fix missing newline in lchan_select.c
Change-Id: Iea8bc73ba6da24f353ad422cdea3fa88173a9a1c
2021-07-24 00:02:00 +02:00
Neels Hofmeyr bb56236e59 fix CM Re-Establishment Request: allocate new A conn
For a call re-establishment, the MS shows up on a different cell and
requests CM Re-Establishment (3GPP TS 24.008 9.2.4). As soon as the
Layer 3 is established, the MSC will clear the first A-connection; the
re-establishment *has* to happen on a new separate A-connection. So for
a brief moment we must allow two distinct A-interface connections to be
used for the same subscriber.

Tested by BSC_Tests.TC_cm_reestablishment
added in I1e7d446644f46b8a0a94688e618ffb4f23a8900e

Related: SYS#5130
Change-Id: I2da9a971dd36c4289a78040adfe85704c8282c59
2021-07-24 00:00:40 +02:00
Pau Espin 56eda35874 Introduce VTY option to forbid use of TCH for non-voicecall signalling
Usual allocation mechansim, when some signalling channel is needed,
first tries to reserve an SDCCH, and if all of them are exhausted, then
attempts to reserve a TCH as a last resort.
This, however, may cause TCH starvation under certain situations, for
instance if there high load on other services (LU, SMS, etc.).
Hence, it may be desirable for the operator to forbid reservation
of TCH slots once SDCCH become exhausted. This commit is thus adding a
VTY command which allows forbidding it. The default behavior (allow using
TCH timeslots when SDCCHs are exhausted) is kept as before.

The above mentioned prohibition is applied only to non-voicecall related
signalling services. That's because voicecall services will end up
requiring a TCH anyway, and forbidding reservation of TCH straighaway
when SDCCHs are exhausted would mean no voice calls could be initiated
while still TCHs would be available.

Related: SYS#5548
Change-Id: Ib08027125145df26602069bfb51847063b0ccc0c
2021-07-23 13:36:03 +02:00
Pau Espin 8e3320ac48 Introduce libbsc to avoid linking long lists of .o files
Every time a new file is added in osmo-bsc, it ends up being a pain
because its .o file has to be included to other tests/util binaries, or
stubs need to be added.
Let's instead bundle all .o files together in an .la file and pass that
around.

Change-Id: If91dc589ea1e476da105b58846d1c3e720a439e1
2021-07-23 13:35:22 +02:00
Pau Espin c8edaad0bf Split bts_vty.c creating bts_trx_vty.c
Change-Id: I15ec8f71a5d31915162cb3ad75ea77e934fa4887
2021-07-23 13:35:04 +02:00
Pau Espin e19289fb89 Split bsc_vty.c creating bts_vty.c
Change-Id: I347e7da328fed0733af2eec10a3ca6e02a148308
2021-07-22 17:26:56 +00:00
Daniel Willmann b2b47d2c47 bts: Clear BTS_STAT_CHAN_*_{TOTAL,USED} on bts disconnect
Adds gsm_bts_stats_reset() to clear the stats and calls it from the
different models.

Change-Id: Ic42687cd73e3546edaa99fb1268a5960ffa43b12
Related: SYS#5541
2021-07-22 15:45:24 +00:00
Neels Hofmeyr 0c2d98e0c4 RES IND: tweak error code on missing Resource Information IE
If the RES IND message is invalid, let's not return ENOENT which
translates to "No such file or directory", instead return EINVAL.

Related: SYS#5313
Change-Id: Ifd700e90c881874d428f2860603a4ddbf13d705e
2021-07-22 12:15:36 +00:00
Neels Hofmeyr a46cd05e93 RES IND: allow empty Resource Information IE
If all channels of a BTS are in use and there are no interference
ratings to be reported, the Resource Information IE may be empty. Do not
log this as an error, it is not something that needs operator attention.

Related: SYS#5313
Change-Id: I75b851ef1269674f43db3fb3a48518e76182d7f0
2021-07-22 12:15:36 +00:00
Pau Espin df420dbe74 Fix recent regression in CHREQ allocation
Recent commit introduces a silly bug when changing code. Fixing it now.

Fixes: fdb87343d7
Change-Id: I1e8027a3933c3c8450e76e1325d0f7c28a89a6d1
2021-07-22 13:26:37 +02:00
Pau Espin 7801bbae82 abis_rsl: Log chan rqd reason on resource exhaustion log message
This allows better understanding which of use is exhausting channels
when there a lot of load.

Change-Id: Ic68162c2d52df07b05c76374e2a92148b9a7ccd5
2021-07-21 13:58:27 +02:00
Pau Espin 4b2feb605b lchan_fsm: Allow rx LCHAN_EV_RLL_REL_IND in state BORKEN
As seen in osmo-bsc log:
DCHAN ERROR abis_rsl.c:2287 lchan(12-0-2-TCH_H-1){BORKEN}: Event LCHAN_EV_RLL_REL_IND not permitted

Related: SYS#5523
Change-Id: Idc7796d41f3483c89559746d9a00fdf32bf67c57
2021-07-20 10:07:17 +00:00
Pau Espin ce869c6baa _select_sdcch_for_call: Avoid 2nd lchan lookup when finally selecting it
We already looked it up, it's not necessary to look it up again by
calling lchan_select_by_type(). Let's instead call
lchan_select_set_type() directly on the lchan pointer.

Related: SYS#5309
Change-Id: I1054c18f58c9e249f263e3e97a365a1fd8b03a93
2021-07-20 10:07:03 +00:00
Pau Espin 2956b52c5b Add new lchan_select_set_type() API helper
It's an easy helper, but it helps in standarizing and finding similar
places in code.
Morevoer, it will be used in follow-up commit where we first use
lchan_avail_by_type and finally we select it in a later stage.

Change-Id: I025a40962a5e5d40543b297a0760e47618fb525c
2021-07-20 10:07:03 +00:00
Philipp Maier 181b5f3b9a handover_ctrl: add control interface for handover settings
The VTY handover_vtc.c offers a large number of handover specific
settings. Those settings are (with one exception) auto generated using
macros. Lets add an equivalent for the control interface that uses the
same auto generation mechanisms.

Change-Id: I12f143906818fd6b16e8783157cbb1eb51e49ffc
Depends: libosmocore I53fc207677f52b1dc748b01d58424839cdba807c
Related: SYS#5369
2021-07-19 10:44:05 +02:00
Neels Hofmeyr 9c61446423 vty 'interference-meas level-bounds': explain duality in ordering
Related: SYS#5313
Change-Id: If71e20e95d29e7f03739ee04e1ef429bf8bd51ed
2021-07-16 16:04:18 +00:00
Neels Hofmeyr ae0b737c62 separate 'interference-meas level-bounds' cfg and used
The VTY defun already indicates BSC_VTY_ATTR_RESTART_ABIS_OML_LINK
correctly, but so far we would immediately start using the new values
internally, and wrongly interpret interference levels. Fix that.

Have bts->interf_meas_params twice: interf_meas_params_cfg for the VTY
configured values, and interf_meas_params_used for the values that the
BTS actually knows about, after they were sent via OML.

In a running BSC, when changing the interference level boundaries on the
telnet VTY, the BTS is not immediately told about the change. That would
require a BTS restart. Hence store the cfg values separately in
interf_meas_params_cfg. For comparing/printing interference levels in a
running BTS, only employ the values that were actually sent via OML and
placed in interf_meas_params_used.

Related: SYS#5313
Change-Id: Iad8cf4151ff7f86dc0549158ed5d91d788d40b1f
2021-07-16 16:04:18 +00:00
Pau Espin 71b4f94601 cosmetic: Small improvements to _select_sdcch_for_call
This commit improves some cosmetic and logical aspects from recent
commit (see "Fixes" below).

* Fix typo s/free_tcch/free_tchh/"
* Improve some comments

Fixes: fdb87343d7
Change-Id: Id6217c929068b0182cb2d4a9922bfbf544c8c75d
2021-07-15 12:54:06 +02:00
Neels Hofmeyr be32e93513 hodec2: add low-rxqual-assignment penalty timer (2/2)
Hold off re-assignment after an intra-cell re-assignment due to low
rxqual.

Adjust test_amr_tch_h_to_f_rxqual.ho_vty to show the changed behaviour.

Related: SYS#5198
Change-Id: Id00a07313fe04eec509b336c0637b59c707760e0
2021-07-15 09:28:18 +00:00
Neels Hofmeyr 70d08b00ab switch handover penalty timers to CLOCK_MONOTONIC
To be able to add a fake time to handover tests, the penalty timers need
to use an osmo_* time source.

There already is a fixme comment rightfully asking for a monotonic
clock, so this change is overdue anyway.

An upcoming patch will prove that this works:
"handover tests: test passing of penalty timeout"
I65e59cc7309778cf9d71612669ce84d101c8135e

Related: SYS#5198
Change-Id: Ifb1ab3165db50511aed4f65aa445798367d7e19e
2021-07-15 09:28:18 +00:00
Neels Hofmeyr 71526043ea ensure trigger_ho() returns zero only when HO or AS was indeed triggered
In an upcoming patch, handover_decision_2.c will use this indicator to
decide whether to start a penalty timer:
"hodec2: add low-rxqual-assignment penalty timer (2/2)"
Id00a07313fe04eec509b336c0637b59c707760e0

Related: SYS#5198
Change-Id: I5de385e0666f716184a62e6e70d656545ac5d2ee
2021-07-15 09:28:18 +00:00
Pau Espin fdb87343d7 Avoid switching dyn ts to sdcch8 if it starves later TCH
In case an MS requests a channel to establish a voice call, we usuually
try to assign an SDCCH to negotiate the call and finally make the MS
switch to a TCH. However, it doesn't make much sense to provoke a switch
of a dynamic TS into SDCCH8 if that would mean we end up with no TS
available for TCH at the next step close in time. In that case, we are
better assigning the TCH directly so that the full call can be
established successfully.

Related: SYS#5309
Change-Id: I3b32968949a7bdcbebf5a823359295bac51d8e08
2021-07-14 13:49:15 +00:00
Philipp Maier cb0786365c bsc_vty: add vty option to allow call-reestablishment
The rach control parameter value that controls the usage of
call-reestablishment is currently hardcoded. Lets add a VTY option for
this so that we are able to configure call-reestablishment

Change-Id: Ia18c1dde4c001cb4d423f694f8bc146adfd77daf
Related: SYS#5130
2021-07-13 10:41:58 +00:00
Vadim Yanitskiy dfd7bef664 lchan_fsm: fix potential NULL-pointer dereference
Change-Id: I373855b95f8bde0ce8f9c2ae7bf95c9135d33484
Related: SYS#5526
2021-07-12 18:05:42 +02:00
Neels Hofmeyr 5ac7075643 RES IND: pick lchan with least interference
In lchan_select, do not return on the first available lchan, but iterate
through all available lchans. Among those that would match, pick the one
with the lowest interference level as indicated by earlier RES IND.

Lchans that have no interference ratings are picked last.

This feature is off by default, enable per BTS with

 network
  bts N
   channel allocator avoid-interference 1

osmo-bsc still does the same ascending/descending lchan allocation as
before this patch with the default setting of:

   channel allocator avoid-interference 0

Related: SYS#5313
Change-Id: I844494092193811dfd9fa4d52983cbaed0fc9248
2021-07-11 21:14:51 +02:00
Neels Hofmeyr c8cd61ddf2 RES IND: add VTY: bts / channel allocator avoid-interference (0|1)
Store the config option whether the channel allocator should try to
avoid lchans with higher interference levels reported in RES IND.

The actual implementation of avoiding interference follows in
I844494092193811dfd9fa4d52983cbaed0fc9248

Related: SYS#5313
Change-Id: I8b62d0b41ad9e908b27713db9219e3dbc1ebaab7
2021-07-11 20:31:41 +02:00
Neels Hofmeyr e5a761c6b8 RES IND: parse msg and store interference levels in lchans
Also show the current interference levels of unused lchans in the vty.

Related: SYS#5313
Change-Id: Iccc1391e8419604bb09e464db8455e053dfbc982
2021-07-11 20:28:02 +02:00
Neels Hofmeyr 9de09c974f lchan: call reset() upon alloc
call lchan_reset() after allocation, to make sure that lchan->* fields
that have a nonzero default value get initialized properly.

In particular, a future patch adds interference measurements, and an
lchan that never received any Resource Indication info should always
indicate that there are no measurements (a nonzero constant).

Related: SYS#5313
Change-Id: I700a969f5b11c21dacda9a7cad00c943dce554b3
2021-07-11 20:11:07 +02:00
Neels Hofmeyr 052934d0e6 hodec1: use same automatic FULL/SUBSET choice as in hodec2
So far handover decision 1 uses the FULL or SUBSET TDMA measurements
across all measurement reports, depending on whether the last
measurement report indicates that DTX is in use or not.

Handover decision 2 since recently uses TDMA_MEAS_SET_AUTO to choose for
each individual measurement report whether to use the FULL or the SUBSET
value, depending on each single report's DTX use flag.

Also switch handover decision 1 to heed every single report's DTX flag,
by simply using TDMA_MEAS_SET_AUTO, replacing the current decision.

Change-Id: Iebe980254b8c4a53ef9e7d720e417dc67077eff7
2021-07-09 11:51:40 +00:00
Neels Hofmeyr 9d4865ecae hodec2: [2/2] implement automatic choice between FULL and SUBSET measurements
Add TDMA_MEAS_SET_AUTO to indicate automatic choice between FULL and
SUBSET measurements depending on DTX. So far use only in hodec2.

TDMA_MEAS_SET_AUTO looks at each individual measurement report's DTX
flag and for each report chooses FULL if DTX is not used, or SUB if DTX
is used.

The default setting for 'handover2 tdma-measurement' is still 'subset'.
To use the automatic choice, users need configure
  handover2 tdma-measurement auto

Change-Id: I67dce55ccf892c8679272ee5dfedc25620f0f725
2021-07-09 11:51:40 +00:00
Neels Hofmeyr 7225fe4902 hodec2: [1/2] implement automatic choice between FULL and SUBSET measurements
Cosmetic preparation for enabling automatic choice between FULL and
SUBSET measurements depending on DTX in handover decision 2.

Change the internal API to pass separate enums for the choices {RXLEV,
RXQUAL}, {UL, DL} and {FULL, SUB}.

Change-Id: I283e03126a6bc1f5f1b35f9801e841053edd2947
2021-07-09 11:51:40 +00:00
Pau Espin 25ea643e19 lchan_fsm: Improve timeout logging line in state WAIT_RLL_RTP_ESTABLISH
This allows quickly finding out whether the timeout is happening due to
RLL not established or whether RTP is not ready. In essence, it
indicates whether issue may be coming from MGW or from MS/BTS side.

If coming from MGW, the timer T3101 is in general not a problem and the
issue should be related to some misbehaving.
If coming from MS/BTS, T3101 may require tunning (it could be a
misbehaving of the MS/BTS too, or simply bad signal).

Related: SYS#5526
Change-Id: Ib655f71aec584962c70d84a4405d996505dff53c
2021-07-09 11:32:40 +00:00
Pau Espin 729980ef4c lchan_fsm: Allow rx LCHAN_EV_RLL_REL_IND in WAIT_RF_RELEASE_ACK
As seen in osmo-bsc log during heavy load scenario:
<000f> abis_rsl.c:2171 lchan(12-2-6-TCH_H-0)[0x559b880d1f40]{WAIT_RF_RELEASE_ACK}: Event LCHAN_EV_RLL_REL_IND not permitted

Related: SYS#5523
Change-Id: Ie307872851490ae4d60c8117a5f4e2d8c2a414d6
2021-07-08 18:08:05 +00:00
Pau Espin 52b9912ef9 Support SDCCH8 in osmo dyn ts
This feature signals support to configure Osmocom Dynamic Timeslot type
as SDCCH8, on top of historically supported TCH/H and TCH/F.
The idea is that when unneeded, the TS is configured as PDCH, and as
soon as there's need for an SDCCH and there's none available, the TS is
dynamically reconfigured to SDCCH8. Once all logical channels in the
dynamic TS are released and hence becomes free, the BSC will reconfigure
it to PDCH.

Related: SYS#5309
Depends: libosmocore.git Change-Id Ifc0ca8916bd3e93e5a60a7dd7391d2588fdb5532
Change-Id: I29ac8b90168dba3ac309daeb0b6cfdbbcb8e9172
2021-07-06 07:16:15 +00:00
Pau Espin cc75145131 Rename osmo dyn ts enums to contain SDCCH8
They will gain support to be activated as SDCCH/8 soon too.

Related: OS#5309
Depends: libosmocore.git I56dcfe4d17899630b17f80145c3ced72f1e91e68
Change-Id: Id5b89fe589a52ff88486435ac43809edb4b80f98
2021-07-06 07:16:15 +00:00
Pau Espin cf65c9b297 assignment_fsm: Add assert to guard ptr access
Let's make sure the null pointer is caught by the assert if ever code
ends up here with conn->lchan being NULL.

Change-Id: I404df638da6a93caa535f10fd330ea24a775bfc3
2021-07-05 17:21:42 +02:00
Pau Espin 60bcba3bcf assignment_fsm: Fix null pointer dereference rx ASSIGNMENT_EV_LCHAN_ERROR
gsm_lchan_name always expects a valid lchan pointer.

This patch fixes a crash seen:
"""
<000f> lchan_fsm.c:99 lchan(12-2-5-TCH_H-1)[0x559b880f2980]{WAIT_RLL_RTP_ESTABLISH}: (type=TCH_H) Signalling Assignment FSM of error (lchan allocation failed in state WAIT_RLL_RTP_ESTABLISH: Timeout)
Assert failed lchan ../../include/osmocom/bsc/gsm_data.h:1034
"""

Related: SYS#5392
Change-Id: I23a337d411e857954008c6f8ae60be714509d351
2021-07-05 17:21:42 +02:00
Vadim Yanitskiy 997a257f8d power_control: constrain BS power reduction on BCCH carrier
BS Power Control is not allowed on the BCCH/CCCH carrier, unless
the BTS is operating in the BCCH carrier power reduction mode.

Allow constrained BS power reduction (up to 6 dB) on active logical
channels iff BCCH carrier power reduction mode is enabled.

Take into account that the maximum power difference between a timeslot
used for BCCH/CCCH and the timeslot preceding it shall not exceed 3 dB.

Change-Id: I2cc6a86731984f586ef35b43a8d3de631f7d8a2f
Related: SYS#4919, SYS#4918
2021-07-05 12:17:59 +00:00