Commit Graph

307 Commits

Author SHA1 Message Date
Jacob Erlbeck e2e004e7a9 tbf: Pass the MS object around instead of old_tbf
Currently the old TBF (either uplink or downlink) is passed around at
TBF allocation mainly to get information about the MS. To implement
more complex allocation algorithms, the MS object itself will be
needed anyway.

This commit replaces the old_tbf arguments by MS object arguments.

Sponsored-by: On-Waves ehf
2015-06-29 10:53:32 +02:00
Jacob Erlbeck ace7b570a0 tbf: Remove update_tlli method
This method does not do anything anymore, it's functionality has been
taken over by update_ms.

This commit removes gprs_rlcmac_tbf::update_tlli completely.

Sponsored-by: On-Waves ehf
2015-06-29 10:53:32 +02:00
Jacob Erlbeck da1a79ef5b l1: Add debug log messages for I_LEVEL
The I_LEVEL values that are obtained now look suspicious. They do not
seem to be contained in messages recorded via gsmtab.

To help debugging this issue, this commit adds related debug messages
that are generated while the encoded values are taken from the
RLC/MAC messages.

Sponsored-by: On-Waves ehf
2015-06-22 10:39:06 +02:00
Jacob Erlbeck 51b1151044 l1: Store measurement values sent by the MS
This commit extends the pcu_l1_meas structure by MS side measurement
values which are transmitted by PACKET DOWNLINK ACK/NACK and
PACKET RESOURCE REQUEST messages. The encoded values are remapped to
dB respectively % values. The values are stored in the corresponding
MS object (if there is one).

Note that the values are store as (rounded) integers, so some
different encodings are mapped to the same decoded value.

Sponsored-by: On-Waves ehf
2015-06-22 10:39:06 +02:00
Jacob Erlbeck 20f6fd1b63 l1: Pass all L1 measurements upwards
Currently only the RSSI value is passed to the upper layers. Other
values like TA and BER which are needed for TA update respectively CS
selection are not propagated.

This commit introduces and passes a struct that contains a set of
measurement values.

Sponsored-by: On-Waves ehf
2015-06-22 10:39:06 +02:00
Jacob Erlbeck 17214bb06d ms: Add back pointer to BTS
Since more functionality will be moved to the GprsMs class, a pointer
to the current BTS object is added to allow access to configuration
data and other methods.

Sponsored-by: On-Waves ehf
2015-06-08 09:39:07 +02:00
Jacob Erlbeck befc760f86 tbf: Store MS class in GprsMs objects
The ms_class value is a property of the MS and thus belongs to the
GprsMs class. Nevertheless the MS object is created after the TLLI
gets known, so the value still has to be stored in the TBF initially.

This commit add the ms_class value to the GprsMs class and introduces
TBF accessor functions which either access that object or, if that is
not available, the value stored locally.

Ticket: #1674
Sponsored-by: On-Waves ehf
2015-06-08 09:38:49 +02:00
Jacob Erlbeck 1db67e0a35 tbf: Remove TimingAdvance storage
Currently the TA storage stores up to 30 TLLI->TA mappings, if more
entries are created the oldest one is dropped. In theory this can
lead to missing TA information if many MS are present.

This commit removes the TimingAdvance class completely, since the TA
value is now stored in the GprsMs objects.

Note that the GprsMs objects are currently not kept after the TBFs
have detached from them, so the TA values are now kept for a shorter
time than before.

Ticket: #1674
Sponsored-by: On-Waves ehf
2015-05-28 13:59:25 +02:00
Jacob Erlbeck 9200ce6019 tbf: Store the timing advance (TA) value in the GprsMs object
The TA value rather relates to an MS and not to a single TBF. So all
TBFs share the same TA value. Currently the TA value is stored per
TBF and eventually copied from an old TBF to a new one. It is in
general only passed with an RACH request when the TLLI and thus the
MS is not yet known.

This commit adds a TA member to the GprsMs class and uses that one
when the TBF is associated to an MS object. Since the TBF is not
always associated with an MS object (after RACH or when it has been
replaced by another TBF), the TA value is still stored in each TBF
and that value is used as long as no MS object is being associated.

