aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/pcu_sock.c
AgeCommit message (Collapse)AuthorFilesLines
2023-03-01pcu_sock: print OML alerts from PCUPhilipp Maier1-0/+3
The PCU is able to send OML alerts via the BTS to the BSC. When the PCU operates in co-location to the BSC we just print the alerts in the log directly Change-Id: Id32553556356c2affe32e47ae1c3ae6a514efdce Related: OS#5198
2023-02-13pcu_sock: set direct TLLI flag in info indicationPhilipp Maier1-0/+1
osmo-bsc requires the PCU to tag IMMEDIATE ASSIGNMENTS that shall be sent via PCU with a TLLI. This is required to confirm the sending of the IMMEDIATE ASSIGNMENT messages to the PCU. Related: OS#5198 Change-Id: Ib804143a57824632e5435f7ba68f2e94f5f3fb21
2023-02-13pcu_sock: transfer E1 connection information to PCUPhilipp Maier1-1/+70
The BSC has all information about the E1 line configuration of each timeslot/channel. The PCU is responsible for opening and managing the CCU connection. To enable the CCU to do that, we have to transfer the E1 connection information (which TS, SS, rate) to the PCU. Change-Id: I6d44373336b41009ff4c6e459d32d0a81081676c Related: OS#5198
2023-02-13pcu_sock: transfer sysinfo to PCUPhilipp Maier1-0/+122
The PCU needs to be aware of the current system information in order to work properly. Change-Id: Ibbfbfaf588a4e406804c36570010aefdfc14328b Related: OS#5198
2023-02-13pcu_sock: use extract_paging_group() for PCU_IF_SAPI_PCHPhilipp Maier1-10/+2
We have introduced the function extract_paging_group() with the previous patch. Lets use it for PCU_IF_SAPI_PCH as well to remove code duplication Change-Id: If4ffe8eafd2e54e323cbc075c09d457a74ebe83f Related: OS#5198
2023-02-13abis_rsl: add support for sending IMMEDIATE ASSIGNMENT through PCHPhilipp Maier1-10/+45
The IMMEDIATE ASSIGNMENT for downlink TBFs needs to be sent through the PCH instead of the AGCH. Since this method is not specified in RSL, it is usually a vendor specific extension. Change-Id: I4452f4973d1ec69c96aad527b057226e8a6edf99 Related: OS#5198
2023-02-11pcu_sock: cosmetic: remove space before tabPhilipp Maier1-1/+1
Change-Id: I6f3f96120d8a106f7c9e8b428d89ed14999a10a8
2023-02-11pcuif_proto: rename PCU_IF_SAPI_AGCH_DT to PCU_IF_SAPI_PCH_DTPhilipp Maier1-2/+2
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: I78abeb62d0267baa31a4727c4bdd027b7230f137 Related: OS#5198
2023-02-02pcu_sock: rework log outputPhilipp Maier1-2/+2
The code is easier to read when the log string is in one line Change-Id: Idc673e0b15869c6966701524db1af7d7847c16ab Related: OS#5198
2023-02-02pcu_sock: remove unecessary OSMO_ASSERT()sPhilipp Maier1-4/+0
Change-Id: I8320cbc14361438d65642d15bc225e9960ce925b Related: OS#5198
2023-02-02pcu_sock: Also fill in BSIC in gsm_pcu_if_info_indPhilipp Maier1-0/+1
When filling in the info_ind parameters we lack the BSIC Change-Id: I22158b18f50a7adf4ba1fed25bd7a880dc109e3d Related: OS#5198
2023-02-02pcu_sock: fix endianess when populating gsm_pcu_if_info_indPhilipp Maier1-2/+2
The intended endienaess for the remote_port member is host byte order, while the endianess in the nsvc struct is in network byte order. (see also pcu_sock.c in osmo-bts.git) Change-Id: Ib62dcceb80fd500e477dd5e1a0e43de47e16eeb0 Related: OS#5198
2023-01-31pcu_sock: rework check logic for tsPhilipp Maier1-2/+17
Before filling in the TS in the info indication, it is checked that the MO opstate is enabled. Also it is checked that the TS serves a PDCH. Lets restructure this check and move the PDCH check into a helper function as we need to check for PDCH from other location as well later. Change-Id: Icaab52ab73c38889dfadb523b89bb54cafacc99a Related: OS#5198
2023-01-31pcu_sock: clean up logging in info_ind_fill_trxPhilipp Maier1-3/+3
Change-Id: Ie5c1abcf7b25fe00b6c228c49648e018f94190f0 Related: OS#5198
2023-01-30pcu_sock: fix sourcecode formattingPhilipp Maier1-1/+1
Change-Id: I593c16efa1639aa8d2f90735bfdc9750cf695ecd Related: OS#5198
2023-01-30pcu_sock: check trx mo statePhilipp Maier1-0/+9
Make sure that the TRX MO state is enabled and unlocked before filling in any TRX information into the info indication Change-Id: I7a93826e6b0df187425310cb82854e7d7fb47e72 Related: OS#5198
2023-01-12pcu_sock: move code that fills in trx info to helper functionPhilipp Maier1-26/+35
The function pcu_tx_info_ind() fills the trx information in the info indication. Since the function is already quite long, move the trx related part into a sperate helper function. Change-Id: Ic30185c9364adcc61d0a9d3483b0550ac1cdf894 Related: OS#5198
2023-01-12pcu_sock: guard against too many TRXPhilipp Maier1-0/+6
The pcuif only supports a limited but sufficient number of TRXs. When filling in the TRX array in info_ind, we must guard against overflowing the maximum number of TRXs Change-Id: I351080a112f3d3fdf833ee7fa0d77c4cd1d13e42 Related: OS#5198
2023-01-10pcu_sock: drop unused variable pcu_directPhilipp Maier1-4/+1
The variable pcu_direct is set to one permanently, lets remove it. Change-Id: I7917ee5abc3347776dc9793cfb4ec3e99df94683 Related: OS#5198
2023-01-10pcu_sock: drop unused function prototypePhilipp Maier1-1/+0
The function trx_get_hlayer1() is defined as a prototype but it is not used anywhere and there is also no implementation, lets drop it. Related: OS#5198 Change-Id: I91ead9379140e971ccabc83cbf2b62b8aa1fc8a2
2022-09-26pcu_sock: add some guard space to message bufferPhilipp Maier1-1/+1
in osmo-pcu, the message buffer in pcu_sock_read is allocated with 1000 bytes in addition to the true size of the pcu_prim struct. Presumably this is to avoid compatibility problems in case the primitives slightly grow due to appending new struct members. Lets do the same in osmo-bts. Change-Id: I99f5204b0563f72f9da427bb7aa5451552d8c5b5 Related: OS#5198
2022-09-26pcu_sock: check size of primitivePhilipp Maier1-2/+19
The pcu_sock interface in osmo-bts does check the size of the primitives it receives. Lets do the same in osmo-bsc as well. Change-Id: I247c6f4b5a7a22d17a060a558c4ceb9221ca7351 Related: OS#5198
2022-09-15pcu_sock: fix memleakPhilipp Maier1-1/+3
pcu_sock_read() may not free the message buffer in case the recv returned errno EAGAIN. This is already fixed in osmo-bts, lets fix it in osmo-bsc as well. Related: OS#5198 Change-Id: I49eda447fc1912c1f7f25ba07331cb84decf4548
2022-04-20Fix compile errors on #warning with '-Wall' on gcc-11.2Harald Welte1-2/+2
pcu_sock.c: In function ‘pcu_tx_info_ind’: pcu_sock.c:197:2: error: #warning "isn't dl_tbf_ext wrong?: * 10 and no ntohs" [-Werror=cpp] 197 | #warning "isn't dl_tbf_ext wrong?: * 10 and no ntohs" | ^~~~~~~ pcu_sock.c:199:2: error: #warning "isn't ul_tbf_ext wrong?: * 10 and no ntohs" [-Werror=cpp] 199 | #warning "isn't ul_tbf_ext wrong?: * 10 and no ntohs" | ^~~~~~~ they made it here from osmo-bts.git (b4999b60d48bcbb5aa575973d068e07ab672e095 states that the PCUIF support was copied from there). The gitlog shows that these warnings were added in 744f745d7a508605254afa8f78412ad410d153b0 by jolly (in 2012!) together with the PCUIF support, and before c1368d4ebe49f8e01f1f5fff3bc3583cb5960c1d these warnings were in German: "ist dl_tbf_ext nicht falsch?" As nobody has bothered for the past ten years, degrade them to comments. Change-Id: I9ef7e18f56aa86b48f0ffeec58406260736170f3
2021-12-14treewide: remove FSF addressOliver Smith1-4/+0
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-10-07Get rid of lots of stubs [4/4]Pau Espin Pedrol1-1/+2
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
2020-12-03Store GPRS MOs directly under BTS SiteMgr objectPau Espin Pedrol1-4/+9
The only real 1-1 relationship between BTS NM objects is the one between GPRS Cell and BTS (which is actually a BTS cell). In our current osmo-bts implementation we don't care much since we only handle 1-cell BTSses, but let's make the data structure organization more generic. Implementation notes: The gsm_bts_sm is moved to its own file, APIs to allocate are added and the new public object is hooked correctly in the allocation process of osmo-bsc. Change-Id: I06461b7784fa2a78de37383406e35beae85fbad8
2020-11-11Use osmo_fd_*_{disable,enable}Harald Welte1-5/+5
Depends: libosmocore.git Idb89ba7bc7c129a6304a76900d17f47daf54d17d Change-Id: I4e228399d21098cc9a99b9cc1aa42b24ec609159
2020-10-19use osmo_fd_setup() whenever applicableHarald Welte1-10/+4
Change-Id: Iee26d14e997cc77c49b8fc1a9f388e4e2f783105
2020-10-05pcuif_proto: version 10: add support for IPv6 NSVCsAlexander Couzens1-9/+17
Introduce a address_type in the NSVC configuration pass the given protocol. The remote_ip is network byte order, the default encoding for in_addr and in6_addr. Related: Iae854875a45dbc29cd46a267ccaf60f1f2ac2973 Related: SYS#4915 Change-Id: I740be0a401612bb5ed4e8ccd7f4be8176b936449
2020-10-05pcuif_proto: version 10: add frequency hopping parametersAlexander Couzens1-10/+29
Related: SYS#4868, OS#4546, OS#4547 Change-Id: I5540fae66a116cbb25ec75b35145c36137146ffd
2020-10-05oml: encode IPv6 NSVC using the new OML attribute NM_ATT_OSMO_NS_LINK_CFGAlexander Couzens1-2/+11
The old IE NM_ATT_IPACC_NS_LINK_CFG didn't support IPv6 NSVC. Depends: Ic261bc43a07fa741b97a9c6ec5a9ed6f5ecae588 (libosmocore) Depends: I9e279bb20940c66eea5196f281184cb4f8a5cc5f (libosmocore) Change-Id: I6529876a3c1116a79dd624312243d8ae48a41fe2
2020-10-03pcu_sock: use tn as variable name to improve readabilityAlexander Couzens1-6/+6
Same as used in osmo-bts Change-Id: I5c8cf0e2d29fa4999983293401294ee0a94bfa30
2020-07-18Move struct gsm_bts: gsm_data.* => bts.*Pau Espin Pedrol1-0/+1
Place all code related to the object into the related file. Having all the data model in one file made sense in early stage of development to make progress quickly, but nowadays it hurts more than helps, due to constantly growing size and more and more bits being added to the model, gaining in complexity. Currently, having lots of different objects mixed up in gsm_data.h is a hole of despair, where nobody can make any sense were to properly put new stuff in, ending up with functions related to same object in different files or with wrong prefixes, declarations of non-existing functions, etc. because people cannot make up their mind on strict relation to objects in the data model. Splitting them in files really helps finding code operating on a specific object and helping with logically splitting in the future. Change-Id: I00c15f5285b5c1a0109279b7ab192d5467a04ece
2020-07-15Fix trailing whitespace in several filesPau Espin Pedrol1-1/+0
Change-Id: Ide9921dfce3b6d7c580edaa612a3063c94319a02
2020-07-15Use OSMO_FD_* instead of deprecated BSC_FD_*Pau Espin Pedrol1-9/+9
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_* symbols when copy-pasting somewhere else. Change-Id: Ia5a656567d212fa265aef1375d714d0c5fee5dd6
2020-06-16use osmo_mobile_identity API everywhereNeels Hofmeyr1-9/+12
Depends: If4f7be606e54cfa1c59084cf169785b1cbda5cf5 (libosmocore) Change-Id: I71c3b4c65dbfdfa51409e09d4868aea83225338a
2019-11-13Fix some typosMartin Hauke1-2/+2
Fix typos and common misspellings in code comments and in the manual. Change-Id: I46fc9d424620c77ae9ccf78b58081bd303386d7c
2019-07-16Fix some spelling errors found by lintianRuben Undheim1-1/+1
Change-Id: I63a733f8bea69f355a6686d99c3aa194c8ac9012
2018-07-28large refactoring: use FSMs for lchans; add inter-BSC HONeels Hofmeyr1-29/+2
Add FSMs: - timeslot_fsm: handle dynamic timeslots and OML+RSL availability. - lchan_fsm: handle an individual lchan activation, RTP stream and release, signal the appropriate calling FSMs on success, failure, release. - mgw_endpoint_fsm: handle one entire endpoint with several CI. - assignment_fsm: BSSMAP Assignment Request. - handover_fsm: all of intra, inter-MO and inter-MT handover. Above FSMs absorb large parts of the gscon FSM. The gscon FSM was surpassing the maximum amount events (32), and it is more logical to treat assignment, handover and MGW procedures in separate FSMs. - Add logging macros for each FSM type: - LOG_TS() - LOG_LCHAN() - LOG_MGWEP(), LOG_CI() - LOG_ASSIGNMENT() - LOG_HO() These log with the osmo_fsm_inst where present. New style decision: logging without a final newline char is awkward, especially for gsmtap logging and when other logs interleave LOGPC() calls; we have various cases where the final \n goes missing, and also this invokes the log category checking N times instead of once. So I decided to make these macros *always* append a newline, but only if there is no final newline yet. I hope that the compiler optimizes the strlen() of the constant format strings away. Thus I can log with or without typing "\n" and always get an \n termination anyway. General: - replace osmo_timers, state enums and program-wide osmo_signal_dispatch() with dedicated FSM timeouts, states and events. - introduce a common way to handle Tnnn timers: gsm_timers.h/.c: struct T_def. These can be used (with some macro magic) to define a state's timeout once, and not make mistakes for each osmo_fsm_inst_state_chg(). Details: bsc_subscr_conn_fsm.c: - move most states of this FSM to lchan_fsm, assignment_fsm, handover_fsm and mgw_endpoint_fsm. - There is exactly one state for an ongoing Assignment, with all details handled in conn->assignment.fi. The state relies on the assignment_fsm's timeout. - There is one state for an ongoing Handover; except for an incoming Handover from a remote BSS, the gscon remains in ST_INIT until the new lchan and conn are both established. - move bssmap_add_lcls_status() to osmo_bsc_lcls.c abis_rsl.c: - move all dynamic timeslot logic away into timeslot_fsm. Only keep plain send/receive functions in abis_rsl.c - reduce some rsl functions to merely send a message, rename to "_tx_". - rsl_ipacc_mdcx(): add '_tx_' in the name; move parts that change the lchan state out into the lchan_fsm, the lchan->abis_ip.* are now set there prior to invoking this function. - move all timers and error/release handling away into various FSMs. - tweak ipa_smod_s_for_lchan() and ipa_rtp_pt_for_lchan() to not require an lchan passed, but just mode,type that they require. Rename to ipacc_speech_mode*() and ipacc_payload_type(). - add rsl_forward_layer3_info, used for inter-BSC HO MO, to just send the RR message received during BSSMAP Handover Command. - move various logging to LOG_LCHAN() in order to log with the lchan FSM instance. One drawback is that the lchan FSM is limited to one logging category, i.e. this moves some logging from DRR to DRSL. It might actually make sense to combine those categories. - lose LOGP...LOGPC logging cascades: they are bad for gsmtap logging and for performance. - handle_classmark_chg(): change logging, move cm2 len check out of the cm3 condition (I hope that's correct). - gsm48_send_ho_cmd(): split off gsm48_make_ho_cmd() which doesn't send right away, so that during inter-bsc HO we can make an RR Handover Command to send via the MSC to the remote BSS. assignment_fsm.c: - the Chan Mode Modify in case of re-using the same lchan is not implemented yet, because this was also missing in the previous implementation (OS#3357). osmo_bsc_api.c: - simplify bsc_mr_config() and move to lchan_fsm.c, the only caller; rename to lchan_mr_config(). (bsc_mr_config() used to copy the values to mr_bts_lv twice, once by member assignment and then again with a memcpy.) - During handover, we used to copy the MR config from the old lchan. Since we may handover between FR and HR, rather set the MR Config anew every time, so that FR rates are always available on FR lchans, and never on HR lchans. Depends: I03ee7ce840ecfa0b6a33358e7385528aabd4873f (libosmocore), I1f2918418c38918c5ac70acaa51a47adfca12b5e (libosmocore) Change-Id: I82e3f918295daa83274a4cf803f046979f284366
2018-07-28rename gsm_04_08_utils.[hc] to gsm_04_08_rrNeels Hofmeyr1-1/+1
"utils" suggests thin helpers to aid using a proper API, while this .c file actually *is* the proper RR API. Rename from "utils" to "rr". Change-Id: I0ffff63d57f03cb324df8e40e41caea5b55a2c85
2018-06-18cosmetic / linking: move str_to_imsi() out of abis_rsl.cNeels Hofmeyr1-0/+1
Move to gsm_04_08_utils.c so that it's possible to use it without linking/stubbing all of RSL. Change-Id: I6e90831d7e618ce3c8e7417082a82c97f6681668
2018-06-15pcu_sock: Log event pcu_sock createdPau Espin Pedrol1-0/+2
Change-Id: If5691d8e8bae7166e06382db589850ce94c20a30
2018-06-07dissolve libbsc: move all to src/osmo-bsc, link .o filesNeels Hofmeyr1-0/+740
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to allow linking from utils/* and ipaccess/* without pulling in unccessary dependencies. Some utilities use gsm_network and gsm_bts structs, which already include data structures for fairly advanced uses. Move initialization that only osmo-bsc needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so that the leaner tools can use the old gsm_* versions without the need to link everything (e.g. handover and lchan alloc code). In some instances, there need to be stubs if to cut off linking "just before the RSL level" and prevent dependencies from creeping in. - abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is osmo-bsc, the utils are merely concerned with OML, if at all. - paging_flush_bts(): ip.access nanobts models call this when the RSL link is dropped. Only osmo-bsc actually needs to do anything there. - on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related to OML, while this action to take on init would pull in RSL dependencies. utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests implement stubs inline where required. From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/. In order for this to work, the osmo-bsc subdir must be built before the other source trees. (An alternative would be to include the .c files as sources, but that would re-compile them in every source tree. Not a large burden really, but unless linking .o files gives problems, let's have the quicker build.) Minor obvious cleanups creep in with this patch, I will not bother to name them individually now unless code review asks me to. Rationale: 1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc is distracting. 2) Recently, ridiculous linking requirements have made adding new functions cumbersome, because libbsc has started depending on osmo-bsc/*.c implementations: on gscon FSM and bssap functions. For example, neither bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP message composition. It makes no sense to link the entire osmo-bsc to it, nor do we want to keep adding stubs to each linking realm. Change-Id: I36a586726f5818121abe54d25654819fc451d3bf