7886
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
|
2 |
/*
|
|
3 |
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
|
4 |
*
|
|
5 |
* This program is free software; you can redistribute it and/or modify
|
|
6 |
* it under the terms of the GNU General Public License version 2 as
|
|
7 |
* published by the Free Software Foundation;
|
|
8 |
*
|
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
* GNU General Public License for more details.
|
|
13 |
*
|
|
14 |
* You should have received a copy of the GNU General Public License
|
|
15 |
* along with this program; if not, write to the Free Software
|
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17 |
*
|
|
18 |
* Author: Marco Miozzo <marco.miozzo@cttc.es>
|
|
19 |
*/
|
|
20 |
|
|
21 |
#include <ns3/log.h>
|
|
22 |
#include <ns3/pointer.h>
|
|
23 |
|
7887
|
24 |
#include "lte-amc.h"
|
7886
|
25 |
#include "rr-ff-mac-scheduler.h"
|
|
26 |
|
|
27 |
NS_LOG_COMPONENT_DEFINE ("RrPacketScheduler");
|
|
28 |
|
|
29 |
namespace ns3 {
|
|
30 |
|
|
31 |
int Type0AllocationRbg[4] = {
|
|
32 |
10, // RGB size 1
|
|
33 |
26, // RGB size 2
|
|
34 |
63, // RGB size 3
|
|
35 |
110 // RGB size 4
|
|
36 |
}; // see table 7.1.6.1-1 of 36.213
|
|
37 |
|
|
38 |
|
|
39 |
// NS_OBJECT_ENSURE_REGISTERED (RrPacketScheduler);
|
|
40 |
|
|
41 |
|
7888
|
42 |
class RrSchedulerMemberCschedSapProvider : public FfMacCschedSapProvider
|
7886
|
43 |
{
|
|
44 |
public:
|
7888
|
45 |
RrSchedulerMemberCschedSapProvider (RrFfMacScheduler* scheduler);
|
7886
|
46 |
|
|
47 |
// inherited from FfMacCschedSapProvider
|
|
48 |
virtual void CschedCellConfigReq (const struct CschedCellConfigReqParameters& params);
|
|
49 |
virtual void CschedUeConfigReq (const struct CschedUeConfigReqParameters& params);
|
|
50 |
virtual void CschedLcConfigReq (const struct CschedLcConfigReqParameters& params);
|
|
51 |
virtual void CschedLcReleaseReq (const struct CschedLcReleaseReqParameters& params);
|
|
52 |
virtual void CschedUeReleaseReq (const struct CschedUeReleaseReqParameters& params);
|
|
53 |
|
|
54 |
private:
|
7888
|
55 |
RrSchedulerMemberCschedSapProvider ();
|
7886
|
56 |
RrFfMacScheduler* m_scheduler;
|
|
57 |
};
|
|
58 |
|
7888
|
59 |
RrSchedulerMemberCschedSapProvider::RrSchedulerMemberCschedSapProvider ()
|
7886
|
60 |
{
|
|
61 |
}
|
|
62 |
|
7888
|
63 |
RrSchedulerMemberCschedSapProvider::RrSchedulerMemberCschedSapProvider (RrFfMacScheduler* scheduler) : m_scheduler (scheduler)
|
7886
|
64 |
{
|
|
65 |
}
|
|
66 |
|
|
67 |
|
|
68 |
void
|
7888
|
69 |
RrSchedulerMemberCschedSapProvider::CschedCellConfigReq (const struct CschedCellConfigReqParameters& params)
|
7886
|
70 |
{
|
|
71 |
m_scheduler->DoCschedCellConfigReq (params);
|
|
72 |
}
|
|
73 |
|
|
74 |
void
|
7888
|
75 |
RrSchedulerMemberCschedSapProvider::CschedUeConfigReq (const struct CschedUeConfigReqParameters& params)
|
7886
|
76 |
{
|
|
77 |
m_scheduler->DoCschedUeConfigReq (params);
|
|
78 |
}
|
|
79 |
|
|
80 |
|
|
81 |
void
|
7888
|
82 |
RrSchedulerMemberCschedSapProvider::CschedLcConfigReq (const struct CschedLcConfigReqParameters& params)
|
7886
|
83 |
{
|
|
84 |
m_scheduler->DoCschedLcConfigReq (params);
|
|
85 |
}
|
|
86 |
|
|
87 |
void
|
7888
|
88 |
RrSchedulerMemberCschedSapProvider::CschedLcReleaseReq (const struct CschedLcReleaseReqParameters& params)
|
7886
|
89 |
{
|
|
90 |
m_scheduler->DoCschedLcReleaseReq (params);
|
|
91 |
}
|
|
92 |
|
|
93 |
void
|
7888
|
94 |
RrSchedulerMemberCschedSapProvider::CschedUeReleaseReq (const struct CschedUeReleaseReqParameters& params)
|
7886
|
95 |
{
|
|
96 |
m_scheduler->DoCschedUeReleaseReq (params);
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
7888
|
102 |
class RrSchedulerMemberSchedSapProvider : public FfMacSchedSapProvider
|
7886
|
103 |
{
|
|
104 |
public:
|
7888
|
105 |
RrSchedulerMemberSchedSapProvider (RrFfMacScheduler* scheduler);
|
7886
|
106 |
|
|
107 |
// inherited from FfMacSchedSapProvider
|
|
108 |
virtual void SchedDlRlcBufferReq (const struct SchedDlRlcBufferReqParameters& params);
|
|
109 |
virtual void SchedDlPagingBufferReq (const struct SchedDlPagingBufferReqParameters& params);
|
|
110 |
virtual void SchedDlMacBufferReq (const struct SchedDlMacBufferReqParameters& params);
|
|
111 |
virtual void SchedDlTriggerReq (const struct SchedDlTriggerReqParameters& params);
|
|
112 |
virtual void SchedDlRachInfoReq (const struct SchedDlRachInfoReqParameters& params);
|
|
113 |
virtual void SchedDlCqiInfoReq (const struct SchedDlCqiInfoReqParameters& params);
|
|
114 |
virtual void SchedUlTriggerReq (const struct SchedUlTriggerReqParameters& params);
|
|
115 |
virtual void SchedUlNoiseInterferenceReq (const struct SchedUlNoiseInterferenceReqParameters& params);
|
|
116 |
virtual void SchedUlSrInfoReq (const struct SchedUlSrInfoReqParameters& params);
|
|
117 |
virtual void SchedUlMacCtrlInfoReq (const struct SchedUlMacCtrlInfoReqParameters& params);
|
|
118 |
virtual void SchedUlCqiInfoReq (const struct SchedUlCqiInfoReqParameters& params);
|
|
119 |
|
|
120 |
|
|
121 |
private:
|
7888
|
122 |
RrSchedulerMemberSchedSapProvider ();
|
7886
|
123 |
RrFfMacScheduler* m_scheduler;
|
|
124 |
};
|
|
125 |
|
|
126 |
|
|
127 |
|
7888
|
128 |
RrSchedulerMemberSchedSapProvider::RrSchedulerMemberSchedSapProvider ()
|
7886
|
129 |
{
|
|
130 |
}
|
|
131 |
|
|
132 |
|
7888
|
133 |
RrSchedulerMemberSchedSapProvider::RrSchedulerMemberSchedSapProvider (RrFfMacScheduler* scheduler)
|
7886
|
134 |
: m_scheduler (scheduler)
|
|
135 |
{
|
|
136 |
}
|
|
137 |
|
|
138 |
void
|
7888
|
139 |
RrSchedulerMemberSchedSapProvider::SchedDlRlcBufferReq (const struct SchedDlRlcBufferReqParameters& params)
|
7886
|
140 |
{
|
|
141 |
m_scheduler->DoSchedDlRlcBufferReq (params);
|
|
142 |
}
|
|
143 |
|
|
144 |
void
|
7888
|
145 |
RrSchedulerMemberSchedSapProvider::SchedDlPagingBufferReq (const struct SchedDlPagingBufferReqParameters& params)
|
7886
|
146 |
{
|
|
147 |
m_scheduler->DoSchedDlPagingBufferReq (params);
|
|
148 |
}
|
|
149 |
|
|
150 |
void
|
7888
|
151 |
RrSchedulerMemberSchedSapProvider::SchedDlMacBufferReq (const struct SchedDlMacBufferReqParameters& params)
|
7886
|
152 |
{
|
|
153 |
m_scheduler->DoSchedDlMacBufferReq (params);
|
|
154 |
}
|
|
155 |
|
|
156 |
void
|
7888
|
157 |
RrSchedulerMemberSchedSapProvider::SchedDlTriggerReq (const struct SchedDlTriggerReqParameters& params)
|
7886
|
158 |
{
|
|
159 |
m_scheduler->DoSchedDlTriggerReq (params);
|
|
160 |
}
|
|
161 |
|
|
162 |
void
|
7888
|
163 |
RrSchedulerMemberSchedSapProvider::SchedDlRachInfoReq (const struct SchedDlRachInfoReqParameters& params)
|
7886
|
164 |
{
|
|
165 |
m_scheduler->DoSchedDlRachInfoReq (params);
|
|
166 |
}
|
|
167 |
|
|
168 |
void
|
7888
|
169 |
RrSchedulerMemberSchedSapProvider::SchedDlCqiInfoReq (const struct SchedDlCqiInfoReqParameters& params)
|
7886
|
170 |
{
|
|
171 |
m_scheduler->DoSchedDlCqiInfoReq (params);
|
|
172 |
}
|
|
173 |
|
|
174 |
void
|
7888
|
175 |
RrSchedulerMemberSchedSapProvider::SchedUlTriggerReq (const struct SchedUlTriggerReqParameters& params)
|
7886
|
176 |
{
|
|
177 |
m_scheduler->DoSchedUlTriggerReq (params);
|
|
178 |
}
|
|
179 |
|
|
180 |
void
|
7888
|
181 |
RrSchedulerMemberSchedSapProvider::SchedUlNoiseInterferenceReq (const struct SchedUlNoiseInterferenceReqParameters& params)
|
7886
|
182 |
{
|
|
183 |
m_scheduler->DoSchedUlNoiseInterferenceReq (params);
|
|
184 |
}
|
|
185 |
|
|
186 |
void
|
7888
|
187 |
RrSchedulerMemberSchedSapProvider::SchedUlSrInfoReq (const struct SchedUlSrInfoReqParameters& params)
|
7886
|
188 |
{
|
|
189 |
m_scheduler->DoSchedUlSrInfoReq (params);
|
|
190 |
}
|
|
191 |
|
|
192 |
void
|
7888
|
193 |
RrSchedulerMemberSchedSapProvider::SchedUlMacCtrlInfoReq (const struct SchedUlMacCtrlInfoReqParameters& params)
|
7886
|
194 |
{
|
|
195 |
m_scheduler->DoSchedUlMacCtrlInfoReq (params);
|
|
196 |
}
|
|
197 |
|
|
198 |
void
|
7888
|
199 |
RrSchedulerMemberSchedSapProvider::SchedUlCqiInfoReq (const struct SchedUlCqiInfoReqParameters& params)
|
7886
|
200 |
{
|
|
201 |
m_scheduler->DoSchedUlCqiInfoReq (params);
|
|
202 |
}
|
|
203 |
|
|
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
RrFfMacScheduler::RrFfMacScheduler ()
|
|
209 |
: m_cschedSapUser (0),
|
|
210 |
m_schedSapUser (0)
|
|
211 |
{
|
7888
|
212 |
m_cschedSapProvider = new RrSchedulerMemberCschedSapProvider (this);
|
|
213 |
m_schedSapProvider = new RrSchedulerMemberSchedSapProvider (this);
|
7886
|
214 |
}
|
|
215 |
|
|
216 |
RrFfMacScheduler::~RrFfMacScheduler ()
|
|
217 |
{
|
|
218 |
NS_LOG_FUNCTION (this);
|
|
219 |
}
|
|
220 |
|
|
221 |
void
|
|
222 |
RrFfMacScheduler::DoDispose ()
|
|
223 |
{
|
|
224 |
NS_LOG_FUNCTION (this);
|
|
225 |
delete m_cschedSapProvider;
|
|
226 |
delete m_schedSapProvider;
|
|
227 |
}
|
|
228 |
|
|
229 |
TypeId
|
|
230 |
RrFfMacScheduler::GetTypeId (void)
|
|
231 |
{
|
|
232 |
static TypeId tid = TypeId ("RrFfMacScheduler")
|
|
233 |
.SetParent<FfMacScheduler> ()
|
|
234 |
.AddConstructor<RrFfMacScheduler> ();
|
|
235 |
return tid;
|
|
236 |
}
|
|
237 |
|
|
238 |
|
|
239 |
|
|
240 |
void
|
|
241 |
RrFfMacScheduler::SetFfMacCschedSapUser (FfMacCschedSapUser* s)
|
|
242 |
{
|
|
243 |
m_cschedSapUser = s;
|
|
244 |
}
|
|
245 |
|
|
246 |
void
|
|
247 |
RrFfMacScheduler::SetFfMacSchedSapUser (FfMacSchedSapUser* s)
|
|
248 |
{
|
|
249 |
m_schedSapUser = s;
|
|
250 |
}
|
|
251 |
|
|
252 |
FfMacCschedSapProvider*
|
|
253 |
RrFfMacScheduler::GetFfMacCschedSapProvider ()
|
|
254 |
{
|
|
255 |
return m_cschedSapProvider;
|
|
256 |
}
|
|
257 |
|
|
258 |
FfMacSchedSapProvider*
|
|
259 |
RrFfMacScheduler::GetFfMacSchedSapProvider ()
|
|
260 |
{
|
|
261 |
return m_schedSapProvider;
|
|
262 |
}
|
|
263 |
|
|
264 |
void
|
|
265 |
RrFfMacScheduler::DoCschedCellConfigReq (const struct FfMacCschedSapProvider::CschedCellConfigReqParameters& params)
|
|
266 |
{
|
|
267 |
NS_LOG_FUNCTION (this);
|
|
268 |
// Read the subset of parameters used
|
|
269 |
m_cschedCellConfig = params;
|
|
270 |
FfMacCschedSapUser::CschedUeConfigCnfParameters cnf;
|
|
271 |
cnf.m_result = SUCCESS;
|
|
272 |
m_cschedSapUser->CschedUeConfigCnf (cnf);
|
|
273 |
return;
|
|
274 |
}
|
|
275 |
|
|
276 |
void
|
|
277 |
RrFfMacScheduler::DoCschedUeConfigReq (const struct FfMacCschedSapProvider::CschedUeConfigReqParameters& params)
|
|
278 |
{
|
|
279 |
NS_LOG_FUNCTION (this);
|
|
280 |
// Not used at this stage
|
|
281 |
return;
|
|
282 |
}
|
|
283 |
|
|
284 |
void
|
|
285 |
RrFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::CschedLcConfigReqParameters& params)
|
|
286 |
{
|
|
287 |
NS_LOG_FUNCTION (this);
|
|
288 |
// Not used at this stage
|
|
289 |
return;
|
|
290 |
}
|
|
291 |
|
|
292 |
void
|
|
293 |
RrFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
|
|
294 |
{
|
|
295 |
NS_LOG_FUNCTION (this);
|
|
296 |
// TODO: Implementation of the API
|
|
297 |
return;
|
|
298 |
}
|
|
299 |
|
|
300 |
void
|
|
301 |
RrFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
|
|
302 |
{
|
|
303 |
NS_LOG_FUNCTION (this);
|
|
304 |
// TODO: Implementation of the API
|
|
305 |
return;
|
|
306 |
}
|
|
307 |
|
|
308 |
|
|
309 |
void
|
|
310 |
RrFfMacScheduler::DoSchedDlRlcBufferReq (const struct FfMacSchedSapProvider::SchedDlRlcBufferReqParameters& params)
|
|
311 |
{
|
|
312 |
NS_LOG_FUNCTION (this << params.m_rnti << (uint32_t) params.m_logicalChannelIdentity);
|
|
313 |
// API generated by RLC for updating RLC parameters on a LC (tx and retx queues)
|
|
314 |
std::vector<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
|
|
315 |
|
|
316 |
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
|
|
317 |
{
|
|
318 |
// remove old entries of this UE-LC
|
|
319 |
if (((*it).m_rnti == params.m_rnti)&&((*it).m_logicalChannelIdentity == params.m_logicalChannelIdentity))
|
|
320 |
{
|
|
321 |
m_rlcBufferReq.erase (it);
|
|
322 |
}
|
|
323 |
}
|
|
324 |
// add the new paramters
|
|
325 |
m_rlcBufferReq.insert (it, params);
|
|
326 |
|
|
327 |
return;
|
|
328 |
}
|
|
329 |
|
|
330 |
void
|
|
331 |
RrFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
|
|
332 |
{
|
|
333 |
NS_LOG_FUNCTION (this);
|
|
334 |
// TODO: Implementation of the API
|
|
335 |
return;
|
|
336 |
}
|
|
337 |
|
|
338 |
void
|
|
339 |
RrFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
|
|
340 |
{
|
|
341 |
NS_LOG_FUNCTION (this);
|
|
342 |
// TODO: Implementation of the API
|
|
343 |
return;
|
|
344 |
}
|
|
345 |
|
|
346 |
int
|
|
347 |
RrFfMacScheduler::GetRbgSize (int dlbandwidth)
|
|
348 |
{
|
|
349 |
for (int i = 0; i < 4; i++)
|
|
350 |
{
|
|
351 |
if (dlbandwidth < Type0AllocationRbg[i])
|
|
352 |
{
|
|
353 |
return (i + 1);
|
|
354 |
}
|
|
355 |
}
|
|
356 |
|
|
357 |
return (-1);
|
|
358 |
}
|
|
359 |
|
|
360 |
|
|
361 |
void
|
|
362 |
RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters& params)
|
|
363 |
{
|
|
364 |
NS_LOG_FUNCTION (this);
|
|
365 |
// API generated by RLC for triggering the scheduling of a DL subframe
|
|
366 |
|
|
367 |
// Get the actual active flows (queue!=0)
|
|
368 |
std::vector<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
|
|
369 |
int nflows = 0;
|
|
370 |
|
|
371 |
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
|
|
372 |
{
|
|
373 |
// remove old entries of this UE-LC
|
|
374 |
if ( ((*it).m_rlcTransmissionQueueSize > 0)
|
|
375 |
|| ((*it).m_rlcRetransmissionQueueSize > 0)
|
|
376 |
|| ((*it).m_rlcStatusPduSize > 0) )
|
|
377 |
{
|
|
378 |
nflows++;
|
|
379 |
}
|
|
380 |
}
|
|
381 |
|
|
382 |
if (nflows == 0)
|
|
383 |
{
|
|
384 |
return;
|
|
385 |
}
|
|
386 |
|
|
387 |
// Divide the resource equally among the active users according to
|
|
388 |
// Resource allocation type 0 (see sec 7.1.6.1 of 36.213)
|
|
389 |
int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth);
|
|
390 |
int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize;
|
|
391 |
int rbgPerFlow = rbgNum / nflows;
|
|
392 |
if (rbgPerFlow == 0)
|
|
393 |
{
|
|
394 |
rbgPerFlow = 1; // at least 1 rbg per flow (till available resource)
|
|
395 |
}
|
|
396 |
int rbgAllocated = 0;
|
|
397 |
|
|
398 |
FfMacSchedSapUser::SchedDlConfigIndParameters ret;
|
|
399 |
|
|
400 |
// round robin assignment to all UE-LC registered
|
|
401 |
// std::vector<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
|
|
402 |
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
|
|
403 |
{
|
|
404 |
// create new BuildDataListElement_s for this LC
|
|
405 |
BuildDataListElement_s newEl;
|
|
406 |
newEl.m_rnti = (*it).m_rnti;
|
|
407 |
// NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << rbgPerFlow);
|
|
408 |
// create the DlDciListElement_s
|
|
409 |
DlDciListElement_s newDci;
|
|
410 |
newDci.m_rnti = (*it).m_rnti;
|
|
411 |
newDci.m_resAlloc = 0;
|
|
412 |
newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213)
|
|
413 |
uint32_t rbgMask = 0;
|
|
414 |
for (int i = 0; i < rbgPerFlow; i++)
|
|
415 |
{
|
|
416 |
rbgMask = rbgMask + (0x1 << rbgAllocated);
|
|
417 |
// NS_LOG_DEBUG (this << " Allocated PRB " << rbgAllocated);
|
|
418 |
rbgAllocated++;
|
|
419 |
}
|
|
420 |
newDci.m_rbBitmap = rbgMask; // (32 bit bitmap see 7.1.6 of 36.213)
|
|
421 |
|
|
422 |
int nbOfTbsInNewDci = 1; // SISO -> only one TB
|
|
423 |
int rlcPduSize = 0;
|
|
424 |
for (int i = 0; i < nbOfTbsInNewDci; i++)
|
|
425 |
{
|
|
426 |
std::map <uint16_t,uint8_t>::iterator it = m_p10CqiRxed.find (newDci.m_rnti);
|
|
427 |
if (it == m_p10CqiRxed.end ())
|
|
428 |
{
|
|
429 |
newDci.m_mcs.push_back (1); // no info on this user -> lowest MCS
|
|
430 |
}
|
|
431 |
else
|
|
432 |
{
|
7887
|
433 |
newDci.m_mcs.push_back ( LteAmc::GetMcsFromCqi ((*it).second) );
|
7886
|
434 |
}
|
|
435 |
int nPRB = rbgSize * rbgPerFlow;
|
7887
|
436 |
newDci.m_tbsSize.push_back ( (LteAmc::GetTbSizeFromMcs (newDci.m_mcs.at (i), nPRB) / 8) ); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
|
7886
|
437 |
newDci.m_ndi.push_back (1); // TBD (new data indicator)
|
|
438 |
newDci.m_rv.push_back (0); // TBD (redundancy version)
|
|
439 |
|
|
440 |
rlcPduSize += newDci.m_tbsSize.at (i);
|
|
441 |
}
|
|
442 |
newEl.m_dci = newDci;
|
|
443 |
// ...more parameters -> ingored in this version
|
|
444 |
|
|
445 |
RlcPduListElement_s newRlcEl;
|
|
446 |
newRlcEl.m_logicalChannelIdentity = (*it).m_logicalChannelIdentity;
|
|
447 |
// NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity);
|
|
448 |
newRlcEl.m_size = rlcPduSize; // TBD (max length of RLC-PDU in bytes)
|
|
449 |
|
|
450 |
std::vector <struct RlcPduListElement_s> newRlcPduLe;
|
|
451 |
newRlcPduLe.push_back (newRlcEl);
|
|
452 |
|
|
453 |
newEl.m_rlcPduList.push_back (newRlcPduLe);
|
|
454 |
ret.m_buildDataList.push_back (newEl);
|
|
455 |
if (rbgAllocated == rbgNum)
|
|
456 |
{
|
|
457 |
break; // no more RGB to be allocated
|
|
458 |
}
|
|
459 |
}
|
|
460 |
|
|
461 |
ret.m_nrOfPdcchOfdmSymbols = 1; // TODO: check correct value according the DCIs txed
|
|
462 |
|
|
463 |
m_schedSapUser->SchedDlConfigInd (ret);
|
|
464 |
return;
|
|
465 |
}
|
|
466 |
|
|
467 |
void
|
|
468 |
RrFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
|
|
469 |
{
|
|
470 |
NS_LOG_FUNCTION (this);
|
|
471 |
// TODO: Implementation of the API
|
|
472 |
return;
|
|
473 |
}
|
|
474 |
|
|
475 |
void
|
|
476 |
RrFfMacScheduler::DoSchedDlCqiInfoReq (const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters& params)
|
|
477 |
{
|
|
478 |
NS_LOG_FUNCTION (this);
|
|
479 |
|
|
480 |
std::map <uint16_t,uint8_t>::iterator it;
|
|
481 |
|
|
482 |
for (unsigned int i = 0; i < params.m_cqiList.size (); i++)
|
|
483 |
{
|
|
484 |
if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::P10 )
|
|
485 |
{
|
|
486 |
// wideband CQI reporting
|
|
487 |
uint16_t rnti = params.m_cqiList.at (i).m_rnti;
|
|
488 |
it = m_p10CqiRxed.find (rnti);
|
|
489 |
if (it == m_p10CqiRxed.end ())
|
|
490 |
{
|
|
491 |
// create the new entry
|
|
492 |
m_p10CqiRxed.insert ( std::pair<uint16_t, uint8_t > (rnti, params.m_cqiList.at (i).m_wbCqi.at (0)) ); // only codeword 0 at this stage (SISO)
|
|
493 |
}
|
|
494 |
else
|
|
495 |
{
|
|
496 |
// update the CQI value
|
|
497 |
(*it).second = params.m_cqiList.at (i).m_wbCqi.at (0);
|
|
498 |
}
|
|
499 |
}
|
|
500 |
}
|
|
501 |
|
|
502 |
return;
|
|
503 |
}
|
|
504 |
|
|
505 |
void
|
|
506 |
RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters& params)
|
|
507 |
{
|
|
508 |
NS_LOG_FUNCTION (this);
|
|
509 |
// TODO: Implementation of the API
|
|
510 |
|
|
511 |
std::map <uint16_t,uint8_t>::iterator it;
|
|
512 |
int nflows = 0;
|
|
513 |
|
|
514 |
for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
|
|
515 |
{
|
|
516 |
// remove old entries of this UE-LC
|
|
517 |
if ((*it).second > 0)
|
|
518 |
{
|
|
519 |
nflows++;
|
|
520 |
}
|
|
521 |
}
|
|
522 |
|
|
523 |
if (nflows==0)
|
|
524 |
{
|
|
525 |
return ; // no flows to be scheduled
|
|
526 |
}
|
|
527 |
|
|
528 |
|
|
529 |
// Divide the resource equally among the active users
|
|
530 |
int rbPerFlow = m_cschedCellConfig.m_ulBandwidth / nflows;
|
|
531 |
if (rbPerFlow == 0)
|
|
532 |
{
|
|
533 |
rbPerFlow = 1; // at least 1 rbg per flow (till available resource)
|
|
534 |
}
|
|
535 |
int rbAllocated = 0;
|
|
536 |
|
|
537 |
FfMacSchedSapUser::SchedUlConfigIndParameters ret;
|
|
538 |
|
|
539 |
for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
|
|
540 |
{
|
|
541 |
if (rbAllocated + rbPerFlow > m_cschedCellConfig.m_ulBandwidth)
|
|
542 |
{
|
|
543 |
// limit to physical resources last resource assignment
|
|
544 |
rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
|
|
545 |
}
|
|
546 |
UlDciListElement_s uldci;
|
|
547 |
uldci.m_rnti = (*it).first;
|
|
548 |
uldci.m_rbStart = rbAllocated;
|
|
549 |
uldci.m_rbLen = rbPerFlow;
|
|
550 |
rbAllocated += rbPerFlow;
|
|
551 |
uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD
|
7887
|
552 |
uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); // MCS 0 -> UL-AMC TBD
|
7886
|
553 |
uldci.m_ndi = 1;
|
|
554 |
uldci.m_cceIndex = 0;
|
|
555 |
uldci.m_aggrLevel = 1;
|
|
556 |
uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF
|
|
557 |
uldci.m_hopping = false;
|
|
558 |
uldci.m_n2Dmrs = 0;
|
|
559 |
uldci.m_tpc = 0; // no power control
|
|
560 |
uldci.m_cqiRequest = false; // only period CQI at this stage
|
|
561 |
uldci.m_ulIndex = 0; // TDD parameter
|
|
562 |
uldci.m_dai = 1; // TDD parameter
|
|
563 |
uldci.m_freqHopping = 0;
|
|
564 |
uldci.m_pdcchPowerOffset = 0; // not used
|
|
565 |
ret.m_dciList.push_back (uldci);
|
|
566 |
}
|
|
567 |
m_schedSapUser->SchedUlConfigInd (ret);
|
|
568 |
return;
|
|
569 |
}
|
|
570 |
|
|
571 |
void
|
|
572 |
RrFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
|
|
573 |
{
|
|
574 |
NS_LOG_FUNCTION (this);
|
|
575 |
// TODO: Implementation of the API
|
|
576 |
return;
|
|
577 |
}
|
|
578 |
|
|
579 |
void
|
|
580 |
RrFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
|
|
581 |
{
|
|
582 |
NS_LOG_FUNCTION (this);
|
|
583 |
// TODO: Implementation of the API
|
|
584 |
return;
|
|
585 |
}
|
|
586 |
|
|
587 |
void
|
|
588 |
RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters& params)
|
|
589 |
{
|
|
590 |
NS_LOG_FUNCTION (this);
|
|
591 |
|
|
592 |
std::map <uint16_t,uint8_t>::iterator it;
|
|
593 |
|
|
594 |
for (unsigned int i = 0; i < params.m_macCeList.size (); i++)
|
|
595 |
{
|
|
596 |
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
|
|
597 |
{
|
|
598 |
// buffer status report
|
|
599 |
uint16_t rnti = params.m_macCeList.at (i).m_rnti;
|
|
600 |
it = m_ceBsrRxed.find(rnti);
|
|
601 |
if (it==m_ceBsrRxed.end())
|
|
602 |
{
|
|
603 |
// create the new entry
|
|
604 |
uint8_t bsr = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
|
|
605 |
m_ceBsrRxed.insert( std::pair<uint16_t, uint8_t > (rnti, bsr)); // only 1 buffer status is working now
|
|
606 |
}
|
|
607 |
else
|
|
608 |
{
|
|
609 |
// update the CQI value
|
|
610 |
(*it).second = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
|
|
611 |
}
|
|
612 |
}
|
|
613 |
}
|
|
614 |
|
|
615 |
return;
|
|
616 |
}
|
|
617 |
|
|
618 |
void
|
|
619 |
RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
|
|
620 |
{
|
|
621 |
NS_LOG_FUNCTION (this);
|
|
622 |
// TODO: Implementation of the API
|
|
623 |
return;
|
|
624 |
}
|
|
625 |
|
|
626 |
}
|