Age | Commit message (Collapse) | Author | Files | Lines |
|
We should really be using monotonic clock in all places that
gettimeofday is used right now. Since clock_gettime() uses timespec,
let's move all code to use timespecs instead to avoid having to convert
in several places between timespec and timeval.
Actually use osmo_clock_gettime() shim everywhere to be able to control
the time everywhere from unit tests.
Change-Id: Ie265d70f8ffa7dbf7efbef6030505d9fcb5dc338
|
|
As seen in OS#4420, setting the MetaInfo.recv_time outside of
llc_queue before calling llc_queue::enqueue() and later on using that
value in llc_queue itself at dequeue time is not a good idea, since it
can provoke errors if the recv_time was not set correctly.
For instance, LlcTest was not setting the value for recv_time on some
test, which ended up with a huge millisec value when substracting now()
from it:
"""
llc.cpp:215:29: runtime error: signed integer overflow: 1582738663 * 1000 cannot be represented in type 'long int'
"""
This issue only appeared when started building on a raspberrypi4.
Let's better set/store the MetaInfo.recv_time internally during
llc_queue::enqueue(). Then, enqueue() only needs the
MetaInfo.expire_time, so let's change its arg list to only receive that
to avoid confusions.
Take the chance to move the llc_queue APIs to use osmo_gettimeofday,
since we need to fake the time now that the API itself sets that time.
Also take the chance during this refactor to disallow passing null
pointer by default since no user needs that.
Finally, update the LlcTest accordingly with all API/behavior changes.
Related: OS#4420
Change-Id: Ief6b1464dc779ff22adc2b02da7a006cd772ebce
|
|
Change-Id: I59da04edd1b8ff965bbfbe00ccae1f7c9b6e5301
|
|
This methods takes all LLC frames from the old LLC queue and moves
them into the current. If both queues are ordered chronologically
(recv_time), the resulting queue is also ordered.
Sponsored-by: On-Waves ehf
|
|
Fixes: Jenkins build #609 warning
Addresses:
llc.cpp:56, GNU C Compiler 3 (gcc), Priority: Normal
comparison between signed and unsigned integer expressions
Sponsored-by: On-Waves ehf
|
|
Currently the receive and expiry timestamps are prepended to the LLC
msgb before it is passed to gprs_llc_queue::enqueue(). Since this meta
information should not be counted as LLC octets, the gprs_llc_queue
needs to known about this (unless the correction was done in the LLC
layer).
This commit moves the meta information storage code into
gprs_llc_queue. The meta data is now stored in the control block
(cb) area of the msgb.
Note that the info pointer that is returned from the dequeue method
is only valid if that method returns a (non-NULL) msgb. It must not
be used after that msgb has been modified or freed.
Sponsored-by: On-Waves ehf
|
|
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
|
|
To get the number of LLC octets that are stored in the queue, this
commit adds a m_queue_octets member along with a octets() method.
This value is updated similarly to m_queue_size on each modifying
method call.
Sponsored-by: On-Waves ehf
|
|
Currently the wrong nibble is masked out, so the conditional
expression always yields true.
Therefore gprs_llc::is_user_data_frame() always returns true. As a
consequence, the low watermark feature of
gprs_rlcmac_dl_tbf::llc_dequeue() is not being used in fact.
This commit fixes the mask value.
Fixes: Coverity CID 1292834, 1292835
Sponsored-by: On-Waves ehf
|
|
Currently the gprs_llc class handles both LLC queueing and the
partition into smaller pieces for RLC/MAC encapsulation. This hinders
the separation of TBF and MS related data, since LLC queueing belongs
to the MS related code while the RLC/MAC encoding/decoding belongs to
the TBF layer.
This commits takes the LLC queueing related methods and members and
puts them into a new class gprs_llc_queue. It puts the queueing
object into gprs_rlcmac_tbf and adds accessor functions. The
implementation in tbf.cpp and tbf_dl.cpp is adapted accordingly.
Ticket: #1674
Sponsored-by: On-Waves ehf
|
|
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
|
|
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
|
|
Use a formula like it is used with TCP. This can help to make
decisions about if frames should be dropped or not at the time
we enqueue them.
This code will store two timeval structs in fron the of the
actual data and compute the average at the time of the dequeue.
|
|
|
|
|
|
|
|
* Make append_data, remaining_space and fits_in_current.. work
on m_length and not the index. This ways things can't overflow.
* The current API consumer was moving the m_index so it should have
worked okay.
|
|
This way the generation of the expiry information and the check
is at the same place. This should make reading the code more easy.
|
|
At some point in the future we can start using the private/protected
keywords in this struct.
|
|
Introduce a method to append data to a TBF and then reset the
read pointer when the frame has been sent.
|
|
This does not mean that they have been successfully transferred
to the SGSN/MS but at least that they have reached a certain point
in the message flow.
|
|
|
|
|
|
|
|
|
|
Add some todo items where we could add assertions now that I see
the constraints and invariants of this code.
|
|
|