Dear all,
so far the osmocom.org mailing lists have always been in a 'non-members
are manually moderated' mode. This has created a lot of work for manual
list moderation, where a lot of the messages caught are simply spam, and
only the occasional valid message is being received.
I'd like to thank the list moderators for taking care of this.
However, in more recent discussions, we were considering to move the
lists to a completely closed mode, i.e. postings would automatically be
rejected from non-members.
The automatic response would contain a description of how to subscribe
in 'nomail' mode, i.e. to subscribe in a way to be able to post to the
list, while still not receiving any incoming traffic. The latter should
be fine for occasional posters who don't want the bulk e-mail that goes
with a full/regular subscription.
Please provide feedback in case you disagree with that change. Unless
there is major opposition, we will likely transition to the 'closed'
mode within one month.
Thanks,
Harald
--
- Harald Welte <laforge(a)gnumonks.org> http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)
Good Afternoon,
last week at the sysmocom office Daniel and me continued to work on the
window handling. We have now a proper abstraction that allows us to unit
test the DL and UL window handling. The encode/decode of the RBB is now
compatible to itself.
While doing our manual tests (sending a big enough ICMP echo request)
we noticed that in the alloc algorithm b case the we get a lot of NACKs.
In the same setup (only alloc algorithm is changed) the A algorithm has
no NACKs.
I am now going to re-write the allocation handling. In terms of operation
on the first DL assignment (through the PCH) we can only use a singleslot
but when re-using the TBF we might go for multislot. In case the of UL
handling we could always try to use multislot assignments. Is this
understanding correct?
holger
--
- Holger Freyther <hfreyther(a)sysmocom.de> http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte
Good Morning,
we at sysmocom continued to add structure/architecture to the PCU
code and started to systematically test the code (using something
as simple as ICMP ping/reply)
Observations:
* "alloc algorithm b" has little (3kbit/s) more bandwidth than just
using the single slot assignment with CS4. There are also some
open coverity issues about this multi slot code.
* Congestion is badly handled. When using a ping that creates IP
fragments the LLC queue of the TBF gets so long that we expire
half the IP fragments before sending them. This means the MS at
the downlink never receives all the IP fragments of a PING.
We played with the BSVC-FLOW-CONTROL parameters but they don't
have any influence here. We have added counting of queue size
and calculation of the average queue delay to the LLC class.
One option is to drop packages based on the PDU lifetime and the
current queue delay.
$ sudo ping -s 1800 -i 0.1 10.23.42.6
(CS4, alloc-algorithm a) is enough to re-produce this issue.
* RLC V(Q) V(R) handling. It appears that after and before the
refactoring the Received Block Bitmap (RBB) is wrongly encoded. The
encode and decode are not compatible to each other (thanks to the
architecture sysmocom is adding to the code this can now be unit
tested!).
So as soon as we don't receive a frame from the UL. The send window
at the phone and the PCU is going out of sync.
After making changes to the window we have also witnesses that on
a fully received window V(Q) and V(R) were WindowSize away from
each other.
<0005> tbf.cpp:1579 UL DATA TFI=0 received (V(Q)=55 .. V(R)=60)
<0005> tbf.cpp:1624 - BSN 60 storing in window (55..118)
<0005> rlc.cpp:173 - Raising V(R) to 61
<0005> tbf.cpp:1690 - Scheduling Ack/Nack, because 20 frames received.
<0005> encoding.cpp:374 Encoding Ack/Nack for TBF(TFI=0 TLLI=0xfa45049d DIR=UL) (final=0) SSN=61
<0005> encoding.cpp:408 - V(N): "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" R=Received N=Not-Received
This part might be something we broke but we will try to re-produce
with a unit test.
We will continue to work on unit-testing the RLC window handling if
anyone outside sysmocom interested in getting a more stable PCU?
holger
--
- Holger Freyther <hfreyther(a)sysmocom.de> http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte
Hi,
I have added rate counters to the PCU and noticed that a lot of frames
in the DL are re-sent without there actually being any NACK or
transmission errors. I have also re-produced a "stall" by just using
ping with a big enough data size and a low enough interval (the PCU
appears to transmit the ICMP PING but the MS never gets to send a PONG
packet).
In both cases it could be a scheduling issue (e.g. we don't schedule
the UL Packet ACK/NACK). Is any of you aware of it? I had already
highlighted that the scheduling is not fair. I wonder if we are seeing
starvation (and will re-factor to be able to unit test this).
In terms of scheduling. For the SBA we are already having a reservation
that we try to honor in multiple places. Maybe it is time to extend it
and have more reservations?
holger
--
- Holger Freyther <hfreyther(a)sysmocom.de> http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte
Hello Andreas,
while looking through the osmo-pcu code to figure out why some
connections stall we had some problems making sense of the elapsed time
calculations in gprs_rlcmac_meas.cpp.
Could you confirm/deny my assumptions about it or explain the idea
behind it?
> gettimeofday(&now_tv, NULL);
> elapsed = ((now_tv.tv_sec - loss_tv->tv_sec) << 7)
> + ((now_tv.tv_usec - loss_tv->tv_usec) << 7) / 1000000;
I assume here you're calculating the duration of the measurement period
so far and since you want to have sub-second accuracy you multiply
everything with 128. Why 128?
Is it becasue it simplifies the throughput calculation?
(tbf->meas.dl_bw_octets/elapsed in gprs_rlcmac_dl_bw())
> if (elapsed < 128)
> return 0;
Is the intention here that the duration of the measurements is supposed
to be one second? So every second these measurements are printed out and
reset?
Regards
Daniel Willmann
--
- Daniel Willmann <dwillmann(a)sysmocom.de> http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte
Hi,
my clean-ups are not done but there is a basic structure now that
can be refined. I started to add statistics to the BTS (and then will
add statistics per tbf but they are short lived so one would need to
be quick to see them).
E.g. in tbf_free we are freeing still pending llc_frames and I assume
that these are related to the "Killing pending DL TBF" and others. I
am wondering why:
* there is no indication to the SGSN for dropped frames/octets?
* can't the DL-TBF be re-associated/updated after the assignment
is done again?
holger
--
- Holger Freyther <hfreyther(a)sysmocom.de> http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte
Hi,
I got this log from the pcu while using my E71 (the only sub in this
network).
<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
So there is an ACK for TLLI=0xe512eba3 but at the same time the tlli
0x88661bc6 is timing out.
PCU->SGSN TLLI=0x88661bc6 Attach Request
SGSN->PCU TLLI=0x88661bc6 Attach Accept (new P-TMSI)
PCU->SGSN TLLI=0xe512eba3 Attach Complete (new TLLI) (6s later)
Now the question is how the PCU should behave. I think the MS is
allowed to change the TLLI (after a P-TMSI assignment) after the
contention resolution is completed. From my reading there is no content
resolution on the UL. My E71 appears to run into a timeout and then
issue a RACH request to send the Attach Complete. I think I have
seen other equipment failing to transmit the Attach Complete at
all.
I think for the SGSN -> PCU side we should generally look things up
by IMSI (there is already a warning in the code), for the MS->PCU
side. I think we should store the old and new TLLI (and then put
new_tlli into tlli once the new one is being used).
comments?
holger
--
- Holger Freyther <hfreyther(a)sysmocom.de> http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte
Hi,
I don't see any print connected to the Uplink TBF request for "Attach
accept" (by MS). At this moment the TLLI has been already updated but UL
TBF still does not exist
(what bts->tbf_by_tlli(m_tlli, GPRS_RLCMAC_UL_TBF) returns?). Corresponding
to TS 04.60, 11.2.29 Packet Uplink Assignment possibly may use DL TFI to
address the MS in place of TLLI (we still don't know if it's accepted or
not by MS). Also the uplink FN may be used to find corresponding UL TBF
context (according to Packet Uplink Assignment RRBP field) for UL Packet
Control Ack which contains relevant TLLI. So is it really necessary to
link UL and DL TBFs in the case? ...
Regards,
Vladimir Rolbin
On Wed, Oct 30, 2013 at 1:17 PM, Holger Hans Peter Freyther <
hfreyther(a)sysmocom.de> wrote:
> On Sun, Oct 27, 2013 at 01:33:13PM +0100, Holger Hans Peter Freyther wrote:
>
> Hi,
>
>
> > <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
>
> this is from a routing area update (with some printf debugging):
>
>
> TBF(TFI=0 TLLI=0xb68154e6 DIR=DL) TLLLI changed......
> 0xb68154e6->0xc782d1de
> <0002> tbf.cpp:1626 TBF(TFI=0 TLLI=0xb68154e6 DIR=DL) changing tlli to
> TLLI=0xc782d1de
> <0002> bts.cpp:941 Got ACK, but UL TBF is gone TLLI=0xc782d1de
> <0007> gprs_rlcmac_meas.cpp:158 DL packet loss of IMSI=274080000004765 /
> TLLI=0xc782d1de: 0%
> <0002> tbf.cpp:664 TBF(TFI=0 TLLI=0xb68154e6 DIR=UL) T3169 timeout during
> transsmission
> <0002> tbf.cpp:686 - Assignment was on PACCH
> <0002> tbf.cpp:690 - No uplink data received yet
>
> So the DL TLLI has been changed and then we get an ACK for a UL tbf
> with the new TLLI and can't find it. And run into a timeout.
>
>
> I have applied this change:
>
> diff --git a/src/tbf.cpp b/src/tbf.cpp
> index fac5aaf..19bb83c 100644
> --- a/src/tbf.cpp
> +++ b/src/tbf.cpp
> @@ -1618,6 +1618,17 @@ void gprs_rlcmac_tbf::update_tlli(uint32_t tlli)
> if (tlli == m_tlli)
> return;
>
> + printf("%s TLLLI changed...... 0x%08x->0x%08x\n",
> + tbf_name(this), m_tlli, tlli);
> +
> + if (direction == GPRS_RLCMAC_DL_TBF) {
> + gprs_rlcmac_tbf *ul_tbf;
> + ul_tbf = bts->tbf_by_tlli(m_tlli, GPRS_RLCMAC_UL_TBF);
> +
> + if (ul_tbf)
> + ul_tbf->m_tlli = tlli;
> + }
> +
> #warning "TODO.. find the DL/UL opposite and update the TLLI too"
> LOGP(DRLCMAC, LOGL_NOTICE, "%s changing tlli to TLLI=0x%08x\n",
> tbf_name(this), tlli);
>
>
> and now the "Attach Complete" comes immediately after the Attach Accept.
> I will push something like this but we really need a better way to link
> the DL/UL TBFs together.
>
>
> holger
>
>
> --
> - Holger Freyther <hfreyther(a)sysmocom.de> http://www.sysmocom.de/
> =======================================================================
> * sysmocom - systems for mobile communications GmbH
> * Schivelbeiner Str. 5
> * 10439 Berlin, Germany
> * Sitz / Registered office: Berlin, HRB 134158 B
> * Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte
>
>
>
Hi all,
I have continued with my refactorings and mostly done:
* Remove global state (e.g. the global lists for ta, sba, tbf, bts
* Add back-pointers to tbf, trx, pdch which will allow to kill methods
that take trx, ts as parameters.
* Started to use C++ classes and functions.
* Stop poking of internals from other classes areas (gprs_rlcmac_data
is still in front of me and the most hairy part).
I will probably need to spend another 40h on this code to finally
have structure in it. Once this is done I will add counters and
rate counters, improve the VTY inspection... and then I can search
for the actual defects we are experiencing.
While doing the refactorings I noticed that both pcu_l1_if.cpp and
sysmo_sock.cpp have different ways to reset the BTS/PCU state. Both
of them have different issues and are both incomplete. It is the
perfect example where structure would have saved timed and made
the code more reliable at the same time.
I am going to work on gprs_rlcmac_data.cpp and while my refactorings
so far where low risk.. the risk will increase when touching and
structuring the above, e.g. it is hard to judge if the difference in
the code-clones is on purpose or actually a bug. There will be only
one way to find it out though.
I am afraid that I have 52 commits compares to master and I am only
half way done. Review and changing directions will be quite difficult
at this point in time.
holger
--
- Holger Freyther <hfreyther(a)sysmocom.de> http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte
From: Holger Hans Peter Freyther <holger(a)moiji-mobile.com>
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.
---
src/gprs_rlcmac.cpp | 1 +
src/gprs_rlcmac.h | 97 --------------------------------------------
src/gprs_rlcmac_meas.cpp | 1 +
src/gprs_rlcmac_sched.cpp | 1 +
src/pcu_l1_if.cpp | 1 +
src/tbf.h | 100 +++++++++++++++++++++++++++++++++++++++++++++-
6 files changed, 103 insertions(+), 98 deletions(-)
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index 6546f8a..3dab44f 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -22,6 +22,7 @@
#include <gprs_bssgp_pcu.h>
#include <pcu_l1_if.h>
#include <gprs_rlcmac.h>
+#include <tbf.h>
/* 3GPP TS 05.02 Annex B.1 */
diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h
index 8de7417..6fdf600 100644
--- a/src/gprs_rlcmac.h
+++ b/src/gprs_rlcmac.h
@@ -155,103 +155,6 @@ enum gprs_rlcmac_tbf_direction {
#define GPRS_RLCMAC_FLAG_TO_DL_ASS 7
#define GPRS_RLCMAC_FLAG_TO_MASK 0xf0 /* timeout bits */
-struct gprs_rlcmac_tbf {
- struct llist_head list;
- enum gprs_rlcmac_tbf_state state;
- uint32_t state_flags;
- enum gprs_rlcmac_tbf_direction direction;
- uint8_t tfi;
- uint32_t tlli;
- uint8_t tlli_valid;
- uint8_t trx;
- uint16_t arfcn;
- uint8_t tsc;
- uint8_t first_ts; /* first TS used by TBF */
- uint8_t first_common_ts; /* first TS that the phone can send and
- reveive simultaniously */
- uint8_t control_ts; /* timeslot control messages and polling */
- uint8_t ms_class;
- struct gprs_rlcmac_pdch *pdch[8]; /* list of PDCHs allocated to TBF */
- uint16_t ta;
- uint8_t llc_frame[LLC_MAX_LEN]; /* current DL or UL frame */
- uint16_t llc_index; /* current write/read position of frame */
- uint16_t llc_length; /* len of current DL LLC_frame, 0 == no frame */
- struct llist_head llc_queue; /* queued LLC DL data */
-
- enum gprs_rlcmac_tbf_dl_ass_state dl_ass_state;
- enum gprs_rlcmac_tbf_ul_ass_state ul_ass_state;
- enum gprs_rlcmac_tbf_ul_ack_state ul_ack_state;
-
- enum gprs_rlcmac_tbf_poll_state poll_state;
- uint32_t poll_fn; /* frame number to poll */
-
- uint16_t ws; /* window size */
- uint16_t sns; /* sequence number space */
-
- /* Please note that all variables here will be reset when changing
- * from WAIT RELEASE back to FLOW state (re-use of TBF).
- * All states that need reset must be in this struct, so this is why
- * variables are in both (dl and ul) structs and not outside union.
- */
- union {
- struct {
- uint16_t bsn; /* block sequence number */
- uint16_t v_s; /* send state */
- uint16_t v_a; /* ack state */
- char v_b[RLC_MAX_SNS/2]; /* acknowledge state array */
- int32_t tx_counter; /* count all transmitted blocks */
- char imsi[16]; /* store IMSI for PCH retransmission */
- uint8_t wait_confirm; /* wait for CCCH IMM.ASS cnf */
- } dl;
- struct {
- uint16_t bsn; /* block sequence number */
- uint16_t v_r; /* receive state */
- uint16_t v_q; /* receive window state */
- char v_n[RLC_MAX_SNS/2]; /* receive state array */
- int32_t rx_counter; /* count all received blocks */
- uint8_t n3103; /* N3103 counter */
- uint8_t usf[8]; /* list USFs per PDCH (timeslot) */
- uint8_t contention_resolution_done; /* set after done */
- uint8_t final_ack_sent; /* set if we sent final ack */
- } ul;
- } dir;
- uint8_t rlc_block[RLC_MAX_SNS/2][RLC_MAX_LEN]; /* block history */
- uint8_t rlc_block_len[RLC_MAX_SNS/2]; /* block len of history */
-
- uint8_t n3105; /* N3105 counter */
-
- struct osmo_timer_list timer;
- unsigned int T; /* Txxxx number */
- unsigned int num_T_exp; /* number of consecutive T expirations */
-
- struct osmo_gsm_timer_list gsm_timer;
- unsigned int fT; /* fTxxxx number */
- unsigned int num_fT_exp; /* number of consecutive fT expirations */
-
- struct {
- char imsi[16];
-
- struct timeval dl_bw_tv; /* timestamp for dl bw calculation */
- uint32_t dl_bw_octets; /* number of octets since bw_tv */
-
- struct timeval rssi_tv; /* timestamp for rssi calculation */
- int32_t rssi_sum; /* sum of rssi values */
- int rssi_num; /* number of rssi values added since rssi_tv */
-
- struct timeval dl_loss_tv; /* timestamp for loss calculation */
- uint16_t dl_loss_lost; /* sum of lost packets */
- uint16_t dl_loss_received; /* sum of received packets */
-
- } meas;
-
- uint8_t cs; /* current coding scheme */
-
-#ifdef DEBUG_DIAGRAM
- int diag; /* number where TBF is presented in diagram */
- int diag_new; /* used to format output of new TBF */
-#endif
-};
-
extern struct llist_head gprs_rlcmac_ul_tbfs; /* list of uplink TBFs */
extern struct llist_head gprs_rlcmac_dl_tbfs; /* list of downlink TBFs */
extern struct llist_head gprs_rlcmac_sbas; /* list of single block allocs */
diff --git a/src/gprs_rlcmac_meas.cpp b/src/gprs_rlcmac_meas.cpp
index 75da835..3229795 100644
--- a/src/gprs_rlcmac_meas.cpp
+++ b/src/gprs_rlcmac_meas.cpp
@@ -20,6 +20,7 @@
#include <gprs_rlcmac.h>
#include <gprs_debug.h>
#include <pcu_l1_if.h>
+#include <tbf.h>
#include <string.h>
#include <errno.h>
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 6290c5d..f3edaac 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -20,6 +20,7 @@
#include <gprs_bssgp_pcu.h>
#include <gprs_rlcmac.h>
#include <pcu_l1_if.h>
+#include <tbf.h>
uint32_t sched_poll(uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr,
struct gprs_rlcmac_tbf **poll_tbf,
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 218dc23..47bf740 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -37,6 +37,7 @@ extern "C" {
#include <gprs_debug.h>
#include <gprs_bssgp_pcu.h>
#include <pcuif_proto.h>
+#include <tbf.h>
// FIXME: move this, when changed from c++ to c.
extern "C" {
diff --git a/src/tbf.h b/src/tbf.h
index 330eac1..a6dfced 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -18,9 +18,107 @@
#pragma once
+#include "gprs_rlcmac.h"
+
#include <stdint.h>
-struct gprs_rlcmac_bts;
+struct gprs_rlcmac_tbf {
+ struct llist_head list;
+ enum gprs_rlcmac_tbf_state state;
+ uint32_t state_flags;
+ enum gprs_rlcmac_tbf_direction direction;
+ uint8_t tfi;
+ uint32_t tlli;
+ uint8_t tlli_valid;
+ uint8_t trx;
+ uint16_t arfcn;
+ uint8_t tsc;
+ uint8_t first_ts; /* first TS used by TBF */
+ uint8_t first_common_ts; /* first TS that the phone can send and
+ reveive simultaniously */
+ uint8_t control_ts; /* timeslot control messages and polling */
+ uint8_t ms_class;
+ struct gprs_rlcmac_pdch *pdch[8]; /* list of PDCHs allocated to TBF */
+ uint16_t ta;
+ uint8_t llc_frame[LLC_MAX_LEN]; /* current DL or UL frame */
+ uint16_t llc_index; /* current write/read position of frame */
+ uint16_t llc_length; /* len of current DL LLC_frame, 0 == no frame */
+ struct llist_head llc_queue; /* queued LLC DL data */
+
+ enum gprs_rlcmac_tbf_dl_ass_state dl_ass_state;
+ enum gprs_rlcmac_tbf_ul_ass_state ul_ass_state;
+ enum gprs_rlcmac_tbf_ul_ack_state ul_ack_state;
+
+ enum gprs_rlcmac_tbf_poll_state poll_state;
+ uint32_t poll_fn; /* frame number to poll */
+
+ uint16_t ws; /* window size */
+ uint16_t sns; /* sequence number space */
+
+ /* Please note that all variables here will be reset when changing
+ * from WAIT RELEASE back to FLOW state (re-use of TBF).
+ * All states that need reset must be in this struct, so this is why
+ * variables are in both (dl and ul) structs and not outside union.
+ */
+ union {
+ struct {
+ uint16_t bsn; /* block sequence number */
+ uint16_t v_s; /* send state */
+ uint16_t v_a; /* ack state */
+ char v_b[RLC_MAX_SNS/2]; /* acknowledge state array */
+ int32_t tx_counter; /* count all transmitted blocks */
+ char imsi[16]; /* store IMSI for PCH retransmission */
+ uint8_t wait_confirm; /* wait for CCCH IMM.ASS cnf */
+ } dl;
+ struct {
+ uint16_t bsn; /* block sequence number */
+ uint16_t v_r; /* receive state */
+ uint16_t v_q; /* receive window state */
+ char v_n[RLC_MAX_SNS/2]; /* receive state array */
+ int32_t rx_counter; /* count all received blocks */
+ uint8_t n3103; /* N3103 counter */
+ uint8_t usf[8]; /* list USFs per PDCH (timeslot) */
+ uint8_t contention_resolution_done; /* set after done */
+ uint8_t final_ack_sent; /* set if we sent final ack */
+ } ul;
+ } dir;
+ uint8_t rlc_block[RLC_MAX_SNS/2][RLC_MAX_LEN]; /* block history */
+ uint8_t rlc_block_len[RLC_MAX_SNS/2]; /* block len of history */
+
+ uint8_t n3105; /* N3105 counter */
+
+ struct osmo_timer_list timer;
+ unsigned int T; /* Txxxx number */
+ unsigned int num_T_exp; /* number of consecutive T expirations */
+
+ struct osmo_gsm_timer_list gsm_timer;
+ unsigned int fT; /* fTxxxx number */
+ unsigned int num_fT_exp; /* number of consecutive fT expirations */
+
+ struct {
+ char imsi[16];
+
+ struct timeval dl_bw_tv; /* timestamp for dl bw calculation */
+ uint32_t dl_bw_octets; /* number of octets since bw_tv */
+
+ struct timeval rssi_tv; /* timestamp for rssi calculation */
+ int32_t rssi_sum; /* sum of rssi values */
+ int rssi_num; /* number of rssi values added since rssi_tv */
+
+ struct timeval dl_loss_tv; /* timestamp for loss calculation */
+ uint16_t dl_loss_lost; /* sum of lost packets */
+ uint16_t dl_loss_received; /* sum of received packets */
+
+ } meas;
+
+ uint8_t cs; /* current coding scheme */
+
+#ifdef DEBUG_DIAGRAM
+ int diag; /* number where TBF is presented in diagram */
+ int diag_new; /* used to format output of new TBF */
+#endif
+};
+
/* dispatch Unitdata.DL messages */
int tbf_handle(struct gprs_rlcmac_bts *bts,
--
1.8.4.rc3