Sponsored-by: On-Waves ehf
2015-05-28 13:58:23 +02:00
Jacob Erlbeck ddfc0d5763 tbf/test: Add tests for single and two phase access
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-28 12:29:43 +02:00
Jacob Erlbeck d3eac2867a tbf: Remove TBF chaining (m_new_tbf and m_old_tbf)
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-28 12:29:43 +02:00
Jacob Erlbeck 71e55118f5 tbf: Remove IMSI handling from trigger_dl_ass
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-28 12:29:42 +02:00
Jacob Erlbeck 767193e20b tbf: Remove the TLLI from the TBFs
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-27 13:29:59 +02:00
Jacob Erlbeck be0cbc1b7e tbf: Explicitly pass the direction to update_ms()
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-21 17:11:14 +02:00
Jacob Erlbeck e43460b50f ms: Integrate the MS storage
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-20 11:36:12 +02:00
Jacob Erlbeck fecece0e59 tbf: Add MS object management to TBF code
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-20 11:31:07 +02:00
Jacob Erlbeck 1f33294b1c pcu: Fix non-critical warnings
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-04 10:01:25 +02:00
Jacob Erlbeck 297edf754f tbf: Don't use 'old' DL TBFs after reuse_tbf
Currently two DL TBF objects with the same TLLI exist after reuse_tbf
which make the result of tbf_by_tlli undefined. This leads to several
DL TBFs belonging to the same TLLI.

This commit extends tbf_by_tlli to check the m_tlli_valid flag for
DL, too. That flag is set to 0 in reuse_tbf to mark the 'old' DL TBF
as invalid after its LLC data has been copied to the new one.

Sponsored-by: On-Waves ehf
2015-02-26 16:22:34 +01:00
Daniel Willmann e481815583 tbf,bts: Keep track of new TBF for dl/ul assignment in m_new_tbf
There are a couple of possibilities where one TBF is used to assign a
new one:

1. Assign a DL TBF from a UL TBF
2. Assign a UL TBF from a DL TBF
3. Assign a DL TBF from a DL TBF which is in wait-release state (T3193 is
   running)

In these cases the assignment is sent on the existing TBF and triggers
the assignement of the new TBF (with different TFI/direction).

The current code detects these situations by looking at dl/ul_ass_state
and then chosing the TBF with the opposite direction (DL/UL) that has
the same TLLI. This does not work in the case 3 above where a new DL TBF
is triggered for a DL TBF. The current code reuses the old TBF (and
TFI), but this violates the spec.

This patch introduces a m_new_tbf member which is set to the new TBF to
be assigned. When receiving a control ack the code looks up the
n_new_tbf member of the tbf that requested the control ack and completes
the ul/dl assignment. If the old TBF was in the wait release state
(T3193 is running) it is released.

From 3GPP TS 04.60 9.3.2.6:
"""
If the network has received the PACKET DOWNLINK ACK/NACK message with
the Final Ack Indicator bit set to '1' and has new data to transmit for
the mobile station, the network may establish a new downlink TBF for the
mobile station by sending the PACKET DOWNLINK ASSIGNMENT or PACKET
TIMESLOT RECONFIGURE message with the Control Ack bit set to '1' on
PACCH. In case the network establishes a new downlink TBF for the mobile
station, the network shall stop timer T3193.
"""

reuse_tbf() is modified to allocate a new TBF with a new TFI and trigger
a dl assignment for that TBF on the old TBF. All pending data is moved
to the new TBF.

Ticket: SYS#382
Sponsored-by: On-Waves ehf
2014-09-10 19:04:46 +02:00
Daniel Willmann eb100244b0 tbf, bts: Use tbf set_state method instead of tbf_new_state function
All the function did was add debug output and call the set_state method.
Move the debugging into the method and remove the function.

Ticket: SYS#389
Sponsored by: On-Waves ehf
2014-08-08 14:15:24 +02:00
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 532a4b54f5 bts: Change parameter in BTS::trigger_dl_ass() to DL TBF
This method is always called with a DL TBF as argument so make it clear.

