aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcu_l1_if.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-03-27Forward GPRS SUSPEND REQ from BTS to SGSN using BSSGPHarald Welte1-0/+19
As specified in 3GPP TS 03.60 Section 16.2.1 and 44.018 Section 3.4.15, a Class B MS is sending a "RR GPRS SUSPEND REQ" via a DCCH to the BTS if it wants to suspend GPRS services. As of Change-Id I3c1af662c8f0d3d22da200638480f6ef05c3ed1f, OsmoBTS forwards this via the PCU socket, so we need to pick it up and send it via BSSGP to the SGSN. Change-Id: I7b4beb413a6f974373a404b5a11c44d86ba695d3 Closes: OS#2249
2019-03-27pcu_l1_if: Fix erroneous endian-swapping of the CellIDHarald Welte1-3/+2
In Change-Id I787fed84a7b613158a5618dd5cffafe4e4927234 in February 2018 we accidentially introduced a change that would erroneously swap the endianness of the CellID on the way between PCUIF socket and BSGSP. This meant that all OsmoPCU based BTSs would report the wrong CellId to the SGSN. Closes: OS#3854 Change-Id: I2f6cc930c5dbf8dac386b24b0756df2efe8199e4
2018-05-25fix a one-byte stack buffer overrun in osmo-pcuStefan Sperling1-1/+2
Address sanitizer uncovered a one-byte stack overrun due to an off-by-one in the size of the 'data' buffer in pcu_l1if_tx_pch(). Fix the problem and add an assertion which triggers before the overrun can occur. Change-Id: I08a879d72fcb916f78f175612fd90467d7bdd57c Related: OS#3289
2018-04-10pcu_l1_if: add frame number to log outputPhilipp Maier1-9/+14
Currently, the log output lacks the frame number. - make get_current_fn() public - add frame number to the log statements in pcu_l1_if.cpp Change-Id: Idce994dbf86a2bbf861907d75418a2a3867244db Related: SYS#4139 Patch-by: Octasic inc.
2018-04-10cosmetic: remove runaway semicolonPhilipp Maier1-1/+1
Change-Id: I33c335dc8d564a8357ffb5b1163c2c4b1a578b49 Related: SYS#4139 Patch-by: Octasic inc.
2018-03-11implement support for 3-digit MNC with leading zerosNeels Hofmeyr1-5/+6
Receive the mnc_3_digits flag from the PCU interface. Bump the PCU interface to 9. This is one part of the three identical pcuif_proto.h patches: - I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 (osmo-bts) - I787fed84a7b613158a5618dd5cffafe4e4927234 (osmo-pcu) - I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 (osmo-bsc) Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout the code base to be able to handle an MNC < 100 that has three digits (leading zeros). Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore), Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore) Change-Id: I787fed84a7b613158a5618dd5cffafe4e4927234
2018-02-19Move PDCH-related functions into separate filesMax1-0/+1
The PDCH class and corresponding functions are rather self-contained and independent from BTS implementation. Let's move them into separate file to make bts.cpp more manageable. As additional benefit it allow us to somewhat untangle all the different cross-dependent includes. Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683 Related: OS#1539
2018-02-19Update header includesMax1-1/+6
Many files include unnecessary headers and don't include headers which are actually used. Because of that combined with the fact that OsmoPCU is a mixture of C and C++, it makes it hard to modularize code. Fix this (using iwyu [1] tool): * add missing headers * remove unused headers [1] https://include-what-you-use.org/ Related: OS#1539 Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
2018-02-14Make osmo-pcu wait for BTS to become available at start-up time.Stefan Sperling1-0/+4
After the PCU socket becomes available, the BTS might send an INFO_IND message with the 'ACTIVE' flag cleared. If this happens, do not exit immediately, but keep retrying until an INFO_IND message with the 'ACTIVE' flag arrives. Note that this change only affects behaviour at process start-up time. If the BTS switches from active to inactive state then osmo-pcu will still exit. If this behaviour should be changed as well it could be done in a follow-up patch. Tested against osom-bsc + osmo-bts-virtual. Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309 Related: OS#2689
2017-09-01Support receiving SI13 from BTSMax1-0/+24
* store SI13 in BTS struct * check and handle BCCH SAPI Change-Id: I610a93ce23725b182ec14e3507331295bd542f74 Related: OS#2400
2017-09-01cosmetic: tighten direct-phy related codeMax1-11/+11
* move the code to related SAPI case * get rid of 'unused variable' warning if direct-phy is not used Change-Id: If8cae6f3579cfdecc25bbe1d08fa88a4f664a03b
2017-08-17GSMTAP: fix category checks in pcu_rx_data_ind and pcu_l1if_tx_ptcchHarald Welte1-2/+2
We needto shift the PCU_GSMTAP_C_* constants before comparing against the mask of enabled GSMTAP categories. Change-Id: Ieb9332c65ed7bd57baf1aeab5ab722f92fc23b24
2017-07-29GSMTAP: Ad PTCCH as separate gsmtap categoryHarald Welte1-1/+2
This allows us to send GSMTAP for PTCCH only if requested by user/vty Change-Id: Id720f4bebdce7f6152fbddddbe05036638c5866e
2017-07-29GSMTAP: Fix logical channel of downlink PTCCHHarald Welte1-1/+1
Change-Id: I29ecc968d56d4d0165cffa206297c42d6fb02cf4
2017-07-21Introduce GSMTAP categoriesHarald Welte1-12/+9
When looking at GSMTAP output so far, one is easily overwhelmed by way too much information being presented. A lot of is consists of DUMMY frames, which are probably of lowest interest, ever. A concept similar to the "gsmtap-sapi" of OsmoBTS is introduced, by which the user can configure which particular categories (uplink or downlink control or data, gprs or egprs, ...) he actually wants to see in his logs. Change-Id: I297183690e98a7234dfc1608c18847d8981306e4
2017-06-26Remove comment warningMax1-3/+2
It's unclear why the warning was placed next to commented log statement to begin with, so let's just follow that warning's advice and drop it. Change-Id: I3ef7a45d015a28fdadf75f97294bc5d4f825b8ae
2017-03-17Support sending OML Alerts via BTSMax1-0/+36
* extend BTS <-> PCU protocol with TXT messages * use it to implement OML alerts support * use it to implement version message * add function to transmit both of them them * send alerts for internal encoding problems as an example * send version when BTS socket is connected Note: requires corresponding change If57459c0610f2c7b36d599b13087c8deef8bdd9e in libosmocore. Related: OS#1614, 1615 Change-Id: If4ea5b3f7409df2fb030681ad468df6b711790a7
2016-11-17Install the pcuif_proto.h header fileHarald Welte1-1/+1
So far, we used to keep a copy of the header file around in both osmo-pcu and osmo-bts projects. Before we start introducing a third copy in openbsc, let's have the osmo-pcu install the header file and make the other programs use that. Change-Id: I60976c9be5488256d1ff55fdc5aa548e3705400d
2016-11-17Fix GSMTAP logging in case direct PHY access is enabledHarald Welte1-2/+2
In the existing code, GSMTAP messages were only generated in case no direct PHY access was being used (i.e. in the case all user traffic goes over the PCU socket). I'm not quite sure what the reason is for that would be and conclud this is not intentional. Let's first send the message to GSMTAP and then decide whether to send it via the direct PHY access or via the PCU socket into the BTS/BSC. Change-Id: I5d2e018f7009cb947abc874881c0c440feca3ade
2016-11-17pcu_l1_if: get rid of magic numbers and use ARRAY_SIZE() for array iterationHarald Welte1-6/+6
Change-Id: I61d00950b4eb0b8bcbaf386d5081be84580dac75
2016-08-27Change interface in osmo-pcu for 11 bit RACHbhargava1-1/+2
Interface structure between osmo-bts and osmo-pcu is updated with the parameters to differentiate the type of RACH and further support 11 bit RACH. The function prototype and definitions are changed accordingly. Interface version number is increased. Change-Id: I265c2d92d36d6cbcbeee60cdd8407dafe1da06a4
2016-08-04Extend BTS <-> PCU protocol with measurementMax1-1/+9
Note: this increases the version of BTS <-> PCU protocol and thus requires corresponding change in BTS. Change-Id: Ide0e29b668ee38516605c1763fda85e87e867813 Related: OS#1616
2016-07-26Remove useless ARFCN parameterMax1-3/+3
ARFCN is already part of TRX struct so there's no need to supply it explicitly in a separate parameter. I've tested and those are the same anyway. Change-Id: I8e975c52cbc819427880093b1e5371fe1f8ce460
2016-05-19Change internal API for consistencyMax1-4/+5
Make TRX API (void *) consistent with the way it's used (integer). Use uint8_t for TRX numbering everywhere (we don't expect hardware with more than 256 transceivers in the near future). This change helps to avoid unnecessary casts and make API much clearer. Change-Id: Ic584611184b0c8b5417ecff0ddae3d526b55a079 Related: SYS#2443 Reviewed-on: https://gerrit.osmocom.org/59 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
2016-04-22Rename define for direct hw accessMax1-4/+4
2016-02-22Add gsmtap support to generic btsMax1-11/+27
Instrument TX and RX functions dealing with regular BTS (without direct DSP access) to use GSMTAP. Previously only DSP-related functions were instrumented.
2016-02-22Introduce --gsmtap-ip/-i optionMax1-2/+3
This option allows user to use custom IP address instead of default "localhost". Correspondingly gsmtap init moved from sysmoBTS-specific code up to "bts" struct level. This way it can be easier reused by other implementations. The lack of regressions was verified by checking following command on sysmoBTS: "./osmo-pcu -c osmo-pcu.cfg -r 1 -i 192.168.10.1" where 192.168.10.1 is the host which was running wireshark and netcat: "nc -u -l 192.168.10.1 -p 4729" to accept gsmtap flow.
2015-08-28l1: Use the FN of all data_ind/ra_ind DSP messagesJacob Erlbeck1-0/+11
Currently all of these messages are discarded if they are assumend to be caused by noise. But even in these cases, the FN and TN values which are added by the DSP are valid. So these can be used to update the current_frame value. The osmo-bts sets the fBFILevel of a physical channel to -200dB if it is used for PDTCH or PACCH which is the case for all PDCH. This way a data_ind or ra_ind message is already send at least once per block period (4 frames) per PDCH. These messages are passed to either handle_ph_data_ind or handle_ph_ra_ind even if they contain garbage data. The ra_ind messages are sometimes sent a few frames earlier than data_ind messages using the same frame. This commit adds calls to update the current_frame value based on all of these messages before they are discarded. The FN taken from ra_ind are passed with an increased max_delay (5) to compensate for early ra_ind messages. Sponsored-by: On-Waves ehf
2015-06-22l1: Pass all L1 measurements upwardsJacob Erlbeck1-3/+5
Currently only the RSSI value is passed to the upper layers. Other values like TA and BER which are needed for TA update respectively CS selection are not propagated. This commit introduces and passes a struct that contains a set of measurement values. Sponsored-by: On-Waves ehf
2014-06-15Always exit and don't try to recoverDaniel Willmann1-2/+2
The current code tries to recover from dropped connections and resets the pcu state so it can keep running. However, this never worked correctly which is why the -e option is used. This option exits the pcu as soon as the internal state needs to be reset. This patch removes this option and makes this behaviour default. Ticket: SYS#390 Sponsored-by: On-Waves ehf
2013-10-30bts: Move gprs_rlcmac_rcv_rach into the BTS classHolger Hans Peter Freyther1-1/+1
2013-10-30bts: Move rcv_imm_ass_cnf into the bts codeHolger Hans Peter Freyther1-2/+1
2013-10-30pdch: Instead of passing bts, trx, ts use the pdchHolger Hans Peter Freyther1-3/+5
All dispatching will go through the PDCH. This will clean a lot of the look-ups inside the gprs_rlcmac_data.c and continue with adding structure to the pcu code.
2013-10-30pdch: Simplify the reset code, rename variables to XYZ_noHolger Hans Peter Freyther1-2/+2
Simplify the reset code now that the PDCH can know where it is located. Rename the variables in the sba to trx_no and ts_no as it stores the number and not the actual thing.
2013-10-30bts/tbf: Move the lists into the BTS and do the look-up from the BTSHolger Hans Peter Freyther1-2/+2
The list belongs to the BTS. This makes cleaning this up more easy and establishes a hierachy of resources that start from the BTS. The debug_diagram code is now broken.
2013-10-30sba: Create a SBAController that will manage the sbas for a BTSHolger Hans Peter Freyther1-2/+2
The PollController is a friend of the SBAController and is allowed to access the internal list. The list is hidden from everyone else. This is done because the calculation of timeout should belong into the PollController and not into the SBAController.
2013-10-30bts/pdch: Move the adding of paging to the BTS/PDCH objectsHolger Hans Peter Freyther1-1/+1
Only the gprs_rlcmac_pdch will manipulate the paging list now. There can be various more refactorings of the code but they can be done later. E.g. on memory allocation failure we can continue instead of leaving the code, we should also set any_tbf only after things have been paged.
2013-10-30pdch: Move enable/disable into the PDCH codeHolger Hans Peter Freyther1-33/+7
When a PDCH is disabled all resources should be freed. This is currently not possible as the PDCH does not know where it belongs to. On top of that the list (and other resources) should be properly initialized on construction so that disable() is idempotent and does not check if it was disabled. During the re-factoring I noticed that during a sysmobts re-start some resources are not freed. I left a warning in the code to resolve this issue later.
2013-10-30bts: Introduce a PollController that has the responsibility to pollHolger Hans Peter Freyther1-31/+0
For each frame indication received by the BTS the poll controller is asked to expire timedout entries.
2013-10-30bts: Move the frame_number into the BTS sructureHolger Hans Peter Freyther1-14/+2
The current_frame is an attribute of the BTS. Move it from the pcu_l1_if.cpp into the BTS. As the next step we can trigger actions depending on the change of the frame.
2013-10-30bts: Introduce a singleton for the BTS and use it in the codeHolger Hans Peter Freyther1-9/+12
Compared to the previous code there will be a branch to get the global pointer so the code will be slightly slower than the previous version but it allows us to start creating objects but still use the code from C. It is best approach I have found so far. One downside of C++ is that by default talloc will not be used (unless we override the new operator to use talloc. Right now we need to memset the C data structure by hand. The benefit of enforcing a better structure should is more important though.
2013-10-30bts: Move struct gprs_rlcmac_bts and other structs into a bts.hHolger Hans Peter Freyther1-0/+1
Begin to make the BTS a real C++ object with real responsibilities. The biggest issue will be the pcu_vty.c that might not like C++ at all.
2013-10-30bts: Remove global state from gprs_rlcmac_rcv_rts_blockHolger Hans Peter Freyther1-1/+1
2013-10-30bts: Remove global state from gprs_rlcmac_add_pagingHolger Hans Peter Freyther1-1/+1
2013-10-30bts: Remove global state from gprs_rlcmac_rcv_rachHolger Hans Peter Freyther1-1/+2
2013-10-30bts: Remove global state from gprs_rlcmac_rcv_data_block_acknowledgedHolger Hans Peter Freyther1-1/+1
2013-10-30bts: Remove the global state gprs_rlcmac_trigger_downlink_assignmentHolger Hans Peter Freyther1-2/+2
Remove the global state from gprs_rlcmac_trigger_downlink_assignment and walk up to the pcu_l1_if.cpp where I find the timeout handling that should be part of the SBA and TBF functionality. In terms of hierachies things start to be more clear. There should be the BTS object. That holds the SBA and TBF Controllers that can allocate TBFs and SBAs and will handle the timeout polling for a BTS.
2013-10-28tbf: Add another variant of the free_all now by pdchHolger Hans Peter Freyther1-10/+2
2013-10-28tbf: Move the struct to the tbf.h header fileHolger Hans Peter Freyther1-0/+1
This is the begin of a long march of turning tbf into a C++ class and properly hiding the secrets inside this implementation instead of having it spread across various different files.
2013-10-02tbf: constify the IMSI argument for the downlink assignmentHolger Hans Peter Freyther1-1/+1