Commit Graph

34 Commits

Author SHA1 Message Date
Pau Espin c88ed31d9e cosmetic: gsm_pchan2chan_nr(): Update spec documentation
Change-Id: If1de230f022c69f3dfce8a7c66d494a984e7f3f9
2023-03-17 15:29:17 +01:00
Pau Espin 149de0c113 lchan: Improve error path logging in gsm_pchan2chan_nr()
Change-Id: I8d9da8e8433feb1f022dc2f5199f9c15c01e9312
2023-03-17 15:14:19 +01:00
Pau Espin bbec5df6c7 lchan: Reset Abis RTP/Osmux config during lchan release
Otherwise some shared variables used by both Osmux and RTP was left set,
like connect_ip and connect_port, and next time the lchan was selected,
those were already configured even if they didn't come in IPAC CRCX.
This is specially bad if the channel was reused to set up an Osmux call,
since the osmux code path relied on those fields being properly reset
until set by IPAC CRCX.

Change-Id: I414bd0bc801451357bb45b89197a95e51b7c97f1
2022-09-20 17:33:07 +02:00
Pau Espin 2201900f94 Introduce Osmux support
Related: SYS#5987
Requires: libosmo-netif.git Change-Id I632654221826340423e1e97b0f8ed9a2baf6c6c3
Change-Id: Ib80be434c06d07b3611bd18ae25dff8b14a7aad9
2022-09-13 17:32:22 +02:00
Pau Espin 755546028e Move lchan_dl_tch_queue_enqueue to lchan.c and make it public
It will be used too by osmux code present in another file. This is a
preparation commit to simplify the one adding osmux support.

Change-Id: Ie7fa57bb04db9ad9b03971467e12ee7b8e4c190a
2022-08-11 23:04:46 +02:00
Pau Espin 7593cc743d Use libosmocore API msgb_queue_free() to free lists
There's no need to maintain a duplicate msgb_queue_flush(), which
returns the amount of freed messages (feature not used at all by the
callers).

Change-Id: I9841e18ca0b7b852130bbb02a510e43a3b3fd93f
2022-08-11 23:04:46 +02:00
Pau Espin 9ea93c7e20 Avoid counting lchan->dl_tch_queue length every time a msg is enqueued
The queue_limit_to method iterates the entire list of messages every
time a new message is added. Let's use msgb_{enqueue,dequeue}_count()
APIs to do that in constant time. It is true that since the queue is
limited to 1, there's usually at most 1 item in the queue so it's not a
real problem. However, when we add Osmux in the future, we may need to
tweak the amount of messages which can be in the list, due to Osmux
batching mechansim which may be more bursty sometimes.
In any case, this change doesn't make things worse for sure.

The patch also takes the chance to group the queue_limit_to + enqueue
into one function to avoid having the code spread several times.

Change-Id: I61818a3bb521c27bd21a8b6fa70581d27638ec9b
2022-08-11 23:04:35 +02:00
Pau Espin 5a1b14fa4f Split out lchan rtp socket creation from rsl handling code
This makes the code more clear, as well as allows adding Osmux in the
future.

Change-Id: Iade43fde7f6113f9d68539f7d6cc9843783c2b3f
2022-08-11 21:02:06 +02:00
Neels Hofmeyr f422873087 gsm_lchan_interf_meas_calc_avg(): adapt to the order of boundaries
The order of interference level boundaries is not clearly defined by
3GPP, so we should support both ascending and descending variants.

Change-Id: I88d841d8d835bde8392c7b606b28c9070b7adc6e
Related: SYS#5313
2021-11-12 03:04:47 +03:00
Vadim Yanitskiy efc0d5bf57 gsm_lchan_interf_meas_calc_avg(): fix band calculation
This patch makes osmo-bts bahave similar to ip.access nanoBTS.

Change-Id: I1bcc6d6ba154f82aef95d05fb9af0eab490923c9
Related: SYS#5313
2021-11-11 09:01:15 +00:00
Vadim Yanitskiy 778aaedb95 lchan: introduce and use lchan_is_tch() helper
Change-Id: Icd832667cad1189e3e819c88bde837c4260aa252
2021-10-23 15:42:32 +03:00
Vadim Yanitskiy 184fcb8010 lchan_set_state(): also free pending messages if any
A logical channel may have associated messages, which are pending
for transmission until some event occurs.  Do not leak them.

Change-Id: I3264e6caa007e9e9cb9c1c2f8627c408bbb28b9e
2021-10-23 01:42:41 +03:00
Vadim Yanitskiy de8e202d83 struct gsm_lchan: move tch.rep_facch to rep_acch.dl_facch
Finally we have all ACCH repetition state variables in one place.