Ticket: SYS#389
Sponsored by: On-Waves ehf
2014-08-07 16:12:04 +02:00
Daniel Willmann 1dac2ebb71 bts: Make use of DL TBF explicit in rcv_imm_ass_cnf()
Ticket: SYS#389
Sponsored by: On-Waves ehf
2014-08-07 16:12:04 +02:00
Daniel Willmann 6c813fc9bc bts, tbf: Make rcvd_dl_ack a method of the DL TBF
This method is only userul for DL TBFs so move it. As a result
gprs_rlcmac_pdch::rcv_control_ack needs to work with dl_tbfs.

Ticket: SYS#389
Sponsored-by: On-Waves ehf
2014-08-07 13:03:10 +02:00
Daniel Willmann 057c285cd7 bts: Remove the OSMO_ASSERTs for TBF direction
llist_add is called on the TBF lists in tbf_alloc_ul/dl_tbf or in
rotate_in_list. All three places check the direction/add the new TBF to
the correct list so an ASSERT on entry is not needed.

Ticket: SYS#389
Sponsored-by: On-Waves ehf
2014-08-07 13:03:09 +02:00
Daniel Willmann 1b3864fc47 tbf: Use plain old data structure (PODS) for llist management
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-07-30 18:27:30 +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 0d12a2fa89 bts, tbf: Change the TBF return type of functions to the ul/dl version
Many functions only ever deal with or return a UL or a DL TBF.
Explicitly change the type to reflect which TBF is used where.

Ticket: SYS#389
Sponsored-by: On-Waves ehf
2014-07-22 12:36:13 +02:00
Daniel Willmann fe6e2e4a08 bts: Return the special type for {ul,dl}_tbf_by_* functions
Start returning the special type instead of the base gprs_rlcmac_tbf
when retrieving a TBF.

Ticket: SYS#389
Sponsored-by: On-Waves ehf
2014-07-16 22:10:17 +02:00
Daniel Willmann 2207c5e4ef bts: Ensure tbf direction with OSMO_ASSERT()
In the lookup functions make sure that we are actually returning tbfs
with the expected direction.

Ticket: SYS#389
Sponsored-by: On-Waves ehf
2014-07-16 19:03:36 +02:00
Daniel Willmann febf1a0ac9 bts: Split tbf_by_poll_fn into separate dl and ul functions
rcv_control_dl_ack_nack is only meaningful for dl tbf while
rcv_control_ack can be sent in response to a dl or ul tbf. So
rcv_control_ack still needs to check for ul and dl tbfs.

Ticket: SYS#389
Sponsored-by: On-Waves ehf
2014-07-03 15:36:52 +02:00
Daniel Willmann 54044b0635 bts: Separate functions for dl/ul tbf_by_tfi lookup
Ticket: SYS#389
Sponsored-by: On-Waves ehf
2014-07-03 15:36:52 +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 77e58f602d bts: Remove outdated comment
There is no parameter in the function and the bts has a memeber trx
which has a member pdch.

Sponsored-by: On-Waves ehf
2014-06-04 19:01:56 +02:00
Daniel Willmann 17a1d5e162 gprs_rlcmac_pdch: Get rid of ul/dl_tbf
The current code keeps a reference to all tbfs in the bts and another
reference in the pdch. This allows for the possibility of both lists to
go out of sync.

This patch removes the pdch-specific list of ul and dl tbfs and uses the
lists in the bts to lookup tbfs everywhere.

Performance for going through the global list is not an issue yet. We
can optimize this later and in a better way.

Sponsored-by: On-Waves ehf
2014-06-04 17:17:45 +02:00
Daniel Willmann 1e0c61032f gprs_rlcmac_pdch: Don't access private members
This patch introduces methods to get ul and dl tbf by tfi and uses them
in gprs_rlcmac_sched.

