Commit Graph

405 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther e5109ba1f0 tbf: Change the log area to RLCMACDL so we see it in a DL trace 2014-01-16 10:11:22 +01: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 a004799699 tbf: Use past-tense and call it created_ts 2014-01-16 10:07:20 +01:00
Daniel Willmann 80367aae17 tbf: Save a timestamp at tbf allocation and print it in the VTY 2014-01-15 17:41:45 +01:00
Daniel Willmann 772415fd8a pcu_vty: Add a command to print info about all TBFs 2014-01-15 17:41:45 +01:00
Daniel Willmann afa72f5210 tbf: Add a function to output tbf info to VTY 2014-01-15 17:41:44 +01:00
Daniel Willmann 3ce011f44f rlc: Rename state() to show_state() to better reflect its function
show_state() is only used for debugging output to make the v(b) array
human readable.
2014-01-15 15:23:35 +01: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
Daniel Willmann f4a1ec6ce7 rlc: Rename the simple raise_v_r method to avoid naming conflicts 2014-01-15 15:23:21 +01:00
Andreas Eversberg 0a940087b2 alloc_algorithm_b: Remove obsolete 'i' incrementation from for-loop 2014-01-15 14:33:49 +01:00
Andreas Eversberg 1cd9d886e6 alloc_algorithm_b: Add seperate function to shrink rx window when TS are removed
After reduce_rx_window() and update_rx_win_max() was called, one or more TS
might be removed. tx_win_min and tx_win_max must be adjusted to the new range
of allocated slots.
2014-01-15 10:39:08 +01:00
Andreas Eversberg fe2dcc8aec alloc_algorithm_b: Increment 'i', so allocated TS will not exceed tx_range 2014-01-15 10:39:08 +01:00
Andreas Eversberg 765736dc77 alloc_algorithm_b: Do not select uplink slots that cannot be used for downlink
In order to poll MS, the mobile must be able to receive polling request.

In order to allow the MS to transmit, the USF must be received by the mobile.
2014-01-15 10:39:08 +01:00
Andreas Eversberg 7a16d46fdc alloc_algorithm_b: Set tx_range to 8, if all 8 TS are supported by MS 2014-01-15 10:39:08 +01:00
Andreas Eversberg ccde4c462d alloc_algorithm_b: For type 1 MS, limit number of donwlink TS to 5
The algorithm does not support more than 5 TS on downlink for type 1 MS.
Supporting more than 5 TS would require adding more complexity to this
algorithm. MS that support more than 4 (or 5) TS on downlink are rare,
if they really exist.
2014-01-15 10:39:08 +01:00
Andreas Eversberg b03d427b08 alloc_algorithm_b: Correctly increment RX/TX window, even if TS is not useable 2014-01-15 10:39:08 +01:00
Holger Hans Peter Freyther 73193110f2 alloc: Move the uplink ts selection/pre-assignment out of the code
Create a select_ul_slots which is very (95%) similar to the
select_dl_slots handling. This needs to be refactored and the
todo for multiple uplink slots should be handled too.

Add a warning about a potential failure on a busy PCU.
2014-01-15 10:39:08 +01:00
Holger Hans Peter Freyther 1fe69323ad alloc: Move the selection of the first enabled pdch to a new method 2014-01-15 10:39:08 +01:00
Holger Hans Peter Freyther 3fd2ddf1a2 alloc: Move the tx window calculation to a new method 2014-01-15 10:39:08 +01:00
Holger Hans Peter Freyther dd4af8045f alloc: Move upating of the rx window max for Type==1 to a new method 2014-01-15 10:39:08 +01:00
Holger Hans Peter Freyther e45c19b3e8 alloc: Move the collision handling to a new method
The naming of RX/TX still looks fishy and it should use DL/UL instead.
Work on pointers right now. We could introduce a struct with the window
min and max and pass this struct. The usage of 'D' appears wrong in the
ul_usage..
2014-01-15 10:39:08 +01:00
Holger Hans Peter Freyther 882fc9b174 alloc: Move the selection of downlink slots to a new method
This code could evolve into working for Uplink and Downlink. The
only different for the final Uplink assignment is that free USFs
are collected.
2014-01-15 10:39:08 +01:00
Holger Hans Peter Freyther f34f34495b alloc: Simplify the assignment of Trb and Ttb
Put the cases for MS_A/MS_B and MS_A/MS_C together.
2014-01-15 10:39:08 +01:00
Holger Hans Peter Freyther df022f6cb2 alloc: Add a note that the tx window handling differs from rx
It looks like the code is different (without a reason) a good
reason.
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 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 ba26368040 tbf: Fix typo and call it same 2014-01-15 10:33:56 +01:00
Daniel Willmann fdcdde2756 Set csnStream direction *after* csnStreamInit
Fixes a bug introduced in commit 402cdc. That commit sets direction to
zero so setting it to 1 should be done after the call to
csnStreamInit().