Change-Id: I1469619528bb69c78c2fdc25bc1db208ead936d0
Related: SYS#5114
2021-10-22 02:53:00 +03:00
Vadim Yanitskiy e0154aa09b struct gsm_lchan: group ACCH repetition state fields
Change-Id: I2680c88f2a51b64f085a92233bc125338622babf
Related: SYS#5114
2021-10-22 02:53:00 +03:00
Vadim Yanitskiy ea0247e26c cosmetic: s/repeated_acch_capability/rep_acch_cap/g
Shorter symbol names are easier to read.

Change-Id: Ib1d51f91139b4c2fe794e37fc8543b2d7a9b9c07
Related: SYS#5114
2021-10-22 02:52:28 +03:00
Pau Espin d9079b192b gsm_pchan2chan_nr(): Properly assert if unexpected pchan is passed
A bit of archeology, history & recap:
ec1b5a0e9e2b6549e0ede48e803095e569997355 (openbsc.git) Adds assert in gsm_ts2chan_nr()
2f44693fad8505255293d3ed37dbd4e7cabebd37 (openbsc.git) ASSERT is disabled due to reported hit in octphy and
						       litecell in gerrit for ec1b5a0e9e2b6549e0ede48e803095e569997355
5cef0623ef (osmo-bts,git) minor fixes to gsm_ts2chan_nr() regarding the pragma
c9079d9106 (osmo-bts.git) GSM_PCHAN_NONE case is introduced in gsm_ts2chan_nr()

This code has long evolved and robustness has improved, it's not even
part of openbsc.git for several years now. Let's always assert if we
receive an unexpected value there, since they are all internally handled
values and hence we have control over them.

Related: OS#2906
Change-Id: I25e2cf0c922bc9902336e9add75a47535b9355bf
2021-10-19 12:39:55 +02:00
Pau Espin 3cd4745efe lchan: Call lapdm_channel_exit() when state changes to NONE
Fixes crash when TTCN3 BTS_Tests_LAPDm TC_rr_response_frame_loss
runs run after TC_t200_n200.

The BTS was shutdown after TC_t200_n200 failed (drop oml link), and
lchan was moved ACTIVE->NONE without lapdm_channel_exit() being called
on it. Hence, on next test (TC_rr_response_frame_loss), when
lchan_init_lapdm() was called again, some memory corruption was caused.

The lapdm_channel_exit can be dropped from gsm_lchan_release() and
rsl_tx_rf_rel_ack() since it's already called in the same path:
"""
rsl_rx_rf_chan_rel
	gsm_lchan_release(lchan, LCHAN_REL_ACT_RSL);
		l1sap_chan_rel(lchan->ts->trx, gsm_lchan2chan_nr(lchan));
			l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_DEACTIVATE)
				bts_model_l1sap_down
					bts_model_lchan_deactivate_sacch(lchan);
						-
					lchan_deactivate(lchan);
						bts_model_lchan_deactivate
							lchan_set_state(lchan, LCHAN_S_NONE); <---------
					mph_info_chan_confirm(trx, chan_nr, PRIM_INFO_DEACTIVATE, 0);
						l1sap_info_rel_cnf
							rsl_tx_rf_rel_ack(lchan);
								lapdm_channel_exit(&lchan->lapdm_ch);
		lapdm_channel_exit(&lchan->lapdm_ch);
"""

Related: SYS#5262
Change-Id: If0ec5f0c7be4d15c8d684d33e15e24d68bd5192e
2021-10-14 17:59:28 +02:00
Pau Espin d3e730c61d Move lchan_init_lapdm inside lchan_set_state(LCHAN_S_ACTIVE)
osmo-bts-trx/l1_if.c lchan_init_lapdm() for CCCH is already done when
trx_set_ts_as_pchan() calls:
"lchan_set_state(&ts->lchan[CCCH_LCHAN], LCHAN_S_ACTIVE);"

Change-Id: I7a9c3660b9aab57ff8765e2f1526349599630cd9
2021-10-14 17:48:31 +02:00
Pau Espin 07232521a9 Move lchan_deactivate() to lchan.c
Change-Id: If75ed432fa9dcb10159a0dac9b8ba7efe6958b35
2021-10-14 17:48:31 +02:00
Pau Espin ac81d2789a lchan: Avoid applying transition changes if state new==old
Let's avoid running over state change conditions or even printing log
lines if there's no state change.

