Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZhouShuya
OpenXG-RAN
Commits
920cf428
Commit
920cf428
authored
4 years ago
by
abdeljel
Committed by
Robert Schmidt
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor HARQ retx in try_allocate_harq_retransmission()
parent
bc73585d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
100 additions
and
149 deletions
+100
-149
openair2/LAYER2/MAC/pre_processor.c
openair2/LAYER2/MAC/pre_processor.c
+100
-149
No files found.
openair2/LAYER2/MAC/pre_processor.c
View file @
920cf428
...
@@ -69,6 +69,70 @@ int get_rbg_size_last(module_id_t Mod_id, int CC_id) {
...
@@ -69,6 +69,70 @@ int get_rbg_size_last(module_id_t Mod_id, int CC_id) {
return
RBGsize
;
return
RBGsize
;
}
}
bool
try_allocate_harq_retransmission
(
module_id_t
Mod_id
,
int
CC_id
,
int
frame
,
int
subframe
,
int
UE_id
,
int
start_rbg
,
int
*
n_rbg_sched
,
uint8_t
*
rbgalloc_mask
)
{
const
int
N_RBG
=
to_rbg
(
RC
.
mac
[
Mod_id
]
->
common_channels
[
CC_id
].
mib
->
message
.
dl_Bandwidth
);
const
int
RBGsize
=
get_min_rb_unit
(
Mod_id
,
CC_id
);
const
int
RBGlastsize
=
get_rbg_size_last
(
Mod_id
,
CC_id
);
UE_info_t
*
UE_info
=
&
RC
.
mac
[
Mod_id
]
->
UE_info
;
// check whether there are HARQ retransmissions
const
COMMON_channels_t
*
cc
=
&
RC
.
mac
[
Mod_id
]
->
common_channels
[
CC_id
];
const
uint8_t
harq_pid
=
frame_subframe2_dl_harq_pid
(
cc
->
tdd_Config
,
frame
,
subframe
);
UE_sched_ctrl_t
*
ue_ctrl
=
&
UE_info
->
UE_sched_ctrl
[
UE_id
];
// retransmission: allocate
const
int
nb_rb
=
UE_info
->
UE_template
[
CC_id
][
UE_id
].
nb_rb
[
harq_pid
];
if
(
nb_rb
==
0
)
{
return
false
;
}
int
nb_rbg
=
(
nb_rb
+
(
nb_rb
%
RBGsize
))
/
RBGsize
;
// needs more RBGs than we can allocate
if
(
nb_rbg
>
*
n_rbg_sched
)
{
LOG_D
(
MAC
,
"retransmission of UE %d needs more RBGs (%d) than we have (%d)
\n
"
,
UE_id
,
nb_rbg
,
*
n_rbg_sched
);
return
false
;
}
// ensure that the number of RBs can be contained by the RBGs (!), i.e.
// if we allocate the last RBG this one should have the full RBGsize
if
((
nb_rb
%
RBGsize
)
==
0
&&
nb_rbg
==
*
n_rbg_sched
&&
rbgalloc_mask
[
N_RBG
-
1
]
&&
RBGlastsize
!=
RBGsize
)
{
LOG_D
(
MAC
,
"retransmission of UE %d needs %d RBs, but the last RBG %d is too small (%d, normal %d)
\n
"
,
UE_id
,
nb_rb
,
N_RBG
-
1
,
RBGlastsize
,
RBGsize
);
return
false
;
}
const
uint8_t
cqi
=
ue_ctrl
->
dl_cqi
[
CC_id
];
const
int
idx
=
CCE_try_allocate_dlsch
(
Mod_id
,
CC_id
,
subframe
,
UE_id
,
cqi
);
if
(
idx
<
0
)
{
// cannot allocate CCE
LOG_D
(
MAC
,
"cannot allocate UE %d: no CCE can be allocated
\n
"
,
UE_id
);
return
false
;
}
ue_ctrl
->
pre_dci_dl_pdu_idx
=
idx
;
// retransmissions: directly allocate
*
n_rbg_sched
-=
nb_rbg
;
ue_ctrl
->
pre_nb_available_rbs
[
CC_id
]
+=
nb_rb
;
for
(;
nb_rbg
>
0
;
start_rbg
++
)
{
if
(
!
rbgalloc_mask
[
start_rbg
])
continue
;
ue_ctrl
->
rballoc_sub_UE
[
CC_id
][
start_rbg
]
=
1
;
rbgalloc_mask
[
start_rbg
]
=
0
;
nb_rbg
--
;
}
LOG_D
(
MAC
,
"%4d.%d n_rbg_sched %d after retransmission reservation for UE %d "
"retx nb_rb %d pre_nb_available_rbs %d
\n
"
,
frame
,
subframe
,
*
n_rbg_sched
,
UE_id
,
UE_info
->
UE_template
[
CC_id
][
UE_id
].
nb_rb
[
harq_pid
],
ue_ctrl
->
pre_nb_available_rbs
[
CC_id
]);
return
true
;
}
void
*
rr_dl_setup
(
void
)
{
void
*
rr_dl_setup
(
void
)
{
void
*
data
=
malloc
(
sizeof
(
int
));
void
*
data
=
malloc
(
sizeof
(
int
));
*
(
int
*
)
data
=
0
;
*
(
int
*
)
data
=
0
;
...
@@ -115,64 +179,25 @@ int rr_dl_run(module_id_t Mod_id,
...
@@ -115,64 +179,25 @@ int rr_dl_run(module_id_t Mod_id,
const
uint8_t
harq_pid
=
frame_subframe2_dl_harq_pid
(
cc
->
tdd_Config
,
frame
,
subframe
);
const
uint8_t
harq_pid
=
frame_subframe2_dl_harq_pid
(
cc
->
tdd_Config
,
frame
,
subframe
);
UE_sched_ctrl_t
*
ue_ctrl
=
&
UE_info
->
UE_sched_ctrl
[
UE_id
];
UE_sched_ctrl_t
*
ue_ctrl
=
&
UE_info
->
UE_sched_ctrl
[
UE_id
];
const
uint8_t
round
=
ue_ctrl
->
round
[
CC_id
][
harq_pid
];
const
uint8_t
round
=
ue_ctrl
->
round
[
CC_id
][
harq_pid
];
if
(
round
!=
8
)
{
// retransmission: allocate
if
(
round
!=
8
)
{
const
int
nb_rb
=
UE_info
->
UE_template
[
CC_id
][
UE_id
].
nb_rb
[
harq_pid
];
bool
r
=
try_allocate_harq_retransmission
(
Mod_id
,
CC_id
,
frame
,
subframe
,
if
(
nb_rb
==
0
)
UE_id
,
rbg
,
&
n_rbg_sched
,
goto
skip_ue
;
rbgalloc_mask
);
int
nb_rbg
=
(
nb_rb
+
(
nb_rb
%
RBGsize
))
/
RBGsize
;
if
(
r
)
{
// needs more RBGs than we can allocate
if
(
nb_rbg
>
n_rbg_sched
)
{
LOG_D
(
MAC
,
"retransmission of UE %d needs more RBGs (%d) than we have (%d)
\n
"
,
UE_id
,
nb_rbg
,
n_rbg_sched
);
goto
skip_ue
;
}
// ensure that the number of RBs can be contained by the RBGs (!), i.e.
// if we allocate the last RBG this one should have the full RBGsize
if
((
nb_rb
%
RBGsize
)
==
0
&&
nb_rbg
==
n_rbg_sched
&&
rbgalloc_mask
[
N_RBG
-
1
]
&&
RBGlastsize
!=
RBGsize
)
{
LOG_D
(
MAC
,
"retransmission of UE %d needs %d RBs, but the last RBG %d is too small (%d, normal %d)
\n
"
,
UE_id
,
nb_rb
,
N_RBG
-
1
,
RBGlastsize
,
RBGsize
);
goto
skip_ue
;
}
const
uint8_t
cqi
=
ue_ctrl
->
dl_cqi
[
CC_id
];
const
int
idx
=
CCE_try_allocate_dlsch
(
Mod_id
,
CC_id
,
subframe
,
UE_id
,
cqi
);
if
(
idx
<
0
)
goto
skip_ue
;
// cannot allocate CCE
ue_ctrl
->
pre_dci_dl_pdu_idx
=
idx
;
// retransmissions: directly allocate
n_rbg_sched
-=
nb_rbg
;
ue_ctrl
->
pre_nb_available_rbs
[
CC_id
]
+=
nb_rb
;
for
(;
nb_rbg
>
0
;
rbg
++
)
{
if
(
!
rbgalloc_mask
[
rbg
])
continue
;
ue_ctrl
->
rballoc_sub_UE
[
CC_id
][
rbg
]
=
1
;
rbgalloc_mask
[
rbg
]
=
0
;
nb_rbg
--
;
}
LOG_D
(
MAC
,
"%4d.%d n_rbg_sched %d after retransmission reservation for UE %d "
"round %d retx nb_rb %d pre_nb_available_rbs %d
\n
"
,
frame
,
subframe
,
n_rbg_sched
,
UE_id
,
round
,
UE_info
->
UE_template
[
CC_id
][
UE_id
].
nb_rb
[
harq_pid
],
ue_ctrl
->
pre_nb_available_rbs
[
CC_id
]);
/* if there are no more RBG to give, return */
/* if there are no more RBG to give, return */
if
(
n_rbg_sched
<=
0
)
if
(
n_rbg_sched
<=
0
)
return
0
;
return
0
;
max_num_ue
--
;
max_num_ue
--
;
/* if there are no UEs that can be allocated anymore, return */
if
(
max_num_ue
==
0
)
if
(
max_num_ue
==
0
)
return
n_rbg_sched
;
return
n_rbg_sched
;
for
(;
!
rbgalloc_mask
[
rbg
];
rbg
++
)
/* fast-forward */
;
for
(;
!
rbgalloc_mask
[
rbg
];
rbg
++
)
/* fast-forward */
;
}
}
else
{
}
else
{
if
(
UE_info
->
UE_template
[
CC_id
][
UE_id
].
dl_buffer_total
>
0
)
{
if
(
UE_info
->
UE_template
[
CC_id
][
UE_id
].
dl_buffer_total
>
0
)
{
*
cur_UE
=
UE_id
;
*
cur_UE
=
UE_id
;
cur_UE
=
&
UE_sched
.
next
[
UE_id
];
cur_UE
=
&
UE_sched
.
next
[
UE_id
];
}
}
}
}
skip_ue:
UE_id
=
next_ue_list_looped
(
UE_list
,
UE_id
);
UE_id
=
next_ue_list_looped
(
UE_list
,
UE_id
);
}
while
(
UE_id
!=
*
start_ue
);
}
while
(
UE_id
!=
*
start_ue
);
*
cur_UE
=
-
1
;
// mark end
*
cur_UE
=
-
1
;
// mark end
...
@@ -284,56 +309,19 @@ int pf_wbcqi_dl_run(module_id_t Mod_id,
...
@@ -284,56 +309,19 @@ int pf_wbcqi_dl_run(module_id_t Mod_id,
const
uint8_t
harq_pid
=
frame_subframe2_dl_harq_pid
(
cc
->
tdd_Config
,
frame
,
subframe
);
const
uint8_t
harq_pid
=
frame_subframe2_dl_harq_pid
(
cc
->
tdd_Config
,
frame
,
subframe
);
UE_sched_ctrl_t
*
ue_ctrl
=
&
UE_info
->
UE_sched_ctrl
[
UE_id
];
UE_sched_ctrl_t
*
ue_ctrl
=
&
UE_info
->
UE_sched_ctrl
[
UE_id
];
const
uint8_t
round
=
ue_ctrl
->
round
[
CC_id
][
harq_pid
];
const
uint8_t
round
=
ue_ctrl
->
round
[
CC_id
][
harq_pid
];
if
(
round
!=
8
)
{
// retransmission: allocate
if
(
round
!=
8
)
{
const
int
nb_rb
=
UE_info
->
UE_template
[
CC_id
][
UE_id
].
nb_rb
[
harq_pid
];
bool
r
=
try_allocate_harq_retransmission
(
Mod_id
,
CC_id
,
frame
,
subframe
,
if
(
nb_rb
==
0
)
UE_id
,
rbg
,
&
n_rbg_sched
,
continue
;
rbgalloc_mask
);
int
nb_rbg
=
(
nb_rb
+
(
nb_rb
%
RBGsize
))
/
RBGsize
;
if
(
r
)
{
// needs more RBGs than we can allocate
if
(
nb_rbg
>
n_rbg_sched
)
{
LOG_D
(
MAC
,
"retransmission of UE %d needs more RBGs (%d) than we have (%d)
\n
"
,
UE_id
,
nb_rbg
,
n_rbg_sched
);
continue
;
}
// ensure that the number of RBs can be contained by the RBGs (!), i.e.
// if we allocate the last RBG this one should have the full RBGsize
if
((
nb_rb
%
RBGsize
)
==
0
&&
nb_rbg
==
n_rbg_sched
&&
rbgalloc_mask
[
N_RBG
-
1
]
&&
RBGlastsize
!=
RBGsize
)
{
LOG_D
(
MAC
,
"retransmission of UE %d needs %d RBs, but the last RBG %d is too small (%d, normal %d)
\n
"
,
UE_id
,
nb_rb
,
N_RBG
-
1
,
RBGlastsize
,
RBGsize
);
continue
;
}
const
uint8_t
cqi
=
ue_ctrl
->
dl_cqi
[
CC_id
];
const
int
idx
=
CCE_try_allocate_dlsch
(
Mod_id
,
CC_id
,
subframe
,
UE_id
,
cqi
);
if
(
idx
<
0
)
continue
;
// cannot allocate CCE
ue_ctrl
->
pre_dci_dl_pdu_idx
=
idx
;
// retransmissions: directly allocate
n_rbg_sched
-=
nb_rbg
;
ue_ctrl
->
pre_nb_available_rbs
[
CC_id
]
+=
nb_rb
;
for
(;
nb_rbg
>
0
;
rbg
++
)
{
if
(
!
rbgalloc_mask
[
rbg
])
continue
;
ue_ctrl
->
rballoc_sub_UE
[
CC_id
][
rbg
]
=
1
;
rbgalloc_mask
[
rbg
]
=
0
;
nb_rbg
--
;
}
LOG_D
(
MAC
,
"%4d.%d n_rbg_sched %d after retransmission reservation for UE %d "
"round %d retx nb_rb %d pre_nb_available_rbs %d
\n
"
,
frame
,
subframe
,
n_rbg_sched
,
UE_id
,
round
,
UE_info
->
UE_template
[
CC_id
][
UE_id
].
nb_rb
[
harq_pid
],
ue_ctrl
->
pre_nb_available_rbs
[
CC_id
]);
/* if there are no more RBG to give, return */
/* if there are no more RBG to give, return */
if
(
n_rbg_sched
<=
0
)
if
(
n_rbg_sched
<=
0
)
return
0
;
return
0
;
max_num_ue
--
;
max_num_ue
--
;
/* if there are no UEs that can be allocated anymore, return */
if
(
max_num_ue
==
0
)
if
(
max_num_ue
==
0
)
return
n_rbg_sched
;
return
n_rbg_sched
;
for
(;
!
rbgalloc_mask
[
rbg
];
rbg
++
)
/* fast-forward */
;
for
(;
!
rbgalloc_mask
[
rbg
];
rbg
++
)
/* fast-forward */
;
}
}
else
{
}
else
{
if
(
UE_info
->
UE_template
[
CC_id
][
UE_id
].
dl_buffer_total
==
0
)
if
(
UE_info
->
UE_template
[
CC_id
][
UE_id
].
dl_buffer_total
==
0
)
continue
;
continue
;
...
@@ -436,56 +424,19 @@ int mt_wbcqi_dl_run(module_id_t Mod_id,
...
@@ -436,56 +424,19 @@ int mt_wbcqi_dl_run(module_id_t Mod_id,
const
uint8_t
harq_pid
=
frame_subframe2_dl_harq_pid
(
cc
->
tdd_Config
,
frame
,
subframe
);
const
uint8_t
harq_pid
=
frame_subframe2_dl_harq_pid
(
cc
->
tdd_Config
,
frame
,
subframe
);
UE_sched_ctrl_t
*
ue_ctrl
=
&
UE_info
->
UE_sched_ctrl
[
UE_id
];
UE_sched_ctrl_t
*
ue_ctrl
=
&
UE_info
->
UE_sched_ctrl
[
UE_id
];
const
uint8_t
round
=
ue_ctrl
->
round
[
CC_id
][
harq_pid
];
const
uint8_t
round
=
ue_ctrl
->
round
[
CC_id
][
harq_pid
];
if
(
round
!=
8
)
{
// retransmission: allocate
if
(
round
!=
8
)
{
const
int
nb_rb
=
UE_info
->
UE_template
[
CC_id
][
UE_id
].
nb_rb
[
harq_pid
];
bool
r
=
try_allocate_harq_retransmission
(
Mod_id
,
CC_id
,
frame
,
subframe
,
if
(
nb_rb
==
0
)
UE_id
,
rbg
,
&
n_rbg_sched
,
continue
;
rbgalloc_mask
);
int
nb_rbg
=
(
nb_rb
+
(
nb_rb
%
RBGsize
))
/
RBGsize
;
if
(
r
)
{
// needs more RBGs than we can allocate
if
(
nb_rbg
>
n_rbg_sched
)
{
LOG_D
(
MAC
,
"retransmission of UE %d needs more RBGs (%d) than we have (%d)
\n
"
,
UE_id
,
nb_rbg
,
n_rbg_sched
);
continue
;
}
// ensure that the number of RBs can be contained by the RBGs (!), i.e.
// if we allocate the last RBG this one should have the full RBGsize
if
((
nb_rb
%
RBGsize
)
==
0
&&
nb_rbg
==
n_rbg_sched
&&
rbgalloc_mask
[
N_RBG
-
1
]
&&
RBGlastsize
!=
RBGsize
)
{
LOG_D
(
MAC
,
"retransmission of UE %d needs %d RBs, but the last RBG %d is too small (%d, normal %d)
\n
"
,
UE_id
,
nb_rb
,
N_RBG
-
1
,
RBGlastsize
,
RBGsize
);
continue
;
}
const
uint8_t
cqi
=
ue_ctrl
->
dl_cqi
[
CC_id
];
const
int
idx
=
CCE_try_allocate_dlsch
(
Mod_id
,
CC_id
,
subframe
,
UE_id
,
cqi
);
if
(
idx
<
0
)
continue
;
// cannot allocate CCE
ue_ctrl
->
pre_dci_dl_pdu_idx
=
idx
;
// retransmissions: directly allocate
n_rbg_sched
-=
nb_rbg
;
ue_ctrl
->
pre_nb_available_rbs
[
CC_id
]
+=
nb_rb
;
for
(;
nb_rbg
>
0
;
rbg
++
)
{
if
(
!
rbgalloc_mask
[
rbg
])
continue
;
ue_ctrl
->
rballoc_sub_UE
[
CC_id
][
rbg
]
=
1
;
rbgalloc_mask
[
rbg
]
=
0
;
nb_rbg
--
;
}
LOG_D
(
MAC
,
"%4d.%d n_rbg_sched %d after retransmission reservation for UE %d "
"round %d retx nb_rb %d pre_nb_available_rbs %d
\n
"
,
frame
,
subframe
,
n_rbg_sched
,
UE_id
,
round
,
UE_info
->
UE_template
[
CC_id
][
UE_id
].
nb_rb
[
harq_pid
],
ue_ctrl
->
pre_nb_available_rbs
[
CC_id
]);
/* if there are no more RBG to give, return */
/* if there are no more RBG to give, return */
if
(
n_rbg_sched
<=
0
)
if
(
n_rbg_sched
<=
0
)
return
0
;
return
0
;
max_num_ue
--
;
max_num_ue
--
;
/* if there are no UEs that can be allocated anymore, return */
if
(
max_num_ue
==
0
)
if
(
max_num_ue
==
0
)
return
n_rbg_sched
;
return
n_rbg_sched
;
for
(;
!
rbgalloc_mask
[
rbg
];
rbg
++
)
/* fast-forward */
;
for
(;
!
rbgalloc_mask
[
rbg
];
rbg
++
)
/* fast-forward */
;
}
}
else
{
}
else
{
if
(
UE_info
->
UE_template
[
CC_id
][
UE_id
].
dl_buffer_total
==
0
)
if
(
UE_info
->
UE_template
[
CC_id
][
UE_id
].
dl_buffer_total
==
0
)
continue
;
continue
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment