blob: caddf63faaeea8516c9a8b9e6271f3800816af10 [file] [log] [blame]
Andreas Eversberge6228b32012-07-03 13:36:03 +02001This document describes the handling of TBFs
2--------------------------------------------
3
4Notes:
5 TBF
6 Instance for one temporary block flow.
7
8 LLC Frame
9 Current frame to be transmitted or received. If tbf->llc_length is not 0,
10 the frame exists, if 0, the frame does not exist. If tbf->llc_index is not
11 0, parts of the frame have been transmitted or received so far.
12
13 LLC Queue
14 Queue of next frames to be transmitted.
15
16States:
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +020017 TBF_ST_ASSIGN
Andreas Eversberge6228b32012-07-03 13:36:03 +020018 After a downlink TBF is created, it resides in this state until the
19 block flow can start. This is required to give the mobile time to listen
20 to connect to downlink PDCH.
21
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +020022 TBF_ST_FLOW,
Andreas Eversberge6228b32012-07-03 13:36:03 +020023 During packet flow, this state indicates downlink and uplink TBF block
24 flow.
25
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +020026 TBF_ST_FINISHED,
Andreas Eversberge6228b32012-07-03 13:36:03 +020027 Uplink TBF:
28 After final block is received AND all other blocks are completely
29 received, the state is entered. The PACKET CONTROL ACK is still not
30 received. (Counter N3103 is counted on each poll request.)
31 Downlink TBF:
32 All blocks including the final block has been transmitted. Not all
33 downlink blocks are acknowledged yet. (Counter N3015 is counted on each
34 poll request.)
35
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +020036 TBF_ST_WAIT_RELEASE,
Andreas Eversberge6228b32012-07-03 13:36:03 +020037 The all blocks on downlink TBF have been acked by mobile. The penalty
38 timer T3192 is running on mobile.
39
Pau Espin Pedroldc2aaac2021-05-14 12:50:46 +020040 TBF_ST_RELEASING,
Andreas Eversberge6228b32012-07-03 13:36:03 +020041 Wait for TFI/USF to be re-used. This state is entered when a counter
42 reaches it's maximum and T3169 is running.
43
44
45When downlink LLC PDU is received:
46
47 If downlink TBF exists for given TLLI, but not in RELEASING state:
48 If downlink TBF is in FLOW or FINISHED state:
49 Enqueue PDU to LLC Queue of TBF.
50 Done.
51 If downlink TBF is in WAIT RELEASE state:
52 Attach PDU to LLC Frame of TBF.
53 Put TBF back into FLOW state.
54 Done.
Pau Espin Pedrold06ec272021-07-30 15:03:21 +020055 If downlink TBF does not exists for given TLLI, or in RELEASING state:
Andreas Eversberge6228b32012-07-03 13:36:03 +020056 Create new downlink TBF.
57 Attach PDU to LLC Frame of TBF.
58 If uplink TBF exists for given TLLI, but not in RELEASING state:
59 Assign packet channel PACCH.
60 Done.
61 If uplink TBF does not exists for given TLLI, or in RELEASING state:
62 Assign packet channel AGCH.
63 Done.
64
65When channel request for uplink TBF is received:
66
67 Create new uplink TBF.
68 If channel request was received on RACH
69 Assign packet channel AGCH.
70 Done
71 If channel request was received on PACCH
72 Assign packet channel PACCH.
73 Done
74
75Handling of LLC Frame of downlink TBF and LLC Queue of downlink TBF:
76
77 If a downlink TBF is created, the LLC PDU is attached to LLC Frame of TBF
78 (downlink flow is assigned to MS).
79
80 If a downlink TBF exists, the LLC PDU is enqueued to LLC Queue of TBF.
81
82 During transfer of downlink blocks, the LLC Queue is dequeued whenever all
83 segments of LLC Frame were used for generation of downlink blocks. (If a
84 block is partly filled with LLC Frame segment, its remaining space is filled
85 with the next LLC Frame from the Queue.)
86
87 If the transfer is finished, no more LLC Frames are dequeued from the LLC
88 Queue, in case a new frame has arrived during lifetime of TBF.
89
90 If the all downlink blocks have been acknowledged, the LLC Queue is
91 dequeued and an existing frame is attached to LLC Frame. If so, the new
92 state is FLOW (downlink flow is assigned to MS), otherwise WAIT RELEASE.
93
94 If a new LLC PDU is attached to LLC Frame during WAIT RELEASE state, the
95 state is changed to FLOW (downlink flow is assigned to MS).
96
Andreas Eversberg592e04a2012-07-15 06:25:37 +020097
Andreas Eversberge6228b32012-07-03 13:36:03 +020098Handling of LLC Frame on uplink TBF:
99
100 Received uplink blocks are appended to LLC Frame of TBF. If the PDU is
101 complete, it is forwarded to the upper layer.
102
Andreas Eversberg592e04a2012-07-15 06:25:37 +0200103
104Control TS:
105 On uplink or downlink assignment, it is required to have one timeslot that
106 can be used to receive and transmit. This timeslot is used at uplink TBF
107 to acknowledge and to assign other TBF. This timeslot is used at downlink
108 TBF to poll acknowledgement and to assign other TBF.
109
110 The first common TS (first_common_ts) is calculated when channels are
111 allocated. After creation of TBF or after assignment to different TS layout,
112 the first common TS is used for control TS.
113
114 The first common TS (and so control TS) must not need to be allocated to
115 MS as uplink TBF. (E.g. in case of non-available USF for this slot)
116
117
Andreas Eversberge6228b32012-07-03 13:36:03 +0200118Polling:
119 In order to poll uplink control block from MS, a special poll state and
Pau Espin Pedrolf593fc52021-04-26 19:22:54 +0200120 frame number is stored at PDCH UL Controller. The scheduler reads that value
121 and will not assign uplink resource for other TBFs at that frame number.
Andreas Eversberge6228b32012-07-03 13:36:03 +0200122
Pau Espin Pedrolf593fc52021-04-26 19:22:54 +0200123 On receipt of an Uplink RLCMAC block, it's the duty of each specific message
124 handler to release the expectancies previously stored in the PDCH UL
125 Controller. After the specific handler returns, the generic return path will
126 expire all reserved events up to the curent FN for that PDCH, eventually
127 calling timeout functions on TBFs and SBAs owning those reservations. Hence,
128 the layer 1 interface is expected to provide DATA.ind for each FN block,
129 containing data=0 if decoding failed, in order to keep the clock up-to-date in
130 upper layers.
Andreas Eversberge6228b32012-07-03 13:36:03 +0200131
Andreas Eversberg592e04a2012-07-15 06:25:37 +0200132 Because polling requires uplink response from MS, the polling must be
133 performed at control TS.
134
135
Andreas Eversbergb0c7ea72012-07-13 14:46:03 +0200136Data structures of TBFs and PDCHs:
137
Pau Espin Pedrolf593fc52021-04-26 19:22:54 +0200138 There is a global structure for PCU (struct gprs_pcu the_pcu).
Andreas Eversbergb0c7ea72012-07-13 14:46:03 +0200139
Pau Espin Pedrolf593fc52021-04-26 19:22:54 +0200140 A BTS is created and put into PCU's list for each PCUIF INFO_IND with a unique
141 bts_nr received.
142
143 Each BTS structure has 8 TRX structures.
Andreas Eversbergb0c7ea72012-07-13 14:46:03 +0200144
145 Each TRX structure has 8 PDCH structures, one for each timeslot.
146
Pau Espin Pedrolf593fc52021-04-26 19:22:54 +0200147 Each BTS structure has a list of MS (struct GprsMs).
148
149 Each MS can have 1 UL TBF and 1 DL TBF, and 1 TBF is always assigned to an
150 existing GprsMS structure.
151
152 Each BTS also has two linked lists of TBF instances:
Andreas Eversbergb0c7ea72012-07-13 14:46:03 +0200153 - uplink TBFs
154 - downlink TBFs
155
156 Each TBF instance also has:
157 - a direction
158 - a TFI of range 0..31
159 - an array of 8 PDCH structures, one for each assigned timeslot
160 - in case of uplink TBF: an array of 8 USFs, one for each assigned timeslot
161
Andreas Eversberg5b8a5282012-11-04 12:48:39 +0100162 Each TRX and all it's PDCH structures also have:
Andreas Eversbergb0c7ea72012-07-13 14:46:03 +0200163 - an array of 32 uplink TBFs that are assigned to this PDCH
164 - an array of 32 downlink TBFs that are assigned to this PDCH
165
166 On creation of a new TBF, it links to all assigned PDCHs.
167 Each PDCH links to that TBF. The TBF is added to the list of TBFs.
168 In case of uplink TBF: The allocated USFs are stored for each timeslot.
169
170 On release of a TBF, the link to this PDCH is removed from all assigned
171 PDCHs. The TBF is removed from the list of TBFs. The TBF is destroyed.
172
Pau Espin Pedrolf593fc52021-04-26 19:22:54 +0200173 GprsMs structures are kept alive for a while once they become unused, in order to
174 have a cache of MS related information it would otherwise need to acquire
175 again once it interacts with the PCU again.