aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_bssgp_pcu.cpp
AgeCommit message (Collapse)AuthorFilesLines
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.
2013-09-04rlcmac: Reduce the depedency on the global gprs_rlcmac_bts variableHolger Hans Peter Freyther1-9/+11
For mocking/unit-testing/emulation (and a dual trx-systems) having global state is quite bad. Cut back on the usage of the global struct gprs_rlcmac_bts. It also makes the complexity of certain routines more clear.
2013-09-04bssgp: These routines are not public API.. make them static for nowHolger Hans Peter Freyther1-4/+4
2013-09-04bssgp: Re-indent the switch/case statementHolger Hans Peter Freyther1-45/+45
2013-08-02bssgp: The method creates and the connects.. reflect that in the nameHolger Hans Peter Freyther1-1/+1
Call things by what they do. This method is creating and then connecting a BSSGP..
2013-07-30misc: Move the parsing of the ms_class from RA Capabilities to a methodHolger Hans Peter Freyther1-32/+43
Decrease the number of lines of a single method by splitting things up. The fewer lines of code, branches and side-effects in a method, the easier it will be to understand. The other benefit is that one can start creating unit tests for the some parts of the code.
2013-07-30bssgp: Remove commented out code that is currently not used.Holger Hans Peter Freyther1-4/+0
2013-07-30bssgp: Reset the BVC and NSVC state in the destroy routineHolger Hans Peter Freyther1-0/+4
This might explain the issue of the BVCI > 1 not being unblocked as the internal state has not been re-set when destroying the bssgp.
2013-07-30misc: Move the nsvc_unblocked into the struct osmo_pcuHolger Hans Peter Freyther1-5/+6
2013-07-30misc: Move the bvc_timer into the struct osmo_pcuHolger Hans Peter Freyther1-9/+9
This continues with the previous changes to reduce the global state.
2013-07-30misc: Remove the unused sgsn pointer from the compilation unitHolger Hans Peter Freyther1-1/+0
2013-07-30misc: Move the struct bssgp_bvc_ctx into the struct osmo_pcuHolger Hans Peter Freyther1-21/+26
2013-07-30misc: Introduce a struct osmo_pcu and move things into it.Holger Hans Peter Freyther1-24/+32
One of the issues with not properly re-setting everything is that due the global state it is not clear which variables belong together and how long it exists. Begin with creating a osmo_pcu and moving things into this class. Think of an organic cell, this commit is introducing the cell wall around it... and defines what is inside and what is outside of it.
2013-07-27misc: Add an option exit/quit when the BSSGP is supposed to be destroyedHolger Hans Peter Freyther1-1/+12
The PCU does not properly re-set the state when the connection to the BTS is lost (and the SGSN potentially is re-started during that). This results in the BSSGP BVCI > 1 remaining blocked and no data will be accepted by the SGSN. Add the '-e' option and exit the PCU when the BSSGP/NS are getting destroyed.
2013-07-27misc: Remove if (timer_pending) stop_timer idiom from the codeHolger Hans Peter Freyther1-4/+2
osmo_timer_del is an idempotent operation. There is no requirement to check if it is running. If you don't want a timer to run, delete it. Maybe one should have called the method _unschedule, _cancel to make this more clear.
2013-05-13Added timing advance support for up and downlink TBFsAndreas Eversberg1-1/+14
The timing advance of any TBF is stored when it ends. Whenever a new TBF with the same TLLI is created (downlink TBF), the stored TA is recalled. This algorithm assumes that the mobile does not move too fast during transfer. Also the mobile must start a connection in order to get correct initial timing advance. This algorithm does not implement the timing advance procedure as defined in TS 04.60. To implement the standard timing advance procedure, the BTS must decode RACH on certain bursts, the mobile is expected to send them. This requires much more complexity to a transceiver like USRP/UmTRX or Calypso BTS. The algorithm was tested at TA >= 8 and works quite well.
2013-03-17Introduce new file for various measurementsAndreas Eversberg1-0/+3
The measurements include: - DL bandwidth usage - DL packet loss rate - DL measurements by mobile - UL measurements by BTS In order to receive DL measurements from mobile, it must be enabled via system information message at BSC.
2013-03-10PCU: respect the PCU-side "local port" as configured via L1 IFHarald Welte1-3/+5
This makes sure that the UDP local port of the Gb link is actually set to what is configured via OML from OpenBSC.
2013-01-16Use PCU's talloc context to allocate libosmogb instancesAndreas Eversberg1-2/+2
This is usefull to identifiy memory leaks while using libosmogb.
2013-01-16Fixed memory leaks caused by not freeing bitvectorAndreas Eversberg1-0/+1
Especially each data message from SGSN caused two memory leaks, which resulted in increasing memory usage while receiving date from SGSN.
2013-01-15Get rid of allocating first timeslot at tfi_allocAndreas Eversberg1-5/+4
This simpliefies the allocation process. tfi_alloc is responsible to allocate a TFI, not a time slot. The first time slot available depends on multislot class and on other ongoing TBF (concurrent TBFs), so it is part of the allocation algorithm to select it.
2013-01-11make sure to register NS protocol to the VTYHarald Welte1-0/+1
Without calling gprs_ns_vty_init(), the NS specific VTY commands are not activated.
2012-12-18Added paging PS support by Ivan KluchnikovAndreas Eversberg1-2/+26
Original code: c7e7f6868b6f24346424dee904f4e76d3f216ff4 (The code was committed earlier, but got lost somehow.) I added IMSI, so the paging request is sent in correct paging group. Also I excluded rest octets from pseudo length. It is tested and it work.
2012-12-18Use seperate function to parse IMSI from BSSGP messageAndreas Eversberg1-20/+31
2012-12-18Fix: Removed potential double free bug when receiving NS messagesAndreas Eversberg1-2/+0
2012-10-05Merge branch 'jolly'Ivan Kluchnikov1-16/+207
Conflicts: src/gprs_bssgp_pcu.cpp src/gprs_rlcmac.cpp src/gprs_rlcmac_data.cpp src/gprs_rlcmac_sched.cpp
2012-09-28Fix: Cleanly open and close NS instanceAndreas Eversberg1-1/+8
2012-09-27Use PCH confirm from BTS to start downlink packet flowAndreas Eversberg1-1/+3
Since we don't know when the IMM.ASS message is sent on it's paging group on PCH, we will wait for confirm from BTS and start packet flow then.
2012-09-27Fix: Dump correct NSVCI value at debug lineAndreas Eversberg1-1/+1