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
canghaiwuhen
OpenXG-RAN
Commits
aaf5aa3f
Commit
aaf5aa3f
authored
Mar 20, 2019
by
Nick Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean code at MAC and RRC layer
parent
22ddb6be
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
142 additions
and
409 deletions
+142
-409
openair2/LAYER2/MAC/config_NB_IoT.c
openair2/LAYER2/MAC/config_NB_IoT.c
+100
-274
openair2/LAYER2/MAC/config_NB_IoT.h
openair2/LAYER2/MAC/config_NB_IoT.h
+2
-4
openair2/LAYER2/MAC/defs_NB_IoT.h
openair2/LAYER2/MAC/defs_NB_IoT.h
+31
-62
openair2/LAYER2/MAC/eNB_scheduler_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_NB_IoT.c
+0
-1
openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
+1
-9
openair2/LAYER2/MAC/eNB_scheduler_dlsch_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_dlsch_NB_IoT.c
+3
-38
openair2/LAYER2/MAC/eNB_scheduler_ulsch_NB_IoT.c
openair2/LAYER2/MAC/eNB_scheduler_ulsch_NB_IoT.c
+5
-21
No files found.
openair2/LAYER2/MAC/config_NB_IoT.c
View file @
aaf5aa3f
This diff is collapsed.
Click to expand it.
openair2/LAYER2/MAC/config_NB_IoT.h
View file @
aaf5aa3f
...
...
@@ -2,17 +2,15 @@
/*! \file config_NB_IoT.h
* \brief configured structures used by scheduler
* \author NTUST BMW Lab./
* \date 201
7
* \date 201
9
* \email:
* \version
1
.0
* \version
2
.0
*
*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
//#include "NB_IoT_Message_definitions.h"
#define NUMBER_OF_SIBS_MAX_NB_IoT 6
///MIB
...
...
openair2/LAYER2/MAC/defs_NB_IoT.h
View file @
aaf5aa3f
...
...
@@ -21,7 +21,7 @@
/*! \file defs_NB_IoT.c
* \brief MAC layer structures
* \author NTUST BMW Lab./Nick HO, Xavier LIU, Calvin HSU
* \date 2017 - 201
8
* \date 2017 - 201
9
* \email: nick133371@gmail.com, sephiroth7277@gmail.com , kai-hsiang.hsu@eurecom.fr
* \version 1.0
*
...
...
@@ -150,33 +150,6 @@ typedef enum{
/*Index of PADDING logical channel*/
#define PADDING 31
/// NPRACH-ParametersList-NB_IoT-r13 from 36.331 RRC spec defined in PHY
/*typedef struct NPRACH_Parameters_NB_IoT{
/// the period time for nprach
int nprach_Periodicity;
/// for the start time for the NPRACH resource from 40ms-2560ms
int nprach_StartTime;
/// for the subcarrier of set to the NPRACH preamble from n0 - n34
int nprach_SubcarrierOffset;
///number of subcarriers in a NPRACH resource allowed values (n12,n24,n36,n48)
int nprach_NumSubcarriers;
/// where is the region that in NPRACH resource to indicate if this UE support MSG3 for multi-tone or not. from 0 - 1
int nprach_SubcarrierMSG3_RangeStart;
/// The max preamble transmission attempt for the CE level from 1 - 128
int maxNumPreambleAttemptCE;
/// Number of NPRACH repetitions per attempt for each NPRACH resource
int numRepetitionsPerPreambleAttempt;
/// The number of the repetition for DCI use in RAR/MSG3/MSG4 from 1 - 2048 (Rmax)
int npdcch_NumRepetitions_RA;
/// Starting subframe for NPDCCH Common searching space for (RAR/MSG3/MSG4)
int npdcch_StartSF_CSS_RA;
/// Fractional period offset of starting subframe for NPDCCH common search space
int npdcch_Offset_RA;
} nprach_parameters_NB_IoT_t;*/
/*! \brief Downlink SCH PDU Structure */
typedef
struct
{
uint8_t
payload
[
SCH_PAYLOAD_SIZE_MAX_NB_IoT
];
...
...
@@ -238,22 +211,23 @@ typedef struct {
}
UE_TEMPLATE_NB_IoT
;
// link list of uplink resource node
typedef
struct
available_resource_UL_s
{
///Resource start subframe
uint32_t
start_subframe
;
///Resource end subframe
uint32_t
end_subframe
;
// pointer to next node
struct
available_resource_UL_s
*
next
,
*
prev
;
///Resource start subframe
uint32_t
start_subframe
;
///Resource end subframe
uint32_t
end_subframe
;
//pointer to next and previous node
struct
available_resource_UL_s
*
next
,
*
prev
;
}
available_resource_UL_t
;
// link list of downlink resource node
typedef
struct
available_resource_DL_s
{
///Resource start subframe
uint32_t
start_subframe
;
///Resource end subframe
uint32_t
end_subframe
;
//uint32_t DLSF_num;
//pointer to next and previous node
struct
available_resource_DL_s
*
next
,
*
prev
;
}
available_resource_DL_t
;
...
...
@@ -271,13 +245,10 @@ typedef struct{
/*Structure used for UL scheduling*/
typedef
struct
{
//resource position info
.
//resource position info
, used subframe as unit
uint32_t
sf_end
,
sf_start
;
//resource position info. separate by HyperSF, Frame, Subframe
//uint32_t start_h, end_h;
//uint32_t start_f, end_f;
//uint32_t start_sf, end_sf;
// information for allocating the resource
// information for allocating the resource (to fill DCIN)
int
tone
;
int
scheduling_delay
;
int
subcarrier_indication
;
...
...
@@ -285,7 +256,6 @@ typedef struct{
available_resource_UL_t
*
node
;
}
sched_temp_UL_NB_IoT_t
;
/******Update******/
/*** the value of variable in this structure is able to be changed in Preprocessor**/
typedef
struct
{
...
...
@@ -333,7 +303,6 @@ typedef struct{
uint8_t
flag_schedule_success
;
}
UE_SCHED_CTRL_NB_IoT_t
;
/*36331 NPDCCH-ConfigDedicated-NB_IoT*/
typedef
struct
{
//npdcch-NumRepetitions-r13
...
...
@@ -369,9 +338,8 @@ typedef struct {
}
UE_list_NB_IoT_t
;
// scheduling flag calculated by computing flag function
typedef
struct
{
// flag to indicate scheduing MIB-NB_IoT
uint8_t
flag_MIB
;
// flag to indicate scheduling SIB1-NB_IoT
...
...
@@ -392,7 +360,6 @@ typedef struct{
uint8_t
num_type1_css_run
;
// number of the uss to schedule in this period
uint8_t
num_uss_run
;
}
scheduling_flag_t
;
/*!\brief MAC subheader short with 7bit Length field */
...
...
@@ -404,6 +371,7 @@ typedef struct {
uint8_t
L
:
7
;
// octet 2 LSB
uint8_t
F
:
1
;
// octet 2 MSB
}
__attribute__
((
__packed__
))
SCH_SUBHEADER_SHORT_NB_IoT
;
typedef
struct
{
uint8_t
LCID
:
5
;
// octet 1 LSB
uint8_t
E
:
1
;
...
...
@@ -413,6 +381,7 @@ typedef struct {
uint8_t
F
:
1
;
// octet 2 MSB
uint8_t
L_LSB
:
8
;
}
__attribute__
((
__packed__
))
SCH_SUBHEADER_LONG_NB_IoT
;
typedef
struct
{
uint8_t
LCID
:
5
;
// octet 1 LSB
uint8_t
E
:
1
;
...
...
@@ -421,6 +390,7 @@ typedef struct {
uint8_t
L_MSB
:
8
;
// octet 2 MSB
uint8_t
L_LSB
:
8
;
}
__attribute__
((
__packed__
))
SCH_SUBHEADER_LONG_EXTEND_NB_IoT
;
/*!\brief MAC subheader short without length field */
typedef
struct
{
uint8_t
LCID
:
5
;
...
...
@@ -447,22 +417,22 @@ typedef struct {
}
__attribute__
((
__packed__
))
RA_HEADER_RAPID_NB_IoT
;
typedef
struct
Available_
available_resource_DL
{
typedef
struct
Available_
resource_tones_UL_s
{
///Available Resoruce for sixtone
available_resource_UL_t
*
sixtone_Head
;
//, *sixtone_npusch_frame;
///Available Resoruce for sixtone
available_resource_UL_t
*
sixtone_Head
;
//, *sixtone_npusch_frame;
uint32_t
sixtone_end_subframe
;
///Available Resoruce for threetone
available_resource_UL_t
*
threetone_Head
;
//, *threetone_npusch_frame;
///Available Resoruce for threetone
available_resource_UL_t
*
threetone_Head
;
//, *threetone_npusch_frame;
uint32_t
threetone_end_subframe
;
///Available Resoruce for singletone1
available_resource_UL_t
*
singletone1_Head
;
//, *singletone1_npusch_frame;
///Available Resoruce for singletone1
available_resource_UL_t
*
singletone1_Head
;
//, *singletone1_npusch_frame;
uint32_t
singletone1_end_subframe
;
///Available Resoruce for singletone2
available_resource_UL_t
*
singletone2_Head
;
//, *singletone2_npusch_frame;
uint32_t
singletone2_end_subframe
;
///Available Resoruce for singletone2
available_resource_UL_t
*
singletone2_Head
;
//, *singletone2_npusch_frame;
uint32_t
singletone2_end_subframe
;
///Available Resoruce for singletone3
available_resource_UL_t
*
singletone3_Head
;
//, *singletone3_npusch_frame;
available_resource_UL_t
*
singletone3_Head
;
//, *singletone3_npusch_frame;
uint32_t
singletone3_end_subframe
;
}
available_resource_tones_UL_t
;
...
...
@@ -500,9 +470,8 @@ typedef struct schedule_result{
int16_t
dl_sdly
;
int16_t
ul_sdly
;
int16_t
num_sf
;
//-----clare
int16_t
harq_round
;
//-----clare
}
schedule_result_t
;
...
...
openair2/LAYER2/MAC/eNB_scheduler_NB_IoT.c
View file @
aaf5aa3f
...
...
@@ -50,7 +50,6 @@ void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t
*
common_flags
|=
flag_sib1
;
}
/* uint32_t type2_css_pp[3] = { type2_css_info[0]->npdcch_NumRepetitions_RA_r13*type2_css_info[0]->npdcch_StartSF_CSS_RA_r13, type2_css_info[1]->npdcch_NumRepetitions_RA_r13*type2_css_info[1]->npdcch_StartSF_CSS_RA_r13, type2_css_info[2]->npdcch_NumRepetitions_RA_r13*type2_css_info[2]->npdcch_StartSF_CSS_RA_r13 };*/
uint32_t
type2_css_pp
[
3
]
=
{
mac_inst
->
npdcch_config_common
[
0
].
R_max
*
mac_inst
->
npdcch_config_common
[
0
].
G
,
mac_inst
->
npdcch_config_common
[
1
].
R_max
*
mac_inst
->
npdcch_config_common
[
1
].
G
,
mac_inst
->
npdcch_config_common
[
2
].
R_max
*
mac_inst
->
npdcch_config_common
[
2
].
G
};
...
...
openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
View file @
aaf5aa3f
...
...
@@ -246,11 +246,10 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
dci_result
->
R_harq
=
0
;
dci_result
->
next
=
(
schedule_result_t
*
)
0
;
dci_result
->
DCI_pdu
=
(
void
*
)
dci_n1_rar
;
//----------clare
dci_result
->
dl_sdly
=
msg2_subframe
-
dci_end_subframe
;
dci_result
->
ul_sdly
=
msg3_subframe
-
msg2_end_subframe
;
dci_result
->
num_sf
=
msg2_end_subframe
-
msg2_subframe
+
1
;
//----------clare
// for msg2
msg2_result
->
output_subframe
=
msg2_first_subframe
;
//msg2_subframe;
msg2_result
->
end_subframe
=
msg2_end_subframe
;
...
...
@@ -266,10 +265,8 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
msg2_result
->
next
=
(
schedule_result_t
*
)
0
;
msg2_result
->
DCI_pdu
=
(
void
*
)
dci_n1_rar
;
msg2_result
->
rar_buffer
=
msg2_nodes
->
rar_buffer
;
//----------clare
msg2_result
->
dl_sdly
=
-
1
;
msg2_result
->
ul_sdly
=
-
1
;
//----------clare
// for msg3(fake DCI N0)
dci_n0
->
type
=
0
;
...
...
@@ -841,12 +838,10 @@ void schedule_msg4_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
dci_result
->
R_harq
=
0
;
dci_result
->
next
=
(
schedule_result_t
*
)
0
;
dci_result
->
DCI_pdu
=
(
void
*
)
dci_n1_msg4
;
//-------clare
dci_result
->
dl_sdly
=
msg4_subframe
-
dci_end_subframe
;
dci_result
->
ul_sdly
=
harq_subframe
-
msg4_end_subframe
;
dci_result
->
num_sf
=
msg4_end_subframe
-
msg4_subframe
+
1
;
dci_result
->
harq_round
=
msg4_nodes
->
msg4_retransmit_count
;
//-------clare
// for msg4
msg4_result
=
(
schedule_result_t
*
)
malloc
(
sizeof
(
schedule_result_t
));
...
...
@@ -937,9 +932,6 @@ void fill_rar_NB_IoT(
uint8_t
*
dlsch_buffer
=
&
ra_template
->
rar_buffer
[
0
];
RA_HEADER_RAPID_NB_IoT
*
rarh
=
(
RA_HEADER_RAPID_NB_IoT
*
)
dlsch_buffer
;
int
i
;
//,ra_idx = -1;
// uint16_t rballoc;
// uint8_t mcs,TPC,ULdelay,cqireq;
for
(
i
=
0
;
i
<
7
;
++
i
){
dlsch_buffer
[
i
]
=
0x0
;
...
...
openair2/LAYER2/MAC/eNB_scheduler_dlsch_NB_IoT.c
View file @
aaf5aa3f
...
...
@@ -44,13 +44,11 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
sched_temp_DL_NB_IoT_t
*
NPDSCH_info
=
(
sched_temp_DL_NB_IoT_t
*
)
malloc
(
sizeof
(
sched_temp_DL_NB_IoT_t
));
sched_temp_UL_NB_IoT_t
*
HARQ_info
=
(
sched_temp_UL_NB_IoT_t
*
)
malloc
(
sizeof
(
sched_temp_UL_NB_IoT_t
));
//Eric current remove it
//DCI N1
//DCIFormatN1_t *DCI_N1 = (DCIFormatN1_t*)malloc(sizeof(DCIFormatN1_t));
//RLC Status
//Eric
//mac_rlc_status_resp_NB_IoT_t rlc_status;
/*Index in DCI_N1*/
...
...
@@ -70,9 +68,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
//uint8_t sdu_temp[SCH_PAYLOAD_SIZE_MAX_NB_IoT];
//Eric
//logical_chan_id_t logical_channel;
//Eric
uint32_t
subheader_length
=
2
;
...
...
@@ -86,7 +82,6 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
//get max TBS
TBS
=
get_max_tbs
(
I_tbs
);
//Eric
if
(
UE_info
->
HARQ_round
==
0
)
{
flag_retransmission
=
0
;
...
...
@@ -97,7 +92,6 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
flag_retransmission
=
1
;
data_size
=
UE_info
->
DLSCH_pdu_size
;
}
//Eric
LOG_D
(
MAC
,
"[%04d][DLSchedulerUSS] Max TBS %d MCS index %d TBS index %d
\n
"
,
mac_inst
->
current_subframe
,
TBS
,
I_mcs
,
I_tbs
);
/*set UE data information*/
...
...
@@ -160,13 +154,11 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
LOG_D
(
MAC
,
"[%04d][DLSchedulerUSS] TBS change to %d because data size is smaller than previous TBS
\n
"
,
mac_inst
->
current_subframe
,
TBS
);
}
search_space_end_sf
=
cal_num_dlsf
(
mac_inst
,
hyperSF_start
,
frame_start
,
subframe_start
,
&
h_temp
,
&
f_temp
,
&
sf_temp
,
UE_info
->
R_max
);
LOG_D
(
MAC
,
"[%04d][DLSchedulerUSS] Search_space_start_sf %d Search_space_end_sf %d
\n
"
,
convert_system_number_sf
(
hyperSF_start
,
frame_start
,
subframe_start
),
mac_inst
->
current_subframe
,
search_space_end_sf
);
//LOG_D(MAC,"[%04d][DLSchedulerUSS][%d] Search_space_start_sf %d Search_space_end_sf %d\n", mac_inst->current_subframe, UE_info->rnti, mac_inst->current_subframe, convert_system_number_sf(hyperSF_start, frame_start, subframe_start), search_space_end_sf);
search_space_end_sf
=
cal_num_dlsf
(
mac_inst
,
hyperSF_start
,
frame_start
,
subframe_start
,
&
h_temp
,
&
f_temp
,
&
sf_temp
,
UE_info
->
R_max
);
LOG_D
(
MAC
,
"[%04d][DLSchedulerUSS] Search_space_start_sf %d Search_space_end_sf %d
\n
"
,
convert_system_number_sf
(
hyperSF_start
,
frame_start
,
subframe_start
),
mac_inst
->
current_subframe
,
search_space_end_sf
);
//LOG_D(MAC,"[%04d][DLSchedulerUSS][%d] Search_space_start_sf %d Search_space_end_sf %d\n", mac_inst->current_subframe, UE_info->rnti, mac_inst->current_subframe, convert_system_number_sf(hyperSF_start, frame_start, subframe_start), search_space_end_sf);
/*Loop all NPDCCH candidate position*/
//Eric
for
(
cdd_num
=
0
;
cdd_num
<
UE_info
->
R_max
/
UE_sched_ctrl_info
->
R_dci
;
++
cdd_num
)
//Eric
{
//LOG_D(MAC,"[%04d][DLSchedulerUSS] Candidate num %d DCI Rep %d\n",mac_inst->current_subframe, cdd_num, UE_sched_ctrl_info->R_dci);
/*Check NPDCCH Resource*/
...
...
@@ -183,9 +175,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
if
(
TBS
>
data_size
+
subheader_length
)
{
TBS
=
get_tbs
(
data_size
,
I_tbs
,
&
I_sf
);
//Eric
LOG_D
(
MAC
,
"[%04d][DLSchedulerUSS] [%d] data_size %d TBS change to %d
\n
"
,
mac_inst
->
current_subframe
,
UE_info
->
rnti
,
data_size
,
TBS
);
//Eric
}
...
...
@@ -235,16 +225,13 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
*/
//mac_sdu_size = mac_rlc_data_req_eNB_NB_IoT(module_id, UE_info->rnti, 0, frame_start, 0, DCCH0_NB_IoT, sdu_temp);
//Eric
//channel=DCCH0_NB_IoT;
//Eric
//Generate header
//payload_offset = generate_dlsch_header_NB_IoT(UE_info->DLSCH_pdu.payload, 1, &logical_channel, &mac_sdu_size, 0, 0, TBS);
//Complete MAC PDU
//memcpy(UE_info->DLSCH_pdu.payload+payload_offset, sdu_temp, mac_sdu_size);
//Eric
//UE_info->DLSCH_pdu.pdu_size=TBS;
UE_sched_ctrl_info
->
NPDCCH_sf_end
=
NPDCCH_info
->
sf_end
;
UE_sched_ctrl_info
->
NPDCCH_sf_start
=
NPDCCH_info
->
sf_start
;
...
...
@@ -260,7 +247,6 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
UE_sched_ctrl_info
->
dci_n1_index_delay
=
I_delay
;
UE_sched_ctrl_info
->
dci_n1_index_ack_nack
=
HARQ_info
->
ACK_NACK_resource_field
;
UE_sched_ctrl_info
->
total_data_size_dl
=
data_size
;
//Eric
}
LOG_D
(
MAC
,
"[%04d][DLSchedulerUSS][%d][Success] Complete scheduling with data size %d
\n
"
,
mac_inst
->
current_subframe
,
UE_info
->
rnti
,
data_size
);
//LOG_D(MAC,"[%04d][DLSchedulerUSS] RNTI %d\n", mac_inst->current_subframe, UE_info->rnti);
...
...
@@ -276,10 +262,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
//fill_DCI_N1(DCI_N1, UE_info, I_delay, I_sf, HARQ_info->ACK_NACK_resource_field);
//LOG_D(MAC,"[%04d][DLSchedulerUSS] HARQ index %d\n", HARQ_info->ACK_NACK_resource_field);
//Eric
//LOG_D(MAC,"[%04d][DLSchedulerUSS][%d] DCI N1 type:%d order:%d MCS:%d HARQ index:%d R:%d RscAssign:%d scheddly:%d DCI_R:%d\n", mac_inst->current_subframe, UE_info->rnti, DCI_N1->type, DCI_N1->orderIndicator, DCI_N1->mcs, DCI_N1->HARQackRes, DCI_N1->RepNum, DCI_N1->ResAssign, DCI_N1->Scheddly, DCI_N1->DCIRep);
//Eric
//Generate Scheduling result for this UE
//generate_scheduling_result_DL(NPDCCH_info->sf_start, NPDSCH_info->sf_start, HARQ_info->sf_start, DCI_N1, UE_info->rnti, TBS, UE_info->DLSCH_pdu.payload);
...
...
@@ -324,9 +307,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
//LOG_D(MAC,"[%04d][DLSchedulerUSS] Candidate %d no resource\n", mac_inst->current_subframe, cdd_num);
}
//Eric
UE_sched_ctrl_info
->
flag_schedule_success
=
0
;
//Eric
/*Resource allocate fail*/
if
((
end_flagCCH
==-
1
)
||
(
end_flagSCH
==-
1
)
||
(
end_flagHARQ
==-
1
))
...
...
@@ -334,9 +315,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
LOG_D
(
MAC
,
"[%04d][DLSchedulerUSS][%d][Fail] Resource allocate fail
\n
"
,
mac_inst
->
current_subframe
,
UE_info
->
rnti
);
LOG_D
(
MAC
,
"[%04d][DLSchedulerUSS][%d][Fail] Resource allocate fail
\n
"
,
mac_inst
->
current_subframe
,
UE_info
->
rnti
);
}
//Eric
return
-
1
;
//Eric
}
int
check_resource_NPDCCH_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
uint32_t
hyperSF_start
,
uint32_t
frame_start
,
uint32_t
subframe_start
,
sched_temp_DL_NB_IoT_t
*
NPDCCH_info
,
uint32_t
cdd_num
,
uint32_t
dci_rep
)
...
...
@@ -422,9 +401,7 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch
uint32_t
num_sdu_L_15
;
int32_t
padding_size
;
uint8_t
flag_end_padding
=
0
;
//Eric
SCH_SUBHEADER_FIXED_NB_IoT
*
mac_header
=
(
SCH_SUBHEADER_FIXED_NB_IoT
*
)
pdu
;
//Eric
uint32_t
offset
=
0
;
for
(
i
=
0
;
i
<
num_sdu
;
++
i
)
...
...
@@ -494,7 +471,6 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch
}
else
{
//Eric
if
(
sdu_length
[
i
]
<
128
)
{
((
SCH_SUBHEADER_SHORT_NB_IoT
*
)
mac_header
)
->
LCID
=
logical_channel
[
i
];
...
...
@@ -520,7 +496,6 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch
num_subheader
--
;
offset
+=
3
;
}
//Eric
}
}
if
(
flag_end_padding
==
1
)
...
...
@@ -545,9 +520,7 @@ void fill_DCI_N1(DCIFormatN1_t *DCI_N1, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT
DCI_N1
->
HARQackRes
=
UE_sched_ctrl_info
->
dci_n1_index_ack_nack
;
//DCI_N1->DCIRep = 3-UE_info->R_max/UE_info->R_dci/2;
DCI_N1
->
DCIRep
=
get_DCI_REP
(
UE_sched_ctrl_info
->
R_dci
,
UE_info
->
R_max
);
// Eric
LOG_D
(
MAC
,
"[fill_DCI_N1] Type %d order %d I_delay %d I_SF %d I_mcs %d I_rep %d I_harq %d I_dci %d
\n
"
,
DCI_N1
->
type
,
DCI_N1
->
orderIndicator
,
DCI_N1
->
Scheddly
,
DCI_N1
->
ResAssign
,
DCI_N1
->
mcs
,
DCI_N1
->
RepNum
,
DCI_N1
->
HARQackRes
,
DCI_N1
->
DCIRep
);
// Eric
}
...
...
@@ -684,9 +657,7 @@ void generate_scheduling_result_DL(uint32_t NPDCCH_sf_end, uint32_t NPDCCH_sf_st
/*HARQ scheduling result*/
// be the first node of UL
// be the first node of UL
// Eric
#if 1
// Eric
tmp1
=
NULL
;
tmp
=
NULL
;
if
(
schedule_result_list_UL
==
NULL
)
...
...
@@ -727,9 +698,7 @@ void generate_scheduling_result_DL(uint32_t NPDCCH_sf_end, uint32_t NPDCCH_sf_st
}
}
}
// Eric
#endif
// Eric
}
void
maintain_resource_DL
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
sched_temp_DL_NB_IoT_t
*
NPDCCH_info
,
sched_temp_DL_NB_IoT_t
*
NPDSCH_info
)
...
...
@@ -1048,14 +1017,11 @@ uint32_t get_I_mcs(int CE_level)
uint32_t
get_max_tbs
(
uint32_t
I_tbs
)
{
//Eric
return
MAC_TBStable_NB_IoT
[
I_tbs
][
7
]
/
8
;
//Eric
}
uint32_t
get_tbs
(
uint32_t
data_size
,
uint32_t
I_tbs
,
uint32_t
*
I_sf
)
{
//Eric
for
((
*
I_sf
)
=
0
;(
*
I_sf
)
<
8
;
++
(
*
I_sf
))
{
...
...
@@ -1067,7 +1033,6 @@ uint32_t get_tbs(uint32_t data_size, uint32_t I_tbs, uint32_t *I_sf)
}
LOG_D
(
MAC
,
"error
\n
"
);
return
0
;
//Eric
}
uint32_t
get_num_sf
(
uint32_t
I_sf
)
...
...
openair2/LAYER2/MAC/eNB_scheduler_ulsch_NB_IoT.c
View file @
aaf5aa3f
...
...
@@ -35,16 +35,12 @@ unsigned char str20[] = "DCI_uss";
unsigned
char
str21
[]
=
"DATA_uss"
;
// scheduling UL
//-------Daniel
int
schedule_UL_NB_IoT
(
eNB_MAC_INST_NB_IoT
*
mac_inst
,
UE_TEMPLATE_NB_IoT
*
UE_info
,
uint32_t
subframe
,
uint32_t
frame
,
uint32_t
H_SFN
,
UE_SCHED_CTRL_NB_IoT_t
*
UE_sched_ctrl_info
){
//-------Daniel
int
i
,
ndi
=
0
,
check_DCI_result
=
0
,
check_UL_result
=
0
,
candidate
;
uint32_t
DL_end
;
//Scheduling resource temp buffer
sched_temp_DL_NB_IoT_t
*
NPDCCH_info
=
(
sched_temp_DL_NB_IoT_t
*
)
malloc
(
sizeof
(
sched_temp_DL_NB_IoT_t
));
//-------Daniel
candidate
=
UE_info
->
R_max
/
UE_sched_ctrl_info
->
R_dci
;
//-------Daniel
uint32_t
mcs
=
max_mcs
[
UE_info
->
multi_tone
];
uint32_t
mappedMcsIndex
=
UE_info
->
PHR
+
(
4
*
UE_info
->
multi_tone
);
int
TBS
=
0
;
...
...
@@ -53,27 +49,20 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
if
(
UE_info
->
ul_total_buffer
<=
0
)
{
//------Daniel
LOG_D
(
MAC
,
"[%04d][ULSchedulerUSS][UE:%05d] No UL data in buffer
\n
"
,
mac_inst
->
current_subframe
,
UE_info
->
rnti
);
//------Daniel
return
-
1
;
}
TBS
=
get_TBS_UL_NB_IoT
(
mcs
,
UE_info
->
multi_tone
,
Iru
);
//-------Daniel
LOG_D
(
MAC
,
"Initial TBS : %d UL_buffer: %d
\n
"
,
TBS
,
UE_info
->
ul_total_buffer
);
//-------Daneil
sched_temp_UL_NB_IoT_t
*
NPUSCH_info
=
(
sched_temp_UL_NB_IoT_t
*
)
malloc
(
sizeof
(
sched_temp_UL_NB_IoT_t
));
//-------Daniel
//DCIFormatN0_t *DCI_N0 = (DCIFormatN0_t*)malloc(sizeof(DCIFormatN0_t));
//-------Daniel
//available_resource_DL_t *node;
// setting of the NDI
//-------Daniel
/*
if(UE_info->HARQ_round == 0)
{
...
...
@@ -81,7 +70,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
UE_info->oldNDI_UL=ndi;
}
*/
//-------Daniel
for
(
i
=
0
;
i
<
candidate
;
i
++
)
{
...
...
@@ -106,7 +94,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
mcs
=
mapped_mcs
[
UE_info
->
CE_level
][
mappedMcsIndex
];
//--------Daniel
if
(
UE_info
->
HARQ_round
==
0
)
{
...
...
@@ -124,7 +111,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
TBS
=
get_TBS_UL_NB_IoT
(
mcs
,
UE_info
->
multi_tone
,
Iru
);
}
}
//--------Daniel
//LOG_D(MAC,"TBS : %d MCS %d I_RU %d\n", TBS, UE_info->ul_total_buffer, mcs, Iru);
Nru
=
RU_table
[
Iru
];
...
...
@@ -143,11 +129,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
check_UL_result
=
Check_UL_resource
(
uplink_time
,
total_ru
,
NPUSCH_info
,
UE_info
->
multi_tone
,
0
);
if
(
check_UL_result
!=
-
1
)
{
//----Daniel
//----Daniel
//----Daniel
//LOG_D(MAC,"[%04d][UL scheduler][UE:%05d] DCI content = scind : %d ResAssign : %d mcs : %d ndi : %d scheddly : %d RepNum : %d rv : %d DCIRep : %d\n", mac_inst->current_subframe,UE_info->rnti,DCI_N0->scind,DCI_N0->ResAssign,DCI_N0->mcs,DCI_N0->ndi,DCI_N0->Scheddly,DCI_N0->RepNum,DCI_N0->rv,DCI_N0->DCIRep);
LOG_D
(
MAC
,
"[%04d][ULSchedulerUSS][%d][Success] complete scheduling with data size %d
\n
"
,
mac_inst
->
current_subframe
,
UE_info
->
rnti
,
UE_info
->
ul_total_buffer
);
LOG_D
(
MAC
,
"[%04d][ULSchedulerUSS][%d] Multi-tone:%d,MCS:%d,TBS:%d,UL_buffer:%d,DL_start:%d,DL_end:%d,N_rep:%d,N_ru:%d,Total_ru:%d
\n
"
,
mac_inst
->
current_subframe
,
UE_info
->
rnti
,
UE_info
->
multi_tone
,
mcs
,
TBS
,
UE_info
->
ul_total_buffer
,
NPDCCH_info
->
sf_start
,
DL_end
,
N_rep
,
Nru
,
total_ru
);
...
...
@@ -243,9 +225,13 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
break
;
case
SHORT_BSR
:
// update BSR here
LOG_I
(
MAC
,
"Update BSR, but still not implemented here
\n
"
);
UE_info
=
get_ue_from_rnti
(
mac_inst
,
rnti
);
BSR_index
=
payload_ptr
[
0
]
&
0x3f
;
UE_info
->
ul_total_buffer
=
BSR_table
[
BSR_index
];
if
(
UE_info
!=
NULL
)
UE_info
->
ul_total_buffer
=
BSR_table
[
BSR_index
];
else
LOG_E
(
MAC
,
"UE info empty
\n
"
);
payload_ptr
+=
1
;
break
;
default:
...
...
@@ -365,7 +351,6 @@ uint16_t length, ce_len=0;
return
(
mac_header_ptr
);
}
//------Daniel
void
fill_DCI_N0
(
DCIFormatN0_t
*
DCI_N0
,
UE_TEMPLATE_NB_IoT
*
UE_info
,
UE_SCHED_CTRL_NB_IoT_t
*
UE_sched_ctrl_info
)
{
DCI_N0
->
type
=
0
;
...
...
@@ -380,4 +365,3 @@ void fill_DCI_N0(DCIFormatN0_t *DCI_N0, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT
//DCI_N0->DCIRep = UE_sched_ctrl_info->dci_n0_index_R_dci;
LOG_D
(
MAC
,
"[fill_DCI_N0] Type %d scind %d I_ru %d I_mcs %d ndi %d I_delay %d I_rep %d RV %d I_dci %d
\n
"
,
DCI_N0
->
type
,
DCI_N0
->
scind
,
DCI_N0
->
ResAssign
,
DCI_N0
->
mcs
,
DCI_N0
->
ndi
,
DCI_N0
->
Scheddly
,
DCI_N0
->
RepNum
,
DCI_N0
->
rv
,
DCI_N0
->
DCIRep
);
}
//-----Daniel
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