Sponsored by: On-Waves ehf
2014-06-04 17:14:22 +02:00
Daniel Willmann 73191a443f tbf/bts, encoding: Keep track of WAIT_RELEASE state for DL assignment
The current code does not properly distinguish between DL assignments to
reuse a tbf (after it was put in state WAIT_RELEASE) and DL assignments
for an active tbf to change the allocation of the PDCH timeslots.

This patch introduces a new variable was_releasing which remembers if
trigger_dl_ass() was called with a tbf in state WAIT_RELEASE. In that
case we have to set the CONTROL_ACK field in the download assignment.

This should allow us to send DL assignments to change PDCH TS allocation
of a tbf before we enter FLOW state.
2014-05-30 18:21:00 +02:00
Daniel Willmann fc03bbe078 tbf/bts: Rename tbf->snd_dl_ack to tbf->rcvd_dl_ack
This function is called to act upon a received DL ACK packet so this
name makes more sense.
2014-05-30 18:19:06 +02:00
Holger Hans Peter Freyther 3d0cc2f97d tbf: Make finding use-after-free more easy and set to NULL or return
Make finding use-after-free more easy by setting things to NULL
or simply return after tbf_free(this) has been called.
2014-01-16 10:09:42 +01:00
Holger Hans Peter Freyther f37e514a96 bts: Rename ts and trx to ts_no and trx_no as we operate on number 2014-01-15 10:34:22 +01:00
Holger Hans Peter Freyther 8f399de135 tbf: Kill the tsc member as it duplicates data
We can just use first_ts and the trx/pdch to extract this information.
Avoid duplication of data.
2014-01-15 10:34:09 +01:00
Holger Hans Peter Freyther 12c039cdb2 debug_diagram: Remove the special debug_diagram compilation mode
This approach is somehow flawed. We need/want to debug problems on
systems with real traffic and re-compiling it with debug_diagram
is not an option. All internal logging needs to be expressive enough
so we can understand what is going on (e.g. create a script to
post-process the output).
2013-11-26 20:57:24 +01:00
Holger Hans Peter Freyther ef93bdb19b tbf: Count how often we re-start a BSN in the send routine
There appears to be a scheduling issue. Even without any NACKs
we are re-transmitting a lot of frames. It might be because of
this.
2013-11-24 00:01:50 +01:00
Holger Hans Peter Freyther 092478f294 rlc: Count nacked frames in the statistics too 2013-11-23 01:01:19 +01:00
Holger Hans Peter Freyther c70aae4697 rlc: Count the window stalls on the RLC level 2013-11-19 17:09:37 +01:00
Holger Hans Peter Freyther e9429b5d3e rlc: Count the sent and resent RLC blocks 2013-11-13 19:36:57 +01:00
Holger Hans Peter Freyther b3d5ee2934 bts: Count the number of llc frames that were "scheduled" to be 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.
2013-11-13 16:43:26 +01:00
Holger Hans Peter Freyther aa35ba7584 tbf: Count how often we re-use a TBF that was already being deactivated 2013-11-13 15:02:50 +01:00
Holger Hans Peter Freyther 77e05971b4 tbf: Move the llc handling into the tbf (from the bts)
This will be moved to a LLC class in the future but after this
we can make the sns/ws private now and have little to update
outside the tbf.
2013-11-06 19:16:43 +01:00
Holger Hans Peter Freyther 5464c9baf2 tbf: Have one imsi field and assign it through a function
Have one IMSI field per TBF and assign through a function call.
The IMSI should be used to look-up the TBF on the SGSN->PCU
direction.
2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther 34f6e5ebe6 tbf: Make tfi private and update the code
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-30 21:24:13 +01:00
Holger Hans Peter Freyther 474685e26e tbf: Make the tlli "private" and update the updating code
Now all updates to the tlli/tlli_valid are in one place. If we
implement the policy to update the matching/linked TBF we can
now to do it in a single place. Add a todo item for that as I
am waiting for feedback from the mailinglist.
2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther bd449f57a7 tbf: Create tbf_name and use it in log statements
This is like gsm_lchan_name and should be used in log statements.
This way we can easily change the information that is printed and
we know how to search things. The other part is that direct use
of tfi/tlli is removed which will allow us to make them private
and at the same time start to resolve the "tlli" updated in many
places.

