aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_bssgp_pcu.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-02-26Optionally Use the NS Sub-Network-Service (SNS) on GbHarald Welte1-7/+24
This change add support for the recently-introduced GPRS Gb interface auto-configuration using the NS IP Sub-Network Service (SNS) procedures. It requires a Change-Id I84786c3b43a8ae34ef3b3ba84b33c90042d234ea of libosmocore. Related: OS#3372 Depends: I84786c3b43a8ae34ef3b3ba84b33c90042d234ea (libosmcore) Change-Id: I256b40ac592d3b6e75dd581bf7b9512f69b11e83
2019-02-26Mark gprs_ns_reconnect() as static (not used outside of C file)Harald Welte1-1/+2
Change-Id: I95138adedacdc2d953284cff57f79ecb33616f0f
2018-06-25check bssgp_tlv_parse() return code in gprs_bssgp_pcu_rcvmsg()Stefan Sperling1-0/+7
The return code from bssgp_tlv_parse() was not checked for a parsing error. In case of a parsing error the stored return code could have been overwritten later in this function. Explicitly check for a parsing error, log corresponding packets, and return an "invalid mandatory information" error status to the sender. To avoid loops, do not respond with an error status to STATUS PDUs. Change-Id: I56e10a97cda7fd2d40bc7b4b2e6202f97772e1b3 Related: OS#3178
2018-03-17gprs_bssgp_pcu.cpp: Comment unused function parse_ra_capPau Espin Pedrol1-0/+2
Commit 741d25cb6f8c0c1522cf6d1be2fea49356ecd4bd commented the only user of the function but forgot to comment too the function itself. Change-Id: I8b291b45aaedfb0421cd28c0d9e24cefa5547b09
2018-03-11implement support for 3-digit MNC with leading zerosNeels Hofmeyr1-6/+9
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-0/+2
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
2017-12-18Remove unused includes and forward declarationsMax1-1/+0
Change-Id: I59da04edd1b8ff965bbfbe00ccae1f7c9b6e5301
2017-10-24gb: allow only packets from a specific SGSNPhilipp Maier1-0/+2
Each PCU has a specifically assigned SGSN, which may send packets to the PCU. Ensure that no one else except the configured SGSN can send packets to the PCU. Change-Id: Ic2009039fab7cf0fba916556239747ae5b410366 Depends: libosmocore Ifeb201d9006eec275a46708007ff342cdfc14e45
2017-07-29BSSGP: Improve logging of received messagesHarald Welte1-39/+73
We now differentiate clearly between messages that a) we don't expect based on our reading of the spec b) we have not implemented yet (but should) c) we do not even know of Also, unify the log string formats and provide BVCI whenever possible. Change-Id: Ie32f5771d49960547ec5d7611f96a74facc1b035
2017-07-28BSSGP: Use libosmocore for BVC-RESETMax1-5/+22
Implement proper BVC RESET procedure by using libosmocore code to handle BVCI reset and initiate PTP BVC reset if necessary. Requires I9bf8f4dd784ccddbb9926492a85fff3293a0e913 in libosmocore. Related: OS#1638 Change-Id: I718c949759688cb34ce6bcbb3da2092fcdfa6989
2017-06-11use tlvp_val16be() rather than manual pointer-cast + ntohs()Harald Welte1-4/+2
Change-Id: Ib77cb703bb1710da396db3a939700515b5c20235
2017-05-25Fix format string error (string needs %s)Harald Welte1-1/+2
In a49475b5a822773ce10e28bf5a02e91de78bd063 we introduce the use of bssgp_pdu_str() and change from printing the numeric code to the stringified version of the message code. However, the format string was not updated accordingly :/ Change-Id: I7173b692fb1f222aab44cd4f44a482038d0f51dc Fixes: Coverity CID 169684
2017-05-23Print human-readable BSSGP PDU typeMax1-8/+9
Change-Id: Ief4b5ce4e4020edaf771eaa24f4382ec368dd18c
2017-05-15remove pcu own bitvector implementationAlexander Couzens1-1/+1
The osmocore bitvec is exact the same, but use a pointer instead of a reference. Change-Id: Id8f797631d89aa12b6e48efb2dc153a3e2f059f7
2017-02-23logging fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*Neels Hofmeyr1-1/+1
In libosmocore, my patch was merged to master a bit too soon. To accomodate the request for naming that matches the general "LOG" prefix instead of "LOGGING", a fixup was committed to libosmocore. Adjust for that. Original patch: change-id I5c343630020f4b108099696fd96c2111614c8067 The fixup: change-id I424fe3f12ea620338902b2bb8230544bde3f1a93 Change-Id: I4db4a668f2be07f3d55f848d38d1b490d8a7a685
2017-02-17logging: use central filter and ctx consts from libosmocoreNeels Hofmeyr1-1/+1
Change-Id: I7b41a5a26527864177c63403ad171d2987f0ff6a Depends: libosmocore change-id I5c343630020f4b108099696fd96c2111614c8067
2016-02-08edge: Support all coding schemes for BSSGP flow controlJacob Erlbeck1-31/+50
Currently the MCS schemes are not supported when the leak rate is being computed. This leads to a lower value for the leak rate, thus limiting the throughput to GPRS-like ranges. Use the payload size reported by GprsCodingScheme instead. Sponsored-by: On-Waves ehf
2016-02-08bssgp: Ignore downlink BSSGP RA Cap IEJacob Erlbeck1-0/+4
That IE may contain inaccurate or completely bogus data. This commit disables the parsing. Note that this should be replaced by a config option. Sponsored-by: On-Waves ehf
2016-02-08edge: Get EGPRS MS class from downlink BSSGPJacob Erlbeck1-27/+22
In case there is no MS object present that matches a DL UNITDATA, the EGPRS class is currently assumed to be 0, since the Radio Access Capabilities IE is not fully decoded if present. This commit uses the CSN.1 decoder to parse the IE and uses the same functions like the uplink related code does to get the GPRS and EGPRS multislot classes. Remove the old parse_ra_cap_ms_class function. Sponsored-by: On-Waves ehf
2016-02-08Revert "bssgp: Add hand-coded extended RA Cap parser"Jacob Erlbeck1-66/+0
Just keep this for later reference, since a CSN.1 decoder based implementation will be used. This reverts commit b37ab36bb14d2d2c1363fbe521cd19984d0c3d4c.
2016-02-08bssgp: Add hand-coded extended RA Cap parserJacob Erlbeck1-0/+66
Add an extended parse_ra_cap function based on the existing parse_ra_cap_ms_class which also parses up to the EGPRS related fields. Sponsored-by: On-Waves ehf
2016-02-01pcu: Fix memory corruption bugs (ASAN)Jacob Erlbeck1-8/+13
ASAN has found improper deletion of objects. These only occur on shutdown but makes it impossible to run the test cases with full ASAN support. This commit fixes some of them and deactivates the freeing of the_pcu.bctx which may cause a corruption in BTS::~BTS() later on. Note that the latter is only a work-aound and should be fixed properly. It will leak bctx objects, but this is currently not critical, since gprs_bssgp_destroy is only called once, immediately before a call to exit(). Ticket: OW#1572 Sponsored-by: On-Waves ehf
2015-12-15edge: Extend gprs_rlcmac_dl_tbf::handle by egprs_ms_classJacob Erlbeck1-1/+3
The multislot (MS) class and the EGPRS MS class can also be passed via BSSGP in an MS Radio Access Capability element which can optionally be contained in a DL-UNITDATA PDU. While this case is fully supported for GPRS, the EGPRS MS class in BSSGP messages is ignored. This commit extends gprs_rlcmac_dl_tbf::handle to pass the EGPRS MS class, too. Note, that the EGPRS class is not yet taken from the CSN.1 RA capability and is always set to 0. Note also, that append_data still uses ms_class only. Sponsored-by: On-Waves ehf
2015-09-11bssgp: Use measured leak rate for flow controlJacob Erlbeck1-0/+57
The leak rate sent to the SGSN does not reflect the current CS level, lost frames, and control message overhead. So the SGSN cannot do proper queue control under non-optimal conditions. This commit computes the leak rate for the last flow control interval by computing the maximum theoretical leak rate and basically substracting control blocks, nacked blocks, and reduced block sizes due to CS downgrade. By using this approach, the value will by more stable on low load, where the value will tend to be near the value derived from the configuration. On full load the transmitted value is completely derived from the measurements. Note that the MS default values are no adapted to the adapted BVC leak rate, since a single MS which has a lower link quality would otherwise be reducing the rate of another MS with good radio conditions, which would not make much sense if they did not share any PDCH. Sponsored-by: On-Waves ehf
2015-08-17ns: Reconnect NSVC after timeoutJacob Erlbeck1-0/+30
Currently the signal S_NS_ALIVE_EXP emitted by the NS layer if the alive check has timed out too often is ignored. This prevents the PCU from reconnecting to the SGSN if it has not been accessible for some time. This commit modifies nsvc_signal_cb to reset the NSCV if S_NS_ALIVE_EXP is sent, so that the PCU continues to send NS RESET message if that happened. Sponsored-by: On-Waves ehf
2015-07-21bssgp: Fix leak rate computation CS valueJacob Erlbeck1-5/+21
Currently the initial_cs_dl value is used to compute the maximum leak rate. This can be too low if adaptive CS selection is used. This commit changes gprs_bssgp_tx_fc_bvc to derive the max CS level from the configuration. Sponsored-by: On-Waves ehf
2015-07-17bssgp: Adapt flowcontrol MS default to current alloc algorithmJacob Erlbeck1-2/+5
Currently the values Bmax/R default MS are computed under the assumption than min(4, N_PDCH) DL slots are allocated for an MS, even if multislot assignment is not enabled. This commit changes the computation to assume 1 DL slot if algorithm A is selected or the dynamic algorithm is used and has disabled multislot assigment due to high load. Sponsored-by: On-Waves ehf
2015-06-22llc: Make timeval arguments constJacob Erlbeck1-2/+2
Some struct timeval pointer arguments do not have the const qualifier, albeit the methods do not write to the structures. The next commit will change related pointers to const, so this commit provides the required constness. Sponsored-by: On-Waves ehf
2015-06-11bssgp: Calculate the avg_delay_ms in 32bit only (Coverity)Jacob Erlbeck1-1/+1
Currently the delay_sum is stored in 64 to avoid overflow errors. But only the result of tv_sec * 1000 is casted to 64 bit, resulting in an overflow if the accumulated queue delay reached 25 days (which will not happen in practice, unless there are >200k LLC messages with a max of 10s delay each in the queue). If that were the case, the only impact would be a wrong number in a log message and in the BSSGP FLOW CONTROL message. This commit changes the calculations so that they are done in 32 bit only, rather than to do the calculation in 64 bit properly. Fixes: Coverity CID 1298705 Sponsored-by: On-Waves ehf
2015-06-11bssgp: Handle btcx == NULL in gprs_bssgp_pcu_rx_sign (Coverity)Jacob Erlbeck1-2/+4
Currently it is assumed, that btcx is non-NULL. The btcx is only used to obtain the BVCI in some log messages. This commit changes that by using -1 as shown BVCI value. Fixes: Coverity CID 1040961 Sponsored-by: On-Waves ehf
2015-05-21ms: Support new and old TLLIsJacob Erlbeck1-1/+15
According to the specification (GSM 04.08/24.008, 4.7.1.5) after a new P-TMSI has been assigned, the old P-TMSI must be kept basically until it has been used by both sides. Since the TLLI will be derived from the P-TMSI, the old TLLI must also be kept until the new TLLI has been used by both MS and SGSN. This commit modifies the TLLI handling of GprsMs accordingly. set_tlli() is only used with TLLIs derived from MS messages, confirm_tlli() is used with TLLIs derived from messages received from the SGSN. tlli() returns the value set by the MS. check_tlli() matches each of the TLLI used by either MS or SGSN as well as the old TLLI until it has been confirmed. Sponsored-by: On-Waves ehf
2015-05-06bssgp: Increment BSSGP flow control tag valueJacob Erlbeck1-1/+4
Currently the tag value in FLOW CONTROL BVC messages is always 1. This commit changes the implementation to increment that value with each of the FLOW CONTROL BVC messages that is sent to the SGSN. Sponsored-by: On-Waves ehf
2015-05-06bssgp: Compute and transmit queue delayJacob Erlbeck1-4/+37
The specification 28.018, allows to transmit the average LLC downlink queueing delay in FLOW CONTROL BVC messages (BVC Measurement IE, see GSM 28.018, 10.4.4 and 11.3.7). This commit extends gprs_bssgp_pcu.cpp to compute the average delay time between two subsequent FLOW CONTROL BVC messages. The average is implemented as an arithmetic average without any weighting. Ticket: OW#1432 Sponsored-by: On-Waves ehf
2015-05-06bssgp: Add VTY command to Limit the bucket size by timeJacob Erlbeck1-3/+7
Currently the bucket size is by default being computed based on the leak rate and the expected life time of LLC frames. The latter is either taken from 'queue lifetime' (if given) or a fixed value is used. Using 'queue lifetime' has the drawback that it sets a 'hard' limit, since frames will be dropped if they stay in the queue for a longer time. This commit adds a VTY command to specifically set the time used for the computation of the bucket size advertised to the SGSN. It does not affect the PCUs queue handling in any way. If the bucket time is not set (or if the 'no' command has been used), the old behaviour (see above) is applied. The following VTY commands are added (config-pcu node): - flow-control bucket-time <1-65534> Sets the time in centisecs - no flow-control bucket-time Don't use this time Ticket: OW#1432 Sponsored-by: On-Waves ehf
2015-05-06bssgp: Compute BVC bucket size and leak rateJacob Erlbeck1-5/+133
Currently the PDCH assignment and coding scheme does not influence the values transmitted by the FLOW-CONTROL-BVC messages. This commit adds the computation of those values. If the leak rate is not given explicitly, it is derived from the number of PDCH and the allowed coding scheme. If the BVC bucket size is not given explicitly, it is derived from the leak rate and the maximum buffer time. The latter is taken from the 'queue lifetime' command (or 10s if this has not been used). The MS default bucket size is set to 50% of the BVC bucket size. The MS default rate computation assumes, that each MS only supports up to 4 time slots for GPRS RX. Sponsored-by: On-Waves ehf
2015-05-06bssgp: Make BVC bucket size / leak rate configurableJacob Erlbeck1-1/+9
Currently the FLOW-CONTROL_BVC message contains fixed values: The tag is 1, the BVC bucket size is 6MB, the BVC bucket leak rate is 820kbit/s, the MS bucket size is 50kB, and the MS leak rate is 50kbit/s. This commit makes the BVC parameters configurable and adds the following VTY commands: - flow-control force-bvc-bucket-size <1-6553500> - no flow-control force-bvc-bucket-size - flow-control force-bvc-leak-rate <1-6553500> - no flow-control force-bvc-leak-rate - flow-control force-ms-bucket-size <1-6553500> - no flow-control force-ms-bucket-size - flow-control force-ms-leak-rate <1-6553500> - no flow-control force-ms-leak-rate The 'no' variants restore the default behaviour. Sponsored-by: On-Waves ehf
2015-03-17bssgp: Handle BSSGP STATUS messagesJacob Erlbeck1-5/+62
Currently incoming BSSGP STATUS messages are just logged and apart from that ignored. Since it is possible that the gbproxy can eventually send both valid replies (from the primary SGSN) and STATUS(unknown BVCI) messages (from the secondary SGSN). Since the PCU assumes in this case that the BVC has been successfully reset and unblocked, it will not send a BVC RESET message after receiving an NS_UNBLOCK. This commit changes gprs_bssgp_pcu_rcvmsg to pass BSSGP STATUS messages to bssgp_rcvmsg() which will in turn call bssgp_prim_cb() with primitive NM_STATUS. Then the BVC RESET or UNBLOCK procedure will be started if the IE in the message matches and the PCU assumes that the BVC should have been successfully reset and unblocked respectively while the STATUS message tells otherwise. Note that bssgp_rcvmsg() from libosmocore is otherwise used for the SGSN side only, albeit it generally just decodes messages, does basic protocol handling and eventually invokes PRIM indications. The only exception here is the handling of BVC RESET, which is implemented specifically for the SGSN. Ticket: OW#1414 Sponsored-by: On-Waves ehf
2015-03-17bssgp: Set blocking and reset timer to 30sJacob Erlbeck1-3/+6
Currently the timer T1 and T2 are hard-coded to 1s which is pretty low in consideration of a possible high latency connection to the SGSN. This commit introduces macros for the timer values and sets them to 30s. Sponsored-by: On-Waves ehf
2014-08-07tbf, gprs_bssgp_pcu: Move some methods to DL TBFDaniel Willmann1-1/+1
These methods are only used on DL TBFs and can be moved to the subclass. Ticket: SYS#389 Sponsored by: On-Waves ehf
2014-06-15Always exit and don't try to recoverDaniel Willmann1-12/+1
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-11-11misc: Fix coverity warning about indentionHolger Hans Peter Freyther1-1/+0
So we had one intended line inside the if for "SMS VALUE" and at the same time one line with "SMS VALUE" at the same indention. Assume it is copy and paste and remove the line. Currently we are only parsing the ms_class so this change should not have any semantic change. Fixes: Coverity CID 1058761
2013-11-07tbf: Move the tbf_handle and tbf_append_data into the classHolger Hans Peter Freyther1-1/+1
2013-11-06llc: Begin creating a LLC class and move counts into it.Holger Hans Peter Freyther1-1/+1
Begin to move state of the LLC into a separate object. This will allow to make side-effects more clear and kill some code duplication.
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-18tbf: Begin to add some structure to the tbf codeHolger Hans Peter Freyther1-118/+3
The TBF should use the IMSI to identify a block flow but all handling is spread across the entire code. Start to clean this up by moving relevant code into the tbf file. Afterwards one can clean up and add more internal structure.
2013-10-02tfi: The tfi_alloc doesn't allocate anything, rename the functionHolger Hans Peter Freyther1-1/+1
Call things by what they do and this function doesn't allocate anything but it is searching for the first unallocated tbf index.
2013-09-04bssgp: Add callback UNITDATA.DL messaes with the dataHolger Hans Peter Freyther1-0/+3
2013-09-04bssgp: Add callbacks for certain BSSGP eventsHolger Hans Peter Freyther1-0/+2
Add a callback called when Unblock Ack is received. This can be used by a supervisor or the emulation test.
2013-09-04bssgp: Return the gprs_bssgp_pcu instance from create/connectHolger Hans Peter Freyther1-24/+9
This can be used to install handlers/testcases to register callbacks and other data.