aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2015-05-28tbf/test: Add tests for single and two phase accessJacob Erlbeck1-2/+4
These tests cover the message exchange from receiving from the first RACH request to the first data block when establishing an uplink TBF. This will be used to check, whether TA and other values are passed to an MS object correctly. In addition, the RX RACH log message in rcv_rach is extended to contain the single block fn. Sponsored-by: On-Waves ehf
2015-05-28tbf: Remove TBF chaining (m_new_tbf and m_old_tbf)Jacob Erlbeck3-85/+15
Currently a new TBF is chained to an existing older one, either of the other direction (active or releasing) or of the same direction (releasing). This does not work properly work if and uplink and a downlink TBF are being established at the same time while an old TBF is being released. In that case, one of them is thrown away and the pending procedure is cancelled. The chaining is no longer necessary since the GprsMs objects have been introduced which keep track of the active TBFs. This commit removes the TBF members m_new_tbf and m_old_tbf and the related methods and code paths. Note that a new TBF can replace an older TBF entry of the same direction within an MS object when it is associated with an MS (e.g. by TLLI or because it is assigned via another, already associated TBF). In that case, the old TBF is no longer associated with an MS object. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-28tbf: Remove IMSI handling from trigger_dl_assJacob Erlbeck4-12/+7
Currently the BTS::trigger_dl_ass() method assigns the IMSI to the MS object. This should be (and is already) done earlier where the MS object is retrieved/created. This commit removes the corresponding code along with the 'imsi' parameter from trigger_dl_ass. Sponsored-by: On-Waves ehf
2015-05-28ms: Use the IMSI to retrieve the MS objectJacob Erlbeck1-11/+19
This commit extends get_ms() to really compare the IMSI if it has been given. Matching by TLLI has a higher precedence than matching by IMSI. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-28tbf: Move IMSI to MS objectJacob Erlbeck5-14/+76
Currently the IMSI is stored in the TBFs. Since it directly refers to an MS, it should rather be stored in an MS object. This patch move the m_imsi field from gprs_rlcmac_tbf to GprsMs, changes gprs_rlcmac_tbf::imsi() to get the IMSI from the associated MS object, and adds getter and setter to GprsMs. Before changing the IMSI of the associated MS object, assign_imsi() checks if there is already another MS object with the same IMSI and eventually resets the IMSI of that one. So using update_ms() and assign_imsi() ensures that there are not two MS object entries is the storage with the same TLLI or the same IMSI. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-27tbf: Always call set_tlli/confirm_tlli in update_msJacob Erlbeck4-8/+24
Currently the m_tlli member in GprsMs is set by the constructor, circumventing the TLLI confirmation mechanism. This commit replaces the get_or_create_ms() method by a create_ms() method which takes the TLLI and the direction (UL or DL) as parameters to select either set_tlli() or confirm_tlli(). The MS object is instantiated with TLLI = 0, and therefore GprsMs::tlli() is extended to return the DL TLLI if both of the other TLLI are not set. Note that create_ms() will not check whether an MS object with a matching TLLI is already stored in the list, so it should only be called after a corresponding get_ms() in general. Sponsored-by: On-Waves ehf
2015-05-27tbf: Remove the TLLI from the TBFsJacob Erlbeck5-82/+14
Currently the TLLI is stored in each TBF. Since each MS is now represented by a GprsMs object which takes care of TLLI updating, and each TBF that has been associated with an TLLI also contains a reference to a GprsMs object, per TBF TLLI handling is no longer needed. Keeping all TBF m_tlli members up to date is complex and doesn't currently work correctly in all circumstances. This commit removes m_tlli and related members from the TBF class and the tbf_by_tlli functions from the BTS class. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-22write_queue: Check the result of osmo_wqueue_enqueue and freeHolger Hans Peter Freyther2-3/+12
The write_queue is designed to have a maximum amount of pending messages and will refuse to take new messages when it has been reached. The caller can decide if it wants to flush the queue and add the message again, create a log. But in all cases the ownership of the msgb has not been transferred. Fix the potential memory leak in the failure situation.
2015-05-21tbf: Just pass the MS object in reuse_tbfJacob Erlbeck1-1/+1
Currently the MS will be searched based on the TLLI in resue_tbf(). Since the MS object is already known in the TBF when the TLLI is set, it can just be passed to the new TBF. This commit removes the call to update_ms() and just adds new_tbf->set_ms(ms()) which will also work as expected if ms() == NULL. Sponsored-by: On-Waves ehf
2015-05-21tbf: Explicitly pass the direction to update_ms()Jacob Erlbeck4-9/+10
The type of the TBF update_ms() is being called on does not always reflect whether the TLLI has been signaled by the MS or the SGSN. This commit adds an additional parameter to tell the method, in which direction the TLLI has been passed. Sponsored-by: On-Waves ehf
2015-05-21tbf: Get the TLLI from the MS objectJacob Erlbeck2-5/+5
Since the synchronisation of the TBF's concerning the TLLIs has been removed in 'Support new and old TLLI's', gprs_rlcmac_tbf::tlli() can return the old TLLI which is probably different to ms()->tlli() in that case. This can lead to a wrong TLLI being used in BSSGP messages. This commit modifies the TBF's tlli() method to get the current TLLI from the MS object. Sponsored-by: On-Waves ehf
2015-05-21ms: Support new and old TLLIsJacob Erlbeck7-36/+94
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-20ms: Integrate the MS storageJacob Erlbeck4-16/+63
Use the MS storage to find a MS object for a given TLLI instead of searching the TBF lists. The TBFs are then taken from the MS object, if one has been found. If all TBF might be temporarily detached from the MS object, a GprsMs::Guard is added to prevent the deletion of the object, in case another TBF gets attached later on in the scope. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-20ms: Add MS storage classJacob Erlbeck5-1/+136
Currently the MS objects are contained in the TBF objects only. To allow for an extended life time after the TBF objects have been freed and to find them based on TLLI, a container for the MS objects is needed. This commit adds the container class and also adds the corresponding m_list member to GprsMs. Further integration into the PCU code is not yet done. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-20llist: Add a C++ wrapper for linux_listJacob Erlbeck2-1/+135
This commit adds the LListHead class which is a wrapper around the linuxlist. It adds an additional member to refer to the container, since the container_of macro doesn't work properly with C++ classes. All functions and macros from linuxlist.h are support except for the entry macros (e.g. llist_entry, llist_for_each_entry, ...). To access the container (entry), an entry() method is provided instead: llist_for_each(pos, &elems) { pos->entry()->do_something(); } Sponsored-by: On-Waves ehf
2015-05-20tbf: Add MS object management to TBF codeJacob Erlbeck5-1/+84
This commit adds MS object creation and cleanup to the TBF related code. MS objects are created when a TBF that has been "anonymous" so far gets associated with a TLLI. When a TBF is replaced by another, the old TBF is detached and the new one is attached to the MS. When all TBFs have been detached, the MS object gets deleted. The TBF related code should not call attach_tbf/detach_tbf directly but use set_ms instead to make sure, that the references are updated properly. GprsMs::detach_tbf also calls set_ms(NULL) on the detached TBF object. The MS object is not really used yet, the focus is still on object creation, TBF association, and cleanup. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-20ms: Add GprsMs class to hold per-MS informationJacob Erlbeck3-0/+263
Currently only TBF objects are used to handle the data flow between the MS and the SGSN. MS specific data (e.g. pending LLC frames, TLLI) is copied between successive TBFs. If all TBFs (uplink and downlink) are idle for some time, all information about the MS is discarded in the PCU. This makes the implementation of some features more difficult, e.g. proper TLLI and timing advance handling, connection based CS selection, and proper management of multiple TBF. This commit adds the GprsMs class that is intended to hold information directly related to the MS and to keep references to the active TBFs. The class is not yet integrated with the other PCU code. A GprsMs object container and MS specific fields (TA, CS) will be added in later commits. Note that calling detach_tbf() can possibly delete the MS object depending on the callback implementation. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-06bssgp: Increment BSSGP flow control tag valueJacob Erlbeck2-1/+5
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 Erlbeck3-10/+54
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 Erlbeck3-3/+36
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 Erlbeck3-1/+132
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-05-06tbf: Added calls to llc_dropped_frameJacob Erlbeck1-0/+3
Currently this function which increments the corresponding counter is just called in gprs_llc::clear(). It is not called on places where LLC DISCARDED messages are sent. This commit adds calls to llc_dropped_frame() at these places. Sponsored-by: On-Waves ehf
2015-05-04l1if: Add missing function prototypesJacob Erlbeck1-0/+10
A few prototypes are not part of any header files, leading to corresponding compiler warnings. This commit adds the missing prototypes to sysmo_l1_if.h. Addresses: sysmo_l1_if.c:347:2: warning: implicit declaration of function ‘l1if_transport_open’ sysmo_l1_if.c:364:3: warning: implicit declaration of function ‘l1if_transport_close’ sysmo_l1_fwd.c:89:3: warning: implicit declaration of function ‘l1if_handle_sysprim’ sysmo_l1_fwd.c:91:3: warning: implicit declaration of function ‘l1if_handle_l1prim’ sysmo_l1_hw.c:109:3: warning: implicit declaration of function ‘l1if_handle_sysprim’ sysmo_l1_hw.c:118:3: warning: implicit declaration of function ‘l1if_handle_l1prim’ Sponsored-by: On-Waves ehf
2015-05-04pcu: Fix non-critical warningsJacob Erlbeck1-1/+1
These fixes do not affect the semantics of the code. They either help gcc by providing default values that won't be used ("may be uninitialised"), remove unused variables, or change signed to unsigned variables to avoid comparison warnings. Addresses: bts.cpp:494:32: warning: 'tbf' may be used uninitialized in this function emu/test_replay_gprs_attach.cpp:81:27: warning: comparison between signed and unsigned integer expressions emu/test_pdp_activation.cpp:95:23: warning: unused variable ‘budh’ emu/test_pdp_activation.cpp:97:6: warning: variable ‘rc’ set but not used emu/pcu_emu.cpp:109:26: warning: unused variable ‘bts’ alloc/AllocTest.cpp:74:27: warning: unused variable ‘tbf’ osmocom/core/utils.h:13:50: warning: comparison between signed and unsigned integer expressions types/TypesTest.cpp:319:7: warning: unused variable ‘count’ types/TypesTest.cpp:320:11: warning: unused variable ‘rbb’ alloc/AllocTest.cpp:74:27: warning: unused variable ‘tbf’ alloc/AllocTest.cpp:132:11: warning: unused variable ‘ts_no’
2015-05-04vty: Fix value range of commands accepting csecsJacob Erlbeck1-3/+3
Currently an uint8_t csec variable is used to temporarily store the number of centiseconds which can be set within the range 1 - 65535. This way values above 255 cannot be set properly. This affects the VTY commands "queue lifetime", "queue hysteres", and "queue idle-ack-delay". This commit replaces the uint8_t by an uint16_t. Sponsored-by: On-Waves ehf
2015-05-04vty: Fix warnings about undeclared functionsJacob Erlbeck3-3/+4
This commit adds missing includes to pcu_vty.c and fixes the llist_head type (missing struct keyword) used by tbf_print_vty_info. Sponsored-by: On-Waves ehf
2015-04-30tbf: Remove double assigment to m_last_dl_drained_fnJacob Erlbeck1-1/+0
Currently the value -1 is assigned twice to m_last_dl_drained_fn within append_data(). This commit removes the first of these assigments. Sponsored-by: On-Waves ehf
2015-04-09pcu: Call bssgp_set_log_ss(DBSSGP) in main()Jacob Erlbeck1-0/+1
Currently the BSSGP functions in libosmocore do not log correctly to DBSSGP since the DBSSGP variable in common_vty.c is left uninitialized. This commit adds the call to bssgp_set_log_ss() to inform libosmocore which sub system id it shall use for BSSGP. Sponsored-by: On-Waves ehf
2015-04-09tbf: Send BSSGP LLC discarded on TBI exhaustionJacob Erlbeck1-17/+14
Currently the PCU silently discard LLC frames from the SGSN if a DL TBF cannot be allocated. This commit changes tbf_new_dl_assignment and reuse_tbf to send an LLC discarded message to the SGSN in this case. Ticket: #607 Sponsored-by: On-Waves ehf
2015-04-09vty: Use libosmocore VTY standardsJacob Erlbeck2-39/+2
This commit applies to following changes to pcu_vty.c: - Use vty_install_default() instead of install_default() - Add a blank after the '#' of the prompt - Rename the 'pcu' configuration node to 'config-pcu' Sponsored-by: On-Waves ehf
2015-04-02tbf: Force ACK after the last DL LCC frame has been receivedJacob Erlbeck5-1/+75
If the protocol layers above LLC (e.g. TCP) need an acknowledgement to continue, it can take up to 400ms (single TS) until the MS is polled for Ack/Nack which it can use to request an uplink TBF quickly. The 400ms result from requesting an DL Ack/Nack every 20 RLC blocks until all pending LLC frames have been sent. Especially TCP's slow start mechanism can lead to a high delay at the start of the connection, since the sender will eventually stop after having sent the first packets (up to 4 (RFC2581) or 10 (RFC6928)). This commit modifies append_data() to (re-)start a timer every time it handles an LLC packet and to request an Ack/Nack every time it expires. So if the server ceases to send IP packets, the MS is polled in the assumption, that the server is waiting for an ACK. The following VTY commands are added (pcu node): - queue idle-ack-delay <1-65535> timeout in centiseconds - no queue idle-ack-delay disable this feature (default) A sensible value is 10 (100ms) that at gave promising results when testing locally. Sponsored-by: On-Waves ehf
2015-04-02tbf: Use a hysteresis when discarding DL LLC framesJacob Erlbeck6-11/+95
Currently single LLC blocks are discarded when the PDU lifetime expires. If an IP packet has been fragmented either on the IP or on the LLC layer and is therefore distributed over several LLC frames, the kept fragments are transmitted and then discarded by the MS because of the missing PDU. This can cause massive IP packet loss when there are many fragmented packets (e.g. when trying 'ping -s1800' or if the GGSN chops downlink IP packets into several SNDCP packets). On the other hand, discarding too many packets might disturb the congestion handling of TCP. Dropping plain TCP ACKs might also hinder flow control and congestion avoidance. This commit adds a hysteresis algorithm to the LLC discard loop. If an LLC message's age reaches the high water mark, further message's with an age above the low water mark are discarded, too. This is aborted, if a GMM, a non-UI, or a small message is detected. In these cases, that message is kept. The following VTY commands are added (pcu config node): - queue hysteresis <1-65535> set the difference between high (lifetime) and low watermark in centiseconds - no queue hysteresis disable this feature (default) Since the SGSN will most probably send all fragments of a single N-PDU without much delay between them, a value slightly above the average transmission delay jitter between SGSN and PCU is probably a sensible value to discard all fragments of a single IP packet. This is an experimental feature that might be replaced by more advanced means of active queue management in the future. Sponsored-by: On-Waves ehf
2015-03-29pcu: Add pcu_utils.h to Makefile.amJacob Erlbeck1-1/+2
Addresses: src/gprs_rlcmac_sched.cpp:26:23: error: pcu_utils.h: No such file or directory Sponsored-by: On-Waves ehf
2015-03-25tbf: Poll MS on idle DL TBFsJacob Erlbeck3-7/+39
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-25tbf: Only create dummy frames if necessaryJacob Erlbeck1-1/+9
Currently a lot of LLC dummy commands will be generated while waiting for an ACK for the DL TBF, even if there are blocks that could be resent instead. This patch modifies create_dl_acked_block to only call create_new_bsn() if there is unsent LLC data or m_window is empty. If the TBF is in state FLOW, no unsent LLC data is left, but there are blocks left in m_window, those are resent instead. Sponsored-by: On-Waves ehf
2015-03-25tbf: Implement delayed release of a downlink TBFJacob Erlbeck6-5/+97
Currently a DL TBF is immediately closed, when the LLC queue is drained. This will lead to a new DL assignment if data is received afterwards. In addition, it is not possible to keep the PACCH open to poll the MS for UL establishment requests there. GSM 44.060, 9.3.1a suggests to delay the release of an inactive TBF for some time (max 5s). This commit mainly changes create_new_bsn() to send LLC dummy commands as filler if no LLC data is available until keep_open() returns false. The keep_open() functions returns true unless a configurable time has passed after the LLC data store drained. By default, that time is not set which causes keep_open() to always return false, so that delayed release is effectively disabled. The following VTY commands are added: - dl-tbf-idle-time <1-5000> to set the delay in ms - no dl-tbf-idle-time to disable delayed release Ticket: #556 Sponsored-by: On-Waves ehf
2015-03-25tbf: Insert LLC dummy command if no frame is availableJacob Erlbeck1-0/+16
If a BSN is going to be created but there is no frame stored in m_llc, an empty LLC message would be created. This shouldn't happen currently, but this will be a common case, when delayed TBF release is implemented. This commit changes create_new_bsn() to create an LLC dummy command in that case and to put it into the frame buffer. Sponsored-by: On-Waves ehf
2015-03-25tbf: Use put_frame in append_data if the TBF has no dataJacob Erlbeck1-0/+4
Currently if append_data() is used when there is no LLC data in the DL TBF, it will either call reuse_tbf() which in turn will call put_frame(), or it will append the LLC message to the queue, even if the queue and the frame buffer are empty. This only happens with the test case so far, but this would change when idle DL TBFs are kept open for some time. It results in empty LLC message being sent to the MS (see log below). This commit changes append_data to check for this case and to eventually use put_frame() instead of appending the LLC data to the queue. Addresses: TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==0) - Sending new block at BSN 0 -- Chunk with length 0 is less than remaining space (20): add length header to to delimit LLC frame Complete DL frame for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW)len=0 - Dequeue next LLC for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) (len=200) Sponsored-by: On-Waves ehf
2015-03-25tbf: Add frames_since_last_poll methodJacob Erlbeck3-0/+25
This functions calculates the number of frames that have passed since the last DL poll (RRBP flag set) has been sent. It returns a value less than zero (fn_now - fn_sched) if the block has been scheduled but not yet sent. If the function is called before the first data block has been sent it will return -1. If the function is called before the first DL poll is sent, it returns the number of frames since the first data block has been sent. Sponsored-by: On-Waves ehf
2015-03-25tbf: Add helper functions for DL TBFsJacob Erlbeck2-5/+25
Some properties of a DL TBF are explicitly calculated within modules using DL TBFs. This commit introduces the methods need_control_ts(), have_data(), is_control_ts() to hide internals of the DL TBF implementation. Sponsored-by: On-Waves ehf
2015-03-20tbf: Refactor create_dl_acked_blockJacob Erlbeck1-42/+42
Turn the big nested if statement into a sequence of smaller ones. The call to create_new_bsn is moved upwards. Sponsored-by: On-Waves ehf
2015-03-20llc: Add put_dummy_frame to create an LLC dummy commandJacob Erlbeck2-0/+21
The LLC dummy command is needed for RLC block stuffing, e.g. when a TBF should be kept open if no LLC data is available. The RLC block headers do not support stuffing, only the last block of a TBF can be used partially. LLC dummy commands are discarded by the receiver immediately, because the have an invalid FCS checksum. This commit adds the function put_dummy_frame, which puts a LLC dummy command into the frame buffer. The requested length is given as an argument, but the real length might be adjusted according to the specification (see GSM 44.064, 6.4.2.2). 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
2015-03-12tbf: Fix scheduling for DL Ack/Nack requestJacob Erlbeck2-13/+22
Currently the DL Ack/Nack is not requested, if the last chunk of the final LLC frame in the TBF fits exactly into the remaining space of the RLC block. It is also not requested, if the RRBP flag cannot be set due to scheduling issues (single block allocation, polling already pending for this TBF, ...). So up to POLL_ACK_AFTER_FRAMES (20) RLC data blocks will have to be resent, before requesting the Ack/Nack will be retried. This commit removes the first_fin_ack parameter of create_dl_acked_block entirely and adds a request_dl_ack() method that should be called, when the TBF's state changes to FINISHED. This request will be reset, when the block has been scheduled successfully. Since the first_fin_ack hasn't been set if chunk == space, calling request_dl_ack() on both places in create_new_bsn() when the state is changed to FINISHED will also fix the first issue described above. Note that DL scheduling might not be fair concerning access to first_ts when multiple TS are used for a TBF. In theory, a TBF might never get access to first_ts in the worst case. 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
2015-03-06tbf: Reduce m_new_tbf logging messagesJacob Erlbeck1-13/+22
Currently tbf->m_new_tbf may point to itself if no new TBF is assigned. But this leads to additional logging messages, since the code in set_new_tbf and tbf_free assumes, that a real new TBF is assigned and generates log messages accordingly. This commit adds checks to avoid those messages in the above case. Sponsored-by: On-Waves ehf
2015-03-06tbf: Add name() method and put the buf into the tbfJacob Erlbeck2-8/+18
Currently tbf_name() must not be used twice in a printf statement with different TBFs, since the same baffer will be used for each. This commit puts the text buffer into struct gprs_rlcmac_tbf to avoid this problem. Sponsored-by: On-Waves ehf
2015-02-26pcu: Fix log messageJacob Erlbeck1-1/+1
This commit adds a missing LF to a log message. Sponsored-by: On-Waves ehf