Commit Graph

540 Commits

Author SHA1 Message Date
Daniel Willmann 7e994e392d tbf, ...: Make the fields in the dl/ul struct member variables
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-07 16:12:05 +02:00
Daniel Willmann 351a573396 tests/alloc: Use the specific UL/DL TBF classes instead of the base
Ticket: SYS#389
Sponsored by: On-Waves ehf
2014-08-07 16:12:04 +02:00
Daniel Willmann 48aa0b0d99 bts, tbf: Split alloc_tbf function into separate UL and DL versions
UL and DL tbfs are used in very separate parts and are not the same
thing so split the alloc function and use the UL/DL version throughout
the code.

Ticket: SYS#389
Sponsored-by: On-Waves ehf
2014-07-22 12:36:31 +02:00
Daniel Willmann b59d61b4b4 bts, tbf: Separate functions for dl/ul tbf_by_tlli lookup
In the future we want to separate ul and dl tbf into different
classes that inherit from a common base.

Ticket: SYS#389
Sponsored-by: On-Waves ehf
2014-07-03 15:36:46 +02:00
Daniel Willmann d54d9f5c75 rlc: Use an enum for the state array instead of chars
gprs_rlc_bsn_state is now used to hold the ACK state of sent/received
rlc packets.
2014-01-15 15:23:35 +01:00
Daniel Willmann 146514e180 rlc/tbf: Move v_b into DL window
Move functions resend_needed(), mark_for_resend(), update(),
move_window(), state(), count_unacked() out of v_b directly into the UL
window and provide a function get_state in v_b to access the v_b
elements.
2014-01-15 15:23:21 +01:00
Daniel Willmann 55844795be rlc/tbf: Add function receive_bsn that updates v_r, v_q, v_n
We don't need to expose the mecanics of updating the variables to the
outside.
2014-01-15 15:23:21 +01:00
Daniel Willmann 7c3751b10b rlc/tbf: Move v_n into gprs_rlc_ul_window and adapt the tests
v_n is part of the UL window handling so move it inside the ul_window
2014-01-15 15:23:21 +01:00
Holger Hans Peter Freyther c2fab7a6ff alloc: Update the test result now that everything is back to working again 2014-01-15 14:42:58 +01:00
Holger Hans Peter Freyther 2bf3446f7a misc: Allow to cross-execute the tests using qemu
When cross-compiling osmo-bts/osmo-pcu one can not easily
execute the testsuite. By adding the OSMO_QEMU variable in
front of the normal execution we can execute the tests. This
should work for native and cross builds.

$ OSMO_QEMU="qemu-arm -L /opt/poky/1.1.2/sysroots/armv5te-poky-linux-gnueabi/" make check
2014-01-15 11:14:52 +01:00
Holger Hans Peter Freyther f3eec04655 alloc/test: Add a crazy test that tests each possible combination
Make a crazy test that will test each possible PDCH configuration
and MS Class and verify that the UL/DL assignments work and that
they are on the same first_common_ts.
2014-01-15 10:39:08 +01:00
Holger Hans Peter Freyther c7b998cc73 alloc/test: Go through all possible ms_classes for the allocation
Generate results for all possible classes.
2014-01-15 10:39:08 +01:00
Holger Hans Peter Freyther 4af30533f0 alloc/tests: Create an allocation test for various scenarious
The allocation in the TBF/BTS code is quite complex. In parts this
is due the assignment and requests occuring under differen circumstances.
Attempt to re-create the commono scenarios.

Remove the bogus msclass check in gprs_rlcmac_tbf::update as the
allocation code will check the ms class anyway.
2014-01-15 10:39:07 +01:00
Holger Hans Peter Freyther b3a87ced5a test: Remove the side-effect from the assertion
Coverity complains about this code as it doesn't know that the
OSMO_ASSERT is always on. But it is good practice to now have the
side-effect in here.

Fixes: Coverity CID 1080724
2013-12-12 14:42:35 +01:00
Daniel Willmann 48df40d2a4 tests/TypesTest: Check rbb handling in DL 2013-12-12 11:06:40 +01:00
Daniel Willmann f1786a375f tests/TypesTest: Ensure that extract_rbb(encode_rbb(x)) == x 2013-12-12 11:05:43 +01:00
Daniel Willmann 0f2b5fc749 tests/TypesTest: Print the result of Encoding::encode_rbb() 2013-12-12 11:03:35 +01:00
Daniel Willmann c3f4330fa3 tests/TypesTest: Add OSMO_ASSERT_STR_EQ which prints out the parameters
Use it to compare rbb
2013-12-12 11:01:32 +01:00
Daniel Willmann f86fb7a953 tests/TypesTest: Test ssn() and update_rbb() uplink window methods in TypesTest
Test that ssn and rbb are updated correctly.
2013-12-12 11:01:13 +01:00
Holger Hans Peter Freyther 11f2d58dbd rlc: Create a testcase for the uplink window 2013-12-04 21:05:18 +01:00
Holger Hans Peter Freyther faf3ef45b3 rlc: Add a basic test for the DL Window and moving the window 2013-11-26 21:00:51 +01:00
Holger Hans Peter Freyther e9b1ebba9d rlc: Test the basic of the gprs_rlc_v_n code for remembering the state 2013-11-26 21:00:51 +01:00
Holger Hans Peter Freyther 9525567d77 rlc: Create a basic test that mark/is is talking about the same 2013-11-23 16:19:17 +01:00
Holger Hans Peter Freyther c6382ddd6e rlc: Add a simple test for the RLC data structure for the init 2013-11-21 21:42:20 +01:00
Holger Hans Peter Freyther 6058220d2a types: Add a simple testcase for basic types and fix the LLC code
* 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.
2013-11-21 21:30:23 +01:00
Holger Hans Peter Freyther bc1626e5de tbf: Update the timing advance for the new tlli based on the old one 2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther b809866be5 tbf: Learn and propagate the TLLI changes due a new P-TMSI
During a routing area update a new P-TMSI was assigned. During
the PACKET CONTROL ACK on the DL we notice the change of TLLI
but didn't propagate this. This means that a Routing Area Update
Complete was only sent after a new RACH request.

