aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-octphy/l1_if.c
AgeCommit message (Collapse)AuthorFilesLines
2022-04-25model_init: order features alphabetically, part 2Oliver Smith1-2/+3
Order the ones I've overlooked as well. Related: SYS#5922, OS#5538 Change-Id: I0aa344de9ea4849de0fcd7b44bfaa70274af594b
2021-11-25[lc15,oc2g,octphy] Fix memory leak on write queue overflowHarald Welte1-1/+5
Callers of osmo_wqueue_enqueue must always check the return value and free the message themselves in the error case. Change-Id: Ic67fbef23e419c0c8a7bcfb16d134e1bf649de72 Related: OS#5329
2021-07-05Rename osmo dyn ts enums to contain SDCCH8Pau Espin Pedrol1-2/+2
They will gain support to be activated as SDCCH/8 soon too. Related: SYS#5309 Depends: libosmocore.git I56dcfe4d17899630b17f80145c3ced72f1e91e68 Change-Id: Ia617d20fc52f09dbab8f4516c06fa1efac08e898
2020-11-03fixup: vty: call bts_model_vty_init() from bts_vty_init()Vadim Yanitskiy1-2/+0
Now bts_model_vty_init() must be called only once, otherwise the process would crash when bts_model_init() is called from main(). Change-Id: I262c39896b5db86c54ad9aa7042c7ca6657815d9 Related: SYS#4937, OS#3036
2020-10-20Introduce NM Channel FSMPau Espin Pedrol1-5/+0
Change-Id: I288cbfb4730b25a334ef1c3d6b9679d6f1d4cfc5
2020-10-20Introduce NM Radio Carrier and Baseband Transceiver FSMsPau Espin Pedrol1-8/+6
All the Operative State logic to manage a RadioCarrier//BBTransc NM objects is centralized in these FSM, where other parts of the code simply send events to it. This allows keeping state consistent and offloading logic from each bts backend, since they are only required to submit events now. The idea in the long run is to also replace other NM objects with similar FSMs. This improved logic fixes bug where PHY + RSL link became available before OPSTART and hence op state changed to Enabled before receiving any OPSTART message. Change-Id: Ifb249a821c4270918699b6375a72b3a618e8cfbe
2020-10-19use osmo_fd_setup() everywhereHarald Welte1-4/+1
Change-Id: I9be55f791a15fae2362dc431dc778b9b9d8db349
2020-07-05Move gsm_bts code gsm-data.* => bts.*Pau Espin Pedrol1-0/+1
bts.h refers to struct gsm_bts object, but we still had a bunch of stuff in bulky gsm_data.* from old days. Let's move stuff where it belongs to start clean up of gsm_data. Change-Id: I0a4219e3f64f625ee8b364bf408b8d2bcc8085c5
2020-06-11Do not mix public and private BTS features, use libosmocore's APIVadim Yanitskiy1-5/+5
It was a very bad idea to mix "public" BTS features, that are reported to the BSC via OML, and those features, that are used locally (and exclusively) in osmo-bts. Why? At least because we already have the BTS feature manipulation API in libosmocore, that is used by osmo-bsc, but for some reason not by osmo-bts. New features added to libosmocore would clash with the existing "internal" ones like BTS_FEAT_MS_PWR_CTRL_DSP. So what this change does can be described as follows: - remove duplicate definition of the "public" features, - use libosmocore's API for the "public" features, - separate both "internal" and "public" features: - the "public" features continue to live in bitvec, - the "internal" features become flags, - s/BTS_FEAT/BTS_INTERNAL_FLAG/g. Change-Id: Icf792d02323bb73e3b8d46384c7890cb1eb4731e
2020-05-09Use OSMO_FD_* instead of deprecated BSC_FD_*Pau Espin Pedrol1-1/+1
New define is available since libosmocore 1.1.0, and we already require 1.3.0, so no need to update dependenices. Let's change it to avoid people re-using old BSC_FD_READ symbol when copy-pasting somewhere else. Change-Id: Id51ccb2c273c5f0fa4986f28bbd69a72d2dbaa0e
2020-02-12l1_if: Fix strange formatting of Meas info loggingPau Espin Pedrol1-9/+5
Some use LOGPC, but were used after a LOGP with a trailing newline. Let's simply add some defines/macros to be able to include it into a normal LOGP easily insted of having a function. Change-Id: Ie082b11c9d6d00ff2206184f03f6e3647c3da18c
2019-10-17Fix common misspellings and typosMartin Hauke1-3/+3
Change-Id: I403b9029f57fec3fdec2c1e2cbeac0f6eab53f24
2019-10-11log: set L1 SAPI log contextOliver Smith1-0/+47
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-17fix spelling stuff mentioned by lintianThorsten Alteholz1-1/+1
Change-Id: I3d6cb6fc1b182d8520ba60e431ab9b74e71d5e3c
2019-06-05Use #define RSL_CHAN_RACH for RSL Channel Number of RACHVadim Yanitskiy1-1/+1
Change-Id: I7f54fccdae6799e5f4d956a101e11c2d6f998546
2018-11-18bts: Allocate TRX for BTS dynamically, deprecate -tPau Espin Pedrol1-0/+5
No need to pass -t num_trx anymore to specify number of TRX to use. It is calculated based on dynamic allocation from VTY config. Using parameter -t is flagged as deprecated and is transformed into a NOOP por backward compatibility. As a result, TRX now are allocated after the BTS is allocated and initial config (pre-VTY) is applied. A new function bts_trx_init() is added, to set default config on each TRX during allocation and before setting VTY config on it. A new per BTS model function bts_model_trx_init() is added, to allow per model specific default configuration of each TRX. Change-Id: Iab1a754ab12a626759f9f90aa66f87bdce65ac9c
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-06-28octphy: add support for 16x oversampling modePhilipp Maier1-0/+1
The latest octphy firmware release (octsdr-2g-02.11.00-B1927-alpha), introduces a 16X oversampling option which is not yet supported in osmo-bts. - Add oversampling flag in phy_link.h - Add VTY commands to enable/disable oversampling - Add phy messages to enable/disable oversampling - Add conditional compilation to preserve support for legacy header files and firmware Change-Id: Ib78f92bfe03ff20aa0a257763c90844fb7b87cf0 Related: SYS#4257 Patch-by: Octasic inc.
2018-03-23cosmetic: remove unused variablePhilipp Maier1-1/+0
Change-Id: Icbec00ec63950b785dcb71e3b9d70541e70be536
2018-03-17Get rid of 'struct gsm_bts_role_bts'Harald Welte1-5/+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-08fix handover: handle_ph_ra_ind(): evaluate ra_ind before msgb_trim()Neels Hofmeyr1-19/+27
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-03-01octphy: replace #warning with #pragma messagePhilipp Maier1-1/+1
warning causes the compiler to throw an actual warning. Lets change those intentional warnings to messages. Change-Id: I2fc83a1a07db9c569b93f29835bf3a0fd8ef4ef5
2018-02-27L1SAP: Increase resolution of reported burst timingHarald Welte1-3/+3
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-21/+11
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-26octphy: Remove code duplication for BER / RSSI conversionHarald Welte1-18/+22
Let's introduce some functions to hide the details of BER and RSSI conversion from OCTPHY representation to L1SAP representation. Change-Id: I517669c87a97b2ba164a2812811c8802fe0b92e8
2018-02-22Introduce + use LOG/DEBUGP with frame number prefixing/printingHarald Welte1-22/+17
Let's make sure whenever we do have a frame number, we print it as context in the related log line Change-Id: I751d5ddb3322fce489bc241459738cbcc55c890b
2018-02-22bts: use feature list instead of speech codec tablePhilipp Maier1-9/+0
osmo-bts has a table of pchan/channel mode combinations for every bts. This table models the codec capabilitys of the BTS hardware. However, having the speech codec apabilities modeled inside the BTS feature list would be much more comfortable and since the feature list is communicated back to the BSC we would get the codec capabilities inside the BSC domain as well. - remove the pchan/channel mode tables - set speech codec variants for each BTS type - fix bts_supports_cm so that it queries the feature list Change-Id: I977dc729ba856631245aedf76afd48eac92166f7
2018-02-22octphy: ensure all BTS models set featuresPhilipp Maier1-0/+5
Most of the BTS models do not or do register not all of thier features to the the feature list. - Update/extend the feature lists for all BTS-Models Change-Id: I26765a64153368016921c2ac115b1c4aec9bc5e4
2018-02-19rsl: do not allow MODE MODIFY request with unsupp. codec/ratePhilipp Maier1-0/+9
When the BSC sends a MODE MODIFY request with an unsupported codec, the BTS must respond with a negative acknowledge. Currently the codec parameter is not checked at all, which may lead into malfunction or crash of the BTS. - Introduce a mechanism to check the codec/rate against a table that is set up in the phy specific code. - Add tables with supported codec/rate combinations for octphy, sysmobts, and trx. Change-Id: Id9b222b7ab19ece90591718bc562b3a8c5e02023 Related: SYS#3212
2017-12-03osmo-bts-octphy: Remove bogus warning about BS_AG_BLKS_RESHarald Welte1-1/+0
Contrary to osmo-bts-sysmo, the OCTPHY-2G does not have different L1 SAPI for AGCH and PCH. It uses cOCTVC1_GSM_SAPI_ENUM_PCH_AGCH for both, and we convert that to the cbits=0x12 (Downlink CCCH) on the L1SAP. The code above L1SAP can hence freely decide if it wants to respond with an AGCH or PCH message, based on its knowledge of BS_AG_BLKS_RES, without the OCTPHY specific code having to do anything about it. Hence, there's nothing to do, and the warning can be removed Change-Id: Ic1038b8dc57bdaf05493cd8479355b960275ea41 Related: OS#1575
2017-08-15octphy: implement support for dynamic timeslotsPhilipp Maier1-4/+23
Implement API functions bts_model_ts_connect() and bts_model_ts_disconnect() in order to support dynamic timeslot allocation. Change-Id: Ia109d4bfade7bc28442127581f4bb0289146ea71
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-07-10octphy: remap frame number in MEAS_INDPhilipp Maier1-1/+52
The octasic phy stamps the SACCH channel that carries the measurmenet indication with the frame number of the last SACCH that falls within the measurement period. The higher layers expect the frame number to be aligned to the SACCH channel after, which marks also the beginning of the next measurement period. Make the octphy code compatible to the higher layers by remapping the measurement indication frame number. Change-Id: I8ecb27c018bf4ad5151878a6ad34026fd0f801a1
2017-07-10octphy: do not send empty frames to phyPhilipp Maier1-34/+5
ph_data_req() and ph_tch_req() are generating empty (idle) frames when no data (msg == NULL) is available. Since the phy is able to generate idle frames internally, there is no need to waste Host CPU cycles by doing this in software. Remove the empty frame generation and exit the function cleanly. (Patch by Octasic Inc.) Change-Id: Ib857b7dab490ad426c48d6a9e5e6fa10ef5a0838
2017-07-10Allow passing low link quality buffers to upper layersPau Espin Pedrol1-2/+0
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-04Fix annoying trailing whitespacePau Espin Pedrol1-1/+1
This whitespace keeps being automatically fixed by editor, polluting my patches. Change-Id: If0ba1321ed326c1498e3f60b611bd962f2a9484a
2017-06-28octphy: remove log outputPhilipp Maier1-2/+0
When handle_ph_data_ind() runs BER and RSSI is logged. Remove this log output by removing the call to dump_meas_res (Patch by Octasic Inc.) Change-Id: I5e755465daa3daec2e2b4f61bc8d779c49196e9a
2017-06-28octphy: initalize nmsg only when neededPhilipp Maier1-5/+6
nmsg is initalized every time the function runs, even when it is not needed. Move the initalization into the if (msg) body so that nmsg is only initalized when we really need it. (Patch by Octasic Inc.) Change-Id: If51dc50a9f4bdb4aba62c0ae5fbfac552806f0c0
2017-06-28octphy: initalize l1msg and only when neededPhilipp Maier1-1/+9
l1msg is initalized when the variable is declared. This means the allocation always runs right on the beginning. Even when the buffer is not needed at all. do a prober l1msg initalization only when needed and check the return code. (Patch by Octasic Inc.) Change-Id: Ia71d49b9cc109af53d997a687a7fb1b5ed062d1c
2017-06-15Set and report BTS featuresMax1-0/+3
Set (possibly incomplete) list of BTS model-specific features and report them in response to attribute request via OML. Change-Id: I5f8a6681c3562ec261441e84dde6e085b516d92f Related: OS#1614
2017-05-29octphy: integrate channel measurement handlingPhilipp Maier1-15/+48
recent octphy firmware versions do support proper channel measurement handling. The new implementation replaces the old, and for osmo-bts non functional implementation. This commit introduces the necessary adjustments. Older firmeware releses will still work. However, the measurement computation results will still be wrong. Change-Id: I0f053bb10b1cb112a8814ee591969d607888e686
2017-05-17octphy: ensure that 11 bit rach flag is not setPhilipp Maier1-0/+2
The l1 interface does not explicitly set the flag for 11 bit rach when a rach request is received. Since the current and previous octphy firmwares do not support 11 bit rach requests, the flag should be explicitly set to zero. Change-Id: Ifa165c56e54d272caafa45d1bf0e177848fcdfbd
2017-05-17octphy: align frame number for new firmware versionsPhilipp Maier1-0/+15
Firmware releases OCTSDR-2G-02.07.00-B1314-BETA and newer require to align the GPRS frame number (fn-3) for ph_data indications. To preserve compatibility the header version is checked during compile time and the right method is compiled in. Change-Id: Ib93d5fb3b34ff92f10021a0e9ce9c8aa3044b7ff
2017-05-10Set BTS variant while initializing BTS modelMax1-0/+1
This will allow proper BTS attribute reporting via OML in follow-up patches. Change-Id: I1c49d6c39fb4dac7a46ee25ceacf4c6ef0f0b736 Related: OS#1614
2017-04-13octphy: add CBCH supportPhilipp Maier1-1/+11
add Support for CBCH channels in osmo-bts-octphy Change-Id: Ic5c8363b4dd8ba78ab22bd5527c08d1162331540
2016-11-11Replace link_id constant with defineMax1-4/+4
Instead of using constant for link_id directly, use shared define value. Change-Id: Ibf3d439d8893bd994ba089796175b6c635db2cf8
2016-09-24octphy: Fixing band selection for ARFCN 0Philipp1-1/+3
There is now an exception for ARFCN 0 in osmocom_to_octphy_band to distingush ARFCN 0 (E-GSM) and 1-124 (P-GSM). Change-Id: If012f31121e9d0d45b36459807c5f290aa17374f
2016-08-08Fill measurements data for L1SAPMax1-1/+12
Fill in values for BER, BTO, Link quality in L1SAP and send them to PCU. Note: this increases the version of BTS <-> PCU protocol. It also requires corresponding changes in libosmocore. All BTS models provide measurements data unless direct DSP access for PCU is enabled. For BTS-specific notes see below. Octphy: conversion from sSNRDb to Link Quality uses formulae which works in practice instead of what's documented for sSNRDb value. Subject to change in future revisions. TRX: C / I link quality estimator is not computed. Change-Id: Ic9693a044756fb1c7bd2ff3cfa0db042c3c4e01c Related: OS#1616
2016-06-23Make get_lchan_by_chan_nr globally availableMax1-11/+5
* Remove static qualifier * Remove duplicated code - use generic function instead Change-Id: I37a312648771f58d3087471083cfcebbd97ccf1d