Commit Graph

2440 Commits

Author SHA1 Message Date
Daniel Willmann 6f0796a33a 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 10:03:42 +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
Ivan Kluchnikov 1b517342ae 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)
2013-12-30 14:56:26 +04: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
Henning Heinold c92b964e2d systemd: Add a service for the sysmopcu
Provide a systemd service file for sysmopcu, leaves
the bundled combined sysvinit for sysmobts and sysmopcu
for legacy systems.

Sponsored-by: sysmocom
2013-12-17 19:16:10 +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
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
Holger Hans Peter Freyther 752a3b2baa Merge branch 'sysmocom/gprs-window-handling' into sysmocom/master
Daniel and me worked on the window handling. We now test that what
we encode is compatible to what we decode. The char array now includes
SSN-1 to the right of the array (reflecting a time axis that grows
towards the right..)
2013-12-12 11:11:02 +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 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 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 0f2b5fc749 tests/TypesTest: Print the result of Encoding::encode_rbb() 2013-12-12 11:03:35 +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 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
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 11f2d58dbd rlc: Create a testcase for the uplink window 2013-12-04 21:05:18 +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
Holger Hans Peter Freyther 7a5f3c2153 tbf/sched: We pick the _last_ entry, rotate the lists
We always pick the _last_ entry from the lists. Let's rotate
so we make it a bit more fair.
2013-11-26 21:00:52 +01:00
Holger Hans Peter Freyther 7f3e662b34 tbf/rlc: Move raising of V(Q) into the ul window code 2013-11-26 21:00:51 +01:00
Holger Hans Peter Freyther cbb00ebd04 rlc/tbf: Move the code to raise V(R) into the ul_window handling 2013-11-26 21:00:51 +01:00
Holger Hans Peter Freyther 423dd2286b tbf/rlc: Move the putting of a block into the rlc code 2013-11-26 21:00:51 +01:00
Holger Hans Peter Freyther 4c06d9155c tbf: Move the extraction of the TLLI into a separate method 2013-11-26 21:00:51 +01:00
Holger Hans Peter Freyther c15d5cc230 tbf/rlc: Remove the side-effect from the loop. 2013-11-26 21:00:51 +01:00
Holger Hans Peter Freyther 9977e1545a tbf: Reduce complexity and deal with only one way of assignment
The normal mode of the PCU doesn't really work right now. There
is no place to have certain kind of features that are not built
and not unit-tested.
2013-11-26 21:00:51 +01:00
Holger Hans Peter Freyther 6ab5b24be4 tbf/rlc: Move the check if something is in the window out. 2013-11-26 21:00:51 +01:00
Holger Hans Peter Freyther 7decedcbf8 rlc: The bsn has never been used. Remove it from the Xl_window 2013-11-26 21:00:51 +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 270f7fce1d tbf/rlc: Move the v_n handling into a dedicated object 2013-11-26 21:00:51 +01:00
Holger Hans Peter Freyther f1593b7c49 tbf/rlc: Big change and move the window handling out to the rlc
The send and receive window is now managed by an external object.
There are some issues that can only be solved with C++11 but it
is progres and removes some of the spaghetti code. For GPRS the
sns and ws is hardcoded. Move that into the window code.
2013-11-26 21:00:51 +01:00
Holger Hans Peter Freyther ab6cd921e3 tbf: Update the legend and mention invalid as well
We should not see it but the legend should be complete.
2013-11-26 20:57:42 +01:00
Holger Hans Peter Freyther 9a76968ec4 rlc: Use uint16_t for the BSN in all cases.
The sns is only 128 for GPRS (it can be bigger for EDGE) so the
uint8_t was enough but it is bad to have inconsistencies for both
of them.
2013-11-26 20:57:40 +01:00
Holger Hans Peter Freyther 9c5539d46d tbf/rlc: Move the counting of unacked frames into the RLC V_B class
Whenwe receive a final ack we assume that all the unacked frames
have been acked now. Move the counting to V_B and now the caller
can remove the BSN and the "lost" variable which has always been
zero.
2013-11-26 20:57:24 +01:00
Holger Hans Peter Freyther 86dc355a33 tbf: Split the handling of DL ACK/NACK into two separate parts
Split the handling of the final ack and the handling of frames
that is moving frames.
2013-11-26 20:57:24 +01:00
Holger Hans Peter Freyther bc15570651 tbf/rlc: Change the code and generate the entire state in the V_B 2013-11-26 20:57:24 +01:00
Holger Hans Peter Freyther e358ff8fa4 tbf/rlc: Move the moving of V(A) into the V_B code
Move the code that moves the V_B to the first not acked frame. Return
how many indexes the V_B was moved and update the V_A in the caller.
2013-11-26 20:57:24 +01:00
Holger Hans Peter Freyther df6b4f52e0 tbf/rlc: Move the parsing of RBB to Decoding, move window marking out
Move the parsing of the bitbmap out of the TBF code into Decoding.
Move the updating of the V_B into the V_B class. Add some comments
about handling the mod_sns, mod_sns_half parameters by using template
code.
2013-11-26 20:57:24 +01:00