Addresses:
<0007> gprs_rlcmac_meas.cpp:103 UL RSSI of TLLI=0x88661bc6: -67 dBm
<0002> bts.cpp:945 Got ACK, but UL TBF is gone TLLI=0xe512eba3
<0007> gprs_rlcmac_meas.cpp:158 DL packet loss of IMSI=274080000004765 / TLLI=0xe512eba3: 0%
<0002> tbf.cpp:668 TBF TFI=0 TLLI=0x88661bc6 T3169 timeout during transsmission
<0002> tbf.cpp:690 - Assignment was on PACCH
<0002> tbf.cpp:694 - No uplink data received yet
2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther 70ddde6929 tbf/bts: Move the tfi_find_free into the bts 2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther 34bd8bdf30 bts/tbf: Move the lists into the BTS and do the look-up from the BTS
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-30 21:24:10 +01:00
Holger Hans Peter Freyther 17b0d83a1f pdch: Move enable/disable into the PDCH code
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-30 21:24:09 +01:00
Holger Hans Peter Freyther b6acfdaa24 bts: Introduce a singleton for the BTS and use it in the code
Compared to the previous code there will be a branch to get the
global pointer so the code will be slightly slower than the previous
version but it allows us to start creating objects but still use
the code from C. It is best approach I have found so far.

One downside of C++ is that by default talloc will not be used
(unless we override the new operator to use talloc. Right now
we need to memset the C data structure by hand. The benefit of
enforcing a better structure should is more important though.
2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther 67ed34eedb bts: Move struct gprs_rlcmac_bts and other structs into a bts.h
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-30 21:20:45 +01:00
Holger Hans Peter Freyther bfdd5f285b alloc: Add very basic test case for the alloc_a algorithm 2013-10-30 21:20:44 +01:00
Holger Hans Peter Freyther 9d938388f6 emu: Add a crash re-producer for the SGSN (and the concept of tests)
Introduce the concept of tests that will be ran one after the other.
This new test will send static message that will lead to the opening
of a PDP context. At this point one should use ping with a large
packet size and suspend/stop the emulator. Once the NS connection is
considered dead the SGSN will crash with a double free.

Reproduce:
0.) Add IMSI 901700000003094 to the ACL
1.) Stop/Suspend the emulation process so the NS Alive times out
2.) Use ping IP -s 2048

This will create a double free...

 #4  0xb7bb2646 in talloc_abort_double_free () at talloc.c:175
 #5  0xb7bbd41a in talloc_chunk_from_ptr (ptr=0x8091208) at talloc.c:190
 #6  _talloc_free (ptr=0x8091208) at talloc.c:517
 #7  talloc_free (ptr=ptr@entry=0x8091208) at talloc.c:990
 #8  0xb7bb319b in msgb_free (m=m@entry=0x8091208) at msgb.c:72
 #9  0x0804db54 in sndcp_send_ud_frag (fs=0xbfffcc6c) at gprs_sndcp.c:423
 #10 sndcp_unitdata_req (msg=msg@entry=0x808eed8, lle=0x808fbc8, nsapi=5 '\005',
    mmcontext=mmcontext@entry=0x80903e8) at gprs_sndcp.c:471
2013-09-04 21:29:00 +04:00
Holger Hans Peter Freyther bc1e52cfbf emu: Use OpenBSC code to decode the LLC and add assertions
Use the OpenBSC SGSN code to parse the LLC data and look into
the data we receive. Add assertions to verify the the sequence
number is increasing.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther 741481d3e0 emu: Send a static GPRS ATTACH request and wait for the reply.
This will send a static message. It will trigger the GMM code
on the SGSN and might ask us for the IMEI/IMSI or send us an
accept. As we are not replying at all the SGSN needs to send new
requests and we can observe if the sequence number is increasing
like it should.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther 4ea940787e emu: Create an app that allows to communicate with a SGSN
This code can open a BSSGP connection toward a SGSN and will
inititate the unblocking. It does not send any user data.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther dfe17d7f91 tests: Fix the expected result (re-add whitespace)
As a last minute change I probably ran git rebase --whitespace=fix
on the patch set and broke the test result. Update the expected
file and tests should pass.
2013-08-03 14:59:38 +02:00
Holger Hans Peter Freyther e13298d093 tests: Move the RLCMACTest into the test directory and setup autotest 2013-08-02 13:40:20 +04:00
Holger Hans Peter Freyther bb00704871 tests: Create tests directory and move the VTY testing into there 2013-08-02 13:39:55 +04:00