Commit Graph

2146 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 344ff48756 bts: Remove the global state gprs_rlcmac_trigger_downlink_assignment
Remove the global state from gprs_rlcmac_trigger_downlink_assignment
and walk up to the pcu_l1_if.cpp where I find the timeout handling
that should be part of the SBA and TBF functionality. In terms of
hierachies things start to be more clear.

There should be the BTS object. That holds the SBA and TBF Controllers
that can allocate TBFs and SBAs and will handle the timeout polling
for a BTS.
2013-10-30 21:20:44 +01:00
Holger Hans Peter Freyther 173a240a7e bts: Remove global state and the usage of the gprs_rlcmac_bts
Global state makes mocking/writing tests more difficult. Continue
by removing direct usage of the bts and adding it as pointer to
the function calls (showing the true dependencies of the functions)
2013-10-30 21:20:44 +01:00
Holger Hans Peter Freyther 45396a99d9 sched: Make sched_poll static and add a warning about fairness 2013-10-30 21:20:44 +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 948a3d62b1 alloc: Move usf into the scope it is actually used 2013-10-30 14:45:57 +01:00
Holger Hans Peter Freyther b0a0075845 alloc: Factor out the routine to find an enabled PDCH 2013-10-30 14:45:57 +01:00
Holger Hans Peter Freyther 11a748935e alloc: Remove the unimplemented/unfinished time constraint code
The algorithm is already complex enough. No reason to further
introduce the complexity with the branches it has.
2013-10-30 14:45:57 +01:00
Holger Hans Peter Freyther 8481a0553d alloc: Remove code duplication for downlink assignment
There was no difference but there is no point in poking in the
internals of the tbf, pdch and trx from various places. Information
hiding has a real purpose, e.g. compare with reading "the mythical
man month".
2013-10-30 14:45:57 +01:00
Holger Hans Peter Freyther 743bafa50c alloc: Introduce a backpointer from the tbf to the trx and simplify code
Kill all the level of indirections where one needs to have the BTS
the TBF to find the TRX.
2013-10-30 14:45:57 +01:00
Holger Hans Peter Freyther 96efa70a9e alloc: Call it trx_no and not trx as it is not trx object 2013-10-30 14:45:57 +01:00
Holger Hans Peter Freyther 02ab4a8803 alloc: Move the two timeslot alloc algorithms to a dedicated file 2013-10-30 14:45:57 +01:00
Holger Hans Peter Freyther 96173aec93 alloc: Move the "assignment" of the slot into a common function
Vladimir Rolbin pointed out that in case of the alloc_algorithm_a
the usf has not been assigned. For now move all the assignment into
a method and call it from the A and B algorithm.
2013-10-30 14:45:57 +01:00
Holger Hans Peter Freyther 1c344e2668 tbf: Prepare to make thing things private in the tbf, start with the state
There really shouldn't be too many callers of state. Instead the
tbf should dispatch depending on the internal state. For now
introduce state_is and state_is_not accessor functions so we can
start to see who is using the internal state.
2013-10-28 12:54:09 +04:00
Holger Hans Peter Freyther 7380babdba tbf: Move the tbf_timer_cb into the tbf class
Introduce the first instance method for printing out diagonistic
about itself and create a jump function for it.
2013-10-28 12:53:49 +04:00
Holger Hans Peter Freyther 0946f99b08 tbf: Remove dead code that called tbf_free 2013-10-28 12:53:29 +04:00
Holger Hans Peter Freyther 455613076a tbf: Move many routines related to the tbf from gprs_rlcmac to tbf.c 2013-10-28 12:52:59 +04:00
Holger Hans Peter Freyther 4f6a4e5d6d tbf: Add another variant of the free_all now by pdch 2013-10-28 12:52:33 +04:00
Holger Hans Peter Freyther 964ddb6aa0 tbf: Move the code to close all timeslots into the tbf class
Move the code out of the sysmocom_socket (as this is only required
to talk to our hardware) and into the TBF class that actually knows
what a TBF is.
2013-10-28 12:52:15 +04:00
Holger Hans Peter Freyther 9e21d84f1e tbf: Move header definition from gprs_rlcmac to the tbf 2013-10-28 12:52:00 +04:00
Holger Hans Peter Freyther 099535a1a7 tbf: Move the struct to the tbf.h header file
This is the begin of a long march of turning tbf into a C++ class
and properly hiding the secrets inside this implementation instead
of having it spread across various different files.
2013-10-28 12:51:38 +04:00
Holger Hans Peter Freyther 8692128365 tbf: Move the alloc_ul_tbf into tbf.c and change signature
Add the bts parameter to the method list. This would be a static
method of the class (in case the TBF would be a class)
2013-10-18 15:17:43 +04:00
Holger Hans Peter Freyther bb20b2c64c tbf: Add more to do items for refactoring on the dl assignment 2013-10-18 15:17:27 +04:00
Holger Hans Peter Freyther bcafdf8d90 tbf: Warn about copy and paste between different tbf alloc routines
These need to be re-factored to use a common allocation routine.
2013-10-18 15:17:13 +04:00
Holger Hans Peter Freyther 443c822f77 tbf: Move the creation of a new tbf for the downlink to a new method
Move the code that is dedicated to handle the assignment of a new
TFI/TBF for the downlink into a new method.
2013-10-18 15:16:56 +04:00
Holger Hans Peter Freyther d868928888 tbf: Create an assign method for IMSI.
This will allow us to set flags (like IMSI) present and will
be of help when fixing the tbf lookup.
2013-10-18 15:16:42 +04:00
Holger Hans Peter Freyther d1d114f5b7 tbf: Move code that sets the tbf's ms_class to a central place 2013-10-18 15:16:27 +04:00
Holger Hans Peter Freyther 31d0df92ac tbf: Separate the easy path out of the receive path
* Create a look up routine for the TBF that will allow us to
  easily find a TBF by IMSI...