This issue was discovered by the rlcmac test.
2014-01-15 09:57:07 +01:00
Ivan Kluchnikov 402cdcd02f Fix warnings in gsm_rlcmac.cpp
1. ar.direction variable was not initialized
2. overrunning array "data->RLC_DATA" of 20 bytes at byte offset 22 using index "i" (which evaluates to 22)
2014-01-09 20:01:48 +01:00
Daniel Willmann 2f1974b5ac sysmo_l1_if: Fix off-by-one bug when sending UL messages to gsmtap
The first byte in data_ind->msgUnitParam.u8Buffer is not part of the GSM
frame, but something else, it is also skipped in the call to
pcu_rx_data_ind_pdtch().

This patch fixes GSM RLC/MAC UL packet decoding in wireshark, especially
ACK/NACK packets are now displayed correctly (amongst others).
2014-01-09 20:00:00 +01:00
Holger Hans Peter Freyther 705653b2d7 sched: Attempt to improve the fairness and schedule UL/AL ACK/ASS
It is possible that certain UL ACK messages are not sent when there
are many many uplink and downlink assignments. Try to be more fair
and schedule them round-robin. This way no starvation should occur.
2013-12-25 15:31:46 +01:00
Holger Hans Peter Freyther aadfc2e121 sched: Remove unused bts parameter from the internal method 2013-12-25 15:19:54 +01:00
Daniel Willmann 9c623892f5 llc: Calculate the average queuing delay of the LLC queues
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.
2013-12-25 14:55:04 +01:00
Holger Hans Peter Freyther a42b2ad5ed llc: Initialize the LLC frame with garbage to detect wrong usage 2013-12-25 14:27:07 +01:00
Holger Hans Peter Freyther 550bb88a9e llc: Count the number of frames queued inside the LLC queue 2013-12-18 12:11:27 +01:00
Holger Hans Peter Freyther 88553abf4d rlc: Use sizeof() for the memset instead of ARRAY_SIZE
In this case both will give the same result but it is better to use
sizeof. But it is better to use the raw number of bytes instead of
the number of elements.
2013-12-18 12:11:10 +01:00
Holger Hans Peter Freyther 81e8f0a8a2 l1if: Include string.h to fix possible coverity issue
Coverity warns about the below lines of code. strerror is supposed
to return a char* and %s should work on char. Let's see if including
string.h will make coverity more happy. The pre-processes file looked
sane as well.

 LOGP(DL1IF, LOGL_ERROR, "error writing to L1 msg_queue: %s\n",
               strerror(errno));

Coverity: CID 1040951, CID 1040950, CID 1040952
2013-12-12 14:32:33 +01:00
Daniel Willmann 5e94cd4fde decoding: Cosmetic - change rbb decoding 2013-12-12 11:09:17 +01:00
Daniel Willmann cc5a4cbe9b rlc: Make the update loop more understandable
Add bitnum_to_bsn() as a convenience function to get the BSN, use it
in the update handling and ignore rbb for values outside of our tx
window.
2013-12-12 11:07:47 +01:00
Daniel Willmann 6f7cb2cb4f decoding: Use 'I' and 'R' in rbb array for DL
We want to match up rbb decoding and encoding so it helps to use the
same chars.
2013-12-12 11:03:50 +01:00
Daniel Willmann 5241c1a018 encoding: Factor out encode_rbb to help testing 2013-12-12 11:03:13 +01:00
Daniel Willmann 52ea8a0d87 encoding: Use ul_window ssn()/update_rbb() methods when encoding ul ACK
Use the ssn() and update_rbb() methods of gprs_rlc_ul_window when
encoding the ACK/NACK packet in write_packet_uplink_ack()
2013-12-12 11:02:09 +01:00
Daniel Willmann e6e605ba86 encoding: Change wording to match that of 3GPP TS 04.60
The spec (in ch. 9.1.8.1) speaks of RECEIVED or INVALID in the RLC
receiver, so change the wording in the log message to match.
2013-12-12 11:01:52 +01:00
Daniel Willmann 8a31f9e016 rlc: Manage the received block bitmap in the ul_window
Added two methods to gprs_rlc_ul_window
* ssn() returns the starting sequence number
* update_rbb() returns an array of chars representing the state of the
  received   block bitmap. Each element is either 'I'nvalid or
  'R'eceived. The rbb is generated from v_n

rbb[63] relates to BSN ssn-1
...
rbb[0] relates to BSN ssn-64
2013-12-12 10:59:56 +01:00
Holger Hans Peter Freyther 3cbf9e040c rlc: Make the RLC types only operate on the BSN
The code has an internal optimization to only use window_size
space. This means that the caller needed to know that only half
of the size was used. Change the API to work on the BSN and do
the mapping internally. The compiler should have plenty of
opportunity to propagate the constant(s) but this has not been
verified.
2013-12-04 21:01:02 +01:00
Holger Hans Peter Freyther 3c95776805 tbf: Separate the handling for rh->si and call in case of re-transmission
In case of a retransmission ack the window again..
2013-12-04 13:51:43 +01:00