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
2070c982
Commit
2070c982
authored
Jul 09, 2018
by
WEI-TAI CHEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding the NR MIB scheduler in eNB_ulsch_dlsch_scheduler, re-use LTE MAC
parent
b3f68c72
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
510 additions
and
530 deletions
+510
-530
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+2
-0
nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h
nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h
+8
-3
openair2/GNB_APP/gnb_app.c
openair2/GNB_APP/gnb_app.c
+1
-1
openair2/LAYER2/MAC/eNB_scheduler.c
openair2/LAYER2/MAC/eNB_scheduler.c
+10
-2
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
+253
-0
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
+125
-0
openair2/LAYER2/NR_MAC_gNB/mac.h
openair2/LAYER2/NR_MAC_gNB/mac.h
+39
-3
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+1
-1
openair2/LAYER2/NR_MAC_gNB/main.c
openair2/LAYER2/NR_MAC_gNB/main.c
+1
-1
openair2/RRC/NR/L2_nr_interface.c
openair2/RRC/NR/L2_nr_interface.c
+62
-0
openair2/RRC/NR/NR_L2_interface.c
openair2/RRC/NR/NR_L2_interface.c
+0
-519
openair2/RRC/NR/nr_rrc_proto.h
openair2/RRC/NR/nr_rrc_proto.h
+8
-0
No files found.
cmake_targets/CMakeLists.txt
View file @
2070c982
...
@@ -1396,6 +1396,7 @@ set(L2_SRC
...
@@ -1396,6 +1396,7 @@ set(L2_SRC
${
RRC_DIR
}
/L2_interface_ue.c
${
RRC_DIR
}
/L2_interface_ue.c
${
NR_RRC_DIR
}
/rrc_gNB.c
${
NR_RRC_DIR
}
/rrc_gNB.c
${
NR_RRC_DIR
}
/nr_rrc_common.c
${
NR_RRC_DIR
}
/nr_rrc_common.c
${
NR_RRC_DIR
}
/L2_nr_interface.c
)
)
set
(
L2_SRC_UE
set
(
L2_SRC_UE
...
@@ -1465,6 +1466,7 @@ set (MAC_SRC
...
@@ -1465,6 +1466,7 @@ set (MAC_SRC
${
NR_PHY_INTERFACE_DIR
}
/NR_IF_Module.c
${
NR_PHY_INTERFACE_DIR
}
/NR_IF_Module.c
${
NR_MAC_DIR
}
/main.c
${
NR_MAC_DIR
}
/main.c
${
NR_MAC_DIR
}
/config.c
${
NR_MAC_DIR
}
/config.c
${
NR_MAC_DIR
}
/gNB_scheduler_bch.c
)
)
set
(
MAC_SRC_UE
set
(
MAC_SRC_UE
...
...
nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h
View file @
2070c982
...
@@ -268,12 +268,17 @@ typedef struct{
...
@@ -268,12 +268,17 @@ typedef struct{
typedef
struct
{
typedef
struct
{
nfapi_tl_t
tl
;
nfapi_tl_t
tl
;
nfapi_nr_SearchSpaces_t
sib1searchSpace
;
uint16_t
length
;
nfapi_nr_ControlResourcesSets_t
sib1ControlResourceSets
;
uint16_t
pdu_index
;
uint16_t
transmission_power
;
}
nfapi_nr_dl_config_bch_pdu_rel15_t
;
}
nfapi_nr_dl_config_bch_pdu_rel15_t
;
#define NFAPI_NR_DL_CONFIG_REQUEST_BCH_PDU_REL15_TAG 0x5025
typedef
struct
{
typedef
struct
{
nfapi_tl_t
tl
;
nfapi_tl_t
tl
;
nfapi_nr_SearchSpaces_t
sib1searchSpace
;
nfapi_nr_ControlResourcesSets_t
sib1ControlResourceSets
;
nfapi_nr_SearchSpaces_t
sibssearchSpace
;
nfapi_nr_SearchSpaces_t
sibssearchSpace
;
nfapi_nr_ControlResourcesSets_t
sibsControlResourceSets
;
nfapi_nr_ControlResourcesSets_t
sibsControlResourceSets
;
nfapi_nr_SearchSpaces_t
ra_SearchSpace
;
nfapi_nr_SearchSpaces_t
ra_SearchSpace
;
...
@@ -319,7 +324,7 @@ typedef struct {
...
@@ -319,7 +324,7 @@ typedef struct {
uint8_t
number_dci
;
uint8_t
number_dci
;
uint16_t
number_pdu
;
uint16_t
number_pdu
;
uint8_t
number_pdsch_rnti
;
uint8_t
number_pdsch_rnti
;
nfapi_dl_config_request_pdu_t
*
dl_config_pdu_list
;
nfapi_
nr_
dl_config_request_pdu_t
*
dl_config_pdu_list
;
}
nfapi_nr_dl_config_request_body_t
;
}
nfapi_nr_dl_config_request_body_t
;
typedef
struct
{
typedef
struct
{
...
...
openair2/GNB_APP/gnb_app.c
View file @
2070c982
...
@@ -125,7 +125,7 @@ void *gNB_app_task(void *args_p)
...
@@ -125,7 +125,7 @@ void *gNB_app_task(void *args_p)
# if defined(ENABLE_USE_MME)
# if defined(ENABLE_USE_MME)
//uint32_t register_gnb_pending;
//uint32_t register_gnb_pending;
//uint32_t registered_gnb;
//uint32_t registered_gnb;
long
gnb_register_retry_timer_id
;
//
long gnb_register_retry_timer_id;
# endif
# endif
uint32_t
gnb_id
;
uint32_t
gnb_id
;
MessageDef
*
msg_p
=
NULL
;
MessageDef
*
msg_p
=
NULL
;
...
...
openair2/LAYER2/MAC/eNB_scheduler.c
View file @
2070c982
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac_proto.h"
#include "LAYER2/MAC/mac_proto.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "UTIL/OPT/opt.h"
...
@@ -42,6 +43,7 @@
...
@@ -42,6 +43,7 @@
#include "OCG_extern.h"
#include "OCG_extern.h"
#include "RRC/LTE/rrc_extern.h"
#include "RRC/LTE/rrc_extern.h"
#include "RRC/NR/nr_rrc_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
//#include "LAYER2/MAC/pre_processor.c"
//#include "LAYER2/MAC/pre_processor.c"
...
@@ -637,8 +639,14 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
...
@@ -637,8 +639,14 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
// This schedules MIB
// This schedules MIB
if
((
subframeP
==
0
)
&&
(
frameP
&
3
)
==
0
)
if
((
subframeP
==
0
)
&&
(
frameP
&
3
)
==
0
)
{
schedule_mib
(
module_idP
,
frameP
,
subframeP
);
schedule_mib
(
module_idP
,
frameP
,
subframeP
);
}
if
((
subframeP
==
0
)
&&
(
frameP
&
7
)
==
0
){
schedule_nr_mib
(
module_idP
,
frameP
,
subframeP
);
}
if
(
phy_test
==
0
){
if
(
phy_test
==
0
){
// This schedules SI for legacy LTE and eMTC starting in subframeP
// This schedules SI for legacy LTE and eMTC starting in subframeP
schedule_SI
(
module_idP
,
frameP
,
subframeP
);
schedule_SI
(
module_idP
,
frameP
,
subframeP
);
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
0 → 100644
View file @
2070c982
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file gNB_scheduler.c
* \brief gNB scheduler top level function operates on per subframe basis
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \email: navid.nikaein@eurecom.fr
* \version 0.5
* @ingroup _mac
*/
#include "assertions.h"
#include "LAYER2/MAC/mac.h"
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac_proto.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "OCG.h"
#include "OCG_extern.h"
#include "RRC/LTE/rrc_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
//Agent-related headers
#include "flexran_agent_extern.h"
#include "flexran_agent_mac.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "assertions.h"
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1
extern
RAN_CONTEXT_t
RC
;
extern
int
phy_test
;
uint16_t
pdcch_order_table
[
6
]
=
{
31
,
31
,
511
,
2047
,
2047
,
8191
};
void
gNB_dlsch_ulsch_scheduler
(
module_id_t
module_idP
,
frame_t
frameP
,
sub_frame_t
subframeP
)
{
int
mbsfn_status
[
MAX_NUM_CCs
];
protocol_ctxt_t
ctxt
;
int
CC_id
,
i
=
-
1
;
UE_list_t
*
UE_list
=
&
RC
.
mac
[
module_idP
]
->
UE_list
;
rnti_t
rnti
;
COMMON_channels_t
*
cc
=
RC
.
mac
[
module_idP
]
->
common_channels
;
start_meas
(
&
RC
.
mac
[
module_idP
]
->
eNB_scheduler
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER
,
VCD_FUNCTION_IN
);
RC
.
mac
[
module_idP
]
->
frame
=
frameP
;
RC
.
mac
[
module_idP
]
->
subframe
=
subframeP
;
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
mbsfn_status
[
CC_id
]
=
0
;
// clear vrb_maps
memset
(
cc
[
CC_id
].
vrb_map
,
0
,
100
);
memset
(
cc
[
CC_id
].
vrb_map_UL
,
0
,
100
);
#if defined(Rel10) || defined(Rel14)
cc
[
CC_id
].
mcch_active
=
0
;
#endif
clear_nfapi_information
(
RC
.
mac
[
module_idP
],
CC_id
,
frameP
,
subframeP
);
}
// refresh UE list based on UEs dropped by PHY in previous subframe
for
(
i
=
0
;
i
<
MAX_MOBILES_PER_ENB
;
i
++
)
{
if
(
UE_list
->
active
[
i
])
{
rnti
=
UE_RNTI
(
module_idP
,
i
);
CC_id
=
UE_PCCID
(
module_idP
,
i
);
if
(((
frameP
&
127
)
==
0
)
&&
(
subframeP
==
0
))
{
LOG_I
(
MAC
,
"UE rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d
\n
"
,
rnti
,
UE_list
->
UE_sched_ctrl
[
i
].
ul_out_of_sync
==
0
?
"in synch"
:
"out of sync"
,
UE_list
->
UE_template
[
CC_id
][
i
].
phr_info
,
UE_list
->
UE_sched_ctrl
[
i
].
dl_cqi
[
CC_id
],
(
UE_list
->
UE_sched_ctrl
[
i
].
pusch_snr
[
CC_id
]
-
128
)
/
2
,
(
UE_list
->
UE_sched_ctrl
[
i
].
pucch1_snr
[
CC_id
]
-
128
)
/
2
);
}
RC
.
eNB
[
module_idP
][
CC_id
]
->
pusch_stats_bsr
[
i
][(
frameP
*
10
)
+
subframeP
]
=
-
63
;
if
(
i
==
UE_list
->
head
)
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
(
VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR
,
RC
.
eNB
[
module_idP
][
CC_id
]
->
pusch_stats_bsr
[
i
][(
frameP
*
10
)
+
subframeP
]);
// increment this, it is cleared when we receive an sdu
RC
.
mac
[
module_idP
]
->
UE_list
.
UE_sched_ctrl
[
i
].
ul_inactivity_timer
++
;
RC
.
mac
[
module_idP
]
->
UE_list
.
UE_sched_ctrl
[
i
].
cqi_req_timer
++
;
LOG_D
(
MAC
,
"UE %d/%x : ul_inactivity %d, cqi_req %d
\n
"
,
i
,
rnti
,
RC
.
mac
[
module_idP
]
->
UE_list
.
UE_sched_ctrl
[
i
].
ul_inactivity_timer
,
RC
.
mac
[
module_idP
]
->
UE_list
.
UE_sched_ctrl
[
i
].
cqi_req_timer
);
check_ul_failure
(
module_idP
,
CC_id
,
i
,
frameP
,
subframeP
);
if
(
RC
.
mac
[
module_idP
]
->
UE_list
.
UE_sched_ctrl
[
i
].
ue_reestablishment_reject_timer
>
0
)
{
RC
.
mac
[
module_idP
]
->
UE_list
.
UE_sched_ctrl
[
i
].
ue_reestablishment_reject_timer
++
;
if
(
RC
.
mac
[
module_idP
]
->
UE_list
.
UE_sched_ctrl
[
i
].
ue_reestablishment_reject_timer
>=
RC
.
mac
[
module_idP
]
->
UE_list
.
UE_sched_ctrl
[
i
].
ue_reestablishment_reject_timer_thres
)
{
RC
.
mac
[
module_idP
]
->
UE_list
.
UE_sched_ctrl
[
i
].
ue_reestablishment_reject_timer
=
0
;
for
(
int
ue_id_l
=
0
;
ue_id_l
<
MAX_MOBILES_PER_ENB
;
ue_id_l
++
)
{
if
(
reestablish_rnti_map
[
ue_id_l
][
0
]
==
rnti
)
{
// clear currentC-RNTI from map
reestablish_rnti_map
[
ue_id_l
][
0
]
=
0
;
reestablish_rnti_map
[
ue_id_l
][
1
]
=
0
;
break
;
}
}
// Note: This should not be done in the MAC!
for
(
int
ii
=
0
;
ii
<
MAX_MOBILES_PER_ENB
;
ii
++
)
{
LTE_eNB_ULSCH_t
*
ulsch
=
RC
.
eNB
[
module_idP
][
CC_id
]
->
ulsch
[
ii
];
if
((
ulsch
!=
NULL
)
&&
(
ulsch
->
rnti
==
rnti
)){
LOG_I
(
MAC
,
"clean_eNb_ulsch UE %x
\n
"
,
rnti
);
clean_eNb_ulsch
(
ulsch
);
}
}
for
(
int
ii
=
0
;
ii
<
MAX_MOBILES_PER_ENB
;
ii
++
)
{
LTE_eNB_DLSCH_t
*
dlsch
=
RC
.
eNB
[
module_idP
][
CC_id
]
->
dlsch
[
ii
][
0
];
if
((
dlsch
!=
NULL
)
&&
(
dlsch
->
rnti
==
rnti
)){
LOG_I
(
MAC
,
"clean_eNb_dlsch UE %x
\n
"
,
rnti
);
clean_eNb_dlsch
(
dlsch
);
}
}
for
(
int
j
=
0
;
j
<
10
;
j
++
){
nfapi_ul_config_request_body_t
*
ul_req_tmp
=
NULL
;
ul_req_tmp
=
&
RC
.
mac
[
module_idP
]
->
UL_req_tmp
[
CC_id
][
j
].
ul_config_request_body
;
if
(
ul_req_tmp
){
int
pdu_number
=
ul_req_tmp
->
number_of_pdus
;
for
(
int
pdu_index
=
pdu_number
-
1
;
pdu_index
>=
0
;
pdu_index
--
){
if
(
ul_req_tmp
->
ul_config_pdu_list
[
pdu_index
].
ulsch_pdu
.
ulsch_pdu_rel8
.
rnti
==
rnti
){
LOG_I
(
MAC
,
"remove UE %x from ul_config_pdu_list %d/%d
\n
"
,
rnti
,
pdu_index
,
pdu_number
);
if
(
pdu_index
<
pdu_number
-
1
){
memcpy
(
&
ul_req_tmp
->
ul_config_pdu_list
[
pdu_index
],
&
ul_req_tmp
->
ul_config_pdu_list
[
pdu_index
+
1
],
(
pdu_number
-
1
-
pdu_index
)
*
sizeof
(
nfapi_ul_config_request_pdu_t
));
}
ul_req_tmp
->
number_of_pdus
--
;
}
}
}
}
rrc_mac_remove_ue
(
module_idP
,
rnti
);
}
}
}
}
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
module_idP
,
ENB_FLAG_YES
,
NOT_A_RNTI
,
frameP
,
subframeP
,
module_idP
);
pdcp_run
(
&
ctxt
);
rrc_rx_tx
(
&
ctxt
,
CC_id
);
#if defined(Rel10) || defined(Rel14)
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
if
(
cc
[
CC_id
].
MBMS_flag
>
0
)
{
start_meas
(
&
RC
.
mac
[
module_idP
]
->
schedule_mch
);
mbsfn_status
[
CC_id
]
=
schedule_MBMS
(
module_idP
,
CC_id
,
frameP
,
subframeP
);
stop_meas
(
&
RC
.
mac
[
module_idP
]
->
schedule_mch
);
}
}
#endif
// This schedules MIB
if
((
subframeP
==
0
)
&&
(
frameP
&
3
)
==
0
)
schedule_mib
(
module_idP
,
frameP
,
subframeP
);
if
(
phy_test
==
0
){
// This schedules SI for legacy LTE and eMTC starting in subframeP
schedule_SI
(
module_idP
,
frameP
,
subframeP
);
// This schedules Paging in subframeP
schedule_PCH
(
module_idP
,
frameP
,
subframeP
);
// This schedules Random-Access for legacy LTE and eMTC starting in subframeP
schedule_RA
(
module_idP
,
frameP
,
subframeP
);
// copy previously scheduled UL resources (ULSCH + HARQ)
copy_ulreq
(
module_idP
,
frameP
,
subframeP
);
// This schedules SRS in subframeP
schedule_SRS
(
module_idP
,
frameP
,
subframeP
);
// This schedules ULSCH in subframeP (dci0)
schedule_ulsch
(
module_idP
,
frameP
,
subframeP
);
// This schedules UCI_SR in subframeP
schedule_SR
(
module_idP
,
frameP
,
subframeP
);
// This schedules UCI_CSI in subframeP
schedule_CSI
(
module_idP
,
frameP
,
subframeP
);
// This schedules DLSCH in subframeP
schedule_dlsch
(
module_idP
,
frameP
,
subframeP
,
mbsfn_status
);
}
else
{
schedule_ulsch_phy_test
(
module_idP
,
frameP
,
subframeP
);
schedule_ue_spec_phy_test
(
module_idP
,
frameP
,
subframeP
,
mbsfn_status
);
}
if
(
RC
.
flexran
[
module_idP
]
->
enabled
)
flexran_agent_send_update_stats
(
module_idP
);
// Allocate CCEs for good after scheduling is done
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
allocate_CCEs
(
module_idP
,
CC_id
,
subframeP
,
0
);
stop_meas
(
&
RC
.
mac
[
module_idP
]
->
eNB_scheduler
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER
,
VCD_FUNCTION_OUT
);
}
\ No newline at end of file
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
0 → 100644
View file @
2070c982
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file eNB_scheduler_bch.c
* \brief procedures related to eNB for the BCH transport channel
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \email: navid.nikaein@eurecom.fr
* \version 1.0
* @ingroup _mac
*/
#include "assertions.h"
#include "LAYER2/NR_MAC_gNB/mac.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "LAYER2/MAC/mac_extern.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "OCG.h"
#include "OCG_extern.h"
#include "RRC/NR/nr_rrc_extern.h"
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1
#include "common/ran_context.h"
extern
RAN_CONTEXT_t
RC
;
void
schedule_nr_mib
(
module_id_t
module_idP
,
frame_t
frameP
,
sub_frame_t
subframeP
){
gNB_MAC_INST
*
gNB
=
RC
.
nrmac
[
module_idP
];
NR_COMMON_channels_t
*
cc
;
nfapi_nr_dl_config_request_t
*
dl_config_request
;
nfapi_nr_dl_config_request_body_t
*
dl_req
;
nfapi_nr_dl_config_request_pdu_t
*
dl_config_pdu
;
nfapi_tx_request_pdu_t
*
TX_req
;
int
mib_sdu_length
;
int
CC_id
;
uint16_t
sfn_sf
=
frameP
<<
4
|
subframeP
;
AssertFatal
(
subframeP
==
0
,
"Subframe must be 0
\n
"
);
AssertFatal
((
frameP
&
7
)
==
0
,
"Frame must be a multiple of 8
\n
"
);
for
(
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
dl_config_request
=
&
gNB
->
DL_req
[
CC_id
];
dl_req
=
&
dl_config_request
->
dl_config_request_body
;
cc
=
&
gNB
->
common_channels
[
CC_id
];
mib_sdu_length
=
mac_rrc_nr_data_req
(
module_idP
,
CC_id
,
frameP
,
MIBCH
,
1
,
&
cc
->
MIB_pdu
.
payload
[
0
]);
// not used in this case
LOG_D
(
MAC
,
"Frame %d, subframe %d: BCH PDU length %d
\n
"
,
frameP
,
subframeP
,
mib_sdu_length
);
if
(
mib_sdu_length
>
0
)
{
LOG_D
(
MAC
,
"Frame %d, subframe %d: Adding BCH PDU in position %d (length %d)
\n
"
,
frameP
,
subframeP
,
dl_req
->
number_pdu
,
mib_sdu_length
);
if
((
frameP
&
1023
)
<
80
){
LOG_D
(
MAC
,
"[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes
\n
"
,
module_idP
,
frameP
,
CC_id
,
mib_sdu_length
);
}
dl_config_pdu
=
&
dl_req
->
dl_config_pdu_list
[
dl_req
->
number_pdu
];
memset
((
void
*
)
dl_config_pdu
,
0
,
sizeof
(
nfapi_nr_dl_config_request_pdu_t
));
dl_config_pdu
->
pdu_type
=
NFAPI_DL_CONFIG_BCH_PDU_TYPE
;
dl_config_pdu
->
pdu_size
=
2
+
sizeof
(
nfapi_nr_dl_config_bch_pdu_rel15_t
);
dl_config_pdu
->
bch_pdu
.
tl
.
tag
=
NFAPI_NR_DL_CONFIG_REQUEST_BCH_PDU_REL15_TAG
;
dl_config_pdu
->
bch_pdu
.
length
=
mib_sdu_length
;
dl_config_pdu
->
bch_pdu
.
pdu_index
=
gNB
->
pdu_index
[
CC_id
];
dl_config_pdu
->
bch_pdu
.
transmission_power
=
6000
;
dl_req
->
tl
.
tag
=
NFAPI_DL_CONFIG_REQUEST_BODY_TAG
;
dl_req
->
number_pdu
++
;
dl_config_request
->
header
.
message_id
=
NFAPI_DL_CONFIG_REQUEST
;
dl_config_request
->
sfn_sf
=
sfn_sf
;
LOG_D
(
MAC
,
"gNB->DL_req[0].number_pdu %d (%p)
\n
"
,
dl_req
->
number_pdu
,
&
dl_req
->
number_pdu
);
// DL request
TX_req
=
&
gNB
->
TX_req
[
CC_id
].
tx_request_body
.
tx_pdu_list
[
gNB
->
TX_req
[
CC_id
].
tx_request_body
.
number_of_pdus
];
TX_req
->
pdu_length
=
3
;
TX_req
->
pdu_index
=
gNB
->
pdu_index
[
CC_id
]
++
;
TX_req
->
num_segments
=
1
;
TX_req
->
segments
[
0
].
segment_length
=
3
;
TX_req
->
segments
[
0
].
segment_data
=
cc
[
CC_id
].
MIB_pdu
.
payload
;
gNB
->
TX_req
[
CC_id
].
tx_request_body
.
number_of_pdus
++
;
gNB
->
TX_req
[
CC_id
].
sfn_sf
=
sfn_sf
;
gNB
->
TX_req
[
CC_id
].
tx_request_body
.
tl
.
tag
=
NFAPI_TX_REQUEST_BODY_TAG
;
gNB
->
TX_req
[
CC_id
].
header
.
message_id
=
NFAPI_TX_REQUEST
;
}
}
}
openair2/LAYER2/NR_MAC_gNB/mac.h
View file @
2070c982
...
@@ -58,6 +58,41 @@
...
@@ -58,6 +58,41 @@
#include "LAYER2/MAC/mac.h" // temporary
#include "LAYER2/MAC/mac.h" // temporary
/*! \brief eNB common channels */
typedef
struct
{
int
physCellId
;
int
p_gNB
;
int
Ncp
;
int
eutra_band
;
uint32_t
dl_CarrierFreq
;
NR_BCCH_BCH_Message_t
*
mib
;
TDD_Config_t
*
tdd_Config
;
ARFCN_ValueEUTRA_t
ul_CarrierFreq
;
long
ul_Bandwidth
;
/// Outgoing MIB PDU for PHY
MIB_PDU
MIB_pdu
;
/// Outgoing BCCH pdu for PHY
BCCH_PDU
BCCH_pdu
;
/// Outgoing BCCH DCI allocation
uint32_t
BCCH_alloc_pdu
;
/// Outgoing CCCH pdu for PHY
CCCH_PDU
CCCH_pdu
;
/// Outgoing PCCH DCI allocation
uint32_t
PCCH_alloc_pdu
;
/// Outgoing PCCH pdu for PHY
PCCH_PDU
PCCH_pdu
;
/// Outgoing RAR pdu for PHY
RAR_PDU
RAR_pdu
;
/// Template for RA computations
RA_t
ra
[
NB_RA_PROC_MAX
];
/// VRB map for common channels
uint8_t
vrb_map
[
100
];
/// VRB map for common channels and retransmissions by PHICH
uint8_t
vrb_map_UL
[
100
];
/// number of subframe allocation pattern available for MBSFN sync area
uint8_t
num_sf_allocation_pattern
;
}
NR_COMMON_channels_t
;
/*! \brief top level eNB MAC structure */
/*! \brief top level eNB MAC structure */
typedef
struct
gNB_MAC_INST_s
{
typedef
struct
gNB_MAC_INST_s
{
/// Ethernet parameters for northbound midhaul interface
/// Ethernet parameters for northbound midhaul interface
...
@@ -75,7 +110,7 @@ typedef struct gNB_MAC_INST_s {
...
@@ -75,7 +110,7 @@ typedef struct gNB_MAC_INST_s {
/// NFAPI Config Request Structure
/// NFAPI Config Request Structure
nfapi_nr_config_request_t
config
[
NFAPI_CC_MAX
];
nfapi_nr_config_request_t
config
[
NFAPI_CC_MAX
];
/// NFAPI DL Config Request Structure
/// NFAPI DL Config Request Structure
nfapi_
dl_config_request_t
DL_req
[
NFAPI_CC_MAX
];
nfapi_
nr_dl_config_request_t
DL_req
[
NFAPI_CC_MAX
];
/// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place
/// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place
nfapi_ul_config_request_t
UL_req
[
NFAPI_CC_MAX
];
nfapi_ul_config_request_t
UL_req
[
NFAPI_CC_MAX
];
/// Preallocated DL pdu list
/// Preallocated DL pdu list
...
@@ -87,8 +122,9 @@ typedef struct gNB_MAC_INST_s {
...
@@ -87,8 +122,9 @@ typedef struct gNB_MAC_INST_s {
/// NFAPI DL PDU structure
/// NFAPI DL PDU structure
nfapi_tx_request_t
TX_req
[
NFAPI_CC_MAX
];
nfapi_tx_request_t
TX_req
[
NFAPI_CC_MAX
];
/// Common cell resources
/// Common cell resources
COMMON_channels_t
common_channels
[
NFAPI_CC_MAX
];
NR_COMMON_channels_t
common_channels
[
NFAPI_CC_MAX
];
/// current PDU index (BCH,DLSCH)
uint16_t
pdu_index
[
NFAPI_CC_MAX
];
UE_list_t
UE_list
;
UE_list_t
UE_list
;
}
gNB_MAC_INST
;
}
gNB_MAC_INST
;
...
...
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
View file @
2070c982
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#include "mac.h"
#include "mac.h"
#include "PHY/defs_nr_common.h"
#include "PHY/defs_nr_common.h"
void
schedule_nr_mib
(
module_id_t
module_idP
,
frame_t
frameP
,
sub_frame_t
subframeP
);
void
mac_top_init_gNB
(
void
);
void
mac_top_init_gNB
(
void
);
...
...
openair2/LAYER2/NR_MAC_gNB/main.c
View file @
2070c982
...
@@ -45,7 +45,7 @@ extern RAN_CONTEXT_t RC;
...
@@ -45,7 +45,7 @@ extern RAN_CONTEXT_t RC;
void
mac_top_init_gNB
(
void
)
void
mac_top_init_gNB
(
void
)
{
{
module_id_t
i
,
j
;
module_id_t
i
;
int
list_el
;
int
list_el
;
UE_list_t
*
UE_list
;
UE_list_t
*
UE_list
;
gNB_MAC_INST
*
nrmac
;
gNB_MAC_INST
*
nrmac
;
...
...
openair2/RRC/NR/L2_nr_interface.c
0 → 100644
View file @
2070c982
#include "platform_types.h"
#include "rrc_defs.h"
#include "rrc_extern.h"
#include "UTIL/LOG/log.h"
#include "pdcp.h"
#include "msc.h"
#include "common/ran_context.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
extern
RAN_CONTEXT_t
RC
;
int8_t
mac_rrc_nr_data_req
(
const
module_id_t
Mod_idP
,
const
int
CC_id
,
const
frame_t
frameP
,
const
rb_id_t
Srb_id
,
const
uint8_t
Nb_tb
,
uint8_t
*
const
buffer_pP
){
asn_enc_rval_t
enc_rval
;
SRB_INFO
*
Srb_info
;
uint8_t
Sdu_size
=
0
;
uint8_t
sfn
=
(
uint8_t
)((
frameP
>>
2
)
&
0xff
);
#ifdef DEBUG_RRC
int
i
;
LOG_I
(
RRC
,
"[eNB %d] mac_rrc_data_req to SRB ID=%d
\n
"
,
Mod_idP
,
Srb_id
);
#endif
gNB_RRC_INST
*
rrc
;
rrc_gNB_carrier_data_t
*
carrier
;
NR_BCCH_BCH_Message_t
*
mib
;
rrc
=
RC
.
nrrrc
[
Mod_idP
];
carrier
=
&
rrc
->
carrier
[
0
];
mib
=
&
carrier
->
mib
;
if
(
(
Srb_id
&
RAB_OFFSET
)
==
MIBCH
)
{
mib
->
message
.
choice
.
mib
->
systemFrameNumber
.
buf
=
&
sfn
;
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_BCCH_BCH_Message
,
NULL
,
(
void
*
)
mib
,
carrier
->
MIB
,
24
);
LOG_D
(
RRC
,
"Encoded MIB for frame %d (%p), bits %lu
\n
"
,
sfn
,
carrier
->
MIB
,
enc_rval
.
encoded
);
buffer_pP
[
0
]
=
carrier
->
MIB
[
0
];
buffer_pP
[
1
]
=
carrier
->
MIB
[
1
];
buffer_pP
[
2
]
=
carrier
->
MIB
[
2
];
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
(
3
);
}
//BCCH SIB1 SIBs
//CCCH
return
(
0
);
}
\ No newline at end of file
openair2/RRC/NR/NR_L2_interface.c
deleted
100644 → 0
View file @
b3f68c72
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file l2_interface.c
* \brief layer 2 interface, used to support different RRC sublayer
* \author Raymond Knopp and Navid Nikaein
* \date 2010-2014
* \version 1.0
* \company Eurecom
* \email: raymond.knopp@eurecom.fr
*/
#include "platform_types.h"
//#include "openair_defs.h"
//#include "openair_proto.h"
#include "defs.h"
#include "extern.h"
//#include "mac_lchan_interface.h"
//#include "openair_rrc_utils.h"
//#include "openair_rrc_main.h"
#include "UTIL/LOG/log.h"
#include "rrc_eNB_UE_context.h"
#include "pdcp.h"
#include "msc.h"
#include "common/ran_context.h"
#ifdef PHY_EMUL
#include "SIMULATION/simulation_defs.h"
extern
EMULATION_VARS
*
Emul_vars
;
extern
eNB_MAC_INST
*
eNB_mac_inst
;
extern
UE_MAC_INST
*
UE_mac_inst
;
#endif
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
#include "flexran_agent_extern.h"
//#define RRC_DATA_REQ_DEBUG
//#define DEBUG_RRC 1
extern
RAN_CONTEXT_t
RC
;
//------------------------------------------------------------------------------
int8_t
mac_rrc_data_req
(
const
module_id_t
Mod_idP
,
const
int
CC_id
,
const
frame_t
frameP
,
const
rb_id_t
Srb_id
,
const
uint8_t
Nb_tb
,
uint8_t
*
const
buffer_pP
,
const
uint8_t
mbsfn_sync_area
)
//--------------------------------------------------------------------------
{
asn_enc_rval_t
enc_rval
;
SRB_INFO
*
Srb_info
;
uint8_t
Sdu_size
=
0
;
uint8_t
sfn
=
(
uint8_t
)((
frameP
>>
2
)
&
0xff
);
#ifdef DEBUG_RRC
int
i
;
LOG_I
(
RRC
,
"[eNB %d] mac_rrc_data_req to SRB ID=%d
\n
"
,
Mod_idP
,
Srb_id
);
#endif
eNB_RRC_INST
*
rrc
;
rrc_eNB_carrier_data_t
*
carrier
;
BCCH_BCH_Message_t
*
mib
;
rrc
=
RC
.
rrc
[
Mod_idP
];
carrier
=
&
rrc
->
carrier
[
0
];
mib
=
&
carrier
->
mib
;
if
((
Srb_id
&
RAB_OFFSET
)
==
BCCH
)
{
if
(
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
SI
.
Active
==
0
)
{
return
0
;
}
// All even frames transmit SIB in SF 5
AssertFatal
(
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_SIB1
!=
255
,
"[eNB %d] MAC Request for SIB1 and SIB1 not initialized
\n
"
,
Mod_idP
);
if
((
frameP
%
2
)
==
0
)
{
memcpy
(
&
buffer_pP
[
0
],
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
SIB1
,
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_SIB1
);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int sib1_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
if (sib1_size > sdu_size) {
LOG_E(RRC, "SIB1 SDU larger than BCCH SDU buffer size (%d, %d)", sib1_size, sdu_size);
sib1_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
sib1_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
#ifdef DEBUG_RRC
LOG_T
(
RRC
,
"[eNB %d] Frame %d : BCCH request => SIB 1
\n
"
,
Mod_idP
,
frameP
);
for
(
i
=
0
;
i
<
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_SIB1
;
i
++
)
{
LOG_T
(
RRC
,
"%x."
,
buffer_pP
[
i
]);
}
LOG_T
(
RRC
,
"
\n
"
);
#endif
return
(
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_SIB1
);
}
// All RFN mod 8 transmit SIB2-3 in SF 5
else
if
((
frameP
%
8
)
==
1
)
{
memcpy
(
&
buffer_pP
[
0
],
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
SIB23
,
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_SIB23
);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int sib23_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
if (sib23_size > sdu_size) {
LOG_E(RRC, "SIB23 SDU larger than BCCH SDU buffer size (%d, %d)", sib23_size, sdu_size);
sib23_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
sib23_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
#ifdef DEBUG_RRC
LOG_T
(
RRC
,
"[eNB %d] Frame %d BCCH request => SIB 2-3
\n
"
,
Mod_idP
,
frameP
);
for
(
i
=
0
;
i
<
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_SIB23
;
i
++
)
{
LOG_T
(
RRC
,
"%x."
,
buffer_pP
[
i
]);
}
LOG_T
(
RRC
,
"
\n
"
);
#endif
return
(
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_SIB23
);
}
else
{
return
(
0
);
}
}
if
(
(
Srb_id
&
RAB_OFFSET
)
==
MIBCH
)
{
mib
->
message
.
systemFrameNumber
.
buf
=
&
sfn
;
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_BCCH_BCH_Message
,
(
void
*
)
mib
,
carrier
->
MIB
,
24
);
LOG_D
(
RRC
,
"Encoded MIB for frame %d (%p), bits %lu
\n
"
,
sfn
,
carrier
->
MIB
,
enc_rval
.
encoded
);
buffer_pP
[
0
]
=
carrier
->
MIB
[
0
];
buffer_pP
[
1
]
=
carrier
->
MIB
[
1
];
buffer_pP
[
2
]
=
carrier
->
MIB
[
2
];
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
(
3
);
}
if
(
(
Srb_id
&
RAB_OFFSET
)
==
CCCH
)
{
LOG_T
(
RRC
,
"[eNB %d] Frame %d CCCH request (Srb_id %d)
\n
"
,
Mod_idP
,
frameP
,
Srb_id
);
if
(
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
Srb0
.
Active
==
0
)
{
LOG_E
(
RRC
,
"[eNB %d] CCCH Not active
\n
"
,
Mod_idP
);
return
-
1
;
}
Srb_info
=&
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
Srb0
;
// check if data is there for MAC
if
(
Srb_info
->
Tx_buffer
.
payload_size
>
0
)
{
//Fill buffer
LOG_D
(
RRC
,
"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)
\n
"
,
Mod_idP
,
Srb_info
,
Srb_info
->
Tx_buffer
.
payload_size
,
buffer_pP
,
Srb_info
->
Tx_buffer
.
Payload
);
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
int ccch_size = Srb_info->Tx_buffer.payload_size;
int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
if (ccch_size > sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
ccch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ);
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size);
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy
(
buffer_pP
,
Srb_info
->
Tx_buffer
.
Payload
,
Srb_info
->
Tx_buffer
.
payload_size
);
Sdu_size
=
Srb_info
->
Tx_buffer
.
payload_size
;
Srb_info
->
Tx_buffer
.
payload_size
=
0
;
}
return
(
Sdu_size
);
}
if
(
(
Srb_id
&
RAB_OFFSET
)
==
PCCH
)
{
LOG_T
(
RRC
,
"[eNB %d] Frame %d PCCH request (Srb_id %d)
\n
"
,
Mod_idP
,
frameP
,
Srb_id
);
// check if data is there for MAC
if
(
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_paging
[
mbsfn_sync_area
]
>
0
)
{
//Fill buffer
LOG_D
(
RRC
,
"[eNB %d] PCCH (%p) has %d bytes
\n
"
,
Mod_idP
,
&
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
paging
[
mbsfn_sync_area
],
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_paging
[
mbsfn_sync_area
]);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu);
if (pcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size);
pcch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ);
RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size;
memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE);
memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size);
RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy
(
buffer_pP
,
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
paging
[
mbsfn_sync_area
],
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_paging
[
mbsfn_sync_area
]);
Sdu_size
=
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_paging
[
mbsfn_sync_area
];
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_paging
[
mbsfn_sync_area
]
=
0
;
}
return
(
Sdu_size
);
}
#if defined(Rel10) || defined(Rel14)
if
((
Srb_id
&
RAB_OFFSET
)
==
MCCH
)
{
if
(
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
MCCH_MESS
[
mbsfn_sync_area
].
Active
==
0
)
{
return
0
;
// this parameter is set in function init_mcch in rrc_eNB.c
}
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
int mcch_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu);
if (mcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size);
mcch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ);
RRC_MAC_MCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size;
memset (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, 0, MCCH_SDU_SIZE);
memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
mcch_size);
RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index;
RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy
(
&
buffer_pP
[
0
],
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
MCCH_MESSAGE
[
mbsfn_sync_area
],
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_MCCH_MESSAGE
[
mbsfn_sync_area
]);
#ifdef DEBUG_RRC
LOG_D
(
RRC
,
"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE
\n
"
,
Mod_idP
,
frameP
);
for
(
i
=
0
;
i
<
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_MCCH_MESSAGE
[
mbsfn_sync_area
];
i
++
)
{
LOG_T
(
RRC
,
"%x."
,
buffer_pP
[
i
]);
}
LOG_T
(
RRC
,
"
\n
"
);
#endif
return
(
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_MCCH_MESSAGE
[
mbsfn_sync_area
]);
// }
//else
//return(0);
}
#endif //Rel10 || Rel14
#ifdef Rel14
if
((
Srb_id
&
RAB_OFFSET
)
==
BCCH_SIB1_BR
){
memcpy
(
&
buffer_pP
[
0
],
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
SIB1_BR
,
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_SIB1_BR
);
return
(
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_SIB1_BR
);
}
if
((
Srb_id
&
RAB_OFFSET
)
==
BCCH_SI_BR
){
// First SI message with SIB2/3
memcpy
(
&
buffer_pP
[
0
],
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
SIB23_BR
,
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_SIB23_BR
);
return
(
RC
.
rrc
[
Mod_idP
]
->
carrier
[
CC_id
].
sizeof_SIB23_BR
);
}
#endif
return
(
0
);
}
//------------------------------------------------------------------------------
int8_t
mac_rrc_data_ind
(
const
module_id_t
module_idP
,
const
int
CC_id
,
const
frame_t
frameP
,
const
sub_frame_t
sub_frameP
,
const
rnti_t
rntiP
,
const
rb_id_t
srb_idP
,
const
uint8_t
*
sduP
,
const
sdu_size_t
sdu_lenP
,
const
uint8_t
mbsfn_sync_areaP
)
//--------------------------------------------------------------------------
{
SRB_INFO
*
Srb_info
;
protocol_ctxt_t
ctxt
;
sdu_size_t
sdu_size
=
0
;
/* for no gcc warnings */
(
void
)
sdu_size
;
/*
int si_window;
*/
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
module_idP
,
ENB_FLAG_YES
,
rntiP
,
frameP
,
sub_frameP
,
0
);
Srb_info
=
&
RC
.
rrc
[
module_idP
]
->
carrier
[
CC_id
].
Srb0
;
LOG_D
(
RRC
,
"[eNB %d] Received SDU for CCCH on SRB %d
\n
"
,
module_idP
,
Srb_info
->
Srb_id
);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu);
if (sdu_lenP > msg_sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size);
sdu_size = msg_sdu_size;
} else {
sdu_size = sdu_lenP;
}
message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND);
RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP;
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
LOG_D(RRC,"[eNB %d] Sending message to RRC task\n",module_idP);
itti_send_msg_to_task (TASK_RRC_ENB, ctxt.instance, message_p);
}
#else
// msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id);
if
(
sdu_lenP
>
0
)
{
memcpy
(
Srb_info
->
Rx_buffer
.
Payload
,
sduP
,
sdu_lenP
);
Srb_info
->
Rx_buffer
.
payload_size
=
sdu_lenP
;
rrc_eNB_decode_ccch
(
&
ctxt
,
Srb_info
,
CC_id
);
}
#endif
return
(
0
);
}
//------------------------------------------------------------------------------
int
mac_eNB_get_rrc_status
(
const
module_id_t
Mod_idP
,
const
rnti_t
rntiP
)
//------------------------------------------------------------------------------
{
struct
rrc_eNB_ue_context_s
*
ue_context_p
=
NULL
;
ue_context_p
=
rrc_eNB_get_ue_context
(
RC
.
rrc
[
Mod_idP
],
rntiP
);
if
(
ue_context_p
!=
NULL
)
{
return
(
ue_context_p
->
ue_context
.
Status
);
}
else
{
return
RRC_INACTIVE
;
}
}
void
mac_eNB_rrc_ul_failure
(
const
module_id_t
Mod_instP
,
const
int
CC_idP
,
const
frame_t
frameP
,
const
sub_frame_t
subframeP
,
const
rnti_t
rntiP
)
{
struct
rrc_eNB_ue_context_s
*
ue_context_p
=
NULL
;
ue_context_p
=
rrc_eNB_get_ue_context
(
RC
.
rrc
[
Mod_instP
],
rntiP
);
if
(
ue_context_p
!=
NULL
)
{
LOG_I
(
RRC
,
"Frame %d, Subframe %d: UE %x UL failure, activating timer
\n
"
,
frameP
,
subframeP
,
rntiP
);
if
(
ue_context_p
->
ue_context
.
ul_failure_timer
==
0
)
ue_context_p
->
ue_context
.
ul_failure_timer
=
1
;
}
else
{
LOG_W
(
RRC
,
"Frame %d, Subframe %d: UL failure: UE %x unknown
\n
"
,
frameP
,
subframeP
,
rntiP
);
}
if
(
rrc_agent_registered
[
Mod_instP
])
{
agent_rrc_xface
[
Mod_instP
]
->
flexran_agent_notify_ue_state_change
(
Mod_instP
,
rntiP
,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED
);
}
// rrc_mac_remove_ue(Mod_instP,rntiP);
}
void
mac_eNB_rrc_uplane_failure
(
const
module_id_t
Mod_instP
,
const
int
CC_idP
,
const
frame_t
frameP
,
const
sub_frame_t
subframeP
,
const
rnti_t
rntiP
)
{
struct
rrc_eNB_ue_context_s
*
ue_context_p
=
NULL
;
ue_context_p
=
rrc_eNB_get_ue_context
(
RC
.
rrc
[
Mod_instP
],
rntiP
);
if
(
ue_context_p
!=
NULL
)
{
LOG_I
(
RRC
,
"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer
\n
"
,
frameP
,
subframeP
,
rntiP
);
if
(
ue_context_p
->
ue_context
.
ul_failure_timer
==
0
)
ue_context_p
->
ue_context
.
ul_failure_timer
=
19999
;
}
else
{
LOG_W
(
RRC
,
"Frame %d, Subframe %d: U-Plane failure: UE %x unknown
\n
"
,
frameP
,
subframeP
,
rntiP
);
}
}
void
mac_eNB_rrc_ul_in_sync
(
const
module_id_t
Mod_instP
,
const
int
CC_idP
,
const
frame_t
frameP
,
const
sub_frame_t
subframeP
,
const
rnti_t
rntiP
)
{
struct
rrc_eNB_ue_context_s
*
ue_context_p
=
NULL
;
ue_context_p
=
rrc_eNB_get_ue_context
(
RC
.
rrc
[
Mod_instP
],
rntiP
);
if
(
ue_context_p
!=
NULL
)
{
LOG_I
(
RRC
,
"Frame %d, Subframe %d: UE %x to UL in synch
\n
"
,
frameP
,
subframeP
,
rntiP
);
ue_context_p
->
ue_context
.
ul_failure_timer
=
0
;
}
else
{
LOG_E
(
RRC
,
"Frame %d, Subframe %d: UE %x unknown
\n
"
,
frameP
,
subframeP
,
rntiP
);
}
}
openair2/RRC/NR/nr_rrc_proto.h
View file @
2070c982
...
@@ -41,6 +41,14 @@ void rrc_config_nr_buffer(NR_SRB_INFO* Srb_info,
...
@@ -41,6 +41,14 @@ void rrc_config_nr_buffer(NR_SRB_INFO* Srb_info,
uint8_t
Lchan_type
,
uint8_t
Lchan_type
,
uint8_t
Role
);
uint8_t
Role
);
int8_t
mac_rrc_nr_data_req
(
const
module_id_t
Mod_idP
,
const
int
CC_id
,
const
frame_t
frameP
,
const
rb_id_t
Srb_id
,
const
uint8_t
Nb_tb
,
uint8_t
*
const
buffer_pP
);
#if defined(ENABLE_ITTI)
#if defined(ENABLE_ITTI)
/**\brief RRC eNB task.
/**\brief RRC eNB task.
\param void *args_p Pointer on arguments to start the task. */
\param void *args_p Pointer on arguments to start the task. */
...
...
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