Commit ec627f7c authored by Raymond Knopp's avatar Raymond Knopp

nr-ip-over-LTE: Add checks for noS1 use case (gNB side)

parent 46c8d181
......@@ -33,7 +33,7 @@
#include "mac_proto.h"
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
#include "PHY/NR_TRANSPORT/nr_dci.h"
#include "targets/RT/USER/lte-softmodem.h"
#include "executables/nr-softmodem.h"
extern RAN_CONTEXT_t RC;
/*Scheduling of DLSCH with associated DCI in common search space
......@@ -457,7 +457,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
memcpy(nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0],DLSCH_pdu.payload[0],TBS_bytes);
LOG_I(MAC, "Printing payload bytes at the gNB side: \n");
LOG_I(MAC, "Printing payload bytes at the gNB side, Frame: %d, slot: %d : \n", frameP, slotP);
for(int i = 0; i < TBS_bytes; i++) { //dlsch_pdu_rel15->transport_block_size/8 6784/8
LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
}
......@@ -480,6 +480,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
TBS_bytes = configure_fapi_dl_Tx(dl_req, TX_req, cfg, &nr_mac->coreset[CC_id][1], &nr_mac->search_space[CC_id][1], nr_mac->pdu_index[CC_id]);
// HOT FIX for all zero pdu problem
// ------------------------------------------------------------------------------------------------
LOG_I(MAC, "Printing payload bytes at the gNB side, Frame: %d, slot: %d : \n", frameP, slotP);
for(int i = 0; i < TBS_bytes; i++) {
((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i] = (unsigned char) rand();
LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
......
......@@ -40,6 +40,7 @@
//#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "common/ran_context.h"
#include "executables/nr-softmodem.h"
extern RAN_CONTEXT_t RC;
......@@ -127,6 +128,9 @@ void mac_top_init_gNB(void)
// These should be out of here later
pdcp_layer_init();
if(IS_SOFTMODEM_NOS1)
nr_ip_over_LTE_DRB_preconfiguration();
rrc_init_nr_global_param();
}else {
......
......@@ -358,7 +358,16 @@ boolean_t pdcp_data_req(
LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n",
rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type);
if (ctxt_pP->enb_flag == ENB_FLAG_YES && NODE_IS_DU(ngran_gNB)) { //RC.rrc[ctxt_pP->module_id]->node_type
// The check on nos1 is done only for the use case of LTE stack running over 5g-nr PHY. This should be changed
// before future merge of develop with develop-nr and instead of a check of IS_SOFTMODEM_NOS1, we should use a check
// with a new execution option capturing the nr-ip-over-LTE-stack use case.
ngran_node_t node_type;
if (IS_SOFTMODEM_NOS1)
node_type = ngran_gNB;
else
node_type = RC.rrc[ctxt_pP->module_id]->node_type;
if (ctxt_pP->enb_flag == ENB_FLAG_YES && NODE_IS_DU(node_type)) { //RC.rrc[ctxt_pP->module_id]->node_type
LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type);
ret=FALSE;
} else {
......@@ -2222,88 +2231,11 @@ void pdcp_module_cleanup (void)
{
}
//-----------------------------------------------------------------------------
void pdcp_layer_init(void)
//-----------------------------------------------------------------------------
{
module_id_t instance;
int i,j;
mbms_session_id_t session_id;
mbms_service_id_t service_id;
/*
* Initialize SDU list
*/
list_init(&pdcp_sdu_list, NULL);
pdcp_coll_p = hashtable_create ((LTE_maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, pdcp_free);
AssertFatal(pdcp_coll_p != NULL, "UNRECOVERABLE error, PDCP hashtable_create failed");
for (instance = 0; instance < MAX_MOBILES_PER_ENB; instance++) {
for (service_id = 0; service_id < LTE_maxServiceCount; service_id++) {
for (session_id = 0; session_id < LTE_maxSessionPerPMCH; session_id++) {
memset(&pdcp_mbms_array_ue[instance][service_id][session_id], 0, sizeof(pdcp_mbms_t));
}
}
pdcp_eNB_UE_instance_to_rnti[instance] = NOT_A_RNTI;
}
pdcp_eNB_UE_instance_to_rnti_index = 0;
for (instance = 0; instance < NUMBER_OF_eNB_MAX; instance++) {
for (service_id = 0; service_id < LTE_maxServiceCount; service_id++) {
for (session_id = 0; session_id < LTE_maxSessionPerPMCH; session_id++) {
memset(&pdcp_mbms_array_eNB[instance][service_id][session_id], 0, sizeof(pdcp_mbms_t));
}
}
}
#ifdef MBMS_MULTICAST_OUT
mbms_socket = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
if (mbms_socket == -1)
LOG_W(PDCP, "Could not create RAW socket, MBMS packets will not be put to the network\n");
#endif
LOG_I(PDCP, "PDCP layer has been initialized\n");
pdcp_output_sdu_bytes_to_write=0;
pdcp_output_header_bytes_to_write=0;
pdcp_input_sdu_remaining_size_to_read=0;
memset(pdcp_enb, 0, sizeof(pdcp_enb_t));
memset(Pdcp_stats_tx_window_ms, 0, sizeof(Pdcp_stats_tx_window_ms));
memset(Pdcp_stats_rx_window_ms, 0, sizeof(Pdcp_stats_rx_window_ms));
for (i = 0; i < MAX_eNB; i++) {
for (j = 0; j < MAX_MOBILES_PER_ENB; j++) {
Pdcp_stats_tx_window_ms[i][j]=100;
Pdcp_stats_rx_window_ms[i][j]=100;
}
}
memset(Pdcp_stats_tx, 0, sizeof(Pdcp_stats_tx));
memset(Pdcp_stats_tx_w, 0, sizeof(Pdcp_stats_tx_w));
memset(Pdcp_stats_tx_tmp_w, 0, sizeof(Pdcp_stats_tx_tmp_w));
memset(Pdcp_stats_tx_bytes, 0, sizeof(Pdcp_stats_tx_bytes));
memset(Pdcp_stats_tx_bytes_w, 0, sizeof(Pdcp_stats_tx_bytes_w));
memset(Pdcp_stats_tx_bytes_tmp_w, 0, sizeof(Pdcp_stats_tx_bytes_tmp_w));
memset(Pdcp_stats_tx_sn, 0, sizeof(Pdcp_stats_tx_sn));
memset(Pdcp_stats_tx_throughput_w, 0, sizeof(Pdcp_stats_tx_throughput_w));
memset(Pdcp_stats_tx_aiat, 0, sizeof(Pdcp_stats_tx_aiat));
memset(Pdcp_stats_tx_iat, 0, sizeof(Pdcp_stats_tx_iat));
memset(Pdcp_stats_rx, 0, sizeof(Pdcp_stats_rx));
memset(Pdcp_stats_rx_w, 0, sizeof(Pdcp_stats_rx_w));
memset(Pdcp_stats_rx_tmp_w, 0, sizeof(Pdcp_stats_rx_tmp_w));
memset(Pdcp_stats_rx_bytes, 0, sizeof(Pdcp_stats_rx_bytes));
memset(Pdcp_stats_rx_bytes_w, 0, sizeof(Pdcp_stats_rx_bytes_w));
memset(Pdcp_stats_rx_bytes_tmp_w, 0, sizeof(Pdcp_stats_rx_bytes_tmp_w));
memset(Pdcp_stats_rx_sn, 0, sizeof(Pdcp_stats_rx_sn));
memset(Pdcp_stats_rx_goodput_w, 0, sizeof(Pdcp_stats_rx_goodput_w));
memset(Pdcp_stats_rx_aiat, 0, sizeof(Pdcp_stats_rx_aiat));
memset(Pdcp_stats_rx_iat, 0, sizeof(Pdcp_stats_rx_iat));
memset(Pdcp_stats_rx_outoforder, 0, sizeof(Pdcp_stats_rx_outoforder));
void nr_ip_over_LTE_DRB_preconfiguration(void){
// Addition for the use-case of 4G stack on top of 5G-NR.
// We need to configure pdcp and rlc instances without having an actual
// UE RRC Connection. Just to be able to test the NR PHY with some injected traffic
// UE RRC Connection. In order to be able to test the NR PHY with some injected traffic
// on top of the LTE stack.
protocol_ctxt_t ctxt;
LTE_DRB_ToAddModList_t* DRB_configList=NULL;
......@@ -2367,21 +2299,6 @@ void pdcp_layer_init(void)
*logicalchannelgroup_drb = 1;//(i+1) % 3;
DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
// Have to dins out how to fill the DRB_config and then feed it back to the list
/*
if (DRB_configList != NULL) {
LOG_D(RRC, "get DRB_config from (ue_context_pP->ue_context.DRB_configList)\n");
for (i = 0; (i < DRB_configList->list.count) && (i < 3); i++) {
DRB_config = DRB_configList->list.array[i];
// Add DRB to DRB configuration list, for RRCConnectionReconfigurationComplete
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
}
}
*/
ASN_SEQUENCE_ADD(&DRB_configList->list,DRB_config);
if (ENB_NAS_USE_TUN){
......@@ -2396,21 +2313,99 @@ void pdcp_layer_init(void)
DRB_configList,
(LTE_DRB_ToReleaseList_t *) NULL,
0xff, NULL, NULL, NULL
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
, (LTE_PMCH_InfoList_r9_t *) NULL
//#endif
//#endif
,NULL);
rrc_rlc_config_asn1_req(&ctxt,
rrc_rlc_config_asn1_req(&ctxt,
(LTE_SRB_ToAddModList_t*)NULL,
DRB_configList,
(LTE_SRB_ToAddModList_t*)NULL
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
(LTE_DRB_ToReleaseList_t*)NULL
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
,(LTE_PMCH_InfoList_r9_t *)NULL
, 0, 0
//#endif
//#endif
);
}
//-----------------------------------------------------------------------------
void pdcp_layer_init(void)
//-----------------------------------------------------------------------------
{
module_id_t instance;
int i,j;
mbms_session_id_t session_id;
mbms_service_id_t service_id;
/*
* Initialize SDU list
*/
list_init(&pdcp_sdu_list, NULL);
pdcp_coll_p = hashtable_create ((LTE_maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, pdcp_free);
AssertFatal(pdcp_coll_p != NULL, "UNRECOVERABLE error, PDCP hashtable_create failed");
for (instance = 0; instance < MAX_MOBILES_PER_ENB; instance++) {
for (service_id = 0; service_id < LTE_maxServiceCount; service_id++) {
for (session_id = 0; session_id < LTE_maxSessionPerPMCH; session_id++) {
memset(&pdcp_mbms_array_ue[instance][service_id][session_id], 0, sizeof(pdcp_mbms_t));
}
}
pdcp_eNB_UE_instance_to_rnti[instance] = NOT_A_RNTI;
}
pdcp_eNB_UE_instance_to_rnti_index = 0;
for (instance = 0; instance < NUMBER_OF_eNB_MAX; instance++) {
for (service_id = 0; service_id < LTE_maxServiceCount; service_id++) {
for (session_id = 0; session_id < LTE_maxSessionPerPMCH; session_id++) {
memset(&pdcp_mbms_array_eNB[instance][service_id][session_id], 0, sizeof(pdcp_mbms_t));
}
}
}
#ifdef MBMS_MULTICAST_OUT
mbms_socket = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
if (mbms_socket == -1)
LOG_W(PDCP, "Could not create RAW socket, MBMS packets will not be put to the network\n");
#endif
LOG_I(PDCP, "PDCP layer has been initialized\n");
pdcp_output_sdu_bytes_to_write=0;
pdcp_output_header_bytes_to_write=0;
pdcp_input_sdu_remaining_size_to_read=0;
memset(pdcp_enb, 0, sizeof(pdcp_enb_t));
memset(Pdcp_stats_tx_window_ms, 0, sizeof(Pdcp_stats_tx_window_ms));
memset(Pdcp_stats_rx_window_ms, 0, sizeof(Pdcp_stats_rx_window_ms));
for (i = 0; i < MAX_eNB; i++) {
for (j = 0; j < MAX_MOBILES_PER_ENB; j++) {
Pdcp_stats_tx_window_ms[i][j]=100;
Pdcp_stats_rx_window_ms[i][j]=100;
}
}
memset(Pdcp_stats_tx, 0, sizeof(Pdcp_stats_tx));
memset(Pdcp_stats_tx_w, 0, sizeof(Pdcp_stats_tx_w));
memset(Pdcp_stats_tx_tmp_w, 0, sizeof(Pdcp_stats_tx_tmp_w));
memset(Pdcp_stats_tx_bytes, 0, sizeof(Pdcp_stats_tx_bytes));
memset(Pdcp_stats_tx_bytes_w, 0, sizeof(Pdcp_stats_tx_bytes_w));
memset(Pdcp_stats_tx_bytes_tmp_w, 0, sizeof(Pdcp_stats_tx_bytes_tmp_w));
memset(Pdcp_stats_tx_sn, 0, sizeof(Pdcp_stats_tx_sn));
memset(Pdcp_stats_tx_throughput_w, 0, sizeof(Pdcp_stats_tx_throughput_w));
memset(Pdcp_stats_tx_aiat, 0, sizeof(Pdcp_stats_tx_aiat));
memset(Pdcp_stats_tx_iat, 0, sizeof(Pdcp_stats_tx_iat));
memset(Pdcp_stats_rx, 0, sizeof(Pdcp_stats_rx));
memset(Pdcp_stats_rx_w, 0, sizeof(Pdcp_stats_rx_w));
memset(Pdcp_stats_rx_tmp_w, 0, sizeof(Pdcp_stats_rx_tmp_w));
memset(Pdcp_stats_rx_bytes, 0, sizeof(Pdcp_stats_rx_bytes));
memset(Pdcp_stats_rx_bytes_w, 0, sizeof(Pdcp_stats_rx_bytes_w));
memset(Pdcp_stats_rx_bytes_tmp_w, 0, sizeof(Pdcp_stats_rx_bytes_tmp_w));
memset(Pdcp_stats_rx_sn, 0, sizeof(Pdcp_stats_rx_sn));
memset(Pdcp_stats_rx_goodput_w, 0, sizeof(Pdcp_stats_rx_goodput_w));
memset(Pdcp_stats_rx_aiat, 0, sizeof(Pdcp_stats_rx_aiat));
memset(Pdcp_stats_rx_iat, 0, sizeof(Pdcp_stats_rx_iat));
memset(Pdcp_stats_rx_outoforder, 0, sizeof(Pdcp_stats_rx_outoforder));
}
//-----------------------------------------------------------------------------
......
......@@ -403,6 +403,7 @@ void pdcp_run (
const protocol_ctxt_t *const ctxt_pP);
uint64_t pdcp_module_init (uint64_t pdcp_optmask);
void pdcp_module_cleanup (void);
void nr_ip_over_LTE_DRB_preconfiguration (void);
void pdcp_layer_init (void);
void pdcp_layer_cleanup (void);
#define PDCP2NW_DRIVER_FIFO 21
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment