aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/l1_if.c
AgeCommit message (Collapse)AuthorFilesLines
12 dayslog: set L1 SAPI log contextOliver Smith1-0/+45
Add a new common L1 SAPI enum, to unify all the BTS specific SAPIs. Translate to this enum, and set the context for uplink messages in each BTS specific implementation. Set the context for downlink messages in the common l1sap code, by converting the osmo_phsap_prim back to the SAPI value (mostly looking at chan_nr). The new functions for doing this conversion, get_common_sapi_by_trx_prim() and get_common_sapi_ph_data(), are based on the existing to_gsmtap() and gsmtap_ph_data() functions. Note that we can't set the uplink SAPI context in the common code, because then we can't set it as early as possible. In this patch, the SAPI context is set for the PHYs where the SAPI is readily available. With additional conversion from the RSL channel, the SAPI context could be set for osmo-bts-trx in a follow up patch. Related: OS#2356 Depends: (libosmocore) I814cb3328d99faca9220adb5a80ffb934f219d7d Change-Id: I6b7bb2e1d61502b61214f854a4ec5cbb7267545b
2019-07-21Move Access Burst link quality handling to L1SAPVadim Yanitskiy1-7/+1
Change-Id: I893ec9c6c2ebad71ea68b2dc5f9f5094dfc43b78 Depends: (libosmocore) Ie2a66ebd040b61d6daf49e04bf8a84d3d64764ee
2019-07-21Clarify and refactor link quality (C/I) handlingVadim Yanitskiy1-1/+1
The radio link quality is defined by C/I (Carrier-to-Interference ratio), which is computed from the training sequence of each received burst, by comparing the "ideal" training sequence with the actual (received) one. Link quality measurements are used by L1SAP to filter out "ghost" Access Bursts, and by the link quality adaptation algorithms. One can define minimum link quality values using the VTY interface. On the VTY interface we expect integer C/I values in centiBels (cB, 10e-2 B), while the internal structures are using float values in deciBels (dB, 10e-1 B). Some PHYs (sysmo, octphy, oc2g, and litecell15) expose C/I measurements in deciBels, while on the L1SAP interface we finally send then in centiBels. Let's avoid this confusion and stick to a single format, that will be used by the internal logic of OsmoBTS - integer values (int16_t) in centiBels. This will give us the range of: -32768 .. 32767 centiBels, or -3276.8 .. 3276.7 deciBels, which is certainly sufficient. Change-Id: If624d6fdc0270e6813af8700d95f1345903c8a01
2019-07-21sysmo/l1_if.c: Annotate fall-through in switch statementHarald Welte1-0/+1
Change-Id: I72937e087288fe7681fafe4099e49849657924bd Closes: CID#162019
2019-06-05Use #define RSL_CHAN_RACH for RSL Channel Number of RACHVadim Yanitskiy1-1/+1
Change-Id: I7f54fccdae6799e5f4d956a101e11c2d6f998546
2019-05-22sysmo: Fix "nominal power" / BS power display in VTYHarald Welte1-1/+1
The function get_p_max_out_mdBm() returns a value in 1/1000th of dBm, "milli-dBm", while trx->nominal_power is only whole dBm. We were missing the required divider of 1000 ever since Change-Id Ieff75d5becaa80a2097b6e744c75c2d16259c9a4 was merged in February 2017. The good news is that this really only affected the VTY output and not any actual operational aspect of the system. Change-Id: If92d0b15c48dafc63776b82c7ff5f3c2b3505f68 Closes: SYS#4570
2018-11-19add missing check of osmo_wqueue_enqueue() return valueStefan Sperling1-1/+5
The return value of osmo_wqueue_enqueue() isn't checked. This can result in a memory leak if the message cannot be enqueued. Log an error an free the message upon failure, as done elsewhere. Change-Id: I5671ca364f31d98f2b28d028e7bf1797386de2ec Related: CID#57662
2018-09-30sysmo, virtual: properly handle BS-AG-BLKS-RES as received from BSCHarald Welte1-1/+1
Change-Id: Ifd9a3be6189b3288526e12260d68a982b089404e
2018-09-30Fix computing CCCH block number from frame numberHarald Welte1-1/+1
The existing implementation used a simplistic macro, which was wrong in many ways: 1) it returned a negative value for "fn % 51 < 5" conditions without raising any error message or asserting 2) it returned a wrong block number for many different input frame numbers, as it didn't account properly for the FCCH/SCH gaps between the blocks Let's replace the simplistic macro with a proper lookup table based on TS 05.02, and let's OSMO_ASSERT() if this is ever called with non-CCCH frame numbers. Change-Id: I11fd6cc558bb61c40c2019e46f56c1fe78ef39f5 Closes: OS#3024
2018-09-17CBCH: Fix CBCH via L1SAP for osmo-bts-{sysmo,octphy,litecell15}Harald Welte1-1/+3
This fixes a bug introduced in "CBCH: Move processing via L1SAP" commit 02d99db08b13589e1417c3448a07747f8805ba88 Author: Harald Welte <laforge@gnumonks.org> Date: Fri Aug 24 23:37:45 2018 +0200 where the full channel number 0xc8 was used instead of the (right-shifted) C-bits only. Change-Id: I0fd8d7762e9cc3319a534f261e8857a1aa2220e0
2018-09-09CBCH: Move processing via L1SAPHarald Welte1-5/+3
for some historical reason, CBCH handling was not using the normal L1SAP boundary. Let's change that and traverse L1SAP just like for e.g. BCCH which is quite similar to CBCH handling. This also has the added benefit of logging CBCH via GSMTAP. Change-Id: Ibdba4c5e808330f8406f441a97fe0e81170fce97 Closes: OS#3534
2018-09-09[sysmo,lc15]: Consider CBCH channel combinations in chan_nr_by_sapi()Harald Welte1-0/+4
Whenever a CBCH is used, this results in a new physical channel combination on the relevant timeslot. The chan_nr_by_sapi() function must handle those cbch-enabled PCHAN types. Change-Id: I963909bcec8392ec445d0bcf53a2a8d7d9535444
2018-06-22sysmo: l1_if.c: Avoid decl of unused vars and funcs with femtobts_v2.7 buildPau Espin Pedrol1-3/+4
Change-Id: I4e6d97114289027fbcff00f77cd42db5277a54ab
2018-06-22sysmo: l1if_mute_rf: Declare vars inside ifdef sectionPau Espin Pedrol1-3/+2
Otherwise sysp variable is unused and compiler triggers a warn. Change-Id: Ie3a3529442a36bb885ef634b8b49ac801bd263da
2018-06-22sysmo: Fix memcmp in RF-MUTE.req for superfemto < 3.6.0Pau Espin Pedrol1-2/+2
Fixes following compilation warning: In file included from l1_if.c:32:0: l1_if.c: In function ‘l1if_mute_rf’: /include/osmocom/core/utils.h:13:30: error: ‘sizeof’ on array function parameter ‘mute’ will return size of ‘uint8_t * {aka unsigned char *}’ [-Werror=sizeof-array-argument] #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) ^ l1_if.c:1405:29: note: in expansion of macro ‘ARRAY_SIZE’ if (!memcmp(mute, unmuted, ARRAY_SIZE(mute))) { ^~~~~~~~~~ l1_if.c:1388:51: note: declared here int l1if_mute_rf(struct femtol1_hdl *hdl, uint8_t mute[8], l1if_compl_cb *cb) ^~~~ In file included from l1_if.c:32:0: /include/osmocom/core/utils.h:13:30: error: ‘sizeof’ on array function parameter ‘mute’ will return size of ‘uint8_t * {aka unsigned char *}’ [-Werror=sizeof-array-argument] #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) ^ l1_if.c:1408:19: note: in expansion of macro ‘ARRAY_SIZE’ for (i = 0; i < ARRAY_SIZE(mute); ++i) ^~~~~~~~~~ l1_if.c:1388:51: note: declared here int l1if_mute_rf(struct femtol1_hdl *hdl, uint8_t mute[8], l1if_compl_cb *cb) ^~~~ Change-Id: Id040aeb35549ddb75072942be0093064a89092a6
2018-06-20l1_if.c: Move decl of vars used in conditional macroPau Espin Pedrol1-3/+3
Nowadays, with latest versions of superfemto, those variables are unused. Change-Id: Iec6c28840745e1bd99406b777ea5db66ca1d6fd9
2018-03-17Get rid of 'struct gsm_bts_role_bts'Harald Welte1-2/+1
gsm_bts_role_bts was introduced at a time when we still shared gsm_data_shared.[ch] between BSC and BTS, and where we then subsequently needed a BTS-private structure. Since that sharing was abandoned quite some time ago, we can merge gsm_bts_role_bts into gsm_bts and do away with the bts/btsb dualism in a lot of the code. Change-Id: I4fdd601ea873d9697f89a748cc77bcf7c978fa3e
2018-03-10sysmobts: Compatibility with older firmware versionsHarald Welte1-1/+12
When using a firmware version < 3.6, the call to l1if_mute_rf() returned an error, which caused an OML CHG ADM STATE NACK. Let's check if the l1if_mute_rf() call is an un-mute for all timeslots (which apparently we do always at start-up). If it is, then acknowledge it even if muting is not supported by earlier firmwares. I suppose the change causing this problem was introduced in: commit b26b8fc77692e851469f3e27b9aeaeff233ffd2e Author: Holger Hans Peter Freyther <zecke@selfish.org> Date: Tue Mar 4 15:03:59 2014 +0100 sysmobts: Do a RF mute at initialization when the RC is locked With the current change applied, we can run the BTS with earlier firmware versions than 3.6.0 again. Tested with 3.1 and 2.4 Change-Id: I1a29c1031d96e65a0111bc812a90f2dbaf2a5aa3
2018-03-08fix handover: handle_ph_ra_ind(): evaluate ra_ind before msgb_trim()Neels Hofmeyr1-40/+46
Commit c2b4c668f3510b7b0baace749c5a310959010e90 I3b989580cb38082e3fd8fc50a11fedda13991092 introduces evaluation of ra_ind members below the msgb_trim() call that actually invalidates ra_ind. A symptom is that it breaks detection of Handover RACH, wich always ends up with lchan == NULL and interpreting all RACH as chan_nr == 0x88. Fix: do all evaluation of ra_ind before the msgb_trim(), for osmo-bts-sysmo, litecell-15 and octphy. To guard against similar mistakes in the future, set ra_ind = NULL before the msgb_trim() call. Related: OS#3045 Change-Id: I203021ee57f49cb963679ba8bec5943e2abb67fb
2018-02-27L1SAP: Increase resolution of reported burst timingHarald Welte1-2/+2
Before this patch we had: * osmo-bts-trx internally using 1/256th bit/symbol period * osmo-bts-sysmo internally using 1/4 bit/smbol period * PCU interface using 1/4 * L1SAP interface using 1/4 * measurement processing code on top of L1SAP using 1/256 So for sysmo/lc15/octphy we are not loosing resolution, but for osmo-bts-trx we're arbitrarily reducing the resolution via L1SAP only then to compute with higher resolution again. Let's change L1SAP to use 1/256 bits and hence not loose any resolution. This requires a corresponding change in libosmocore for l1sap.h, which is found in Change-Id Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d Change-Id: If9b0f617845ba6c4aa47969f521734388197c9a7
2018-02-27Move rach_busy counting above L1SAPHarald Welte1-10/+6
In the past, rach_busy counting was performed below L1SAP, while reporting was handled above. This lead to subtle differences between the BTS models, such as osmo-bts-trx missing to increment rach_busy. Let's move the rach_busy counting above L1SAP to share more code. This means we need libosmocore Change-Id I9439810c3a3ad89ea0302753617b850749af887c for the additional required parameters in ph_rach_ind_param, as well as libosmocore Change-id I2b1926a37bde860dcfeb0d613eb55a71271928c5 for osmo-bts-trx to determine the RACH bit error rate. Change-Id: I3b989580cb38082e3fd8fc50a11fedda13991092 Closes: OS#3003
2018-02-26{sysmo,lc15}: Fix RACH reporting in combined CBCH caseHarald Welte1-1/+2
Combined CCCH with CBCH is a separate PCHAN type and hence we must accept it in the list of RACH-carrying pchan types in order to correctly report the RACH chan_nr when handing RACH requests up to L1SAP. The bug this fixes likely might have rendered cells with combined CBCH impossible to use. Change-Id: I9537463e5eedd2b8b30f298e0d3b308367c5b1fb
2018-02-26{sysmo,lc15}: Correctly report BER to L1SAP in INFO_MEAS_INDHarald Welte1-1/+1
L1SAP uses 'ber10k' values, i.e. BER in 1/10000 units, where 10000 is all errors are bit-errors (= 100%). The PHY on osmo-bts-sysmo and osmo-bts-lc15 is reporting a float fBer value scaled to 1, i.e. 1.00 = 100% and hence must be 10000 as ber10k. Before this patch, BER values reported on those BTS models were too low by a factor of 100, resulting in way too optimistic RxQual values reported to the BSC. Closes: OS#3005 Change-Id: I17e2f8fe8055f613da1e554cd36ed13289f56fb3
2018-02-22Introduce + use LOG/DEBUGP with frame number prefixing/printingHarald Welte1-13/+10
Let's make sure whenever we do have a frame number, we print it as context in the related log line Change-Id: I751d5ddb3322fce489bc241459738cbcc55c890b
2017-10-11sysmo: don't override clock source with defaultsMax1-11/+14
Previously clock source configured via vty was ignored. Check that it wasn't configured and only apply default value in that case. Change-Id: I8de74a12d2096971a8a83946dc6c7cdb9889acd7 Fixes: OS#1944
2017-10-11sysmo: use clock calibration source wrapperMax1-1/+1
Make get_clk_cal() public and use it for ctrl commands handling. This ensures that the calibration is properly selected depending on the clock source. Change-Id: I1c809d48f29ef8e8c50641f882d7a954dfcf88f9 Related: OS#1944
2017-08-09L1SAP: Use RSL_CHAN_OSMO_PDCH across L1SAPHarald Welte1-2/+2
So far, L1SAP code is hiding RSL_CHAN_OSMO_PDCH from the bts specific code below L1SAP. This is some kind of a hack/workaround, making code and debug output / logs more difficult to understand. So let's teach the lower layer how to treat RSL_CHAN_OSMO_PDCH and remove the "hiding" code from the common l1sap.c code. Change-Id: Iaaa833febe45b82166d3901f10cc5466a7591c19
2017-08-01lc-15, sysmo: l1_if: print name on PH-DATA.ind unknwon sapiPau Espin Pedrol1-2/+2
Change-Id: I007e5f0ce9709026331817e55148749e21d8b015
2017-07-10osmo-bts-sysmo: Include frame number in MEAS INDPhilipp Maier1-2/+3
l1_if.c does not generate struct osmo_phsap_prim l1sap properly. The frame number is not included in this struct. This renders the logic that processes the reported measurements non functional, since the logic (see measurement.c) is not able to detect the end of the measurement period. This commit fixes the problem by adding the missing frame number to the l1sap structure. Change-Id: I09241d6cc2ff09e71a3d723d90e4468108a27ae1
2017-07-10Use osmo_dump_gsmtime to log fn across different layersPau Espin Pedrol1-2/+5
This commit also fixes a missing end of line in the log output of handle_ph_data_ind Change-Id: I049f58d51333d3590361db5c0105e6899a862af6
2017-07-10Allow passing low link quality buffers to upper layersPau Espin Pedrol1-8/+1
We want to always call l1if_tch_rx and l1sap_up in order to avoid losing triggering events on the upper layer. With this change, the upper layer will increase correctly seq + ts for RTP. It will then send an RTP packet with only the header and no payload, which is not correct but at least we avoid drifting the RTP clock. Upcoming patch in the series solves this issue. This patch assumes that we are not lossing data events from the physical layer and that we receive an event every 20ms, even if the MS is not transmitting due to DTX. Depends on libosmocore If4ae20c22b881e94585dad710f17b9e37f77bf82 Change-Id: If5df8940fab833eb4e3ed851880b66987d356031
2017-07-04Revert "osmo-bts-sysmo: Include frame number in MEAS IND"Philipp Maier1-7/+2
This reverts commit 3f97e4b1fcdc788345ab7740bd4fb8a3d73f5526. Change-Id: Ib50c813c470bf6ea740fe6667431eaa1a23fdd8d
2017-06-29Revert "sysmobts: normalize frame number in measurement indication"Philipp Maier1-10/+2
This reverts commit 88b2cc30a6a7253c2c4c76178e5727fad48556ca. Change-Id: I30f37a9feef24a45e254377502615d717dba9765
2017-06-24osmo-bts-sysmo/l1_if.c: PH-DATA.ind belongs to L1P, not L1CHarald Welte1-1/+1
L1C is control, while L1P is data primitive. Change-Id: I5a0ef08df96a67cd25b11eb23c60934011b01c29
2017-06-09sysmobts: normalize frame number in measurement indicationPhilipp Maier1-2/+10
The higher layers relay on a normalized version of frame number in order to detect the end of a measurement period. The frame number on which the measurement reports are sent may depend on the phy, so we need to normalize the frame number before we report it to the higher layers. Change-Id: I90bd01479e41f04a6b0aefe3845d071e3148d0c6
2017-06-09Re-add version to phy_instanceMax1-0/+4
This is resubmission of 9eeb0b1a136fc8c24a86cb4d832c264674c10db0 with errorneous use of talloc_asprintf() removed which should fix OS#2316. Change-Id: I02ae6fffdc808c1ea14185dbb4a720d27a62d4bb Related: OS#1614
2017-06-02Revert "Add version to phy_instance"Neels Hofmeyr1-4/+0
This reverts commit 9eeb0b1a136fc8c24a86cb4d832c264674c10db0. This commit caused osmo-gsm-tester test runs for the sysmoBTS to fail with SIGABRT consistently. See below redmine issues. In osmo-bts-sysmo/l1_if.c, it uses talloc_asprintf to write to the char version[MAX_VERSION_LENGTH]; talloc_asprintf() however is intended to work on string buffers allocated by talloc, and attempts to reallocate version[]. Furthermore, it is not clear why the patch passes a 'data' arg to app_info_sys_compl_cb() that is not used. Hence I will revert this instead of trying to fix. Please resolve issues and re-submit. Related: OS#2316 OS#1614 Change-Id: I2c9fd5e6739c1750365c0241476ce4b1aa2df3d4
2017-05-29Add version to phy_instanceMax1-0/+4
Change-Id: I5b2352b8d15e9b0d8616fcd526b4902d247e4693 Related: OS#1614
2017-05-29sysmobts: Re-order the bit-endianness of every HR codec parameterHarald Welte1-0/+3
The so-called "RTP mode" of the DSP contains a bug on all firmware versions < 5.3.3 which causes the bit-order within each of the non-aligned codec parameters to be wrong. Introduce a function originally written by Sylvain Munaut during 32C3 in http://git.osmocom.org/openbsc/commit/?h=sylvain/32c3_codec&id=5b4a16bbe93a7b1ace65cc23d6cce56ecf4f1275 to bring the bits into [the correct] order. This has never been seen in a "pure sysmoBTS" setup, as all BTSs would use the same (wrong) bit-ordering and thus interoperate. This patch now checks for an affected DSP firmware version and then jumbles (old DSP firmware version) or does nothing (new DSP firmware version). Change-Id: Ia0eee4f514fb8fd81c052bb44a4facba898d6afb Closes: SYS#2452
2017-05-29osmo-bts-sysmo: Include frame number in MEAS INDPhilipp Maier1-2/+7
l1_if.c does not generate struct osmo_phsap_prim l1sap properly. The (logical) frame number is not included in this struct. This renders the logic that processes the reported measurements non functional, since the logic (see measurement.c) is no longer able to detect the end of the measurement period. This commit fixes the problem by adding the missing frame number to the l1sap structure. Change-Id: I2bab40c30d727395eb3096026810917407419cd7
2017-05-27Implement basic Get Attribute responderMax1-0/+4
Add 3GPP TS 52.021 §8.11.2 Get Attribute Response handling: * report OsmoBTS version * report sysmoBTS sub-model * report OsmoBTS variant Requires I7ecb0c4339530d3a8354a2f94b34063dda87e030 in OpenBSC. Change-Id: I09f95ed995fab5def9dc6e8cc201012fba4db28d Related: OS#1614
2017-05-15Prepare for BTS attribute reporting via OMLMax1-2/+2
* move BTS model name resolution into separate function * add convenience wrappers for BTS type and number fo TRX and use then in L1 interface Change-Id: I4649100df8f1b8e095f210fc294567ba014c0b6a Related: OS#1614
2017-02-14sysmobts: fully support trx_power_paramsHarald Welte1-3/+43
The simplistic approach of sysmobts_get_nominal_power() is insufficient to cope for devices that have an internal PA. The Actual transceiver board is driven to a certain level (0..23 dBm typically), and the external PA must be handled independent of that. Increasing the return value of sysmobts_get_nominal_power() would result in the sysmoBTS mainboard attempting to reach a higher power, which is wrong. This change affects sysmoBTS 1020 and 1100. It causes power-ramping to be used by default. For 1002 and 2050, no behavior change is expected. Change-Id: Ieff75d5becaa80a2097b6e744c75c2d16259c9a4
2017-02-01Fix AMR HR DTX FSM logic.Jean-Francois Dionne1-4/+13
Fix SID_FIRST_INH detection during speech and when SID_FIRST is interrupted by FACCH. Fix SID_UPDATE_INH detection during silence and when SID_UPDATE is interrupted by FACCH. Add a delay for SID_FIRST to appear at the right time after FACCH. Fix extra byte sent in downlink for SID_FIRST and SID_UPDATE. Change-Id: Ia811305e15541f2376005df736bd610e8b0d2f69
2017-02-01DTX: fix "unexpected burst" errorJean-Francois Dionne1-0/+1
Fix error during FACCH interruption of DTX for AMR HR. Max's note: added fix for sysmobts. Change-Id: Ib064952331b4f89676ee68a3d8078b1d9debe570 Related: OS#1801
2017-01-31sysmo,lc15: fix memory leak at each call placedJean-Francois Dionne1-1/+3
Max's note: added same fix for default case and ported it to sysmobts. Change-Id: Ife1293e3238cfda16eac9c28e7e81ffe5595e031
2017-01-12lc15,sysmobts l1_if: fix memleak in handle_mph_time_ind()Jean-Francois Dionne1-0/+1
Change-Id: I3061060235a488b114b636b3af9a2253a94de1e8
2017-01-04DTX AMR HR: fix inhibitionMax1-1/+5
* Unlike in AMR FR, in AMR HR incoming ONSET have to be treated differently depending on whether we've recently sent SID UPDATE or EMPTY frame. Split ST_SID_U FSM state into 2 states to accommodate for that and make sure that additional states specific to AMR HR are not used for AMR FR. * Avoid sending E_VOICE and E_SID_U in corresponding states as those do not initiate FSM state transitions anyway. This decrease extra load from FSM signalling which otherwise would be triggered on per-frame basis. * Introduce separate signal for SID First P1 -> P2 transition to avoid confusion with E_COMPL and E_SID_U initiated transitions from P1 state. * Don't init DTX FSM for SDCCH channels. Change-Id: I229ba39a38a223fada4881fc9aca35d3639371f8 Related: OS#1801
2016-12-01Fix AGCH/PCH proportional allocationMax1-16/+0
Do not assume that 1 == BS_AG_BLKS_RES but take that information from SI3. Note: due to current implementation quirks we activate channels before SI3 obtained, than we deactivate channels upon receiving SI3 and activate them again. This might not be necessary once we migrate to proper OML state machines. This affects lc15 and sysmo hw. Change-Id: I11377b12680ac3b2f77f80e742b6f0af63fc9c1e Related: OS#1575
2016-12-01DTX DL AMR: rewrite FSM recursionMax1-13/+20
Add explicit state for recursion (sending the different payload data in response to the RTS request for same FN) and corresponding transition. Remove ST_FACCH_V as with new explicit recursion handling it becomes unreacheable. This makes it easier to maintain preemption (interruption of current procedure due to FACCH or Inhibition). This also reduces the number of possible transitions out of each state thus reducing graph's cyclomatic complexity. Change-Id: If39b68083d23a4a35f468a5d75f54eb733ebfd14