Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 1 | /* encoding.cpp |
| 2 | * |
| 3 | * Copyright (C) 2012 Ivan Klyuchnikov |
| 4 | * Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu> |
| 5 | * Copyright (C) 2013 by Holger Hans Peter Freyther |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License |
| 9 | * as published by the Free Software Foundation; either version 2 |
| 10 | * of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | |
Holger Hans Peter Freyther | 63f29d6 | 2013-10-19 19:04:03 +0200 | [diff] [blame] | 22 | #include <encoding.h> |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 23 | #include <gprs_rlcmac.h> |
Holger Hans Peter Freyther | 34bd8bd | 2013-10-19 21:10:38 +0200 | [diff] [blame] | 24 | #include <bts.h> |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 25 | #include <tbf.h> |
| 26 | #include <gprs_debug.h> |
| 27 | |
Jacob Erlbeck | f0e4039 | 2016-01-08 10:07:53 +0100 | [diff] [blame] | 28 | #include <errno.h> |
| 29 | #include <string.h> |
| 30 | |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 31 | // GSM 04.08 9.1.18 Immediate assignment |
Holger Hans Peter Freyther | 63f29d6 | 2013-10-19 19:04:03 +0200 | [diff] [blame] | 32 | int Encoding::write_immediate_assignment( |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 33 | struct gprs_rlcmac_bts *bts, |
| 34 | bitvec * dest, uint8_t downlink, uint8_t ra, |
| 35 | uint32_t ref_fn, uint8_t ta, uint16_t arfcn, uint8_t ts, uint8_t tsc, |
| 36 | uint8_t tfi, uint8_t usf, uint32_t tlli, |
| 37 | uint8_t polling, uint32_t fn, uint8_t single_block, uint8_t alpha, |
| 38 | uint8_t gamma, int8_t ta_idx) |
| 39 | { |
| 40 | unsigned wp = 0; |
| 41 | uint8_t plen; |
| 42 | |
| 43 | bitvec_write_field(dest, wp,0x0,4); // Skip Indicator |
| 44 | bitvec_write_field(dest, wp,0x6,4); // Protocol Discriminator |
| 45 | bitvec_write_field(dest, wp,0x3F,8); // Immediate Assignment Message Type |
| 46 | |
| 47 | // 10.5.2.25b Dedicated mode or TBF |
| 48 | bitvec_write_field(dest, wp,0x0,1); // spare |
| 49 | bitvec_write_field(dest, wp,0x0,1); // TMA : Two-message assignment: No meaning |
| 50 | bitvec_write_field(dest, wp,downlink,1); // Downlink : Downlink assignment to mobile in packet idle mode |
| 51 | bitvec_write_field(dest, wp,0x1,1); // T/D : TBF or dedicated mode: this message assigns a Temporary Block Flow (TBF). |
| 52 | |
| 53 | bitvec_write_field(dest, wp,0x0,4); // Page Mode |
| 54 | |
| 55 | // GSM 04.08 10.5.2.25a Packet Channel Description |
| 56 | bitvec_write_field(dest, wp,0x1,5); // Channel type |
| 57 | bitvec_write_field(dest, wp,ts,3); // TN |
| 58 | bitvec_write_field(dest, wp,tsc,3); // TSC |
| 59 | bitvec_write_field(dest, wp,0x0,3); // non-hopping RF channel configuraion |
| 60 | bitvec_write_field(dest, wp,arfcn,10); // ARFCN |
| 61 | |
| 62 | //10.5.2.30 Request Reference |
| 63 | bitvec_write_field(dest, wp,ra,8); // RA |
| 64 | bitvec_write_field(dest, wp,(ref_fn / (26 * 51)) % 32,5); // T1' |
| 65 | bitvec_write_field(dest, wp,ref_fn % 51,6); // T3 |
| 66 | bitvec_write_field(dest, wp,ref_fn % 26,5); // T2 |
| 67 | |
| 68 | // 10.5.2.40 Timing Advance |
| 69 | bitvec_write_field(dest, wp,0x0,2); // spare |
| 70 | bitvec_write_field(dest, wp,ta,6); // Timing Advance value |
| 71 | |
| 72 | // No mobile allocation in non-hopping systems. |
| 73 | // A zero-length LV. Just write L=0. |
| 74 | bitvec_write_field(dest, wp,0,8); |
| 75 | |
| 76 | if ((wp % 8)) { |
| 77 | LOGP(DRLCMACUL, LOGL_ERROR, "Length of IMM.ASS without rest " |
| 78 | "octets is not multiple of 8 bits, PLEASE FIX!\n"); |
| 79 | exit (0); |
| 80 | } |
| 81 | plen = wp / 8; |
| 82 | |
| 83 | if (downlink) |
| 84 | { |
| 85 | // GSM 04.08 10.5.2.16 IA Rest Octets |
| 86 | bitvec_write_field(dest, wp, 3, 2); // "HH" |
| 87 | bitvec_write_field(dest, wp, 1, 2); // "01" Packet Downlink Assignment |
| 88 | bitvec_write_field(dest, wp,tlli,32); // TLLI |
| 89 | bitvec_write_field(dest, wp,0x1,1); // switch TFI : on |
| 90 | bitvec_write_field(dest, wp,tfi,5); // TFI |
| 91 | bitvec_write_field(dest, wp,0x0,1); // RLC acknowledged mode |
| 92 | if (alpha) { |
| 93 | bitvec_write_field(dest, wp,0x1,1); // ALPHA = present |
| 94 | bitvec_write_field(dest, wp,alpha,4); // ALPHA |
| 95 | } else { |
| 96 | bitvec_write_field(dest, wp,0x0,1); // ALPHA = not present |
| 97 | } |
| 98 | bitvec_write_field(dest, wp,gamma,5); // GAMMA power control parameter |
| 99 | bitvec_write_field(dest, wp,polling,1); // Polling Bit |
| 100 | bitvec_write_field(dest, wp,!polling,1); // TA_VALID ??? |
| 101 | if (ta_idx < 0) { |
| 102 | bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off |
| 103 | } else { |
| 104 | bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on |
| 105 | bitvec_write_field(dest, wp,ta_idx,4); // TIMING_ADVANCE_INDEX |
| 106 | } |
| 107 | if (polling) { |
| 108 | bitvec_write_field(dest, wp,0x1,1); // TBF Starting TIME present |
| 109 | bitvec_write_field(dest, wp,(fn / (26 * 51)) % 32,5); // T1' |
| 110 | bitvec_write_field(dest, wp,fn % 51,6); // T3 |
| 111 | bitvec_write_field(dest, wp,fn % 26,5); // T2 |
| 112 | } else { |
| 113 | bitvec_write_field(dest, wp,0x0,1); // TBF Starting TIME present |
| 114 | } |
| 115 | bitvec_write_field(dest, wp,0x0,1); // P0 not present |
| 116 | // bitvec_write_field(dest, wp,0x1,1); // P0 not present |
| 117 | // bitvec_write_field(dest, wp,0xb,4); |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | // GMS 04.08 10.5.2.37b 10.5.2.16 |
| 122 | bitvec_write_field(dest, wp, 3, 2); // "HH" |
| 123 | bitvec_write_field(dest, wp, 0, 2); // "0" Packet Uplink Assignment |
| 124 | if (single_block) { |
| 125 | bitvec_write_field(dest, wp, 0, 1); // Block Allocation : Single Block Allocation |
| 126 | if (alpha) { |
| 127 | bitvec_write_field(dest, wp,0x1,1); // ALPHA = present |
| 128 | bitvec_write_field(dest, wp,alpha,4); // ALPHA = present |
| 129 | } else |
| 130 | bitvec_write_field(dest, wp,0x0,1); // ALPHA = not present |
| 131 | bitvec_write_field(dest, wp,gamma,5); // GAMMA power control parameter |
| 132 | if (ta_idx < 0) { |
| 133 | bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off |
| 134 | } else { |
| 135 | bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on |
| 136 | bitvec_write_field(dest, wp,ta_idx,4); // TIMING_ADVANCE_INDEX |
| 137 | } |
| 138 | bitvec_write_field(dest, wp, 1, 1); // TBF_STARTING_TIME_FLAG |
| 139 | bitvec_write_field(dest, wp,(fn / (26 * 51)) % 32,5); // T1' |
| 140 | bitvec_write_field(dest, wp,fn % 51,6); // T3 |
| 141 | bitvec_write_field(dest, wp,fn % 26,5); // T2 |
| 142 | } else { |
| 143 | bitvec_write_field(dest, wp, 1, 1); // Block Allocation : Not Single Block Allocation |
| 144 | bitvec_write_field(dest, wp, tfi, 5); // TFI_ASSIGNMENT Temporary Flow Identity |
| 145 | bitvec_write_field(dest, wp, 0, 1); // POLLING |
| 146 | bitvec_write_field(dest, wp, 0, 1); // ALLOCATION_TYPE: dynamic |
| 147 | bitvec_write_field(dest, wp, usf, 3); // USF |
| 148 | bitvec_write_field(dest, wp, 0, 1); // USF_GRANULARITY |
| 149 | bitvec_write_field(dest, wp, 0, 1); // "0" power control: Not Present |
| 150 | bitvec_write_field(dest, wp, bts->initial_cs_ul-1, 2); // CHANNEL_CODING_COMMAND |
| 151 | bitvec_write_field(dest, wp, 1, 1); // TLLI_BLOCK_CHANNEL_CODING |
| 152 | if (alpha) { |
| 153 | bitvec_write_field(dest, wp,0x1,1); // ALPHA = present |
| 154 | bitvec_write_field(dest, wp,alpha,4); // ALPHA |
| 155 | } else |
| 156 | bitvec_write_field(dest, wp,0x0,1); // ALPHA = not present |
| 157 | bitvec_write_field(dest, wp,gamma,5); // GAMMA power control parameter |
| 158 | /* note: there is no choise for TAI and no starting time */ |
| 159 | bitvec_write_field(dest, wp, 0, 1); // switch TIMING_ADVANCE_INDEX = off |
| 160 | bitvec_write_field(dest, wp, 0, 1); // TBF_STARTING_TIME_FLAG |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | return plen; |
| 165 | } |
| 166 | |
| 167 | /* generate uplink assignment */ |
Holger Hans Peter Freyther | 63f29d6 | 2013-10-19 19:04:03 +0200 | [diff] [blame] | 168 | void Encoding::write_packet_uplink_assignment( |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 169 | struct gprs_rlcmac_bts *bts, |
| 170 | bitvec * dest, uint8_t old_tfi, |
| 171 | uint8_t old_downlink, uint32_t tlli, uint8_t use_tlli, |
Jacob Erlbeck | f2694b7 | 2016-01-26 21:46:26 +0100 | [diff] [blame] | 172 | struct gprs_rlcmac_ul_tbf *tbf, uint8_t poll, uint8_t rrbp, uint8_t alpha, |
Jacob Erlbeck | 76d767c | 2015-09-28 18:54:32 +0200 | [diff] [blame] | 173 | uint8_t gamma, int8_t ta_idx, int8_t use_egprs) |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 174 | { |
| 175 | // TODO We should use our implementation of encode RLC/MAC Control messages. |
| 176 | unsigned wp = 0; |
| 177 | uint8_t ts; |
| 178 | |
| 179 | bitvec_write_field(dest, wp,0x1,2); // Payload Type |
| 180 | bitvec_write_field(dest, wp,0x0,2); // Uplink block with TDMA framenumber (N+13) |
| 181 | bitvec_write_field(dest, wp,poll,1); // Suppl/Polling Bit |
| 182 | bitvec_write_field(dest, wp,0x0,3); // Uplink state flag |
| 183 | bitvec_write_field(dest, wp,0xa,6); // MESSAGE TYPE |
| 184 | |
| 185 | bitvec_write_field(dest, wp,0x0,2); // Page Mode |
| 186 | |
| 187 | bitvec_write_field(dest, wp,0x0,1); // switch PERSIST_LEVEL: off |
| 188 | if (use_tlli) { |
| 189 | bitvec_write_field(dest, wp,0x2,2); // switch TLLI : on |
| 190 | bitvec_write_field(dest, wp,tlli,32); // TLLI |
| 191 | } else { |
| 192 | bitvec_write_field(dest, wp,0x0,1); // switch TFI : on |
| 193 | bitvec_write_field(dest, wp,old_downlink,1); // 0=UPLINK TFI, 1=DL TFI |
| 194 | bitvec_write_field(dest, wp,old_tfi,5); // TFI |
| 195 | } |
| 196 | |
Jacob Erlbeck | 76d767c | 2015-09-28 18:54:32 +0200 | [diff] [blame] | 197 | if (!use_egprs) { |
| 198 | bitvec_write_field(dest, wp,0x0,1); // Message escape |
Jacob Erlbeck | cb72890 | 2016-01-05 15:33:03 +0100 | [diff] [blame] | 199 | bitvec_write_field(dest, wp,tbf->current_cs().to_num()-1, 2); // CHANNEL_CODING_COMMAND |
Jacob Erlbeck | 76d767c | 2015-09-28 18:54:32 +0200 | [diff] [blame] | 200 | bitvec_write_field(dest, wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING |
| 201 | bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on |
| 202 | bitvec_write_field(dest, wp,tbf->ta(),6); // TIMING_ADVANCE_VALUE |
| 203 | if (ta_idx < 0) { |
| 204 | bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off |
| 205 | } else { |
| 206 | bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on |
| 207 | bitvec_write_field(dest, wp,ta_idx,4); // TIMING_ADVANCE_INDEX |
| 208 | } |
| 209 | |
| 210 | } else { /* EPGRS */ |
Jacob Erlbeck | 36df774 | 2016-01-19 15:53:30 +0100 | [diff] [blame] | 211 | unsigned int ws_enc = (tbf->m_window.ws() - 64) / 32; |
Jacob Erlbeck | 76d767c | 2015-09-28 18:54:32 +0200 | [diff] [blame] | 212 | bitvec_write_field(dest, wp,0x1,1); // Message escape |
| 213 | bitvec_write_field(dest, wp,0x0,2); // EGPRS message contents |
| 214 | bitvec_write_field(dest, wp,0x0,1); // No CONTENTION_RESOLUTION_TLLI |
| 215 | bitvec_write_field(dest, wp,0x0,1); // No COMPACT reduced MA |
Jacob Erlbeck | cb72890 | 2016-01-05 15:33:03 +0100 | [diff] [blame] | 216 | bitvec_write_field(dest, wp,tbf->current_cs().to_num()-1, 4); // EGPRS Modulation and Coding IE |
Jacob Erlbeck | 76d767c | 2015-09-28 18:54:32 +0200 | [diff] [blame] | 217 | bitvec_write_field(dest, wp,0x0,1); // No RESEGMENT |
Jacob Erlbeck | 36df774 | 2016-01-19 15:53:30 +0100 | [diff] [blame] | 218 | bitvec_write_field(dest, wp,ws_enc,5); // EGPRS Window Size |
Jacob Erlbeck | 76d767c | 2015-09-28 18:54:32 +0200 | [diff] [blame] | 219 | bitvec_write_field(dest, wp,0x0,1); // No Access Technologies Request |
| 220 | bitvec_write_field(dest, wp,0x0,1); // No ARAC RETRANSMISSION REQUEST |
| 221 | bitvec_write_field(dest, wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING |
| 222 | bitvec_write_field(dest, wp,0x0,1); // No BEP_PERIOD2 |
| 223 | |
| 224 | bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on |
| 225 | bitvec_write_field(dest, wp,tbf->ta(),6); // TIMING_ADVANCE_VALUE |
| 226 | if (ta_idx < 0) { |
| 227 | bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off |
| 228 | } else { |
| 229 | bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on |
| 230 | bitvec_write_field(dest, wp,ta_idx,4); // TIMING_ADVANCE_INDEX |
| 231 | } |
| 232 | |
| 233 | bitvec_write_field(dest, wp,0x0,1); // No Packet Extended Timing Advance |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | #if 1 |
| 237 | bitvec_write_field(dest, wp,0x1,1); // Frequency Parameters information elements = present |
Holger Hans Peter Freyther | 8f399de | 2013-12-25 20:22:35 +0100 | [diff] [blame] | 238 | bitvec_write_field(dest, wp,tbf->tsc(),3); // Training Sequence Code (TSC) |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 239 | bitvec_write_field(dest, wp,0x0,2); // ARFCN = present |
Holger Hans Peter Freyther | fc498c9 | 2013-10-27 13:38:54 +0100 | [diff] [blame] | 240 | bitvec_write_field(dest, wp,tbf->trx->arfcn,10); // ARFCN |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 241 | #else |
| 242 | bitvec_write_field(dest, wp,0x0,1); // Frequency Parameters = off |
| 243 | #endif |
| 244 | |
| 245 | bitvec_write_field(dest, wp,0x1,2); // Dynamic Allocation |
Jacob Erlbeck | edfd7e3 | 2015-11-17 16:30:58 +0100 | [diff] [blame] | 246 | |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 247 | bitvec_write_field(dest, wp,0x0,1); // Extended Dynamic Allocation = off |
| 248 | bitvec_write_field(dest, wp,0x0,1); // P0 = off |
Jacob Erlbeck | edfd7e3 | 2015-11-17 16:30:58 +0100 | [diff] [blame] | 249 | |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 250 | bitvec_write_field(dest, wp,0x0,1); // USF_GRANULARITY |
| 251 | bitvec_write_field(dest, wp,0x1,1); // switch TFI : on |
Holger Hans Peter Freyther | 34f6e5e | 2013-10-27 20:31:47 +0100 | [diff] [blame] | 252 | bitvec_write_field(dest, wp,tbf->tfi(),5);// TFI |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 253 | |
| 254 | bitvec_write_field(dest, wp,0x0,1); // |
| 255 | bitvec_write_field(dest, wp,0x0,1); // TBF Starting Time = off |
| 256 | if (alpha || gamma) { |
| 257 | bitvec_write_field(dest, wp,0x1,1); // Timeslot Allocation with Power Control |
| 258 | bitvec_write_field(dest, wp,alpha,4); // ALPHA |
| 259 | } else |
| 260 | bitvec_write_field(dest, wp,0x0,1); // Timeslot Allocation |
Jacob Erlbeck | edfd7e3 | 2015-11-17 16:30:58 +0100 | [diff] [blame] | 261 | |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 262 | for (ts = 0; ts < 8; ts++) { |
| 263 | if (tbf->pdch[ts]) { |
| 264 | bitvec_write_field(dest, wp,0x1,1); // USF_TN(i): on |
Daniel Willmann | 7e994e3 | 2014-08-07 15:49:21 +0200 | [diff] [blame] | 265 | bitvec_write_field(dest, wp,tbf->m_usf[ts],3); // USF_TN(i) |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 266 | if (alpha || gamma) |
| 267 | bitvec_write_field(dest, wp,gamma,5); // GAMMA power control parameter |
| 268 | } else |
| 269 | bitvec_write_field(dest, wp,0x0,1); // USF_TN(i): off |
| 270 | } |
Jacob Erlbeck | edfd7e3 | 2015-11-17 16:30:58 +0100 | [diff] [blame] | 271 | // bitvec_write_field(dest, wp,0x0,1); // Measurement Mapping struct not present |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | |
| 275 | /* generate downlink assignment */ |
Jacob Erlbeck | 166c9fc | 2016-01-07 16:04:29 +0100 | [diff] [blame] | 276 | void Encoding::write_packet_downlink_assignment(RlcMacDownlink_t * block, |
Jacob Erlbeck | 6b356a5 | 2016-01-29 16:39:21 +0100 | [diff] [blame] | 277 | bool old_tfi_is_valid, uint8_t old_tfi, uint8_t old_downlink, |
| 278 | struct gprs_rlcmac_tbf *tbf, uint8_t poll, uint8_t rrbp, |
| 279 | uint8_t alpha, uint8_t gamma, int8_t ta_idx, |
Jacob Erlbeck | f2694b7 | 2016-01-26 21:46:26 +0100 | [diff] [blame] | 280 | uint8_t ta_ts, bool use_egprs) |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 281 | { |
| 282 | // Packet downlink assignment TS 44.060 11.2.7 |
| 283 | |
Jacob Erlbeck | 166c9fc | 2016-01-07 16:04:29 +0100 | [diff] [blame] | 284 | PDA_AdditionsR99_t *pda_r99; |
| 285 | |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 286 | uint8_t tn; |
Jacob Erlbeck | 36df774 | 2016-01-19 15:53:30 +0100 | [diff] [blame] | 287 | unsigned int ws_enc; |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 288 | |
| 289 | block->PAYLOAD_TYPE = 0x1; // RLC/MAC control block that does not include the optional octets of the RLC/MAC control header |
Jacob Erlbeck | f2694b7 | 2016-01-26 21:46:26 +0100 | [diff] [blame] | 290 | block->RRBP = rrbp; // 0: N+13 |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 291 | block->SP = poll; // RRBP field is valid |
| 292 | block->USF = 0x0; // Uplink state flag |
| 293 | |
| 294 | block->u.Packet_Downlink_Assignment.MESSAGE_TYPE = 0x2; // Packet Downlink Assignment |
| 295 | block->u.Packet_Downlink_Assignment.PAGE_MODE = 0x0; // Normal Paging |
| 296 | |
| 297 | block->u.Packet_Downlink_Assignment.Exist_PERSISTENCE_LEVEL = 0x0; // PERSISTENCE_LEVEL: off |
| 298 | |
Jacob Erlbeck | 6b356a5 | 2016-01-29 16:39:21 +0100 | [diff] [blame] | 299 | if (old_tfi_is_valid) { |
| 300 | block->u.Packet_Downlink_Assignment.ID.UnionType = 0x0; // TFI = on |
| 301 | block->u.Packet_Downlink_Assignment.ID.u.Global_TFI.UnionType = old_downlink; // 0=UPLINK TFI, 1=DL TFI |
| 302 | block->u.Packet_Downlink_Assignment.ID.u.Global_TFI.u.UPLINK_TFI = old_tfi; // TFI |
| 303 | } else { |
| 304 | block->u.Packet_Downlink_Assignment.ID.UnionType = 0x1; // TLLI |
| 305 | block->u.Packet_Downlink_Assignment.ID.u.TLLI = tbf->tlli(); |
| 306 | } |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 307 | |
| 308 | block->u.Packet_Downlink_Assignment.MAC_MODE = 0x0; // Dynamic Allocation |
| 309 | block->u.Packet_Downlink_Assignment.RLC_MODE = 0x0; // RLC acknowledged mode |
Daniel Willmann | 73191a4 | 2014-05-30 17:58:00 +0200 | [diff] [blame] | 310 | block->u.Packet_Downlink_Assignment.CONTROL_ACK = tbf->was_releasing; // NW establishes no new DL TBF for the MS with running timer T3192 |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 311 | block->u.Packet_Downlink_Assignment.TIMESLOT_ALLOCATION = 0; // timeslot(s) |
| 312 | for (tn = 0; tn < 8; tn++) { |
| 313 | if (tbf->pdch[tn]) |
| 314 | block->u.Packet_Downlink_Assignment.TIMESLOT_ALLOCATION |= 0x80 >> tn; // timeslot(s) |
| 315 | } |
| 316 | |
| 317 | block->u.Packet_Downlink_Assignment.Packet_Timing_Advance.Exist_TIMING_ADVANCE_VALUE = 0x1; // TIMING_ADVANCE_VALUE = on |
Jacob Erlbeck | 9200ce6 | 2015-05-22 17:48:04 +0200 | [diff] [blame] | 318 | block->u.Packet_Downlink_Assignment.Packet_Timing_Advance.TIMING_ADVANCE_VALUE = tbf->ta(); // TIMING_ADVANCE_VALUE |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 319 | if (ta_idx < 0) { |
| 320 | block->u.Packet_Downlink_Assignment.Packet_Timing_Advance.Exist_IndexAndtimeSlot = 0x0; // TIMING_ADVANCE_INDEX = off |
| 321 | } else { |
| 322 | block->u.Packet_Downlink_Assignment.Packet_Timing_Advance.Exist_IndexAndtimeSlot = 0x1; // TIMING_ADVANCE_INDEX = on |
| 323 | block->u.Packet_Downlink_Assignment.Packet_Timing_Advance.TIMING_ADVANCE_INDEX = ta_idx; // TIMING_ADVANCE_INDEX |
| 324 | block->u.Packet_Downlink_Assignment.Packet_Timing_Advance.TIMING_ADVANCE_TIMESLOT_NUMBER = ta_ts; // TIMING_ADVANCE_TS |
| 325 | } |
| 326 | |
| 327 | block->u.Packet_Downlink_Assignment.Exist_P0_and_BTS_PWR_CTRL_MODE = 0x0; // POWER CONTROL = off |
| 328 | |
| 329 | block->u.Packet_Downlink_Assignment.Exist_Frequency_Parameters = 0x1; // Frequency Parameters = on |
Holger Hans Peter Freyther | 8f399de | 2013-12-25 20:22:35 +0100 | [diff] [blame] | 330 | block->u.Packet_Downlink_Assignment.Frequency_Parameters.TSC = tbf->tsc(); // Training Sequence Code (TSC) |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 331 | block->u.Packet_Downlink_Assignment.Frequency_Parameters.UnionType = 0x0; // ARFCN = on |
Holger Hans Peter Freyther | fc498c9 | 2013-10-27 13:38:54 +0100 | [diff] [blame] | 332 | block->u.Packet_Downlink_Assignment.Frequency_Parameters.u.ARFCN = tbf->trx->arfcn; // ARFCN |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 333 | |
| 334 | block->u.Packet_Downlink_Assignment.Exist_DOWNLINK_TFI_ASSIGNMENT = 0x1; // DOWNLINK TFI ASSIGNMENT = on |
Holger Hans Peter Freyther | 34f6e5e | 2013-10-27 20:31:47 +0100 | [diff] [blame] | 335 | block->u.Packet_Downlink_Assignment.DOWNLINK_TFI_ASSIGNMENT = tbf->tfi(); // TFI |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 336 | |
| 337 | block->u.Packet_Downlink_Assignment.Exist_Power_Control_Parameters = 0x1; // Power Control Parameters = on |
| 338 | block->u.Packet_Downlink_Assignment.Power_Control_Parameters.ALPHA = alpha; // ALPHA |
| 339 | |
| 340 | for (tn = 0; tn < 8; tn++) |
| 341 | { |
| 342 | if (tbf->pdch[tn]) |
| 343 | { |
| 344 | block->u.Packet_Downlink_Assignment.Power_Control_Parameters.Slot[tn].Exist = 0x1; // Slot[i] = on |
| 345 | block->u.Packet_Downlink_Assignment.Power_Control_Parameters.Slot[tn].GAMMA_TN = gamma; // GAMMA_TN |
| 346 | } |
| 347 | else |
| 348 | { |
| 349 | block->u.Packet_Downlink_Assignment.Power_Control_Parameters.Slot[tn].Exist = 0x0; // Slot[i] = off |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | block->u.Packet_Downlink_Assignment.Exist_TBF_Starting_Time = 0x0; // TBF Starting TIME = off |
| 354 | block->u.Packet_Downlink_Assignment.Exist_Measurement_Mapping = 0x0; // Measurement_Mapping = off |
Jacob Erlbeck | 166c9fc | 2016-01-07 16:04:29 +0100 | [diff] [blame] | 355 | if (!use_egprs) { |
| 356 | block->u.Packet_Downlink_Assignment.Exist_AdditionsR99 = 0x0; // AdditionsR99 = off |
| 357 | return; |
| 358 | } |
Jacob Erlbeck | 36df774 | 2016-01-19 15:53:30 +0100 | [diff] [blame] | 359 | |
| 360 | ws_enc = (tbf->window()->ws() - 64) / 32; |
| 361 | |
Jacob Erlbeck | 166c9fc | 2016-01-07 16:04:29 +0100 | [diff] [blame] | 362 | block->u.Packet_Downlink_Assignment.Exist_AdditionsR99 = 0x1; // AdditionsR99 = on |
| 363 | pda_r99 = &block->u.Packet_Downlink_Assignment.AdditionsR99; |
| 364 | pda_r99->Exist_EGPRS_Params = 1; |
Jacob Erlbeck | 36df774 | 2016-01-19 15:53:30 +0100 | [diff] [blame] | 365 | pda_r99->EGPRS_WindowSize = ws_enc; /* see TS 44.060, table 12.5.2.1 */ |
Jacob Erlbeck | 166c9fc | 2016-01-07 16:04:29 +0100 | [diff] [blame] | 366 | pda_r99->LINK_QUALITY_MEASUREMENT_MODE = 0x0; /* no meas, see TS 44.060, table 11.2.7.2 */ |
| 367 | pda_r99->Exist_BEP_PERIOD2 = 0; /* No extra EGPRS BEP PERIOD */ |
| 368 | pda_r99->Exist_Packet_Extended_Timing_Advance = 0; |
| 369 | pda_r99->Exist_COMPACT_ReducedMA = 0; |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 370 | } |
| 371 | |
| 372 | /* generate paging request */ |
Holger Hans Peter Freyther | 63f29d6 | 2013-10-19 19:04:03 +0200 | [diff] [blame] | 373 | int Encoding::write_paging_request(bitvec * dest, uint8_t *ptmsi, uint16_t ptmsi_len) |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 374 | { |
| 375 | unsigned wp = 0; |
| 376 | int plen; |
| 377 | |
| 378 | bitvec_write_field(dest, wp,0x0,4); // Skip Indicator |
| 379 | bitvec_write_field(dest, wp,0x6,4); // Protocol Discriminator |
| 380 | bitvec_write_field(dest, wp,0x21,8); // Paging Request Message Type |
| 381 | |
| 382 | bitvec_write_field(dest, wp,0x0,4); // Page Mode |
| 383 | bitvec_write_field(dest, wp,0x0,4); // Channel Needed |
| 384 | |
| 385 | // Mobile Identity |
| 386 | bitvec_write_field(dest, wp,ptmsi_len+1,8); // Mobile Identity length |
| 387 | bitvec_write_field(dest, wp,0xf,4); // unused |
| 388 | bitvec_write_field(dest, wp,0x4,4); // PTMSI type |
| 389 | for (int i = 0; i < ptmsi_len; i++) |
| 390 | { |
| 391 | bitvec_write_field(dest, wp,ptmsi[i],8); // PTMSI |
| 392 | } |
| 393 | if ((wp % 8)) { |
| 394 | LOGP(DRLCMACUL, LOGL_ERROR, "Length of PAG.REQ without rest " |
| 395 | "octets is not multiple of 8 bits, PLEASE FIX!\n"); |
| 396 | exit (0); |
| 397 | } |
| 398 | plen = wp / 8; |
| 399 | bitvec_write_field(dest, wp,0x0,1); // "L" NLN(PCH) = off |
| 400 | bitvec_write_field(dest, wp,0x0,1); // "L" Priority1 = off |
| 401 | bitvec_write_field(dest, wp,0x1,1); // "L" Priority2 = off |
| 402 | bitvec_write_field(dest, wp,0x0,1); // "L" Group Call information = off |
| 403 | bitvec_write_field(dest, wp,0x0,1); // "H" Packet Page Indication 1 = packet paging procedure |
| 404 | bitvec_write_field(dest, wp,0x1,1); // "H" Packet Page Indication 2 = packet paging procedure |
| 405 | |
| 406 | return plen; |
| 407 | } |
| 408 | |
Daniel Willmann | 5241c1a | 2013-12-11 14:35:29 +0100 | [diff] [blame] | 409 | /** |
| 410 | * The index of the array show_rbb is the bit position inside the rbb |
| 411 | * (show_rbb[63] relates to BSN ssn-1) |
| 412 | */ |
| 413 | void Encoding::encode_rbb(const char *show_rbb, uint8_t *rbb) |
| 414 | { |
| 415 | uint8_t rbb_byte = 0; |
| 416 | |
| 417 | // RECEIVE_BLOCK_BITMAP |
| 418 | for (int i = 0; i < 64; i++) { |
| 419 | /* Set bit at the appropriate position (see 3GPP TS 04.60 9.1.8.1) */ |
| 420 | if (show_rbb[i] == 'R') |
| 421 | rbb_byte |= 1<< (7-(i%8)); |
| 422 | |
| 423 | if((i%8) == 7) { |
| 424 | rbb[i/8] = rbb_byte; |
| 425 | rbb_byte = 0; |
| 426 | } |
| 427 | } |
| 428 | } |
| 429 | |
Jacob Erlbeck | 37005a1 | 2015-12-22 14:58:34 +0100 | [diff] [blame] | 430 | static void write_packet_ack_nack_desc_gprs( |
| 431 | struct gprs_rlcmac_bts *bts, bitvec * dest, unsigned& wp, |
| 432 | gprs_rlc_ul_window *window, bool is_final) |
| 433 | { |
| 434 | char rbb[65]; |
| 435 | |
| 436 | window->update_rbb(rbb); |
| 437 | |
| 438 | rbb[64] = 0; |
| 439 | LOGP(DRLCMACUL, LOGL_DEBUG, "- V(N): \"%s\" R=Received " |
| 440 | "I=Invalid\n", rbb); |
| 441 | |
| 442 | bitvec_write_field(dest, wp, is_final, 1); // FINAL_ACK_INDICATION |
| 443 | bitvec_write_field(dest, wp, window->ssn(), 7); // STARTING_SEQUENCE_NUMBER |
| 444 | |
| 445 | for (int i = 0; i < 64; i++) { |
| 446 | /* Set bit at the appropriate position (see 3GPP TS 04.60 9.1.8.1) */ |
| 447 | bool is_ack = (rbb[i] == 'R'); |
| 448 | bitvec_write_field(dest, wp, is_ack, 1); |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | static void write_packet_uplink_ack_gprs( |
| 453 | struct gprs_rlcmac_bts *bts, bitvec * dest, unsigned& wp, |
| 454 | struct gprs_rlcmac_ul_tbf *tbf, bool is_final) |
| 455 | { |
| 456 | |
Jacob Erlbeck | cb72890 | 2016-01-05 15:33:03 +0100 | [diff] [blame] | 457 | bitvec_write_field(dest, wp, tbf->current_cs().to_num() - 1, 2); // CHANNEL_CODING_COMMAND |
Jacob Erlbeck | 37005a1 | 2015-12-22 14:58:34 +0100 | [diff] [blame] | 458 | write_packet_ack_nack_desc_gprs(bts, dest, wp, &tbf->m_window, is_final); |
| 459 | |
| 460 | bitvec_write_field(dest, wp, 1, 1); // 1: have CONTENTION_RESOLUTION_TLLI |
| 461 | bitvec_write_field(dest, wp, tbf->tlli(), 32); // CONTENTION_RESOLUTION_TLLI |
| 462 | |
| 463 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have Packet Timing Advance |
| 464 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have Power Control Parameters |
| 465 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have Extension Bits |
| 466 | bitvec_write_field(dest, wp, 0, 1); // fixed 0 |
| 467 | bitvec_write_field(dest, wp, 1, 1); // 1: have Additions R99 |
| 468 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have Packet Extended Timing Advance |
| 469 | bitvec_write_field(dest, wp, 1, 1); // TBF_EST (enabled) |
| 470 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have REL 5 |
| 471 | }; |
| 472 | |
| 473 | static void write_packet_ack_nack_desc_egprs( |
| 474 | struct gprs_rlcmac_bts *bts, bitvec * dest, unsigned& wp, |
| 475 | gprs_rlc_ul_window *window, bool is_final) |
| 476 | { |
| 477 | int urbb_len = 0; |
| 478 | int crbb_len = 0; |
| 479 | int len; |
| 480 | bool bow = true; |
| 481 | bool eow = true; |
| 482 | int ssn = window->mod_sns(window->v_q() + 1); |
| 483 | int num_blocks = window->mod_sns(window->v_r() - window->v_q()); |
| 484 | int esn_crbb = window->mod_sns(ssn - 1); |
| 485 | int rest_bits = dest->data_len * 8 - wp; |
| 486 | |
| 487 | if (num_blocks > 0) |
| 488 | /* V(Q) is NACK and omitted -> SSN = V(Q) + 1 */ |
| 489 | num_blocks -= 1; |
| 490 | |
| 491 | if (num_blocks > window->ws()) |
| 492 | num_blocks = window->ws(); |
| 493 | |
| 494 | if (num_blocks > rest_bits) { |
| 495 | eow = false; |
| 496 | urbb_len = rest_bits; |
| 497 | /* TODO: use compression, start encoding bits and stop when the |
| 498 | * space is exhausted. Use the first combination that encodes |
| 499 | * all bits. If there is none, use the combination that encodes |
| 500 | * the largest number of bits (e.g. by setting num_blocks to the |
| 501 | * max and repeating the construction). |
| 502 | */ |
| 503 | } else if (num_blocks > rest_bits - 9) { |
| 504 | /* union bit and length field take 9 bits */ |
| 505 | eow = false; |
| 506 | urbb_len = rest_bits - 9; |
| 507 | /* TODO: use compression (see above) */ |
| 508 | } |
| 509 | |
| 510 | if (urbb_len + crbb_len == rest_bits) |
| 511 | len = -1; |
| 512 | else if (crbb_len == 0) |
| 513 | len = urbb_len + 15; |
| 514 | else |
| 515 | len = urbb_len + crbb_len + 23; |
| 516 | |
| 517 | /* EGPRS Ack/Nack Description IE */ |
| 518 | if (len < 0) { |
| 519 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have length |
| 520 | } else { |
| 521 | bitvec_write_field(dest, wp, 1, 1); // 1: have length |
| 522 | bitvec_write_field(dest, wp, len, 8); // length |
| 523 | } |
| 524 | |
| 525 | bitvec_write_field(dest, wp, is_final, 1); // FINAL_ACK_INDICATION |
| 526 | bitvec_write_field(dest, wp, bow, 1); // BEGINNING_OF_WINDOW |
| 527 | bitvec_write_field(dest, wp, eow, 1); // END_OF_WINDOW |
| 528 | bitvec_write_field(dest, wp, ssn, 11); // STARTING_SEQUENCE_NUMBER |
| 529 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have CRBB |
| 530 | |
| 531 | /* TODO: Add CRBB support */ |
| 532 | |
| 533 | LOGP(DRLCMACUL, LOGL_DEBUG, |
| 534 | " - EGPRS URBB, len = %d, SSN = %d, ESN_CRBB = %d, " |
| 535 | "SNS = %d, WS = %d, V(Q) = %d, V(R) = %d%s%s\n", |
| 536 | urbb_len, ssn, esn_crbb, |
| 537 | window->sns(), window->ws(), window->v_q(), window->v_r(), |
| 538 | bow ? ", BOW" : "", eow ? ", EOW" : ""); |
| 539 | for (int i = urbb_len; i > 0; i--) { |
| 540 | /* Set bit at the appropriate position (see 3GPP TS 04.60 12.3.1) */ |
| 541 | bool is_ack = window->m_v_n.is_received(esn_crbb + i); |
| 542 | bitvec_write_field(dest, wp, is_ack, 1); |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | static void write_packet_uplink_ack_egprs( |
| 547 | struct gprs_rlcmac_bts *bts, bitvec * dest, unsigned& wp, |
| 548 | struct gprs_rlcmac_ul_tbf *tbf, bool is_final) |
| 549 | { |
| 550 | bitvec_write_field(dest, wp, 0, 2); // fixed 00 |
| 551 | bitvec_write_field(dest, wp, 2, 4); // CHANNEL_CODING_COMMAND: MCS-3 |
| 552 | // bitvec_write_field(dest, wp, tbf->current_cs() - 1, 4); // CHANNEL_CODING_COMMAND |
| 553 | bitvec_write_field(dest, wp, 0, 1); // 0: no RESEGMENT (nyi) |
| 554 | bitvec_write_field(dest, wp, 1, 1); // PRE_EMPTIVE_TRANSMISSION, TODO: This resembles GPRS, change it? |
| 555 | bitvec_write_field(dest, wp, 0, 1); // 0: no PRR_RETRANSMISSION_REQUEST, TODO: clarify |
| 556 | bitvec_write_field(dest, wp, 0, 1); // 0: no ARAC_RETRANSMISSION_REQUEST, TODO: clarify |
| 557 | bitvec_write_field(dest, wp, 1, 1); // 1: have CONTENTION_RESOLUTION_TLLI |
| 558 | bitvec_write_field(dest, wp, tbf->tlli(), 32); // CONTENTION_RESOLUTION_TLLI |
| 559 | bitvec_write_field(dest, wp, 1, 1); // TBF_EST (enabled) |
| 560 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have Packet Timing Advance |
| 561 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have Packet Extended Timing Advance |
| 562 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have Power Control Parameters |
| 563 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have Extension Bits |
| 564 | |
| 565 | write_packet_ack_nack_desc_egprs(bts, dest, wp, &tbf->m_window, is_final); |
| 566 | |
| 567 | bitvec_write_field(dest, wp, 0, 1); // fixed 0 |
| 568 | bitvec_write_field(dest, wp, 0, 1); // 0: don't have REL 5 |
| 569 | }; |
| 570 | |
| 571 | void Encoding::write_packet_uplink_ack( |
| 572 | struct gprs_rlcmac_bts *bts, bitvec * dest, |
Jacob Erlbeck | f2694b7 | 2016-01-26 21:46:26 +0100 | [diff] [blame] | 573 | struct gprs_rlcmac_ul_tbf *tbf, bool is_final, |
| 574 | uint8_t rrbp) |
Jacob Erlbeck | 37005a1 | 2015-12-22 14:58:34 +0100 | [diff] [blame] | 575 | { |
| 576 | unsigned wp = 0; |
| 577 | |
| 578 | LOGP(DRLCMACUL, LOGL_DEBUG, "Encoding Ack/Nack for %s " |
| 579 | "(final=%d)\n", tbf_name(tbf), is_final); |
| 580 | |
| 581 | bitvec_write_field(dest, wp, 0x1, 2); // Payload Type |
Jacob Erlbeck | f2694b7 | 2016-01-26 21:46:26 +0100 | [diff] [blame] | 582 | bitvec_write_field(dest, wp, rrbp, 2); // Uplink block with TDMA framenumber |
Jacob Erlbeck | 37005a1 | 2015-12-22 14:58:34 +0100 | [diff] [blame] | 583 | bitvec_write_field(dest, wp, is_final, 1); // Suppl/Polling Bit |
| 584 | bitvec_write_field(dest, wp, 0x0, 3); // Uplink state flag |
| 585 | bitvec_write_field(dest, wp, 0x9, 6); // MESSAGE TYPE Uplink Ack/Nack |
| 586 | bitvec_write_field(dest, wp, 0x0, 2); // Page Mode |
| 587 | |
| 588 | bitvec_write_field(dest, wp, 0x0, 2); // fixed 00 |
| 589 | bitvec_write_field(dest, wp, tbf->tfi(), 5); // Uplink TFI |
| 590 | |
| 591 | if (tbf->is_egprs_enabled()) { |
| 592 | /* PU_AckNack_EGPRS = on */ |
| 593 | bitvec_write_field(dest, wp, 1, 1); // 1: EGPRS |
| 594 | write_packet_uplink_ack_egprs(bts, dest, wp, tbf, is_final); |
| 595 | } else { |
| 596 | /* PU_AckNack_GPRS = on */ |
| 597 | bitvec_write_field(dest, wp, 0, 1); // 0: GPRS |
| 598 | write_packet_uplink_ack_gprs(bts, dest, wp, tbf, is_final); |
| 599 | } |
| 600 | |
| 601 | LOGP(DRLCMACUL, LOGL_DEBUG, |
| 602 | "Uplink Ack/Nack bit count %d, max %d, message = %s\n", |
| 603 | wp, dest->data_len * 8, |
| 604 | osmo_hexdump(dest->data, dest->data_len)); |
| 605 | } |
| 606 | |
Holger Hans Peter Freyther | 63f29d6 | 2013-10-19 19:04:03 +0200 | [diff] [blame] | 607 | unsigned Encoding::write_packet_paging_request(bitvec * dest) |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 608 | { |
| 609 | unsigned wp = 0; |
| 610 | |
| 611 | bitvec_write_field(dest, wp,0x1,2); // Payload Type |
| 612 | bitvec_write_field(dest, wp,0x0,3); // No polling |
| 613 | bitvec_write_field(dest, wp,0x0,3); // Uplink state flag |
| 614 | bitvec_write_field(dest, wp,0x22,6); // MESSAGE TYPE |
| 615 | |
| 616 | bitvec_write_field(dest, wp,0x0,2); // Page Mode |
| 617 | |
| 618 | bitvec_write_field(dest, wp,0x0,1); // No PERSISTENCE_LEVEL |
| 619 | bitvec_write_field(dest, wp,0x0,1); // No NLN |
| 620 | |
| 621 | return wp; |
| 622 | } |
| 623 | |
Holger Hans Peter Freyther | 63f29d6 | 2013-10-19 19:04:03 +0200 | [diff] [blame] | 624 | unsigned Encoding::write_repeated_page_info(bitvec * dest, unsigned& wp, uint8_t len, |
Holger Hans Peter Freyther | 6ca0a90 | 2013-10-19 18:50:22 +0200 | [diff] [blame] | 625 | uint8_t *identity, uint8_t chan_needed) |
| 626 | { |
| 627 | bitvec_write_field(dest, wp,0x1,1); // Repeated Page info exists |
| 628 | |
| 629 | bitvec_write_field(dest, wp,0x1,1); // RR connection paging |
| 630 | |
| 631 | if ((identity[0] & 0x07) == 4) { |
| 632 | bitvec_write_field(dest, wp,0x0,1); // TMSI |
| 633 | identity++; |
| 634 | len--; |
| 635 | } else { |
| 636 | bitvec_write_field(dest, wp,0x0,1); // MI |
| 637 | bitvec_write_field(dest, wp,len,4); // MI len |
| 638 | } |
| 639 | while (len) { |
| 640 | bitvec_write_field(dest, wp,*identity++,8); // MI data |
| 641 | len--; |
| 642 | } |
| 643 | bitvec_write_field(dest, wp,chan_needed,2); // CHANNEL_NEEDED |
| 644 | bitvec_write_field(dest, wp,0x0,1); // No eMLPP_PRIORITY |
| 645 | |
| 646 | return wp; |
| 647 | } |
| 648 | |
Jacob Erlbeck | f0e4039 | 2016-01-08 10:07:53 +0100 | [diff] [blame] | 649 | int Encoding::rlc_write_dl_data_header(const struct gprs_rlc_data_info *rlc, |
| 650 | uint8_t *data) |
| 651 | { |
| 652 | struct gprs_rlc_dl_header_egprs_3 *egprs3; |
| 653 | struct rlc_dl_header *gprs; |
| 654 | unsigned int e_fbi_header; |
| 655 | GprsCodingScheme cs = rlc->cs; |
| 656 | |
| 657 | switch(cs.headerTypeData()) { |
| 658 | case GprsCodingScheme::HEADER_GPRS_DATA: |
| 659 | gprs = static_cast<struct rlc_dl_header *> |
| 660 | ((void *)data); |
| 661 | |
| 662 | gprs->usf = rlc->usf; |
| 663 | gprs->s_p = rlc->es_p != 0 ? 1 : 0; |
| 664 | gprs->rrbp = rlc->rrbp; |
| 665 | gprs->pt = 0; |
| 666 | gprs->tfi = rlc->tfi; |
| 667 | gprs->pr = rlc->pr; |
| 668 | |
| 669 | gprs->fbi = rlc->block_info[0].cv == 0; |
| 670 | gprs->e = rlc->block_info[0].e; |
| 671 | gprs->bsn = rlc->block_info[0].bsn; |
| 672 | break; |
| 673 | |
| 674 | case GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_3: |
| 675 | egprs3 = static_cast<struct gprs_rlc_dl_header_egprs_3 *> |
| 676 | ((void *)data); |
| 677 | |
| 678 | egprs3->usf = rlc->usf; |
| 679 | egprs3->es_p = rlc->es_p; |
| 680 | egprs3->rrbp = rlc->rrbp; |
| 681 | egprs3->tfi_a = rlc->tfi >> 0; /* 1 bit LSB */ |
| 682 | egprs3->tfi_b = rlc->tfi >> 1; /* 4 bits */ |
| 683 | egprs3->pr = rlc->pr; |
| 684 | egprs3->cps = rlc->cps; |
| 685 | |
| 686 | egprs3->bsn1_a = rlc->block_info[0].bsn >> 0; /* 2 bits LSB */ |
| 687 | egprs3->bsn1_b = rlc->block_info[0].bsn >> 2; /* 8 bits */ |
| 688 | egprs3->bsn1_c = rlc->block_info[0].bsn >> 10; /* 1 bit */ |
| 689 | |
| 690 | egprs3->spb = rlc->block_info[0].spb; |
| 691 | |
| 692 | e_fbi_header = rlc->block_info[0].e ? 0x01 : 0; |
| 693 | e_fbi_header |= rlc->block_info[0].cv == 0 ? 0x02 : 0; /* FBI */ |
| 694 | e_fbi_header <<= 7; |
| 695 | data[3] = (data[3] & 0b01111111) | (e_fbi_header >> 0); |
| 696 | data[4] = (data[4] & 0b11111110) | (e_fbi_header >> 8); |
| 697 | break; |
| 698 | |
| 699 | case GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_1: |
| 700 | case GprsCodingScheme::HEADER_EGPRS_DATA_TYPE_2: |
| 701 | /* TODO: Support both header types */ |
| 702 | /* fall through */ |
| 703 | default: |
| 704 | LOGP(DRLCMACDL, LOGL_ERROR, |
| 705 | "Encoding of uplink %s data blocks not yet supported.\n", |
| 706 | cs.name()); |
| 707 | return -ENOTSUP; |
| 708 | }; |
| 709 | |
| 710 | return 0; |
| 711 | } |
| 712 | |
| 713 | /** |
| 714 | * \brief Copy LSB bitstream RLC data block from byte aligned buffer. |
| 715 | * |
| 716 | * Note that the bitstream is encoded in LSB first order, so the two octets |
| 717 | * 654321xx xxxxxx87 contain the octet 87654321 starting at bit position 3 |
| 718 | * (LSB has bit position 1). This is a different order than the one used by |
| 719 | * CSN.1. |
| 720 | * |
| 721 | * \param data_block_idx The block index, 0..1 for header type 1, 0 otherwise |
| 722 | * \param src A pointer to the start of the RLC block (incl. the header) |
| 723 | * \param buffer A data area of a least the size of the RLC block |
| 724 | * \returns the number of bytes copied |
| 725 | */ |
| 726 | unsigned int Encoding::rlc_copy_from_aligned_buffer( |
| 727 | const struct gprs_rlc_data_info *rlc, |
| 728 | unsigned int data_block_idx, |
| 729 | uint8_t *dst, const uint8_t *buffer) |
| 730 | { |
| 731 | unsigned int hdr_bytes; |
| 732 | unsigned int extra_bits; |
| 733 | unsigned int i; |
| 734 | |
| 735 | uint8_t c, last_c; |
| 736 | const uint8_t *src; |
| 737 | const struct gprs_rlc_data_block_info *rdbi; |
| 738 | |
| 739 | OSMO_ASSERT(data_block_idx < rlc->num_data_blocks); |
| 740 | rdbi = &rlc->block_info[data_block_idx]; |
| 741 | |
| 742 | hdr_bytes = rlc->data_offs_bits[data_block_idx] / 8; |
| 743 | extra_bits = (rlc->data_offs_bits[data_block_idx] % 8); |
| 744 | |
| 745 | if (extra_bits == 0) { |
| 746 | /* It is aligned already */ |
| 747 | memmove(dst + hdr_bytes, buffer, rdbi->data_len); |
| 748 | return rdbi->data_len; |
| 749 | } |
| 750 | |
| 751 | src = buffer; |
| 752 | dst = dst + hdr_bytes; |
| 753 | last_c = *dst << (8 - extra_bits); |
| 754 | |
| 755 | for (i = 0; i < rdbi->data_len; i++) { |
| 756 | c = src[i]; |
| 757 | *(dst++) = (last_c >> (8 - extra_bits)) | (c << extra_bits); |
| 758 | last_c = c; |
| 759 | } |
| 760 | |
| 761 | /* overwrite the lower extra_bits */ |
| 762 | *dst = (*dst & (0xff << extra_bits)) | (last_c >> (8 - extra_bits)); |
| 763 | |
| 764 | return rdbi->data_len; |
| 765 | } |
Jacob Erlbeck | 14bb094 | 2016-01-12 11:58:13 +0100 | [diff] [blame] | 766 | |
Jacob Erlbeck | 5058bd6 | 2016-01-13 10:51:25 +0100 | [diff] [blame] | 767 | static Encoding::AppendResult rlc_data_to_dl_append_gprs( |
Jacob Erlbeck | 14bb094 | 2016-01-12 11:58:13 +0100 | [diff] [blame] | 768 | struct gprs_rlc_data_block_info *rdbi, |
| 769 | gprs_llc *llc, int *offset, int *num_chunks, |
| 770 | uint8_t *data_block, |
| 771 | bool is_final) |
| 772 | { |
| 773 | int chunk; |
| 774 | int space; |
| 775 | struct rlc_li_field *li; |
| 776 | uint8_t *delimiter, *data, *e_pointer; |
| 777 | |
| 778 | data = data_block + *offset; |
| 779 | delimiter = data_block + *num_chunks; |
| 780 | e_pointer = (*num_chunks ? delimiter - 1 : NULL); |
| 781 | |
| 782 | chunk = llc->chunk_size(); |
| 783 | space = rdbi->data_len - *offset; |
| 784 | |
| 785 | /* if chunk will exceed block limit */ |
| 786 | if (chunk > space) { |
| 787 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- Chunk with length %d " |
| 788 | "larger than space (%d) left in block: copy " |
| 789 | "only remaining space, and we are done\n", |
| 790 | chunk, space); |
| 791 | /* block is filled, so there is no extension */ |
| 792 | if (e_pointer) |
| 793 | *e_pointer |= 0x01; |
| 794 | /* fill only space */ |
| 795 | llc->consume(data, space); |
| 796 | /* return data block as message */ |
| 797 | *offset = rdbi->data_len; |
| 798 | (*num_chunks)++; |
Jacob Erlbeck | 5058bd6 | 2016-01-13 10:51:25 +0100 | [diff] [blame] | 799 | return Encoding::AR_NEED_MORE_BLOCKS; |
Jacob Erlbeck | 14bb094 | 2016-01-12 11:58:13 +0100 | [diff] [blame] | 800 | } |
| 801 | /* if FINAL chunk would fit precisely in space left */ |
| 802 | if (chunk == space && is_final) |
| 803 | { |
| 804 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- Chunk with length %d " |
| 805 | "would exactly fit into space (%d): because " |
| 806 | "this is a final block, we don't add length " |
| 807 | "header, and we are done\n", chunk, space); |
| 808 | /* block is filled, so there is no extension */ |
| 809 | if (e_pointer) |
| 810 | *e_pointer |= 0x01; |
| 811 | /* fill space */ |
| 812 | llc->consume(data, space); |
| 813 | *offset = rdbi->data_len; |
| 814 | (*num_chunks)++; |
| 815 | rdbi->cv = 0; |
Jacob Erlbeck | 5058bd6 | 2016-01-13 10:51:25 +0100 | [diff] [blame] | 816 | return Encoding::AR_COMPLETED_BLOCK_FILLED; |
Jacob Erlbeck | 14bb094 | 2016-01-12 11:58:13 +0100 | [diff] [blame] | 817 | } |
| 818 | /* if chunk would fit exactly in space left */ |
| 819 | if (chunk == space) { |
| 820 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- Chunk with length %d " |
| 821 | "would exactly fit into space (%d): add length " |
| 822 | "header with LI=0, to make frame extend to " |
| 823 | "next block, and we are done\n", chunk, space); |
| 824 | /* make space for delimiter */ |
| 825 | if (delimiter != data) |
| 826 | memmove(delimiter + 1, delimiter, |
| 827 | data - delimiter); |
| 828 | data++; |
| 829 | (*offset)++; |
| 830 | space--; |
| 831 | /* add LI with 0 length */ |
| 832 | li = (struct rlc_li_field *)delimiter; |
| 833 | li->e = 1; /* not more extension */ |
| 834 | li->m = 0; /* shall be set to 0, in case of li = 0 */ |
| 835 | li->li = 0; /* chunk fills the complete space */ |
| 836 | rdbi->e = 0; /* 0: extensions present */ |
| 837 | // no need to set e_pointer nor increase delimiter |
| 838 | /* fill only space, which is 1 octet less than chunk */ |
| 839 | llc->consume(data, space); |
| 840 | /* return data block as message */ |
| 841 | *offset = rdbi->data_len; |
| 842 | (*num_chunks)++; |
Jacob Erlbeck | 5058bd6 | 2016-01-13 10:51:25 +0100 | [diff] [blame] | 843 | return Encoding::AR_NEED_MORE_BLOCKS; |
Jacob Erlbeck | 14bb094 | 2016-01-12 11:58:13 +0100 | [diff] [blame] | 844 | } |
| 845 | |
| 846 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- Chunk with length %d is less " |
| 847 | "than remaining space (%d): add length header to " |
| 848 | "to delimit LLC frame\n", chunk, space); |
| 849 | /* the LLC frame chunk ends in this block */ |
| 850 | /* make space for delimiter */ |
| 851 | if (delimiter != data) |
| 852 | memmove(delimiter + 1, delimiter, data - delimiter); |
| 853 | data++; |
| 854 | (*offset)++; |
| 855 | space--; |
| 856 | /* add LI to delimit frame */ |
| 857 | li = (struct rlc_li_field *)delimiter; |
| 858 | li->e = 0; /* Extension bit, maybe set later */ |
| 859 | li->m = 0; /* will be set later, if there is more LLC data */ |
| 860 | li->li = chunk; /* length of chunk */ |
| 861 | rdbi->e = 0; /* 0: extensions present */ |
| 862 | (*num_chunks)++; |
| 863 | /* copy (rest of) LLC frame to space and reset later */ |
| 864 | llc->consume(data, chunk); |
| 865 | data += chunk; |
| 866 | space -= chunk; |
| 867 | (*offset) += chunk; |
| 868 | /* if we have more data and we have space left */ |
| 869 | if (space > 0 && !is_final) { |
| 870 | li->m = 1; /* we indicate more frames to follow */ |
Jacob Erlbeck | 5058bd6 | 2016-01-13 10:51:25 +0100 | [diff] [blame] | 871 | return Encoding::AR_COMPLETED_SPACE_LEFT; |
Jacob Erlbeck | 14bb094 | 2016-01-12 11:58:13 +0100 | [diff] [blame] | 872 | } |
| 873 | /* if we don't have more LLC frames */ |
| 874 | if (is_final) { |
| 875 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- Final block, so we " |
| 876 | "done.\n"); |
| 877 | li->e = 1; /* we cannot extend */ |
| 878 | rdbi->cv = 0; |
Jacob Erlbeck | 5058bd6 | 2016-01-13 10:51:25 +0100 | [diff] [blame] | 879 | return Encoding::AR_COMPLETED_BLOCK_FILLED; |
Jacob Erlbeck | 14bb094 | 2016-01-12 11:58:13 +0100 | [diff] [blame] | 880 | } |
| 881 | /* we have no space left */ |
| 882 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- No space left, so we are " |
| 883 | "done.\n"); |
| 884 | li->e = 1; /* we cannot extend */ |
Jacob Erlbeck | 5058bd6 | 2016-01-13 10:51:25 +0100 | [diff] [blame] | 885 | return Encoding::AR_COMPLETED_BLOCK_FILLED; |
| 886 | } |
| 887 | |
Jacob Erlbeck | a88d065 | 2016-01-13 11:28:10 +0100 | [diff] [blame] | 888 | static Encoding::AppendResult rlc_data_to_dl_append_egprs( |
| 889 | struct gprs_rlc_data_block_info *rdbi, |
| 890 | gprs_llc *llc, int *offset, int *num_chunks, |
| 891 | uint8_t *data_block, |
| 892 | bool is_final) |
| 893 | { |
| 894 | int chunk; |
| 895 | int space; |
| 896 | struct rlc_li_field_egprs *li; |
| 897 | struct rlc_li_field_egprs *prev_li; |
| 898 | uint8_t *delimiter, *data; |
| 899 | |
| 900 | data = data_block + *offset; |
| 901 | delimiter = data_block + *num_chunks; |
| 902 | prev_li = (struct rlc_li_field_egprs *) |
| 903 | (*num_chunks ? delimiter - 1 : NULL); |
| 904 | |
| 905 | chunk = llc->chunk_size(); |
| 906 | space = rdbi->data_len - *offset; |
| 907 | |
| 908 | /* if chunk will exceed block limit */ |
| 909 | if (chunk > space) { |
| 910 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- Chunk with length %d " |
| 911 | "larger than space (%d) left in block: copy " |
| 912 | "only remaining space, and we are done\n", |
| 913 | chunk, space); |
| 914 | /* fill only space */ |
| 915 | llc->consume(data, space); |
| 916 | /* return data block as message */ |
| 917 | *offset = rdbi->data_len; |
| 918 | (*num_chunks)++; |
| 919 | return Encoding::AR_NEED_MORE_BLOCKS; |
| 920 | } |
| 921 | /* if FINAL chunk would fit precisely in space left */ |
| 922 | if (chunk == space && is_final) |
| 923 | { |
| 924 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- Chunk with length %d " |
| 925 | "would exactly fit into space (%d): because " |
| 926 | "this is a final block, we don't add length " |
| 927 | "header, and we are done\n", chunk, space); |
| 928 | /* fill space */ |
| 929 | llc->consume(data, space); |
| 930 | *offset = rdbi->data_len; |
| 931 | (*num_chunks)++; |
| 932 | rdbi->cv = 0; |
| 933 | return Encoding::AR_COMPLETED_BLOCK_FILLED; |
| 934 | } |
| 935 | /* if chunk would fit exactly in space left */ |
| 936 | if (chunk == space) { |
| 937 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- Chunk with length %d " |
| 938 | "would exactly fit into space (%d): just copy " |
| 939 | "it, and we are done. The next block will have " |
| 940 | "to start with an empty chunk\n", |
| 941 | chunk, space); |
| 942 | /* fill space */ |
| 943 | llc->consume(data, space); |
| 944 | *offset = rdbi->data_len; |
| 945 | (*num_chunks)++; |
| 946 | return Encoding::AR_NEED_MORE_BLOCKS; |
| 947 | } |
| 948 | |
| 949 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- Chunk with length %d is less " |
| 950 | "than remaining space (%d): add length header to " |
| 951 | "to delimit LLC frame\n", chunk, space); |
| 952 | /* the LLC frame chunk ends in this block */ |
| 953 | /* make space for delimiter */ |
| 954 | |
| 955 | if (delimiter != data) |
| 956 | memmove(delimiter + 1, delimiter, data - delimiter); |
| 957 | |
| 958 | data += 1; |
| 959 | (*offset) += 1; |
| 960 | space -= 1; |
| 961 | /* add LI to delimit frame */ |
| 962 | li = (struct rlc_li_field_egprs *)delimiter; |
| 963 | li->e = 1; /* Extension bit, maybe set later */ |
| 964 | li->li = chunk; /* length of chunk */ |
| 965 | /* tell previous extension header about the new one */ |
| 966 | if (prev_li) |
| 967 | prev_li->e = 0; |
| 968 | rdbi->e = 0; /* 0: extensions present */ |
| 969 | delimiter++; |
| 970 | prev_li = li; |
| 971 | (*num_chunks)++; |
| 972 | /* copy (rest of) LLC frame to space and reset later */ |
| 973 | llc->consume(data, chunk); |
| 974 | data += chunk; |
| 975 | space -= chunk; |
| 976 | (*offset) += chunk; |
| 977 | /* if we have more data and we have space left */ |
| 978 | if (space > 0) { |
| 979 | if (!is_final) |
| 980 | return Encoding::AR_COMPLETED_SPACE_LEFT; |
| 981 | |
| 982 | /* we don't have more LLC frames */ |
| 983 | /* We will have to add another chunk with filling octets */ |
| 984 | LOGP(DRLCMACDL, LOGL_DEBUG, |
| 985 | "-- There is remaining space (%d): add filling byte chunk\n", |
| 986 | space); |
| 987 | |
| 988 | if (delimiter != data) |
| 989 | memmove(delimiter + 1, delimiter, data - delimiter); |
| 990 | |
| 991 | data += 1; |
| 992 | (*offset) += 1; |
| 993 | space -= 1; |
| 994 | |
| 995 | /* set filling bytes extension */ |
| 996 | li = (struct rlc_li_field_egprs *)delimiter; |
| 997 | li->e = 1; |
| 998 | li->li = 127; |
| 999 | |
| 1000 | /* tell previous extension header about the new one */ |
| 1001 | if (prev_li) |
| 1002 | prev_li->e = 0; |
| 1003 | |
| 1004 | delimiter++; |
| 1005 | (*num_chunks)++; |
| 1006 | |
| 1007 | rdbi->cv = 0; |
| 1008 | |
| 1009 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- Final block, so we " |
| 1010 | "are done.\n"); |
| 1011 | |
| 1012 | *offset = rdbi->data_len; |
| 1013 | return Encoding::AR_COMPLETED_BLOCK_FILLED; |
| 1014 | } |
| 1015 | |
| 1016 | if (is_final) { |
| 1017 | /* we don't have more LLC frames */ |
| 1018 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- Final block, so we " |
| 1019 | "are done.\n"); |
| 1020 | rdbi->cv = 0; |
| 1021 | return Encoding::AR_COMPLETED_BLOCK_FILLED; |
| 1022 | } |
| 1023 | |
| 1024 | /* we have no space left */ |
| 1025 | LOGP(DRLCMACDL, LOGL_DEBUG, "-- No space left, so we are " |
| 1026 | "done.\n"); |
| 1027 | return Encoding::AR_COMPLETED_BLOCK_FILLED; |
| 1028 | } |
| 1029 | |
Jacob Erlbeck | 5058bd6 | 2016-01-13 10:51:25 +0100 | [diff] [blame] | 1030 | Encoding::AppendResult Encoding::rlc_data_to_dl_append( |
| 1031 | struct gprs_rlc_data_block_info *rdbi, GprsCodingScheme cs, |
| 1032 | gprs_llc *llc, int *offset, int *num_chunks, |
| 1033 | uint8_t *data_block, |
| 1034 | bool is_final) |
| 1035 | { |
| 1036 | if (cs.isGprs()) |
| 1037 | return rlc_data_to_dl_append_gprs(rdbi, |
| 1038 | llc, offset, num_chunks, data_block, is_final); |
| 1039 | |
Jacob Erlbeck | a88d065 | 2016-01-13 11:28:10 +0100 | [diff] [blame] | 1040 | if (cs.isEgprs()) |
| 1041 | return rlc_data_to_dl_append_egprs(rdbi, |
| 1042 | llc, offset, num_chunks, data_block, is_final); |
| 1043 | |
Jacob Erlbeck | 5058bd6 | 2016-01-13 10:51:25 +0100 | [diff] [blame] | 1044 | LOGP(DRLCMACDL, LOGL_ERROR, "%s data block encoding not implemented\n", |
| 1045 | cs.name()); |
| 1046 | |
| 1047 | return AR_NEED_MORE_BLOCKS; |
Jacob Erlbeck | 14bb094 | 2016-01-12 11:58:13 +0100 | [diff] [blame] | 1048 | } |