aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_rlcmac_sched.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-07-29GSMTAP: Fix channel type for data blocks: PDTCH instead of PACCHHarald Welte1-1/+1
PACCH is used only for RLC/MAC control messages, while PDTCH is used for data. Change-Id: I6c912e17d8c8d4178096679a541e61eeeb4b6643
2017-07-21Introduce GSMTAP categoriesHarald Welte1-3/+10
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-05-26Cleanup FN schedulingMax1-1/+1
* replace magic number with defined constant * move copy-pasted code to inline functions * remove unused code Change-Id: I6fee0714453d0c3c3f3f875f88daea2d9c477331 Related: OS#1524
2017-05-15fix PACCH paging: don't return early in case of NULL TBFNeels Hofmeyr1-7/+8
Commit b78a4a6dfef217c538d45949a6ae725e22a36b05 tried to fix a NULL dereference error, but apparently was overly eager to return, because it looked like all code paths would dereference the tbf. In fact the code path further above, for msg != NULL, has "always" dereferenced the tbf, but the lower code path, the one effecting the paging, has only started to dereference tbf since shortly before the overly eager fix: in da7250ad2c1cd5ddc7d3c6e10435a00b357ef8f7, to "update the dl ctrl msg counter for ms". It seems that this tbf dereference in the paging path is bogus and the cause for the segfault that made me write the early exit fix. Fix that fix: Do not exit early if tbf == NULL, stay in there to be able to reach the paging path below. In case of a message to be sent, assume that tbf is present, and verify: print an error message and abort if there is a msg but no tbf, so that we will see the error if I'm wrong there. If a tbf is missing, free the msg. In case of no message, go on to send pending pagings, but do not attempt to count ctrl messages for a tbf -- IIUC there will never be a tbf if we're paging. This should avoid segfaults while keeping PACCH paging intact. Tweak a comment for and add a blank line above the paging section. Related: OS#2176 CID#158969 Change-Id: Ib79f4a945e211a13ac7d1e511cc37b0940ac6202
2017-01-24Handle packet access reject during packet resource requestaravind sirsikar1-3/+8
When Packet resource request is received, PCU will generate the packet access reject if no resources are present. The encoding is done based on section 7.1.3.2.1 and 8.1.2.5 of 44.060 version 7.27.0 Release 7. This patch also includes the test case to validate the generated packet access reject message. This patch is integration tested on Osmo-trx setup with Ettus B210 board and LG F70 MS with some simulation code changes in Osmo-pcu. Change-Id: I05ff25124b58905586caa0c0c37023d69724f121
2017-01-06fix segfault: check for NULL tbf in sched_select_ctrl_msg()Neels Hofmeyr1-0/+3
Apparently fixes a corrupted stack looking like this on sysmobts: (gdb) run Starting program: /usr/bin/osmo-pcu -c /etc/osmocom/osmo-pcu.cfg [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". <000b> telnet_interface.c:95 telnet at 127.0.0.1 4240 <0001> osmobts_sock.cpp:227 Opening OsmoPCU L1 interface to OsmoBTS <0001> osmobts_sock.cpp:285 osmo-bts PCU socket has been connected <0001> pcu_l1_if.cpp:368 BTS available <0008> gprs_ns.c:233 NSVCI=65534 Creating NS-VC <0008> gprs_ns.c:233 NSVCI=100 Creating NS-VC <0008> gprs_ns.c:1568 NSEI=100 RESET procedure based on API request <0008> gprs_ns.c:393 NSEI=100 Tx NS RESET (NSVCI=100, cause=O&M intervention) <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=2 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=2 <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=3 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=3 <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=4 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=4 <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=5 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=5 <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=6 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=6 <0001> pcu_l1_if.cpp:83 Sending activate request: trx=0 ts=7 <0001> pcu_l1_if.cpp:495 PDCH: trx=0 ts=7 <0001> pcu_l1_if.cpp:319 RACH request received: sapi=1 qta=0, ra=120, fn=103198 <0009> tbf_ul.cpp:373 LLC [PCU -> SGSN] TBF(TFI=0 TLLI=0x7f2dd569 DIR=UL STATE=FLOW) len=6 <0008> gprs_ns.c:684 All NS-VCs for NSEI 100 are either dead or blocked! Program received signal SIGSEGV, Segmentation fault. gprs_rlcmac_rcv_rts_block (bts=0x60a08, trx=trx@entry=0 '\000', ts=ts@entry=4 '\004', fn=7, fn@entry=103272, block_nr=block_nr@entry=0 '\000') at gprs_rlcmac_sched.cpp:349 349 gprs_rlcmac_sched.cpp: No such file or directory. (gdb) bt #0 gprs_rlcmac_rcv_rts_block (bts=0x60a08, trx=trx@entry=0 '\000', ts=ts@entry=4 '\004', fn=7, fn@entry=103272, block_nr=block_nr@entry=0 '\000') at gprs_rlcmac_sched.cpp:349 #1 0x0001151c in pcu_rx_rts_req_pdtch (trx=<optimized out>, ts=<optimized out>, fn=103272, block_nr=<optimized out>) at pcu_l1_if.cpp:279 #2 0x0000bfcc in handle_ph_readytosend_ind (fl1h=0xafa40, rts_ind=0xb03f8) at osmo-bts-sysmo/sysmo_l1_if.c:142 #3 l1if_handle_l1prim (wq=<optimized out>, fl1h=0xafa40, msg=0xb0330) at osmo-bts-sysmo/sysmo_l1_if.c:259 #4 0x4fcd6330 in osmo_fd_disp_fds (_eset=0xbefffb68, _wset=0xbefffae8, _rset=0xbefffa68) at select.c:149 #5 osmo_select_main (polling=<optimized out>) at select.c:189 #6 0x0000b2a0 in main (argc=<optimized out>, argv=0x66628 <_ZStL8__ioinit>) at pcu_main.cpp:295 Fixes: coverity CID#158969 Related: https://lists.osmocom.org/pipermail/osmocom-net-gprs/2016-December/000785.html Change-Id: I357492e558e98cfdbf5bb3438b5013029195b02b
2016-12-22Add counter at BTS level And statistics at TBF/MS level.sivasankari1-0/+5
Adds spb counters at BTS level(show bts statistics). Adds RLC/MAC downlink control msg at ms level(show ms imsi <imsi_val>). Adds the number of coding schemes counter for UL at TBF level. Change-Id: Icbe4ba95e34bea89ee36f532d099db68204b7c38
2016-11-11Handle packet access reject during EPDAN/PDAN with channel descriptionaravind sirsikar1-2/+7
When PDAN/EPDAN with channel description is received, PCU will generate the packet access reject if no resources are present. The encoding is done based on section 7.1.3.2.1 and 8.1.2.5 of 44.060 version 7.27.0 Release 7. This patch also includes the test case to validate the generated packet access reject message. This patch is integration tested on Osmo-trx setup with Ettus B210 board and LG F70 MS with some simulation code changes in Osmo-pcu. Change-Id: I096a3bb44a65533b9e9b091925dd5f70a8696d6
2016-07-26Remove useless ARFCN parameterMax1-4/+2
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-06-07add KPI counter to count bytes for RLC and LLC framesAlexander Couzens1-0/+1
rlc.dl_bytes bytes before sending rlc rlc.dl_payload_bytes count data w/o LI rlc.ul_bytes bytes when received rlc (only valid) rlc.ul_payload_bytes count data fragments w/o LI llc.dl_bytes complete encapsulated LLC PDUs llc.ul_bytes complete received LLC PDUs Change-Id: I9a98a5a375d39b3f4990360056c4d6145e755f4d Reviewed-on: https://gerrit.osmocom.org/145 Reviewed-by: Harald Welte <laforge@gnumonks.org> Reviewed-by: Holger Freyther <holger@freyther.de> Tested-by: Jenkins Builder
2016-05-22introduce new counter rlc_sent_controlAlexander Couzens1-0/+2
Counts control messages (UL/DL assignment, UL ACKs or page requests) Change-Id: Ib41031d430beddfb48d54470e632436f2c99c360 Reviewed-on: https://gerrit.osmocom.org/99 Reviewed-by: Holger Freyther <holger@freyther.de> Tested-by: Jenkins Builder
2016-05-22gprs_rlcmac_sched: fix mistype of CONTROL ACKAlexander Couzens1-1/+1
Change-Id: If37b33f69cd659d913ed81eb6060a42734ba524f Reviewed-on: https://gerrit.osmocom.org/100 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-21introduce new counter rlc_sent_dummyAlexander Couzens1-1/+5
rlc_sent_dummy count the amount of dummy package which are sent in case no data packet is in the queue. Change-Id: Ia60eab853d9145980f30d63e4ce4b520b8c51381 Reviewed-on: https://gerrit.osmocom.org/85 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-20move statistics counter rlc_sent() to gprs_rlcmac_schedAlexander Couzens1-1/+4
The counter rlc_sent has nothing to do with the TBF. The RLC packet got sent in the gprs_rlcmac_sched(). Change-Id: I5d2b910ea7cc250f17530406eda3be9b29b051fd Reviewed-on: https://gerrit.osmocom.org/84 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
2016-02-08sched: Do PACCH assignments for the same direction lastJacob Erlbeck1-4/+23
Currently the selection of a pending control message is done round robin. It can possibly happen, that a DL assigment is sent on a DL TBF while an UL assignment is pending. The MS will replace the old DL TBF in that case, so that it can no longer be used for the PACCH so that the UL assignment is lost. Give assigment requests for the same direction a lower priority. Sponsored-by: On-Waves ehf
2016-02-08tbf: Use is_control_ts() instead of comparing TS values directlyJacob Erlbeck1-2/+2
Currently there are some places where tbf->control_ts != ts is evaluated to check, whether ts is a control slot. Replace these expressions by tbf->is_control_ts(ts) which does the same whitout exposing internal fields. Sponsored-by: On-Waves ehf
2016-02-08sched: Pass the current TS to the control create functionsJacob Erlbeck1-3/+3
Currently the checks in that function are based on the different internal TS values of a TBF. It is assumed that they match the TS that the current RTS refers to. This commit adds a TS parameter to create_ul_ass, create_dl_ass, and create_ul_ack to make this more explicit. Sponsored-by: On-Waves ehf
2016-02-01tbf: Use LListHead instead of llist_podsJacob Erlbeck1-5/+9
LListHead does basically the same like llist_pods, but more C++ish and with type safety. This commit turns the former list field of gprs_rlcmac_tbf into a private field, provides accessors, moves the related code from pcu_vty.c to pcu_vty_functions.cpp, and removes the llist_pods type and related code. Sponsored-by: On-Waves ehf
2016-02-01sched: Assert that the generated message is not emptyJacob Erlbeck1-0/+1
Currently the msg data is accessed and index 0 assuming the msg is not empty. While this should be always the case, the msg can be empty if there are software errors in the message creation functions. This commit adds an assertion to catch this kind of bugs. Sponsored-by: On-Waves ehf
2015-12-16sched: Change next_ctrl_prio incrementJacob Erlbeck1-1/+1
Currently the control block scheduler does not seem to be fair in all cases. At least it happend while testing the EGPRS code, that a Uplink Ack/Nack message got never be sent, because a Downlink assignment took over all the times. This commit changes the round robin code to always increment the priority offset by 1 instead of (i + 1). The former definitely ensures that every message type gets the highest priority after some steps. The latter might be more fair in some situations, but that and its correctness are not proven. Sponsored-by: On-Waves ehf
2015-09-11bssgp: Use measured leak rate for flow controlJacob Erlbeck1-0/+3
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-03-25tbf: Poll MS on idle DL TBFsJacob Erlbeck1-7/+34
If an MS wants to open a new UL TBF, it can either use (P)RACH or request one in a Ack/Nack message for a DL TBF (PACCH). When a TBF becomes idle (LCC queue is empty but the TBF is kept open), there aren't any Ack/Nack requests that can be used by the MS to ask for an UL TBF, therefore it has to use the RACH. This leads to many RACH requests even for a single HTTP transaction, so it takes some time to retrieve even a simple web page. This commit modifies the scheduler to regularly send Ack/Nack requests on idle DL TBFs. It does so by extending the priority based scheduling algorithm to have 5 priority levels (highest priority first): - Control block is pending - High age (100%) threshold reached (-> request Ack/Nack) - Data is waiting or there are pending Nacks - Low age (200ms) threshold reached (-> request Ack/Nack) - Pending Nacks that have been resent already - None of the above (-> send DL dummy control block) The 'age' refers to the time since since the last control block has been sent on the TBF. This high age threshold is set to dl-tbf-idle-time or to 50% of T3190 (whichever is smaller), aiming for at least a poll (and TBF shutdown) after the TBF has expired and to safely prevent expiry of T3190. So if dl-tbf-idle-time > 200ms, there will be a poll every 200ms and a final poll after dl-tbf-idle-time. On high load, the interval between polls can get higher, but the 'high age' poll should be in place. This commit implements the scheduling with respect to GSM 44.060, 9.3.1a ("Delayed release of downlink TBF"). Ticket: #556 Sponsored-by: On-Waves ehf
2015-03-06sched: Modify DL scheduling to use different prioritiesJacob Erlbeck1-6/+23
Currently the DL blocks are scheduled round robin to each TBF that is either in state FLOW or FINISHED and not waiting for an IMM.ASS confirmation. This way, if single blocks has been NACK'ed by the MS and the PCU has already resent the missing packets, the PCU starts retransmitting them until it has received an ACK/NACK even if other TBF have RLC blocks that need to be transmitted. This commit changes sched_select_downlink to select the next TBF with the highest priority, where blocks that are going to be resent again have a lower priority unless the window is stalling. If there is only one TBF the old behaviour is kept, since there is no other TBF that can have a higher priority. If there is much packet loss on a single phone, this modification can lead to a higher latency for that MS. Sponsored-by: On-Waves ehf
2014-08-07tbf, ...: Make the fields in the dl/ul struct member variablesDaniel Willmann1-2/+2
There is no need for the union/struct anymore. Make the variable members of the UL/DL class. As a result gprs_rlc_dl_window gets a reset() method because memset(&dir.dl, 0, sizeof(dir.dl)) doesn't work anymore in reuse_tbf(). Ticket: SYS#389 Sponsored by: On-Waves ehf
2014-08-07gprs_rlcmac_sched: Use UL/DL TBFs in schedulerDaniel Willmann1-28/+32
Ticket: SYS#389 Sponsored by: On-Waves ehf
2014-08-07tbf: Make create_new_bsn and create_dl_acked_block a method of DL TBFDaniel Willmann1-1/+1
These functions are only used for DL TBFs so move them. sched_select_downlink() in src/gprs_rlcmac_sched.cpp now needs to deal with DL TBFs instead of the base class. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-30tbf: Use plain old data structure (PODS) for llist managementDaniel Willmann1-2/+3
The PODS struct has a back pointer to access the actual object. llist_pods_for_each_entry traverses the list of struct llist_pods and makes the entry available (through the back pointer). Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-06-04gprs_rlcmac_pdch: Don't access private membersDaniel Willmann1-2/+2
This patch introduces methods to get ul and dl tbf by tfi and uses them in gprs_rlcmac_sched. Sponsored by: On-Waves ehf
2013-12-25sched: Attempt to improve the fairness and schedule UL/AL ACK/ASSHolger Hans Peter Freyther1-14/+22
It is possible that certain UL ACK messages are not sent when there are many many uplink and downlink assignments. Try to be more fair and schedule them round-robin. This way no starvation should occur.
2013-12-25sched: Remove unused bts parameter from the internal methodHolger Hans Peter Freyther1-2/+2
2013-11-26tbf/sched: We pick the _last_ entry, rotate the listsHolger Hans Peter Freyther1-0/+1
We always pick the _last_ entry from the lists. Let's rotate so we make it a bit more fair.
2013-11-23sched: Make internal methods staticHolger Hans Peter Freyther1-3/+4
2013-10-30tbf: Make tfi private and update the codeHolger Hans Peter Freyther1-6/+4
All logging code that used tbf->tfi is now using tbf_name to print the the TBF. External code is now using tfi() which is inlined and should result in the same code being generated as before (+debug code that can be stripped).
2013-10-30tbf: Remove the trx_no field from the tbf, go through the trx objectHolger Hans Peter Freyther1-2/+2
2013-10-30misc: Change the logging for the tbf and what to logHolger Hans Peter Freyther1-3/+3
TLLIs got printed as TBF. Fix that but also rename things to TFI. The TFI is not required to be unique per BTS but it is the indicator we use right now.
2013-10-30misc: Fix typo.. resource in english only has one 's'Holger Hans Peter Freyther1-7/+7
2013-10-30tbf: Move gprs_rlcmac_send_data_block_acknowledged into tbfHolger Hans Peter Freyther1-1/+1
We can now remove the gprs_rlcmac_data as the code has been moved into the tbf, pdch and bts.
2013-10-30tbf: Move gprs_rlcmac_send_packet_uplink_assignment to the tbfHolger Hans Peter Freyther1-1/+1
Again the function was called send but didn't do any sending
2013-10-30tbf: Move gprs_rlcmac_send_uplink_ack into the tbfHolger Hans Peter Freyther1-1/+1
The method was called send but didn't send anything. Move it to the tbf
2013-10-30tbf: Move gprs_rlcmac_send_packet_downlink_assignment into the tbfHolger Hans Peter Freyther1-1/+1
This method was called _send_packet_ but actually didn't do any sending at all. It just formated the right assignment. I replaced tbf-> with nothing.
2013-10-30misc: Remove the bts parameter from calls that take a tbfHolger Hans Peter Freyther1-5/+4
Mark some of the tbf manipulation that is burried in the data sending routine.. that it should be moved around.
2013-10-30sched: Add another warning about trx->arfcn and arfcn..Holger Hans Peter Freyther1-0/+2
2013-10-30bts/tbf: Move the lists into the BTS and do the look-up from the BTSHolger Hans Peter Freyther1-4/+5
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-1/+1
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-30sba: Move the sba code to a dedicated fileHolger Hans Peter Freyther1-17/+0
Move the code around and then turn it into an object...
2013-10-30pdch: Move paging dequeue into the PDCH objectHolger Hans Peter Freyther1-2/+1
Rely on packet_paging_request returning NULL in case the queue is empty. We should move the write_packet_paging_request into a separate file/object as well.
2013-10-30pdch: Move enable/disable into the PDCH codeHolger Hans Peter Freyther1-1/+1
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: 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-2/+2
2013-10-30bts: Remove global state from gprs_rlcmac_send_packet_uplink_assignmentHolger Hans Peter Freyther1-1/+1
This was the last method of gprs_rlcmac_data.cpp to access the gprs_rlcmac_bts variable.