Commit Graph

2282 Commits

Author SHA1 Message Date
Pau Espin b5a8a67dfe Update libosmogsm deprecated include
The previous gprs/protocol/gsm_04_60.h header from libosmogsm was
misleading because it was placed in the subdirectory used by libosmogb,
and hence was recently deprecated in favour of gsm/protocol/gsm_04_60.h.
Let's follow the pragma message advising to move to the new header file.

Depends: libosmocore 0158b05337a825352d9fd7f074170b686e9fd1e5
Change-Id: I027abbf3ed4c71331000565af1ef4f08f10cfafc
2023-03-14 11:19:53 +01:00
Pau Espin 93d7ece833 osmo_bts_sock.c: Call osmo_fd_unregister() before closing and changing bfd->fd
Change-Id: Iec0faba781bcb2bc6de8710392655785790b9af4
2023-03-14 11:13:42 +01:00
Vadim Yanitskiy db5ac8ddd5 tests/Makefile.am: do not overwrite global LDFLAGS
We still want -no-install to be used for these tests.

Change-Id: I926df1918fd24ea7be4b390d168a8c76ef9931c0
2023-03-11 04:58:00 +07:00
Vadim Yanitskiy cc95424df9 {src,tests}/Makefile.am: libraries shall not be in AM_LDFLAGS
Change-Id: Ibd7eb55e2cfe7daed2f8a8d74c6a3ede6f29308f
2023-03-11 04:55:57 +07:00
Pau Espin 02d4b2a724 tbf_ul_fm: Allow receiving event TBF_EV_MAX_N3105 in state RELEASING
Change-Id: I8560293d7b0f3bfefc1641208196404bc4848bfd
2023-03-08 14:04:44 +01:00
Pau Espin 8bb176fdcb tbf: Increase log level if polling requested in wrong TS
Change-Id: I641bddcb4027ecc9cc1ec66d4d6b9b483c94c617
2023-03-07 17:08:47 +01:00
Philipp Maier 2353ed403f bts: add IMMEDIATE ASSIGNMENT via PCH transmission
In situations where the PCU is co-located to the BSC, the IMMEDIATE ASSIGNMENT
for downlink TBFs must be sent via RSL and the BSC also must instruct the BTS
to transmit the IMMEDIATE ASSIGNMENT via PCH instead of AGCH. Eventually the
BSC must sent a confirmation message (follow-up patch) where the TLLI is used
as an identifer.

This new method will eventually replace the previous method that uses
the MAC block as an identifier. To remain compatible with older versions
of osmo-bsc, we will keep the old method until osmo-bts is migrated as
well.

This patch also requires new features to be added to the PCU socket
interface the version number of the protocol is incremented from 0x0a to
0x0b. Version 0x0a will remain compatible and use the old method, while
version 0x0b will use the new method introduced with this patch.

Change-Id: I2a78651593323e8b9627c39918d949a33497b70f
Related: OS#5198
2023-03-06 17:39:11 +01:00
Philipp Maier c82c948e99 pcu_l1_if_phy: support multiple BTS (in theory)
The PCU already has a list that can hold multiple BTS objects but the
API for the direct PHY access has no way to associate a PHY with a
certain BTS object. Lets update the API so that we can associate a BTS
object when opening a PDCH.

Unfortunately OsmoPCU has never been tested with more than one BTS so it
is very likely that there are still shortcomings that prevent OsmoPCU to
work properly when more then one BTS is attached. To make users aware of
this, also print a warning as soon as more than one BTS object exists.

Related: OS#5198
Related: OS#5930
Change-Id: I33518cbbe83f7f8c071afa5e995d30930099ba92
2023-03-03 17:51:33 +01:00
Philipp Maier 6f41762717 pcu_l1_if: cosmetic: remove whitespace after *
Change-Id: Idd1abdfb8df4df58271025c7a808a692d9d86af7
2023-03-03 12:46:16 +01:00
Philipp Maier 916e9d3454 pcu_l1_if_phy: add new PHY API function to initialize PHY
The PHY implementations we currently have do not require any
initialization that has to run directly on startup. This will change
when we introduce support for the E1 based Ericsson RBS CCU. Then we
will have to perform at least one elarly initialization (VTY config
file). So lets add an API function for PHY initialization now.

Related: OS#5198
Change-Id: Ibf2a3a058c826f6ee5b740eee72d5be94d460517
2023-02-27 16:47:12 +01:00
Philipp Maier 72ed33303a pcu_l1_if_phy: add new PHY API function to disconnect PDCH
There is a function l1if_connect_pdch, but no complementary function
like we have it with l1if_open_pdch and l1if_close_pdch. The reason for
this is that the PHY implementations that rely on a femtocell DSP do not
need to disconnect the pdch explcitly. However, the planned support for
the E1 based Ercisson RBS CCU will require an explicit disconnect. So
lets add a function call for this.

Change-Id: Ied88f3289bda87c48f5f9255c4591470633cc805
Related: OS#5198
2023-02-27 16:46:01 +01:00
Philipp Maier af8d49a99d pcu_l1_if_phy: add header file for struct gsmtap_inst
Lets include the header file that contains the definition of struct
gsmtap_inst since this struct is directly used with l1if_open_pdch.

Change-Id: I9b859c4f7906f31547549d4ff7751fb720519270
Related: OS#5198
2023-02-27 15:15:18 +01:00
Philipp Maier 0cb3b2aa16 pcu_l1_if: use only the term "direct PHY access"
The log messages and code comments sometimes refer to the direct PHY
access feature as "direct DSP access". Lets use only the term "direct
PHY access"

Change-Id: I121ad85cd8581c40f390dbaad0d6a028d68b095e
2023-02-27 15:15:18 +01:00
Philipp Maier 7f5393ca6e en/decoding: fix deprecated include path
The file gprs/protocol/gsm_04_60.h is deprecated, now it is recommended
to use gsm/protocol/gsm_44_060.h

Change-Id: I870e446ad8f371e13bbdb4034feae1260c874ee5
2023-02-24 18:29:40 +01:00
Oliver Smith 83ee452ddb Run struct_endianness.py
Ensure there is no diff to prepare to run this in CI.

Related: OS#5884
Change-Id: I1c82acd09497371938a2d9ae12a80382d20189ff
2023-02-20 10:50:17 +01:00
Philipp Maier 84ece23c09 osmo-bts-xyz: include pcu_l1_if_phy.h in phy in l1_if code
The file pcu_l1_if_phy.h contains the function prototypes for the
implementations found in xyz_l1_if.c. Lets also include pcu_l1_if_phy.h
in the related .c files.

Change-Id: Id35ba473973108da4e36d5c6f2ca78da1225ae8b
Related: OS#5198
2023-02-15 15:38:31 +01:00
Philipp Maier 80828f0514 lc15/oc2g: fix function signature of l1if_open_pdch()
The function signatures l1if_open_pdch() in the code for lc15 and oc2g
differ from what is defined in pcu_l1_if_phy.h. Lets update the
signatures so that they match the prototype.

Related: OS#5198
Change-Id: If1693b1b74c1808596d7da639b860f7b226385c0
2023-02-15 15:38:31 +01:00
Philipp Maier eaf5da306c pcu_l1_if: move direct phy l1if functions to dedicated header file
The function headers for the direct phy related functions (l1if_...) are
currently directly listed in pcu_l1_if.cpp and osmobts_sock.c. Those
functions are basically the API interface definition between the
platform independed PCU code and the platform dependant direct phy code.
Lets put them into a dedicated header file.

Change-Id: Id54b96a4cd498a9860f3f209498132455e2aa6f8
Related: OS#5198
2023-02-13 13:54:58 +01:00
Philipp Maier 7c3fd98c90 pcu_l1_if.cpp: handle TLLI based IMMEDIATE ASSIGNMENT confirmation
The IMMEDIATE ASSIGNMENT for downlink TBFs must be confirmed by the
receiving end (BSC/BTS) in order to set the timers in the PCU correctly.