Change-Id: I1ca86aa846084f53751076643665cb6dabc26a06
2021-10-14 17:04:24 +02:00
Pau Espin 578b540711 lchan: Update log line level to use macro and level INFO
Change-Id: Idd48fd8fbb13b715096a4765dcb08a18d85098a7
2021-10-14 17:03:45 +02:00
Pau Espin fd051b0f5c Move lchan related code to lchan.{c,h}
Change-Id: I17ebe6af69e31d1b4dbad7656bbf043f4c9243c1
2021-10-14 14:55:35 +02:00
Pau Espin 03cb50f809 lchan: Setup early_rr_ia timer only once during init
There's no need to re-setup it every time.

Mark the cb as static since its private to the module, and move it
above its use point so it can be referenced.

Change-Id: I90324f26d8ca09d425c7523a25b3e6c951fa49d6
2021-10-14 14:41:41 +02:00
Vadim Yanitskiy e73516ed00 rsl_tx_rf_res(): separate interference AVG / band calculation
It's cleaner from the architectural point of view to have the
interference measurements processed in a separate function.

Change-Id: I3981608e01a50585359cad673c38c8a305027d30
Related: SYS#5313
2021-10-08 10:48:51 +00:00
Pau Espin b1409015fa Introduce gsm_lchan_release function helper
Change-Id: I0525beaba3c833f8d7adf9701fe373761a7720d3
2021-10-07 12:11:52 +00:00
Pau Espin 36bbf1c328 Move lchan,power_control related code from gsm_data.c to their own files
We already have similar classification in osmo-bsc.

Change-Id: I1493f40d99f88a565f15d3e0943a512fb9b8719a
2021-10-07 12:11:52 +00:00
Pau Espin e525584f3a Move lchan,power_ctrl specific code from gsm_data.h to their own files
Let's split all lchan and power_control specific stuff into their own headers,
it helps finding out data and operations available related to them.

We already have similar classification in osmo-bsc.

Change-Id: I6424dcbd2e329fc1a516f8886359554ed7e9487e
2021-10-07 12:11:52 +00:00
Pau Espin 77e014f061 Introduce gsm_lchan_init() function helper
Let's move lchan specific struct stuff into lchan.c

Change-Id: I9cb96707c63b8b7d76591d25fe906f02e34bb76b
2021-10-07 10:26:24 +00:00
Neels Hofmeyr da7c56ab8e early IMM ASS: add configurable delay for RR IMM ASS
During live testing, it has become apparent that some IMM ASS still fail
when sending the RR IMM ASS directly upon the target channel becoming
active.

Add a bit of delay after activation, to give some time for the channel
to light up for the MS. Default is 50ms.

Related: OS#5559
Change-Id: Ia1e63b98944dc840cde212fc732e20277cdc5585
2021-09-11 13:10:33 +00:00
Neels Hofmeyr f1312f9818 enable Early Immediate Assignment
When an Immediate Assignment comes in targeting an lchan that is not yet
active, then hold back the RR Immediate Assignment until the channel
becomes active.

This allows the BSC to send the Immediate Assignment before first
waiting for the Channel Activation ACK, saving one Abis roundtrip, and
helping avoid double allocation on high latency Abis links.

Related: SYS#5559
Related: I56c25cde152040fb66bdba44399bd37671ae3df2 (osmo-bsc)
Related: Ifb2c62431a91dafa6116b5d6b9410930f00a6e18 (osmo-ttcn3-hacks)
Change-Id: Ie52765b238b01f22fb327fe12327fbf10abcad4c
2021-08-18 17:27:04 +02:00
Pau Espin a4b9073989 Rename osmo dyn ts enums to contain SDCCH8
They will gain support to be activated as SDCCH/8 soon too.

Related: SYS#5309
Depends: libosmocore.git I56dcfe4d17899630b17f80145c3ced72f1e91e68
Change-Id: Ia617d20fc52f09dbab8f4516c06fa1efac08e898
2021-07-05 08:03:08 +00:00
Neels Hofmeyr 9faaf4ecf0 cosmetic: common ts_is_pdch()
Have one common ts_is_pdch(), placed in lchan.c, since this file is pretty
empty and pretty close to ts. Publish in gsm_data.h.

Remove the if-style implementation from l1sap.c, and instead implement in a
switch statement.

This prepares for upcoming ts_is_pdch() usage in ph_data_req() for sysmo and
lc15.

Change-Id: Ib78d663fdbac5a1d7053f1b9d543649b66da00e2
2016-08-30 07:35:47 +00:00
Neels Hofmeyr 7efc2f3c5b debug log: log lchan state transitions
Change-Id: Id20f61ef535f4ea049da6579e41eb98f31238d23
2016-06-17 15:50:48 +00:00
Holger Hans Peter Freyther f4f69ee6fc lchan: Similar to OpenBSC use a set method to change the state
By making all modifications through lchan_set_state we can easily
add code to verify the state transition.
2012-04-19 09:39:15 +02:00