Not old log statements are changed yet. This will done whenever
a bad log statement is seen on the console...
2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther 870c601f1d tbf: TODO:Mark TLLI changes as todo item in the code
The TLLI can change when a new P-TMSI is assigned to the phone,
e.g. during a (periodic) routing area update. When the TLLI
changes we need to update all TBFs and maybe even register the
timing advance for the new TLLI..
2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther 6b88cddc21 bts: Simplify rcv_resource_request, remove logically dead code
tbf = find
 if (tbf) {
   tbf_free(tbf);
   tbf = NULL;
 }
 if (!tbf) {
   code...
 }

Remove the if (!tbf) and indention as the tbf is always to be
NULL.
2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther 8021644e9d bts: Kill dead stores of the tlli/tfi, fix the log message again
The code meant to print the tfi and not the tlli. Update it.
2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther ec80f82824 tbf: Remove the trx_no field from the tbf, go through the trx object 2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther fc498c9e7b tbf: Go through the trx to get the ARFCN 2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther 875fc895a8 bts: Further logging improvements for TFI/TLLI output 2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther e1a075ab59 bts: Pass the Packet_Control_Acknowledgement_t into the recv method 2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther 53a336f0e5 bts: Log the TLLI inside the report we get 2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther 8d0e489484 tbf: Log the TFI and TLLI so we can try to figure out more from logs
<0002> tbf.cpp:444 Poll timeout for DL TBF=0
<0002> tbf.cpp:513 - Timeout for polling PACKET DOWNLINK ACK.
<0002> tbf.cpp:688 - Assignment was on PACCH
<0002> tbf.cpp:694 - Downlink ACK was received
<0008> gprs_bssgp_pcu.cpp:154 LLC [SGSN -> PCU] = TLLI: 0xd6942c78 IMSI: 274080000004765 len: 506
<0002> bts.cpp:974 PACKET DOWNLINK ACK with unknown FN=2213128 TFI=0 (TRX 0 TS 6)
2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther 15bb1a2a51 misc: Change the logging for the tbf and what to log
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-30 21:24:12 +01:00
Holger Hans Peter Freyther 5da2014f13 bts: Use Packet_Downlink_Ack_Nack_t as parameter 2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 7a344716a6 bts: Simplify the code and use Packet_Resource_Request_t* 2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther cb5c49b581 bts: Work with the Packet_Measurement_Report_t 2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 750ca67ce9 bts: Move the MT_PACKET_MEASUREMENT_REPORT handling to a new method 2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 842808848c bts: Move handling of MT_PACKET_RESOURCE_REQUEST to a method
Move the code to a new method
2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 5a9658168a bts: Move handling of MT_PACKET_DOWNLINK_ACK_NACK to separate function
Kill the tlli assignment as it is never used.
2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 396f4161cb pdch: Move handling of control_ack to a separate method
Kill the unused tfi parameter
2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther c1ae22694c bts: Count the rach frames we receive 2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 90b87ea5e6 misc: Fix typo.. resource in english only has one 's' 2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 180def907b bts: Print the kind of message type not known. 2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 1997787c52 llc: Count timedout and silently dropped frames
A DL tbf can be discarded and then the already queued LLCs will
be silently dropped. Count this event.
2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther b98dd9e240 sba: Move freeing a sba into a central place 2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 93e048fe27 sba: Count SBA allocation, frees and timeouts
Add a warning about the receive message poking in the internal
of the sba. This will be cleaned up in a follow up commit
2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 158776411b bts: Provide the first set of counters 2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther f537298cca bts: Start creating statistics inside the BTS code 2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 3dc56a3b34 tbf: Move gprs_rlcmac_send_packet_uplink_assignment into the tbf 2013-10-30 21:24:12 +01:00
Holger Hans Peter Freyther 02beed5e98 bts: Move gprs_rlcmac_rcv_rach into the BTS class 2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther 24c1a5ba29 bts: Move gprs_rlcmac_trigger_downlink_assignment into BTS 2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther d9262b3b55 tbf: Move gprs_rlcmac_poll_timeout into the tbf
Move the gprs_rlcmac_poll_timeout method into the tbf class and
gprs_rlcmac_downlink_assignment into the BTS.
2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther 40cfaa6837 bts: Move rcv_imm_ass_cnf into the bts code 2013-10-30 21:24:11 +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 f63cabd931 tbf/pdch/bts: Move the tbf look-up by tfi into the BTS 2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther a54bbbbf02 pdch/tbf: Add another todo item for badly placed code... 2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther dea63b96e0 sba/pdch: Use thepdch to look up a sba for a frame number 2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther 05f8efc1a2 pdch: Remove the trx_no/ts_no parameter and use/caclulate it on demand
Simplify the depedencies and use the inline functions when we need
to figure out the numbers.
2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther 4f753c64d6 pdch: Remove the bts argument from rcv_control_block 2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther 65be4808af pdch: Remove the the bts parameter from rcv_data_block_acknowledged 2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther 86300bbeea tbf: Move the timer routine into the class
The timer is used for various timeouts and there is still external
client code that is calling it. In a perfect world the client code
would indicate that an event has happened and the internal timer
will be stopped. The best compromise is the "stop_t3191" method. It
allows to add semantic verification that the timer has been running.
2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther fcbc702112 pdch: Move the giant switch/case of gprs_rlcmac_rcv_control_block
Move the dispatch into the PDCH. This needs to be split up
further into understandable blocks.
2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther d11290b90b pdch/tbf: Move gprs_rlcmac_rcv_data_block_acknowledged into the pdch
Move the method into the PDCH. Extract the finding of TLLI into a
new class called Decoding. Move the assemble and forward LLC frames
into the TBF as it is poking in the internals of the TBF.
2013-10-30 21:24:11 +01:00
Holger Hans Peter Freyther 6f9f434463 pdch: Move the dispatch of gprs_rlcmac_rcv_block into the pdch 2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 9ae367f639 pdch: Instead of passing bts, trx, ts use the pdch
All dispatching will go through the PDCH. This will clean a lot
of the look-ups inside the gprs_rlcmac_data.c and continue with
adding structure to the pcu code.
2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 09ef27ae04 pdch: Simplify the reset code, rename variables to XYZ_no
Simplify the reset code now that the PDCH can know where it is
located. Rename the variables in the sba to trx_no and ts_no as
it stores the number and not the actual thing.
2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 4ed1dae533 bts: Add backpointers to the PDCH and TRX structures
This will allow to kill various parameters from all the functions
as we can walk back.
2013-10-30 21:24:10 +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 cedf890928 sba: Create a SBAController that will manage the sbas for a BTS
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-30 21:24:10 +01:00
Holger Hans Peter Freyther 63f29d6f73 encoding: Move the functions into the encoding class
Add some TODO to this class. E.g. they could all work on the
bitvec and the parameter handling could better.
2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 9446485e3d pdch: Only say we have paged when this has actually been done 2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther f0984897a5 bts/pdch: Move the adding of paging to the BTS/PDCH objects
Only the gprs_rlcmac_pdch will manipulate the paging list now. There
can be various more refactorings of the code but they can be done
later. E.g. on memory allocation failure we can continue instead
of leaving the code, we should also set any_tbf only after things
have been paged.
2013-10-30 21:24:10 +01:00
Holger Hans Peter Freyther 24e98d039d pdch: Move paging dequeue into the PDCH object
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-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 b78adcdd11 bts: Introduce a PollController that has the responsibility to poll
For each frame indication received by the BTS the poll controller
is asked to expire timedout entries.
2013-10-30 21:20:45 +01:00
Holger Hans Peter Freyther 9b30c7f46e bts: Move the frame_number into the BTS sructure
The current_frame is an attribute of the BTS. Move it from the
pcu_l1_if.cpp into the BTS. As the next step we can trigger
actions depending on the change of the frame.
2013-10-30 21:20:45 +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