When the PCU is used in a BSC co-located scheme (Ericsson RBS). The TLLI
is used as an identifier to confirm a specific IMMEDIATE ASSIGNMENT.

Change-Id: Icf7ca34500984239ee877ee71fd9c126b5eb3480
Related: OS#5198
2023-02-13 12:46:43 +01:00
Philipp Maier d8cea3c618 pcuif_proto: move gsm_pcu_if_e1_ccu_ind into right place
The struct gsm_pcu_if_e1_ccu_ind is a bit misplaced. Lets move it next
to the info indication strucht, to have it in the same order is it used
in gsm_pcu_if

Change-Id: I4afafd8e94dc0083974ff2f5b6d6be0f5574d0bf
Related: OS#5198
2023-02-07 17:28:58 +01:00
Pau Espin 0ec7724d10 Bump version: 1.1.0.117-7932-dirty → 1.2.0
Change-Id: Iec69415edfca552798015decacf91dc50bda11bf
2023-02-07 17:10:46 +01:00
Philipp Maier 7932bc8d32 pcuif_proto: rename PCU_IF_SAPI_AGCH_DT to PCU_IF_SAPI_PCH_DT
The current name of PCU_IF_SAPI_AGCH_DT is a bit misleading as it
describes a method to send immediate assignment messages (normally AGCH)
via the PCH. The name in the constant should reflect that correctly

Change-Id: I6dfb8035134bc85a025415bd6c2f9c01987d9268
Related: OS#5198
2023-02-06 15:30:17 +01:00
Philipp Maier 40db4c330e pcu_l1_if: ignore frame numbers that exceed the valid range
osmo-bsc may send invalid frame numbers through the pcu-sock interface.
Lets make sure that incoming frame numbers do not exceed the valid
range.

Change-Id: Ib0cf1738be07733c95fc6c459a8a7c4cb2eeef26
Related: OS#5198
2023-02-06 15:19:18 +01:00
Philipp Maier 3b66bbf813 pcu_l1_if: cosmetic: use sizeof instead of constants
Change-Id: Ib99e0a5470758bc4235b140103f2abd448ac07d3
2023-02-03 15:46:07 +01:00
Pau Espin 08523c2286 rlc.h: Fix typo in param name
The function definition in rlc.cpp already uses the correct param name.

Change-Id: Ifd55fca3c04b72cef3a8f27d6826bc8529e85ec7
2023-02-01 19:51:42 +01:00
Philipp Maier 8b571ee2e7 pcuif_proto: add indication to communicate E1 parameters
osmo-pcu will also support GPRS via E1 timeslots in a BSC co-located
setup. To avoid duplicate configuration the BSC has to communicate the
E1 parameters (which TS, SS etc.) to the PCU. Lets add a new primitive
to do that.

Change-Id: Ia7928489130c1205b06bb9b10de0fb1461843301
Related: OS#5198
2023-01-31 17:24:31 +01:00
Pau Espin 76ef66698c Mark several fsm related internal symbols as static
After some earlier refactoring, those fields are only used internally in
the module, and hence can be marked as static.

Change-Id: Ibf2a6ee5636ae7102ffd13b7497769652bcc3202
2023-01-30 10:42:44 +01:00
arehbein 9e732ae4b1 osmo-pcu: Transition to use of 'telnet_init_default'
Related: OS#5809
Change-Id: I9559486ce64a9ccf348b4ee0e1d09141dbc1ae8f
2023-01-29 10:53:23 +00:00
Pau Espin ea6d534369 cosmetic: Remove unneeded curly braces
Change-Id: I6d87f11ff749d027685bf539a81f43d35ff98e9a
2023-01-27 11:29:52 +01:00
Pau Espin e0a8488773 llc: remove unused reference to msgb address
This is probably a leftover from an old refactoring where the tv was
moved to MetaInfo (msg->cb[].

Change-Id: I7aceaf2d13a125c75925877c4344c0aeed326c79
2023-01-26 18:20:12 +01:00
Pau Espin 1111aa16e6 llc: Refactor code checking if PDU expired while dequeueing
The previous function name was misleading since it was checking already
for more stuff than pdu containing user data.
Rename the function and move all checks on PDU in there instead of
having it half in one place and half in the other.

Change-Id: Ia0738caa1ccab5f78c2d49db582bdce96f18600a
2023-01-26 15:10:29 +01:00
Pau Espin 0e435fa959 llc: Mark llc_is_user_data_frame() as static
It's only used once in the same file.

Change-Id: I8e38a946c87142a09e0b49ea3160df1d5772b587
2023-01-26 14:56:45 +01:00
Philipp Maier 6a5b1b1f3e bts: log FN jump delta in bts_set_current_frame_number()
In case of an FN jump the expected value is logged. Lets also log the
delta between the expected and the current FN as it may give a better
clue what goes wrong

Change-Id: Ie361df30852570fe8a47347a42e962db869ccf82
2023-01-05 16:58:20 +01:00
Philipp Maier a42521dfbb bts: use GSM_TDMA_FN_ macros and uint32_t in bts_rfn_to_fn
The function bts_rfn_to_fn() uses int32_t for its internal variables and
the input parameter rfn while the callers and everything outside uses
uint32_t to store frame numbers. Lets convert this to uint32_t and use
GSM_TDMA_FN_ macros wherever possible.

Change-Id: Iedd493bb30dd1c342dec031883060c545432e740
Related: OS#5198
2023-01-05 16:58:20 +01:00
Philipp Maier 39f5e27412 bts: refuse to set invalid frame numbers
A valid GSM frame ranges from 0 to 2715647. When using
set_current_frame_number() to set the current frame number (source
usually is the layer 1 and below) we should not allow invalid frame
numbers.

Note: this also fixes FnTest which uses invalid frame numbers for
testsing.

Change-Id: Iaae31b370fababba975d419b0d20ac15618c296e
Related: OS#5198
2023-01-05 16:56:28 +01:00
Pau Espin d1058b9445 Avoid moving DL-TBF from old_msg to new_ms during ms_merge
The DL-TBF assigned to another MS object may have a totally different
set of reserved resources (TS set, TRX, etc.), so one cannot simply move
those to the new MS. To start with, if the 2 MS are on different TRX it
is clear that one of them will not be really in operation. That's most
probably the DL-TBF being in ASSIGN state on CCCH waiting for PCUIF_CNF
and later X2002 to trigger to start sending DL blocks, but without
confirmation whether the MS is really there. Since the other new MS
object probably has a UL-TBF, that's the one probably operative, and
hence a new DL-TBF can be created at that same time and assigned through
UL-TBF's PACCH.

Unit test test_ms_merge_dl_tbf_different_trx showcases the above
scenario.

Related: SYS#6231
Related: OS#5700
Related: 677bebbe5c
Change-Id: Ie8cb49d5492cfc4cbf8340f3f376b0e6105e8c82
2022-12-19 12:32:44 +01:00
Pau Espin 0aacd21658 tests/TbfTest: reproduce buggy corner case: MS with TBFs on 2 TRXs
Add a test which showcases a scenario where the PCU ends up with 1
GprsMs object holding a DL-TBF in a weird condition half in one TRX and
half in other due to ms_merge().

This test (slightly adapted) used to cause a crash in osmo-pcu.git
586ddda9bc (a few versions behind current
master).

Related: SYS#6231
Change-Id: Ic16b5e96debf91e72684833cd64253687857f3aa
2022-12-19 12:32:33 +01:00
Pau Espin 0d957d8364 bts: Adapt trx check based on bts->trx[] defined array size
This way the code is not hardcoded to 8 TRX.

Related: OS#5827
Change-Id: I5ccb5ec27bc189d17c62e7f2a59fae0b3bddf8e3
2022-12-16 12:54:46 +01:00
Pau Espin 5b7eeecac2 Pass gprc_rlcmac_pdch to tbf_set_polling
Change-Id: I5ecc57c72e7f60e31e64e76e724d7a5a95968c40
2022-12-16 12:11:31 +01:00
Pau Espin fd74e79ab3 Pass gprc_rlcmac_pdch to tbf_check_polling
Change-Id: I1c7140b35b7c93d3df4156841e908d3b44d7336d
2022-12-16 12:11:31 +01:00
Pau Espin d29a1435ad Pass gprs_rlcmac_pdch to create_dl_acked_block()
This allows having full TS information, not only ts_no, which will be
needed later on followup patches.

Change-Id: I1efccb32c5afa4fe62233bf114ea95b6fbbe1a06
2022-12-16 12:11:31 +01:00
Pau Espin ef1b9847f1 tests/tbf: test_tbf_dl_llc_loss(): Fix wrong param passed and wrong expectancies
The DL-TBF in the test gets its TS allocated on TS4 (only that one is
enabled through setup_bts(bts, ts_no=4)), and hence it makes no sense to
ask it to send data on TS7.

Change-Id: Ibe6fc073b7438b8024c4d3ddb0e60c6112752351
2022-12-16 12:11:31 +01:00
Pau Espin e2ed40d02b Convert tbf->control_ts to be a gprs_rlcmac_pdch*
This allows having full information on the control TS easily reachable
(like TRX ofthe PDCH), and makes it easy to compare TS by simply
matching the pointer address.

Change-Id: I6a97b6528b2f9d78dfbca8fb97ab7c621f777fc7
2022-12-16 12:11:31 +01:00
Pau Espin 02aeba47df tbf: Fix typo in define used
Change-Id: I1d85cba17fc1ee70a063ed03c7707876e1349515
2022-12-16 12:11:31 +01:00
Pau Espin 23ae0e3d23 pdch: Introduce APIs to print PDCH name
This will allow printing PDCH with same formatting outside of LOGPDCH.

Change-Id: If18cb4a48237751e0dddede6793191b36dfe386d
2022-12-16 12:11:23 +01:00
Pau Espin ff7c581011 Rename gprs_rlcmac_ts_alloc.cpp -> alloc_algo.cpp & create own .h file
First commit towards trying to have alloc algorithm as isolated as
possible from others parts of the code trying to avoid state changes on
data structures.
Change name also because the alloc_algo not only allocated TS, but TFIs
and USFs.

Change-Id: I33a6c178c64a769f05d3880a69c38acb154afa62
2022-12-16 12:08:07 +01:00
Pau Espin 9935d0d21d Convert ms_first_common_ts to struct gprs_rlcmac_pdch
This way it contains full information about the TS, not only the TN.

Change-Id: I19373939ec104d371e3e91422f018a8175cb0f89
2022-12-16 12:08:07 +01:00
Pau Espin 478c150a09 bts: Adapt slot_mask to trx defined array size
struct gprs_rlcmac_bts still hardcodes it to 8, but using ARRAY_SIZE
there should aim at seeing the relation between those, and avoid having
one updated without the other.

Related: OS#5827

Change-Id: I165588ba10d8528a9a496175d8dfe9d902c89e55
2022-12-16 11:05:46 +00:00
Pau Espin a621d59ea8 Refactor code rejecting UL-TBF upon rx of PktResourceReq
* Make it similar to the already existing TBF allocation procedures
* Pass pdch pointer instead of trx and ts numbers

Change-Id: I04b3b65942732cc652adeaa507529b849292ff61
2022-12-16 11:05:46 +00:00
Pau Espin 57b2589041 tbf_ul: Fix wrong struct type in field
This typo was harmless so far because both old and new structures have
the exact same content.

Change-Id: If2e20128a589a25b9dc3fd08340cdb92aad158c3
2022-12-16 11:05:46 +00:00