* Separate the code that works on an existing TBF.
2013-10-18 15:16:11 +04:00
Holger Hans Peter Freyther 17c31ce173 tbf: Begin to add some structure to the tbf code
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-18 15:15:49 +04:00
Holger Hans Peter Freyther dcc9c39529 sba: Fix memory leak when all PDCHs are disabled 2013-10-17 11:36:11 +02:00
Holger Hans Peter Freyther 70862c9409 misc: Print the payload that is not known
Print the payload type that is not handled as this allows one to
look it up in the specification.
2013-10-16 16:37:22 +02:00
Holger Hans Peter Freyther 26da8361e9 rlc: Add missing break after GPRS_RLCMAC_CONTROL_BLOCK_OPT
Do not claim that the payload is not known. Add the missing break.

Do not print:
<0002> gprs_rlcmac.cpp:1174 GPRS_RLCMAC_CONTROL_BLOCK_OPT block payload is not supported.
<0002> gprs_rlcmac.cpp:1176 Unknown RLCMAC block payload.
2013-10-16 16:36:11 +02:00
Holger Hans Peter Freyther 483f77a275 misc: Fix some typos sed -i s,ressources,resources,g 2013-10-16 16:33:00 +02:00
Holger Hans Peter Freyther 985806030d misc: Fix format and typos in the code 2013-10-16 16:28:16 +02:00
Holger Hans Peter Freyther 52c911b3b4 tbf: constify the IMSI argument for the downlink assignment 2013-10-02 18:09:10 +04:00
Holger Hans Peter Freyther 2023bd18b6 tbf: Make multislot lookup tables static/const 2013-10-02 18:08:51 +04:00
Holger Hans Peter Freyther d6bd91e4e5 tfi: The tfi_alloc doesn't allocate anything, rename the function
Call things by what they do and this function doesn't allocate
anything but it is searching for the first unallocated tbf index.
2013-10-02 18:08:31 +04: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.

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 416ce69550 bssgp: Add callback UNITDATA.DL messaes with the data 2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther c0f1644c88 bssgp: Add callbacks for certain BSSGP events
Add a callback called when Unblock Ack is received. This can be
used by a supervisor or the emulation test.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther e8d9a5fa54 bssgp: Return the gprs_bssgp_pcu instance from create/connect
This can be used to install handlers/testcases to register
callbacks and other data.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther b67a8a348a rlcmac: Reduce the depedency on the global gprs_rlcmac_bts variable
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-04 21:28:53 +04:00
Holger Hans Peter Freyther 90d5df4ae7 bssgp: These routines are not public API.. make them static for now 2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther a9744debd9 bssgp: Re-indent the switch/case statement 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
Holger Hans Peter Freyther 421fe79e39 bssgp: The method creates and the connects.. reflect that in the name
Call things by what they do. This method is creating and then connecting
2013-08-02 13:39:30 +04:00